xref: /rk3399_ARM-atf/include/drivers/st/bsec3_reg.h (revision ae6542f6c7ac9224843448424d3a539733bd651b)
1*ae6542f6SNicolas Le Bayon /*
2*ae6542f6SNicolas Le Bayon  * Copyright (c) 2024, STMicroelectronics - All Rights Reserved
3*ae6542f6SNicolas Le Bayon  *
4*ae6542f6SNicolas Le Bayon  * SPDX-License-Identifier: BSD-3-Clause
5*ae6542f6SNicolas Le Bayon  */
6*ae6542f6SNicolas Le Bayon 
7*ae6542f6SNicolas Le Bayon #ifndef BSEC3_REG_H
8*ae6542f6SNicolas Le Bayon #define BSEC3_REG_H
9*ae6542f6SNicolas Le Bayon 
10*ae6542f6SNicolas Le Bayon #include <lib/utils_def.h>
11*ae6542f6SNicolas Le Bayon 
12*ae6542f6SNicolas Le Bayon /* BSEC REGISTER OFFSET (base relative) */
13*ae6542f6SNicolas Le Bayon #define BSEC_FVR(x)			(U(0x000) + 4U * (x))
14*ae6542f6SNicolas Le Bayon #define BSEC_SPLOCK(x)			(U(0x800) + 4U * (x))
15*ae6542f6SNicolas Le Bayon #define BSEC_SWLOCK(x)			(U(0x840) + 4U * (x))
16*ae6542f6SNicolas Le Bayon #define BSEC_SRLOCK(x)			(U(0x880) + 4U * (x))
17*ae6542f6SNicolas Le Bayon #define BSEC_OTPVLDR(x)			(U(0x8C0) + 4U * (x))
18*ae6542f6SNicolas Le Bayon #define BSEC_SFSR(x)			(U(0x940) + 4U * (x))
19*ae6542f6SNicolas Le Bayon #define BSEC_OTPCR			U(0xC04)
20*ae6542f6SNicolas Le Bayon #define BSEC_WDR			U(0xC08)
21*ae6542f6SNicolas Le Bayon #define BSEC_SCRATCHR0			U(0xE00)
22*ae6542f6SNicolas Le Bayon #define BSEC_SCRATCHR1			U(0xE04)
23*ae6542f6SNicolas Le Bayon #define BSEC_SCRATCHR2			U(0xE08)
24*ae6542f6SNicolas Le Bayon #define BSEC_SCRATCHR3			U(0xE0C)
25*ae6542f6SNicolas Le Bayon #define BSEC_LOCKR			U(0xE10)
26*ae6542f6SNicolas Le Bayon #define BSEC_JTAGINR			U(0xE14)
27*ae6542f6SNicolas Le Bayon #define BSEC_JTAGOUTR			U(0xE18)
28*ae6542f6SNicolas Le Bayon #define BSEC_DENR			U(0xE20)
29*ae6542f6SNicolas Le Bayon #define BSEC_UNMAPR			U(0xE24)
30*ae6542f6SNicolas Le Bayon #define BSEC_SR				U(0xE40)
31*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR			U(0xE44)
32*ae6542f6SNicolas Le Bayon #define BSEC_WRCR			U(0xF00)
33*ae6542f6SNicolas Le Bayon #define BSEC_HWCFGR			U(0xFF0)
34*ae6542f6SNicolas Le Bayon #define BSEC_VERR			U(0xFF4)
35*ae6542f6SNicolas Le Bayon #define BSEC_IPIDR			U(0xFF8)
36*ae6542f6SNicolas Le Bayon #define BSEC_SIDR			U(0xFFC)
37*ae6542f6SNicolas Le Bayon 
38*ae6542f6SNicolas Le Bayon /* BSEC_OTPCR register fields */
39*ae6542f6SNicolas Le Bayon #define BSEC_OTPCR_ADDR_MASK		GENMASK_32(8, 0)
40*ae6542f6SNicolas Le Bayon #define BSEC_OTPCR_ADDR_SHIFT		U(0)
41*ae6542f6SNicolas Le Bayon #define BSEC_OTPCR_PROG			BIT_32(13)
42*ae6542f6SNicolas Le Bayon #define BSEC_OTPCR_PPLOCK		BIT_32(14)
43*ae6542f6SNicolas Le Bayon #define BSEC_OTPCR_LASTCID_MASK		GENMASK_32(21, 19)
44*ae6542f6SNicolas Le Bayon #define BSEC_OTPCR_LASTCID_SHIFT	U(19)
45*ae6542f6SNicolas Le Bayon 
46*ae6542f6SNicolas Le Bayon /* BSEC_LOCKR register fields */
47*ae6542f6SNicolas Le Bayon #define BSEC_LOCKR_GWLOCK_MASK		BIT_32(0)
48*ae6542f6SNicolas Le Bayon #define BSEC_LOCKR_GWLOCK_SHIFT		U(0)
49*ae6542f6SNicolas Le Bayon #define BSEC_LOCKR_DENLOCK_MASK		BIT_32(1)
50*ae6542f6SNicolas Le Bayon #define BSEC_LOCKR_DENLOCK_SHIFT	U(1)
51*ae6542f6SNicolas Le Bayon #define BSEC_LOCKR_HKLOCK_MASK		BIT_32(2)
52*ae6542f6SNicolas Le Bayon #define BSEC_LOCKR_HKLOCK_SHIFT		U(2)
53*ae6542f6SNicolas Le Bayon 
54*ae6542f6SNicolas Le Bayon /* BSEC_DENR register fields */
55*ae6542f6SNicolas Le Bayon #define BSEC_DENR_LPDBGEN		BIT_32(0)
56*ae6542f6SNicolas Le Bayon #define BSEC_DENR_DBGENA		BIT_32(1)
57*ae6542f6SNicolas Le Bayon #define BSEC_DENR_NIDENA		BIT_32(2)
58*ae6542f6SNicolas Le Bayon #define BSEC_DENR_DEVICEEN		BIT_32(3)
59*ae6542f6SNicolas Le Bayon #define BSEC_DENR_HDPEN			BIT_32(4)
60*ae6542f6SNicolas Le Bayon #define BSEC_DENR_SPIDENA		BIT_32(5)
61*ae6542f6SNicolas Le Bayon #define BSEC_DENR_SPNIDENA		BIT_32(6)
62*ae6542f6SNicolas Le Bayon #define BSEC_DENR_DBGSWEN		BIT_32(7)
63*ae6542f6SNicolas Le Bayon #define BSEC_DENR_DBGENM		BIT_32(8)
64*ae6542f6SNicolas Le Bayon #define BSEC_DENR_NIDENM		BIT_32(9)
65*ae6542f6SNicolas Le Bayon #define BSEC_DENR_SPIDENM		BIT_32(10)
66*ae6542f6SNicolas Le Bayon #define BSEC_DENR_SPNIDENM		BIT_32(11)
67*ae6542f6SNicolas Le Bayon #define BSEC_DENR_CFGSDIS		BIT_32(12)
68*ae6542f6SNicolas Le Bayon #define BSEC_DENR_CP15SDIS_MASK		GENMASK_32(14, 13)
69*ae6542f6SNicolas Le Bayon #define BSEC_DENR_CP15SDIS_SHIFT	U(13)
70*ae6542f6SNicolas Le Bayon #define BSEC_DENR_LPDBGDIS		BIT_32(15)
71*ae6542f6SNicolas Le Bayon #define BSEC_DENR_ALL_MSK		GENMASK_32(15, 0)
72*ae6542f6SNicolas Le Bayon 
73*ae6542f6SNicolas Le Bayon /* BSEC_SR register fields */
74*ae6542f6SNicolas Le Bayon #define BSEC_SR_BUSY			BIT_32(0)
75*ae6542f6SNicolas Le Bayon #define BSEC_SR_HVALID			BIT_32(1)
76*ae6542f6SNicolas Le Bayon #define BSEC_SR_RNGERR			BIT_32(2)
77*ae6542f6SNicolas Le Bayon #define BSEC_SR_HKWW_MASK		GENMASK_32(15, 8)
78*ae6542f6SNicolas Le Bayon #define BSEC_SR_HKWW_SHIFT		U(8)
79*ae6542f6SNicolas Le Bayon #define BSEC_SR_NVSTATE_MASK		GENMASK_32(31, 26)
80*ae6542f6SNicolas Le Bayon #define BSEC_SR_NVSTATE_SHIFT		U(26)
81*ae6542f6SNicolas Le Bayon #define BSEC_SR_NVSTATE_OPEN		U(0x16)
82*ae6542f6SNicolas Le Bayon #define BSEC_SR_NVSTATE_CLOSED		U(0x0D)
83*ae6542f6SNicolas Le Bayon #define BSEC_SR_NVSTATE_OTP_LOCKED	U(0x23)
84*ae6542f6SNicolas Le Bayon 
85*ae6542f6SNicolas Le Bayon /* BSEC_OTPSR register fields */
86*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_BUSY			BIT_32(0)
87*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_FUSEOK		BIT_32(1)
88*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_HIDEUP		BIT_32(2)
89*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_OTPNVIR		BIT_32(4)
90*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_OTPERR		BIT_32(5)
91*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_OTPSEC		BIT_32(6)
92*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_PROGFAIL		BIT_32(16)
93*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_DISTURBF		BIT_32(17)
94*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_DEDF			BIT_32(18)
95*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_SECF			BIT_32(19)
96*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_PPLF			BIT_32(20)
97*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_PPLMF		BIT_32(21)
98*ae6542f6SNicolas Le Bayon #define BSEC_OTPSR_AMEF			BIT_32(22)
99*ae6542f6SNicolas Le Bayon 
100*ae6542f6SNicolas Le Bayon /* BSEC_VERR register fields */
101*ae6542f6SNicolas Le Bayon #define BSEC_VERR_MASK			GENMASK_32(7, 0)
102*ae6542f6SNicolas Le Bayon 
103*ae6542f6SNicolas Le Bayon #endif /* BSEC3_REG_H */
104