1 /* SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2019 Broadcom Ltd.
9 #define RNG_BASE 0xff800b80
12 uint32_t ctrl0
; /* 0x00 */
13 uint32_t rngSoftReset
; /* 0x04 */
14 uint32_t rbgSoftReset
; /* 0x08 */
15 uint32_t totalBitCnt
; /* 0x0c */
16 uint32_t totalBitCntThreshold
; /* 0x10 */
17 uint32_t revId
; /* 0x14 */
18 uint32_t intStatus
; /* 0x18 */
19 #define RNG_INT_STATUS_NIST_FAIL (0x1<<5)
20 #define RNG_INT_STATUS_FIFO_FULL (0x1<<2)
21 uint32_t intEn
; /* 0x1c */
22 uint32_t rngFifoData
; /* 0x20 */
23 uint32_t fifoCnt
; /* 0x24 */
24 #define RNG_PERM_ALLOW_SECURE_ACCESS 0xCC
25 #define RNG_PERM_ALLOW_NONSEC_ACCESS 0x33
26 uint32_t perm
; /* 0x28 */
29 #define RNG_PERM_SHIFT 0x0
30 #define RNG_PERM_BLK_SHIFT 0x4
32 #define RNG_PERM_SEC_W 0x8
33 #define RNG_PERM_SEC_R 0x4
34 #define RNG_PERM_NSEC_W 0x2
35 #define RNG_PERM_NSEC_R 0x1
37 #define RNG_PERM_BLK_SEC_W 0x8
38 #define RNG_PERM_BLK_SEC_R 0x4
39 #define RNG_PERM_BLK_NSEC_W 0x2
40 #define RNG_PERM_BLK_NSEC_R 0x1
42 #define RNG_PERM_NSEC_ENABLE (((RNG_PERM_BLK_NSEC_R|RNG_PERM_BLK_NSEC_W)<<RNG_PERM_BLK_SHIFT)| (RNG_PERM_SEC_W|RNG_PERM_SEC_R)<<RNG_PERM_SHIFT)
43 #define RNG_PERM_SEC_ENABLE (((RNG_PERM_BLK_SEC_R|RNG_PERM_BLK_SEC_W)<<RNG_PERM_BLK_SHIFT)| (RNG_PERM_SEC_W|RNG_PERM_SEC_R)<<RNG_PERM_SHIFT)
44 #define RNG_PERM_DISABLE_ALL 0x0
46 #define RNG ((volatile Rng * const) RNG_BASE)