1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *     SCP PIK registers
9  */
10 
11 #ifndef SCP_PIK_H
12 #define SCP_PIK_H
13 
14 #include "scp_css_mmap.h"
15 
16 #include <fwk_macros.h>
17 
18 #include <stdint.h>
19 
20 /*!
21  * \brief SCP PIK register definitions
22  */
23 struct pik_scp_reg {
24             uint8_t   RESERVED0[0x10 - 0x0];
25     FWK_RW  uint32_t  RESET_SYNDROME;
26             uint8_t   RESERVED1[0x20 - 0x14];
27     FWK_RW  uint32_t  SURVIVAL_RESET_STATUS;
28             uint8_t   RESERVED2[0x34 - 0x24];
29     FWK_RW  uint32_t  ADDR_TRANS;
30     FWK_RW  uint32_t  DBG_ADDR_TRANS;
31             uint8_t   RESERVED3[0x40 - 0x3C];
32     FWK_RW  uint32_t  WS1_TIMER_MATCH;
33     FWK_RW  uint32_t  WS1_TIMER_EN;
34             uint8_t   RESERVED4[0x200 - 0x48];
35     FWK_R   uint32_t  SS_RESET_STATUS;
36     FWK_W   uint32_t  SS_RESET_SET;
37     FWK_W   uint32_t  SS_RESET_CLR;
38             uint8_t   RESERVED5[0x810 - 0x20C];
39     FWK_RW  uint32_t  CORECLK_CTRL;
40     FWK_RW  uint32_t  CORECLK_DIV1;
41             uint8_t   RESERVED6[0x820 - 0x818];
42     FWK_RW  uint32_t  ACLK_CTRL;
43     FWK_RW  uint32_t  ACLK_DIV1;
44             uint8_t   RESERVED7[0x830 - 0x828];
45     FWK_RW  uint32_t  GTSYNCCLK_CTRL;
46     FWK_RW  uint32_t  GTSYNCCLK_DIV1;
47             uint8_t   RESERVED8[0xA10 - 0x838];
48     FWK_R   uint32_t  PLL_STATUS[17];
49             uint8_t   RESERVED9[0xA60 - 0xA54];
50     FWK_R   uint32_t  CONS_MMUTCU_INT_STATUS;
51     FWK_R   uint32_t  CONS_MMUTBU_INT_STATUS0;
52     FWK_R   uint32_t  CONS_MMUTBU_INT_STATUS1;
53     FWK_W   uint32_t  CONS_MMUTCU_INT_CLR;
54     FWK_W   uint32_t  CONS_MMUTBU_INT_CLR0;
55     FWK_W   uint32_t  CONS_MMUTBU_INT_CLR1;
56             uint8_t   RESERVED10[0xB00 - 0xA78];
57     FWK_R   uint32_t  MHU_NS_INT_STATUS;
58     FWK_R   uint32_t  MHU_S_INT_STATUS;
59             uint8_t   RESERVED11[0xB20 - 0xB08];
60     FWK_R   uint32_t  CPU_PPU_INT_STATUS[8];
61     FWK_R   uint32_t  CLUS_PPU_INT_STATUS;
62             uint8_t   RESERVED12[0xB60 - 0xB44];
63     FWK_R   uint32_t  TIMER_INT_STATUS[8];
64     FWK_R   uint32_t  CPU_PLL_LOCK_STATUS[8];
65             uint8_t   RESERVED13[0xBC0 - 0xBA0];
66     FWK_R   uint32_t  CPU_PLL_UNLOCK_STATUS[8];
67             uint8_t   RESERVED14[0xBF0 - 0xBE0];
68     FWK_R   uint32_t  CLUSTER_PLL_LOCK_STATUS;
69     FWK_R   uint32_t  CLUSTER_PLL_UNLOCK_STATUS;
70             uint8_t   RESERVED15[0xC00 - 0xBF8];
71     FWK_R   uint32_t  CLUS_FAULT_INT_STATUS;
72             uint8_t   RESERVED16[0xC30 - 0xC04];
73     FWK_R   uint32_t  CLUSTER_ECCERR_INT_STATUS;
74             uint8_t   RESERVED17[0xD00 - 0xC34];
75     FWK_R   uint32_t  DMC0_4_INT_STATUS;
76     FWK_R   uint32_t  DMC1_5_INT_STATUS;
77     FWK_R   uint32_t  DMC2_6_INT_STATUS;
78     FWK_R   uint32_t  DMC3_7_INT_STATUS;
79             uint8_t   RESERVED18[0xFC0 - 0xD10];
80     FWK_R   uint32_t  PCL_CFG;
81             uint8_t   RESERVED19[0xFD0 - 0xFC4];
82     FWK_R   uint32_t  PID4;
83     FWK_R   uint32_t  PID5;
84     FWK_R   uint32_t  PID6;
85     FWK_R   uint32_t  PID7;
86     FWK_R   uint32_t  PID0;
87     FWK_R   uint32_t  PID1;
88     FWK_R   uint32_t  PID2;
89     FWK_R   uint32_t  PID3;
90     FWK_R   uint32_t  ID0;
91     FWK_R   uint32_t  ID1;
92     FWK_R   uint32_t  ID2;
93     FWK_R   uint32_t  ID3;
94 };
95 
96 #define PLL_STATUS_0_REFCLK     UINT32_C(0x00000001)
97 #define PLL_STATUS_0_SYSPLLLOCK UINT32_C(0x00000002)
98 #define PLL_STATUS_0_DDRPLLLOCK UINT32_C(0x00000004)
99 #define PLL_STATUS_0_INTPLLLOCK UINT32_C(0x00000008)
100 
101 #define PLL_STATUS_CPUPLLLOCK(CPU) ((uint32_t)(1 << (CPU % 32)))
102 
103 /* Pointer to SCP PIK */
104 #define SCP_PIK_PTR ((struct pik_scp_reg *)SCP_PIK_SCP_BASE)
105 
106 #endif /* SCP_PIK_H */
107