blob: e99dead65b38d9327a77acb3d401ffedf0d16619 [file] [log] [blame]
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +01001/*
2 * based on code from the following
3 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
4 * Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
5 * Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
6 *
7 * The code contained herein is licensed under the GNU General Public
8 * License. You may obtain a copy of the GNU General Public License
9 * Version 2 or later at the following locations:
10 *
11 * http://www.opensource.org/licenses/gpl-license.html
12 * http://www.gnu.org/copyleft/gpl.html
13 */
14
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/i2c.h>
18#include <linux/gpio.h>
19#include <linux/leds.h>
20#include <linux/input.h>
21#include <linux/delay.h>
22#include <linux/io.h>
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +010023#include <linux/spi/flash.h>
24#include <linux/spi/spi.h>
Arnaud Patard (Rtp)2432cff2011-02-17 15:31:30 +010025#include <linux/mfd/mc13892.h>
26#include <linux/regulator/machine.h>
27#include <linux/regulator/consumer.h>
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +010028
29#include <mach/common.h>
30#include <mach/hardware.h>
31#include <mach/iomux-mx51.h>
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +010032
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +010033#include <linux/usb/otg.h>
34#include <linux/usb/ulpi.h>
35#include <mach/ulpi.h>
36
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +010037#include <asm/irq.h>
38#include <asm/setup.h>
39#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
41#include <asm/mach/time.h>
42
43#include "devices-imx51.h"
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +010044#include "efika.h"
Arnaud Patard (Rtp)856e6562011-02-17 15:31:31 +010045#include "cpu_op-mx51.h"
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +010046
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +010047#define MX51_USB_CTRL_1_OFFSET 0x10
48#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
49#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
50
51#define EFIKAMX_USB_HUB_RESET IMX_GPIO_NR(1, 5)
52#define EFIKAMX_USBH1_STP IMX_GPIO_NR(1, 27)
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +010053
54#define EFIKAMX_SPI_CS0 IMX_GPIO_NR(4, 24)
55#define EFIKAMX_SPI_CS1 IMX_GPIO_NR(4, 25)
56
Arnaud Patard (Rtp)2432cff2011-02-17 15:31:30 +010057#define EFIKAMX_PMIC IMX_GPIO_NR(1, 6)
58
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +010059static iomux_v3_cfg_t mx51efika_pads[] = {
60 /* UART1 */
61 MX51_PAD_UART1_RXD__UART1_RXD,
62 MX51_PAD_UART1_TXD__UART1_TXD,
63 MX51_PAD_UART1_RTS__UART1_RTS,
64 MX51_PAD_UART1_CTS__UART1_CTS,
65
66 /* SD 1 */
67 MX51_PAD_SD1_CMD__SD1_CMD,
68 MX51_PAD_SD1_CLK__SD1_CLK,
69 MX51_PAD_SD1_DATA0__SD1_DATA0,
70 MX51_PAD_SD1_DATA1__SD1_DATA1,
71 MX51_PAD_SD1_DATA2__SD1_DATA2,
72 MX51_PAD_SD1_DATA3__SD1_DATA3,
73
74 /* SD 2 */
75 MX51_PAD_SD2_CMD__SD2_CMD,
76 MX51_PAD_SD2_CLK__SD2_CLK,
77 MX51_PAD_SD2_DATA0__SD2_DATA0,
78 MX51_PAD_SD2_DATA1__SD2_DATA1,
79 MX51_PAD_SD2_DATA2__SD2_DATA2,
80 MX51_PAD_SD2_DATA3__SD2_DATA3,
81
82 /* SD/MMC WP/CD */
83 MX51_PAD_GPIO1_0__SD1_CD,
84 MX51_PAD_GPIO1_1__SD1_WP,
85 MX51_PAD_GPIO1_7__SD2_WP,
86 MX51_PAD_GPIO1_8__SD2_CD,
87
88 /* spi */
89 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
90 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
91 MX51_PAD_CSPI1_SS0__GPIO4_24,
92 MX51_PAD_CSPI1_SS1__GPIO4_25,
93 MX51_PAD_CSPI1_RDY__ECSPI1_RDY,
94 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
Arnaud Patard (Rtp)2432cff2011-02-17 15:31:30 +010095 MX51_PAD_GPIO1_6__GPIO1_6,
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +010096
97 /* USB HOST1 */
98 MX51_PAD_USBH1_CLK__USBH1_CLK,
99 MX51_PAD_USBH1_DIR__USBH1_DIR,
100 MX51_PAD_USBH1_NXT__USBH1_NXT,
101 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
102 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
103 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
104 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
105 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
106 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
107 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
108 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
109
110 /* USB HUB RESET */
111 MX51_PAD_GPIO1_5__GPIO1_5,
112
113 /* WLAN */
114 MX51_PAD_EIM_A22__GPIO2_16,
115 MX51_PAD_EIM_A16__GPIO2_10,
116
117 /* USB PHY RESET */
118 MX51_PAD_EIM_D27__GPIO2_9,
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100119};
120
121/* Serial ports */
122static const struct imxuart_platform_data uart_pdata = {
123 .flags = IMXUART_HAVE_RTSCTS,
124};
125
126/* This function is board specific as the bit mask for the plldiv will also
127 * be different for other Freescale SoCs, thus a common bitmask is not
128 * possible and cannot get place in /plat-mxc/ehci.c.
129 */
130static int initialize_otg_port(struct platform_device *pdev)
131{
132 u32 v;
133 void __iomem *usb_base;
134 void __iomem *usbother_base;
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200135 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100136 if (!usb_base)
137 return -ENOMEM;
138 usbother_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
139
140 /* Set the PHY clock to 19.2MHz */
141 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
142 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +0100143 v |= MX51_USB_PLL_DIV_19_2_MHZ;
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100144 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
145 iounmap(usb_base);
146
147 mdelay(10);
148
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +0100149 return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100150}
151
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200152static const struct mxc_usbh_platform_data dr_utmi_config __initconst = {
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100153 .init = initialize_otg_port,
154 .portsc = MXC_EHCI_UTMI_16BIT,
155};
156
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +0100157static int initialize_usbh1_port(struct platform_device *pdev)
158{
159 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
160 iomux_v3_cfg_t usbh1gpio = MX51_PAD_USBH1_STP__GPIO1_27;
161 u32 v;
162 void __iomem *usb_base;
163 void __iomem *socregs_base;
164
165 mxc_iomux_v3_setup_pad(usbh1gpio);
166 gpio_request(EFIKAMX_USBH1_STP, "usbh1_stp");
167 gpio_direction_output(EFIKAMX_USBH1_STP, 0);
168 msleep(1);
169 gpio_set_value(EFIKAMX_USBH1_STP, 1);
170 msleep(1);
171
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200172 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +0100173 socregs_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
174
175 /* The clock for the USBH1 ULPI port will come externally */
176 /* from the PHY. */
177 v = __raw_readl(socregs_base + MX51_USB_CTRL_1_OFFSET);
178 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN,
179 socregs_base + MX51_USB_CTRL_1_OFFSET);
180
181 iounmap(usb_base);
182
183 gpio_free(EFIKAMX_USBH1_STP);
184 mxc_iomux_v3_setup_pad(usbh1stp);
185
186 mdelay(10);
187
188 return mx51_initialize_usb_hw(0, MXC_EHCI_ITC_NO_THRESHOLD);
189}
190
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200191static struct mxc_usbh_platform_data usbh1_config __initdata = {
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +0100192 .init = initialize_usbh1_port,
193 .portsc = MXC_EHCI_MODE_ULPI,
194};
195
196static void mx51_efika_hubreset(void)
197{
198 gpio_request(EFIKAMX_USB_HUB_RESET, "usb_hub_rst");
199 gpio_direction_output(EFIKAMX_USB_HUB_RESET, 1);
200 msleep(1);
201 gpio_set_value(EFIKAMX_USB_HUB_RESET, 0);
202 msleep(1);
203 gpio_set_value(EFIKAMX_USB_HUB_RESET, 1);
204}
205
206static void __init mx51_efika_usb(void)
207{
208 mx51_efika_hubreset();
209
210 /* pulling it low, means no USB at all... */
211 gpio_request(EFIKA_USB_PHY_RESET, "usb_phy_reset");
212 gpio_direction_output(EFIKA_USB_PHY_RESET, 0);
213 msleep(1);
214 gpio_set_value(EFIKA_USB_PHY_RESET, 1);
215
Sascha Hauer48f6b092011-03-02 09:27:42 +0100216 usbh1_config.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
217 ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_EXTVBUSIND);
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +0100218
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200219 imx51_add_mxc_ehci_otg(&dr_utmi_config);
Sascha Hauer48f6b092011-03-02 09:27:42 +0100220 if (usbh1_config.otg)
Uwe Kleine-König7d92e8e2011-07-30 23:41:49 +0200221 imx51_add_mxc_ehci_hs(1, &usbh1_config);
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +0100222}
223
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100224static struct mtd_partition mx51_efika_spi_nor_partitions[] = {
225 {
226 .name = "u-boot",
227 .offset = 0,
228 .size = SZ_256K,
229 },
230 {
231 .name = "config",
232 .offset = MTDPART_OFS_APPEND,
233 .size = SZ_64K,
234 },
235};
236
237static struct flash_platform_data mx51_efika_spi_flash_data = {
238 .name = "spi_flash",
239 .parts = mx51_efika_spi_nor_partitions,
240 .nr_parts = ARRAY_SIZE(mx51_efika_spi_nor_partitions),
241 .type = "sst25vf032b",
242};
243
Arnaud Patard (Rtp)2432cff2011-02-17 15:31:30 +0100244static struct regulator_consumer_supply sw1_consumers[] = {
245 {
246 .supply = "cpu_vcc",
247 }
248};
249
250static struct regulator_consumer_supply vdig_consumers[] = {
251 /* sgtl5000 */
252 REGULATOR_SUPPLY("VDDA", "1-000a"),
253 REGULATOR_SUPPLY("VDDD", "1-000a"),
254};
255
256static struct regulator_consumer_supply vvideo_consumers[] = {
257 /* sgtl5000 */
258 REGULATOR_SUPPLY("VDDIO", "1-000a"),
259};
260
261static struct regulator_consumer_supply vsd_consumers[] = {
Shawn Guo57ed3312011-06-30 09:24:26 +0800262 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.0"),
263 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.1"),
Arnaud Patard (Rtp)2432cff2011-02-17 15:31:30 +0100264};
265
266static struct regulator_consumer_supply pwgt1_consumer[] = {
267 {
268 .supply = "pwgt1",
269 }
270};
271
272static struct regulator_consumer_supply pwgt2_consumer[] = {
273 {
274 .supply = "pwgt2",
275 }
276};
277
278static struct regulator_consumer_supply coincell_consumer[] = {
279 {
280 .supply = "coincell",
281 }
282};
283
284static struct regulator_init_data sw1_init = {
285 .constraints = {
286 .name = "SW1",
287 .min_uV = 600000,
288 .max_uV = 1375000,
289 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
290 .valid_modes_mask = 0,
291 .always_on = 1,
292 .boot_on = 1,
293 .state_mem = {
294 .uV = 850000,
295 .mode = REGULATOR_MODE_NORMAL,
296 .enabled = 1,
297 },
298 },
299 .num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
300 .consumer_supplies = sw1_consumers,
301};
302
303static struct regulator_init_data sw2_init = {
304 .constraints = {
305 .name = "SW2",
306 .min_uV = 900000,
307 .max_uV = 1850000,
308 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
309 .always_on = 1,
310 .boot_on = 1,
311 .state_mem = {
312 .uV = 950000,
313 .mode = REGULATOR_MODE_NORMAL,
314 .enabled = 1,
315 },
316 }
317};
318
319static struct regulator_init_data sw3_init = {
320 .constraints = {
321 .name = "SW3",
322 .min_uV = 1100000,
323 .max_uV = 1850000,
324 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
325 .always_on = 1,
326 .boot_on = 1,
327 }
328};
329
330static struct regulator_init_data sw4_init = {
331 .constraints = {
332 .name = "SW4",
333 .min_uV = 1100000,
334 .max_uV = 1850000,
335 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
336 .always_on = 1,
337 .boot_on = 1,
338 }
339};
340
341static struct regulator_init_data viohi_init = {
342 .constraints = {
343 .name = "VIOHI",
344 .boot_on = 1,
345 .always_on = 1,
346 }
347};
348
349static struct regulator_init_data vusb_init = {
350 .constraints = {
351 .name = "VUSB",
352 .boot_on = 1,
353 .always_on = 1,
354 }
355};
356
357static struct regulator_init_data swbst_init = {
358 .constraints = {
359 .name = "SWBST",
360 }
361};
362
363static struct regulator_init_data vdig_init = {
364 .constraints = {
365 .name = "VDIG",
366 .min_uV = 1050000,
367 .max_uV = 1800000,
368 .valid_ops_mask =
369 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
370 .boot_on = 1,
371 .always_on = 1,
372 },
373 .num_consumer_supplies = ARRAY_SIZE(vdig_consumers),
374 .consumer_supplies = vdig_consumers,
375};
376
377static struct regulator_init_data vpll_init = {
378 .constraints = {
379 .name = "VPLL",
380 .min_uV = 1050000,
381 .max_uV = 1800000,
382 .valid_ops_mask =
383 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
384 .boot_on = 1,
385 .always_on = 1,
386 }
387};
388
389static struct regulator_init_data vusb2_init = {
390 .constraints = {
391 .name = "VUSB2",
392 .min_uV = 2400000,
393 .max_uV = 2775000,
394 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
395 .boot_on = 1,
396 .always_on = 1,
397 }
398};
399
400static struct regulator_init_data vvideo_init = {
401 .constraints = {
402 .name = "VVIDEO",
403 .min_uV = 2775000,
404 .max_uV = 2775000,
405 .valid_ops_mask =
406 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
407 .boot_on = 1,
408 .apply_uV = 1,
409 },
410 .num_consumer_supplies = ARRAY_SIZE(vvideo_consumers),
411 .consumer_supplies = vvideo_consumers,
412};
413
414static struct regulator_init_data vaudio_init = {
415 .constraints = {
416 .name = "VAUDIO",
417 .min_uV = 2300000,
418 .max_uV = 3000000,
419 .valid_ops_mask =
420 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
421 .boot_on = 1,
422 }
423};
424
425static struct regulator_init_data vsd_init = {
426 .constraints = {
427 .name = "VSD",
428 .min_uV = 1800000,
429 .max_uV = 3150000,
430 .valid_ops_mask =
431 REGULATOR_CHANGE_VOLTAGE,
432 .boot_on = 1,
433 },
434 .num_consumer_supplies = ARRAY_SIZE(vsd_consumers),
435 .consumer_supplies = vsd_consumers,
436};
437
438static struct regulator_init_data vcam_init = {
439 .constraints = {
440 .name = "VCAM",
441 .min_uV = 2500000,
442 .max_uV = 3000000,
443 .valid_ops_mask =
444 REGULATOR_CHANGE_VOLTAGE |
445 REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
446 .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
447 .boot_on = 1,
448 }
449};
450
451static struct regulator_init_data vgen1_init = {
452 .constraints = {
453 .name = "VGEN1",
454 .min_uV = 1200000,
455 .max_uV = 3150000,
456 .valid_ops_mask =
457 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
458 .boot_on = 1,
459 .always_on = 1,
460 }
461};
462
463static struct regulator_init_data vgen2_init = {
464 .constraints = {
465 .name = "VGEN2",
466 .min_uV = 1200000,
467 .max_uV = 3150000,
468 .valid_ops_mask =
469 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
470 .boot_on = 1,
471 .always_on = 1,
472 }
473};
474
475static struct regulator_init_data vgen3_init = {
476 .constraints = {
477 .name = "VGEN3",
478 .min_uV = 1800000,
479 .max_uV = 2900000,
480 .valid_ops_mask =
481 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
482 .boot_on = 1,
483 .always_on = 1,
484 }
485};
486
487static struct regulator_init_data gpo1_init = {
488 .constraints = {
489 .name = "GPO1",
490 }
491};
492
493static struct regulator_init_data gpo2_init = {
494 .constraints = {
495 .name = "GPO2",
496 }
497};
498
499static struct regulator_init_data gpo3_init = {
500 .constraints = {
501 .name = "GPO3",
502 }
503};
504
505static struct regulator_init_data gpo4_init = {
506 .constraints = {
507 .name = "GPO4",
508 }
509};
510
511static struct regulator_init_data pwgt1_init = {
512 .constraints = {
513 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
514 .boot_on = 1,
515 },
516 .num_consumer_supplies = ARRAY_SIZE(pwgt1_consumer),
517 .consumer_supplies = pwgt1_consumer,
518};
519
520static struct regulator_init_data pwgt2_init = {
521 .constraints = {
522 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
523 .boot_on = 1,
524 },
525 .num_consumer_supplies = ARRAY_SIZE(pwgt2_consumer),
526 .consumer_supplies = pwgt2_consumer,
527};
528
529static struct regulator_init_data vcoincell_init = {
530 .constraints = {
531 .name = "COINCELL",
532 .min_uV = 3000000,
533 .max_uV = 3000000,
534 .valid_ops_mask =
535 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
536 },
537 .num_consumer_supplies = ARRAY_SIZE(coincell_consumer),
538 .consumer_supplies = coincell_consumer,
539};
540
541static struct mc13xxx_regulator_init_data mx51_efika_regulators[] = {
542 { .id = MC13892_SW1, .init_data = &sw1_init },
543 { .id = MC13892_SW2, .init_data = &sw2_init },
544 { .id = MC13892_SW3, .init_data = &sw3_init },
545 { .id = MC13892_SW4, .init_data = &sw4_init },
546 { .id = MC13892_SWBST, .init_data = &swbst_init },
547 { .id = MC13892_VIOHI, .init_data = &viohi_init },
548 { .id = MC13892_VPLL, .init_data = &vpll_init },
549 { .id = MC13892_VDIG, .init_data = &vdig_init },
550 { .id = MC13892_VSD, .init_data = &vsd_init },
551 { .id = MC13892_VUSB2, .init_data = &vusb2_init },
552 { .id = MC13892_VVIDEO, .init_data = &vvideo_init },
553 { .id = MC13892_VAUDIO, .init_data = &vaudio_init },
554 { .id = MC13892_VCAM, .init_data = &vcam_init },
555 { .id = MC13892_VGEN1, .init_data = &vgen1_init },
556 { .id = MC13892_VGEN2, .init_data = &vgen2_init },
557 { .id = MC13892_VGEN3, .init_data = &vgen3_init },
558 { .id = MC13892_VUSB, .init_data = &vusb_init },
559 { .id = MC13892_GPO1, .init_data = &gpo1_init },
560 { .id = MC13892_GPO2, .init_data = &gpo2_init },
561 { .id = MC13892_GPO3, .init_data = &gpo3_init },
562 { .id = MC13892_GPO4, .init_data = &gpo4_init },
563 { .id = MC13892_PWGT1SPI, .init_data = &pwgt1_init },
564 { .id = MC13892_PWGT2SPI, .init_data = &pwgt2_init },
565 { .id = MC13892_VCOINCELL, .init_data = &vcoincell_init },
566};
567
568static struct mc13xxx_platform_data mx51_efika_mc13892_data = {
569 .flags = MC13XXX_USE_RTC | MC13XXX_USE_REGULATOR,
Andres Salomon251290a2011-03-04 08:06:53 -0800570 .regulators = {
571 .num_regulators = ARRAY_SIZE(mx51_efika_regulators),
572 .regulators = mx51_efika_regulators,
573 },
Arnaud Patard (Rtp)2432cff2011-02-17 15:31:30 +0100574};
575
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100576static struct spi_board_info mx51_efika_spi_board_info[] __initdata = {
577 {
578 .modalias = "m25p80",
579 .max_speed_hz = 25000000,
580 .bus_num = 0,
581 .chip_select = 1,
582 .platform_data = &mx51_efika_spi_flash_data,
583 .irq = -1,
584 },
Arnaud Patard (Rtp)2432cff2011-02-17 15:31:30 +0100585 {
586 .modalias = "mc13892",
587 .max_speed_hz = 1000000,
588 .bus_num = 0,
589 .chip_select = 0,
590 .platform_data = &mx51_efika_mc13892_data,
591 .irq = gpio_to_irq(EFIKAMX_PMIC),
592 },
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100593};
594
595static int mx51_efika_spi_cs[] = {
596 EFIKAMX_SPI_CS0,
597 EFIKAMX_SPI_CS1,
598};
599
600static const struct spi_imx_master mx51_efika_spi_pdata __initconst = {
601 .chipselect = mx51_efika_spi_cs,
602 .num_chipselect = ARRAY_SIZE(mx51_efika_spi_cs),
603};
604
605void __init efika_board_common_init(void)
606{
607 mxc_iomux_v3_setup_multiple_pads(mx51efika_pads,
608 ARRAY_SIZE(mx51efika_pads));
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100609 imx51_add_imx_uart(0, &uart_pdata);
Arnaud Patard (Rtp)9d72af62011-02-17 15:31:29 +0100610 mx51_efika_usb();
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100611 imx51_add_sdhci_esdhc_imx(0, NULL);
612
Arnaud Patard (Rtp)2432cff2011-02-17 15:31:30 +0100613 /* FIXME: comes from original code. check this. */
614 if (mx51_revision() < IMX_CHIP_REVISION_2_0)
615 sw2_init.constraints.state_mem.uV = 1100000;
616 else if (mx51_revision() == IMX_CHIP_REVISION_2_0) {
617 sw2_init.constraints.state_mem.uV = 1250000;
618 sw1_init.constraints.state_mem.uV = 1000000;
619 }
620 if (machine_is_mx51_efikasb())
621 vgen1_init.constraints.max_uV = 1200000;
622
623 gpio_request(EFIKAMX_PMIC, "pmic irq");
624 gpio_direction_input(EFIKAMX_PMIC);
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100625 spi_register_board_info(mx51_efika_spi_board_info,
626 ARRAY_SIZE(mx51_efika_spi_board_info));
627 imx51_add_ecspi(0, &mx51_efika_spi_pdata);
Arnaud Patard (Rtp)856e6562011-02-17 15:31:31 +0100628
629#if defined(CONFIG_CPU_FREQ_IMX)
630 get_cpu_op = mx51_get_cpu_op;
631#endif
Arnaud Patard (Rtp)7ac18a32011-02-17 15:31:28 +0100632}