]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - include/asm-arm/arch-mx53/mx53.h
applied patches from Freescale and Ka-Ro
[karo-tx-uboot.git] / include / asm-arm / arch-mx53 / mx53.h
1 /*
2  * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3  *
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.
8
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.
13
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.
17  */
18
19 #ifndef __ASM_ARCH_MXC_MX53_H__
20 #define __ASM_ARCH_MXC_MX53_H__
21
22 #define __REG(x)        (*((volatile u32 *)(x)))
23 #define __REG16(x)      (*((volatile u16 *)(x)))
24 #define __REG8(x)       (*((volatile u8 *)(x)))
25
26 /*
27  * SATA
28  */
29 #define SATA_BASE_ADDR          0x10000000
30
31 /*
32  * IRAM
33  */
34 #define IRAM_BASE_ADDR          0xF8000000      /* internal ram */
35 #define IRAM_PARTITIONS         16
36 #define IRAM_SIZE               (IRAM_PARTITIONS*SZ_8K) /* 128KB */
37
38 /*
39  * NFC
40  */
41 #define NFC_BASE_ADDR_AXI               0xF7FF0000      /* NAND flash AXI */
42 #define NFC_AXI_SIZE            SZ_64K
43
44 #define TZIC_BASE_ADDR          0x0FFFC000
45
46 #define DEBUG_BASE_ADDR 0x40000000
47 #define ETB_BASE_ADDR           (DEBUG_BASE_ADDR + 0x00001000)
48 #define ETM_BASE_ADDR           (DEBUG_BASE_ADDR + 0x00002000)
49 #define TPIU_BASE_ADDR          (DEBUG_BASE_ADDR + 0x00003000)
50 #define CTI0_BASE_ADDR          (DEBUG_BASE_ADDR + 0x00004000)
51 #define CTI1_BASE_ADDR          (DEBUG_BASE_ADDR + 0x00005000)
52 #define CTI2_BASE_ADDR          (DEBUG_BASE_ADDR + 0x00006000)
53 #define CTI3_BASE_ADDR          (DEBUG_BASE_ADDR + 0x00007000)
54 #define CORTEX_DBG_BASE_ADDR    (DEBUG_BASE_ADDR + 0x00008000)
55
56 /*
57  * SPBA global module enabled #0
58  */
59 #define SPBA0_BASE_ADDR         0x50000000
60
61 #define MMC_SDHC1_BASE_ADDR     (SPBA0_BASE_ADDR + 0x00004000)
62 #define MMC_SDHC2_BASE_ADDR     (SPBA0_BASE_ADDR + 0x00008000)
63 #define UART3_BASE_ADDR         (SPBA0_BASE_ADDR + 0x0000C000)
64 #define CSPI1_BASE_ADDR         (SPBA0_BASE_ADDR + 0x00010000)
65 #define SSI2_BASE_ADDR          (SPBA0_BASE_ADDR + 0x00014000)
66 #define ESAI_BASE_ADDR          (SPBA0_BASE_ADDR + 0x00018000)
67 #define MMC_SDHC3_BASE_ADDR     (SPBA0_BASE_ADDR + 0x00020000)
68 #define MMC_SDHC4_BASE_ADDR     (SPBA0_BASE_ADDR + 0x00024000)
69 #define SPDIF_BASE_ADDR         (SPBA0_BASE_ADDR + 0x00028000)
70 #define ASRC_BASE_ADDR          (SPBA0_BASE_ADDR + 0x0002C000)
71 #define ATA_DMA_BASE_ADDR       (SPBA0_BASE_ADDR + 0x00030000)
72 #define SPBA_CTRL_BASE_ADDR     (SPBA0_BASE_ADDR + 0x0003C000)
73
74 /*!
75  * defines for SPBA modules
76  */
77 #define SPBA_SDHC1      0x04
78 #define SPBA_SDHC2      0x08
79 #define SPBA_UART3      0x0C
80 #define SPBA_CSPI1      0x10
81 #define SPBA_SSI2       0x14
82 #define SPBA_ESAI       0x18
83 #define SPBA_SDHC3      0x20
84 #define SPBA_SDHC4      0x24
85 #define SPBA_SPDIF      0x28
86 #define SPBA_ASRC       0x2C
87 #define SPBA_ATA        0x30
88 #define SPBA_CTRL       0x3C
89
90 /*
91  * AIPS 1
92  */
93 #define AIPS1_BASE_ADDR         0x53F00000
94
95 #define OTG_BASE_ADDR   (AIPS1_BASE_ADDR + 0x00080000)
96 #define GPIO1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00084000)
97 #define GPIO2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00088000)
98 #define GPIO3_BASE_ADDR (AIPS1_BASE_ADDR + 0x0008C000)
99 #define GPIO4_BASE_ADDR (AIPS1_BASE_ADDR + 0x00090000)
100 #define KPP_BASE_ADDR           (AIPS1_BASE_ADDR + 0x00094000)
101 #define WDOG1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00098000)
102 #define WDOG2_BASE_ADDR (AIPS1_BASE_ADDR + 0x0009C000)
103 #define GPT1_BASE_ADDR          (AIPS1_BASE_ADDR + 0x000A0000)
104 #define SRTC_BASE_ADDR          (AIPS1_BASE_ADDR + 0x000A4000)
105 #define IOMUXC_BASE_ADDR        (AIPS1_BASE_ADDR + 0x000A8000)
106 #define EPIT1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000AC000)
107 #define EPIT2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B0000)
108 #define PWM1_BASE_ADDR  (AIPS1_BASE_ADDR + 0x000B4000)
109 #define PWM2_BASE_ADDR  (AIPS1_BASE_ADDR + 0x000B8000)
110 #define UART1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000BC000)
111 #define UART2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000C0000)
112 #define CAN1_BASE_ADDR          (AIPS1_BASE_ADDR + 0x000C8000)
113 #define CAN2_BASE_ADDR          (AIPS1_BASE_ADDR + 0x000CC000)
114 #define SRC_BASE_ADDR           (AIPS1_BASE_ADDR + 0x000D0000)
115 #define CCM_BASE_ADDR           (AIPS1_BASE_ADDR + 0x000D4000)
116 #define GPC_BASE_ADDR           (AIPS1_BASE_ADDR + 0x000D8000)
117 #define GPIO5_BASE_ADDR (AIPS1_BASE_ADDR + 0x000DC000)
118 #define GPIO6_BASE_ADDR (AIPS1_BASE_ADDR + 0x000E0000)
119 #define GPIO7_BASE_ADDR (AIPS1_BASE_ADDR + 0x000E4000)
120 #define ATA_BASE_ADDR           (AIPS1_BASE_ADDR + 0x000E8000)
121 #define I2C3_BASE_ADDR          (AIPS1_BASE_ADDR + 0x000EC000)
122 #define UART4_BASE_ADDR (AIPS1_BASE_ADDR + 0x000F0000)
123
124 /*
125  * AIPS 2
126  */
127 #define AIPS2_BASE_ADDR 0x63F00000
128
129 #define PLL1_BASE_ADDR          (AIPS2_BASE_ADDR + 0x00080000)
130 #define PLL2_BASE_ADDR          (AIPS2_BASE_ADDR + 0x00084000)
131 #define PLL3_BASE_ADDR          (AIPS2_BASE_ADDR + 0x00088000)
132 #define PLL4_BASE_ADDR          (AIPS2_BASE_ADDR + 0x0008C000)
133 #define UART5_BASE_ADDR (AIPS2_BASE_ADDR + 0x00090000)
134 #define AHBMAX_BASE_ADDR        (AIPS2_BASE_ADDR + 0x00094000)
135 #define IIM_BASE_ADDR           (AIPS2_BASE_ADDR + 0x00098000)
136 #define CSU_BASE_ADDR           (AIPS2_BASE_ADDR + 0x0009C000)
137 #define ARM_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000A0000)
138 #define OWIRE_BASE_ADDR         (AIPS2_BASE_ADDR + 0x000A4000)
139 #define FIRI_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000A8000)
140 #define CSPI2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AC000)
141 #define SDMA_BASE_ADDR  (AIPS2_BASE_ADDR + 0x000B0000)
142 #define SCC_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000B4000)
143 #define ROMCP_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B8000)
144 #define RTIC_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000BC000)
145 #define CSPI3_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C0000)
146 #define I2C2_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000C4000)
147 #define I2C1_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000C8000)
148 #define SSI1_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000CC000)
149 #define AUDMUX_BASE_ADDR        (AIPS2_BASE_ADDR + 0x000D0000)
150 #define RTC_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000D4000)
151 #define M4IF_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000D8000)
152 #define ESDCTL_BASE_ADDR        (AIPS2_BASE_ADDR + 0x000D9000)
153 #define WEIM_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000DA000)
154 #define NFC_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000DB000)
155 #define EMI_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000DBF00)
156 #define MLB_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000E4000)
157 #define SSI3_BASE_ADDR          (AIPS2_BASE_ADDR + 0x000E8000)
158 #define FEC_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000EC000)
159 #define TVE_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000F0000)
160 #define VPU_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000F4000)
161 #define SAHARA_BASE_ADDR        (AIPS2_BASE_ADDR + 0x000F8000)
162 #define PTP_BASE_ADDR           (AIPS2_BASE_ADDR + 0x000FC000)
163
164 /*
165  * Memory regions and CS
166  */
167 #define CSD0_BASE_ADDR          0x70000000
168 #define CSD1_BASE_ADDR          0xB0000000
169
170 /*
171  * Interrupt numbers
172  */
173 #define MXC_INT_BASE            0
174 #define MXC_INT_RESV0           0
175 #define MXC_INT_MMC_SDHC1       1
176 #define MXC_INT_MMC_SDHC2       2
177 #define MXC_INT_MMC_SDHC3       3
178 #define MXC_INT_MMC_SDHC4       4
179 #define MXC_INT_DAP             5
180 #define MXC_INT_SDMA            6
181 #define MXC_INT_IOMUX           7
182 #define MXC_INT_NFC             8
183 #define MXC_INT_VPU             9
184 #define MXC_INT_IPU_ERR 10
185 #define MXC_INT_IPU_SYN 11
186 #define MXC_INT_GPU             12
187 #define MXC_INT_UART4           13
188 #define MXC_INT_USB_H1          14
189 #define MXC_INT_EMI             15
190 #define MXC_INT_USB_H2          16
191 #define MXC_INT_USB_H3          17
192 #define MXC_INT_USB_OTG 18
193 #define MXC_INT_SAHARA_H0       19
194 #define MXC_INT_SAHARA_H1       20
195 #define MXC_INT_SCC_SMN 21
196 #define MXC_INT_SCC_STZ 22
197 #define MXC_INT_SCC_SCM 23
198 #define MXC_INT_SRTC_NTZ        24
199 #define MXC_INT_SRTC_TZ 25
200 #define MXC_INT_RTIC            26
201 #define MXC_INT_CSU             27
202 #define MXC_INT_SATA            28
203 #define MXC_INT_SSI1            29
204 #define MXC_INT_SSI2            30
205 #define MXC_INT_UART1           31
206 #define MXC_INT_UART2           32
207 #define MXC_INT_UART3           33
208 #define MXC_INT_RTC                     34
209 #define MXC_INT_PTP             35
210 #define MXC_INT_CSPI1           36
211 #define MXC_INT_CSPI2           37
212 #define MXC_INT_CSPI            38
213 #define MXC_INT_GPT             39
214 #define MXC_INT_EPIT1           40
215 #define MXC_INT_EPIT2           41
216 #define MXC_INT_GPIO1_INT7      42
217 #define MXC_INT_GPIO1_INT6      43
218 #define MXC_INT_GPIO1_INT5      44
219 #define MXC_INT_GPIO1_INT4      45
220 #define MXC_INT_GPIO1_INT3      46
221 #define MXC_INT_GPIO1_INT2      47
222 #define MXC_INT_GPIO1_INT1      48
223 #define MXC_INT_GPIO1_INT0      49
224 #define MXC_INT_GPIO1_LOW       50
225 #define MXC_INT_GPIO1_HIGH      51
226 #define MXC_INT_GPIO2_LOW       52
227 #define MXC_INT_GPIO2_HIGH      53
228 #define MXC_INT_GPIO3_LOW       54
229 #define MXC_INT_GPIO3_HIGH      55
230 #define MXC_INT_GPIO4_LOW       56
231 #define MXC_INT_GPIO4_HIGH      57
232 #define MXC_INT_WDOG1           58
233 #define MXC_INT_WDOG2           59
234 #define MXC_INT_KPP             60
235 #define MXC_INT_PWM1            61
236 #define MXC_INT_I2C1            62
237 #define MXC_INT_I2C2            63
238 #define MXC_INT_I2C3            64
239 #define MXC_INT_MLB             65
240 #define MXC_INT_ASRC            66
241 #define MXC_INT_SPDIF           67
242 #define MXC_INT_RESV1           68
243 #define MXC_INT_IIM             69
244 #define MXC_INT_ATA             70
245 #define MXC_INT_CCM1            71
246 #define MXC_INT_CCM2            72
247 #define MXC_INT_GPC1            73
248 #define MXC_INT_GPC2            74
249 #define MXC_INT_SRC             75
250 #define MXC_INT_NM              76
251 #define MXC_INT_PMU             77
252 #define MXC_INT_CTI_IRQ         78
253 #define MXC_INT_CTI1_TG0        79
254 #define MXC_INT_CTI1_TG1        80
255 #define MXC_INT_ESAI            81
256 #define MXC_INT_CAN1            82
257 #define MXC_INT_CAN2            83
258 #define MXC_INT_GPU2_IRQ        84
259 #define MXC_INT_GPU2_BUSY       85
260 #define MXC_INT_UART5           86
261 #define MXC_INT_FEC             87
262 #define MXC_INT_OWIRE           88
263 #define MXC_INT_CTI1_TG2        89
264 #define MXC_INT_SJC             90
265 #define MXC_INT_RESV2           91
266 #define MXC_INT_TVE             92
267 #define MXC_INT_FIRI            93
268 #define MXC_INT_PWM2            94
269 #define MXC_INT_RESV3           95
270 #define MXC_INT_SSI3            96
271 #define MXC_INT_RESV4           97
272 #define MXC_INT_CTI1_TG3        98
273 #define MXC_INT_RESV5           99
274 #define MXC_INT_VPU_IDLE        100
275 #define MXC_INT_EMI_NFC 101
276 #define MXC_INT_GPU_IDLE        102
277 #define MXC_INT_GPIO5_LOW       103
278 #define MXC_INT_GPIO5_HIGH      104
279 #define MXC_INT_GPIO6_LOW       105
280 #define MXC_INT_GPIO6_HIGH      106
281 #define MXC_INT_GPIO7_LOW       107
282 #define MXC_INT_GPIO7_HIGH      108
283
284 /* gpio and gpio based interrupt handling */
285 #define GPIO_DR                 0x00
286 #define GPIO_GDIR               0x04
287 #define GPIO_PSR                0x08
288 #define GPIO_ICR1               0x0C
289 #define GPIO_ICR2               0x10
290 #define GPIO_IMR                0x14
291 #define GPIO_ISR                0x18
292 #define GPIO_INT_LOW_LEV        0x0
293 #define GPIO_INT_HIGH_LEV       0x1
294 #define GPIO_INT_RISE_EDGE      0x2
295 #define GPIO_INT_FALL_EDGE      0x3
296 #define GPIO_INT_NONE           0x4
297
298 #define CLKCTL_CCR              0x00
299 #define CLKCTL_CCDR             0x04
300 #define CLKCTL_CSR              0x08
301 #define CLKCTL_CCSR             0x0C
302 #define CLKCTL_CACRR            0x10
303 #define CLKCTL_CBCDR            0x14
304 #define CLKCTL_CBCMR            0x18
305 #define CLKCTL_CSCMR1           0x1C
306 #define CLKCTL_CSCMR2           0x20
307 #define CLKCTL_CSCDR1           0x24
308 #define CLKCTL_CS1CDR           0x28
309 #define CLKCTL_CS2CDR           0x2C
310 #define CLKCTL_CDCDR            0x30
311 #define CLKCTL_CHSCDR           0x34
312 #define CLKCTL_CSCDR2           0x38
313 #define CLKCTL_CSCDR3           0x3C
314 #define CLKCTL_CSCDR4           0x40
315 #define CLKCTL_CWDR             0x44
316 #define CLKCTL_CDHIPR           0x48
317 #define CLKCTL_CDCR             0x4C
318 #define CLKCTL_CTOR             0x50
319 #define CLKCTL_CLPCR            0x54
320 #define CLKCTL_CISR             0x58
321 #define CLKCTL_CIMR             0x5C
322 #define CLKCTL_CCOSR            0x60
323 #define CLKCTL_CGPR             0x64
324 #define CLKCTL_CCGR0            0x68
325 #define CLKCTL_CCGR1            0x6C
326 #define CLKCTL_CCGR2            0x70
327 #define CLKCTL_CCGR3            0x74
328 #define CLKCTL_CCGR4            0x78
329 #define CLKCTL_CCGR5            0x7C
330 #define CLKCTL_CCGR6            0x80
331 #define CLKCTL_CCGR7            0x84
332 #define CLKCTL_CMEOR            0x88
333
334 #define CHIP_REV_1_0            0x10
335 #define PLATFORM_ICGC           0x14
336
337 /* Assuming 24MHz input clock with doubler ON */
338 /*                            MFI         PDF */
339 #define DP_OP_850       ((8 << 4) + ((1 - 1)  << 0))
340 #define DP_MFD_850      (48 - 1)
341 #define DP_MFN_850      41
342
343 #define DP_OP_800       ((8 << 4) + ((1 - 1)  << 0))
344 #define DP_MFD_800      (3 - 1)
345 #define DP_MFN_800      1
346
347 #define DP_OP_700       ((7 << 4) + ((1 - 1)  << 0))
348 #define DP_MFD_700      (24 - 1)
349 #define DP_MFN_700      7
350
351 #define DP_OP_600       ((6 << 4) + ((1 - 1)  << 0))
352 #define DP_MFD_600      (4 - 1)
353 #define DP_MFN_600      1
354
355 #define DP_OP_665       ((6 << 4) + ((1 - 1)  << 0))
356 #define DP_MFD_665      (96 - 1)
357 #define DP_MFN_665      89
358
359 #define DP_OP_532       ((5 << 4) + ((1 - 1)  << 0))
360 #define DP_MFD_532      (24 - 1)
361 #define DP_MFN_532      13
362
363 #define DP_OP_400       ((8 << 4) + ((2 - 1)  << 0))
364 #define DP_MFD_400      (3 - 1)
365 #define DP_MFN_400      1
366
367 #define DP_OP_216       ((6 << 4) + ((3 - 1)  << 0))
368 #define DP_MFD_216      (4 - 1)
369 #define DP_MFN_216      3
370
371 #define PLL_DP_CTL      0x00
372 #define PLL_DP_CONFIG   0x04
373 #define PLL_DP_OP       0x08
374 #define PLL_DP_MFD      0x0C
375 #define PLL_DP_MFN      0x10
376 #define PLL_DP_MFNMINUS 0x14
377 #define PLL_DP_MFNPLUS  0x18
378 #define PLL_DP_HFS_OP   0x1C
379 #define PLL_DP_HFS_MFD  0x20
380 #define PLL_DP_HFS_MFN  0x24
381 #define PLL_DP_TOGC     0x28
382 #define PLL_DP_DESTAT   0x2C
383
384 #ifndef __ASSEMBLER__
385
386 enum boot_device {
387         WEIM_NOR_BOOT,
388         ONE_NAND_BOOT,
389         PATA_BOOT,
390         SATA_BOOT,
391         I2C_BOOT,
392         SPI_NOR_BOOT,
393         SD_BOOT,
394         MMC_BOOT,
395         NAND_BOOT,
396         UNKNOWN_BOOT
397 };
398
399 enum mxc_clock {
400         MXC_ARM_CLK = 0,
401         MXC_PER_CLK,
402         MXC_AHB_CLK,
403         MXC_IPG_CLK,
404         MXC_IPG_PERCLK,
405         MXC_UART_CLK,
406         MXC_CSPI_CLK,
407         MXC_AXI_A_CLK,
408         MXC_AXI_B_CLK,
409         MXC_EMI_SLOW_CLK,
410         MXC_DDR_CLK,
411         MXC_ESDHC_CLK,
412         MXC_ESDHC2_CLK,
413         MXC_ESDHC3_CLK,
414         MXC_ESDHC4_CLK,
415         MXC_SATA_CLK
416 };
417
418 enum mxc_peri_clocks {
419         MXC_UART1_BAUD,
420         MXC_UART2_BAUD,
421         MXC_UART3_BAUD,
422         MXC_SSI1_BAUD,
423         MXC_SSI2_BAUD,
424         MXC_CSI_BAUD,
425         MXC_MSTICK1_CLK,
426         MXC_MSTICK2_CLK,
427         MXC_SPI1_CLK,
428         MXC_SPI2_CLK,
429 };
430
431 extern unsigned int mxc_get_clock(enum mxc_clock clk);
432 extern unsigned int get_board_rev(void);
433 extern int is_soc_rev(int rev);
434 extern enum boot_device get_boot_device(void);
435
436 #endif /* __ASSEMBLER__*/
437
438 #endif                          /*  __ASM_ARCH_MXC_MX53_H__ */