1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2018-2019 NXP
4  *
5  * Brief   Job Ring Registers.
6  */
7 #ifndef __JR_REGS_H__
8 #define __JR_REGS_H__
9 
10 #include <util.h>
11 
12 /* Job Ring Block Register Size */
13 #define JRX_BLOCK_SIZE		CFG_JR_BLOCK_SIZE
14 #define JRX_IDX(offset)		(((offset) - JRX_BLOCK_SIZE) / JRX_BLOCK_SIZE)
15 
16 /*
17  * Input Ring
18  */
19 /* Base Address */
20 #define JRX_IRBAR			0x0000
21 /* Size */
22 #define JRX_IRSR			0x000C
23 /* Slots Available */
24 #define JRX_IRSAR			0x0014
25 /* Jobs Added */
26 #define JRX_IRJAR			0x001C
27 
28 /*
29  * Output Ring
30  */
31 /* Base Address */
32 #define JRX_ORBAR			0x0020
33 /* Size */
34 #define JRX_ORSR			0x002C
35 /* Jobs Removed */
36 #define JRX_ORJRR			0x0034
37 /* Slots Full */
38 #define JRX_ORSFR			0x003C
39 
40 /* Interrupt Status */
41 #define JRX_JRINTR			0x004C
42 #define BM_JRX_JRINTR_HALT		SHIFT_U32(0x3, 2)
43 #define JRINTR_HALT_RESUME		SHIFT_U32(0x2, 2)
44 #define JRINTR_HALT_ONGOING		SHIFT_U32(0x1, 2)
45 #define JRINTR_HALT_DONE		SHIFT_U32(0x2, 2)
46 #define JRX_JRINTR_JRI			BIT32(0)
47 
48 /* Configuration */
49 #define JRX_JRCFGR_LS			0x0054
50 #define JRX_JRCFGR_LS_ICTT(val)		SHIFT_U32((val) & 0xFFFF, 16)
51 #define JRX_JRCFGR_LS_ICDCT(val)	SHIFT_U32((val) & 0xFF, 8)
52 #define JRX_JRCFGR_LS_ICEN		BIT32(1)
53 #define JRX_JRCFGR_LS_IMSK		BIT32(0)
54 
55 /* Input Ring Read Index */
56 #define JRX_IRRIR			0x005C
57 
58 /* Output Ring Write Index */
59 #define JRX_ORWIR			0x0064
60 
61 /* Command */
62 #define JRX_JRCR			0x006C
63 #define JRX_JRCR_PARK			BIT32(1)
64 #define JRX_JRCR_RESET			BIT32(0)
65 
66 /* CAAM Status register - duplicated */
67 #define JRX_CSTA			0x0FD4
68 #define JRX_CSTA_TRNG_IDLE		BIT32(2)
69 #define JRX_CSTA_IDLE			BIT32(1)
70 #define JRX_CSTA_BSY			BIT32(0)
71 
72 #endif /* __JR_REGS_H__ */
73