1
2
3
4
5
6
7
8
9#ifndef REGS_H
10#define REGS_H
11
12#include <linux/types.h>
13#include <linux/bitops.h>
14#include <linux/io.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71extern bool caam_little_end;
72extern bool caam_imx;
73
74#define caam_to_cpu(len) \
75static inline u##len caam##len ## _to_cpu(u##len val) \
76{ \
77 if (caam_little_end) \
78 return le##len ## _to_cpu((__force __le##len)val); \
79 else \
80 return be##len ## _to_cpu((__force __be##len)val); \
81}
82
83#define cpu_to_caam(len) \
84static inline u##len cpu_to_caam##len(u##len val) \
85{ \
86 if (caam_little_end) \
87 return (__force u##len)cpu_to_le##len(val); \
88 else \
89 return (__force u##len)cpu_to_be##len(val); \
90}
91
92caam_to_cpu(16)
93caam_to_cpu(32)
94caam_to_cpu(64)
95cpu_to_caam(16)
96cpu_to_caam(32)
97cpu_to_caam(64)
98
99static inline void wr_reg32(void __iomem *reg, u32 data)
100{
101 if (caam_little_end)
102 iowrite32(data, reg);
103 else
104 iowrite32be(data, reg);
105}
106
107static inline u32 rd_reg32(void __iomem *reg)
108{
109 if (caam_little_end)
110 return ioread32(reg);
111
112 return ioread32be(reg);
113}
114
115static inline void clrsetbits_32(void __iomem *reg, u32 clear, u32 set)
116{
117 if (caam_little_end)
118 iowrite32((ioread32(reg) & ~clear) | set, reg);
119 else
120 iowrite32be((ioread32be(reg) & ~clear) | set, reg);
121}
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140#ifdef CONFIG_64BIT
141static inline void wr_reg64(void __iomem *reg, u64 data)
142{
143 if (caam_little_end)
144 iowrite64(data, reg);
145 else
146 iowrite64be(data, reg);
147}
148
149static inline u64 rd_reg64(void __iomem *reg)
150{
151 if (caam_little_end)
152 return ioread64(reg);
153 else
154 return ioread64be(reg);
155}
156
157#else
158static inline void wr_reg64(void __iomem *reg, u64 data)
159{
160 if (!caam_imx && caam_little_end) {
161 wr_reg32((u32 __iomem *)(reg) + 1, data >> 32);
162 wr_reg32((u32 __iomem *)(reg), data);
163 } else {
164 wr_reg32((u32 __iomem *)(reg), data >> 32);
165 wr_reg32((u32 __iomem *)(reg) + 1, data);
166 }
167}
168
169static inline u64 rd_reg64(void __iomem *reg)
170{
171 if (!caam_imx && caam_little_end)
172 return ((u64)rd_reg32((u32 __iomem *)(reg) + 1) << 32 |
173 (u64)rd_reg32((u32 __iomem *)(reg)));
174
175 return ((u64)rd_reg32((u32 __iomem *)(reg)) << 32 |
176 (u64)rd_reg32((u32 __iomem *)(reg) + 1));
177}
178#endif
179
180static inline u64 cpu_to_caam_dma64(dma_addr_t value)
181{
182 if (caam_imx)
183 return (((u64)cpu_to_caam32(lower_32_bits(value)) << 32) |
184 (u64)cpu_to_caam32(upper_32_bits(value)));
185
186 return cpu_to_caam64(value);
187}
188
189static inline u64 caam_dma64_to_cpu(u64 value)
190{
191 if (caam_imx)
192 return (((u64)caam32_to_cpu(lower_32_bits(value)) << 32) |
193 (u64)caam32_to_cpu(upper_32_bits(value)));
194
195 return caam64_to_cpu(value);
196}
197
198#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
199#define cpu_to_caam_dma(value) cpu_to_caam_dma64(value)
200#define caam_dma_to_cpu(value) caam_dma64_to_cpu(value)
201#else
202#define cpu_to_caam_dma(value) cpu_to_caam32(value)
203#define caam_dma_to_cpu(value) caam32_to_cpu(value)
204#endif
205
206
207
208
209
210struct jr_outentry {
211 dma_addr_t desc;
212 u32 jrstatus;
213} __packed;
214
215
216struct version_regs {
217 u32 crca;
218 u32 afha;
219 u32 kfha;
220 u32 pkha;
221 u32 aesa;
222 u32 mdha;
223 u32 desa;
224 u32 snw8a;
225 u32 snw9a;
226 u32 zuce;
227 u32 zuca;
228 u32 ccha;
229 u32 ptha;
230 u32 rng;
231 u32 trng;
232 u32 aaha;
233 u32 rsvd[10];
234 u32 sr;
235 u32 dma;
236 u32 ai;
237 u32 qi;
238 u32 jr;
239 u32 deco;
240};
241
242
243
244
245#define CHA_VER_NUM_MASK 0xffull
246
247#define CHA_VER_MISC_SHIFT 8
248#define CHA_VER_MISC_MASK (0xffull << CHA_VER_MISC_SHIFT)
249
250#define CHA_VER_REV_SHIFT 16
251#define CHA_VER_REV_MASK (0xffull << CHA_VER_REV_SHIFT)
252
253#define CHA_VER_VID_SHIFT 24
254#define CHA_VER_VID_MASK (0xffull << CHA_VER_VID_SHIFT)
255
256
257
258
259
260
261
262
263
264#define CHA_NUM_MS_DECONUM_SHIFT 24
265#define CHA_NUM_MS_DECONUM_MASK (0xfull << CHA_NUM_MS_DECONUM_SHIFT)
266
267
268
269
270
271
272
273#define CHA_ID_LS_AES_SHIFT 0
274#define CHA_ID_LS_AES_MASK (0xfull << CHA_ID_LS_AES_SHIFT)
275
276#define CHA_ID_LS_DES_SHIFT 4
277#define CHA_ID_LS_DES_MASK (0xfull << CHA_ID_LS_DES_SHIFT)
278
279#define CHA_ID_LS_ARC4_SHIFT 8
280#define CHA_ID_LS_ARC4_MASK (0xfull << CHA_ID_LS_ARC4_SHIFT)
281
282#define CHA_ID_LS_MD_SHIFT 12
283#define CHA_ID_LS_MD_MASK (0xfull << CHA_ID_LS_MD_SHIFT)
284
285#define CHA_ID_LS_RNG_SHIFT 16
286#define CHA_ID_LS_RNG_MASK (0xfull << CHA_ID_LS_RNG_SHIFT)
287
288#define CHA_ID_LS_SNW8_SHIFT 20
289#define CHA_ID_LS_SNW8_MASK (0xfull << CHA_ID_LS_SNW8_SHIFT)
290
291#define CHA_ID_LS_KAS_SHIFT 24
292#define CHA_ID_LS_KAS_MASK (0xfull << CHA_ID_LS_KAS_SHIFT)
293
294#define CHA_ID_LS_PK_SHIFT 28
295#define CHA_ID_LS_PK_MASK (0xfull << CHA_ID_LS_PK_SHIFT)
296
297#define CHA_ID_MS_CRC_SHIFT 0
298#define CHA_ID_MS_CRC_MASK (0xfull << CHA_ID_MS_CRC_SHIFT)
299
300#define CHA_ID_MS_SNW9_SHIFT 4
301#define CHA_ID_MS_SNW9_MASK (0xfull << CHA_ID_MS_SNW9_SHIFT)
302
303#define CHA_ID_MS_DECO_SHIFT 24
304#define CHA_ID_MS_DECO_MASK (0xfull << CHA_ID_MS_DECO_SHIFT)
305
306#define CHA_ID_MS_JR_SHIFT 28
307#define CHA_ID_MS_JR_MASK (0xfull << CHA_ID_MS_JR_SHIFT)
308
309
310#define CHA_VER_VID_AES_LP 0x3ull
311#define CHA_VER_VID_AES_HP 0x4ull
312#define CHA_VER_VID_MD_LP256 0x0ull
313#define CHA_VER_VID_MD_LP512 0x1ull
314#define CHA_VER_VID_MD_HP 0x2ull
315
316struct sec_vid {
317 u16 ip_id;
318 u8 maj_rev;
319 u8 min_rev;
320};
321
322struct caam_perfmon {
323
324 u64 req_dequeued;
325 u64 ob_enc_req;
326 u64 ib_dec_req;
327 u64 ob_enc_bytes;
328 u64 ob_prot_bytes;
329 u64 ib_dec_bytes;
330 u64 ib_valid_bytes;
331 u64 rsvd[13];
332
333
334 u32 cha_rev_ms;
335 u32 cha_rev_ls;
336#define CTPR_MS_QI_SHIFT 25
337#define CTPR_MS_QI_MASK (0x1ull << CTPR_MS_QI_SHIFT)
338#define CTPR_MS_DPAA2 BIT(13)
339#define CTPR_MS_VIRT_EN_INCL 0x00000001
340#define CTPR_MS_VIRT_EN_POR 0x00000002
341#define CTPR_MS_PG_SZ_MASK 0x10
342#define CTPR_MS_PG_SZ_SHIFT 4
343 u32 comp_parms_ms;
344 u32 comp_parms_ls;
345 u64 rsvd1[2];
346
347
348 u64 faultaddr;
349 u32 faultliodn;
350 u32 faultdetail;
351 u32 rsvd2;
352#define CSTA_PLEND BIT(10)
353#define CSTA_ALT_PLEND BIT(18)
354 u32 status;
355 u64 rsvd3;
356
357
358 u32 rtic_id;
359#define CCBVID_ERA_MASK 0xff000000
360#define CCBVID_ERA_SHIFT 24
361 u32 ccb_id;
362 u32 cha_id_ms;
363 u32 cha_id_ls;
364 u32 cha_num_ms;
365 u32 cha_num_ls;
366#define SECVID_MS_IPID_MASK 0xffff0000
367#define SECVID_MS_IPID_SHIFT 16
368#define SECVID_MS_MAJ_REV_MASK 0x0000ff00
369#define SECVID_MS_MAJ_REV_SHIFT 8
370 u32 caam_id_ms;
371 u32 caam_id_ls;
372};
373
374
375#define MSTRID_LOCK_LIODN 0x80000000
376#define MSTRID_LOCK_MAKETRUSTED 0x00010000
377
378#define MSTRID_LIODN_MASK 0x0fff
379struct masterid {
380 u32 liodn_ms;
381 u32 liodn_ls;
382};
383
384
385struct partid {
386 u32 rsvd1;
387 u32 pidr;
388};
389
390
391
392struct rngtst {
393 u32 mode;
394 u32 rsvd1[3];
395 u32 reset;
396 u32 rsvd2[3];
397 u32 status;
398 u32 rsvd3;
399 u32 errstat;
400 u32 rsvd4;
401 u32 errctl;
402 u32 rsvd5;
403 u32 entropy;
404 u32 rsvd6[15];
405 u32 verifctl;
406 u32 rsvd7;
407 u32 verifstat;
408 u32 rsvd8;
409 u32 verifdata;
410 u32 rsvd9;
411 u32 xkey;
412 u32 rsvd10;
413 u32 oscctctl;
414 u32 rsvd11;
415 u32 oscct;
416 u32 rsvd12;
417 u32 oscctstat;
418 u32 rsvd13[2];
419 u32 ofifo[4];
420 u32 rsvd14[15];
421};
422
423
424struct rng4tst {
425#define RTMCTL_PRGM 0x00010000
426#define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_SC 0
427
428
429#define RTMCTL_SAMP_MODE_RAW_ES_SC 1
430
431
432#define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_RAW_SC 2
433
434
435#define RTMCTL_SAMP_MODE_INVALID 3
436 u32 rtmctl;
437 u32 rtscmisc;
438 u32 rtpkrrng;
439 union {
440 u32 rtpkrmax;
441 u32 rtpkrsq;
442 };
443#define RTSDCTL_ENT_DLY_SHIFT 16
444#define RTSDCTL_ENT_DLY_MASK (0xffff << RTSDCTL_ENT_DLY_SHIFT)
445#define RTSDCTL_ENT_DLY_MIN 3200
446#define RTSDCTL_ENT_DLY_MAX 12800
447 u32 rtsdctl;
448 union {
449 u32 rtsblim;
450 u32 rttotsam;
451 };
452 u32 rtfrqmin;
453#define RTFRQMAX_DISABLE (1 << 20)
454 union {
455 u32 rtfrqmax;
456 u32 rtfrqcnt;
457 };
458 u32 rsvd1[40];
459#define RDSTA_SKVT 0x80000000
460#define RDSTA_SKVN 0x40000000
461#define RDSTA_IF0 0x00000001
462#define RDSTA_IF1 0x00000002
463#define RDSTA_IFMASK (RDSTA_IF1 | RDSTA_IF0)
464 u32 rdsta;
465 u32 rsvd2[15];
466};
467
468
469
470
471
472
473#define KEK_KEY_SIZE 8
474#define TKEK_KEY_SIZE 8
475#define TDSK_KEY_SIZE 8
476
477#define DECO_RESET 1
478#define DECO_RESET_0 (DECO_RESET << 0)
479#define DECO_RESET_1 (DECO_RESET << 1)
480#define DECO_RESET_2 (DECO_RESET << 2)
481#define DECO_RESET_3 (DECO_RESET << 3)
482#define DECO_RESET_4 (DECO_RESET << 4)
483
484struct caam_ctrl {
485
486
487 u32 rsvd1;
488 u32 mcr;
489 u32 rsvd2;
490 u32 scfgr;
491
492
493
494 struct masterid jr_mid[4];
495 u32 rsvd3[11];
496 u32 jrstart;
497 struct masterid rtic_mid[4];
498 u32 rsvd4[5];
499 u32 deco_rsr;
500 u32 rsvd11;
501 u32 deco_rq;
502 struct partid deco_mid[5];
503 u32 rsvd5[22];
504
505
506 u32 deco_avail;
507 u32 deco_reset;
508 u32 rsvd6[182];
509
510
511
512 u32 kek[KEK_KEY_SIZE];
513 u32 tkek[TKEK_KEY_SIZE];
514 u32 tdsk[TDSK_KEY_SIZE];
515 u32 rsvd7[32];
516 u64 sknonce;
517 u32 rsvd8[70];
518
519
520
521 union {
522 struct rngtst rtst[2];
523 struct rng4tst r4tst[2];
524 };
525
526 u32 rsvd9[416];
527
528
529 struct version_regs vreg;
530
531 struct caam_perfmon perfmon;
532};
533
534
535
536
537#define MCFGR_SWRESET 0x80000000
538#define MCFGR_WDENABLE 0x40000000
539#define MCFGR_WDFAIL 0x20000000
540#define MCFGR_DMA_RESET 0x10000000
541#define MCFGR_LONG_PTR 0x00010000
542#define SCFGR_RDBENABLE 0x00000400
543#define SCFGR_VIRT_EN 0x00008000
544#define DECORR_RQD0ENABLE 0x00000001
545#define DECORSR_JR0 0x00000001
546#define DECORSR_VALID 0x80000000
547#define DECORR_DEN0 0x00010000
548
549
550#define MCFGR_ARCACHE_SHIFT 12
551#define MCFGR_ARCACHE_MASK (0xf << MCFGR_ARCACHE_SHIFT)
552#define MCFGR_ARCACHE_BUFF (0x1 << MCFGR_ARCACHE_SHIFT)
553#define MCFGR_ARCACHE_CACH (0x2 << MCFGR_ARCACHE_SHIFT)
554#define MCFGR_ARCACHE_RALL (0x4 << MCFGR_ARCACHE_SHIFT)
555
556
557#define MCFGR_AWCACHE_SHIFT 8
558#define MCFGR_AWCACHE_MASK (0xf << MCFGR_AWCACHE_SHIFT)
559#define MCFGR_AWCACHE_BUFF (0x1 << MCFGR_AWCACHE_SHIFT)
560#define MCFGR_AWCACHE_CACH (0x2 << MCFGR_AWCACHE_SHIFT)
561#define MCFGR_AWCACHE_WALL (0x8 << MCFGR_AWCACHE_SHIFT)
562
563
564#define MCFGR_AXIPIPE_SHIFT 4
565#define MCFGR_AXIPIPE_MASK (0xf << MCFGR_AXIPIPE_SHIFT)
566
567#define MCFGR_AXIPRI 0x00000008
568#define MCFGR_LARGE_BURST 0x00000004
569#define MCFGR_BURST_64 0x00000001
570
571
572#define JRSTART_JR0_START 0x00000001
573#define JRSTART_JR1_START 0x00000002
574#define JRSTART_JR2_START 0x00000004
575#define JRSTART_JR3_START 0x00000008
576
577
578
579
580
581
582struct caam_job_ring {
583
584 u64 inpring_base;
585 u32 rsvd1;
586 u32 inpring_size;
587 u32 rsvd2;
588 u32 inpring_avail;
589 u32 rsvd3;
590 u32 inpring_jobadd;
591
592
593 u64 outring_base;
594 u32 rsvd4;
595 u32 outring_size;
596 u32 rsvd5;
597 u32 outring_rmvd;
598 u32 rsvd6;
599 u32 outring_used;
600
601
602 u32 rsvd7;
603 u32 jroutstatus;
604 u32 rsvd8;
605 u32 jrintstatus;
606 u32 rconfig_hi;
607 u32 rconfig_lo;
608
609
610 u32 rsvd9;
611 u32 inp_rdidx;
612 u32 rsvd10;
613 u32 out_wtidx;
614
615
616 u32 rsvd11;
617 u32 jrcommand;
618
619 u32 rsvd12[900];
620
621
622 struct version_regs vreg;
623
624 struct caam_perfmon perfmon;
625};
626
627#define JR_RINGSIZE_MASK 0x03ff
628
629
630
631
632
633
634#define JRSTA_SSRC_SHIFT 28
635#define JRSTA_SSRC_MASK 0xf0000000
636
637#define JRSTA_SSRC_NONE 0x00000000
638#define JRSTA_SSRC_CCB_ERROR 0x20000000
639#define JRSTA_SSRC_JUMP_HALT_USER 0x30000000
640#define JRSTA_SSRC_DECO 0x40000000
641#define JRSTA_SSRC_JRERROR 0x60000000
642#define JRSTA_SSRC_JUMP_HALT_CC 0x70000000
643
644#define JRSTA_DECOERR_JUMP 0x08000000
645#define JRSTA_DECOERR_INDEX_SHIFT 8
646#define JRSTA_DECOERR_INDEX_MASK 0xff00
647#define JRSTA_DECOERR_ERROR_MASK 0x00ff
648
649#define JRSTA_DECOERR_NONE 0x00
650#define JRSTA_DECOERR_LINKLEN 0x01
651#define JRSTA_DECOERR_LINKPTR 0x02
652#define JRSTA_DECOERR_JRCTRL 0x03
653#define JRSTA_DECOERR_DESCCMD 0x04
654#define JRSTA_DECOERR_ORDER 0x05
655#define JRSTA_DECOERR_KEYCMD 0x06
656#define JRSTA_DECOERR_LOADCMD 0x07
657#define JRSTA_DECOERR_STORECMD 0x08
658#define JRSTA_DECOERR_OPCMD 0x09
659#define JRSTA_DECOERR_FIFOLDCMD 0x0a
660#define JRSTA_DECOERR_FIFOSTCMD 0x0b
661#define JRSTA_DECOERR_MOVECMD 0x0c
662#define JRSTA_DECOERR_JUMPCMD 0x0d
663#define JRSTA_DECOERR_MATHCMD 0x0e
664#define JRSTA_DECOERR_SHASHCMD 0x0f
665#define JRSTA_DECOERR_SEQCMD 0x10
666#define JRSTA_DECOERR_DECOINTERNAL 0x11
667#define JRSTA_DECOERR_SHDESCHDR 0x12
668#define JRSTA_DECOERR_HDRLEN 0x13
669#define JRSTA_DECOERR_BURSTER 0x14
670#define JRSTA_DECOERR_DESCSIGNATURE 0x15
671#define JRSTA_DECOERR_DMA 0x16
672#define JRSTA_DECOERR_BURSTFIFO 0x17
673#define JRSTA_DECOERR_JRRESET 0x1a
674#define JRSTA_DECOERR_JOBFAIL 0x1b
675#define JRSTA_DECOERR_DNRERR 0x80
676#define JRSTA_DECOERR_UNDEFPCL 0x81
677#define JRSTA_DECOERR_PDBERR 0x82
678#define JRSTA_DECOERR_ANRPLY_LATE 0x83
679#define JRSTA_DECOERR_ANRPLY_REPLAY 0x84
680#define JRSTA_DECOERR_SEQOVF 0x85
681#define JRSTA_DECOERR_INVSIGN 0x86
682#define JRSTA_DECOERR_DSASIGN 0x87
683
684#define JRSTA_QIERR_ERROR_MASK 0x00ff
685
686#define JRSTA_CCBERR_JUMP 0x08000000
687#define JRSTA_CCBERR_INDEX_MASK 0xff00
688#define JRSTA_CCBERR_INDEX_SHIFT 8
689#define JRSTA_CCBERR_CHAID_MASK 0x00f0
690#define JRSTA_CCBERR_CHAID_SHIFT 4
691#define JRSTA_CCBERR_ERRID_MASK 0x000f
692
693#define JRSTA_CCBERR_CHAID_AES (0x01 << JRSTA_CCBERR_CHAID_SHIFT)
694#define JRSTA_CCBERR_CHAID_DES (0x02 << JRSTA_CCBERR_CHAID_SHIFT)
695#define JRSTA_CCBERR_CHAID_ARC4 (0x03 << JRSTA_CCBERR_CHAID_SHIFT)
696#define JRSTA_CCBERR_CHAID_MD (0x04 << JRSTA_CCBERR_CHAID_SHIFT)
697#define JRSTA_CCBERR_CHAID_RNG (0x05 << JRSTA_CCBERR_CHAID_SHIFT)
698#define JRSTA_CCBERR_CHAID_SNOW (0x06 << JRSTA_CCBERR_CHAID_SHIFT)
699#define JRSTA_CCBERR_CHAID_KASUMI (0x07 << JRSTA_CCBERR_CHAID_SHIFT)
700#define JRSTA_CCBERR_CHAID_PK (0x08 << JRSTA_CCBERR_CHAID_SHIFT)
701#define JRSTA_CCBERR_CHAID_CRC (0x09 << JRSTA_CCBERR_CHAID_SHIFT)
702
703#define JRSTA_CCBERR_ERRID_NONE 0x00
704#define JRSTA_CCBERR_ERRID_MODE 0x01
705#define JRSTA_CCBERR_ERRID_DATASIZ 0x02
706#define JRSTA_CCBERR_ERRID_KEYSIZ 0x03
707#define JRSTA_CCBERR_ERRID_PKAMEMSZ 0x04
708#define JRSTA_CCBERR_ERRID_PKBMEMSZ 0x05
709#define JRSTA_CCBERR_ERRID_SEQUENCE 0x06
710#define JRSTA_CCBERR_ERRID_PKDIVZRO 0x07
711#define JRSTA_CCBERR_ERRID_PKMODEVN 0x08
712#define JRSTA_CCBERR_ERRID_KEYPARIT 0x09
713#define JRSTA_CCBERR_ERRID_ICVCHK 0x0a
714#define JRSTA_CCBERR_ERRID_HARDWARE 0x0b
715#define JRSTA_CCBERR_ERRID_CCMAAD 0x0c
716#define JRSTA_CCBERR_ERRID_INVCHA 0x0f
717
718#define JRINT_ERR_INDEX_MASK 0x3fff0000
719#define JRINT_ERR_INDEX_SHIFT 16
720#define JRINT_ERR_TYPE_MASK 0xf00
721#define JRINT_ERR_TYPE_SHIFT 8
722#define JRINT_ERR_HALT_MASK 0xc
723#define JRINT_ERR_HALT_SHIFT 2
724#define JRINT_ERR_HALT_INPROGRESS 0x4
725#define JRINT_ERR_HALT_COMPLETE 0x8
726#define JRINT_JR_ERROR 0x02
727#define JRINT_JR_INT 0x01
728
729#define JRINT_ERR_TYPE_WRITE 1
730#define JRINT_ERR_TYPE_BAD_INPADDR 3
731#define JRINT_ERR_TYPE_BAD_OUTADDR 4
732#define JRINT_ERR_TYPE_INV_INPWRT 5
733#define JRINT_ERR_TYPE_INV_OUTWRT 6
734#define JRINT_ERR_TYPE_RESET 7
735#define JRINT_ERR_TYPE_REMOVE_OFL 8
736#define JRINT_ERR_TYPE_ADD_OFL 9
737
738#define JRCFG_SOE 0x04
739#define JRCFG_ICEN 0x02
740#define JRCFG_IMSK 0x01
741#define JRCFG_ICDCT_SHIFT 8
742#define JRCFG_ICTT_SHIFT 16
743
744#define JRCR_RESET 0x01
745
746
747
748
749
750
751struct rtic_element {
752 u64 address;
753 u32 rsvd;
754 u32 length;
755};
756
757struct rtic_block {
758 struct rtic_element element[2];
759};
760
761struct rtic_memhash {
762 u32 memhash_be[32];
763 u32 memhash_le[32];
764};
765
766struct caam_assurance {
767
768 u32 rsvd1;
769 u32 status;
770 u32 rsvd2;
771 u32 cmd;
772 u32 rsvd3;
773 u32 ctrl;
774 u32 rsvd4;
775 u32 throttle;
776 u32 rsvd5[2];
777 u64 watchdog;
778 u32 rsvd6;
779 u32 rend;
780 u32 rsvd7[50];
781
782
783 struct rtic_block memblk[4];
784 u32 rsvd8[32];
785
786
787 struct rtic_memhash hash[4];
788 u32 rsvd_3[640];
789};
790
791
792
793
794
795
796struct caam_queue_if {
797 u32 qi_control_hi;
798 u32 qi_control_lo;
799 u32 rsvd1;
800 u32 qi_status;
801 u32 qi_deq_cfg_hi;
802 u32 qi_deq_cfg_lo;
803 u32 qi_enq_cfg_hi;
804 u32 qi_enq_cfg_lo;
805 u32 rsvd2[1016];
806};
807
808
809#define QICTL_DQEN 0x01
810#define QICTL_STOP 0x02
811#define QICTL_SOE 0x04
812
813
814#define QICTL_MBSI 0x01
815#define QICTL_MHWSI 0x02
816#define QICTL_MWSI 0x04
817#define QICTL_MDWSI 0x08
818#define QICTL_CBSI 0x10
819#define QICTL_CHWSI 0x20
820#define QICTL_CWSI 0x40
821#define QICTL_CDWSI 0x80
822#define QICTL_MBSO 0x0100
823#define QICTL_MHWSO 0x0200
824#define QICTL_MWSO 0x0400
825#define QICTL_MDWSO 0x0800
826#define QICTL_CBSO 0x1000
827#define QICTL_CHWSO 0x2000
828#define QICTL_CWSO 0x4000
829#define QICTL_CDWSO 0x8000
830#define QICTL_DMBS 0x010000
831#define QICTL_EPO 0x020000
832
833
834#define QISTA_PHRDERR 0x01
835#define QISTA_CFRDERR 0x02
836#define QISTA_OFWRERR 0x04
837#define QISTA_BPDERR 0x08
838#define QISTA_BTSERR 0x10
839#define QISTA_CFWRERR 0x20
840#define QISTA_STOPD 0x80000000
841
842
843struct deco_sg_table {
844 u64 addr;
845 u32 elen;
846 u32 bpid_offset;
847};
848
849
850
851
852
853
854
855
856
857
858struct caam_deco {
859 u32 rsvd1;
860 u32 cls1_mode;
861 u32 rsvd2;
862 u32 cls1_keysize;
863 u32 cls1_datasize_hi;
864 u32 cls1_datasize_lo;
865 u32 rsvd3;
866 u32 cls1_icvsize;
867 u32 rsvd4[5];
868 u32 cha_ctrl;
869 u32 rsvd5;
870 u32 irq_crtl;
871 u32 rsvd6;
872 u32 clr_written;
873 u32 ccb_status_hi;
874 u32 ccb_status_lo;
875 u32 rsvd7[3];
876 u32 aad_size;
877 u32 rsvd8;
878 u32 cls1_iv_size;
879 u32 rsvd9[7];
880 u32 pkha_a_size;
881 u32 rsvd10;
882 u32 pkha_b_size;
883 u32 rsvd11;
884 u32 pkha_n_size;
885 u32 rsvd12;
886 u32 pkha_e_size;
887 u32 rsvd13[24];
888 u32 cls1_ctx[16];
889 u32 rsvd14[48];
890 u32 cls1_key[8];
891 u32 rsvd15[121];
892 u32 cls2_mode;
893 u32 rsvd16;
894 u32 cls2_keysize;
895 u32 cls2_datasize_hi;
896 u32 cls2_datasize_lo;
897 u32 rsvd17;
898 u32 cls2_icvsize;
899 u32 rsvd18[56];
900 u32 cls2_ctx[18];
901 u32 rsvd19[46];
902 u32 cls2_key[32];
903 u32 rsvd20[84];
904 u32 inp_infofifo_hi;
905 u32 inp_infofifo_lo;
906 u32 rsvd21[2];
907 u64 inp_datafifo;
908 u32 rsvd22[2];
909 u64 out_datafifo;
910 u32 rsvd23[2];
911 u32 jr_ctl_hi;
912 u32 jr_ctl_lo;
913 u64 jr_descaddr;
914#define DECO_OP_STATUS_HI_ERR_MASK 0xF00000FF
915 u32 op_status_hi;
916 u32 op_status_lo;
917 u32 rsvd24[2];
918 u32 liodn;
919 u32 td_liodn;
920 u32 rsvd26[6];
921 u64 math[4];
922 u32 rsvd27[8];
923 struct deco_sg_table gthr_tbl[4];
924 u32 rsvd28[16];
925 struct deco_sg_table sctr_tbl[4];
926 u32 rsvd29[48];
927 u32 descbuf[64];
928 u32 rscvd30[193];
929#define DESC_DBG_DECO_STAT_VALID 0x80000000
930#define DESC_DBG_DECO_STAT_MASK 0x00F00000
931#define DESC_DBG_DECO_STAT_SHIFT 20
932 u32 desc_dbg;
933 u32 rsvd31[13];
934#define DESC_DER_DECO_STAT_MASK 0x000F0000
935#define DESC_DER_DECO_STAT_SHIFT 16
936 u32 dbg_exec;
937 u32 rsvd32[112];
938};
939
940#define DECO_STAT_HOST_ERR 0xD
941
942#define DECO_JQCR_WHL 0x20000000
943#define DECO_JQCR_FOUR 0x10000000
944
945#define JR_BLOCK_NUMBER 1
946#define ASSURE_BLOCK_NUMBER 6
947#define QI_BLOCK_NUMBER 7
948#define DECO_BLOCK_NUMBER 8
949#define PG_SIZE_4K 0x1000
950#define PG_SIZE_64K 0x10000
951#endif
952