2 * Copyright (C) 2011 Freescale Semiconductor, Inc.
3 * Jason Liu <r64343@freescale.com>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #include <asm/arch/imx-regs.h>
27 #include <asm/arch/mx5x_pins.h>
28 #include <asm/arch/sys_proto.h>
29 #include <asm/arch/crm_regs.h>
30 #include <asm/arch/iomux.h>
31 #include <asm/arch/clock.h>
32 #include <asm/errno.h>
36 #include <fsl_esdhc.h>
39 DECLARE_GLOBAL_DATA_PTR;
41 u32 get_board_rev(void)
50 size1 = get_ram_size((void *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
51 size2 = get_ram_size((void *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE);
53 gd->ram_size = size1 + size2;
57 void dram_init_banksize(void)
59 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
60 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
62 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
63 gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
66 static void setup_iomux_uart(void)
69 mxc_request_iomux(MX53_PIN_CSI0_D11, IOMUX_CONFIG_ALT2);
70 mxc_iomux_set_pad(MX53_PIN_CSI0_D11,
71 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
72 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
73 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU |
74 PAD_CTL_ODE_OPENDRAIN_ENABLE);
75 mxc_iomux_set_input(MX53_UART1_IPP_UART_RXD_MUX_SELECT_INPUT, 0x1);
78 mxc_request_iomux(MX53_PIN_CSI0_D10, IOMUX_CONFIG_ALT2);
79 mxc_iomux_set_pad(MX53_PIN_CSI0_D10,
80 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
81 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
82 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU |
83 PAD_CTL_ODE_OPENDRAIN_ENABLE);
86 static void setup_iomux_fec(void)
89 mxc_request_iomux(MX53_PIN_FEC_MDIO, IOMUX_CONFIG_ALT0);
90 mxc_iomux_set_pad(MX53_PIN_FEC_MDIO,
91 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
92 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
93 PAD_CTL_22K_PU | PAD_CTL_ODE_OPENDRAIN_ENABLE);
94 mxc_iomux_set_input(MX53_FEC_FEC_MDI_SELECT_INPUT, 0x1);
97 mxc_request_iomux(MX53_PIN_FEC_MDC, IOMUX_CONFIG_ALT0);
98 mxc_iomux_set_pad(MX53_PIN_FEC_MDC, PAD_CTL_DRV_HIGH);
101 mxc_request_iomux(MX53_PIN_FEC_RXD1, IOMUX_CONFIG_ALT0);
102 mxc_iomux_set_pad(MX53_PIN_FEC_RXD1,
103 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
106 mxc_request_iomux(MX53_PIN_FEC_RXD0, IOMUX_CONFIG_ALT0);
107 mxc_iomux_set_pad(MX53_PIN_FEC_RXD0,
108 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
111 mxc_request_iomux(MX53_PIN_FEC_TXD1, IOMUX_CONFIG_ALT0);
112 mxc_iomux_set_pad(MX53_PIN_FEC_TXD1, PAD_CTL_DRV_HIGH);
115 mxc_request_iomux(MX53_PIN_FEC_TXD0, IOMUX_CONFIG_ALT0);
116 mxc_iomux_set_pad(MX53_PIN_FEC_TXD0, PAD_CTL_DRV_HIGH);
119 mxc_request_iomux(MX53_PIN_FEC_TX_EN, IOMUX_CONFIG_ALT0);
120 mxc_iomux_set_pad(MX53_PIN_FEC_TX_EN, PAD_CTL_DRV_HIGH);
123 mxc_request_iomux(MX53_PIN_FEC_REF_CLK, IOMUX_CONFIG_ALT0);
124 mxc_iomux_set_pad(MX53_PIN_FEC_REF_CLK,
125 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
128 mxc_request_iomux(MX53_PIN_FEC_RX_ER, IOMUX_CONFIG_ALT0);
129 mxc_iomux_set_pad(MX53_PIN_FEC_RX_ER,
130 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
133 mxc_request_iomux(MX53_PIN_FEC_CRS_DV, IOMUX_CONFIG_ALT0);
134 mxc_iomux_set_pad(MX53_PIN_FEC_CRS_DV,
135 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
138 #ifdef CONFIG_FSL_ESDHC
139 struct fsl_esdhc_cfg esdhc_cfg[2] = {
140 {MMC_SDHC1_BASE_ADDR, 1},
141 {MMC_SDHC3_BASE_ADDR, 1},
144 int board_mmc_getcd(u8 *cd, struct mmc *mmc)
146 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
148 if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
149 *cd = mxc_gpio_get(77); /*GPIO3_13*/
151 *cd = mxc_gpio_get(75); /*GPIO3_11*/
156 int board_mmc_init(bd_t *bis)
161 for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM; index++) {
164 mxc_request_iomux(MX53_PIN_SD1_CMD, IOMUX_CONFIG_ALT0);
165 mxc_request_iomux(MX53_PIN_SD1_CLK, IOMUX_CONFIG_ALT0);
166 mxc_request_iomux(MX53_PIN_SD1_DATA0,
168 mxc_request_iomux(MX53_PIN_SD1_DATA1,
170 mxc_request_iomux(MX53_PIN_SD1_DATA2,
172 mxc_request_iomux(MX53_PIN_SD1_DATA3,
174 mxc_request_iomux(MX53_PIN_EIM_DA13,
177 mxc_iomux_set_pad(MX53_PIN_SD1_CMD,
178 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
179 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
180 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU);
181 mxc_iomux_set_pad(MX53_PIN_SD1_CLK,
182 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
183 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
185 mxc_iomux_set_pad(MX53_PIN_SD1_DATA0,
186 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
187 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
188 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
189 mxc_iomux_set_pad(MX53_PIN_SD1_DATA1,
190 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
191 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
192 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
193 mxc_iomux_set_pad(MX53_PIN_SD1_DATA2,
194 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
195 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
196 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
197 mxc_iomux_set_pad(MX53_PIN_SD1_DATA3,
198 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
199 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
200 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
203 mxc_request_iomux(MX53_PIN_ATA_RESET_B,
205 mxc_request_iomux(MX53_PIN_ATA_IORDY,
207 mxc_request_iomux(MX53_PIN_ATA_DATA8,
209 mxc_request_iomux(MX53_PIN_ATA_DATA9,
211 mxc_request_iomux(MX53_PIN_ATA_DATA10,
213 mxc_request_iomux(MX53_PIN_ATA_DATA11,
215 mxc_request_iomux(MX53_PIN_ATA_DATA0,
217 mxc_request_iomux(MX53_PIN_ATA_DATA1,
219 mxc_request_iomux(MX53_PIN_ATA_DATA2,
221 mxc_request_iomux(MX53_PIN_ATA_DATA3,
223 mxc_request_iomux(MX53_PIN_EIM_DA11,
226 mxc_iomux_set_pad(MX53_PIN_ATA_RESET_B,
227 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
228 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
229 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU);
230 mxc_iomux_set_pad(MX53_PIN_ATA_IORDY,
231 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
232 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
234 mxc_iomux_set_pad(MX53_PIN_ATA_DATA8,
235 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
236 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
237 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
238 mxc_iomux_set_pad(MX53_PIN_ATA_DATA9,
239 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
240 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
241 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
242 mxc_iomux_set_pad(MX53_PIN_ATA_DATA10,
243 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
244 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
245 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
246 mxc_iomux_set_pad(MX53_PIN_ATA_DATA11,
247 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
248 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
249 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
250 mxc_iomux_set_pad(MX53_PIN_ATA_DATA0,
251 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
252 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
253 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
254 mxc_iomux_set_pad(MX53_PIN_ATA_DATA1,
255 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
256 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
257 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
258 mxc_iomux_set_pad(MX53_PIN_ATA_DATA2,
259 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
260 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
261 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
262 mxc_iomux_set_pad(MX53_PIN_ATA_DATA3,
263 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
264 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
265 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU);
269 printf("Warning: you configured more ESDHC controller"
270 "(%d) as supported by the board(2)\n",
271 CONFIG_SYS_FSL_ESDHC_NUM);
274 status |= fsl_esdhc_initialize(bis, &esdhc_cfg[index]);
281 int board_early_init_f(void)
291 gd->bd->bi_arch_number = MACH_TYPE_MX53_LOCO;
292 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
299 puts("Board: MX53 LOCO\n");