blob: 147ca2f99de69f93f39193b7053ccc85a8916e34 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Mingkai Hue4e93ea2015-10-26 19:47:51 +08002/*
3 * Copyright 2013-2015 Freescale Semiconductor, Inc.
Mingkai Hue4e93ea2015-10-26 19:47:51 +08004 */
5
6#ifndef __ARCH_FSL_LSCH2_IMMAP_H__
7#define __ARCH_FSL_LSCH2_IMMAP_H__
8
Tom Rinidec7ea02024-05-20 13:35:03 -06009#include <config.h>
Mingkai Hue4e93ea2015-10-26 19:47:51 +080010#include <fsl_immap.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -060011#ifndef __ASSEMBLY__
12#include <linux/bitops.h>
13#endif
Mingkai Hue4e93ea2015-10-26 19:47:51 +080014
Tom Rini6a5dccc2022-11-16 13:10:41 -050015#define CFG_SYS_DCSRBAR 0x20000000
16#define CFG_SYS_DCSR_DCFG_ADDR (CFG_SYS_DCSRBAR + 0x00140000)
Mingkai Hue4e93ea2015-10-26 19:47:51 +080017
Tom Rini376b88a2022-10-28 20:27:13 -040018#define CFG_SYS_FSL_DDR_ADDR (CONFIG_SYS_IMMR + 0x00080000)
Tom Rini6a5dccc2022-11-16 13:10:41 -050019#define CFG_SYS_IFC_ADDR (CONFIG_SYS_IMMR + 0x00530000)
Yuan Yao52ae4fd2016-12-01 10:13:52 +080020#define SYS_FSL_QSPI_ADDR (CONFIG_SYS_IMMR + 0x00550000)
Tom Rini376b88a2022-10-28 20:27:13 -040021#define CFG_SYS_FSL_ESDHC_ADDR (CONFIG_SYS_IMMR + 0x00560000)
22#define CFG_SYS_FSL_CSU_ADDR (CONFIG_SYS_IMMR + 0x00510000)
23#define CFG_SYS_FSL_GUTS_ADDR (CONFIG_SYS_IMMR + 0x00ee0000)
24#define CFG_SYS_FSL_RST_ADDR (CONFIG_SYS_IMMR + 0x00ee00b0)
25#define CFG_SYS_FSL_SCFG_ADDR (CONFIG_SYS_IMMR + 0x00570000)
26#define CFG_SYS_FSL_BMAN_ADDR (CONFIG_SYS_IMMR + 0x00890000)
27#define CFG_SYS_FSL_QMAN_ADDR (CONFIG_SYS_IMMR + 0x00880000)
28#define CFG_SYS_FSL_SERDES_ADDR (CONFIG_SYS_IMMR + 0x00ea0000)
29#define CFG_SYS_FSL_CLK_ADDR (CONFIG_SYS_IMMR + 0x00ee1000)
Tom Rinidf6a2152022-11-16 13:10:28 -050030#define CFG_SYS_NS16550_COM1 (CONFIG_SYS_IMMR + 0x011c0500)
31#define CFG_SYS_NS16550_COM2 (CONFIG_SYS_IMMR + 0x011c0600)
32#define CFG_SYS_NS16550_COM3 (CONFIG_SYS_IMMR + 0x011d0500)
33#define CFG_SYS_NS16550_COM4 (CONFIG_SYS_IMMR + 0x011d0600)
Tom Rini6a5dccc2022-11-16 13:10:41 -050034#define CFG_SYS_XHCI_USB1_ADDR (CONFIG_SYS_IMMR + 0x01f00000)
35#define CFG_SYS_XHCI_USB2_ADDR (CONFIG_SYS_IMMR + 0x02000000)
36#define CFG_SYS_XHCI_USB3_ADDR (CONFIG_SYS_IMMR + 0x02100000)
Tom Rini56af6592022-11-16 13:10:33 -050037#define CFG_SYS_PCIE1_ADDR (CONFIG_SYS_IMMR + 0x2400000)
38#define CFG_SYS_PCIE2_ADDR (CONFIG_SYS_IMMR + 0x2500000)
Tom Rini6a5dccc2022-11-16 13:10:41 -050039#define CFG_SYS_SEC_MON_ADDR (CONFIG_SYS_IMMR + 0xe90000)
40#define CFG_SYS_SFP_ADDR (CONFIG_SYS_IMMR + 0xe80200)
Mingkai Hue4e93ea2015-10-26 19:47:51 +080041
Tom Rini6a5dccc2022-11-16 13:10:41 -050042#define CFG_SYS_BMAN_NUM_PORTALS 10
43#define CFG_SYS_BMAN_MEM_BASE 0x508000000
44#define CFG_SYS_BMAN_MEM_PHYS (0xf00000000ull + \
45 CFG_SYS_BMAN_MEM_BASE)
46#define CFG_SYS_BMAN_MEM_SIZE 0x08000000
47#define CFG_SYS_BMAN_SP_CENA_SIZE 0x10000
48#define CFG_SYS_BMAN_SP_CINH_SIZE 0x10000
49#define CFG_SYS_BMAN_CENA_BASE CFG_SYS_BMAN_MEM_BASE
50#define CFG_SYS_BMAN_CENA_SIZE (CFG_SYS_BMAN_MEM_SIZE >> 1)
51#define CFG_SYS_BMAN_CINH_BASE (CFG_SYS_BMAN_MEM_BASE + \
52 CFG_SYS_BMAN_CENA_SIZE)
53#define CFG_SYS_BMAN_CINH_SIZE (CFG_SYS_BMAN_MEM_SIZE >> 1)
54#define CFG_SYS_BMAN_SWP_ISDR_REG 0x3E80
55#define CFG_SYS_QMAN_NUM_PORTALS 10
56#define CFG_SYS_QMAN_MEM_BASE 0x500000000
57#define CFG_SYS_QMAN_MEM_PHYS CFG_SYS_QMAN_MEM_BASE
58#define CFG_SYS_QMAN_MEM_SIZE 0x08000000
59#define CFG_SYS_QMAN_SP_CINH_SIZE 0x10000
60#define CFG_SYS_QMAN_CENA_SIZE (CFG_SYS_QMAN_MEM_SIZE >> 1)
61#define CFG_SYS_QMAN_CINH_BASE (CFG_SYS_QMAN_MEM_BASE + \
62 CFG_SYS_QMAN_CENA_SIZE)
63#define CFG_SYS_QMAN_CINH_SIZE (CFG_SYS_QMAN_MEM_SIZE >> 1)
64#define CFG_SYS_QMAN_SWP_ISDR_REG 0x3680
Ahmed Mansouraa270b42017-12-15 16:01:00 -050065
Tom Rini376b88a2022-10-28 20:27:13 -040066#define CFG_SYS_FSL_TIMER_ADDR 0x02b00000
Mingkai Hue4e93ea2015-10-26 19:47:51 +080067
68#define I2C1_BASE_ADDR (CONFIG_SYS_IMMR + 0x01180000)
69#define I2C2_BASE_ADDR (CONFIG_SYS_IMMR + 0x01190000)
70#define I2C3_BASE_ADDR (CONFIG_SYS_IMMR + 0x011a0000)
71#define I2C4_BASE_ADDR (CONFIG_SYS_IMMR + 0x011b0000)
72
73#define WDOG1_BASE_ADDR (CONFIG_SYS_IMMR + 0x01ad0000)
74
75#define QSPI0_BASE_ADDR (CONFIG_SYS_IMMR + 0x00550000)
76#define DSPI1_BASE_ADDR (CONFIG_SYS_IMMR + 0x01100000)
77
Prabhakar Kushwaha1a9d4982018-03-08 15:30:24 +053078#define GPIO1_BASE_ADDR (CONFIG_SYS_IMMR + 0x1300000)
79#define GPIO2_BASE_ADDR (CONFIG_SYS_IMMR + 0x1310000)
80#define GPIO3_BASE_ADDR (CONFIG_SYS_IMMR + 0x1320000)
81#define GPIO4_BASE_ADDR (CONFIG_SYS_IMMR + 0x1330000)
82
Laurentiu Tudor0fa54972018-08-27 17:33:57 +030083#define QE_BASE_ADDR (CONFIG_SYS_IMMR + 0x1400000)
84
Mingkai Hue4e93ea2015-10-26 19:47:51 +080085#define LPUART_BASE (CONFIG_SYS_IMMR + 0x01950000)
86
Laurentiu Tudor3ad36e72018-08-09 15:19:42 +030087#define EDMA_BASE_ADDR (CONFIG_SYS_IMMR + 0x01c00000)
88
Mingkai Hue4e93ea2015-10-26 19:47:51 +080089#define AHCI_BASE_ADDR (CONFIG_SYS_IMMR + 0x02200000)
90
Laurentiu Tudor3ad36e72018-08-09 15:19:42 +030091#define QDMA_BASE_ADDR (CONFIG_SYS_IMMR + 0x07380000)
Laurentiu Tudore03b4852018-12-12 13:45:51 +020092#define QMAN_CQSIDR_REG 0x20a80
Laurentiu Tudor3ad36e72018-08-09 15:19:42 +030093
Tom Rini56af6592022-11-16 13:10:33 -050094#define CFG_SYS_PCIE1_PHYS_ADDR 0x4000000000ULL
95#define CFG_SYS_PCIE2_PHYS_ADDR 0x4800000000ULL
96#define CFG_SYS_PCIE3_PHYS_ADDR 0x5000000000ULL
Mingkai Hu19218992015-11-11 17:58:34 +080097/* LUT registers */
York Sunb3d71642016-09-26 08:09:26 -070098#ifdef CONFIG_ARCH_LS1012A
Prabhakar Kushwahad169ebe2016-06-03 18:41:31 +053099#define PCIE_LUT_BASE 0xC0000
100#else
Mingkai Hu19218992015-11-11 17:58:34 +0800101#define PCIE_LUT_BASE 0x10000
Prabhakar Kushwahad169ebe2016-06-03 18:41:31 +0530102#endif
Mingkai Hu19218992015-11-11 17:58:34 +0800103#define PCIE_LUT_LCTRL0 0x7F8
104#define PCIE_LUT_DBG 0x7FC
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800105
106/* TZ Address Space Controller Definitions */
107#define TZASC1_BASE 0x01100000 /* as per CCSR map. */
108#define TZASC2_BASE 0x01110000 /* as per CCSR map. */
109#define TZASC3_BASE 0x01120000 /* as per CCSR map. */
110#define TZASC4_BASE 0x01130000 /* as per CCSR map. */
111#define TZASC_BUILD_CONFIG_REG(x) ((TZASC1_BASE + (x * 0x10000)))
112#define TZASC_ACTION_REG(x) ((TZASC1_BASE + (x * 0x10000)) + 0x004)
113#define TZASC_GATE_KEEPER(x) ((TZASC1_BASE + (x * 0x10000)) + 0x008)
114#define TZASC_REGION_BASE_LOW_0(x) ((TZASC1_BASE + (x * 0x10000)) + 0x100)
115#define TZASC_REGION_BASE_HIGH_0(x) ((TZASC1_BASE + (x * 0x10000)) + 0x104)
116#define TZASC_REGION_TOP_LOW_0(x) ((TZASC1_BASE + (x * 0x10000)) + 0x108)
117#define TZASC_REGION_TOP_HIGH_0(x) ((TZASC1_BASE + (x * 0x10000)) + 0x10C)
118#define TZASC_REGION_ATTRIBUTES_0(x) ((TZASC1_BASE + (x * 0x10000)) + 0x110)
119#define TZASC_REGION_ID_ACCESS_0(x) ((TZASC1_BASE + (x * 0x10000)) + 0x114)
120
121#define TP_ITYP_AV 0x00000001 /* Initiator available */
122#define TP_ITYP_TYPE(x) (((x) & 0x6) >> 1) /* Initiator Type */
123#define TP_ITYP_TYPE_ARM 0x0
124#define TP_ITYP_TYPE_PPC 0x1 /* PowerPC */
125#define TP_ITYP_TYPE_OTHER 0x2 /* StarCore DSP */
126#define TP_ITYP_TYPE_HA 0x3 /* HW Accelerator */
127#define TP_ITYP_THDS(x) (((x) & 0x18) >> 3) /* # threads */
128#define TP_ITYP_VER(x) (((x) & 0xe0) >> 5) /* Initiator Version */
129#define TY_ITYP_VER_A7 0x1
130#define TY_ITYP_VER_A53 0x2
131#define TY_ITYP_VER_A57 0x3
Alison Wang79808392016-07-05 16:01:52 +0800132#define TY_ITYP_VER_A72 0x4
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800133
134#define TP_CLUSTER_EOC 0xc0000000 /* end of clusters */
135#define TP_CLUSTER_INIT_MASK 0x0000003f /* initiator mask */
136#define TP_INIT_PER_CLUSTER 4
137
Tom Rini6a5dccc2022-11-16 13:10:41 -0500138#ifndef CFG_SYS_CCSRBAR
139#define CFG_SYS_CCSRBAR 0x01000000
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800140#endif
141
Tom Rini6a5dccc2022-11-16 13:10:41 -0500142#ifndef CFG_SYS_CCSRBAR_PHYS_HIGH
143#define CFG_SYS_CCSRBAR_PHYS_HIGH 0
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800144#endif
145
Tom Rini6a5dccc2022-11-16 13:10:41 -0500146#ifndef CFG_SYS_CCSRBAR_PHYS_LOW
147#define CFG_SYS_CCSRBAR_PHYS_LOW 0x01000000
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800148#endif
149
Tom Rini6a5dccc2022-11-16 13:10:41 -0500150#define CFG_SYS_CCSRBAR_PHYS ((CFG_SYS_CCSRBAR_PHYS_HIGH * 1ull) << 32 | \
151 CFG_SYS_CCSRBAR_PHYS_LOW)
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800152
153struct sys_info {
154 unsigned long freq_processor[CONFIG_MAX_CPUS];
Hou Zhiqiang3f91cda2017-01-10 16:44:15 +0800155 /* frequency of platform PLL */
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800156 unsigned long freq_systembus;
157 unsigned long freq_ddrbus;
158 unsigned long freq_localbus;
Yinbo Zhu3761ffc2019-07-16 15:09:06 +0800159 unsigned long freq_cga_m2;
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800160#ifdef CONFIG_SYS_DPAA_FMAN
Tom Rini0a2bac72022-11-16 13:10:29 -0500161 unsigned long freq_fman[CFG_SYS_NUM_FMAN];
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800162#endif
163 unsigned long freq_qman;
164};
165
Tom Rini376b88a2022-10-28 20:27:13 -0400166#define CFG_SYS_FSL_FM1_OFFSET 0xa00000
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800167
Tom Rini376b88a2022-10-28 20:27:13 -0400168#define CFG_SYS_FSL_FM1_DTSEC1_OFFSET 0xae0000
169#define CFG_SYS_FSL_FM1_ADDR \
170 (CONFIG_SYS_IMMR + CFG_SYS_FSL_FM1_OFFSET)
171#define CFG_SYS_FSL_FM1_DTSEC1_ADDR \
172 (CONFIG_SYS_IMMR + CFG_SYS_FSL_FM1_DTSEC1_OFFSET)
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800173
Tom Rini376b88a2022-10-28 20:27:13 -0400174#define CFG_SYS_FSL_SEC_OFFSET 0x700000ull
175#define CFG_SYS_FSL_JR0_OFFSET 0x710000ull
176#define FSL_SEC_JR0_OFFSET CFG_SYS_FSL_JR0_OFFSET
Laurentiu Tudor3987b042018-08-09 15:19:49 +0300177#define FSL_SEC_JR1_OFFSET 0x720000ull
178#define FSL_SEC_JR2_OFFSET 0x730000ull
179#define FSL_SEC_JR3_OFFSET 0x740000ull
Tom Rini376b88a2022-10-28 20:27:13 -0400180#define CFG_SYS_FSL_SEC_ADDR \
181 (CONFIG_SYS_IMMR + CFG_SYS_FSL_SEC_OFFSET)
182#define CFG_SYS_FSL_JR0_ADDR \
183 (CONFIG_SYS_IMMR + CFG_SYS_FSL_JR0_OFFSET)
Laurentiu Tudor3987b042018-08-09 15:19:49 +0300184#define FSL_SEC_JR0_BASE_ADDR (CONFIG_SYS_IMMR + FSL_SEC_JR0_OFFSET)
185#define FSL_SEC_JR1_BASE_ADDR (CONFIG_SYS_IMMR + FSL_SEC_JR1_OFFSET)
186#define FSL_SEC_JR2_BASE_ADDR (CONFIG_SYS_IMMR + FSL_SEC_JR2_OFFSET)
187#define FSL_SEC_JR3_BASE_ADDR (CONFIG_SYS_IMMR + FSL_SEC_JR3_OFFSET)
Alex Porosanu177fca82016-04-29 15:17:58 +0300188
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800189/* Device Configuration and Pin Control */
Hou Zhiqiangc06b30a2016-09-29 12:42:44 +0800190#define DCFG_DCSR_PORCR1 0x0
Calvin Johnson6d6ef012018-03-08 15:30:33 +0530191#define DCFG_DCSR_ECCCR2 0x524
192#define DISABLE_PFE_ECC BIT(13)
Hou Zhiqiangc06b30a2016-09-29 12:42:44 +0800193
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800194struct ccsr_gur {
195 u32 porsr1; /* POR status 1 */
196#define FSL_CHASSIS2_CCSR_PORSR1_RCW_MASK 0xFF800000
197 u32 porsr2; /* POR status 2 */
198 u8 res_008[0x20-0x8];
199 u32 gpporcr1; /* General-purpose POR configuration */
200 u32 gpporcr2;
201#define FSL_CHASSIS2_DCFG_FUSESR_VID_SHIFT 25
202#define FSL_CHASSIS2_DCFG_FUSESR_VID_MASK 0x1F
203#define FSL_CHASSIS2_DCFG_FUSESR_ALTVID_SHIFT 20
204#define FSL_CHASSIS2_DCFG_FUSESR_ALTVID_MASK 0x1F
205 u32 dcfg_fusesr; /* Fuse status register */
206 u8 res_02c[0x70-0x2c];
207 u32 devdisr; /* Device disable control */
208#define FSL_CHASSIS2_DEVDISR2_DTSEC1_1 0x80000000
209#define FSL_CHASSIS2_DEVDISR2_DTSEC1_2 0x40000000
210#define FSL_CHASSIS2_DEVDISR2_DTSEC1_3 0x20000000
211#define FSL_CHASSIS2_DEVDISR2_DTSEC1_4 0x10000000
212#define FSL_CHASSIS2_DEVDISR2_DTSEC1_5 0x08000000
213#define FSL_CHASSIS2_DEVDISR2_DTSEC1_6 0x04000000
214#define FSL_CHASSIS2_DEVDISR2_DTSEC1_9 0x00800000
215#define FSL_CHASSIS2_DEVDISR2_DTSEC1_10 0x00400000
216#define FSL_CHASSIS2_DEVDISR2_10GEC1_1 0x00800000
217#define FSL_CHASSIS2_DEVDISR2_10GEC1_2 0x00400000
218#define FSL_CHASSIS2_DEVDISR2_10GEC1_3 0x80000000
219#define FSL_CHASSIS2_DEVDISR2_10GEC1_4 0x40000000
220 u32 devdisr2; /* Device disable control 2 */
221 u32 devdisr3; /* Device disable control 3 */
222 u32 devdisr4; /* Device disable control 4 */
223 u32 devdisr5; /* Device disable control 5 */
224 u32 devdisr6; /* Device disable control 6 */
225 u32 devdisr7; /* Device disable control 7 */
226 u8 res_08c[0x94-0x8c];
227 u32 coredisru; /* uppper portion for support of 64 cores */
228 u32 coredisrl; /* lower portion for support of 64 cores */
229 u8 res_09c[0xa0-0x9c];
230 u32 pvr; /* Processor version */
231 u32 svr; /* System version */
232 u32 mvr; /* Manufacturing version */
233 u8 res_0ac[0xb0-0xac];
234 u32 rstcr; /* Reset control */
235 u32 rstrqpblsr; /* Reset request preboot loader status */
236 u8 res_0b8[0xc0-0xb8];
237 u32 rstrqmr1; /* Reset request mask */
238 u8 res_0c4[0xc8-0xc4];
239 u32 rstrqsr1; /* Reset request status */
240 u8 res_0cc[0xd4-0xcc];
241 u32 rstrqwdtmrl; /* Reset request WDT mask */
242 u8 res_0d8[0xdc-0xd8];
243 u32 rstrqwdtsrl; /* Reset request WDT status */
244 u8 res_0e0[0xe4-0xe0];
245 u32 brrl; /* Boot release */
246 u8 res_0e8[0x100-0xe8];
247 u32 rcwsr[16]; /* Reset control word status */
248#define FSL_CHASSIS2_RCWSR0_SYS_PLL_RAT_SHIFT 25
249#define FSL_CHASSIS2_RCWSR0_SYS_PLL_RAT_MASK 0x1f
250#define FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_SHIFT 16
251#define FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_MASK 0x3f
252#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK 0xffff0000
253#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT 16
Qianyu Gong2b5b7a92016-07-05 16:01:54 +0800254#define FSL_CHASSIS2_RCWSR4_SRDS2_PRTCL_MASK 0x0000ffff
255#define FSL_CHASSIS2_RCWSR4_SRDS2_PRTCL_SHIFT 0
Aneesh Bansalc4713ec2016-01-22 16:37:25 +0530256#define RCW_SB_EN_REG_INDEX 7
257#define RCW_SB_EN_MASK 0x00200000
258
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800259 u8 res_140[0x200-0x140];
260 u32 scratchrw[4]; /* Scratch Read/Write */
261 u8 res_210[0x300-0x210];
262 u32 scratchw1r[4]; /* Scratch Read (Write once) */
263 u8 res_310[0x400-0x310];
264 u32 crstsr[12];
265 u8 res_430[0x500-0x430];
266
267 /* PCI Express n Logical I/O Device Number register */
268 u32 dcfg_ccsr_pex1liodnr;
269 u32 dcfg_ccsr_pex2liodnr;
270 u32 dcfg_ccsr_pex3liodnr;
271 u32 dcfg_ccsr_pex4liodnr;
272 /* RIO n Logical I/O Device Number register */
273 u32 dcfg_ccsr_rio1liodnr;
274 u32 dcfg_ccsr_rio2liodnr;
275 u32 dcfg_ccsr_rio3liodnr;
276 u32 dcfg_ccsr_rio4liodnr;
277 /* USB Logical I/O Device Number register */
278 u32 dcfg_ccsr_usb1liodnr;
279 u32 dcfg_ccsr_usb2liodnr;
280 u32 dcfg_ccsr_usb3liodnr;
281 u32 dcfg_ccsr_usb4liodnr;
282 /* SD/MMC Logical I/O Device Number register */
283 u32 dcfg_ccsr_sdmmc1liodnr;
284 u32 dcfg_ccsr_sdmmc2liodnr;
285 u32 dcfg_ccsr_sdmmc3liodnr;
286 u32 dcfg_ccsr_sdmmc4liodnr;
287 /* RIO Message Unit Logical I/O Device Number register */
288 u32 dcfg_ccsr_riomaintliodnr;
289
290 u8 res_544[0x550-0x544];
291 u32 sataliodnr[4];
292 u8 res_560[0x570-0x560];
293
294 u32 dcfg_ccsr_misc1liodnr;
295 u32 dcfg_ccsr_misc2liodnr;
296 u32 dcfg_ccsr_misc3liodnr;
297 u32 dcfg_ccsr_misc4liodnr;
298 u32 dcfg_ccsr_dma1liodnr;
299 u32 dcfg_ccsr_dma2liodnr;
300 u32 dcfg_ccsr_dma3liodnr;
301 u32 dcfg_ccsr_dma4liodnr;
302 u32 dcfg_ccsr_spare1liodnr;
303 u32 dcfg_ccsr_spare2liodnr;
304 u32 dcfg_ccsr_spare3liodnr;
305 u32 dcfg_ccsr_spare4liodnr;
306 u8 res_5a0[0x600-0x5a0];
307 u32 dcfg_ccsr_pblsr;
308
309 u32 pamubypenr;
310 u32 dmacr1;
311
312 u8 res_60c[0x610-0x60c];
313 u32 dcfg_ccsr_gensr1;
314 u32 dcfg_ccsr_gensr2;
315 u32 dcfg_ccsr_gensr3;
316 u32 dcfg_ccsr_gensr4;
317 u32 dcfg_ccsr_gencr1;
318 u32 dcfg_ccsr_gencr2;
319 u32 dcfg_ccsr_gencr3;
320 u32 dcfg_ccsr_gencr4;
321 u32 dcfg_ccsr_gencr5;
322 u32 dcfg_ccsr_gencr6;
323 u32 dcfg_ccsr_gencr7;
324 u8 res_63c[0x658-0x63c];
325 u32 dcfg_ccsr_cgensr1;
326 u32 dcfg_ccsr_cgensr0;
327 u8 res_660[0x678-0x660];
328 u32 dcfg_ccsr_cgencr1;
329
330 u32 dcfg_ccsr_cgencr0;
331 u8 res_680[0x700-0x680];
332 u32 dcfg_ccsr_sriopstecr;
333 u32 dcfg_ccsr_dcsrcr;
334
335 u8 res_708[0x740-0x708]; /* add more registers when needed */
336 u32 tp_ityp[64]; /* Topology Initiator Type Register */
337 struct {
338 u32 upper;
339 u32 lower;
340 } tp_cluster[16];
341 u8 res_8c0[0xa00-0x8c0]; /* add more registers when needed */
342 u32 dcfg_ccsr_qmbm_warmrst;
343 u8 res_a04[0xa20-0xa04]; /* add more registers when needed */
344 u32 dcfg_ccsr_reserved0;
345 u32 dcfg_ccsr_reserved1;
346};
347
348#define SCFG_QSPI_CLKSEL 0x40100000
349#define SCFG_USBDRVVBUS_SELCR_USB1 0x00000000
350#define SCFG_USBDRVVBUS_SELCR_USB2 0x00000001
351#define SCFG_USBDRVVBUS_SELCR_USB3 0x00000002
352#define SCFG_USBPWRFAULT_INACTIVE 0x00000000
353#define SCFG_USBPWRFAULT_SHARED 0x00000001
354#define SCFG_USBPWRFAULT_DEDICATED 0x00000002
355#define SCFG_USBPWRFAULT_USB3_SHIFT 4
356#define SCFG_USBPWRFAULT_USB2_SHIFT 2
357#define SCFG_USBPWRFAULT_USB1_SHIFT 0
358
Ran Wangb358b7b2017-09-04 18:46:48 +0800359#define SCFG_BASE 0x01570000
360#define SCFG_USB3PRM1CR_USB1 0x070
Ran Wange64f7472017-09-04 18:46:50 +0800361#define SCFG_USB3PRM2CR_USB1 0x074
Ran Wangb358b7b2017-09-04 18:46:48 +0800362#define SCFG_USB3PRM1CR_USB2 0x07C
Ran Wange64f7472017-09-04 18:46:50 +0800363#define SCFG_USB3PRM2CR_USB2 0x080
Ran Wangb358b7b2017-09-04 18:46:48 +0800364#define SCFG_USB3PRM1CR_USB3 0x088
Ran Wange64f7472017-09-04 18:46:50 +0800365#define SCFG_USB3PRM2CR_USB3 0x08c
Ran Wangb358b7b2017-09-04 18:46:48 +0800366#define SCFG_USB_TXVREFTUNE 0x9
Ran Wang9e8fabc2017-09-04 18:46:49 +0800367#define SCFG_USB_SQRXTUNE_MASK 0x7
Ran Wange64f7472017-09-04 18:46:50 +0800368#define SCFG_USB_PCSTXSWINGFULL 0x47
Ran Wang3ba69482017-09-04 18:46:51 +0800369#define SCFG_USB_PHY1 0x084F0000
370#define SCFG_USB_PHY2 0x08500000
371#define SCFG_USB_PHY3 0x08510000
372#define SCFG_USB_PHY_RX_OVRD_IN_HI 0x200c
373#define USB_PHY_RX_EQ_VAL_1 0x0000
374#define USB_PHY_RX_EQ_VAL_2 0x0080
375#define USB_PHY_RX_EQ_VAL_3 0x0380
376#define USB_PHY_RX_EQ_VAL_4 0x0b80
Ran Wangb358b7b2017-09-04 18:46:48 +0800377
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800378#define SCFG_SNPCNFGCR_SECRDSNP 0x80000000
379#define SCFG_SNPCNFGCR_SECWRSNP 0x40000000
Tang Yuantian2945ae02016-08-08 15:07:20 +0800380#define SCFG_SNPCNFGCR_SATARDSNP 0x00800000
381#define SCFG_SNPCNFGCR_SATAWRSNP 0x00400000
Ran Wangc75026e2019-09-20 17:34:29 +0800382#define SCFG_SNPCNFGCR_USB1RDSNP 0x00200000
383#define SCFG_SNPCNFGCR_USB1WRSNP 0x00100000
Sean Andersone7e395d2022-09-23 12:05:51 -0400384#define SCFG_SNPCNFGCR_EDMASNP 0x00020000
Ran Wangc75026e2019-09-20 17:34:29 +0800385#define SCFG_SNPCNFGCR_USB2RDSNP 0x00008000
386#define SCFG_SNPCNFGCR_USB2WRSNP 0x00010000
387#define SCFG_SNPCNFGCR_USB3RDSNP 0x00002000
388#define SCFG_SNPCNFGCR_USB3WRSNP 0x00004000
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800389
Calvin Johnson18f81c32018-03-08 15:30:32 +0530390/* RGMIIPCR bit definitions*/
391#define SCFG_RGMIIPCR_EN_AUTO BIT(3)
392#define SCFG_RGMIIPCR_SETSP_1000M BIT(2)
393#define SCFG_RGMIIPCR_SETSP_100M 0
394#define SCFG_RGMIIPCR_SETSP_10M BIT(1)
395#define SCFG_RGMIIPCR_SETFD BIT(0)
396
397/* PFEASBCR bit definitions */
398#define SCFG_PFEASBCR_ARCACHE0 BIT(31)
399#define SCFG_PFEASBCR_AWCACHE0 BIT(30)
400#define SCFG_PFEASBCR_ARCACHE1 BIT(29)
401#define SCFG_PFEASBCR_AWCACHE1 BIT(28)
402#define SCFG_PFEASBCR_ARSNP BIT(27)
403#define SCFG_PFEASBCR_AWSNP BIT(26)
404
Calvin Johnson6d6ef012018-03-08 15:30:33 +0530405/* WR_QoS1 PFE bit definitions */
406#define SCFG_WR_QOS1_PFE1_QOS GENMASK(27, 24)
407#define SCFG_WR_QOS1_PFE2_QOS GENMASK(23, 20)
408
409/* RD_QoS1 PFE bit definitions */
410#define SCFG_RD_QOS1_PFE1_QOS GENMASK(27, 24)
411#define SCFG_RD_QOS1_PFE2_QOS GENMASK(23, 20)
412
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800413/* Supplemental Configuration Unit */
414struct ccsr_scfg {
415 u8 res_000[0x100-0x000];
416 u32 usb2_icid;
417 u32 usb3_icid;
418 u8 res_108[0x114-0x108];
419 u32 dma_icid;
420 u32 sata_icid;
421 u32 usb1_icid;
422 u32 qe_icid;
423 u32 sdhc_icid;
424 u32 edma_icid;
425 u32 etr_icid;
426 u32 core_sft_rst[4];
427 u8 res_140[0x158-0x140];
428 u32 altcbar;
429 u32 qspi_cfg;
Calvin Johnson18f81c32018-03-08 15:30:32 +0530430 u8 res_160[0x164 - 0x160];
431 u32 wr_qos1;
432 u32 wr_qos2;
433 u32 rd_qos1;
434 u32 rd_qos2;
435 u8 res_174[0x180 - 0x174];
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800436 u32 dmamcr;
Wenbin Songa8f57a92017-01-17 18:31:15 +0800437 u8 res_184[0x188-0x184];
438 u32 gic_align;
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800439 u32 debug_icid;
440 u8 res_190[0x1a4-0x190];
441 u32 snpcnfgcr;
442 u8 res_1a8[0x1ac-0x1a8];
443 u32 intpcr;
444 u8 res_1b0[0x204-0x1b0];
445 u32 coresrencr;
446 u8 res_208[0x220-0x208];
447 u32 rvbar0_0;
448 u32 rvbar0_1;
449 u32 rvbar1_0;
450 u32 rvbar1_1;
451 u32 rvbar2_0;
452 u32 rvbar2_1;
453 u32 rvbar3_0;
454 u32 rvbar3_1;
455 u32 lpmcsr;
456 u8 res_244[0x400-0x244];
457 u32 qspidqscr;
458 u32 ecgtxcmcr;
459 u32 sdhciovselcr;
460 u32 rcwpmuxcr0;
461 u32 usbdrvvbus_selcr;
462 u32 usbpwrfault_selcr;
463 u32 usb_refclk_selcr1;
464 u32 usb_refclk_selcr2;
465 u32 usb_refclk_selcr3;
Calvin Johnson18f81c32018-03-08 15:30:32 +0530466 u8 res_424[0x434 - 0x424];
467 u32 rgmiipcr;
468 u32 res_438;
469 u32 rgmiipsr;
470 u32 pfepfcssr1;
471 u32 pfeintencr1;
472 u32 pfepfcssr2;
473 u32 pfeintencr2;
474 u32 pfeerrcr;
475 u32 pfeeerrintencr;
476 u32 pfeasbcr;
477 u32 pfebsbcr;
478 u8 res_460[0x484 - 0x460];
479 u32 mdioselcr;
480 u8 res_468[0x600 - 0x488];
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800481 u32 scratchrw[4];
482 u8 res_610[0x680-0x610];
483 u32 corebcr;
484 u8 res_684[0x1000-0x684];
485 u32 pex1msiir;
486 u32 pex1msir;
487 u8 res_1008[0x2000-0x1008];
488 u32 pex2;
489 u32 pex2msir;
490 u8 res_2008[0x3000-0x2008];
491 u32 pex3msiir;
492 u32 pex3msir;
493};
494
495/* Clocking */
496struct ccsr_clk {
497 struct {
498 u32 clkcncsr; /* core cluster n clock control status */
499 u8 res_004[0x0c];
500 u32 clkcghwacsr; /* Clock generator n hardware accelerator */
501 u8 res_014[0x0c];
502 } clkcsr[4];
503 u8 res_040[0x780]; /* 0x100 */
504 struct {
505 u32 pllcngsr;
506 u8 res_804[0x1c];
507 } pllcgsr[2];
508 u8 res_840[0x1c0];
509 u32 clkpcsr; /* 0xa00 Platform clock domain control/status */
510 u8 res_a04[0x1fc];
511 u32 pllpgsr; /* 0xc00 Platform PLL General Status */
512 u8 res_c04[0x1c];
513 u32 plldgsr; /* 0xc20 DDR PLL General Status */
514 u8 res_c24[0x3dc];
515};
516
517/* System Counter */
518struct sctr_regs {
519 u32 cntcr;
520 u32 cntsr;
521 u32 cntcv1;
522 u32 cntcv2;
523 u32 resv1[4];
524 u32 cntfid0;
525 u32 cntfid1;
526 u32 resv2[1002];
527 u32 counterid[12];
528};
529
530#define SRDS_MAX_LANES 4
531struct ccsr_serdes {
532 struct {
533 u32 rstctl; /* Reset Control Register */
534#define SRDS_RSTCTL_RST 0x80000000
535#define SRDS_RSTCTL_RSTDONE 0x40000000
536#define SRDS_RSTCTL_RSTERR 0x20000000
537#define SRDS_RSTCTL_SWRST 0x10000000
538#define SRDS_RSTCTL_SDEN 0x00000020
539#define SRDS_RSTCTL_SDRST_B 0x00000040
540#define SRDS_RSTCTL_PLLRST_B 0x00000080
541 u32 pllcr0; /* PLL Control Register 0 */
542#define SRDS_PLLCR0_POFF 0x80000000
543#define SRDS_PLLCR0_RFCK_SEL_MASK 0x70000000
544#define SRDS_PLLCR0_RFCK_SEL_100 0x00000000
545#define SRDS_PLLCR0_RFCK_SEL_125 0x10000000
546#define SRDS_PLLCR0_RFCK_SEL_156_25 0x20000000
547#define SRDS_PLLCR0_RFCK_SEL_150 0x30000000
548#define SRDS_PLLCR0_RFCK_SEL_161_13 0x40000000
549#define SRDS_PLLCR0_RFCK_SEL_122_88 0x50000000
550#define SRDS_PLLCR0_PLL_LCK 0x00800000
551#define SRDS_PLLCR0_FRATE_SEL_MASK 0x000f0000
552#define SRDS_PLLCR0_FRATE_SEL_5 0x00000000
553#define SRDS_PLLCR0_FRATE_SEL_3_75 0x00050000
554#define SRDS_PLLCR0_FRATE_SEL_5_15 0x00060000
555#define SRDS_PLLCR0_FRATE_SEL_4 0x00070000
556#define SRDS_PLLCR0_FRATE_SEL_3_12 0x00090000
557#define SRDS_PLLCR0_FRATE_SEL_3 0x000a0000
558 u32 pllcr1; /* PLL Control Register 1 */
559#define SRDS_PLLCR1_PLL_BWSEL 0x08000000
560 u32 res_0c; /* 0x00c */
561 u32 pllcr3;
562 u32 pllcr4;
Shaohui Xie8ba66062015-12-14 18:05:35 +0800563 u32 pllcr5; /* 0x018 SerDes PLL1 Control 5 */
564 u8 res_1c[0x20-0x1c];
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800565 } bank[2];
566 u8 res_40[0x90-0x40];
567 u32 srdstcalcr; /* 0x90 TX Calibration Control */
568 u8 res_94[0xa0-0x94];
569 u32 srdsrcalcr; /* 0xa0 RX Calibration Control */
570 u8 res_a4[0xb0-0xa4];
571 u32 srdsgr0; /* 0xb0 General Register 0 */
Shaohui Xie8ba66062015-12-14 18:05:35 +0800572 u8 res_b4[0x100-0xb4];
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800573 struct {
Shaohui Xie8ba66062015-12-14 18:05:35 +0800574 u32 lnpssr0; /* 0x100, 0x120, 0x140, 0x160 */
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800575 u8 res_104[0x120-0x104];
Shaohui Xie8ba66062015-12-14 18:05:35 +0800576 } lnpssr[4]; /* Lane A, B, C, D */
577 u8 res_180[0x200-0x180];
578 u32 srdspccr0; /* 0x200 Protocol Configuration 0 */
579 u32 srdspccr1; /* 0x204 Protocol Configuration 1 */
580 u32 srdspccr2; /* 0x208 Protocol Configuration 2 */
581 u32 srdspccr3; /* 0x20c Protocol Configuration 3 */
582 u32 srdspccr4; /* 0x210 Protocol Configuration 4 */
583 u32 srdspccr5; /* 0x214 Protocol Configuration 5 */
584 u32 srdspccr6; /* 0x218 Protocol Configuration 6 */
585 u32 srdspccr7; /* 0x21c Protocol Configuration 7 */
586 u32 srdspccr8; /* 0x220 Protocol Configuration 8 */
587 u32 srdspccr9; /* 0x224 Protocol Configuration 9 */
588 u32 srdspccra; /* 0x228 Protocol Configuration A */
589 u32 srdspccrb; /* 0x22c Protocol Configuration B */
590 u8 res_230[0x800-0x230];
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800591 struct {
592 u32 gcr0; /* 0x800 General Control Register 0 */
593 u32 gcr1; /* 0x804 General Control Register 1 */
594 u32 gcr2; /* 0x808 General Control Register 2 */
595 u32 sscr0;
596 u32 recr0; /* 0x810 Receive Equalization Control */
597 u32 recr1;
598 u32 tecr0; /* 0x818 Transmit Equalization Control */
599 u32 sscr1;
600 u32 ttlcr0; /* 0x820 Transition Tracking Loop Ctrl 0 */
601 u8 res_824[0x83c-0x824];
602 u32 tcsr3;
Shaohui Xie8ba66062015-12-14 18:05:35 +0800603 } lane[4]; /* Lane A, B, C, D */
604 u8 res_900[0x1000-0x900]; /* from 0x900 to 0xfff */
605 struct {
606 u32 srdspexcr0; /* 0x1000, 0x1040, 0x1080 */
607 u8 res_1004[0x1040-0x1004];
608 } pcie[3];
609 u8 res_10c0[0x1800-0x10c0];
610 struct {
611 u8 res_1800[0x1804-0x1800];
612 u32 srdssgmiicr1; /* 0x1804 SGMII Protocol Control 1 */
613 u8 res_1808[0x180c-0x1808];
614 u32 srdssgmiicr3; /* 0x180c SGMII Protocol Control 3 */
615 } sgmii[4]; /* Lane A, B, C, D */
616 u8 res_1840[0x1880-0x1840];
617 struct {
618 u8 res_1880[0x1884-0x1880];
619 u32 srdsqsgmiicr1; /* 0x1884 QSGMII Protocol Control 1 */
620 u8 res_1888[0x188c-0x1888];
621 u32 srdsqsgmiicr3; /* 0x188c QSGMII Protocol Control 3 */
622 } qsgmii[2]; /* Lane A, B */
623 u8 res_18a0[0x1980-0x18a0];
624 struct {
625 u8 res_1980[0x1984-0x1980];
626 u32 srdsxficr1; /* 0x1984 XFI Protocol Control 1 */
627 u8 res_1988[0x198c-0x1988];
628 u32 srdsxficr3; /* 0x198c XFI Protocol Control 3 */
629 } xfi[2]; /* Lane A, B */
630 u8 res_19a0[0x2000-0x19a0]; /* from 0x19a0 to 0x1fff */
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800631};
632
Prabhakar Kushwaha1a9d4982018-03-08 15:30:24 +0530633struct ccsr_gpio {
634 u32 gpdir;
635 u32 gpodr;
636 u32 gpdat;
637 u32 gpier;
638 u32 gpimr;
639 u32 gpicr;
640 u32 gpibe;
641};
642
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800643/* MMU 500 */
644#define SMMU_SCR0 (SMMU_BASE + 0x0)
645#define SMMU_SCR1 (SMMU_BASE + 0x4)
646#define SMMU_SCR2 (SMMU_BASE + 0x8)
647#define SMMU_SACR (SMMU_BASE + 0x10)
648#define SMMU_IDR0 (SMMU_BASE + 0x20)
649#define SMMU_IDR1 (SMMU_BASE + 0x24)
650
651#define SMMU_NSCR0 (SMMU_BASE + 0x400)
652#define SMMU_NSCR2 (SMMU_BASE + 0x408)
653#define SMMU_NSACR (SMMU_BASE + 0x410)
654
655#define SCR0_CLIENTPD_MASK 0x00000001
656#define SCR0_USFCFG_MASK 0x00000400
657
Rajesh Bhagat583da8b2018-11-05 18:01:42 +0000658#ifdef CONFIG_TFABOOT
659#define RCW_SRC_MASK (0xFF800000)
660#define RCW_SRC_BIT 23
661
662/* RCW SRC NAND */
663#define RCW_SRC_NAND_MASK (0x100)
664#define RCW_SRC_NAND_VAL (0x100)
665#define NAND_RESERVED_MASK (0xFC)
666#define NAND_RESERVED_1 (0x0)
667#define NAND_RESERVED_2 (0x80)
668
669/* RCW SRC NOR */
670#define RCW_SRC_NOR_MASK (0x1F0)
671#define NOR_8B_VAL (0x10)
672#define NOR_16B_VAL (0x20)
673#define SD_VAL (0x40)
674#define QSPI_VAL1 (0x44)
675#define QSPI_VAL2 (0x45)
676#endif
677
Sriram Dash9282d262016-06-13 09:58:32 +0530678uint get_svr(void);
679
Mingkai Hue4e93ea2015-10-26 19:47:51 +0800680#endif /* __ARCH_FSL_LSCH2_IMMAP_H__*/