3 * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
5 * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #ifndef __ASM_ARCH_MX35_H
27 #define __ASM_ARCH_MX35_H
29 #define __REG(x) (*((volatile u32 *)(x)))
30 #define __REG16(x) (*((volatile u16 *)(x)))
31 #define __REG8(x) (*((volatile u8 *)(x)))
33 #define L2CC_BASE_ADDR 0x30000000
38 #define AIPS1_BASE_ADDR 0x43F00000
39 #define AIPS1_CTRL_BASE_ADDR AIPS1_BASE_ADDR
40 #define MAX_BASE_ADDR 0x43F04000
41 #define EVTMON_BASE_ADDR 0x43F08000
42 #define CLKCTL_BASE_ADDR 0x43F0C000
43 #define I2C_BASE_ADDR 0x43F80000
44 #define I2C3_BASE_ADDR 0x43F84000
45 #define ATA_BASE_ADDR 0x43F8C000
46 #define UART1_BASE_ADDR 0x43F90000
47 #define UART2_BASE_ADDR 0x43F94000
48 #define I2C2_BASE_ADDR 0x43F98000
49 #define CSPI1_BASE_ADDR 0x43FA4000
50 #define IOMUXC_BASE_ADDR 0x43FAC000
55 #define SPBA_BASE_ADDR 0x50000000
56 #define UART3_BASE_ADDR 0x5000C000
57 #define CSPI2_BASE_ADDR 0x50010000
58 #define ATA_DMA_BASE_ADDR 0x50020000
59 #define FEC_BASE_ADDR 0x50038000
60 #define SPBA_CTRL_BASE_ADDR 0x5003C000
65 #define AIPS2_BASE_ADDR 0x53F00000
66 #define AIPS2_CTRL_BASE_ADDR AIPS2_BASE_ADDR
67 #define CCM_BASE_ADDR 0x53F80000
68 #define GPT1_BASE_ADDR 0x53F90000
69 #define EPIT1_BASE_ADDR 0x53F94000
70 #define EPIT2_BASE_ADDR 0x53F98000
71 #define GPIO3_BASE_ADDR 0x53FA4000
72 #define MMC_SDHC1_BASE_ADDR 0x53FB4000
73 #define MMC_SDHC2_BASE_ADDR 0x53FB8000
74 #define MMC_SDHC3_BASE_ADDR 0x53FBC000
75 #define IPU_CTRL_BASE_ADDR 0x53FC0000
76 #define GPIO3_BASE_ADDR 0x53FA4000
77 #define GPIO1_BASE_ADDR 0x53FCC000
78 #define GPIO2_BASE_ADDR 0x53FD0000
79 #define SDMA_BASE_ADDR 0x53FD4000
80 #define RTC_BASE_ADDR 0x53FD8000
81 #define WDOG_BASE_ADDR 0x53FDC000
82 #define PWM_BASE_ADDR 0x53FE0000
83 #define RTIC_BASE_ADDR 0x53FEC000
84 #define IIM_BASE_ADDR 0x53FF0000
89 #define ROMPATCH_BASE_ADDR 0x60000000
90 #define AVIC_BASE_ADDR 0x68000000
93 * NAND, SDRAM, WEIM, M3IF, EMI controllers
95 #define EXT_MEM_CTRL_BASE 0xB8000000
96 #define ESDCTL_BASE_ADDR 0xB8001000
97 #define WEIM_BASE_ADDR 0xB8002000
98 #define WEIM_CTRL_CS0 WEIM_BASE_ADDR
99 #define WEIM_CTRL_CS1 (WEIM_BASE_ADDR + 0x10)
100 #define WEIM_CTRL_CS2 (WEIM_BASE_ADDR + 0x20)
101 #define WEIM_CTRL_CS3 (WEIM_BASE_ADDR + 0x30)
102 #define WEIM_CTRL_CS4 (WEIM_BASE_ADDR + 0x40)
103 #define WEIM_CTRL_CS5 (WEIM_BASE_ADDR + 0x50)
104 #define M3IF_BASE_ADDR 0xB8003000
105 #define EMI_BASE_ADDR 0xB8004000
107 #define NFC_BASE_ADDR 0xBB000000
110 * Memory regions and CS
112 #define IPU_MEM_BASE_ADDR 0x70000000
113 #define CSD0_BASE_ADDR 0x80000000
114 #define CSD1_BASE_ADDR 0x90000000
115 #define CS0_BASE_ADDR 0xA0000000
116 #define CS1_BASE_ADDR 0xA8000000
117 #define CS2_BASE_ADDR 0xB0000000
118 #define CS3_BASE_ADDR 0xB2000000
119 #define CS4_BASE_ADDR 0xB4000000
120 #define CS5_BASE_ADDR 0xB6000000
123 * IRQ Controller Register Definitions.
125 #define AVIC_NIMASK 0x04
126 #define AVIC_INTTYPEH 0x18
127 #define AVIC_INTTYPEL 0x1C
130 #define L2CC_BASE_ADDR 0x30000000
131 #define L2_CACHE_LINE_SIZE 32
132 #define L2_CACHE_CTL_REG 0x100
133 #define L2_CACHE_AUX_CTL_REG 0x104
134 #define L2_CACHE_SYNC_REG 0x730
135 #define L2_CACHE_INV_LINE_REG 0x770
136 #define L2_CACHE_INV_WAY_REG 0x77C
137 #define L2_CACHE_CLEAN_LINE_REG 0x7B0
138 #define L2_CACHE_CLEAN_INV_LINE_REG 0x7F0
139 #define L2_CACHE_DBG_CTL_REG 0xF40
142 #define CLKCTL_CCMR 0x00
143 #define CLKCTL_PDR0 0x04
144 #define CLKCTL_PDR1 0x08
145 #define CLKCTL_PDR2 0x0C
146 #define CLKCTL_PDR3 0x10
147 #define CLKCTL_PDR4 0x14
148 #define CLKCTL_RCSR 0x18
149 #define CLKCTL_MPCTL 0x1C
150 #define CLKCTL_PPCTL 0x20
151 #define CLKCTL_ACMR 0x24
152 #define CLKCTL_COSR 0x28
153 #define CLKCTL_CGR0 0x2C
154 #define CLKCTL_CGR1 0x30
155 #define CLKCTL_CGR2 0x34
156 #define CLKCTL_CGR3 0x38
158 #define CLKMODE_AUTO 0
159 #define CLKMODE_CONSUMER 1
161 #define PLL_PD(x) (((x) & 0xf) << 26)
162 #define PLL_MFD(x) (((x) & 0x3ff) << 16)
163 #define PLL_MFI(x) (((x) & 0xf) << 10)
164 #define PLL_MFN(x) (((x) & 0x3ff) << 0)
166 #define CSCR_U(x) (WEIM_CTRL_CS#x + 0)
167 #define CSCR_L(x) (WEIM_CTRL_CS#x + 4)
168 #define CSCR_A(x) (WEIM_CTRL_CS#x + 8)
170 #define IIM_SREV 0x24
171 #define ROMPATCH_REV 0x40
173 #define IPU_CONF IPU_CTRL_BASE_ADDR
175 #define IPU_CONF_PXL_ENDIAN (1<<8)
176 #define IPU_CONF_DU_EN (1<<7)
177 #define IPU_CONF_DI_EN (1<<6)
178 #define IPU_CONF_ADC_EN (1<<5)
179 #define IPU_CONF_SDC_EN (1<<4)
180 #define IPU_CONF_PF_EN (1<<3)
181 #define IPU_CONF_ROT_EN (1<<2)
182 #define IPU_CONF_IC_EN (1<<1)
183 #define IPU_CONF_SCI_EN (1<<0)
185 #define GPIO_PORT_NUM 3
186 #define GPIO_NUM_PIN 32
188 #define NFC_BUF_SIZE 0x1000
189 #define NFC_BUFSIZE_REG_OFF (0 + 0x00)
190 #define RAM_BUFFER_ADDRESS_REG_OFF (0 + 0x04)
191 #define NAND_FLASH_ADD_REG_OFF (0 + 0x06)
192 #define NAND_FLASH_CMD_REG_OFF (0 + 0x08)
193 #define NFC_CONFIGURATION_REG_OFF (0 + 0x0A)
194 #define ECC_STATUS_RESULT_REG_OFF (0 + 0x0C)
195 #define ECC_RSLT_MAIN_AREA_REG_OFF (0 + 0x0E)
196 #define ECC_RSLT_SPARE_AREA_REG_OFF (0 + 0x10)
197 #define NF_WR_PROT_REG_OFF (0 + 0x12)
198 #define NAND_FLASH_WR_PR_ST_REG_OFF (0 + 0x18)
199 #define NAND_FLASH_CONFIG1_REG_OFF (0 + 0x1A)
200 #define NAND_FLASH_CONFIG2_REG_OFF (0 + 0x1C)
201 #define UNLOCK_START_BLK_ADD_REG_OFF (0 + 0x20)
202 #define UNLOCK_END_BLK_ADD_REG_OFF (0 + 0x22)
203 #define RAM_BUFFER_ADDRESS_RBA_3 0x3
204 #define NFC_BUFSIZE_1KB 0x0
205 #define NFC_BUFSIZE_2KB 0x1
206 #define NFC_CONFIGURATION_UNLOCKED 0x2
207 #define ECC_STATUS_RESULT_NO_ERR 0x0
208 #define ECC_STATUS_RESULT_1BIT_ERR 0x1
209 #define ECC_STATUS_RESULT_2BIT_ERR 0x2
210 #define NF_WR_PROT_UNLOCK 0x4
211 #define NAND_FLASH_CONFIG1_FORCE_CE (1 << 7)
212 #define NAND_FLASH_CONFIG1_RST (1 << 6)
213 #define NAND_FLASH_CONFIG1_BIG (1 << 5)
214 #define NAND_FLASH_CONFIG1_INT_MSK (1 << 4)
215 #define NAND_FLASH_CONFIG1_ECC_EN (1 << 3)
216 #define NAND_FLASH_CONFIG1_SP_EN (1 << 2)
217 #define NAND_FLASH_CONFIG2_INT_DONE (1 << 15)
218 #define NAND_FLASH_CONFIG2_FDO_PAGE (0 << 3)
219 #define NAND_FLASH_CONFIG2_FDO_ID (2 << 3)
220 #define NAND_FLASH_CONFIG2_FDO_STATUS (4 << 3)
221 #define NAND_FLASH_CONFIG2_FDI_EN (1 << 2)
222 #define NAND_FLASH_CONFIG2_FADD_EN (1 << 1)
223 #define NAND_FLASH_CONFIG2_FCMD_EN (1 << 0)
224 #define FDO_PAGE_SPARE_VAL 0x8
225 #define NAND_BUF_NUM 8
227 #define CHIP_REV_1_0 0x10
228 #define CHIP_REV_2_0 0x20
230 #define BOARD_REV_1_0 0x0
231 #define BOARD_REV_2_0 0x1
233 #ifndef __ASSEMBLER__
247 MCU_PLL = CCM_BASE_ADDR + CLKCTL_MPCTL,
248 PER_PLL = CCM_BASE_ADDR + CLKCTL_PPCTL,
251 enum mxc_main_clocks {
261 enum mxc_peri_clocks {
277 * NFMS bit in RCSR register for pagesize of nandflash
279 #define NFMS (*((volatile u32 *)(CCM_BASE_ADDR+0x18)))
281 #define NFMS_NF_DWIDTH 14
282 #define NFMS_NF_PG_SZ 8
285 extern unsigned int mxc_get_clock(enum mxc_clock clk);
286 extern unsigned int get_board_rev(void);
287 extern int is_soc_rev(int rev);
288 extern int sdhc_init(void);
290 #define fixup_before_linux \
292 volatile unsigned long *l2cc_ctl = (unsigned long *)0x30000100;\
293 if (is_soc_rev(CHIP_REV_2_0) < 0) \
296 #endif /* __ASSEMBLER__*/
297 #endif /* __ASM_ARCH_MX35_H */