blob: 49bac8c1fa6ae27064f62c379305c680ba2d6a0a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Peng Fanb11a7342018-01-10 13:20:20 +08002/*
3 * Copyright 2017 NXP
Peng Fanb11a7342018-01-10 13:20:20 +08004 */
5
Peng Fan39945c12018-11-20 10:19:25 +00006#ifndef __ASM_ARCH_IMX8M_REGS_H__
7#define __ASM_ARCH_IMX8M_REGS_H__
Peng Fanb11a7342018-01-10 13:20:20 +08008
Peng Fan00565bf2019-05-09 08:33:55 +00009#define ARCH_MXC
10
Peng Fanb11a7342018-01-10 13:20:20 +080011#include <asm/mach-imx/regs-lcdif.h>
12
Peng Fan2f8c5e12019-08-27 06:25:14 +000013#define ROM_VERSION_A0 IS_ENABLED(CONFIG_IMX8MQ) ? 0x800 : 0x800
14#define ROM_VERSION_B0 IS_ENABLED(CONFIG_IMX8MQ) ? 0x83C : 0x800
Peng Fanb11a7342018-01-10 13:20:20 +080015
Peng Fanc627b302019-08-27 06:25:10 +000016#define M4_BOOTROM_BASE_ADDR 0x007E0000
Peng Fanb11a7342018-01-10 13:20:20 +080017
Peng Fanb11a7342018-01-10 13:20:20 +080018#define GPIO1_BASE_ADDR 0X30200000
19#define GPIO2_BASE_ADDR 0x30210000
20#define GPIO3_BASE_ADDR 0x30220000
21#define GPIO4_BASE_ADDR 0x30230000
22#define GPIO5_BASE_ADDR 0x30240000
Peng Fanb11a7342018-01-10 13:20:20 +080023#define WDOG1_BASE_ADDR 0x30280000
24#define WDOG2_BASE_ADDR 0x30290000
25#define WDOG3_BASE_ADDR 0x302A0000
Peng Fanb11a7342018-01-10 13:20:20 +080026#define IOMUXC_BASE_ADDR 0x30330000
27#define IOMUXC_GPR_BASE_ADDR 0x30340000
28#define OCOTP_BASE_ADDR 0x30350000
29#define ANATOP_BASE_ADDR 0x30360000
Peng Fanb11a7342018-01-10 13:20:20 +080030#define CCM_BASE_ADDR 0x30380000
31#define SRC_BASE_ADDR 0x30390000
32#define GPC_BASE_ADDR 0x303A0000
Peng Fanb11a7342018-01-10 13:20:20 +080033
Peng Fanb11a7342018-01-10 13:20:20 +080034#define SYSCNT_RD_BASE_ADDR 0x306A0000
35#define SYSCNT_CMP_BASE_ADDR 0x306B0000
36#define SYSCNT_CTRL_BASE_ADDR 0x306C0000
Peng Fanb11a7342018-01-10 13:20:20 +080037
Peng Fanb11a7342018-01-10 13:20:20 +080038#define UART1_BASE_ADDR 0x30860000
39#define UART3_BASE_ADDR 0x30880000
40#define UART2_BASE_ADDR 0x30890000
Peng Fanb11a7342018-01-10 13:20:20 +080041#define I2C1_BASE_ADDR 0x30A20000
42#define I2C2_BASE_ADDR 0x30A30000
43#define I2C3_BASE_ADDR 0x30A40000
44#define I2C4_BASE_ADDR 0x30A50000
45#define UART4_BASE_ADDR 0x30A60000
Peng Fanb11a7342018-01-10 13:20:20 +080046#define USDHC1_BASE_ADDR 0x30B40000
47#define USDHC2_BASE_ADDR 0x30B50000
Peng Fan2f8c5e12019-08-27 06:25:14 +000048#ifdef CONFIG_IMX8MM
49#define USDHC3_BASE_ADDR 0x30B60000
50#endif
Peng Fanb11a7342018-01-10 13:20:20 +080051
Peng Fanb11a7342018-01-10 13:20:20 +080052#define TZASC_BASE_ADDR 0x32F80000
Peng Fanb11a7342018-01-10 13:20:20 +080053
Peng Fan2f8c5e12019-08-27 06:25:14 +000054#define MXS_LCDIF_BASE IS_ENABLED(CONFIG_IMX8MQ) ? \
55 0x30320000 : 0x32e00000
Peng Fanb11a7342018-01-10 13:20:20 +080056
57#define SRC_IPS_BASE_ADDR 0x30390000
58#define SRC_DDRC_RCR_ADDR 0x30391000
59#define SRC_DDRC2_RCR_ADDR 0x30391004
60
61#define DDRC_DDR_SS_GPR0 0x3d000000
62#define DDRC_IPS_BASE_ADDR(X) (0x3d400000 + ((X) * 0x2000000))
63#define DDR_CSD1_BASE_ADDR 0x40000000
64
Peng Fan4f0c97b2020-12-25 16:16:34 +080065#define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK 0x70000
Marek Vasutbefffe72021-02-25 22:02:26 +010066#define FEC_QUIRK_ENET_MAC
Peng Fan4f0c97b2020-12-25 16:16:34 +080067
Peng Fanb11a7342018-01-10 13:20:20 +080068#if !defined(__ASSEMBLY__)
69#include <asm/types.h>
70#include <linux/bitops.h>
71#include <stdbool.h>
72
73#define GPR_TZASC_EN BIT(0)
74#define GPR_TZASC_EN_LOCK BIT(16)
75
76#define SRC_SCR_M4_ENABLE_OFFSET 3
77#define SRC_SCR_M4_ENABLE_MASK BIT(3)
78#define SRC_SCR_M4C_NON_SCLR_RST_OFFSET 0
79#define SRC_SCR_M4C_NON_SCLR_RST_MASK BIT(0)
80#define SRC_DDR1_ENABLE_MASK 0x8F000000UL
81#define SRC_DDR2_ENABLE_MASK 0x8F000000UL
82#define SRC_DDR1_RCR_PHY_PWROKIN_N_MASK BIT(3)
83#define SRC_DDR1_RCR_PHY_RESET_MASK BIT(2)
84#define SRC_DDR1_RCR_CORE_RESET_N_MASK BIT(1)
85#define SRC_DDR1_RCR_PRESET_N_MASK BIT(0)
86
87struct iomuxc_gpr_base_regs {
88 u32 gpr[47];
89};
90
91struct ocotp_regs {
92 u32 ctrl;
93 u32 ctrl_set;
94 u32 ctrl_clr;
95 u32 ctrl_tog;
96 u32 timing;
97 u32 rsvd0[3];
98 u32 data;
99 u32 rsvd1[3];
100 u32 read_ctrl;
101 u32 rsvd2[3];
102 u32 read_fuse_data;
103 u32 rsvd3[3];
104 u32 sw_sticky;
105 u32 rsvd4[3];
106 u32 scs;
107 u32 scs_set;
108 u32 scs_clr;
109 u32 scs_tog;
110 u32 crc_addr;
111 u32 rsvd5[3];
112 u32 crc_value;
113 u32 rsvd6[3];
114 u32 version;
115 u32 rsvd7[0xdb];
116
117 /* fuse banks */
118 struct fuse_bank {
119 u32 fuse_regs[0x10];
120 } bank[0];
121};
122
Peng Fan438b52a2021-03-19 15:57:15 +0800123#ifdef CONFIG_IMX8MP
Peng Fanb11a7342018-01-10 13:20:20 +0800124struct fuse_bank0_regs {
125 u32 lock;
Peng Fan438b52a2021-03-19 15:57:15 +0800126 u32 rsvd0[7];
127 u32 uid_low;
128 u32 rsvd1[3];
129 u32 uid_high;
130 u32 rsvd2[3];
131};
132#else
133struct fuse_bank0_regs {
134 u32 lock;
Peng Fanb11a7342018-01-10 13:20:20 +0800135 u32 rsvd0[3];
136 u32 uid_low;
137 u32 rsvd1[3];
138 u32 uid_high;
139 u32 rsvd2[7];
140};
Peng Fan438b52a2021-03-19 15:57:15 +0800141#endif
Peng Fanb11a7342018-01-10 13:20:20 +0800142
143struct fuse_bank1_regs {
144 u32 tester3;
145 u32 rsvd0[3];
146 u32 tester4;
147 u32 rsvd1[3];
148 u32 tester5;
149 u32 rsvd2[3];
150 u32 cfg0;
151 u32 rsvd3[3];
152};
153
Peng Fan60767632020-05-03 22:19:56 +0800154struct fuse_bank3_regs {
155 u32 mem_trim0;
156 u32 rsvd0[3];
157 u32 mem_trim1;
158 u32 rsvd1[3];
159 u32 mem_trim2;
160 u32 rsvd2[3];
161 u32 ana0;
162 u32 rsvd3[3];
163};
164
165struct fuse_bank9_regs {
166 u32 mac_addr0;
167 u32 rsvd0[3];
168 u32 mac_addr1;
169 u32 rsvd1[11];
170};
171
172struct fuse_bank38_regs {
173 u32 ana_trim1; /* trim0 is at 0xD70, bank 37*/
174 u32 rsvd0[3];
175 u32 ana_trim2;
176 u32 rsvd1[3];
177 u32 ana_trim3;
178 u32 rsvd2[3];
179 u32 ana_trim4;
180 u32 rsvd3[3];
181};
182
183struct fuse_bank39_regs {
184 u32 ana_trim5;
185 u32 rsvd[15];
186};
187
Peng Fan2f8c5e12019-08-27 06:25:14 +0000188#ifdef CONFIG_IMX8MQ
Peng Fanb11a7342018-01-10 13:20:20 +0800189struct anamix_pll {
190 u32 audio_pll1_cfg0;
191 u32 audio_pll1_cfg1;
192 u32 audio_pll2_cfg0;
193 u32 audio_pll2_cfg1;
194 u32 video_pll_cfg0;
195 u32 video_pll_cfg1;
196 u32 gpu_pll_cfg0;
197 u32 gpu_pll_cfg1;
198 u32 vpu_pll_cfg0;
199 u32 vpu_pll_cfg1;
200 u32 arm_pll_cfg0;
201 u32 arm_pll_cfg1;
202 u32 sys_pll1_cfg0;
203 u32 sys_pll1_cfg1;
204 u32 sys_pll1_cfg2;
205 u32 sys_pll2_cfg0;
206 u32 sys_pll2_cfg1;
207 u32 sys_pll2_cfg2;
208 u32 sys_pll3_cfg0;
209 u32 sys_pll3_cfg1;
210 u32 sys_pll3_cfg2;
211 u32 video_pll2_cfg0;
212 u32 video_pll2_cfg1;
213 u32 video_pll2_cfg2;
214 u32 dram_pll_cfg0;
215 u32 dram_pll_cfg1;
216 u32 dram_pll_cfg2;
217 u32 digprog;
218 u32 osc_misc_cfg;
219 u32 pllout_monitor_cfg;
220 u32 frac_pllout_div_cfg;
221 u32 sscg_pllout_div_cfg;
222};
Peng Fan2f8c5e12019-08-27 06:25:14 +0000223#else
224struct anamix_pll {
225 u32 audio_pll1_gnrl_ctl;
226 u32 audio_pll1_fdiv_ctl0;
227 u32 audio_pll1_fdiv_ctl1;
228 u32 audio_pll1_sscg_ctl;
229 u32 audio_pll1_mnit_ctl;
230 u32 audio_pll2_gnrl_ctl;
231 u32 audio_pll2_fdiv_ctl0;
232 u32 audio_pll2_fdiv_ctl1;
233 u32 audio_pll2_sscg_ctl;
234 u32 audio_pll2_mnit_ctl;
235 u32 video_pll1_gnrl_ctl;
236 u32 video_pll1_fdiv_ctl0;
237 u32 video_pll1_fdiv_ctl1;
238 u32 video_pll1_sscg_ctl;
239 u32 video_pll1_mnit_ctl;
240 u32 reserved[5];
241 u32 dram_pll_gnrl_ctl;
242 u32 dram_pll_fdiv_ctl0;
243 u32 dram_pll_fdiv_ctl1;
244 u32 dram_pll_sscg_ctl;
245 u32 dram_pll_mnit_ctl;
246 u32 gpu_pll_gnrl_ctl;
247 u32 gpu_pll_div_ctl;
248 u32 gpu_pll_locked_ctl1;
249 u32 gpu_pll_mnit_ctl;
250 u32 vpu_pll_gnrl_ctl;
251 u32 vpu_pll_div_ctl;
252 u32 vpu_pll_locked_ctl1;
253 u32 vpu_pll_mnit_ctl;
254 u32 arm_pll_gnrl_ctl;
255 u32 arm_pll_div_ctl;
256 u32 arm_pll_locked_ctl1;
257 u32 arm_pll_mnit_ctl;
258 u32 sys_pll1_gnrl_ctl;
259 u32 sys_pll1_div_ctl;
260 u32 sys_pll1_locked_ctl1;
261 u32 reserved2[24];
262 u32 sys_pll1_mnit_ctl;
263 u32 sys_pll2_gnrl_ctl;
264 u32 sys_pll2_div_ctl;
265 u32 sys_pll2_locked_ctl1;
266 u32 sys_pll2_mnit_ctl;
267 u32 sys_pll3_gnrl_ctl;
268 u32 sys_pll3_div_ctl;
269 u32 sys_pll3_locked_ctl1;
270 u32 sys_pll3_mnit_ctl;
271 u32 anamix_misc_ctl;
272 u32 anamix_clk_mnit_ctl;
273 u32 reserved3[437];
274 u32 digprog;
275};
276#endif
Peng Fanb11a7342018-01-10 13:20:20 +0800277
Peng Fanb11a7342018-01-10 13:20:20 +0800278/* System Reset Controller (SRC) */
279struct src {
280 u32 scr;
281 u32 a53rcr;
282 u32 a53rcr1;
283 u32 m4rcr;
284 u32 reserved1[4];
285 u32 usbophy1_rcr;
286 u32 usbophy2_rcr;
287 u32 mipiphy_rcr;
288 u32 pciephy_rcr;
289 u32 hdmi_rcr;
290 u32 disp_rcr;
291 u32 reserved2[2];
292 u32 gpu_rcr;
293 u32 vpu_rcr;
294 u32 pcie2_rcr;
295 u32 mipiphy1_rcr;
296 u32 mipiphy2_rcr;
297 u32 reserved3;
298 u32 sbmr1;
299 u32 srsr;
300 u32 reserved4[2];
301 u32 sisr;
302 u32 simr;
303 u32 sbmr2;
304 u32 gpr1;
305 u32 gpr2;
306 u32 gpr3;
307 u32 gpr4;
308 u32 gpr5;
309 u32 gpr6;
310 u32 gpr7;
311 u32 gpr8;
312 u32 gpr9;
313 u32 gpr10;
314 u32 reserved5[985];
315 u32 ddr1_rcr;
316 u32 ddr2_rcr;
317};
318
Peng Fanb11a7342018-01-10 13:20:20 +0800319#define WDOG_WDT_MASK BIT(3)
320#define WDOG_WDZST_MASK BIT(0)
321struct wdog_regs {
322 u16 wcr; /* Control */
323 u16 wsr; /* Service */
324 u16 wrsr; /* Reset Status */
325 u16 wicr; /* Interrupt Control */
326 u16 wmcr; /* Miscellaneous Control */
327};
328
329struct bootrom_sw_info {
330 u8 reserved_1;
331 u8 boot_dev_instance;
332 u8 boot_dev_type;
333 u8 reserved_2;
334 u32 core_freq;
335 u32 axi_freq;
336 u32 ddr_freq;
337 u32 tick_freq;
338 u32 reserved_3[3];
339};
340
Peng Fan2f8c5e12019-08-27 06:25:14 +0000341#define ROM_SW_INFO_ADDR_B0 (IS_ENABLED(CONFIG_IMX8MQ) ? 0x00000968 :\
342 0x000009e8)
Peng Fanb11a7342018-01-10 13:20:20 +0800343#define ROM_SW_INFO_ADDR_A0 0x000009e8
344
345#define ROM_SW_INFO_ADDR is_soc_rev(CHIP_REV_1_0) ? \
346 (struct bootrom_sw_info **)ROM_SW_INFO_ADDR_A0 : \
347 (struct bootrom_sw_info **)ROM_SW_INFO_ADDR_B0
Peng Fan9cf2aa32020-07-09 13:52:41 +0800348
349struct gpc_reg {
350 u32 lpcr_bsc;
351 u32 lpcr_ad;
352 u32 lpcr_cpu1;
353 u32 lpcr_cpu2;
354 u32 lpcr_cpu3;
355 u32 slpcr;
356 u32 mst_cpu_mapping;
357 u32 mmdc_cpu_mapping;
358 u32 mlpcr;
359 u32 pgc_ack_sel;
360 u32 pgc_ack_sel_m4;
361 u32 gpc_misc;
362 u32 imr1_core0;
363 u32 imr2_core0;
364 u32 imr3_core0;
365 u32 imr4_core0;
366 u32 imr1_core1;
367 u32 imr2_core1;
368 u32 imr3_core1;
369 u32 imr4_core1;
370 u32 imr1_cpu1;
371 u32 imr2_cpu1;
372 u32 imr3_cpu1;
373 u32 imr4_cpu1;
374 u32 imr1_cpu3;
375 u32 imr2_cpu3;
376 u32 imr3_cpu3;
377 u32 imr4_cpu3;
378 u32 isr1_cpu0;
379 u32 isr2_cpu0;
380 u32 isr3_cpu0;
381 u32 isr4_cpu0;
382 u32 isr1_cpu1;
383 u32 isr2_cpu1;
384 u32 isr3_cpu1;
385 u32 isr4_cpu1;
386 u32 isr1_cpu2;
387 u32 isr2_cpu2;
388 u32 isr3_cpu2;
389 u32 isr4_cpu2;
390 u32 isr1_cpu3;
391 u32 isr2_cpu3;
392 u32 isr3_cpu3;
393 u32 isr4_cpu3;
394 u32 slt0_cfg;
395 u32 slt1_cfg;
396 u32 slt2_cfg;
397 u32 slt3_cfg;
398 u32 slt4_cfg;
399 u32 slt5_cfg;
400 u32 slt6_cfg;
401 u32 slt7_cfg;
402 u32 slt8_cfg;
403 u32 slt9_cfg;
404 u32 slt10_cfg;
405 u32 slt11_cfg;
406 u32 slt12_cfg;
407 u32 slt13_cfg;
408 u32 slt14_cfg;
409 u32 pgc_cpu_0_1_mapping;
410 u32 cpu_pgc_up_trg;
411 u32 mix_pgc_up_trg;
412 u32 pu_pgc_up_trg;
413 u32 cpu_pgc_dn_trg;
414 u32 mix_pgc_dn_trg;
415 u32 pu_pgc_dn_trg;
416 u32 lpcr_bsc2;
417 u32 pgc_cpu_2_3_mapping;
418 u32 lps_cpu0;
419 u32 lps_cpu1;
420 u32 lps_cpu2;
421 u32 lps_cpu3;
422 u32 gpc_gpr;
423 u32 gtor;
424 u32 debug_addr1;
425 u32 debug_addr2;
426 u32 cpu_pgc_up_status1;
427 u32 mix_pgc_up_status0;
428 u32 mix_pgc_up_status1;
429 u32 mix_pgc_up_status2;
430 u32 m4_mix_pgc_up_status0;
431 u32 m4_mix_pgc_up_status1;
432 u32 m4_mix_pgc_up_status2;
433 u32 pu_pgc_up_status0;
434 u32 pu_pgc_up_status1;
435 u32 pu_pgc_up_status2;
436 u32 m4_pu_pgc_up_status0;
437 u32 m4_pu_pgc_up_status1;
438 u32 m4_pu_pgc_up_status2;
439 u32 a53_lp_io_0;
440 u32 a53_lp_io_1;
441 u32 a53_lp_io_2;
442 u32 cpu_pgc_dn_status1;
443 u32 mix_pgc_dn_status0;
444 u32 mix_pgc_dn_status1;
445 u32 mix_pgc_dn_status2;
446 u32 m4_mix_pgc_dn_status0;
447 u32 m4_mix_pgc_dn_status1;
448 u32 m4_mix_pgc_dn_status2;
449 u32 pu_pgc_dn_status0;
450 u32 pu_pgc_dn_status1;
451 u32 pu_pgc_dn_status2;
452 u32 m4_pu_pgc_dn_status0;
453 u32 m4_pu_pgc_dn_status1;
454 u32 m4_pu_pgc_dn_status2;
455 u32 res[3];
456 u32 mix_pdn_flg;
457 u32 pu_pdn_flg;
458 u32 m4_mix_pdn_flg;
459 u32 m4_pu_pdn_flg;
460 u32 imr1_core2;
461 u32 imr2_core2;
462 u32 imr3_core2;
463 u32 imr4_core2;
464 u32 imr1_core3;
465 u32 imr2_core3;
466 u32 imr3_core3;
467 u32 imr4_core3;
468 u32 pgc_ack_sel_pu;
469 u32 pgc_ack_sel_m4_pu;
470 u32 slt15_cfg;
471 u32 slt16_cfg;
472 u32 slt17_cfg;
473 u32 slt18_cfg;
474 u32 slt19_cfg;
475 u32 gpc_pu_pwrhsk;
476 u32 slt0_cfg_pu;
477 u32 slt1_cfg_pu;
478 u32 slt2_cfg_pu;
479 u32 slt3_cfg_pu;
480 u32 slt4_cfg_pu;
481 u32 slt5_cfg_pu;
482 u32 slt6_cfg_pu;
483 u32 slt7_cfg_pu;
484 u32 slt8_cfg_pu;
485 u32 slt9_cfg_pu;
486 u32 slt10_cfg_pu;
487 u32 slt11_cfg_pu;
488 u32 slt12_cfg_pu;
489 u32 slt13_cfg_pu;
490 u32 slt14_cfg_pu;
491 u32 slt15_cfg_pu;
492 u32 slt16_cfg_pu;
493 u32 slt17_cfg_pu;
494 u32 slt18_cfg_pu;
495 u32 slt19_cfg_pu;
496};
497
498struct pgc_reg {
499 u32 pgcr;
500 u32 pgpupscr;
501 u32 pgpdnscr;
502 u32 pgsr;
503 u32 pgauxsw;
504 u32 pgdr;
505};
Peng Fanb11a7342018-01-10 13:20:20 +0800506#endif
507#endif