blob: b505a710543f362b6f94c4f7354a48d5af271344 [file] [log] [blame]
Stefano Babicc5fb70c2010-02-05 15:13:58 +01001/*
2 * (C) Copyright 2009 Freescale Semiconductor, Inc.
3 *
4 * See file CREDITS for list of people who contributed to this
5 * project.
6 *
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.
11 *
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.
16 *
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,
20 * MA 02111-1307 USA
21 */
22
23#include <common.h>
24#include <asm/io.h>
Stefano Babic753fc2e2011-08-21 23:29:52 +020025#include <asm/gpio.h>
Stefano Babicc5fb70c2010-02-05 15:13:58 +010026#include <asm/arch/imx-regs.h>
Jason Liuff9f4752010-10-18 11:09:26 +080027#include <asm/arch/mx5x_pins.h>
Stefano Babicc5fb70c2010-02-05 15:13:58 +010028#include <asm/arch/iomux.h>
29#include <asm/errno.h>
Stefano Babice4d34492010-03-05 17:54:37 +010030#include <asm/arch/sys_proto.h>
Stefano Babicb4377e12010-03-16 17:22:21 +010031#include <asm/arch/crm_regs.h>
Stefano Babicc5fb70c2010-02-05 15:13:58 +010032#include <i2c.h>
33#include <mmc.h>
34#include <fsl_esdhc.h>
Stefano Babic53572652011-10-08 10:59:20 +020035#include <pmic.h>
Stefano Babicb4377e12010-03-16 17:22:21 +010036#include <fsl_pmic.h>
37#include <mc13892.h>
Wolfgang Grandegger055d9692011-11-11 14:03:38 +010038#include <usb/ehci-fsl.h>
Stefano Babicc5fb70c2010-02-05 15:13:58 +010039
40DECLARE_GLOBAL_DATA_PTR;
41
Stefano Babicc5fb70c2010-02-05 15:13:58 +010042#ifdef CONFIG_FSL_ESDHC
43struct fsl_esdhc_cfg esdhc_cfg[2] = {
Stefano Babic68c07a02010-04-18 20:01:01 +020044 {MMC_SDHC1_BASE_ADDR, 1},
45 {MMC_SDHC2_BASE_ADDR, 1},
Stefano Babicc5fb70c2010-02-05 15:13:58 +010046};
47#endif
48
Stefano Babicc5fb70c2010-02-05 15:13:58 +010049int dram_init(void)
50{
Shawn Guo1ab027c2010-10-28 10:13:15 +080051 /* dram_init must store complete ramsize in gd->ram_size */
Albert ARIBAUDa55d23c2011-07-03 05:55:33 +000052 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
Shawn Guo1ab027c2010-10-28 10:13:15 +080053 PHYS_SDRAM_1_SIZE);
Stefano Babicc5fb70c2010-02-05 15:13:58 +010054 return 0;
55}
56
57static void setup_iomux_uart(void)
58{
59 unsigned int pad = PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
60 PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH;
61
62 mxc_request_iomux(MX51_PIN_UART1_RXD, IOMUX_CONFIG_ALT0);
63 mxc_iomux_set_pad(MX51_PIN_UART1_RXD, pad | PAD_CTL_SRE_FAST);
64 mxc_request_iomux(MX51_PIN_UART1_TXD, IOMUX_CONFIG_ALT0);
65 mxc_iomux_set_pad(MX51_PIN_UART1_TXD, pad | PAD_CTL_SRE_FAST);
66 mxc_request_iomux(MX51_PIN_UART1_RTS, IOMUX_CONFIG_ALT0);
67 mxc_iomux_set_pad(MX51_PIN_UART1_RTS, pad);
68 mxc_request_iomux(MX51_PIN_UART1_CTS, IOMUX_CONFIG_ALT0);
69 mxc_iomux_set_pad(MX51_PIN_UART1_CTS, pad);
70}
71
Stefano Babicc5fb70c2010-02-05 15:13:58 +010072static void setup_iomux_fec(void)
73{
74 /*FEC_MDIO*/
75 mxc_request_iomux(MX51_PIN_EIM_EB2 , IOMUX_CONFIG_ALT3);
76 mxc_iomux_set_pad(MX51_PIN_EIM_EB2 , 0x1FD);
77
78 /*FEC_MDC*/
79 mxc_request_iomux(MX51_PIN_NANDF_CS3, IOMUX_CONFIG_ALT2);
80 mxc_iomux_set_pad(MX51_PIN_NANDF_CS3, 0x2004);
81
82 /* FEC RDATA[3] */
83 mxc_request_iomux(MX51_PIN_EIM_CS3, IOMUX_CONFIG_ALT3);
84 mxc_iomux_set_pad(MX51_PIN_EIM_CS3, 0x180);
85
86 /* FEC RDATA[2] */
87 mxc_request_iomux(MX51_PIN_EIM_CS2, IOMUX_CONFIG_ALT3);
88 mxc_iomux_set_pad(MX51_PIN_EIM_CS2, 0x180);
89
90 /* FEC RDATA[1] */
91 mxc_request_iomux(MX51_PIN_EIM_EB3, IOMUX_CONFIG_ALT3);
92 mxc_iomux_set_pad(MX51_PIN_EIM_EB3, 0x180);
93
94 /* FEC RDATA[0] */
95 mxc_request_iomux(MX51_PIN_NANDF_D9, IOMUX_CONFIG_ALT2);
96 mxc_iomux_set_pad(MX51_PIN_NANDF_D9, 0x2180);
97
98 /* FEC TDATA[3] */
99 mxc_request_iomux(MX51_PIN_NANDF_CS6, IOMUX_CONFIG_ALT2);
100 mxc_iomux_set_pad(MX51_PIN_NANDF_CS6, 0x2004);
101
102 /* FEC TDATA[2] */
103 mxc_request_iomux(MX51_PIN_NANDF_CS5, IOMUX_CONFIG_ALT2);
104 mxc_iomux_set_pad(MX51_PIN_NANDF_CS5, 0x2004);
105
106 /* FEC TDATA[1] */
107 mxc_request_iomux(MX51_PIN_NANDF_CS4, IOMUX_CONFIG_ALT2);
108 mxc_iomux_set_pad(MX51_PIN_NANDF_CS4, 0x2004);
109
110 /* FEC TDATA[0] */
111 mxc_request_iomux(MX51_PIN_NANDF_D8, IOMUX_CONFIG_ALT2);
112 mxc_iomux_set_pad(MX51_PIN_NANDF_D8, 0x2004);
113
114 /* FEC TX_EN */
115 mxc_request_iomux(MX51_PIN_NANDF_CS7, IOMUX_CONFIG_ALT1);
116 mxc_iomux_set_pad(MX51_PIN_NANDF_CS7, 0x2004);
117
118 /* FEC TX_ER */
119 mxc_request_iomux(MX51_PIN_NANDF_CS2, IOMUX_CONFIG_ALT2);
120 mxc_iomux_set_pad(MX51_PIN_NANDF_CS2, 0x2004);
121
122 /* FEC TX_CLK */
123 mxc_request_iomux(MX51_PIN_NANDF_RDY_INT, IOMUX_CONFIG_ALT1);
124 mxc_iomux_set_pad(MX51_PIN_NANDF_RDY_INT, 0x2180);
125
126 /* FEC TX_COL */
127 mxc_request_iomux(MX51_PIN_NANDF_RB2, IOMUX_CONFIG_ALT1);
128 mxc_iomux_set_pad(MX51_PIN_NANDF_RB2, 0x2180);
129
130 /* FEC RX_CLK */
131 mxc_request_iomux(MX51_PIN_NANDF_RB3, IOMUX_CONFIG_ALT1);
132 mxc_iomux_set_pad(MX51_PIN_NANDF_RB3, 0x2180);
133
134 /* FEC RX_CRS */
135 mxc_request_iomux(MX51_PIN_EIM_CS5, IOMUX_CONFIG_ALT3);
136 mxc_iomux_set_pad(MX51_PIN_EIM_CS5, 0x180);
137
138 /* FEC RX_ER */
139 mxc_request_iomux(MX51_PIN_EIM_CS4, IOMUX_CONFIG_ALT3);
140 mxc_iomux_set_pad(MX51_PIN_EIM_CS4, 0x180);
141
142 /* FEC RX_DV */
143 mxc_request_iomux(MX51_PIN_NANDF_D11, IOMUX_CONFIG_ALT2);
144 mxc_iomux_set_pad(MX51_PIN_NANDF_D11, 0x2180);
145}
146
Stefano Babicb4377e12010-03-16 17:22:21 +0100147#ifdef CONFIG_MXC_SPI
148static void setup_iomux_spi(void)
149{
150 /* 000: Select mux mode: ALT0 mux port: MOSI of instance: ecspi1 */
151 mxc_request_iomux(MX51_PIN_CSPI1_MOSI, IOMUX_CONFIG_ALT0);
152 mxc_iomux_set_pad(MX51_PIN_CSPI1_MOSI, 0x105);
153
154 /* 000: Select mux mode: ALT0 mux port: MISO of instance: ecspi1. */
155 mxc_request_iomux(MX51_PIN_CSPI1_MISO, IOMUX_CONFIG_ALT0);
156 mxc_iomux_set_pad(MX51_PIN_CSPI1_MISO, 0x105);
157
158 /* de-select SS1 of instance: ecspi1. */
159 mxc_request_iomux(MX51_PIN_CSPI1_SS1, IOMUX_CONFIG_ALT3);
160 mxc_iomux_set_pad(MX51_PIN_CSPI1_SS1, 0x85);
161
162 /* 000: Select mux mode: ALT0 mux port: SS0 ecspi1 */
163 mxc_request_iomux(MX51_PIN_CSPI1_SS0, IOMUX_CONFIG_ALT0);
164 mxc_iomux_set_pad(MX51_PIN_CSPI1_SS0, 0x185);
165
166 /* 000: Select mux mode: ALT0 mux port: RDY of instance: ecspi1. */
167 mxc_request_iomux(MX51_PIN_CSPI1_RDY, IOMUX_CONFIG_ALT0);
168 mxc_iomux_set_pad(MX51_PIN_CSPI1_RDY, 0x180);
169
170 /* 000: Select mux mode: ALT0 mux port: SCLK of instance: ecspi1. */
171 mxc_request_iomux(MX51_PIN_CSPI1_SCLK, IOMUX_CONFIG_ALT0);
172 mxc_iomux_set_pad(MX51_PIN_CSPI1_SCLK, 0x105);
173}
174#endif
175
Wolfgang Grandegger055d9692011-11-11 14:03:38 +0100176#ifdef CONFIG_USB_EHCI_MX5
177#define MX51EVK_USBH1_HUB_RST IOMUX_TO_GPIO(MX51_PIN_GPIO1_7) /* GPIO1_7 */
178#define MX51EVK_USBH1_STP IOMUX_TO_GPIO(MX51_PIN_USBH1_STP) /* GPIO1_27 */
179#define MX51EVK_USB_CLK_EN_B IOMUX_TO_GPIO(MX51_PIN_EIM_D18) /* GPIO2_1 */
180#define MX51EVK_USB_PHY_RESET IOMUX_TO_GPIO(MX51_PIN_EIM_D21) /* GPIO2_5 */
181
182#define USBH1_PAD (PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | \
183 PAD_CTL_100K_PU | PAD_CTL_PUE_PULL | \
184 PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE)
185#define GPIO_PAD (PAD_CTL_DRV_HIGH | PAD_CTL_PKE_ENABLE | \
186 PAD_CTL_SRE_FAST)
187#define NO_PAD (1 << 16)
188
189static void setup_usb_h1(void)
190{
191 setup_iomux_usb_h1();
192
193 /* GPIO_1_7 for USBH1 hub reset */
194 mxc_request_iomux(MX51_PIN_GPIO1_7, IOMUX_CONFIG_ALT0);
195 mxc_iomux_set_pad(MX51_PIN_GPIO1_7, NO_PAD);
196
197 /* GPIO_2_1 */
198 mxc_request_iomux(MX51_PIN_EIM_D17, IOMUX_CONFIG_ALT1);
199 mxc_iomux_set_pad(MX51_PIN_EIM_D17, GPIO_PAD);
200
201 /* GPIO_2_5 for USB PHY reset */
202 mxc_request_iomux(MX51_PIN_EIM_D21, IOMUX_CONFIG_ALT1);
203 mxc_iomux_set_pad(MX51_PIN_EIM_D21, GPIO_PAD);
204}
205
Anatolij Gustschin60bae5e2011-12-12 01:25:46 +0000206int board_ehci_hcd_init(int port)
Wolfgang Grandegger055d9692011-11-11 14:03:38 +0100207{
208 /* Set USBH1_STP to GPIO and toggle it */
209 mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_GPIO);
210 mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USBH1_PAD);
211
212 gpio_direction_output(MX51EVK_USBH1_STP, 0);
213 gpio_direction_output(MX51EVK_USB_PHY_RESET, 0);
214 mdelay(10);
215 gpio_set_value(MX51EVK_USBH1_STP, 1);
216
217 /* Set back USBH1_STP to be function */
218 mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT0);
219 mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USBH1_PAD);
220
221 /* De-assert USB PHY RESETB */
222 gpio_set_value(MX51EVK_USB_PHY_RESET, 1);
223
224 /* Drive USB_CLK_EN_B line low */
225 gpio_direction_output(MX51EVK_USB_CLK_EN_B, 0);
226
227 /* Reset USB hub */
228 gpio_direction_output(MX51EVK_USBH1_HUB_RST, 0);
229 mdelay(2);
230 gpio_set_value(MX51EVK_USBH1_HUB_RST, 1);
Anatolij Gustschin60bae5e2011-12-12 01:25:46 +0000231 return 0;
Wolfgang Grandegger055d9692011-11-11 14:03:38 +0100232}
233#endif
234
Stefano Babicb4377e12010-03-16 17:22:21 +0100235static void power_init(void)
236{
237 unsigned int val;
Stefano Babicb4377e12010-03-16 17:22:21 +0100238 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
Stefano Babic53572652011-10-08 10:59:20 +0200239 struct pmic *p;
240
241 pmic_init();
242 p = get_pmic();
Stefano Babicb4377e12010-03-16 17:22:21 +0100243
244 /* Write needed to Power Gate 2 register */
Stefano Babic53572652011-10-08 10:59:20 +0200245 pmic_reg_read(p, REG_POWER_MISC, &val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100246 val &= ~PWGT2SPIEN;
Stefano Babic53572652011-10-08 10:59:20 +0200247 pmic_reg_write(p, REG_POWER_MISC, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100248
Shawn Guo888b4f42010-10-27 23:36:04 +0800249 /* Externally powered */
Stefano Babic53572652011-10-08 10:59:20 +0200250 pmic_reg_read(p, REG_CHARGE, &val);
Shawn Guo888b4f42010-10-27 23:36:04 +0800251 val |= ICHRG0 | ICHRG1 | ICHRG2 | ICHRG3 | CHGAUTOB;
Stefano Babic53572652011-10-08 10:59:20 +0200252 pmic_reg_write(p, REG_CHARGE, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100253
254 /* power up the system first */
Stefano Babic53572652011-10-08 10:59:20 +0200255 pmic_reg_write(p, REG_POWER_MISC, PWUP);
Stefano Babicb4377e12010-03-16 17:22:21 +0100256
257 /* Set core voltage to 1.1V */
Stefano Babic53572652011-10-08 10:59:20 +0200258 pmic_reg_read(p, REG_SW_0, &val);
Marek Vasutc4a3c742011-01-19 04:40:36 +0000259 val = (val & ~SWx_VOLT_MASK) | SWx_1_100V;
Stefano Babic53572652011-10-08 10:59:20 +0200260 pmic_reg_write(p, REG_SW_0, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100261
262 /* Setup VCC (SW2) to 1.25 */
Stefano Babic53572652011-10-08 10:59:20 +0200263 pmic_reg_read(p, REG_SW_1, &val);
Marek Vasutc4a3c742011-01-19 04:40:36 +0000264 val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
Stefano Babic53572652011-10-08 10:59:20 +0200265 pmic_reg_write(p, REG_SW_1, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100266
267 /* Setup 1V2_DIG1 (SW3) to 1.25 */
Stefano Babic53572652011-10-08 10:59:20 +0200268 pmic_reg_read(p, REG_SW_2, &val);
Marek Vasutc4a3c742011-01-19 04:40:36 +0000269 val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
Stefano Babic53572652011-10-08 10:59:20 +0200270 pmic_reg_write(p, REG_SW_2, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100271 udelay(50);
272
273 /* Raise the core frequency to 800MHz */
274 writel(0x0, &mxc_ccm->cacrr);
275
276 /* Set switchers in Auto in NORMAL mode & STANDBY mode */
277 /* Setup the switcher mode for SW1 & SW2*/
Stefano Babic53572652011-10-08 10:59:20 +0200278 pmic_reg_read(p, REG_SW_4, &val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100279 val = (val & ~((SWMODE_MASK << SWMODE1_SHIFT) |
280 (SWMODE_MASK << SWMODE2_SHIFT)));
281 val |= (SWMODE_AUTO_AUTO << SWMODE1_SHIFT) |
282 (SWMODE_AUTO_AUTO << SWMODE2_SHIFT);
Stefano Babic53572652011-10-08 10:59:20 +0200283 pmic_reg_write(p, REG_SW_4, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100284
285 /* Setup the switcher mode for SW3 & SW4 */
Stefano Babic53572652011-10-08 10:59:20 +0200286 pmic_reg_read(p, REG_SW_5, &val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100287 val = (val & ~((SWMODE_MASK << SWMODE3_SHIFT) |
288 (SWMODE_MASK << SWMODE4_SHIFT)));
289 val |= (SWMODE_AUTO_AUTO << SWMODE3_SHIFT) |
290 (SWMODE_AUTO_AUTO << SWMODE4_SHIFT);
Stefano Babic53572652011-10-08 10:59:20 +0200291 pmic_reg_write(p, REG_SW_5, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100292
293 /* Set VDIG to 1.65V, VGEN3 to 1.8V, VCAM to 2.6V */
Stefano Babic53572652011-10-08 10:59:20 +0200294 pmic_reg_read(p, REG_SETTING_0, &val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100295 val &= ~(VCAM_MASK | VGEN3_MASK | VDIG_MASK);
296 val |= VDIG_1_65 | VGEN3_1_8 | VCAM_2_6;
Stefano Babic53572652011-10-08 10:59:20 +0200297 pmic_reg_write(p, REG_SETTING_0, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100298
299 /* Set VVIDEO to 2.775V, VAUDIO to 3V, VSD to 3.15V */
Stefano Babic53572652011-10-08 10:59:20 +0200300 pmic_reg_read(p, REG_SETTING_1, &val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100301 val &= ~(VVIDEO_MASK | VSD_MASK | VAUDIO_MASK);
302 val |= VSD_3_15 | VAUDIO_3_0 | VVIDEO_2_775;
Stefano Babic53572652011-10-08 10:59:20 +0200303 pmic_reg_write(p, REG_SETTING_1, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100304
305 /* Configure VGEN3 and VCAM regulators to use external PNP */
306 val = VGEN3CONFIG | VCAMCONFIG;
Stefano Babic53572652011-10-08 10:59:20 +0200307 pmic_reg_write(p, REG_MODE_1, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100308 udelay(200);
309
Stefano Babicb4377e12010-03-16 17:22:21 +0100310 /* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
311 val = VGEN3EN | VGEN3CONFIG | VCAMEN | VCAMCONFIG |
312 VVIDEOEN | VAUDIOEN | VSDEN;
Stefano Babic53572652011-10-08 10:59:20 +0200313 pmic_reg_write(p, REG_MODE_1, val);
Stefano Babicb4377e12010-03-16 17:22:21 +0100314
Fabio Estevamd736ebe2011-10-25 03:14:00 +0000315 mxc_request_iomux(MX51_PIN_EIM_A20, IOMUX_CONFIG_ALT1);
316 gpio_direction_output(46, 0);
317
Stefano Babicb4377e12010-03-16 17:22:21 +0100318 udelay(500);
319
Stefano Babic753fc2e2011-08-21 23:29:52 +0200320 gpio_set_value(46, 1);
Stefano Babicb4377e12010-03-16 17:22:21 +0100321}
322
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100323#ifdef CONFIG_FSL_ESDHC
Thierry Reding314284b2012-01-02 01:15:36 +0000324int board_mmc_getcd(struct mmc *mmc)
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100325{
326 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
Thierry Reding314284b2012-01-02 01:15:36 +0000327 int ret;
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100328
Fabio Estevam58aef722011-11-15 05:51:33 +0000329 mxc_request_iomux(MX51_PIN_GPIO1_0, IOMUX_CONFIG_ALT1);
Fabio Estevamed9d2162012-02-08 02:34:45 +0000330 gpio_direction_input(0);
Fabio Estevam58aef722011-11-15 05:51:33 +0000331 mxc_request_iomux(MX51_PIN_GPIO1_6, IOMUX_CONFIG_ALT0);
Fabio Estevamed9d2162012-02-08 02:34:45 +0000332 gpio_direction_input(6);
Fabio Estevam58aef722011-11-15 05:51:33 +0000333
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100334 if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
Thierry Reding314284b2012-01-02 01:15:36 +0000335 ret = !gpio_get_value(0);
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100336 else
Thierry Reding314284b2012-01-02 01:15:36 +0000337 ret = !gpio_get_value(6);
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100338
Thierry Reding314284b2012-01-02 01:15:36 +0000339 return ret;
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100340}
341
342int board_mmc_init(bd_t *bis)
343{
344 u32 index;
345 s32 status = 0;
346
347 for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM;
348 index++) {
349 switch (index) {
350 case 0:
351 mxc_request_iomux(MX51_PIN_SD1_CMD,
352 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
353 mxc_request_iomux(MX51_PIN_SD1_CLK,
354 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
355 mxc_request_iomux(MX51_PIN_SD1_DATA0,
356 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
357 mxc_request_iomux(MX51_PIN_SD1_DATA1,
358 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
359 mxc_request_iomux(MX51_PIN_SD1_DATA2,
360 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
361 mxc_request_iomux(MX51_PIN_SD1_DATA3,
362 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
363 mxc_iomux_set_pad(MX51_PIN_SD1_CMD,
364 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
365 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
366 PAD_CTL_PUE_PULL |
367 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
368 mxc_iomux_set_pad(MX51_PIN_SD1_CLK,
369 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
370 PAD_CTL_HYS_NONE | PAD_CTL_47K_PU |
371 PAD_CTL_PUE_PULL |
372 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
373 mxc_iomux_set_pad(MX51_PIN_SD1_DATA0,
374 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
375 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
376 PAD_CTL_PUE_PULL |
377 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
378 mxc_iomux_set_pad(MX51_PIN_SD1_DATA1,
379 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
380 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
381 PAD_CTL_PUE_PULL |
382 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
383 mxc_iomux_set_pad(MX51_PIN_SD1_DATA2,
384 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
385 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
386 PAD_CTL_PUE_PULL |
387 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
388 mxc_iomux_set_pad(MX51_PIN_SD1_DATA3,
389 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
390 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PD |
391 PAD_CTL_PUE_PULL |
392 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
393 mxc_request_iomux(MX51_PIN_GPIO1_0,
394 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
395 mxc_iomux_set_pad(MX51_PIN_GPIO1_0,
396 PAD_CTL_HYS_ENABLE);
397 mxc_request_iomux(MX51_PIN_GPIO1_1,
398 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
399 mxc_iomux_set_pad(MX51_PIN_GPIO1_1,
400 PAD_CTL_HYS_ENABLE);
401 break;
402 case 1:
403 mxc_request_iomux(MX51_PIN_SD2_CMD,
404 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
405 mxc_request_iomux(MX51_PIN_SD2_CLK,
406 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
407 mxc_request_iomux(MX51_PIN_SD2_DATA0,
408 IOMUX_CONFIG_ALT0);
409 mxc_request_iomux(MX51_PIN_SD2_DATA1,
410 IOMUX_CONFIG_ALT0);
411 mxc_request_iomux(MX51_PIN_SD2_DATA2,
412 IOMUX_CONFIG_ALT0);
413 mxc_request_iomux(MX51_PIN_SD2_DATA3,
414 IOMUX_CONFIG_ALT0);
415 mxc_iomux_set_pad(MX51_PIN_SD2_CMD,
416 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU |
417 PAD_CTL_SRE_FAST);
418 mxc_iomux_set_pad(MX51_PIN_SD2_CLK,
419 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU |
420 PAD_CTL_SRE_FAST);
421 mxc_iomux_set_pad(MX51_PIN_SD2_DATA0,
422 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU |
423 PAD_CTL_SRE_FAST);
424 mxc_iomux_set_pad(MX51_PIN_SD2_DATA1,
425 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU |
426 PAD_CTL_SRE_FAST);
427 mxc_iomux_set_pad(MX51_PIN_SD2_DATA2,
428 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU |
429 PAD_CTL_SRE_FAST);
430 mxc_iomux_set_pad(MX51_PIN_SD2_DATA3,
431 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU |
432 PAD_CTL_SRE_FAST);
433 mxc_request_iomux(MX51_PIN_SD2_CMD,
434 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
435 mxc_request_iomux(MX51_PIN_GPIO1_6,
436 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
437 mxc_iomux_set_pad(MX51_PIN_GPIO1_6,
438 PAD_CTL_HYS_ENABLE);
439 mxc_request_iomux(MX51_PIN_GPIO1_5,
440 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
441 mxc_iomux_set_pad(MX51_PIN_GPIO1_5,
442 PAD_CTL_HYS_ENABLE);
443 break;
444 default:
445 printf("Warning: you configured more ESDHC controller"
446 "(%d) as supported by the board(2)\n",
447 CONFIG_SYS_FSL_ESDHC_NUM);
448 return status;
449 }
450 status |= fsl_esdhc_initialize(bis, &esdhc_cfg[index]);
451 }
452 return status;
453}
454#endif
455
Liu Hui-R64343877eb0f2010-12-23 01:13:17 +0000456int board_early_init_f(void)
457{
458 setup_iomux_uart();
459 setup_iomux_fec();
Wolfgang Grandegger055d9692011-11-11 14:03:38 +0100460#ifdef CONFIG_USB_EHCI_MX5
461 setup_usb_h1();
462#endif
Liu Hui-R64343877eb0f2010-12-23 01:13:17 +0000463
464 return 0;
465}
466
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100467int board_init(void)
468{
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100469 /* address of boot parameters */
470 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
471
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100472 return 0;
473}
474
Helmut Raiger9660e442011-10-20 04:19:47 +0000475#ifdef CONFIG_BOARD_LATE_INIT
Stefano Babicb4377e12010-03-16 17:22:21 +0100476int board_late_init(void)
477{
478#ifdef CONFIG_MXC_SPI
479 setup_iomux_spi();
480 power_init();
481#endif
482 return 0;
483}
484#endif
485
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100486int checkboard(void)
487{
Jason Liu51958902011-04-22 02:55:42 +0000488 puts("Board: MX51EVK\n");
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100489
Stefano Babicc5fb70c2010-02-05 15:13:58 +0100490 return 0;
491}