2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef __ASM_ARCH_MXC_MX50_H__
20 #define __ASM_ARCH_MXC_MX50_H__
22 #define __REG(x) (*((volatile u32 *)(x)))
23 #define __REG16(x) (*((volatile u16 *)(x)))
24 #define __REG8(x) (*((volatile u8 *)(x)))
29 #define IRAM_BASE_ADDR 0xF8000000 /* internal ram */
30 #define IRAM_PARTITIONS 16
31 #define IRAM_SIZE (IRAM_PARTITIONS*SZ_8K) /* 128KB */
33 #define TZIC_BASE_ADDR 0x0FFFC000
34 #define DATABAHN_BASE_ADDR 0x14000000
36 #define DEBUG_BASE_ADDR 0x40000000
37 #define ETB_BASE_ADDR (DEBUG_BASE_ADDR + 0x00001000)
38 #define ETM_BASE_ADDR (DEBUG_BASE_ADDR + 0x00002000)
39 #define TPIU_BASE_ADDR (DEBUG_BASE_ADDR + 0x00003000)
40 #define CTI0_BASE_ADDR (DEBUG_BASE_ADDR + 0x00004000)
41 #define CTI1_BASE_ADDR (DEBUG_BASE_ADDR + 0x00005000)
42 #define CTI2_BASE_ADDR (DEBUG_BASE_ADDR + 0x00006000)
43 #define CTI3_BASE_ADDR (DEBUG_BASE_ADDR + 0x00007000)
44 #define CORTEX_DBG_BASE_ADDR (DEBUG_BASE_ADDR + 0x00008000)
45 #define OCOTP_CTRL_BASE_ADDR (DEBUG_BASE_ADDR + 0x01002000)
46 #define EPDC_BASE_ADDR (DEBUG_BASE_ADDR + 0x01010000)
49 * SPBA global module enabled #0
51 #define SPBA0_BASE_ADDR 0x50000000
53 #define MMC_SDHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00004000)
54 #define MMC_SDHC2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00008000)
55 #define UART3_BASE_ADDR (SPBA0_BASE_ADDR + 0x0000C000)
56 #define CSPI1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00010000)
57 #define SSI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00014000)
58 #define MMC_SDHC3_BASE_ADDR (SPBA0_BASE_ADDR + 0x00020000)
59 #define MMC_SDHC4_BASE_ADDR (SPBA0_BASE_ADDR + 0x00024000)
60 #define SPBA_CTRL_BASE_ADDR (SPBA0_BASE_ADDR + 0x0003C000)
63 * defines for SPBA modules
65 #define SPBA_SDHC1 0x04
66 #define SPBA_SDHC2 0x08
67 #define SPBA_UART3 0x0C
68 #define SPBA_CSPI1 0x10
69 #define SPBA_SSI2 0x14
70 #define SPBA_ESAI 0x18
71 #define SPBA_SDHC3 0x20
72 #define SPBA_SDHC4 0x24
73 #define SPBA_SPDIF 0x28
74 #define SPBA_ASRC 0x2C
76 #define SPBA_CTRL 0x3C
81 #define AIPS1_BASE_ADDR 0x53F00000
83 #define OTG_BASE_ADDR (AIPS1_BASE_ADDR + 0x00080000)
84 #define GPIO1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00084000)
85 #define GPIO2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00088000)
86 #define GPIO3_BASE_ADDR (AIPS1_BASE_ADDR + 0x0008C000)
87 #define GPIO4_BASE_ADDR (AIPS1_BASE_ADDR + 0x00090000)
88 #define KPP_BASE_ADDR (AIPS1_BASE_ADDR + 0x00094000)
89 #define WDOG1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00098000)
90 #define GPT1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A0000)
91 #define SRTC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A4000)
92 #define IOMUXC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A8000)
93 #define EPIT1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000AC000)
94 #define PWM1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B4000)
95 #define PWM2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B8000)
96 #define UART1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000BC000)
97 #define UART2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000C0000)
98 #define USBOH1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000C4000)
99 #define SRC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D0000)
100 #define CCM_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D4000)
101 #define GPC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D8000)
102 #define GPIO5_BASE_ADDR (AIPS1_BASE_ADDR + 0x000DC000)
103 #define GPIO6_BASE_ADDR (AIPS1_BASE_ADDR + 0x000E0000)
104 #define GPIO7_BASE_ADDR (AIPS1_BASE_ADDR + 0x000E4000)
105 #define ATA_BASE_ADDR (AIPS1_BASE_ADDR + 0x000E8000)
106 #define I2C3_BASE_ADDR (AIPS1_BASE_ADDR + 0x000EC000)
107 #define UART4_BASE_ADDR (AIPS1_BASE_ADDR + 0x000F0000)
108 #define MSHC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000F4000)
109 #define RNGB_BASE_ADDR (AIPS1_BASE_ADDR + 0x000F8000)
114 #define AIPS2_BASE_ADDR 0x63F00000
116 #define PLL1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00080000)
117 #define PLL2_BASE_ADDR (AIPS2_BASE_ADDR + 0x00084000)
118 #define PLL3_BASE_ADDR (AIPS2_BASE_ADDR + 0x00088000)
119 #define UART5_BASE_ADDR (AIPS2_BASE_ADDR + 0x00090000)
120 #define AHBMAX_BASE_ADDR (AIPS2_BASE_ADDR + 0x00094000)
121 #define ARM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A0000)
122 #define OWIRE_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A4000)
123 #define CSPI2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AC000)
124 #define SDMA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B0000)
125 #define ROMCP_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B8000)
126 #define CSPI3_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C0000)
127 #define I2C2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C4000)
128 #define I2C1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C8000)
129 #define SSI1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000CC000)
130 #define AUDMUX_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D0000)
131 #define M4IF_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D8000)
132 #define ESDCTL_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D9000)
133 #define WEIM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DA000)
134 #define NFC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DB000)
135 #define EMI_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DBF00)
136 #define FEC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000EC000)
139 * Some of i.MX50 SoC registers are associated with four addresses
140 * used for different operations - read/write, set, clear and toggle bits.
142 * Some of registers do not implement such feature and, thus, should be
143 * accessed/manipulated via single address in common way.
145 #define REG_RD(base, reg) \
146 (*(volatile unsigned int *)((base) + (reg)))
147 #define REG_WR(base, reg, value) \
148 ((*(volatile unsigned int *)((base) + (reg))) = (value))
149 #define REG_SET(base, reg, value) \
150 ((*(volatile unsigned int *)((base) + (reg ## _SET))) = (value))
151 #define REG_CLR(base, reg, value) \
152 ((*(volatile unsigned int *)((base) + (reg ## _CLR))) = (value))
153 #define REG_TOG(base, reg, value) \
154 ((*(volatile unsigned int *)((base) + (reg ## _TOG))) = (value))
156 #define REG_RD_ADDR(addr) \
157 (*(volatile unsigned int *)((addr)))
158 #define REG_WR_ADDR(addr, value) \
159 ((*(volatile unsigned int *)((addr))) = (value))
160 #define REG_SET_ADDR(addr, value) \
161 ((*(volatile unsigned int *)((addr) + 0x4)) = (value))
162 #define REG_CLR_ADDR(addr, value) \
163 ((*(volatile unsigned int *)((addr) + 0x8)) = (value))
164 #define REG_TOG_ADDR(addr, value) \
165 ((*(volatile unsigned int *)((addr) + 0xc)) = (value))
168 * Memory regions and CS
170 #define CSD0_BASE_ADDR 0x70000000
171 #define CSD1_BASE_ADDR 0xB0000000
173 /* gpio and gpio based interrupt handling */
175 #define GPIO_GDIR 0x04
176 #define GPIO_PSR 0x08
177 #define GPIO_ICR1 0x0C
178 #define GPIO_ICR2 0x10
179 #define GPIO_IMR 0x14
180 #define GPIO_ISR 0x18
181 #define GPIO_INT_LOW_LEV 0x0
182 #define GPIO_INT_HIGH_LEV 0x1
183 #define GPIO_INT_RISE_EDGE 0x2
184 #define GPIO_INT_FALL_EDGE 0x3
185 #define GPIO_INT_NONE 0x4
187 #define CLKCTL_CCR 0x00
188 #define CLKCTL_CCDR 0x04
189 #define CLKCTL_CSR 0x08
190 #define CLKCTL_CCSR 0x0C
191 #define CLKCTL_CACRR 0x10
192 #define CLKCTL_CBCDR 0x14
193 #define CLKCTL_CBCMR 0x18
194 #define CLKCTL_CSCMR1 0x1C
195 #define CLKCTL_CSCMR2 0x20
196 #define CLKCTL_CSCDR1 0x24
197 #define CLKCTL_CS1CDR 0x28
198 #define CLKCTL_CS2CDR 0x2C
199 #define CLKCTL_CDCDR 0x30
200 #define CLKCTL_CHSCDR 0x34
201 #define CLKCTL_CSCDR2 0x38
202 #define CLKCTL_CSCDR3 0x3C
203 #define CLKCTL_CSCDR4 0x40
204 #define CLKCTL_CWDR 0x44
205 #define CLKCTL_CDHIPR 0x48
206 #define CLKCTL_CDCR 0x4C
207 #define CLKCTL_CTOR 0x50
208 #define CLKCTL_CLPCR 0x54
209 #define CLKCTL_CISR 0x58
210 #define CLKCTL_CIMR 0x5C
211 #define CLKCTL_CCOSR 0x60
212 #define CLKCTL_CGPR 0x64
213 #define CLKCTL_CCGR0 0x68
214 #define CLKCTL_CCGR1 0x6C
215 #define CLKCTL_CCGR2 0x70
216 #define CLKCTL_CCGR3 0x74
217 #define CLKCTL_CCGR4 0x78
218 #define CLKCTL_CCGR5 0x7C
219 #define CLKCTL_CCGR6 0x80
220 #define CLKCTL_CCGR7 0x84
221 #define CLKCTL_CMEOR 0x88
223 #define CLKCTL_CSR2 0x8C
224 #define CLKCTL_CLKSEQ_BYPASS 0x90
225 #define CLKCTL_CLK_SYS 0x94
226 #define CLKCTL_CLK_DDR 0x98
228 #define CHIP_REV_1_0 0x10
229 #define PLATFORM_ICGC 0x14
231 /* Assuming 24MHz input clock with doubler ON */
233 #define DP_OP_850 ((8 << 4) + ((1 - 1) << 0))
234 #define DP_MFD_850 (48 - 1)
235 #define DP_MFN_850 41
237 #define DP_OP_800 ((8 << 4) + ((1 - 1) << 0))
238 #define DP_MFD_800 (3 - 1)
241 #define DP_OP_700 ((7 << 4) + ((1 - 1) << 0))
242 #define DP_MFD_700 (24 - 1)
245 #define DP_OP_600 ((6 << 4) + ((1 - 1) << 0))
246 #define DP_MFD_600 (4 - 1)
249 #define DP_OP_665 ((6 << 4) + ((1 - 1) << 0))
250 #define DP_MFD_665 (96 - 1)
251 #define DP_MFN_665 89
253 #define DP_OP_532 ((5 << 4) + ((1 - 1) << 0))
254 #define DP_MFD_532 (24 - 1)
255 #define DP_MFN_532 13
257 #define DP_OP_400 ((8 << 4) + ((2 - 1) << 0))
258 #define DP_MFD_400 (3 - 1)
261 #define DP_OP_216 ((6 << 4) + ((3 - 1) << 0))
262 #define DP_MFD_216 (4 - 1)
265 #define PLL_DP_CTL 0x00
266 #define PLL_DP_CONFIG 0x04
267 #define PLL_DP_OP 0x08
268 #define PLL_DP_MFD 0x0C
269 #define PLL_DP_MFN 0x10
270 #define PLL_DP_MFNMINUS 0x14
271 #define PLL_DP_MFNPLUS 0x18
272 #define PLL_DP_HFS_OP 0x1C
273 #define PLL_DP_HFS_MFD 0x20
274 #define PLL_DP_HFS_MFN 0x24
275 #define PLL_DP_TOGC 0x28
276 #define PLL_DP_DESTAT 0x2C
278 #ifndef __ASSEMBLER__
311 enum mxc_peri_clocks {
324 extern unsigned int mxc_get_clock(enum mxc_clock clk);
325 extern unsigned int get_board_rev(void);
326 extern int is_soc_rev(int rev);
327 extern enum boot_device get_boot_device(void);
329 #endif /* __ASSEMBLER__*/
331 #endif /* __ASM_ARCH_MXC_MX50_H__ */