3 * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
5 * (C) Copyright 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,
28 #include <asm/arch/imx-regs.h>
29 #include <asm/arch/mx5x_pins.h>
30 #include <asm/arch/crm_regs.h>
31 #include <asm/arch/iomux.h>
33 #include <asm/arch/sys_proto.h>
37 #include <fsl_esdhc.h>
42 #include <ipu_pixfmt.h>
44 DECLARE_GLOBAL_DATA_PTR;
46 static struct fb_videomode nec_nl6448bc26_09c = {
51 37650, /* pixclock = 26.56Mhz */
53 16, /* right margin */
54 31, /* upper margin */
55 12, /* lower margin */
59 FB_VMODE_NONINTERLACED, /* vmode */
63 #ifdef CONFIG_HW_WATCHDOG
65 void hw_watchdog_reset(void)
69 /* toggle watchdog trigger pin */
70 val = gpio_get_value(66);
72 gpio_set_value(66, val);
76 static void init_drive_strength(void)
78 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEDDR, PAD_CTL_DDR_INPUT_CMOS);
79 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEADDR, PAD_CTL_PKE_ENABLE);
80 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRAPKS, PAD_CTL_PUE_KEEPER);
81 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRAPUS, PAD_CTL_100K_PU);
82 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_A1, PAD_CTL_SRE_FAST);
83 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_A0, PAD_CTL_DRV_HIGH);
84 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_A1, PAD_CTL_DRV_HIGH);
85 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_RAS,
86 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
87 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CAS,
88 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
89 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEDDR, PAD_CTL_PKE_ENABLE);
90 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRPKS, PAD_CTL_PUE_KEEPER);
91 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR0, PAD_CTL_HYS_NONE);
92 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR1, PAD_CTL_HYS_NONE);
93 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR2, PAD_CTL_HYS_NONE);
94 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR3, PAD_CTL_HYS_NONE);
95 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B0, PAD_CTL_SRE_FAST);
96 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B1, PAD_CTL_SRE_FAST);
97 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B2, PAD_CTL_SRE_FAST);
98 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B4, PAD_CTL_SRE_FAST);
99 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRPUS, PAD_CTL_100K_PU);
100 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_INMODE1, PAD_CTL_DDR_INPUT_CMOS);
101 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B0, PAD_CTL_DRV_MEDIUM);
102 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B1, PAD_CTL_DRV_MEDIUM);
103 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B2, PAD_CTL_DRV_MEDIUM);
104 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B4, PAD_CTL_DRV_MEDIUM);
106 /* Setting pad options */
107 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDWE,
108 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
109 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
110 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCKE0,
111 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
112 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
113 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCKE1,
114 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
115 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
116 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCLK,
117 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
118 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
119 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS0,
120 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
121 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
122 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS1,
123 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
124 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
125 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS2,
126 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
127 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
128 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS3,
129 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
130 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
131 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CS0,
132 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
133 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
134 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CS1,
135 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
136 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
137 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_DQM0,
138 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
139 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
140 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_DQM1,
141 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
142 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
143 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_DQM2,
144 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
145 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
146 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_DQM3,
147 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
148 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
153 gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1,
159 static void setup_weim(void)
161 struct weim *pweim = (struct weim *)WEIM_BASE_ADDR;
163 pweim->cs0gcr1 = 0x004100b9;
164 pweim->cs0gcr2 = 0x00000001;
165 pweim->cs0rcr1 = 0x0a018000;
167 pweim->cs0wcr1 = 0x0704a240;
170 static void setup_uart(void)
172 unsigned int pad = PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
173 PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST;
174 /* console RX on Pin EIM_D25 */
175 mxc_request_iomux(MX51_PIN_EIM_D25, IOMUX_CONFIG_ALT3);
176 mxc_iomux_set_pad(MX51_PIN_EIM_D25, pad);
177 /* console TX on Pin EIM_D26 */
178 mxc_request_iomux(MX51_PIN_EIM_D26, IOMUX_CONFIG_ALT3);
179 mxc_iomux_set_pad(MX51_PIN_EIM_D26, pad);
182 #ifdef CONFIG_MXC_SPI
183 void spi_io_init(void)
185 /* 000: Select mux mode: ALT0 mux port: MOSI of instance: ecspi1 */
186 mxc_request_iomux(MX51_PIN_CSPI1_MOSI, IOMUX_CONFIG_ALT0);
187 mxc_iomux_set_pad(MX51_PIN_CSPI1_MOSI,
188 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
190 /* 000: Select mux mode: ALT0 mux port: MISO of instance: ecspi1. */
191 mxc_request_iomux(MX51_PIN_CSPI1_MISO, IOMUX_CONFIG_ALT0);
192 mxc_iomux_set_pad(MX51_PIN_CSPI1_MISO,
193 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
195 /* 000: Select mux mode: ALT0 mux port: SS0 of instance: ecspi1. */
196 mxc_request_iomux(MX51_PIN_CSPI1_SS0, IOMUX_CONFIG_ALT0);
197 mxc_iomux_set_pad(MX51_PIN_CSPI1_SS0,
198 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
199 PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
202 * SS1 will be used as GPIO because of uninterrupted
203 * long SPI transmissions (GPIO4_25)
205 mxc_request_iomux(MX51_PIN_CSPI1_SS1, IOMUX_CONFIG_ALT3);
206 mxc_iomux_set_pad(MX51_PIN_CSPI1_SS1,
207 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
208 PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
210 /* 000: Select mux mode: ALT0 mux port: SS2 of instance: ecspi1. */
211 mxc_request_iomux(MX51_PIN_DI1_PIN11, IOMUX_CONFIG_ALT7);
212 mxc_iomux_set_pad(MX51_PIN_DI1_PIN11,
213 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
214 PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
216 /* 000: Select mux mode: ALT0 mux port: SCLK of instance: ecspi1. */
217 mxc_request_iomux(MX51_PIN_CSPI1_SCLK, IOMUX_CONFIG_ALT0);
218 mxc_iomux_set_pad(MX51_PIN_CSPI1_SCLK,
219 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
222 static void reset_peripherals(int reset)
226 /* reset_n is on NANDF_D15 */
227 gpio_direction_output(89, 0);
229 #ifdef CONFIG_VISION2_HW_1_0
231 * set FEC Configuration lines
232 * set levels of FEC config lines
234 gpio_direction_output(75, 0);
235 gpio_direction_output(74, 1);
236 gpio_direction_output(95, 1);
238 /* set direction of FEC config lines */
239 gpio_direction_output(59, 0);
240 gpio_direction_output(60, 0);
241 gpio_direction_output(61, 0);
242 gpio_direction_output(55, 1);
244 /* FEC_RXD1 - sel GPIO (2-23) for configuration -> 1 */
245 mxc_request_iomux(MX51_PIN_EIM_EB3, IOMUX_CONFIG_ALT1);
246 /* FEC_RXD2 - sel GPIO (2-27) for configuration -> 0 */
247 mxc_request_iomux(MX51_PIN_EIM_CS2, IOMUX_CONFIG_ALT1);
248 /* FEC_RXD3 - sel GPIO (2-28) for configuration -> 0 */
249 mxc_request_iomux(MX51_PIN_EIM_CS3, IOMUX_CONFIG_ALT1);
250 /* FEC_RXER - sel GPIO (2-29) for configuration -> 0 */
251 mxc_request_iomux(MX51_PIN_EIM_CS4, IOMUX_CONFIG_ALT1);
252 /* FEC_COL - sel GPIO (3-10) for configuration -> 1 */
253 mxc_request_iomux(MX51_PIN_NANDF_RB2, IOMUX_CONFIG_ALT3);
254 /* FEC_RCLK - sel GPIO (3-11) for configuration -> 0 */
255 mxc_request_iomux(MX51_PIN_NANDF_RB3, IOMUX_CONFIG_ALT3);
256 /* FEC_RXD0 - sel GPIO (3-31) for configuration -> 1 */
257 mxc_request_iomux(MX51_PIN_NANDF_D9, IOMUX_CONFIG_ALT3);
261 * activate reset_n pin
262 * Select mux mode: ALT3 mux port: NAND D15
264 mxc_request_iomux(MX51_PIN_NANDF_D15, IOMUX_CONFIG_ALT3);
265 mxc_iomux_set_pad(MX51_PIN_NANDF_D15,
266 PAD_CTL_DRV_VOT_HIGH | PAD_CTL_DRV_MAX);
268 /* set FEC Control lines */
269 gpio_direction_input(89);
272 #ifdef CONFIG_VISION2_HW_1_0
274 mxc_request_iomux(MX51_PIN_EIM_CS3, IOMUX_CONFIG_ALT3);
275 mxc_iomux_set_pad(MX51_PIN_EIM_CS3, 0x180);
278 mxc_request_iomux(MX51_PIN_EIM_CS2, IOMUX_CONFIG_ALT3);
279 mxc_iomux_set_pad(MX51_PIN_EIM_CS2, 0x180);
282 mxc_request_iomux(MX51_PIN_EIM_EB3, IOMUX_CONFIG_ALT3);
283 mxc_iomux_set_pad(MX51_PIN_EIM_EB3, 0x180);
286 mxc_request_iomux(MX51_PIN_NANDF_D9, IOMUX_CONFIG_ALT2);
287 mxc_iomux_set_pad(MX51_PIN_NANDF_D9, 0x2180);
290 mxc_request_iomux(MX51_PIN_NANDF_RB3, IOMUX_CONFIG_ALT1);
291 mxc_iomux_set_pad(MX51_PIN_NANDF_RB3, 0x2180);
294 mxc_request_iomux(MX51_PIN_EIM_CS4, IOMUX_CONFIG_ALT3);
295 mxc_iomux_set_pad(MX51_PIN_EIM_CS4, 0x180);
298 mxc_request_iomux(MX51_PIN_NANDF_RB2, IOMUX_CONFIG_ALT1);
299 mxc_iomux_set_pad(MX51_PIN_NANDF_RB2, 0x2180);
304 static void power_init_mx51(void)
312 /* Write needed to Power Gate 2 register */
313 pmic_reg_read(p, REG_POWER_MISC, &val);
315 /* enable VCAM with 2.775V to enable read from PMIC */
316 val = VCAMCONFIG | VCAMEN;
317 pmic_reg_write(p, REG_MODE_1, val);
320 * Set switchers in Auto in NORMAL mode & STANDBY mode
321 * Setup the switcher mode for SW1 & SW2
323 pmic_reg_read(p, REG_SW_4, &val);
324 val = (val & ~((SWMODE_MASK << SWMODE1_SHIFT) |
325 (SWMODE_MASK << SWMODE2_SHIFT)));
326 val |= (SWMODE_AUTO_AUTO << SWMODE1_SHIFT) |
327 (SWMODE_AUTO_AUTO << SWMODE2_SHIFT);
328 pmic_reg_write(p, REG_SW_4, val);
330 /* Setup the switcher mode for SW3 & SW4 */
331 pmic_reg_read(p, REG_SW_5, &val);
332 val &= ~((SWMODE_MASK << SWMODE4_SHIFT) |
333 (SWMODE_MASK << SWMODE3_SHIFT));
334 val |= (SWMODE_AUTO_AUTO << SWMODE4_SHIFT) |
335 (SWMODE_AUTO_AUTO << SWMODE3_SHIFT);
336 pmic_reg_write(p, REG_SW_5, val);
339 /* Set VGEN3 to 1.8V, VCAM to 3.0V */
340 pmic_reg_read(p, REG_SETTING_0, &val);
341 val &= ~(VCAM_MASK | VGEN3_MASK);
343 pmic_reg_write(p, REG_SETTING_0, val);
345 /* Set VVIDEO to 2.775V, VAUDIO to 3V0, VSD to 1.8V */
346 pmic_reg_read(p, REG_SETTING_1, &val);
347 val &= ~(VVIDEO_MASK | VSD_MASK | VAUDIO_MASK);
348 val |= VVIDEO_2_775 | VAUDIO_3_0 | VSD_1_8;
349 pmic_reg_write(p, REG_SETTING_1, val);
351 /* Configure VGEN3 and VCAM regulators to use external PNP */
352 val = VGEN3CONFIG | VCAMCONFIG;
353 pmic_reg_write(p, REG_MODE_1, val);
356 /* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
357 val = VGEN3EN | VGEN3CONFIG | VCAMEN | VCAMCONFIG |
358 VVIDEOEN | VAUDIOEN | VSDEN;
359 pmic_reg_write(p, REG_MODE_1, val);
361 pmic_reg_read(p, REG_POWER_CTL2, &val);
363 pmic_reg_write(p, REG_POWER_CTL2, val);
370 static void setup_gpios(void)
374 /* CAM_SUP_DISn, GPIO1_7 */
375 mxc_request_iomux(MX51_PIN_GPIO1_7, IOMUX_CONFIG_ALT0);
376 mxc_iomux_set_pad(MX51_PIN_GPIO1_7, 0x82);
378 /* DAB Display EN, GPIO3_1 */
379 mxc_request_iomux(MX51_PIN_DI1_PIN12, IOMUX_CONFIG_ALT4);
380 mxc_iomux_set_pad(MX51_PIN_DI1_PIN12, 0x82);
382 /* WDOG_TRIGGER, GPIO3_2 */
383 mxc_request_iomux(MX51_PIN_DI1_PIN13, IOMUX_CONFIG_ALT4);
384 mxc_iomux_set_pad(MX51_PIN_DI1_PIN13, 0x82);
386 /* Now we need to trigger the watchdog */
389 /* Display2 TxEN, GPIO3_3 */
390 mxc_request_iomux(MX51_PIN_DI1_D0_CS, IOMUX_CONFIG_ALT4);
391 mxc_iomux_set_pad(MX51_PIN_DI1_D0_CS, 0x82);
393 /* DAB Light EN, GPIO3_4 */
394 mxc_request_iomux(MX51_PIN_DI1_D1_CS, IOMUX_CONFIG_ALT4);
395 mxc_iomux_set_pad(MX51_PIN_DI1_D1_CS, 0x82);
397 /* AUDIO_MUTE, GPIO3_5 */
398 mxc_request_iomux(MX51_PIN_DISPB2_SER_DIN, IOMUX_CONFIG_ALT4);
399 mxc_iomux_set_pad(MX51_PIN_DISPB2_SER_DIN, 0x82);
401 /* SPARE_OUT, GPIO3_6 */
402 mxc_request_iomux(MX51_PIN_DISPB2_SER_DIO, IOMUX_CONFIG_ALT4);
403 mxc_iomux_set_pad(MX51_PIN_DISPB2_SER_DIO, 0x82);
405 /* BEEPER_EN, GPIO3_26 */
406 mxc_request_iomux(MX51_PIN_NANDF_D14, IOMUX_CONFIG_ALT3);
407 mxc_iomux_set_pad(MX51_PIN_NANDF_D14, 0x82);
409 /* POWER_OFF, GPIO3_27 */
410 mxc_request_iomux(MX51_PIN_NANDF_D13, IOMUX_CONFIG_ALT3);
411 mxc_iomux_set_pad(MX51_PIN_NANDF_D13, 0x82);
413 /* FRAM_WE, GPIO3_30 */
414 mxc_request_iomux(MX51_PIN_NANDF_D10, IOMUX_CONFIG_ALT3);
415 mxc_iomux_set_pad(MX51_PIN_NANDF_D10, 0x82);
417 /* EXPANSION_EN, GPIO4_26 */
418 mxc_request_iomux(MX51_PIN_CSPI1_RDY, IOMUX_CONFIG_ALT3);
419 mxc_iomux_set_pad(MX51_PIN_CSPI1_RDY, 0x82);
421 /* PWM Output GPIO1_2 */
422 mxc_request_iomux(MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT1);
425 * Set GPIO1_4 to high and output; it is used to reset
426 * the system on reboot
428 gpio_direction_output(4, 1);
430 gpio_direction_output(7, 0);
431 for (i = 65; i < 71; i++) {
432 gpio_direction_output(i, 0);
435 gpio_direction_output(94, 0);
437 /* Set POWER_OFF high */
438 gpio_direction_output(91, 1);
440 gpio_direction_output(90, 0);
442 gpio_direction_output(122, 0);
444 gpio_direction_output(121, 1);
449 static void setup_fec(void)
452 mxc_request_iomux(MX51_PIN_EIM_EB2, IOMUX_CONFIG_ALT3);
453 mxc_iomux_set_pad(MX51_PIN_EIM_EB2, 0x1FD);
456 mxc_request_iomux(MX51_PIN_NANDF_CS3, IOMUX_CONFIG_ALT2);
457 mxc_iomux_set_pad(MX51_PIN_NANDF_CS3, 0x2004);
460 mxc_request_iomux(MX51_PIN_EIM_CS3, IOMUX_CONFIG_ALT3);
461 mxc_iomux_set_pad(MX51_PIN_EIM_CS3, 0x180);
464 mxc_request_iomux(MX51_PIN_EIM_CS2, IOMUX_CONFIG_ALT3);
465 mxc_iomux_set_pad(MX51_PIN_EIM_CS2, 0x180);
468 mxc_request_iomux(MX51_PIN_EIM_EB3, IOMUX_CONFIG_ALT3);
469 mxc_iomux_set_pad(MX51_PIN_EIM_EB3, 0x180);
472 mxc_request_iomux(MX51_PIN_NANDF_D9, IOMUX_CONFIG_ALT2);
473 mxc_iomux_set_pad(MX51_PIN_NANDF_D9, 0x2180);
476 mxc_request_iomux(MX51_PIN_NANDF_CS6, IOMUX_CONFIG_ALT2);
477 mxc_iomux_set_pad(MX51_PIN_NANDF_CS6, 0x2004);
480 mxc_request_iomux(MX51_PIN_NANDF_CS5, IOMUX_CONFIG_ALT2);
481 mxc_iomux_set_pad(MX51_PIN_NANDF_CS5, 0x2004);
484 mxc_request_iomux(MX51_PIN_NANDF_CS4, IOMUX_CONFIG_ALT2);
485 mxc_iomux_set_pad(MX51_PIN_NANDF_CS4, 0x2004);
488 mxc_request_iomux(MX51_PIN_NANDF_D8, IOMUX_CONFIG_ALT2);
489 mxc_iomux_set_pad(MX51_PIN_NANDF_D8, 0x2004);
492 mxc_request_iomux(MX51_PIN_NANDF_CS7, IOMUX_CONFIG_ALT1);
493 mxc_iomux_set_pad(MX51_PIN_NANDF_CS7, 0x2004);
496 mxc_request_iomux(MX51_PIN_NANDF_CS2, IOMUX_CONFIG_ALT2);
497 mxc_iomux_set_pad(MX51_PIN_NANDF_CS2, 0x2004);
500 mxc_request_iomux(MX51_PIN_NANDF_RDY_INT, IOMUX_CONFIG_ALT1);
501 mxc_iomux_set_pad(MX51_PIN_NANDF_RDY_INT, 0x2180);
504 mxc_request_iomux(MX51_PIN_NANDF_RB2, IOMUX_CONFIG_ALT1);
505 mxc_iomux_set_pad(MX51_PIN_NANDF_RB2, 0x2180);
508 mxc_request_iomux(MX51_PIN_NANDF_RB3, IOMUX_CONFIG_ALT1);
509 mxc_iomux_set_pad(MX51_PIN_NANDF_RB3, 0x2180);
512 mxc_request_iomux(MX51_PIN_EIM_CS5, IOMUX_CONFIG_ALT3);
513 mxc_iomux_set_pad(MX51_PIN_EIM_CS5, 0x180);
516 mxc_request_iomux(MX51_PIN_EIM_CS4, IOMUX_CONFIG_ALT3);
517 mxc_iomux_set_pad(MX51_PIN_EIM_CS4, 0x180);
520 mxc_request_iomux(MX51_PIN_NANDF_D11, IOMUX_CONFIG_ALT2);
521 mxc_iomux_set_pad(MX51_PIN_NANDF_D11, 0x2180);
524 struct fsl_esdhc_cfg esdhc_cfg[1] = {
525 {MMC_SDHC1_BASE_ADDR, 1},
528 int get_mmc_getcd(u8 *cd, struct mmc *mmc)
530 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
532 if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
533 *cd = gpio_get_value(0);
540 #ifdef CONFIG_FSL_ESDHC
541 int board_mmc_init(bd_t *bis)
543 mxc_request_iomux(MX51_PIN_SD1_CMD,
544 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
545 mxc_request_iomux(MX51_PIN_SD1_CLK,
546 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
547 mxc_request_iomux(MX51_PIN_SD1_DATA0,
548 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
549 mxc_request_iomux(MX51_PIN_SD1_DATA1,
550 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
551 mxc_request_iomux(MX51_PIN_SD1_DATA2,
552 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
553 mxc_request_iomux(MX51_PIN_SD1_DATA3,
554 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
555 mxc_iomux_set_pad(MX51_PIN_SD1_CMD,
556 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
557 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
559 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
560 mxc_iomux_set_pad(MX51_PIN_SD1_CLK,
561 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
562 PAD_CTL_HYS_NONE | PAD_CTL_47K_PU |
564 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
565 mxc_iomux_set_pad(MX51_PIN_SD1_DATA0,
566 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
567 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
569 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
570 mxc_iomux_set_pad(MX51_PIN_SD1_DATA1,
571 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
572 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
574 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
575 mxc_iomux_set_pad(MX51_PIN_SD1_DATA2,
576 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
577 PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU |
579 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
580 mxc_iomux_set_pad(MX51_PIN_SD1_DATA3,
581 PAD_CTL_DRV_MAX | PAD_CTL_DRV_VOT_HIGH |
582 PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PD |
584 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
585 mxc_request_iomux(MX51_PIN_GPIO1_0,
586 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
587 mxc_iomux_set_pad(MX51_PIN_GPIO1_0,
589 mxc_request_iomux(MX51_PIN_GPIO1_1,
590 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
591 mxc_iomux_set_pad(MX51_PIN_GPIO1_1,
594 return fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
598 void lcd_enable(void)
602 mxc_request_iomux(MX51_PIN_DI1_PIN2, IOMUX_CONFIG_ALT0);
603 mxc_request_iomux(MX51_PIN_DI1_PIN3, IOMUX_CONFIG_ALT0);
605 gpio_set_value(2, 1);
606 mxc_request_iomux(MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT0);
608 ret = mx51_fb_init(&nec_nl6448bc26_09c, 0, IPU_PIX_FMT_RGB666);
610 puts("LCD cannot be configured\n");
613 int board_early_init_f(void)
617 init_drive_strength();
619 /* Setup debug led */
620 gpio_direction_output(6, 0);
621 mxc_request_iomux(MX51_PIN_GPIO1_6, IOMUX_CONFIG_ALT0);
622 mxc_iomux_set_pad(MX51_PIN_GPIO1_6, PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST);
624 /* wait a little while to give the pll time to settle */
637 static void backlight(int on)
640 gpio_set_value(65, 1);
642 gpio_set_value(68, 1);
644 gpio_set_value(65, 0);
645 gpio_set_value(68, 0);
651 /* address of boot parameters */
652 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
661 int board_late_init(void)
665 reset_peripherals(1);
667 reset_peripherals(0);
670 /* Early revisions require a second reset */
671 #ifdef CONFIG_VISION2_HW_1_0
672 reset_peripherals(1);
674 reset_peripherals(0);
678 setenv("stdout", "serial");
685 puts("Board: TTControl Vision II CPU V\n");
690 int do_vision_lcd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
695 return cmd_usage(cmdtp);
697 on = (strcmp(argv[1], "on") == 0);
704 lcdbl, CONFIG_SYS_MAXARGS, 1, do_vision_lcd,