2 * (C) Copyright 2011 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/clock.h>
30 #include <asm/arch/iomux.h>
31 #include <asm/errno.h>
34 #include <fsl_esdhc.h>
37 #define ETHERNET_INT IMX_GPIO_NR(2, 31)
39 DECLARE_GLOBAL_DATA_PTR;
45 size1 = get_ram_size((void *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
46 size2 = get_ram_size((void *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE);
48 gd->ram_size = size1 + size2;
52 void dram_init_banksize(void)
54 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
55 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
57 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
58 gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
61 static void setup_iomux_uart(void)
64 mxc_request_iomux(MX53_PIN_ATA_DMACK, IOMUX_CONFIG_ALT3);
65 mxc_iomux_set_pad(MX53_PIN_ATA_DMACK,
66 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
67 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
68 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU |
69 PAD_CTL_ODE_OPENDRAIN_ENABLE);
70 mxc_iomux_set_input(MX53_UART1_IPP_UART_RXD_MUX_SELECT_INPUT, 0x3);
73 mxc_request_iomux(MX53_PIN_ATA_DIOW, IOMUX_CONFIG_ALT3);
74 mxc_iomux_set_pad(MX53_PIN_ATA_DIOW,
75 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH |
76 PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE |
77 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU |
78 PAD_CTL_ODE_OPENDRAIN_ENABLE);
81 #ifdef CONFIG_FSL_ESDHC
82 struct fsl_esdhc_cfg esdhc_cfg[2] = {
83 {MMC_SDHC1_BASE_ADDR},
84 {MMC_SDHC2_BASE_ADDR},
87 int board_mmc_getcd(struct mmc *mmc)
89 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
92 mxc_request_iomux(MX53_PIN_GPIO_1, IOMUX_CONFIG_ALT1);
93 gpio_direction_input(IMX_GPIO_NR(1, 1));
94 mxc_request_iomux(MX53_PIN_GPIO_4, IOMUX_CONFIG_ALT1);
95 gpio_direction_input(IMX_GPIO_NR(1, 4));
97 if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
98 ret = !gpio_get_value(IMX_GPIO_NR(1, 1));
100 ret = !gpio_get_value(IMX_GPIO_NR(1, 4));
105 int board_mmc_init(bd_t *bis)
110 esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
111 esdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
113 for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM; index++) {
116 mxc_request_iomux(MX53_PIN_SD1_CMD, IOMUX_CONFIG_ALT0);
117 mxc_request_iomux(MX53_PIN_SD1_CLK, IOMUX_CONFIG_ALT0);
118 mxc_request_iomux(MX53_PIN_SD1_DATA0,
120 mxc_request_iomux(MX53_PIN_SD1_DATA1,
122 mxc_request_iomux(MX53_PIN_SD1_DATA2,
124 mxc_request_iomux(MX53_PIN_SD1_DATA3,
127 mxc_iomux_set_pad(MX53_PIN_SD1_CMD, 0x1E4);
128 mxc_iomux_set_pad(MX53_PIN_SD1_CLK, 0xD4);
129 mxc_iomux_set_pad(MX53_PIN_SD1_DATA0, 0x1D4);
130 mxc_iomux_set_pad(MX53_PIN_SD1_DATA1, 0x1D4);
131 mxc_iomux_set_pad(MX53_PIN_SD1_DATA2, 0x1D4);
132 mxc_iomux_set_pad(MX53_PIN_SD1_DATA3, 0x1D4);
135 mxc_request_iomux(MX53_PIN_SD2_CMD,
136 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
137 mxc_request_iomux(MX53_PIN_SD2_CLK,
138 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
139 mxc_request_iomux(MX53_PIN_SD2_DATA0,
141 mxc_request_iomux(MX53_PIN_SD2_DATA1,
143 mxc_request_iomux(MX53_PIN_SD2_DATA2,
145 mxc_request_iomux(MX53_PIN_SD2_DATA3,
147 mxc_request_iomux(MX53_PIN_ATA_DATA12,
149 mxc_request_iomux(MX53_PIN_ATA_DATA13,
151 mxc_request_iomux(MX53_PIN_ATA_DATA14,
153 mxc_request_iomux(MX53_PIN_ATA_DATA15,
156 mxc_iomux_set_pad(MX53_PIN_SD2_CMD, 0x1E4);
157 mxc_iomux_set_pad(MX53_PIN_SD2_CLK, 0xD4);
158 mxc_iomux_set_pad(MX53_PIN_SD2_DATA0, 0x1D4);
159 mxc_iomux_set_pad(MX53_PIN_SD2_DATA1, 0x1D4);
160 mxc_iomux_set_pad(MX53_PIN_SD2_DATA2, 0x1D4);
161 mxc_iomux_set_pad(MX53_PIN_SD2_DATA3, 0x1D4);
162 mxc_iomux_set_pad(MX53_PIN_ATA_DATA12, 0x1D4);
163 mxc_iomux_set_pad(MX53_PIN_ATA_DATA13, 0x1D4);
164 mxc_iomux_set_pad(MX53_PIN_ATA_DATA14, 0x1D4);
165 mxc_iomux_set_pad(MX53_PIN_ATA_DATA15, 0x1D4);
168 printf("Warning: you configured more ESDHC controller"
169 "(%d) as supported by the board(2)\n",
170 CONFIG_SYS_FSL_ESDHC_NUM);
173 status |= fsl_esdhc_initialize(bis, &esdhc_cfg[index]);
180 static void weim_smc911x_iomux(void)
182 /* ETHERNET_INT as GPIO2_31 */
183 mxc_request_iomux(MX53_PIN_EIM_EB3, IOMUX_CONFIG_ALT1);
184 gpio_direction_input(ETHERNET_INT);
187 mxc_request_iomux(MX53_PIN_EIM_D16, IOMUX_CONFIG_ALT0);
188 mxc_iomux_set_pad(MX53_PIN_EIM_D16, 0xA4);
190 mxc_request_iomux(MX53_PIN_EIM_D17, IOMUX_CONFIG_ALT0);
191 mxc_iomux_set_pad(MX53_PIN_EIM_D17, 0xA4);
193 mxc_request_iomux(MX53_PIN_EIM_D18, IOMUX_CONFIG_ALT0);
194 mxc_iomux_set_pad(MX53_PIN_EIM_D18, 0xA4);
196 mxc_request_iomux(MX53_PIN_EIM_D19, IOMUX_CONFIG_ALT0);
197 mxc_iomux_set_pad(MX53_PIN_EIM_D19, 0xA4);
199 mxc_request_iomux(MX53_PIN_EIM_D20, IOMUX_CONFIG_ALT0);
200 mxc_iomux_set_pad(MX53_PIN_EIM_D20, 0xA4);
202 mxc_request_iomux(MX53_PIN_EIM_D21, IOMUX_CONFIG_ALT0);
203 mxc_iomux_set_pad(MX53_PIN_EIM_D21, 0xA4);
205 mxc_request_iomux(MX53_PIN_EIM_D22, IOMUX_CONFIG_ALT0);
206 mxc_iomux_set_pad(MX53_PIN_EIM_D22, 0xA4);
208 mxc_request_iomux(MX53_PIN_EIM_D23, IOMUX_CONFIG_ALT0);
209 mxc_iomux_set_pad(MX53_PIN_EIM_D23, 0xA4);
211 mxc_request_iomux(MX53_PIN_EIM_D24, IOMUX_CONFIG_ALT0);
212 mxc_iomux_set_pad(MX53_PIN_EIM_D24, 0xA4);
214 mxc_request_iomux(MX53_PIN_EIM_D25, IOMUX_CONFIG_ALT0);
215 mxc_iomux_set_pad(MX53_PIN_EIM_D25, 0xA4);
217 mxc_request_iomux(MX53_PIN_EIM_D26, IOMUX_CONFIG_ALT0);
218 mxc_iomux_set_pad(MX53_PIN_EIM_D26, 0xA4);
220 mxc_request_iomux(MX53_PIN_EIM_D27, IOMUX_CONFIG_ALT0);
221 mxc_iomux_set_pad(MX53_PIN_EIM_D27, 0xA4);
223 mxc_request_iomux(MX53_PIN_EIM_D28, IOMUX_CONFIG_ALT0);
224 mxc_iomux_set_pad(MX53_PIN_EIM_D28, 0xA4);
226 mxc_request_iomux(MX53_PIN_EIM_D29, IOMUX_CONFIG_ALT0);
227 mxc_iomux_set_pad(MX53_PIN_EIM_D29, 0xA4);
229 mxc_request_iomux(MX53_PIN_EIM_D30, IOMUX_CONFIG_ALT0);
230 mxc_iomux_set_pad(MX53_PIN_EIM_D30, 0xA4);
232 mxc_request_iomux(MX53_PIN_EIM_D31, IOMUX_CONFIG_ALT0);
233 mxc_iomux_set_pad(MX53_PIN_EIM_D31, 0xA4);
236 mxc_request_iomux(MX53_PIN_EIM_DA0, IOMUX_CONFIG_ALT0);
237 mxc_iomux_set_pad(MX53_PIN_EIM_DA0, 0xA4);
239 mxc_request_iomux(MX53_PIN_EIM_DA1, IOMUX_CONFIG_ALT0);
240 mxc_iomux_set_pad(MX53_PIN_EIM_DA1, 0xA4);
242 mxc_request_iomux(MX53_PIN_EIM_DA2, IOMUX_CONFIG_ALT0);
243 mxc_iomux_set_pad(MX53_PIN_EIM_DA2, 0xA4);
245 mxc_request_iomux(MX53_PIN_EIM_DA3, IOMUX_CONFIG_ALT0);
246 mxc_iomux_set_pad(MX53_PIN_EIM_DA3, 0xA4);
248 mxc_request_iomux(MX53_PIN_EIM_DA4, IOMUX_CONFIG_ALT0);
249 mxc_iomux_set_pad(MX53_PIN_EIM_DA4, 0xA4);
251 mxc_request_iomux(MX53_PIN_EIM_DA5, IOMUX_CONFIG_ALT0);
252 mxc_iomux_set_pad(MX53_PIN_EIM_DA5, 0xA4);
254 mxc_request_iomux(MX53_PIN_EIM_DA6, IOMUX_CONFIG_ALT0);
255 mxc_iomux_set_pad(MX53_PIN_EIM_DA6, 0xA4);
257 /* other EIM signals for ethernet */
258 mxc_request_iomux(MX53_PIN_EIM_OE, IOMUX_CONFIG_ALT0);
259 mxc_request_iomux(MX53_PIN_EIM_RW, IOMUX_CONFIG_ALT0);
260 mxc_request_iomux(MX53_PIN_EIM_CS1, IOMUX_CONFIG_ALT0);
263 static void weim_cs1_settings(void)
265 struct weim *weim_regs = (struct weim *)WEIM_BASE_ADDR;
267 writel(MX53ARD_CS1GCR1, &weim_regs->cs1gcr1);
268 writel(0x0, &weim_regs->cs1gcr2);
269 writel(MX53ARD_CS1RCR1, &weim_regs->cs1rcr1);
270 writel(MX53ARD_CS1RCR2, &weim_regs->cs1rcr2);
271 writel(MX53ARD_CS1WCR1, &weim_regs->cs1wcr1);
272 writel(0x0, &weim_regs->cs1wcr2);
273 writel(0x0, &weim_regs->wcr);
275 set_chipselect_size(CS0_64M_CS1_64M);
278 int board_early_init_f(void)
286 /* address of boot parameters */
287 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
292 int board_eth_init(bd_t *bis)
296 weim_smc911x_iomux();
299 #ifdef CONFIG_SMC911X
300 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
307 puts("Board: MX53ARD\n");