blob: fa3a97824faa626608a92ef96728a06d7a5cb9b2 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Alison Wang035260a2013-05-27 22:55:42 +00002/*
Chao Fuceb33472014-05-06 09:13:03 +08003 * Copyright 2013-2014 Freescale Semiconductor, Inc.
Alison Wang035260a2013-05-27 22:55:42 +00004 */
5
6#ifndef __ASM_ARCH_IMX_REGS_H__
7#define __ASM_ARCH_IMX_REGS_H__
8
9#define ARCH_MXC
10
11#define IRAM_BASE_ADDR 0x3F000000 /* internal ram */
12#define IRAM_SIZE 0x00080000 /* 512 KB */
13
14#define AIPS0_BASE_ADDR 0x40000000
15#define AIPS1_BASE_ADDR 0x40080000
16
17/* AIPS 0 */
18#define MSCM_BASE_ADDR (AIPS0_BASE_ADDR + 0x00001000)
19#define MSCM_IR_BASE_ADDR (AIPS0_BASE_ADDR + 0x00001800)
20#define CA5SCU_BASE_ADDR (AIPS0_BASE_ADDR + 0x00002000)
21#define CA5_INTD_BASE_ADDR (AIPS0_BASE_ADDR + 0x00003000)
22#define CA5_L2C_BASE_ADDR (AIPS0_BASE_ADDR + 0x00006000)
23#define NIC0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00008000)
24#define NIC1_BASE_ADDR (AIPS0_BASE_ADDR + 0x00009000)
25#define NIC2_BASE_ADDR (AIPS0_BASE_ADDR + 0x0000A000)
26#define NIC3_BASE_ADDR (AIPS0_BASE_ADDR + 0x0000B000)
27#define NIC4_BASE_ADDR (AIPS0_BASE_ADDR + 0x0000C000)
28#define NIC5_BASE_ADDR (AIPS0_BASE_ADDR + 0x0000D000)
29#define NIC6_BASE_ADDR (AIPS0_BASE_ADDR + 0x0000E000)
30#define NIC7_BASE_ADDR (AIPS0_BASE_ADDR + 0x0000F000)
31#define AHBTZASC_BASE_ADDR (AIPS0_BASE_ADDR + 0x00010000)
32#define TZASC_SYS0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00011000)
33#define TZASC_SYS1_BASE_ADDR (AIPS0_BASE_ADDR + 0x00012000)
34#define TZASC_GFX_BASE_ADDR (AIPS0_BASE_ADDR + 0x00013000)
35#define TZASC_DDR0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00014000)
36#define TZASC_DDR1_BASE_ADDR (AIPS0_BASE_ADDR + 0x00015000)
37#define CSU_BASE_ADDR (AIPS0_BASE_ADDR + 0x00017000)
38#define DMA0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00018000)
39#define DMA0_TCD_BASE_ADDR (AIPS0_BASE_ADDR + 0x00019000)
40#define SEMA4_BASE_ADDR (AIPS0_BASE_ADDR + 0x0001D000)
41#define FB_BASE_ADDR (AIPS0_BASE_ADDR + 0x0001E000)
42#define DMA_MUX0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00024000)
43#define UART0_BASE (AIPS0_BASE_ADDR + 0x00027000)
44#define UART1_BASE (AIPS0_BASE_ADDR + 0x00028000)
45#define UART2_BASE (AIPS0_BASE_ADDR + 0x00029000)
46#define UART3_BASE (AIPS0_BASE_ADDR + 0x0002A000)
47#define SPI0_BASE_ADDR (AIPS0_BASE_ADDR + 0x0002C000)
48#define SPI1_BASE_ADDR (AIPS0_BASE_ADDR + 0x0002D000)
49#define SAI0_BASE_ADDR (AIPS0_BASE_ADDR + 0x0002F000)
50#define SAI1_BASE_ADDR (AIPS0_BASE_ADDR + 0x00030000)
51#define SAI2_BASE_ADDR (AIPS0_BASE_ADDR + 0x00031000)
52#define SAI3_BASE_ADDR (AIPS0_BASE_ADDR + 0x00032000)
53#define CRC_BASE_ADDR (AIPS0_BASE_ADDR + 0x00033000)
Sanchayan Maity1b320bd2015-04-15 16:24:27 +053054#define USBC0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00034000)
Alison Wang035260a2013-05-27 22:55:42 +000055#define PDB_BASE_ADDR (AIPS0_BASE_ADDR + 0x00036000)
56#define PIT_BASE_ADDR (AIPS0_BASE_ADDR + 0x00037000)
57#define FTM0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00038000)
58#define FTM1_BASE_ADDR (AIPS0_BASE_ADDR + 0x00039000)
59#define ADC_BASE_ADDR (AIPS0_BASE_ADDR + 0x0003B000)
60#define TCON0_BASE_ADDR (AIPS0_BASE_ADDR + 0x0003D000)
61#define WDOG1_BASE_ADDR (AIPS0_BASE_ADDR + 0x0003E000)
62#define LPTMR_BASE_ADDR (AIPS0_BASE_ADDR + 0x00040000)
63#define RLE_BASE_ADDR (AIPS0_BASE_ADDR + 0x00042000)
64#define MLB_BASE_ADDR (AIPS0_BASE_ADDR + 0x00043000)
65#define QSPI0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00044000)
66#define IOMUXC_BASE_ADDR (AIPS0_BASE_ADDR + 0x00048000)
67#define ANADIG_BASE_ADDR (AIPS0_BASE_ADDR + 0x00050000)
Sanchayan Maity1b320bd2015-04-15 16:24:27 +053068#define USB_PHY0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00050800)
69#define USB_PHY1_BASE_ADDR (AIPS0_BASE_ADDR + 0x00050C00)
Stefan Agnerab2aaaa2015-04-15 16:24:23 +053070#define SCSC_BASE_ADDR (AIPS0_BASE_ADDR + 0x00052000)
Stefan Agner13011752017-04-11 11:12:14 +053071#define DCU0_BASE_ADDR (AIPS0_BASE_ADDR + 0x00058000)
Alison Wang035260a2013-05-27 22:55:42 +000072#define ASRC_BASE_ADDR (AIPS0_BASE_ADDR + 0x00060000)
73#define SPDIF_BASE_ADDR (AIPS0_BASE_ADDR + 0x00061000)
74#define ESAI_BASE_ADDR (AIPS0_BASE_ADDR + 0x00062000)
75#define ESAI_FIFO_BASE_ADDR (AIPS0_BASE_ADDR + 0x00063000)
76#define WDOG_BASE_ADDR (AIPS0_BASE_ADDR + 0x00065000)
Heiko Schocher24ebcf22015-05-18 10:58:12 +020077#define I2C1_BASE_ADDR (AIPS0_BASE_ADDR + 0x00066000)
Albert ARIBAUD \(3ADEV\)40281ba2015-06-19 14:18:29 +020078#define I2C2_BASE_ADDR (AIPS0_BASE_ADDR + 0x00067000)
79#define I2C3_BASE_ADDR (AIPS0_BASE_ADDR + 0x000E6000)
80#define I2C4_BASE_ADDR (AIPS0_BASE_ADDR + 0x000E7000)
Alison Wang035260a2013-05-27 22:55:42 +000081#define WKUP_BASE_ADDR (AIPS0_BASE_ADDR + 0x0006A000)
82#define CCM_BASE_ADDR (AIPS0_BASE_ADDR + 0x0006B000)
83#define GPC_BASE_ADDR (AIPS0_BASE_ADDR + 0x0006C000)
84#define VREG_DIG_BASE_ADDR (AIPS0_BASE_ADDR + 0x0006D000)
85#define SRC_BASE_ADDR (AIPS0_BASE_ADDR + 0x0006E000)
86#define CMU_BASE_ADDR (AIPS0_BASE_ADDR + 0x0006F000)
Bhuvanchandra DV6d236aa2015-06-01 18:37:16 +053087#define GPIO0_BASE_ADDR (AIPS0_BASE_ADDR + 0x000FF000)
88#define GPIO1_BASE_ADDR (AIPS0_BASE_ADDR + 0x000FF040)
89#define GPIO2_BASE_ADDR (AIPS0_BASE_ADDR + 0x000FF080)
90#define GPIO3_BASE_ADDR (AIPS0_BASE_ADDR + 0x000FF0C0)
91#define GPIO4_BASE_ADDR (AIPS0_BASE_ADDR + 0x000FF100)
Alison Wang035260a2013-05-27 22:55:42 +000092
93/* AIPS 1 */
94#define OCOTP_BASE_ADDR (AIPS1_BASE_ADDR + 0x00025000)
95#define DDR_BASE_ADDR (AIPS1_BASE_ADDR + 0x0002E000)
96#define ESDHC0_BASE_ADDR (AIPS1_BASE_ADDR + 0x00031000)
97#define ESDHC1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00032000)
Sanchayan Maity1b320bd2015-04-15 16:24:27 +053098#define USBC1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00034000)
Alison Wang035260a2013-05-27 22:55:42 +000099#define ENET_BASE_ADDR (AIPS1_BASE_ADDR + 0x00050000)
Marcel Ziswiler53957682014-03-11 18:43:59 +0100100#define ENET1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00051000)
Stefan Agner13011752017-04-11 11:12:14 +0530101#define DCU1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00058000)
Stefan Agnere8866902014-08-06 10:59:36 +0200102#define NFC_BASE_ADDR (AIPS1_BASE_ADDR + 0x00060000)
Alison Wang035260a2013-05-27 22:55:42 +0000103
Chao Fuceb33472014-05-06 09:13:03 +0800104#define QSPI0_AMBA_BASE 0x20000000
105
Alison Wang035260a2013-05-27 22:55:42 +0000106#define FEC_QUIRK_ENET_MAC
Alison Wang86bef202013-06-17 15:30:38 +0800107#define I2C_QUIRK_REG
Alison Wang035260a2013-05-27 22:55:42 +0000108
109/* MSCM interrupt rounter */
110#define MSCM_IRSPRC_CP0_EN 1
111#define MSCM_IRSPRC_NUM 112
112
113/* DDRMC */
114#define DDRMC_PHY_DQ_TIMING 0x00002613
115#define DDRMC_PHY_DQS_TIMING 0x00002615
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200116#define DDRMC_PHY_CTRL 0x00210000
Alison Wang035260a2013-05-27 22:55:42 +0000117#define DDRMC_PHY_MASTER_CTRL 0x0001012a
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200118#define DDRMC_PHY_SLAVE_CTRL 0x00002000
119#define DDRMC_PHY_OFF 0x00000000
120#define DDRMC_PHY_PROC_PAD_ODT 0x00010101
Alison Wang035260a2013-05-27 22:55:42 +0000121
122#define DDRMC_PHY50_DDR3_MODE (1 << 12)
123#define DDRMC_PHY50_EN_SW_HALF_CYCLE (1 << 8)
124
125#define DDRMC_CR00_DRAM_CLASS_DDR3 (0x6 << 8)
126#define DDRMC_CR00_DRAM_CLASS_LPDDR2 (0x5 << 8)
127#define DDRMC_CR00_START 1
128#define DDRMC_CR02_DRAM_TINIT(v) ((v) & 0xffffff)
129#define DDRMC_CR10_TRST_PWRON(v) (v)
130#define DDRMC_CR11_CKE_INACTIVE(v) (v)
131#define DDRMC_CR12_WRLAT(v) (((v) & 0x1f) << 8)
132#define DDRMC_CR12_CASLAT_LIN(v) ((v) & 0x3f)
133#define DDRMC_CR13_TRC(v) (((v) & 0xff) << 24)
134#define DDRMC_CR13_TRRD(v) (((v) & 0xff) << 16)
135#define DDRMC_CR13_TCCD(v) (((v) & 0x1f) << 8)
136#define DDRMC_CR13_TBST_INT_INTERVAL(v) ((v) & 0x7)
137#define DDRMC_CR14_TFAW(v) (((v) & 0x3f) << 24)
138#define DDRMC_CR14_TRP(v) (((v) & 0x1f) << 16)
139#define DDRMC_CR14_TWTR(v) (((v) & 0xf) << 8)
140#define DDRMC_CR14_TRAS_MIN(v) ((v) & 0xff)
141#define DDRMC_CR16_TMRD(v) (((v) & 0x1f) << 24)
142#define DDRMC_CR16_TRTP(v) (((v) & 0xf) << 16)
143#define DDRMC_CR17_TRAS_MAX(v) (((v) & 0x1ffff) << 8)
144#define DDRMC_CR17_TMOD(v) ((v) & 0xff)
145#define DDRMC_CR18_TCKESR(v) (((v) & 0x1f) << 8)
146#define DDRMC_CR18_TCKE(v) ((v) & 0x7)
147#define DDRMC_CR20_AP_EN (1 << 24)
148#define DDRMC_CR21_TRCD_INT(v) (((v) & 0xff) << 16)
Albert ARIBAUD \\(3ADEV\\)25ac8ce2015-09-21 22:43:37 +0200149#define DDRMC_CR21_TRAS_LOCKOUT(v) ((v) << 8)
Alison Wang035260a2013-05-27 22:55:42 +0000150#define DDRMC_CR21_CCMAP_EN 1
151#define DDRMC_CR22_TDAL(v) (((v) & 0x3f) << 16)
152#define DDRMC_CR23_BSTLEN(v) (((v) & 0x7) << 24)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200153#define DDRMC_CR23_TDLL(v) ((v) & 0xffff)
Alison Wang035260a2013-05-27 22:55:42 +0000154#define DDRMC_CR24_TRP_AB(v) ((v) & 0x1f)
155#define DDRMC_CR25_TREF_EN (1 << 16)
156#define DDRMC_CR26_TREF(v) (((v) & 0xffff) << 16)
157#define DDRMC_CR26_TRFC(v) ((v) & 0x3ff)
158#define DDRMC_CR28_TREF_INT(v) ((v) & 0xffff)
159#define DDRMC_CR29_TPDEX(v) ((v) & 0xffff)
160#define DDRMC_CR30_TXPDLL(v) ((v) & 0xffff)
161#define DDRMC_CR31_TXSNR(v) (((v) & 0xffff) << 16)
162#define DDRMC_CR31_TXSR(v) ((v) & 0xffff)
163#define DDRMC_CR33_EN_QK_SREF (1 << 16)
164#define DDRMC_CR34_CKSRX(v) (((v) & 0xf) << 16)
165#define DDRMC_CR34_CKSRE(v) (((v) & 0xf) << 8)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200166#define DDRMC_CR38_FREQ_CHG_EN(v) (((v) & 0x1) << 8)
Alison Wang035260a2013-05-27 22:55:42 +0000167#define DDRMC_CR39_PHY_INI_COM(v) (((v) & 0xffff) << 16)
168#define DDRMC_CR39_PHY_INI_STA(v) (((v) & 0xff) << 8)
169#define DDRMC_CR39_FRQ_CH_DLLOFF(v) ((v) & 0x3)
170#define DDRMC_CR41_PHY_INI_STRT_INI_DIS 1
171#define DDRMC_CR48_MR1_DA_0(v) (((v) & 0xffff) << 16)
172#define DDRMC_CR48_MR0_DA_0(v) ((v) & 0xffff)
173#define DDRMC_CR66_ZQCL(v) (((v) & 0xfff) << 16)
174#define DDRMC_CR66_ZQINIT(v) ((v) & 0xfff)
175#define DDRMC_CR67_ZQCS(v) ((v) & 0xfff)
176#define DDRMC_CR69_ZQ_ON_SREF_EX(v) (((v) & 0xf) << 8)
177#define DDRMC_CR70_REF_PER_ZQ(v) (v)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200178#define DDRMC_CR72_ZQCS_ROTATE(v) (((v) & 0x1) << 24)
Alison Wang035260a2013-05-27 22:55:42 +0000179#define DDRMC_CR73_APREBIT(v) (((v) & 0xf) << 24)
180#define DDRMC_CR73_COL_DIFF(v) (((v) & 0x7) << 16)
181#define DDRMC_CR73_ROW_DIFF(v) (((v) & 0x3) << 8)
182#define DDRMC_CR74_BANKSPLT_EN (1 << 24)
183#define DDRMC_CR74_ADDR_CMP_EN (1 << 16)
184#define DDRMC_CR74_CMD_AGE_CNT(v) (((v) & 0xff) << 8)
185#define DDRMC_CR74_AGE_CNT(v) ((v) & 0xff)
186#define DDRMC_CR75_RW_PG_EN (1 << 24)
187#define DDRMC_CR75_RW_EN (1 << 16)
188#define DDRMC_CR75_PRI_EN (1 << 8)
189#define DDRMC_CR75_PLEN 1
190#define DDRMC_CR76_NQENT_ACTDIS(v) (((v) & 0x7) << 24)
191#define DDRMC_CR76_D_RW_G_BKCN(v) (((v) & 0x3) << 16)
192#define DDRMC_CR76_W2R_SPLT_EN (1 << 8)
193#define DDRMC_CR76_CS_EN 1
194#define DDRMC_CR77_CS_MAP (1 << 24)
195#define DDRMC_CR77_DI_RD_INTLEAVE (1 << 8)
196#define DDRMC_CR77_SWAP_EN 1
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200197#define DDRMC_CR78_Q_FULLNESS(v) (((v) & 0x7) << 24)
Alison Wang035260a2013-05-27 22:55:42 +0000198#define DDRMC_CR78_BUR_ON_FLY_BIT(v) ((v) & 0xf)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200199#define DDRMC_CR79_CTLUPD_AREF(v) (((v) & 0x1) << 24)
Stefan Agnerfb7c3b92018-12-04 11:10:20 +0100200#define DDRMC_CR80_MC_INIT_COMPLETE (1 << 8)
201#define DDRMC_CR82_INT_MASK (1 << 28)
Albert ARIBAUD \\(3ADEV\\)25ac8ce2015-09-21 22:43:37 +0200202#define DDRMC_CR87_ODT_WR_MAPCS0(v) ((v) << 24)
203#define DDRMC_CR87_ODT_RD_MAPCS0(v) ((v) << 16)
Alison Wang035260a2013-05-27 22:55:42 +0000204#define DDRMC_CR88_TODTL_CMD(v) (((v) & 0x1f) << 16)
205#define DDRMC_CR89_AODT_RWSMCS(v) ((v) & 0xf)
206#define DDRMC_CR91_R2W_SMCSDL(v) (((v) & 0x7) << 16)
Lukasz Majewskif3ff0b22018-12-05 17:04:01 +0100207#define DDRMC_CR93_SW_LVL_MODE_OFF (8)
208#define DDRMC_CR93_SW_LVL_MODE(v) (((v) & 0x3) << DDRMC_CR93_SW_LVL_MODE_OFF)
209#define DDRMC_CR93_SWLVL_LOAD BIT(16)
210#define DDRMC_CR93_SWLVL_START BIT(24)
211#define DDRMC_CR94_SWLVL_EXIT BIT(0)
212#define DDRMC_CR94_SWLVL_OP_DONE BIT(8)
213#define DDRMC_CR94_SWLVL_RESP_0_OFF (24)
214#define DDRMC_CR95_SWLVL_RESP_1_OFF (0)
Alison Wang035260a2013-05-27 22:55:42 +0000215#define DDRMC_CR96_WLMRD(v) (((v) & 0x3f) << 8)
216#define DDRMC_CR96_WLDQSEN(v) ((v) & 0x3f)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200217#define DDRMC_CR97_WRLVL_EN (1 << 24)
Sanchayan Maitye3a76e22015-04-15 16:24:22 +0530218#define DDRMC_CR98_WRLVL_DL_0(v) ((v) & 0xffff)
219#define DDRMC_CR99_WRLVL_DL_1(v) ((v) & 0xffff)
Lukasz Majewskif3ff0b22018-12-05 17:04:01 +0100220#define DDRMC_CR101_PHY_RDLVL_EDGE_OFF (24)
221#define DDRMC_CR101_PHY_RDLVL_EDGE BIT(DDRMC_CR101_PHY_RDLVL_EDGE_OFF)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200222#define DDRMC_CR102_RDLVL_GT_REGEN (1 << 16)
223#define DDRMC_CR102_RDLVL_REG_EN (1 << 8)
Lukasz Majewskif3ff0b22018-12-05 17:04:01 +0100224#define DDRMC_CR105_RDLVL_DL_0_OFF (8)
225#define DDRMC_CR105_RDLVL_DL_0(v) (((v) & 0xff) << DDRMC_CR105_RDLVL_DL_0_OFF)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200226#define DDRMC_CR106_RDLVL_GTDL_0(v) ((v) & 0xff)
Lukasz Majewskif3ff0b22018-12-05 17:04:01 +0100227#define DDRMC_CR110_RDLVL_DL_1_OFF (0)
Alison Wang035260a2013-05-27 22:55:42 +0000228#define DDRMC_CR110_RDLVL_DL_1(v) ((v) & 0xff)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200229#define DDRMC_CR110_RDLVL_GTDL_1(v) (((v) & 0xff) << 16)
Alison Wang035260a2013-05-27 22:55:42 +0000230#define DDRMC_CR114_RDLVL_GTDL_2(v) (((v) & 0xffff) << 8)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200231#define DDRMC_CR115_RDLVL_GTDL_2(v) ((v) & 0xff)
Alison Wang035260a2013-05-27 22:55:42 +0000232#define DDRMC_CR117_AXI0_W_PRI(v) (((v) & 0x3) << 8)
233#define DDRMC_CR117_AXI0_R_PRI(v) ((v) & 0x3)
234#define DDRMC_CR118_AXI1_W_PRI(v) (((v) & 0x3) << 24)
235#define DDRMC_CR118_AXI1_R_PRI(v) (((v) & 0x3) << 16)
236#define DDRMC_CR120_AXI0_PRI1_RPRI(v) (((v) & 0xf) << 24)
237#define DDRMC_CR120_AXI0_PRI0_RPRI(v) (((v) & 0xf) << 16)
238#define DDRMC_CR121_AXI0_PRI3_RPRI(v) (((v) & 0xf) << 8)
239#define DDRMC_CR121_AXI0_PRI2_RPRI(v) ((v) & 0xf)
240#define DDRMC_CR122_AXI1_PRI1_RPRI(v) (((v) & 0xf) << 24)
241#define DDRMC_CR122_AXI1_PRI0_RPRI(v) (((v) & 0xf) << 16)
242#define DDRMC_CR122_AXI0_PRIRLX(v) ((v) & 0x3ff)
243#define DDRMC_CR123_AXI1_PRI3_RPRI(v) (((v) & 0xf) << 8)
244#define DDRMC_CR123_AXI1_PRI2_RPRI(v) ((v) & 0xf)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200245#define DDRMC_CR123_AXI1_P_ODR_EN (1 << 16)
Alison Wang035260a2013-05-27 22:55:42 +0000246#define DDRMC_CR124_AXI1_PRIRLX(v) ((v) & 0x3ff)
247#define DDRMC_CR126_PHY_RDLAT(v) (((v) & 0x3f) << 8)
248#define DDRMC_CR132_WRLAT_ADJ(v) (((v) & 0x1f) << 8)
249#define DDRMC_CR132_RDLAT_ADJ(v) ((v) & 0x3f)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200250#define DDRMC_CR137_PHYCTL_DL(v) (((v) & 0xf) << 16)
251#define DDRMC_CR138_PHY_WRLV_MXDL(v) (((v) & 0xffff) << 16)
Stefan Agnere63d2332018-12-04 11:10:19 +0100252#define DDRMC_CR138_PHYDRAM_CK_EN(v) (((v) & 0x7) << 8)
Alison Wang035260a2013-05-27 22:55:42 +0000253#define DDRMC_CR139_PHY_WRLV_RESPLAT(v) (((v) & 0xff) << 24)
254#define DDRMC_CR139_PHY_WRLV_LOAD(v) (((v) & 0xff) << 16)
255#define DDRMC_CR139_PHY_WRLV_DLL(v) (((v) & 0xff) << 8)
256#define DDRMC_CR139_PHY_WRLV_EN(v) ((v) & 0xff)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200257#define DDRMC_CR140_PHY_WRLV_WW(v) ((v) & 0x3ff)
258#define DDRMC_CR143_RDLV_GAT_MXDL(v) (((v) & 0xffff) << 16)
259#define DDRMC_CR143_RDLV_MXDL(v) ((v) & 0xffff)
260#define DDRMC_CR144_PHY_RDLVL_RES(v) (((v) & 0xff) << 24)
261#define DDRMC_CR144_PHY_RDLV_LOAD(v) (((v) & 0xff) << 16)
262#define DDRMC_CR144_PHY_RDLV_DLL(v) (((v) & 0xff) << 8)
263#define DDRMC_CR144_PHY_RDLV_EN(v) ((v) & 0xff)
264#define DDRMC_CR145_PHY_RDLV_RR(v) ((v) & 0x3ff)
265#define DDRMC_CR146_PHY_RDLVL_RESP(v) (v)
266#define DDRMC_CR147_RDLV_RESP_MASK(v) ((v) & 0xfffff)
267#define DDRMC_CR148_RDLV_GATE_RESP_MASK(v) ((v) & 0xfffff)
268#define DDRMC_CR151_RDLV_GAT_DQ_ZERO_CNT(v) (((v) & 0xf) << 8)
269#define DDRMC_CR151_RDLVL_DQ_ZERO_CNT(v) ((v) & 0xf)
Alison Wang035260a2013-05-27 22:55:42 +0000270#define DDRMC_CR154_PAD_ZQ_EARLY_CMP_EN_TIMER(v) (((v) & 0x1f) << 27)
271#define DDRMC_CR154_PAD_ZQ_MODE(v) (((v) & 0x3) << 21)
Stefan Agnerad4bb012014-04-23 18:17:51 +0200272#define DDRMC_CR154_DDR_SEL_PAD_CONTR(v) (((v) & 0x3) << 18)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200273#define DDRMC_CR154_PAD_ZQ_HW_FOR(v) (((v) & 0x1) << 14)
Alison Wang035260a2013-05-27 22:55:42 +0000274#define DDRMC_CR155_AXI0_AWCACHE (1 << 10)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200275#define DDRMC_CR155_PAD_ODT_BYTE1(v) (((v) & 0x7) << 3)
276#define DDRMC_CR155_PAD_ODT_BYTE0(v) ((v) & 0x7)
Alison Wang035260a2013-05-27 22:55:42 +0000277#define DDRMC_CR158_TWR(v) ((v) & 0x3f)
Anthony Feliceaf0464f2014-09-06 19:47:06 +0200278#define DDRMC_CR161_ODT_EN(v) (((v) & 0x1) << 16)
279#define DDRMC_CR161_TODTH_RD(v) (((v) & 0xf) << 8)
280#define DDRMC_CR161_TODTH_WR(v) ((v) & 0xf)
Alison Wang035260a2013-05-27 22:55:42 +0000281
Stefan Agner5b4ca3e2014-11-27 23:58:20 +0100282/* System Reset Controller (SRC) */
283#define SRC_SRSR_SW_RST (0x1 << 18)
284#define SRC_SRSR_RESETB (0x1 << 7)
285#define SRC_SRSR_JTAG_RST (0x1 << 5)
286#define SRC_SRSR_WDOG_M4 (0x1 << 4)
287#define SRC_SRSR_WDOG_A5 (0x1 << 3)
288#define SRC_SRSR_POR_RST (0x1 << 0)
Lukasz Majewski8df96a22019-02-13 22:46:56 +0100289#define SRC_SBMR1_BOOTCFG1_SDMMC BIT(6)
290#define SRC_SBMR1_BOOTCFG1_MMC BIT(4)
Sanchayan Maitycc4d78f2015-04-15 16:24:26 +0530291#define SRC_SBMR2_BMOD_MASK (0x3 << 24)
292#define SRC_SBMR2_BMOD_SHIFT 24
293#define SRC_SBMR2_BMOD_FUSES 0x0
294#define SRC_SBMR2_BMOD_SERIAL 0x1
295#define SRC_SBMR2_BMOD_RCON 0x2
Stefan Agner5b4ca3e2014-11-27 23:58:20 +0100296
Stefan Agnerab2aaaa2015-04-15 16:24:23 +0530297/* Slow Clock Source Controller Module (SCSC) */
298#define SCSC_SOSC_CTR_SOSC_EN 0x1
299
Alison Wang035260a2013-05-27 22:55:42 +0000300#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
301#include <asm/types.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -0600302#include <linux/bitops.h>
Alison Wang035260a2013-05-27 22:55:42 +0000303
304/* System Reset Controller (SRC) */
305struct src {
306 u32 scr;
307 u32 sbmr1;
308 u32 srsr;
309 u32 secr;
310 u32 gpsr;
311 u32 sicr;
312 u32 simr;
313 u32 sbmr2;
314 u32 gpr0;
315 u32 gpr1;
316 u32 gpr2;
317 u32 gpr3;
318 u32 gpr4;
319 u32 hab0;
320 u32 hab1;
321 u32 hab2;
322 u32 hab3;
323 u32 hab4;
324 u32 hab5;
325 u32 misc0;
326 u32 misc1;
327 u32 misc2;
328 u32 misc3;
329};
330
331/* Periodic Interrupt Timer (PIT) */
332struct pit_reg {
333 u32 mcr;
334 u32 recv0[55];
335 u32 ltmr64h;
336 u32 ltmr64l;
337 u32 recv1[6];
338 u32 ldval0;
339 u32 cval0;
340 u32 tctrl0;
341 u32 tflg0;
342 u32 ldval1;
343 u32 cval1;
344 u32 tctrl1;
345 u32 tflg1;
346 u32 ldval2;
347 u32 cval2;
348 u32 tctrl2;
349 u32 tflg2;
350 u32 ldval3;
351 u32 cval3;
352 u32 tctrl3;
353 u32 tflg3;
354 u32 ldval4;
355 u32 cval4;
356 u32 tctrl4;
357 u32 tflg4;
358 u32 ldval5;
359 u32 cval5;
360 u32 tctrl5;
361 u32 tflg5;
362 u32 ldval6;
363 u32 cval6;
364 u32 tctrl6;
365 u32 tflg6;
366 u32 ldval7;
367 u32 cval7;
368 u32 tctrl7;
369 u32 tflg7;
370};
371
372/* Watchdog Timer (WDOG) */
373struct wdog_regs {
374 u16 wcr;
375 u16 wsr;
376 u16 wrsr;
377 u16 wicr;
378 u16 wmcr;
379};
380
381/* LPDDR2/DDR3 SDRAM Memory Controller (DDRMC) */
382struct ddrmr_regs {
383 u32 cr[162];
384 u32 rsvd[94];
385 u32 phy[53];
386};
387
388/* On-Chip One Time Programmable Controller (OCOTP) */
389struct ocotp_regs {
390 u32 ctrl;
391 u32 ctrl_set;
392 u32 ctrl_clr;
393 u32 ctrl_tog;
394 u32 timing;
395 u32 rsvd0[3];
396 u32 data;
397 u32 rsvd1[3];
398 u32 read_ctrl;
399 u32 rsvd2[3];
400 u32 read_fuse_data;
401 u32 rsvd3[7];
402 u32 scs;
403 u32 scs_set;
404 u32 scs_clr;
405 u32 scs_tog;
406 u32 crc_addr;
407 u32 rsvd4[3];
408 u32 crc_value;
409 u32 rsvd5[3];
410 u32 version;
411 u32 rsvd6[0xdb];
412
413 struct fuse_bank {
414 u32 fuse_regs[0x20];
415 } bank[16];
416};
417
418struct fuse_bank0_regs {
419 u32 lock;
420 u32 rsvd0[3];
421 u32 uid_low;
422 u32 rsvd1[3];
423 u32 uid_high;
424 u32 rsvd2[0x17];
425};
426
427struct fuse_bank4_regs {
428 u32 sjc_resp0;
429 u32 rsvd0[3];
430 u32 sjc_resp1;
431 u32 rsvd1[3];
432 u32 mac_addr0;
433 u32 rsvd2[3];
434 u32 mac_addr1;
435 u32 rsvd3[3];
436 u32 mac_addr2;
437 u32 rsvd4[3];
438 u32 mac_addr3;
439 u32 rsvd5[3];
440 u32 gp1;
441 u32 rsvd6[3];
442 u32 gp2;
443 u32 rsvd7[3];
444};
445
Alison Wang035260a2013-05-27 22:55:42 +0000446/* MSCM Interrupt Router */
447struct mscm_ir {
448 u32 ircp0ir;
449 u32 ircp1ir;
450 u32 rsvd1[6];
451 u32 ircpgir;
452 u32 rsvd2[23];
453 u16 irsprc[112];
454 u16 rsvd3[848];
455};
456
Stefan Agnerab2aaaa2015-04-15 16:24:23 +0530457/* SCSC */
458struct scsc_reg {
459 u32 sirc_ctr;
460 u32 sosc_ctr;
461};
462
Sanchayan Maitycb01fb12015-04-15 16:24:24 +0530463/* MSCM */
464struct mscm {
465 u32 cpxtype;
466 u32 cpxnum;
467 u32 cpxmaster;
468 u32 cpxcount;
469 u32 cpxcfg0;
470 u32 cpxcfg1;
471 u32 cpxcfg2;
472 u32 cpxcfg3;
473};
474
Simon Glass559f1a82020-05-10 11:40:12 -0600475#endif /* __ASSEMBLY__ */
Alison Wang035260a2013-05-27 22:55:42 +0000476
477#endif /* __ASM_ARCH_IMX_REGS_H__ */