2 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
14 #ifndef __ASM_ARCH_MXC_MX51_H__
15 #define __ASM_ARCH_MXC_MX51_H__
17 #define __REG(x) (*((volatile u32 *)(x)))
18 #define __REG16(x) (*((volatile u16 *)(x)))
19 #define __REG8(x) (*((volatile u8 *)(x)))
23 #define IRAM_BASE_ADDR 0x1FFE8000 /* internal ram */
25 * Graphics Memory of GPU
27 #define GPU_BASE_ADDR 0x20000000
28 #define GPU_CTRL_BASE_ADDR 0x30000000
29 #define IPU_CTRL_BASE_ADDR 0x40000000
33 #define DEBUG_BASE_ADDR 0x60000000
34 #define ETB_BASE_ADDR (DEBUG_BASE_ADDR + 0x00001000)
35 #define ETM_BASE_ADDR (DEBUG_BASE_ADDR + 0x00002000)
36 #define TPIU_BASE_ADDR (DEBUG_BASE_ADDR + 0x00003000)
37 #define CTI0_BASE_ADDR (DEBUG_BASE_ADDR + 0x00004000)
38 #define CTI1_BASE_ADDR (DEBUG_BASE_ADDR + 0x00005000)
39 #define CTI2_BASE_ADDR (DEBUG_BASE_ADDR + 0x00006000)
40 #define CTI3_BASE_ADDR (DEBUG_BASE_ADDR + 0x00007000)
41 #define CORTEX_DBG_BASE_ADDR (DEBUG_BASE_ADDR + 0x00008000)
44 * SPBA global module enabled #0
46 #define SPBA0_BASE_ADDR 0x70000000
48 #define MMC_SDHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00004000)
49 #define MMC_SDHC2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00008000)
50 #define UART3_BASE_ADDR (SPBA0_BASE_ADDR + 0x0000C000)
51 #define CSPI1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00010000)
52 #define SSI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00014000)
53 #define MMC_SDHC3_BASE_ADDR (SPBA0_BASE_ADDR + 0x00020000)
54 #define MMC_SDHC4_BASE_ADDR (SPBA0_BASE_ADDR + 0x00024000)
55 #define SPDIF_BASE_ADDR (SPBA0_BASE_ADDR + 0x00028000)
56 #define ATA_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00030000)
57 #define SLIM_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00034000)
58 #define HSI2C_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00038000)
59 #define SPBA_CTRL_BASE_ADDR (SPBA0_BASE_ADDR + 0x0003C000)
64 #define AIPS1_BASE_ADDR 0x73F00000
66 #define OTG_BASE_ADDR (AIPS1_BASE_ADDR + 0x00080000)
67 #define GPIO1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00084000)
68 #define GPIO2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00088000)
69 #define GPIO3_BASE_ADDR (AIPS1_BASE_ADDR + 0x0008C000)
70 #define GPIO4_BASE_ADDR (AIPS1_BASE_ADDR + 0x00090000)
71 #define KPP_BASE_ADDR (AIPS1_BASE_ADDR + 0x00094000)
72 #define WDOG1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00098000)
73 #define WDOG2_BASE_ADDR (AIPS1_BASE_ADDR + 0x0009C000)
74 #define GPT1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A0000)
75 #define SRTC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A4000)
76 #define IOMUXC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A8000)
77 #define EPIT1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000AC000)
78 #define EPIT2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B0000)
79 #define PWM1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B4000)
80 #define PWM2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B8000)
81 #define UART1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000BC000)
82 #define UART2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000C0000)
83 #define SRC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D0000)
84 #define CCM_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D4000)
85 #define GPC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D8000)
90 #define AIPS2_BASE_ADDR 0x83F00000
92 #define PLL1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00080000)
93 #define PLL2_BASE_ADDR (AIPS2_BASE_ADDR + 0x00084000)
94 #define PLL3_BASE_ADDR (AIPS2_BASE_ADDR + 0x00088000)
95 #define AHBMAX_BASE_ADDR (AIPS2_BASE_ADDR + 0x00094000)
96 #define IIM_BASE_ADDR (AIPS2_BASE_ADDR + 0x00098000)
97 #define CSU_BASE_ADDR (AIPS2_BASE_ADDR + 0x0009C000)
98 #define ARM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A0000)
99 #define OWIRE_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A4000)
100 #define FIRI_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A8000)
101 #define CSPI2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AC000)
102 #define SDMA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B0000)
103 #define SCC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B4000)
104 #define ROMCP_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B8000)
105 #define RTIC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000BC000)
106 #define CSPI3_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C0000)
107 #define I2C2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C4000)
108 #define I2C1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C8000)
109 #define SSI1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000CC000)
110 #define AUDMUX_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D0000)
111 #define M4IF_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D8000)
112 #define ESDCTL_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D9000)
113 #define WEIM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DA000)
114 #define NFC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DB000)
115 #define EMI_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DBF00)
116 #define MIPI_HSC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DC000)
117 #define ATA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000E0000)
118 #define SIM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000E4000)
119 #define SSI3BASE_ADDR (AIPS2_BASE_ADDR + 0x000E8000)
120 #define FEC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000EC000)
121 #define TVE_BASE_ADDR (AIPS2_BASE_ADDR + 0x000F0000)
122 #define VPU_BASE_ADDR (AIPS2_BASE_ADDR + 0x000F4000)
123 #define SAHARA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000F8000)
125 #define TZIC_BASE_ADDR 0x8FFFC000
128 * Memory regions and CS
130 #define CSD0_BASE_ADDR 0x90000000
131 #define CSD1_BASE_ADDR 0xA0000000
132 #define CS0_BASE_ADDR 0xB0000000
133 #define CS1_BASE_ADDR 0xB8000000
134 #define CS2_BASE_ADDR 0xC0000000
135 #define CS3_BASE_ADDR 0xC8000000
136 #define CS4_BASE_ADDR 0xCC000000
137 #define CS5_BASE_ADDR 0xCE000000
142 #define NFC_BASE_ADDR_AXI 0xCFFF0000 /* NAND flash AXI */
145 * defines for SPBA modules
147 #define SPBA_SDHC1 0x04
148 #define SPBA_SDHC2 0x08
149 #define SPBA_UART3 0x0C
150 #define SPBA_CSPI1 0x10
151 #define SPBA_SSI2 0x14
152 #define SPBA_SDHC3 0x20
153 #define SPBA_SDHC4 0x24
154 #define SPBA_SPDIF 0x28
155 #define SPBA_ATA 0x30
156 #define SPBA_SLIM 0x34
157 #define SPBA_HSI2C 0x38
158 #define SPBA_CTRL 0x3C
163 #define MXC_INT_BASE 0
164 #define MXC_INT_RESV0 0
165 #define MXC_INT_MMC_SDHC1 1
166 #define MXC_INT_MMC_SDHC2 2
167 #define MXC_INT_MMC_SDHC3 3
168 #define MXC_INT_MMC_SDHC4 4
169 #define MXC_INT_RESV5 5
170 #define MXC_INT_SDMA 6
171 #define MXC_INT_IOMUX 7
172 #define MXC_INT_NFC 8
173 #define MXC_INT_VPU 9
174 #define MXC_INT_IPU_ERR 10
175 #define MXC_INT_IPU_SYN 11
176 #define MXC_INT_GPU 12
177 #define MXC_INT_RESV13 13
178 #define MXC_INT_USB_H1 14
179 #define MXC_INT_EMI 15
180 #define MXC_INT_USB_H2 16
181 #define MXC_INT_USB_H3 17
182 #define MXC_INT_USB_OTG 18
183 #define MXC_INT_SAHARA_H0 19
184 #define MXC_INT_SAHARA_H1 20
185 #define MXC_INT_SCC_SMN 21
186 #define MXC_INT_SCC_STZ 22
187 #define MXC_INT_SCC_SCM 23
188 #define MXC_INT_SRTC_NTZ 24
189 #define MXC_INT_SRTC_TZ 25
190 #define MXC_INT_RTIC 26
191 #define MXC_INT_CSU 27
192 #define MXC_INT_SLIM_B 28
193 #define MXC_INT_SSI1 29
194 #define MXC_INT_SSI2 30
195 #define MXC_INT_UART1 31
196 #define MXC_INT_UART2 32
197 #define MXC_INT_UART3 33
198 #define MXC_INT_RESV34 34
199 #define MXC_INT_RESV35 35
200 #define MXC_INT_CSPI1 36
201 #define MXC_INT_CSPI2 37
202 #define MXC_INT_CSPI 38
203 #define MXC_INT_GPT 39
204 #define MXC_INT_EPIT1 40
205 #define MXC_INT_EPIT2 41
206 #define MXC_INT_GPIO1_INT7 42
207 #define MXC_INT_GPIO1_INT6 43
208 #define MXC_INT_GPIO1_INT5 44
209 #define MXC_INT_GPIO1_INT4 45
210 #define MXC_INT_GPIO1_INT3 46
211 #define MXC_INT_GPIO1_INT2 47
212 #define MXC_INT_GPIO1_INT1 48
213 #define MXC_INT_GPIO1_INT0 49
214 #define MXC_INT_GPIO1_LOW 50
215 #define MXC_INT_GPIO1_HIGH 51
216 #define MXC_INT_GPIO2_LOW 52
217 #define MXC_INT_GPIO2_HIGH 53
218 #define MXC_INT_GPIO3_LOW 54
219 #define MXC_INT_GPIO3_HIGH 55
220 #define MXC_INT_GPIO4_LOW 56
221 #define MXC_INT_GPIO4_HIGH 57
222 #define MXC_INT_WDOG1 58
223 #define MXC_INT_WDOG2 59
224 #define MXC_INT_KPP 60
225 #define MXC_INT_PWM1 61
226 #define MXC_INT_I2C1 62
227 #define MXC_INT_I2C2 63
228 #define MXC_INT_HS_I2C 64
229 #define MXC_INT_RESV65 65
230 #define MXC_INT_RESV66 66
231 #define MXC_INT_SIM_IPB 67
232 #define MXC_INT_SIM_DAT 68
233 #define MXC_INT_IIM 69
234 #define MXC_INT_ATA 70
235 #define MXC_INT_CCM1 71
236 #define MXC_INT_CCM2 72
237 #define MXC_INT_GPC1 73
238 #define MXC_INT_GPC2 74
239 #define MXC_INT_SRC 75
240 #define MXC_INT_NM 76
241 #define MXC_INT_PMU 77
242 #define MXC_INT_CTI_IRQ 78
243 #define MXC_INT_CTI1_TG0 79
244 #define MXC_INT_CTI1_TG1 80
245 #define MXC_INT_MCG_ERR 81
246 #define MXC_INT_MCG_TMR 82
247 #define MXC_INT_MCG_FUNC 83
248 #define MXC_INT_RESV84 84
249 #define MXC_INT_RESV85 85
250 #define MXC_INT_RESV86 86
251 #define MXC_INT_FEC 87
252 #define MXC_INT_OWIRE 88
253 #define MXC_INT_CTI1_TG2 89
254 #define MXC_INT_SJC 90
255 #define MXC_INT_SPDIF 91
256 #define MXC_INT_TVE 92
257 #define MXC_INT_FIRI 93
258 #define MXC_INT_PWM2 94
259 #define MXC_INT_SLIM_EXP 95
260 #define MXC_INT_SSI3 96
261 #define MXC_INT_RESV97 97
262 #define MXC_INT_CTI1_TG3 98
263 #define MXC_INT_SMC_RX 99
264 #define MXC_INT_VPU_IDLE 100
265 #define MXC_INT_RESV101 101
266 #define MXC_INT_GPU_IDLE 102
268 #define MXC_MAX_INT_LINES 128
270 #define MXC_GPIO_INT_BASE (MXC_MAX_INT_LINES)
273 * Number of GPIO port as defined in the IC Spec
275 #define GPIO_PORT_NUM 4
277 * Number of GPIO pins per port
279 #define GPIO_NUM_PIN 32
281 #define MXC_GPIO_SPLIT_IRQ_2
283 #define IIM_SREV 0x24
284 #define ROM_SI_REV 0x48
286 #define NFC_BUF_SIZE 0x1000
296 #define M4IF_FBPM0 0x40
297 #define M4IF_FIDBP 0x48
300 #define ESDCTL_ESDCTL0 0x00
301 #define ESDCTL_ESDCFG0 0x04
302 #define ESDCTL_ESDCTL1 0x08
303 #define ESDCTL_ESDCFG1 0x0C
304 #define ESDCTL_ESDMISC 0x10
305 #define ESDCTL_ESDSCR 0x14
306 #define ESDCTL_ESDCDLY1 0x20
307 #define ESDCTL_ESDCDLY2 0x24
308 #define ESDCTL_ESDCDLY3 0x28
309 #define ESDCTL_ESDCDLY4 0x2C
310 #define ESDCTL_ESDCDLY5 0x30
311 #define ESDCTL_ESDCDLYGD 0x34
314 #define CLKCTL_CCR 0x00
315 #define CLKCTL_CCDR 0x04
316 #define CLKCTL_CSR 0x08
317 #define CLKCTL_CCSR 0x0C
318 #define CLKCTL_CACRR 0x10
319 #define CLKCTL_CBCDR 0x14
320 #define CLKCTL_CBCMR 0x18
321 #define CLKCTL_CSCMR1 0x1C
322 #define CLKCTL_CSCMR2 0x20
323 #define CLKCTL_CSCDR1 0x24
324 #define CLKCTL_CS1CDR 0x28
325 #define CLKCTL_CS2CDR 0x2C
326 #define CLKCTL_CDCDR 0x30
327 #define CLKCTL_CHSCCDR 0x34
328 #define CLKCTL_CSCDR2 0x38
329 #define CLKCTL_CSCDR3 0x3C
330 #define CLKCTL_CSCDR4 0x40
331 #define CLKCTL_CWDR 0x44
332 #define CLKCTL_CDHIPR 0x48
333 #define CLKCTL_CDCR 0x4C
334 #define CLKCTL_CTOR 0x50
335 #define CLKCTL_CLPCR 0x54
336 #define CLKCTL_CISR 0x58
337 #define CLKCTL_CIMR 0x5C
338 #define CLKCTL_CCOSR 0x60
339 #define CLKCTL_CGPR 0x64
340 #define CLKCTL_CCGR0 0x68
341 #define CLKCTL_CCGR1 0x6C
342 #define CLKCTL_CCGR2 0x70
343 #define CLKCTL_CCGR3 0x74
344 #define CLKCTL_CCGR4 0x78
345 #define CLKCTL_CCGR5 0x7C
346 #define CLKCTL_CCGR6 0x80
347 #define CLKCTL_CMEOR 0x84
350 #define PLL_DP_CTL 0x00
351 #define PLL_DP_CONFIG 0x04
352 #define PLL_DP_OP 0x08
353 #define PLL_DP_MFD 0x0C
354 #define PLL_DP_MFN 0x10
355 #define PLL_DP_MFNMINUS 0x14
356 #define PLL_DP_MFNPLUS 0x18
357 #define PLL_DP_HFS_OP 0x1C
358 #define PLL_DP_HFS_MFD 0x20
359 #define PLL_DP_HFS_MFN 0x24
360 #define PLL_DP_TOGC 0x28
361 #define PLL_DP_DESTAT 0x2C
363 /* Assuming 24MHz input clock with doubler ON */
365 #define DP_OP_850 ((8 << 4) + ((1 - 1) << 0))
366 #define DP_MFD_850 (48 - 1)
367 #define DP_MFN_850 41
369 #define DP_OP_800 ((8 << 4) + ((1 - 1) << 0))
370 #define DP_MFD_800 (3 - 1)
373 #define DP_OP_700 ((7 << 4) + ((1 - 1) << 0))
374 #define DP_MFD_700 (24 - 1)
377 #define DP_OP_665 ((6 << 4) + ((1 - 1) << 0))
378 #define DP_MFD_665 (96 - 1)
379 #define DP_MFN_665 89
381 #define DP_OP_532 ((5 << 4) + ((1 - 1) << 0))
382 #define DP_MFD_532 (24 - 1)
383 #define DP_MFN_532 13
385 #define DP_OP_400 ((8 << 4) + ((2 - 1) << 0))
386 #define DP_MFD_400 (3 - 1)
389 #define DP_OP_216 ((6 << 4) + ((3 - 1) << 0))
390 #define DP_MFD_216 (4 - 1)
394 #define IIM_STAT_OFF 0x00
395 #define IIM_STAT_BUSY (1 << 7)
396 #define IIM_STAT_PRGD (1 << 1)
397 #define IIM_STAT_SNSD (1 << 0)
398 #define IIM_STATM_OFF 0x04
399 #define IIM_ERR_OFF 0x08
400 #define IIM_ERR_PRGE (1 << 7)
401 #define IIM_ERR_WPE (1 << 6)
402 #define IIM_ERR_OPE (1 << 5)
403 #define IIM_ERR_RPE (1 << 4)
404 #define IIM_ERR_WLRE (1 << 3)
405 #define IIM_ERR_SNSE (1 << 2)
406 #define IIM_ERR_PARITYE (1 << 1)
407 #define IIM_EMASK_OFF 0x0C
408 #define IIM_FCTL_OFF 0x10
409 #define IIM_UA_OFF 0x14
410 #define IIM_LA_OFF 0x18
411 #define IIM_SDAT_OFF 0x1C
412 #define IIM_PREV_OFF 0x20
413 #define IIM_SREV_OFF 0x24
414 #define IIM_PREG_P_OFF 0x28
415 #define IIM_SCS0_OFF 0x2C
416 #define IIM_SCS1_P_OFF 0x30
417 #define IIM_SCS2_OFF 0x34
418 #define IIM_SCS3_P_OFF 0x38
420 #define IIM_PROD_REV_SH 3
421 #define IIM_PROD_REV_LEN 5
422 #define IIM_SREV_REV_SH 4
423 #define IIM_SREV_REV_LEN 4
424 #define PROD_SIGNATURE_MX51 0x1
426 #define CHIP_REV_1_0 0x10
427 #define CHIP_REV_1_1 0x11
428 #define CHIP_REV_2_0 0x20
429 #define CHIP_REV_2_5 0x25
430 #define CHIP_REV_3_0 0x30
432 #define BOARD_REV_1_0 0x0
433 #define BOARD_REV_2_0 0x1
435 #define BOARD_VER_OFFSET 0x8
437 #define NAND_FLASH_BOOT 0x10000000
438 #define SPI_NOR_FLASH_BOOT 0x80000000
439 #define MMC_FLASH_BOOT 0x40000000
441 #ifndef __ASSEMBLER__
462 enum mxc_main_clocks {
473 enum mxc_peri_clocks {
486 extern unsigned int mxc_get_clock(enum mxc_clock clk);
487 extern unsigned int get_board_rev(void);
488 extern int is_soc_rev(int rev);
489 extern enum boot_device get_boot_device(void);
491 #endif /* __ASSEMBLER__*/
493 #endif /* __ASM_ARCH_MXC_MX51_H__ */