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