blob: b78bf6ccba17d05cec33b6a4a3f278a842965965 [file] [log] [blame]
Marek Vasut92c34832011-01-19 04:40:37 +00001/*
2 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
3 *
4 * (C) Copyright 2009 Freescale Semiconductor, Inc.
5 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 * MA 02111-1307 USA
23 */
24
25#include <common.h>
26#include <asm/io.h>
27#include <asm/arch/imx-regs.h>
28#include <asm/arch/mx5x_pins.h>
29#include <asm/arch/iomux.h>
Stefano Babica3b1edd2011-08-21 10:53:32 +020030#include <asm/gpio.h>
Marek Vasut92c34832011-01-19 04:40:37 +000031#include <asm/errno.h>
32#include <asm/arch/sys_proto.h>
33#include <asm/arch/crm_regs.h>
34#include <i2c.h>
35#include <mmc.h>
36#include <fsl_esdhc.h>
Stefano Babic11bbd712011-10-06 11:44:26 +020037#include <pmic.h>
Marek Vasut92c34832011-01-19 04:40:37 +000038#include <fsl_pmic.h>
39#include <mc13892.h>
40
41DECLARE_GLOBAL_DATA_PTR;
42
43/*
44 * Compile-time error checking
45 */
46#ifndef CONFIG_MXC_SPI
47#error "CONFIG_MXC_SPI not set, this is essential for board's operation!"
48#endif
49
50/*
51 * Shared variables / local defines
52 */
53/* LED */
54#define EFIKAMX_LED_BLUE 0x1
55#define EFIKAMX_LED_GREEN 0x2
56#define EFIKAMX_LED_RED 0x4
57
58void efikamx_toggle_led(uint32_t mask);
59
60/* Board revisions */
61#define EFIKAMX_BOARD_REV_11 0x1
62#define EFIKAMX_BOARD_REV_12 0x2
63#define EFIKAMX_BOARD_REV_13 0x3
64#define EFIKAMX_BOARD_REV_14 0x4
65
Marek Vasut3cc35cc2011-09-25 09:55:43 +000066#define EFIKASB_BOARD_REV_13 0x1
67#define EFIKASB_BOARD_REV_20 0x2
68
Marek Vasut92c34832011-01-19 04:40:37 +000069/*
70 * Board identification
71 */
Marek Vasut3cc35cc2011-09-25 09:55:43 +000072u32 get_efikamx_rev(void)
Marek Vasut92c34832011-01-19 04:40:37 +000073{
74 u32 rev = 0;
75 /*
76 * Retrieve board ID:
77 * rev1.1: 1,1,1
78 * rev1.2: 1,1,0
79 * rev1.3: 1,0,1
80 * rev1.4: 1,0,0
81 */
82 mxc_request_iomux(MX51_PIN_NANDF_CS0, IOMUX_CONFIG_GPIO);
Marek Vasut92c34832011-01-19 04:40:37 +000083 /* set to 1 in order to get correct value on board rev1.1 */
Stefano Babica3b1edd2011-08-21 10:53:32 +020084 gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_NANDF_CS0), 1);
Marek Vasut92c34832011-01-19 04:40:37 +000085
86 mxc_request_iomux(MX51_PIN_NANDF_CS0, IOMUX_CONFIG_GPIO);
87 mxc_iomux_set_pad(MX51_PIN_NANDF_CS0, PAD_CTL_100K_PU);
Stefano Babica3b1edd2011-08-21 10:53:32 +020088 gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_NANDF_CS0));
89 rev |= (!!gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_NANDF_CS0))) << 0;
Marek Vasut92c34832011-01-19 04:40:37 +000090
91 mxc_request_iomux(MX51_PIN_NANDF_CS1, IOMUX_CONFIG_GPIO);
92 mxc_iomux_set_pad(MX51_PIN_NANDF_CS1, PAD_CTL_100K_PU);
Stefano Babica3b1edd2011-08-21 10:53:32 +020093 gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_NANDF_CS1));
94 rev |= (!!gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_NANDF_CS1))) << 1;
Marek Vasut92c34832011-01-19 04:40:37 +000095
96 mxc_request_iomux(MX51_PIN_NANDF_RB3, IOMUX_CONFIG_GPIO);
97 mxc_iomux_set_pad(MX51_PIN_NANDF_RB3, PAD_CTL_100K_PU);
Stefano Babica3b1edd2011-08-21 10:53:32 +020098 gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_NANDF_RB3));
99 rev |= (!!gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_NANDF_RB3))) << 2;
Marek Vasut92c34832011-01-19 04:40:37 +0000100
101 return (~rev & 0x7) + 1;
102}
103
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000104inline u32 get_efikasb_rev(void)
105{
106 u32 rev = 0;
107
108 mxc_request_iomux(MX51_PIN_EIM_CS3, IOMUX_CONFIG_GPIO);
109 mxc_iomux_set_pad(MX51_PIN_EIM_CS3, PAD_CTL_100K_PU);
110 gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_EIM_CS3));
111 rev |= (!!gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_EIM_CS3))) << 0;
112
113 mxc_request_iomux(MX51_PIN_EIM_CS4, IOMUX_CONFIG_GPIO);
114 mxc_iomux_set_pad(MX51_PIN_EIM_CS4, PAD_CTL_100K_PU);
115 gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_EIM_CS4));
116 rev |= (!!gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_EIM_CS4))) << 1;
117
118 return rev;
119}
120
121inline uint32_t get_efika_rev(void)
122{
123 if (machine_is_efikamx())
124 return get_efikamx_rev();
125 else
126 return get_efikasb_rev();
127}
128
Marek Vasut92c34832011-01-19 04:40:37 +0000129u32 get_board_rev(void)
130{
131 return get_cpu_rev() | (get_efika_rev() << 8);
132}
133
134/*
135 * DRAM initialization
136 */
137int dram_init(void)
138{
139 /* dram_init must store complete ramsize in gd->ram_size */
Albert ARIBAUDa9606732011-07-03 05:55:33 +0000140 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
Marek Vasut92c34832011-01-19 04:40:37 +0000141 PHYS_SDRAM_1_SIZE);
142 return 0;
143}
144
145/*
146 * UART configuration
147 */
148static void setup_iomux_uart(void)
149{
150 unsigned int pad = PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
151 PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH;
152
153 mxc_request_iomux(MX51_PIN_UART1_RXD, IOMUX_CONFIG_ALT0);
154 mxc_iomux_set_pad(MX51_PIN_UART1_RXD, pad | PAD_CTL_SRE_FAST);
155 mxc_request_iomux(MX51_PIN_UART1_TXD, IOMUX_CONFIG_ALT0);
156 mxc_iomux_set_pad(MX51_PIN_UART1_TXD, pad | PAD_CTL_SRE_FAST);
157 mxc_request_iomux(MX51_PIN_UART1_RTS, IOMUX_CONFIG_ALT0);
158 mxc_iomux_set_pad(MX51_PIN_UART1_RTS, pad);
159 mxc_request_iomux(MX51_PIN_UART1_CTS, IOMUX_CONFIG_ALT0);
160 mxc_iomux_set_pad(MX51_PIN_UART1_CTS, pad);
161}
162
163/*
164 * SPI configuration
165 */
166#ifdef CONFIG_MXC_SPI
167static void setup_iomux_spi(void)
168{
169 /* 000: Select mux mode: ALT0 mux port: MOSI of instance: ecspi1 */
170 mxc_request_iomux(MX51_PIN_CSPI1_MOSI, IOMUX_CONFIG_ALT0);
171 mxc_iomux_set_pad(MX51_PIN_CSPI1_MOSI,
172 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
173
174 /* 000: Select mux mode: ALT0 mux port: MISO of instance: ecspi1. */
175 mxc_request_iomux(MX51_PIN_CSPI1_MISO, IOMUX_CONFIG_ALT0);
176 mxc_iomux_set_pad(MX51_PIN_CSPI1_MISO,
177 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
178
179 /* Configure SS0 as a GPIO */
180 mxc_request_iomux(MX51_PIN_CSPI1_SS0, IOMUX_CONFIG_GPIO);
Stefano Babica3b1edd2011-08-21 10:53:32 +0200181 gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_CSPI1_SS0), 0);
Marek Vasut92c34832011-01-19 04:40:37 +0000182
183 /* Configure SS1 as a GPIO */
184 mxc_request_iomux(MX51_PIN_CSPI1_SS1, IOMUX_CONFIG_GPIO);
Stefano Babica3b1edd2011-08-21 10:53:32 +0200185 gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_CSPI1_SS1), 1);
Marek Vasut92c34832011-01-19 04:40:37 +0000186
187 /* 000: Select mux mode: ALT0 mux port: SS2 of instance: ecspi1. */
188 mxc_request_iomux(MX51_PIN_CSPI1_RDY, IOMUX_CONFIG_ALT0);
189 mxc_iomux_set_pad(MX51_PIN_CSPI1_RDY,
190 PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE);
191
192 /* 000: Select mux mode: ALT0 mux port: SCLK of instance: ecspi1. */
193 mxc_request_iomux(MX51_PIN_CSPI1_SCLK, IOMUX_CONFIG_ALT0);
194 mxc_iomux_set_pad(MX51_PIN_CSPI1_SCLK,
195 PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
196}
197#else
198static inline void setup_iomux_spi(void) { }
199#endif
200
201/*
202 * PMIC configuration
203 */
204#ifdef CONFIG_MXC_SPI
205static void power_init(void)
206{
207 unsigned int val;
208 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
Stefano Babic11bbd712011-10-06 11:44:26 +0200209 struct pmic *p;
210
211 pmic_init();
212 p = get_pmic();
Marek Vasut92c34832011-01-19 04:40:37 +0000213
214 /* Write needed to Power Gate 2 register */
Stefano Babic11bbd712011-10-06 11:44:26 +0200215 pmic_reg_read(p, REG_POWER_MISC, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000216 val &= ~PWGT2SPIEN;
Stefano Babic11bbd712011-10-06 11:44:26 +0200217 pmic_reg_write(p, REG_POWER_MISC, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000218
219 /* Externally powered */
Stefano Babic11bbd712011-10-06 11:44:26 +0200220 pmic_reg_read(p, REG_CHARGE, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000221 val |= ICHRG0 | ICHRG1 | ICHRG2 | ICHRG3 | CHGAUTOB;
Stefano Babic11bbd712011-10-06 11:44:26 +0200222 pmic_reg_write(p, REG_CHARGE, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000223
224 /* power up the system first */
Stefano Babic11bbd712011-10-06 11:44:26 +0200225 pmic_reg_write(p, REG_POWER_MISC, PWUP);
Marek Vasut92c34832011-01-19 04:40:37 +0000226
227 /* Set core voltage to 1.1V */
Stefano Babic11bbd712011-10-06 11:44:26 +0200228 pmic_reg_read(p, REG_SW_0, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000229 val = (val & ~SWx_VOLT_MASK) | SWx_1_100V;
Stefano Babic11bbd712011-10-06 11:44:26 +0200230 pmic_reg_write(p, REG_SW_0, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000231
232 /* Setup VCC (SW2) to 1.25 */
Stefano Babic11bbd712011-10-06 11:44:26 +0200233 pmic_reg_read(p, REG_SW_1, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000234 val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
Stefano Babic11bbd712011-10-06 11:44:26 +0200235 pmic_reg_write(p, REG_SW_1, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000236
237 /* Setup 1V2_DIG1 (SW3) to 1.25 */
Stefano Babic11bbd712011-10-06 11:44:26 +0200238 pmic_reg_read(p, REG_SW_2, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000239 val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
Stefano Babic11bbd712011-10-06 11:44:26 +0200240 pmic_reg_write(p, REG_SW_2, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000241 udelay(50);
242
243 /* Raise the core frequency to 800MHz */
244 writel(0x0, &mxc_ccm->cacrr);
245
246 /* Set switchers in Auto in NORMAL mode & STANDBY mode */
247 /* Setup the switcher mode for SW1 & SW2*/
Stefano Babic11bbd712011-10-06 11:44:26 +0200248 pmic_reg_read(p, REG_SW_4, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000249 val = (val & ~((SWMODE_MASK << SWMODE1_SHIFT) |
250 (SWMODE_MASK << SWMODE2_SHIFT)));
251 val |= (SWMODE_AUTO_AUTO << SWMODE1_SHIFT) |
252 (SWMODE_AUTO_AUTO << SWMODE2_SHIFT);
Stefano Babic11bbd712011-10-06 11:44:26 +0200253 pmic_reg_write(p, REG_SW_4, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000254
255 /* Setup the switcher mode for SW3 & SW4 */
Stefano Babic11bbd712011-10-06 11:44:26 +0200256 pmic_reg_read(p, REG_SW_5, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000257 val = (val & ~((SWMODE_MASK << SWMODE3_SHIFT) |
258 (SWMODE_MASK << SWMODE4_SHIFT)));
259 val |= (SWMODE_AUTO_AUTO << SWMODE3_SHIFT) |
260 (SWMODE_AUTO_AUTO << SWMODE4_SHIFT);
Stefano Babic11bbd712011-10-06 11:44:26 +0200261 pmic_reg_write(p, REG_SW_5, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000262
263 /* Set VDIG to 1.65V, VGEN3 to 1.8V, VCAM to 2.6V */
Stefano Babic11bbd712011-10-06 11:44:26 +0200264 pmic_reg_read(p, REG_SETTING_0, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000265 val &= ~(VCAM_MASK | VGEN3_MASK | VDIG_MASK);
266 val |= VDIG_1_65 | VGEN3_1_8 | VCAM_2_6;
Stefano Babic11bbd712011-10-06 11:44:26 +0200267 pmic_reg_write(p, REG_SETTING_0, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000268
269 /* Set VVIDEO to 2.775V, VAUDIO to 3V, VSD to 3.15V */
Stefano Babic11bbd712011-10-06 11:44:26 +0200270 pmic_reg_read(p, REG_SETTING_1, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000271 val &= ~(VVIDEO_MASK | VSD_MASK | VAUDIO_MASK);
272 val |= VSD_3_15 | VAUDIO_3_0 | VVIDEO_2_775;
Stefano Babic11bbd712011-10-06 11:44:26 +0200273 pmic_reg_write(p, REG_SETTING_1, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000274
275 /* Configure VGEN3 and VCAM regulators to use external PNP */
276 val = VGEN3CONFIG | VCAMCONFIG;
Stefano Babic11bbd712011-10-06 11:44:26 +0200277 pmic_reg_write(p, REG_MODE_1, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000278 udelay(200);
279
280 /* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
281 val = VGEN3EN | VGEN3CONFIG | VCAMEN | VCAMCONFIG |
282 VVIDEOEN | VAUDIOEN | VSDEN;
Stefano Babic11bbd712011-10-06 11:44:26 +0200283 pmic_reg_write(p, REG_MODE_1, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000284
Stefano Babic11bbd712011-10-06 11:44:26 +0200285 pmic_reg_read(p, REG_POWER_CTL2, &val);
Marek Vasut92c34832011-01-19 04:40:37 +0000286 val |= WDIRESET;
Stefano Babic11bbd712011-10-06 11:44:26 +0200287 pmic_reg_write(p, REG_POWER_CTL2, val);
Marek Vasut92c34832011-01-19 04:40:37 +0000288
289 udelay(2500);
290}
291#else
292static inline void power_init(void) { }
293#endif
294
295/*
296 * MMC configuration
297 */
298#ifdef CONFIG_FSL_ESDHC
299struct fsl_esdhc_cfg esdhc_cfg[2] = {
300 {MMC_SDHC1_BASE_ADDR, 1},
301 {MMC_SDHC2_BASE_ADDR, 1},
302};
303
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000304static inline uint32_t efika_mmc_cd(void)
305{
306 if (machine_is_efikamx())
307 return MX51_PIN_GPIO1_0;
308 else
309 return MX51_PIN_EIM_CS2;
310}
311
Marek Vasut92c34832011-01-19 04:40:37 +0000312int board_mmc_getcd(u8 *absent, struct mmc *mmc)
313{
314 struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000315 uint32_t cd = efika_mmc_cd();
Marek Vasut92c34832011-01-19 04:40:37 +0000316
317 if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000318 *absent = gpio_get_value(IOMUX_TO_GPIO(cd));
Marek Vasut92c34832011-01-19 04:40:37 +0000319 else
Stefano Babica3b1edd2011-08-21 10:53:32 +0200320 *absent = gpio_get_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_8));
Marek Vasut92c34832011-01-19 04:40:37 +0000321
322 return 0;
323}
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000324
Marek Vasut92c34832011-01-19 04:40:37 +0000325int board_mmc_init(bd_t *bis)
326{
327 int ret;
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000328 uint32_t cd = efika_mmc_cd();
Marek Vasut92c34832011-01-19 04:40:37 +0000329
330 /* SDHC1 is used on all revisions, setup control pins first */
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000331 mxc_request_iomux(cd,
Marek Vasut92c34832011-01-19 04:40:37 +0000332 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000333 mxc_iomux_set_pad(cd,
Marek Vasut92c34832011-01-19 04:40:37 +0000334 PAD_CTL_DRV_HIGH | PAD_CTL_HYS_ENABLE |
335 PAD_CTL_PUE_KEEPER | PAD_CTL_100K_PU |
336 PAD_CTL_ODE_OPENDRAIN_NONE |
337 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
338 mxc_request_iomux(MX51_PIN_GPIO1_1,
339 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
340 mxc_iomux_set_pad(MX51_PIN_GPIO1_1,
341 PAD_CTL_DRV_HIGH | PAD_CTL_HYS_ENABLE |
342 PAD_CTL_100K_PU | PAD_CTL_ODE_OPENDRAIN_NONE |
343 PAD_CTL_SRE_FAST);
344
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000345 gpio_direction_input(IOMUX_TO_GPIO(cd));
Stefano Babica3b1edd2011-08-21 10:53:32 +0200346 gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_GPIO1_1));
Marek Vasut92c34832011-01-19 04:40:37 +0000347
348 /* Internal SDHC1 IOMUX + SDHC2 IOMUX on old boards */
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000349 if (machine_is_efikasb() || (machine_is_efikamx() &&
350 (get_efika_rev() < EFIKAMX_BOARD_REV_12))) {
Marek Vasut92c34832011-01-19 04:40:37 +0000351 /* SDHC1 IOMUX */
352 mxc_request_iomux(MX51_PIN_SD1_CMD,
353 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
354 mxc_iomux_set_pad(MX51_PIN_SD1_CMD,
355 PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE |
356 PAD_CTL_DRV_HIGH | PAD_CTL_47K_PU | PAD_CTL_SRE_FAST);
357
358 mxc_request_iomux(MX51_PIN_SD1_CLK,
359 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
360 mxc_iomux_set_pad(MX51_PIN_SD1_CLK,
361 PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE |
362 PAD_CTL_DRV_HIGH | PAD_CTL_47K_PU | PAD_CTL_SRE_FAST);
363
364 mxc_request_iomux(MX51_PIN_SD1_DATA0, IOMUX_CONFIG_ALT0);
365 mxc_iomux_set_pad(MX51_PIN_SD1_DATA0,
366 PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE |
367 PAD_CTL_DRV_HIGH | PAD_CTL_47K_PU | PAD_CTL_SRE_FAST);
368
369 mxc_request_iomux(MX51_PIN_SD1_DATA1, IOMUX_CONFIG_ALT0);
370 mxc_iomux_set_pad(MX51_PIN_SD1_DATA1,
371 PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE |
372 PAD_CTL_DRV_HIGH | PAD_CTL_47K_PU | PAD_CTL_SRE_FAST);
373
374 mxc_request_iomux(MX51_PIN_SD1_DATA2, IOMUX_CONFIG_ALT0);
375 mxc_iomux_set_pad(MX51_PIN_SD1_DATA2,
376 PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE |
377 PAD_CTL_DRV_HIGH | PAD_CTL_47K_PU | PAD_CTL_SRE_FAST);
378
379 mxc_request_iomux(MX51_PIN_SD1_DATA3, IOMUX_CONFIG_ALT0);
380 mxc_iomux_set_pad(MX51_PIN_SD1_DATA3,
381 PAD_CTL_PUE_KEEPER | PAD_CTL_PKE_ENABLE |
382 PAD_CTL_DRV_HIGH | PAD_CTL_47K_PU | PAD_CTL_SRE_FAST);
383
384 /* SDHC2 IOMUX */
385 mxc_request_iomux(MX51_PIN_SD2_CMD,
386 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
387 mxc_iomux_set_pad(MX51_PIN_SD2_CMD,
388 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
389
390 mxc_request_iomux(MX51_PIN_SD2_CLK,
391 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
392 mxc_iomux_set_pad(MX51_PIN_SD2_CLK,
393 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
394
395 mxc_request_iomux(MX51_PIN_SD2_DATA0, IOMUX_CONFIG_ALT0);
396 mxc_iomux_set_pad(MX51_PIN_SD2_DATA0,
397 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
398
399 mxc_request_iomux(MX51_PIN_SD2_DATA1, IOMUX_CONFIG_ALT0);
400 mxc_iomux_set_pad(MX51_PIN_SD2_DATA1,
401 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
402
403 mxc_request_iomux(MX51_PIN_SD2_DATA2, IOMUX_CONFIG_ALT0);
404 mxc_iomux_set_pad(MX51_PIN_SD2_DATA2,
405 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
406
407 mxc_request_iomux(MX51_PIN_SD2_DATA3, IOMUX_CONFIG_ALT0);
408 mxc_iomux_set_pad(MX51_PIN_SD2_DATA3,
409 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
410
411 /* SDHC2 Control lines IOMUX */
412 mxc_request_iomux(MX51_PIN_GPIO1_7,
413 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
414 mxc_iomux_set_pad(MX51_PIN_GPIO1_7,
415 PAD_CTL_DRV_HIGH | PAD_CTL_HYS_ENABLE |
416 PAD_CTL_PUE_KEEPER | PAD_CTL_100K_PU |
417 PAD_CTL_ODE_OPENDRAIN_NONE |
418 PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
419 mxc_request_iomux(MX51_PIN_GPIO1_8,
420 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
421 mxc_iomux_set_pad(MX51_PIN_GPIO1_8,
422 PAD_CTL_DRV_HIGH | PAD_CTL_HYS_ENABLE |
423 PAD_CTL_100K_PU | PAD_CTL_ODE_OPENDRAIN_NONE |
424 PAD_CTL_SRE_FAST);
425
Stefano Babica3b1edd2011-08-21 10:53:32 +0200426 gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_GPIO1_8));
427 gpio_direction_input(IOMUX_TO_GPIO(MX51_PIN_GPIO1_7));
Marek Vasut92c34832011-01-19 04:40:37 +0000428
429 ret = fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
430 if (!ret)
431 ret = fsl_esdhc_initialize(bis, &esdhc_cfg[1]);
432 } else { /* New boards use only SDHC1 */
433 /* SDHC1 IOMUX */
434 mxc_request_iomux(MX51_PIN_SD1_CMD,
435 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
436 mxc_iomux_set_pad(MX51_PIN_SD1_CMD,
437 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
438
439 mxc_request_iomux(MX51_PIN_SD1_CLK,
440 IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION);
441 mxc_iomux_set_pad(MX51_PIN_SD1_CLK,
442 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
443
444 mxc_request_iomux(MX51_PIN_SD1_DATA0, IOMUX_CONFIG_ALT0);
445 mxc_iomux_set_pad(MX51_PIN_SD1_DATA0,
446 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
447
448 mxc_request_iomux(MX51_PIN_SD1_DATA1, IOMUX_CONFIG_ALT0);
449 mxc_iomux_set_pad(MX51_PIN_SD1_DATA1,
450 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
451
452 mxc_request_iomux(MX51_PIN_SD1_DATA2, IOMUX_CONFIG_ALT0);
453 mxc_iomux_set_pad(MX51_PIN_SD1_DATA2,
454 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
455
456 mxc_request_iomux(MX51_PIN_SD1_DATA3, IOMUX_CONFIG_ALT0);
457 mxc_iomux_set_pad(MX51_PIN_SD1_DATA3,
458 PAD_CTL_DRV_MAX | PAD_CTL_22K_PU | PAD_CTL_SRE_FAST);
459
460 ret = fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
461 }
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000462
Marek Vasut92c34832011-01-19 04:40:37 +0000463 return ret;
464}
465#endif
466
467/*
468 * ATA
469 */
470#ifdef CONFIG_MX51_PATA
471#define ATA_PAD_CONFIG (PAD_CTL_DRV_HIGH | PAD_CTL_DRV_VOT_HIGH)
472void setup_iomux_ata(void)
473{
474 mxc_request_iomux(MX51_PIN_NANDF_ALE, IOMUX_CONFIG_ALT1);
475 mxc_iomux_set_pad(MX51_PIN_NANDF_ALE, ATA_PAD_CONFIG);
476 mxc_request_iomux(MX51_PIN_NANDF_CS2, IOMUX_CONFIG_ALT1);
477 mxc_iomux_set_pad(MX51_PIN_NANDF_CS2, ATA_PAD_CONFIG);
478 mxc_request_iomux(MX51_PIN_NANDF_CS3, IOMUX_CONFIG_ALT1);
479 mxc_iomux_set_pad(MX51_PIN_NANDF_CS3, ATA_PAD_CONFIG);
480 mxc_request_iomux(MX51_PIN_NANDF_CS4, IOMUX_CONFIG_ALT1);
481 mxc_iomux_set_pad(MX51_PIN_NANDF_CS4, ATA_PAD_CONFIG);
482 mxc_request_iomux(MX51_PIN_NANDF_CS5, IOMUX_CONFIG_ALT1);
483 mxc_iomux_set_pad(MX51_PIN_NANDF_CS5, ATA_PAD_CONFIG);
484 mxc_request_iomux(MX51_PIN_NANDF_CS6, IOMUX_CONFIG_ALT1);
485 mxc_iomux_set_pad(MX51_PIN_NANDF_CS6, ATA_PAD_CONFIG);
486 mxc_request_iomux(MX51_PIN_NANDF_RE_B, IOMUX_CONFIG_ALT1);
487 mxc_iomux_set_pad(MX51_PIN_NANDF_RE_B, ATA_PAD_CONFIG);
488 mxc_request_iomux(MX51_PIN_NANDF_WE_B, IOMUX_CONFIG_ALT1);
489 mxc_iomux_set_pad(MX51_PIN_NANDF_WE_B, ATA_PAD_CONFIG);
490 mxc_request_iomux(MX51_PIN_NANDF_CLE, IOMUX_CONFIG_ALT1);
491 mxc_iomux_set_pad(MX51_PIN_NANDF_CLE, ATA_PAD_CONFIG);
492 mxc_request_iomux(MX51_PIN_NANDF_RB0, IOMUX_CONFIG_ALT1);
493 mxc_iomux_set_pad(MX51_PIN_NANDF_RB0, ATA_PAD_CONFIG);
494 mxc_request_iomux(MX51_PIN_NANDF_WP_B, IOMUX_CONFIG_ALT1);
495 mxc_iomux_set_pad(MX51_PIN_NANDF_WP_B, ATA_PAD_CONFIG);
496 mxc_request_iomux(MX51_PIN_GPIO_NAND, IOMUX_CONFIG_ALT1);
497 mxc_iomux_set_pad(MX51_PIN_GPIO_NAND, ATA_PAD_CONFIG);
498 mxc_request_iomux(MX51_PIN_NANDF_RB1, IOMUX_CONFIG_ALT1);
499 mxc_iomux_set_pad(MX51_PIN_NANDF_RB1, ATA_PAD_CONFIG);
500 mxc_request_iomux(MX51_PIN_NANDF_D0, IOMUX_CONFIG_ALT1);
501 mxc_iomux_set_pad(MX51_PIN_NANDF_D0, ATA_PAD_CONFIG);
502 mxc_request_iomux(MX51_PIN_NANDF_D1, IOMUX_CONFIG_ALT1);
503 mxc_iomux_set_pad(MX51_PIN_NANDF_D1, ATA_PAD_CONFIG);
504 mxc_request_iomux(MX51_PIN_NANDF_D2, IOMUX_CONFIG_ALT1);
505 mxc_iomux_set_pad(MX51_PIN_NANDF_D2, ATA_PAD_CONFIG);
506 mxc_request_iomux(MX51_PIN_NANDF_D3, IOMUX_CONFIG_ALT1);
507 mxc_iomux_set_pad(MX51_PIN_NANDF_D3, ATA_PAD_CONFIG);
508 mxc_request_iomux(MX51_PIN_NANDF_D4, IOMUX_CONFIG_ALT1);
509 mxc_iomux_set_pad(MX51_PIN_NANDF_D4, ATA_PAD_CONFIG);
510 mxc_request_iomux(MX51_PIN_NANDF_D5, IOMUX_CONFIG_ALT1);
511 mxc_iomux_set_pad(MX51_PIN_NANDF_D5, ATA_PAD_CONFIG);
512 mxc_request_iomux(MX51_PIN_NANDF_D6, IOMUX_CONFIG_ALT1);
513 mxc_iomux_set_pad(MX51_PIN_NANDF_D6, ATA_PAD_CONFIG);
514 mxc_request_iomux(MX51_PIN_NANDF_D7, IOMUX_CONFIG_ALT1);
515 mxc_iomux_set_pad(MX51_PIN_NANDF_D7, ATA_PAD_CONFIG);
516 mxc_request_iomux(MX51_PIN_NANDF_D8, IOMUX_CONFIG_ALT1);
517 mxc_iomux_set_pad(MX51_PIN_NANDF_D8, ATA_PAD_CONFIG);
518 mxc_request_iomux(MX51_PIN_NANDF_D9, IOMUX_CONFIG_ALT1);
519 mxc_iomux_set_pad(MX51_PIN_NANDF_D9, ATA_PAD_CONFIG);
520 mxc_request_iomux(MX51_PIN_NANDF_D10, IOMUX_CONFIG_ALT1);
521 mxc_iomux_set_pad(MX51_PIN_NANDF_D10, ATA_PAD_CONFIG);
522 mxc_request_iomux(MX51_PIN_NANDF_D11, IOMUX_CONFIG_ALT1);
523 mxc_iomux_set_pad(MX51_PIN_NANDF_D11, ATA_PAD_CONFIG);
524 mxc_request_iomux(MX51_PIN_NANDF_D12, IOMUX_CONFIG_ALT1);
525 mxc_iomux_set_pad(MX51_PIN_NANDF_D12, ATA_PAD_CONFIG);
526 mxc_request_iomux(MX51_PIN_NANDF_D13, IOMUX_CONFIG_ALT1);
527 mxc_iomux_set_pad(MX51_PIN_NANDF_D13, ATA_PAD_CONFIG);
528 mxc_request_iomux(MX51_PIN_NANDF_D14, IOMUX_CONFIG_ALT1);
529 mxc_iomux_set_pad(MX51_PIN_NANDF_D14, ATA_PAD_CONFIG);
530 mxc_request_iomux(MX51_PIN_NANDF_D15, IOMUX_CONFIG_ALT1);
531 mxc_iomux_set_pad(MX51_PIN_NANDF_D15, ATA_PAD_CONFIG);
532}
533#else
534static inline void setup_iomux_ata(void) { }
535#endif
536
537/*
538 * LED configuration
539 */
540void setup_iomux_led(void)
541{
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000542 if (machine_is_efikamx()) {
543 /* Blue LED */
544 mxc_request_iomux(MX51_PIN_CSI1_D9, IOMUX_CONFIG_ALT3);
545 gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_CSI1_D9), 0);
Stefano Babica3b1edd2011-08-21 10:53:32 +0200546
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000547 /* Green LED */
548 mxc_request_iomux(MX51_PIN_CSI1_VSYNC, IOMUX_CONFIG_ALT3);
549 gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_CSI1_VSYNC), 0);
Stefano Babica3b1edd2011-08-21 10:53:32 +0200550
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000551 /* Red LED */
552 mxc_request_iomux(MX51_PIN_CSI1_HSYNC, IOMUX_CONFIG_ALT3);
553 gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_CSI1_HSYNC), 0);
554 } else {
555 /* CAPS-LOCK LED */
556 mxc_request_iomux(MX51_PIN_EIM_CS0, IOMUX_CONFIG_GPIO);
557 gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_CS0), 0);
558
559 /* ALARM-LED LED */
560 mxc_request_iomux(MX51_PIN_GPIO1_3, IOMUX_CONFIG_GPIO);
561 gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_GPIO1_3), 0);
562 }
Marek Vasut92c34832011-01-19 04:40:37 +0000563}
564
565void efikamx_toggle_led(uint32_t mask)
566{
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000567 if (machine_is_efikamx()) {
568 gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_CSI1_D9),
569 mask & EFIKAMX_LED_BLUE);
570 gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_CSI1_VSYNC),
571 mask & EFIKAMX_LED_GREEN);
572 gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_CSI1_HSYNC),
573 mask & EFIKAMX_LED_RED);
574 } else {
575 gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_CS0),
576 mask & EFIKAMX_LED_BLUE);
577 gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_3),
578 !(mask & EFIKAMX_LED_GREEN));
579 }
Marek Vasut92c34832011-01-19 04:40:37 +0000580}
581
582/*
583 * Board initialization
584 */
585static void init_drive_strength(void)
586{
587 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEDDR, PAD_CTL_DDR_INPUT_CMOS);
588 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEADDR, PAD_CTL_PKE_ENABLE);
589 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRAPKS, PAD_CTL_PUE_KEEPER);
590 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRAPUS, PAD_CTL_100K_PU);
591 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_A1, PAD_CTL_SRE_FAST);
592 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_A0, PAD_CTL_DRV_HIGH);
593 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_A1, PAD_CTL_DRV_HIGH);
594 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_RAS,
595 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
596 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CAS,
597 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
598 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_PKEDDR, PAD_CTL_PKE_ENABLE);
599 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRPKS, PAD_CTL_PUE_KEEPER);
600 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR0, PAD_CTL_HYS_NONE);
601 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR1, PAD_CTL_HYS_NONE);
602 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR2, PAD_CTL_HYS_NONE);
603 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_HYSDDR3, PAD_CTL_HYS_NONE);
604 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B0, PAD_CTL_SRE_FAST);
605 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B1, PAD_CTL_SRE_FAST);
606 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B2, PAD_CTL_SRE_FAST);
607 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDR_SR_B4, PAD_CTL_SRE_FAST);
608 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DDRPUS, PAD_CTL_100K_PU);
609 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_INMODE1, PAD_CTL_DDR_INPUT_CMOS);
610 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B0, PAD_CTL_DRV_MEDIUM);
611 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B1, PAD_CTL_DRV_MEDIUM);
612 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B2, PAD_CTL_DRV_MEDIUM);
613 mxc_iomux_set_pad(MX51_PIN_CTL_GRP_DRAM_B4, PAD_CTL_DRV_MEDIUM);
614
615 /* Setting pad options */
616 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDWE,
617 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
618 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
619 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCKE0,
620 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
621 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
622 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCKE1,
623 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
624 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
625 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDCLK,
626 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
627 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
628 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS0,
629 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
630 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
631 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS1,
632 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
633 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
634 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS2,
635 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
636 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
637 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_SDQS3,
638 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
639 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
640 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CS0,
641 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
642 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
643 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_CS1,
644 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
645 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
646 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_DQM0,
647 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
648 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
649 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_DQM1,
650 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
651 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
652 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_DQM2,
653 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
654 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
655 mxc_iomux_set_pad(MX51_PIN_CTL_DRAM_DQM3,
656 PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
657 PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST);
658}
659
660int board_early_init_f(void)
661{
662 init_drive_strength();
663
664 setup_iomux_uart();
665 setup_iomux_spi();
666 setup_iomux_led();
667
668 return 0;
669}
670
671int board_init(void)
672{
Marek Vasut92c34832011-01-19 04:40:37 +0000673 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
674
675 return 0;
676}
677
678int board_late_init(void)
679{
680 setup_iomux_spi();
681
682 power_init();
683
684 setup_iomux_led();
685 setup_iomux_ata();
686
687 efikamx_toggle_led(EFIKAMX_LED_BLUE);
688
689 return 0;
690}
691
692int checkboard(void)
693{
Marek Vasut3cc35cc2011-09-25 09:55:43 +0000694 u32 rev = get_efika_rev();
695
696 if (machine_is_efikamx()) {
697 printf("Board: Efika MX, rev1.%i\n", rev & 0xf);
698 return 0;
699 } else {
700 switch (rev) {
701 case EFIKASB_BOARD_REV_13:
702 printf("Board: Efika SB rev1.3\n");
703 break;
704 case EFIKASB_BOARD_REV_20:
705 printf("Board: Efika SB rev2.0\n");
706 break;
707 default:
708 printf("Board: Efika SB, rev Unknown\n");
709 break;
710 }
711 }
Marek Vasut92c34832011-01-19 04:40:37 +0000712
713 return 0;
714}