2 * (C) Copyright 2010 Freescale Semiconductor, Inc.
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #include <asm/arch/imx-regs.h>
26 #include <asm/arch/mx5x_pins.h>
27 #include <asm/arch/sys_proto.h>
28 #include <asm/arch/crm_regs.h>
29 #include <asm/arch/iomux.h>
30 #include <asm/errno.h>
34 #include <fsl_esdhc.h>
39 DECLARE_GLOBAL_DATA_PTR;
41 u32 get_board_rev(void)
48 /* dram_init must store complete ramsize in gd->ram_size */
49 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
54 static void setup_iomux_uart(void)
57 mxc_request_iomux(MX53_PIN_CSI0_D11, IOMUX_CONFIG_ALT2);
58 mxc_iomux_set_pad(MX53_PIN_CSI0_D11,
59 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
60 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
61 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU |
62 PAD_CTL_ODE_OPENDRAIN_ENABLE);
63 mxc_iomux_set_input(MX53_UART1_IPP_UART_RXD_MUX_SELECT_INPUT, 0x1);
66 mxc_request_iomux(MX53_PIN_CSI0_D10, IOMUX_CONFIG_ALT2);
67 mxc_iomux_set_pad(MX53_PIN_CSI0_D10,
68 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
69 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
70 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU |
71 PAD_CTL_ODE_OPENDRAIN_ENABLE);
74 static void setup_i2c(unsigned int port_number)
76 switch (port_number) {
79 mxc_request_iomux(MX53_PIN_CSI0_D8,
80 IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
81 mxc_iomux_set_input(MX53_I2C1_IPP_SDA_IN_SELECT_INPUT,
83 mxc_iomux_set_pad(MX53_PIN_CSI0_D8,
84 PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
85 PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE |
86 PAD_CTL_ODE_OPENDRAIN_ENABLE);
88 mxc_request_iomux(MX53_PIN_CSI0_D9,
89 IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION);
90 mxc_iomux_set_input(MX53_I2C1_IPP_SCL_IN_SELECT_INPUT,
92 mxc_iomux_set_pad(MX53_PIN_CSI0_D9,
93 PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
94 PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE |
95 PAD_CTL_ODE_OPENDRAIN_ENABLE);
99 mxc_request_iomux(MX53_PIN_KEY_ROW3,
100 IOMUX_CONFIG_ALT4 | IOMUX_CONFIG_SION);
101 mxc_iomux_set_input(MX53_I2C2_IPP_SDA_IN_SELECT_INPUT,
103 mxc_iomux_set_pad(MX53_PIN_KEY_ROW3,
104 PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
105 PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE |
106 PAD_CTL_ODE_OPENDRAIN_ENABLE);
109 mxc_request_iomux(MX53_PIN_KEY_COL3,
110 IOMUX_CONFIG_ALT4 | IOMUX_CONFIG_SION);
111 mxc_iomux_set_input(MX53_I2C2_IPP_SCL_IN_SELECT_INPUT,
113 mxc_iomux_set_pad(MX53_PIN_KEY_COL3,
114 PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
115 PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE |
116 PAD_CTL_ODE_OPENDRAIN_ENABLE);
119 printf("Warning: Wrong I2C port number\n");
124 void power_init(void)
128 /* Set VDDA to 1.25V */
129 val = pmic_reg_read(REG_SW_2);
130 val &= ~SWX_OUT_MASK;
132 pmic_reg_write(REG_SW_2, val);
135 * Need increase VCC and VDDA to 1.3V
136 * according to MX53 IC TO2 datasheet.
138 if (is_soc_rev(CHIP_REV_2_0) == 0) {
139 /* Set VCC to 1.3V for TO2 */
140 val = pmic_reg_read(REG_SW_1);
141 val &= ~SWX_OUT_MASK;
143 pmic_reg_write(REG_SW_1, val);
145 /* Set VDDA to 1.3V for TO2 */
146 val = pmic_reg_read(REG_SW_2);
147 val &= ~SWX_OUT_MASK;
149 pmic_reg_write(REG_SW_2, val);
153 static void setup_iomux_fec(void)
156 mxc_request_iomux(MX53_PIN_FEC_MDIO, IOMUX_CONFIG_ALT0);
157 mxc_iomux_set_pad(MX53_PIN_FEC_MDIO,
158 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
159 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
160 PAD_CTL_22K_PU | PAD_CTL_ODE_OPENDRAIN_ENABLE);
161 mxc_iomux_set_input(MX53_FEC_FEC_MDI_SELECT_INPUT, 0x1);
164 mxc_request_iomux(MX53_PIN_FEC_MDC, IOMUX_CONFIG_ALT0);
165 mxc_iomux_set_pad(MX53_PIN_FEC_MDC, PAD_CTL_DRV_HIGH);
168 mxc_request_iomux(MX53_PIN_FEC_RXD1, IOMUX_CONFIG_ALT0);
169 mxc_iomux_set_pad(MX53_PIN_FEC_RXD1,
170 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
173 mxc_request_iomux(MX53_PIN_FEC_RXD0, IOMUX_CONFIG_ALT0);
174 mxc_iomux_set_pad(MX53_PIN_FEC_RXD0,
175 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
178 mxc_request_iomux(MX53_PIN_FEC_TXD1, IOMUX_CONFIG_ALT0);
179 mxc_iomux_set_pad(MX53_PIN_FEC_TXD1, PAD_CTL_DRV_HIGH);
182 mxc_request_iomux(MX53_PIN_FEC_TXD0, IOMUX_CONFIG_ALT0);
183 mxc_iomux_set_pad(MX53_PIN_FEC_TXD0, PAD_CTL_DRV_HIGH);
186 mxc_request_iomux(MX53_PIN_FEC_TX_EN, IOMUX_CONFIG_ALT0);
187 mxc_iomux_set_pad(MX53_PIN_FEC_TX_EN, PAD_CTL_DRV_HIGH);
190 mxc_request_iomux(MX53_PIN_FEC_REF_CLK, IOMUX_CONFIG_ALT0);
191 mxc_iomux_set_pad(MX53_PIN_FEC_REF_CLK,
192 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
195 mxc_request_iomux(MX53_PIN_FEC_RX_ER, IOMUX_CONFIG_ALT0);
196 mxc_iomux_set_pad(MX53_PIN_FEC_RX_ER,
197 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
200 mxc_request_iomux(MX53_PIN_FEC_CRS_DV, IOMUX_CONFIG_ALT0);
201 mxc_iomux_set_pad(MX53_PIN_FEC_CRS_DV,
202 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
205 #ifdef CONFIG_FSL_ESDHC
206 struct fsl_esdhc_cfg esdhc_cfg[2] = {
207 {MMC_SDHC1_BASE_ADDR, 1},
208 {MMC_SDHC3_BASE_ADDR, 1},
211 int board_mmc_getcd(u8 *cd, struct mmc *mmc)
213 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
215 if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
216 *cd = mxc_gpio_get(77); /*GPIO3_13*/
218 *cd = mxc_gpio_get(75); /*GPIO3_11*/
223 int board_mmc_init(bd_t *bis)
228 for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM; index++) {
231 mxc_request_iomux(MX53_PIN_SD1_CMD, IOMUX_CONFIG_ALT0);
232 mxc_request_iomux(MX53_PIN_SD1_CLK, IOMUX_CONFIG_ALT0);
233 mxc_request_iomux(MX53_PIN_SD1_DATA0,
235 mxc_request_iomux(MX53_PIN_SD1_DATA1,
237 mxc_request_iomux(MX53_PIN_SD1_DATA2,
239 mxc_request_iomux(MX53_PIN_SD1_DATA3,
241 mxc_request_iomux(MX53_PIN_EIM_DA13,
244 mxc_iomux_set_pad(MX53_PIN_SD1_CMD,
245 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
246 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
247 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU);
248 mxc_iomux_set_pad(MX53_PIN_SD1_CLK,
249 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
250 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
252 mxc_iomux_set_pad(MX53_PIN_SD1_DATA0,
253 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
254 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
255 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
256 mxc_iomux_set_pad(MX53_PIN_SD1_DATA1,
257 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
258 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
259 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
260 mxc_iomux_set_pad(MX53_PIN_SD1_DATA2,
261 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
262 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
263 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
264 mxc_iomux_set_pad(MX53_PIN_SD1_DATA3,
265 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
266 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
267 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
270 mxc_request_iomux(MX53_PIN_ATA_RESET_B,
272 mxc_request_iomux(MX53_PIN_ATA_IORDY,
274 mxc_request_iomux(MX53_PIN_ATA_DATA8,
276 mxc_request_iomux(MX53_PIN_ATA_DATA9,
278 mxc_request_iomux(MX53_PIN_ATA_DATA10,
280 mxc_request_iomux(MX53_PIN_ATA_DATA11,
282 mxc_request_iomux(MX53_PIN_ATA_DATA0,
284 mxc_request_iomux(MX53_PIN_ATA_DATA1,
286 mxc_request_iomux(MX53_PIN_ATA_DATA2,
288 mxc_request_iomux(MX53_PIN_ATA_DATA3,
290 mxc_request_iomux(MX53_PIN_EIM_DA11,
293 mxc_iomux_set_pad(MX53_PIN_ATA_RESET_B,
294 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
295 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
296 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU);
297 mxc_iomux_set_pad(MX53_PIN_ATA_IORDY,
298 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
299 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
301 mxc_iomux_set_pad(MX53_PIN_ATA_DATA8,
302 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
303 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
304 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
305 mxc_iomux_set_pad(MX53_PIN_ATA_DATA9,
306 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
307 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
308 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
309 mxc_iomux_set_pad(MX53_PIN_ATA_DATA10,
310 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
311 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
312 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
313 mxc_iomux_set_pad(MX53_PIN_ATA_DATA11,
314 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
315 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
316 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
317 mxc_iomux_set_pad(MX53_PIN_ATA_DATA0,
318 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
319 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
320 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
321 mxc_iomux_set_pad(MX53_PIN_ATA_DATA1,
322 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
323 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
324 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
325 mxc_iomux_set_pad(MX53_PIN_ATA_DATA2,
326 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
327 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
328 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
329 mxc_iomux_set_pad(MX53_PIN_ATA_DATA3,
330 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
331 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
332 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
336 printf("Warning: you configured more ESDHC controller"
337 "(%d) as supported by the board(2)\n",
338 CONFIG_SYS_FSL_ESDHC_NUM);
341 status |= fsl_esdhc_initialize(bis, &esdhc_cfg[index]);
348 int board_early_init_f(void)
358 gd->bd->bi_arch_number = MACH_TYPE_MX53_EVK;
359 /* address of boot parameters */
360 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
365 int board_late_init(void)
375 puts("Board: MX53EVK\n");