Merge branch 'fix/rt5645' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[deliverable/linux.git] / arch / arm / mach-pxa / em-x270.c
CommitLineData
3d50527b 1/*
3c85bce6 2 * Support for CompuLab EM-X270 platform
3d50527b 3 *
3c85bce6 4 * Copyright (C) 2007, 2008 CompuLab, Ltd.
3d50527b
MR
5 * Author: Mike Rapoport <mike@compulab.co.il>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/irq.h>
13#include <linux/platform_device.h>
7f14a787 14#include <linux/delay.h>
3d50527b
MR
15
16#include <linux/dm9000.h>
17#include <linux/rtc-v3020.h>
3d50527b
MR
18#include <linux/mtd/nand.h>
19#include <linux/mtd/partitions.h>
28c88046 20#include <linux/mtd/physmap.h>
3c85bce6
MR
21#include <linux/input.h>
22#include <linux/gpio_keys.h>
23#include <linux/gpio.h>
28c88046
MR
24#include <linux/mfd/da903x.h>
25#include <linux/regulator/machine.h>
26#include <linux/spi/spi.h>
27#include <linux/spi/tdo24m.h>
c9be0e39 28#include <linux/spi/libertas_spi.h>
8348c259 29#include <linux/spi/pxa2xx_spi.h>
9f055c49
MR
30#include <linux/power_supply.h>
31#include <linux/apm-emulation.h>
76e3fc36 32#include <linux/i2c.h>
5877457a 33#include <linux/platform_data/pca953x.h>
b459396e 34#include <linux/i2c/pxa-i2c.h>
a37ed431 35#include <linux/regulator/userspace-consumer.h>
28c88046
MR
36
37#include <media/soc_camera.h>
3d50527b
MR
38
39#include <asm/mach-types.h>
3d50527b
MR
40#include <asm/mach/arch.h>
41
51c62982 42#include <mach/pxa27x.h>
a09e64fb
RK
43#include <mach/pxa27x-udc.h>
44#include <mach/audio.h>
293b2da1
AB
45#include <linux/platform_data/video-pxafb.h>
46#include <linux/platform_data/usb-ohci-pxa27x.h>
47#include <linux/platform_data/mmc-pxamci.h>
48#include <linux/platform_data/keypad-pxa27x.h>
49#include <linux/platform_data/camera-pxa.h>
3d50527b
MR
50
51#include "generic.h"
6432f46c 52#include "devices.h"
3d50527b 53
7f14a787 54/* EM-X270 specific GPIOs */
3c85bce6 55#define GPIO13_MMC_CD (13)
7f14a787
MR
56#define GPIO95_MMC_WP (95)
57#define GPIO56_NAND_RB (56)
76e3fc36 58#define GPIO93_CAM_RESET (93)
128d88b8 59#define GPIO16_USB_HUB_RESET (16)
3c85bce6 60
7f14a787
MR
61/* eXeda specific GPIOs */
62#define GPIO114_MMC_CD (114)
63#define GPIO20_NAND_RB (20)
64#define GPIO38_SD_PWEN (38)
76e3fc36
MR
65#define GPIO37_WLAN_RST (37)
66#define GPIO95_TOUCHPAD_INT (95)
67#define GPIO130_CAM_RESET (130)
128d88b8 68#define GPIO10_USB_HUB_RESET (10)
3c85bce6 69
7f14a787
MR
70/* common GPIOs */
71#define GPIO11_NAND_CS (11)
7f14a787 72#define GPIO41_ETHIRQ (41)
6384fdad 73#define EM_X270_ETHIRQ PXA_GPIO_TO_IRQ(GPIO41_ETHIRQ)
c9be0e39
MR
74#define GPIO115_WLAN_PWEN (115)
75#define GPIO19_WLAN_STRAP (19)
128d88b8 76#define GPIO9_USB_VBUS_EN (9)
28c88046 77
4a697e83
MR
78static int mmc_cd;
79static int nand_rb;
80static int dm9000_flags;
76e3fc36 81static int cam_reset;
128d88b8 82static int usb_hub_reset;
4a697e83
MR
83
84static unsigned long common_pin_config[] = {
3c85bce6
MR
85 /* AC'97 */
86 GPIO28_AC97_BITCLK,
87 GPIO29_AC97_SDATA_IN_0,
88 GPIO30_AC97_SDATA_OUT,
89 GPIO31_AC97_SYNC,
90 GPIO98_AC97_SYSCLK,
91 GPIO113_AC97_nRESET,
92
93 /* BTUART */
94 GPIO42_BTUART_RXD,
95 GPIO43_BTUART_TXD,
96 GPIO44_BTUART_CTS,
97 GPIO45_BTUART_RTS,
98
99 /* STUART */
100 GPIO46_STUART_RXD,
101 GPIO47_STUART_TXD,
102
103 /* MCI controller */
104 GPIO32_MMC_CLK,
105 GPIO112_MMC_CMD,
106 GPIO92_MMC_DAT_0,
107 GPIO109_MMC_DAT_1,
108 GPIO110_MMC_DAT_2,
109 GPIO111_MMC_DAT_3,
110
111 /* LCD */
bedbda97 112 GPIOxx_LCD_TFT_16BPP,
3c85bce6
MR
113
114 /* QCI */
115 GPIO84_CIF_FV,
116 GPIO25_CIF_LV,
117 GPIO53_CIF_MCLK,
118 GPIO54_CIF_PCLK,
119 GPIO81_CIF_DD_0,
120 GPIO55_CIF_DD_1,
121 GPIO51_CIF_DD_2,
122 GPIO50_CIF_DD_3,
123 GPIO52_CIF_DD_4,
124 GPIO48_CIF_DD_5,
125 GPIO17_CIF_DD_6,
126 GPIO12_CIF_DD_7,
127
128 /* I2C */
129 GPIO117_I2C_SCL,
130 GPIO118_I2C_SDA,
131
132 /* Keypad */
133 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
134 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
135 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
136 GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
137 GPIO39_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
138 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
139 GPIO91_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH,
140 GPIO36_KP_MKIN_7 | WAKEUP_ON_LEVEL_HIGH,
141 GPIO103_KP_MKOUT_0,
142 GPIO104_KP_MKOUT_1,
143 GPIO105_KP_MKOUT_2,
144 GPIO106_KP_MKOUT_3,
145 GPIO107_KP_MKOUT_4,
146 GPIO108_KP_MKOUT_5,
147 GPIO96_KP_MKOUT_6,
148 GPIO22_KP_MKOUT_7,
149
150 /* SSP1 */
151 GPIO26_SSP1_RXD,
152 GPIO23_SSP1_SCLK,
153 GPIO24_SSP1_SFRM,
154 GPIO57_SSP1_TXD,
155
156 /* SSP2 */
c9be0e39
MR
157 GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */
158 GPIO14_GPIO,
3c85bce6
MR
159 GPIO89_SSP2_TXD,
160 GPIO88_SSP2_RXD,
161
162 /* SDRAM and local bus */
163 GPIO15_nCS_1,
164 GPIO78_nCS_2,
165 GPIO79_nCS_3,
166 GPIO80_nCS_4,
167 GPIO49_nPWE,
168 GPIO18_RDY,
169
170 /* GPIO */
6432f46c 171 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */
3c85bce6
MR
172
173 /* power controls */
174 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
175 GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */
176
177 /* NAND controls */
178 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
3c85bce6
MR
179
180 /* interrupts */
3c85bce6
MR
181 GPIO41_GPIO, /* DM9000 interrupt */
182};
3d50527b 183
4a697e83 184static unsigned long em_x270_pin_config[] = {
76e3fc36 185 GPIO13_GPIO, /* MMC card detect */
128d88b8 186 GPIO16_GPIO, /* USB hub reset */
76e3fc36
MR
187 GPIO56_GPIO, /* NAND Ready/Busy */
188 GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */
189 GPIO95_GPIO, /* MMC Write protect */
4a697e83
MR
190};
191
7f14a787 192static unsigned long exeda_pin_config[] = {
128d88b8 193 GPIO10_GPIO, /* USB hub reset */
7f14a787
MR
194 GPIO20_GPIO, /* NAND Ready/Busy */
195 GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */
76e3fc36 196 GPIO95_GPIO, /* touchpad IRQ */
7f14a787
MR
197 GPIO114_GPIO, /* MMC card detect */
198};
199
3c85bce6
MR
200#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
201static struct resource em_x270_dm9000_resource[] = {
3d50527b
MR
202 [0] = {
203 .start = PXA_CS2_PHYS,
204 .end = PXA_CS2_PHYS + 3,
205 .flags = IORESOURCE_MEM,
206 },
207 [1] = {
208 .start = PXA_CS2_PHYS + 8,
209 .end = PXA_CS2_PHYS + 8 + 0x3f,
210 .flags = IORESOURCE_MEM,
211 },
212 [2] = {
213 .start = EM_X270_ETHIRQ,
214 .end = EM_X270_ETHIRQ,
3c85bce6 215 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
3d50527b
MR
216 }
217};
218
3c85bce6 219static struct dm9000_plat_data em_x270_dm9000_platdata = {
4a697e83 220 .flags = DM9000_PLATF_NO_EEPROM,
3d50527b
MR
221};
222
3c85bce6 223static struct platform_device em_x270_dm9000 = {
3d50527b
MR
224 .name = "dm9000",
225 .id = 0,
3c85bce6
MR
226 .num_resources = ARRAY_SIZE(em_x270_dm9000_resource),
227 .resource = em_x270_dm9000_resource,
3d50527b 228 .dev = {
3c85bce6 229 .platform_data = &em_x270_dm9000_platdata,
3d50527b
MR
230 }
231};
232
3c85bce6
MR
233static void __init em_x270_init_dm9000(void)
234{
4a697e83 235 em_x270_dm9000_platdata.flags |= dm9000_flags;
3c85bce6
MR
236 platform_device_register(&em_x270_dm9000);
237}
238#else
239static inline void em_x270_init_dm9000(void) {}
240#endif
3d50527b 241
3c85bce6
MR
242/* V3020 RTC */
243#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
3d50527b
MR
244static struct resource em_x270_v3020_resource[] = {
245 [0] = {
246 .start = PXA_CS4_PHYS,
247 .end = PXA_CS4_PHYS + 3,
248 .flags = IORESOURCE_MEM,
249 },
250};
251
252static struct v3020_platform_data em_x270_v3020_platdata = {
253 .leftshift = 0,
254};
255
256static struct platform_device em_x270_rtc = {
257 .name = "v3020",
258 .num_resources = ARRAY_SIZE(em_x270_v3020_resource),
259 .resource = em_x270_v3020_resource,
260 .id = -1,
261 .dev = {
262 .platform_data = &em_x270_v3020_platdata,
263 }
264};
265
3c85bce6
MR
266static void __init em_x270_init_rtc(void)
267{
268 platform_device_register(&em_x270_rtc);
269}
270#else
271static inline void em_x270_init_rtc(void) {}
272#endif
3d50527b 273
3c85bce6
MR
274/* NAND flash */
275#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
3d50527b
MR
276static inline void nand_cs_on(void)
277{
3c85bce6 278 gpio_set_value(GPIO11_NAND_CS, 0);
3d50527b
MR
279}
280
281static void nand_cs_off(void)
282{
283 dsb();
284
3c85bce6 285 gpio_set_value(GPIO11_NAND_CS, 1);
3d50527b
MR
286}
287
288/* hardware specific access to control-lines */
289static void em_x270_nand_cmd_ctl(struct mtd_info *mtd, int dat,
290 unsigned int ctrl)
291{
292 struct nand_chip *this = mtd->priv;
293 unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
294
295 dsb();
296
297 if (ctrl & NAND_CTRL_CHANGE) {
298 if (ctrl & NAND_ALE)
299 nandaddr |= (1 << 3);
300 else
301 nandaddr &= ~(1 << 3);
302 if (ctrl & NAND_CLE)
303 nandaddr |= (1 << 2);
304 else
305 nandaddr &= ~(1 << 2);
306 if (ctrl & NAND_NCE)
307 nand_cs_on();
308 else
309 nand_cs_off();
310 }
311
312 dsb();
313 this->IO_ADDR_W = (void __iomem *)nandaddr;
314 if (dat != NAND_CMD_NONE)
315 writel(dat, this->IO_ADDR_W);
316
317 dsb();
318}
319
320/* read device ready pin */
321static int em_x270_nand_device_ready(struct mtd_info *mtd)
322{
323 dsb();
324
4a697e83 325 return gpio_get_value(nand_rb);
3d50527b
MR
326}
327
328static struct mtd_partition em_x270_partition_info[] = {
329 [0] = {
330 .name = "em_x270-0",
331 .offset = 0,
332 .size = SZ_4M,
333 },
334 [1] = {
335 .name = "em_x270-1",
336 .offset = MTDPART_OFS_APPEND,
337 .size = MTDPART_SIZ_FULL
338 },
339};
340
3d50527b
MR
341struct platform_nand_data em_x270_nand_platdata = {
342 .chip = {
343 .nr_chips = 1,
344 .chip_offset = 0,
345 .nr_partitions = ARRAY_SIZE(em_x270_partition_info),
346 .partitions = em_x270_partition_info,
347 .chip_delay = 20,
3d50527b
MR
348 },
349 .ctrl = {
350 .hwcontrol = 0,
351 .dev_ready = em_x270_nand_device_ready,
352 .select_chip = 0,
353 .cmd_ctrl = em_x270_nand_cmd_ctl,
354 },
355};
356
357static struct resource em_x270_nand_resource[] = {
358 [0] = {
359 .start = PXA_CS1_PHYS,
360 .end = PXA_CS1_PHYS + 12,
361 .flags = IORESOURCE_MEM,
362 },
363};
364
365static struct platform_device em_x270_nand = {
366 .name = "gen_nand",
367 .num_resources = ARRAY_SIZE(em_x270_nand_resource),
368 .resource = em_x270_nand_resource,
369 .id = -1,
370 .dev = {
371 .platform_data = &em_x270_nand_platdata,
372 }
373};
374
3c85bce6
MR
375static void __init em_x270_init_nand(void)
376{
377 int err;
3d50527b 378
3c85bce6
MR
379 err = gpio_request(GPIO11_NAND_CS, "NAND CS");
380 if (err) {
7b472ac7 381 pr_warn("EM-X270: failed to request NAND CS gpio\n");
3c85bce6
MR
382 return;
383 }
384
385 gpio_direction_output(GPIO11_NAND_CS, 1);
386
4a697e83 387 err = gpio_request(nand_rb, "NAND R/B");
3c85bce6 388 if (err) {
7b472ac7 389 pr_warn("EM-X270: failed to request NAND R/B gpio\n");
3c85bce6
MR
390 gpio_free(GPIO11_NAND_CS);
391 return;
392 }
393
4a697e83 394 gpio_direction_input(nand_rb);
3c85bce6
MR
395
396 platform_device_register(&em_x270_nand);
397}
398#else
399static inline void em_x270_init_nand(void) {}
400#endif
3d50527b 401
28c88046
MR
402#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
403static struct mtd_partition em_x270_nor_parts[] = {
404 {
405 .name = "Bootloader",
406 .offset = 0x00000000,
407 .size = 0x00050000,
408 .mask_flags = MTD_WRITEABLE /* force read-only */
409 }, {
410 .name = "Environment",
411 .offset = 0x00050000,
412 .size = 0x00010000,
413 }, {
414 .name = "Reserved",
415 .offset = 0x00060000,
416 .size = 0x00050000,
417 .mask_flags = MTD_WRITEABLE /* force read-only */
418 }, {
419 .name = "Splashscreen",
420 .offset = 0x000b0000,
421 .size = 0x00050000,
422 }
423};
424
425static struct physmap_flash_data em_x270_nor_data[] = {
426 [0] = {
427 .width = 2,
428 .parts = em_x270_nor_parts,
429 .nr_parts = ARRAY_SIZE(em_x270_nor_parts),
430 },
431};
432
433static struct resource em_x270_nor_flash_resource = {
434 .start = PXA_CS0_PHYS,
435 .end = PXA_CS0_PHYS + SZ_1M - 1,
436 .flags = IORESOURCE_MEM,
437};
438
439static struct platform_device em_x270_physmap_flash = {
440 .name = "physmap-flash",
441 .id = 0,
442 .num_resources = 1,
443 .resource = &em_x270_nor_flash_resource,
444 .dev = {
445 .platform_data = &em_x270_nor_data,
446 },
447};
448
449static void __init em_x270_init_nor(void)
450{
451 platform_device_register(&em_x270_physmap_flash);
452}
453#else
454static inline void em_x270_init_nor(void) {}
455#endif
456
3d50527b 457/* PXA27x OHCI controller setup */
3c85bce6 458#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
128d88b8
MR
459static struct regulator *em_x270_usb_ldo;
460
461static int em_x270_usb_hub_init(void)
462{
463 int err;
464
465 em_x270_usb_ldo = regulator_get(NULL, "vcc usb");
466 if (IS_ERR(em_x270_usb_ldo))
467 return PTR_ERR(em_x270_usb_ldo);
468
469 err = gpio_request(GPIO9_USB_VBUS_EN, "vbus en");
470 if (err)
471 goto err_free_usb_ldo;
472
473 err = gpio_request(usb_hub_reset, "hub rst");
474 if (err)
475 goto err_free_vbus_gpio;
476
477 /* USB Hub power-on and reset */
1b82e4c3
IG
478 gpio_direction_output(usb_hub_reset, 1);
479 gpio_direction_output(GPIO9_USB_VBUS_EN, 0);
a829abf8
AB
480 err = regulator_enable(em_x270_usb_ldo);
481 if (err)
482 goto err_free_rst_gpio;
483
128d88b8 484 gpio_set_value(usb_hub_reset, 0);
1b82e4c3 485 gpio_set_value(usb_hub_reset, 1);
128d88b8 486 regulator_disable(em_x270_usb_ldo);
a829abf8
AB
487 err = regulator_enable(em_x270_usb_ldo);
488 if (err)
489 goto err_free_rst_gpio;
490
1b82e4c3
IG
491 gpio_set_value(usb_hub_reset, 0);
492 gpio_set_value(GPIO9_USB_VBUS_EN, 1);
128d88b8
MR
493
494 return 0;
495
a829abf8
AB
496err_free_rst_gpio:
497 gpio_free(usb_hub_reset);
128d88b8
MR
498err_free_vbus_gpio:
499 gpio_free(GPIO9_USB_VBUS_EN);
500err_free_usb_ldo:
501 regulator_put(em_x270_usb_ldo);
502
503 return err;
504}
505
3d50527b
MR
506static int em_x270_ohci_init(struct device *dev)
507{
128d88b8
MR
508 int err;
509
510 /* we don't want to entirely disable USB if the HUB init failed */
511 err = em_x270_usb_hub_init();
512 if (err)
513 pr_err("USB Hub initialization failed: %d\n", err);
514
3d50527b
MR
515 /* enable port 2 transiever */
516 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE;
517
518 return 0;
519}
520
128d88b8
MR
521static void em_x270_ohci_exit(struct device *dev)
522{
523 gpio_free(usb_hub_reset);
524 gpio_free(GPIO9_USB_VBUS_EN);
525
526 if (!IS_ERR(em_x270_usb_ldo)) {
527 if (regulator_is_enabled(em_x270_usb_ldo))
528 regulator_disable(em_x270_usb_ldo);
529
530 regulator_put(em_x270_usb_ldo);
531 }
532}
533
3d50527b
MR
534static struct pxaohci_platform_data em_x270_ohci_platform_data = {
535 .port_mode = PMM_PERPORT_MODE,
097b5334 536 .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW,
3d50527b 537 .init = em_x270_ohci_init,
128d88b8 538 .exit = em_x270_ohci_exit,
3d50527b
MR
539};
540
3c85bce6
MR
541static void __init em_x270_init_ohci(void)
542{
543 pxa_set_ohci_info(&em_x270_ohci_platform_data);
544}
545#else
546static inline void em_x270_init_ohci(void) {}
547#endif
3d50527b 548
3c85bce6
MR
549/* MCI controller setup */
550#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
6432f46c
MR
551static struct regulator *em_x270_sdio_ldo;
552
3d50527b
MR
553static int em_x270_mci_init(struct device *dev,
554 irq_handler_t em_x270_detect_int,
555 void *data)
556{
6432f46c
MR
557 int err;
558
559 em_x270_sdio_ldo = regulator_get(dev, "vcc sdio");
560 if (IS_ERR(em_x270_sdio_ldo)) {
561 dev_err(dev, "can't request SDIO power supply: %ld\n",
562 PTR_ERR(em_x270_sdio_ldo));
563 return PTR_ERR(em_x270_sdio_ldo);
564 }
565
4a697e83 566 err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
ed7936f9 567 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
3c85bce6 568 "MMC card detect", data);
3d50527b 569 if (err) {
6432f46c
MR
570 dev_err(dev, "can't request MMC card detect IRQ: %d\n", err);
571 goto err_irq;
572 }
573
7f14a787
MR
574 if (machine_is_em_x270()) {
575 err = gpio_request(GPIO95_MMC_WP, "MMC WP");
576 if (err) {
577 dev_err(dev, "can't request MMC write protect: %d\n",
578 err);
579 goto err_gpio_wp;
580 }
581 gpio_direction_input(GPIO95_MMC_WP);
582 } else {
583 err = gpio_request(GPIO38_SD_PWEN, "sdio power");
584 if (err) {
585 dev_err(dev, "can't request MMC power control : %d\n",
586 err);
587 goto err_gpio_wp;
588 }
589 gpio_direction_output(GPIO38_SD_PWEN, 1);
3d50527b
MR
590 }
591
592 return 0;
6432f46c
MR
593
594err_gpio_wp:
4a697e83 595 free_irq(gpio_to_irq(mmc_cd), data);
6432f46c
MR
596err_irq:
597 regulator_put(em_x270_sdio_ldo);
598
599 return err;
3d50527b
MR
600}
601
a829abf8 602static int em_x270_mci_setpower(struct device *dev, unsigned int vdd)
3d50527b 603{
6432f46c
MR
604 struct pxamci_platform_data* p_d = dev->platform_data;
605
606 if ((1 << vdd) & p_d->ocr_mask) {
607 int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000;
608
609 regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV);
a829abf8 610 return regulator_enable(em_x270_sdio_ldo);
6432f46c
MR
611 } else {
612 regulator_disable(em_x270_sdio_ldo);
613 }
a829abf8 614 return 0;
3d50527b
MR
615}
616
617static void em_x270_mci_exit(struct device *dev, void *data)
618{
4a697e83 619 free_irq(gpio_to_irq(mmc_cd), data);
7f14a787
MR
620 regulator_put(em_x270_sdio_ldo);
621
622 if (machine_is_em_x270())
623 gpio_free(GPIO95_MMC_WP);
624 else
625 gpio_free(GPIO38_SD_PWEN);
6432f46c
MR
626}
627
628static int em_x270_mci_get_ro(struct device *dev)
629{
630 return gpio_get_value(GPIO95_MMC_WP);
3d50527b
MR
631}
632
633static struct pxamci_platform_data em_x270_mci_platform_data = {
f97cab28 634 .detect_delay_ms = 250,
7a648256
RJ
635 .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23|
636 MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27|
637 MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
638 MMC_VDD_30_31|MMC_VDD_31_32,
639 .init = em_x270_mci_init,
640 .setpower = em_x270_mci_setpower,
641 .exit = em_x270_mci_exit,
642 .gpio_card_detect = -1,
643 .gpio_card_ro = -1,
644 .gpio_power = -1,
3d50527b
MR
645};
646
3c85bce6
MR
647static void __init em_x270_init_mmc(void)
648{
7f14a787
MR
649 if (machine_is_em_x270())
650 em_x270_mci_platform_data.get_ro = em_x270_mci_get_ro;
651
3c85bce6
MR
652 pxa_set_mci_info(&em_x270_mci_platform_data);
653}
654#else
655static inline void em_x270_init_mmc(void) {}
656#endif
657
28c88046 658/* LCD */
3c85bce6 659#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
28c88046
MR
660static struct pxafb_mode_info em_x270_lcd_modes[] = {
661 [0] = {
662 .pixclock = 38250,
663 .bpp = 16,
664 .xres = 480,
665 .yres = 640,
666 .hsync_len = 8,
667 .vsync_len = 2,
668 .left_margin = 8,
669 .upper_margin = 2,
670 .right_margin = 24,
671 .lower_margin = 4,
672 .sync = 0,
673 },
674 [1] = {
675 .pixclock = 153800,
676 .bpp = 16,
677 .xres = 240,
678 .yres = 320,
679 .hsync_len = 8,
680 .vsync_len = 2,
681 .left_margin = 8,
682 .upper_margin = 2,
683 .right_margin = 88,
684 .lower_margin = 2,
685 .sync = 0,
686 },
3d50527b
MR
687};
688
689static struct pxafb_mach_info em_x270_lcd = {
28c88046
MR
690 .modes = em_x270_lcd_modes,
691 .num_modes = 2,
3c85bce6 692 .lcd_conn = LCD_COLOR_TFT_16BPP,
3d50527b 693};
28c88046 694
3c85bce6 695static void __init em_x270_init_lcd(void)
3d50527b 696{
4321e1a1 697 pxa_set_fb_info(NULL, &em_x270_lcd);
3c85bce6
MR
698}
699#else
700static inline void em_x270_init_lcd(void) {}
701#endif
3d50527b 702
28c88046
MR
703#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
704static struct pxa2xx_spi_master em_x270_spi_info = {
705 .num_chipselect = 1,
706};
707
708static struct pxa2xx_spi_chip em_x270_tdo24m_chip = {
bd9d0740
MR
709 .rx_threshold = 1,
710 .tx_threshold = 1,
711 .gpio_cs = -1,
28c88046
MR
712};
713
714static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
715 .model = TDO35S,
716};
717
c9be0e39
MR
718static struct pxa2xx_spi_master em_x270_spi_2_info = {
719 .num_chipselect = 1,
720 .enable_dma = 1,
721};
722
723static struct pxa2xx_spi_chip em_x270_libertas_chip = {
724 .rx_threshold = 1,
725 .tx_threshold = 1,
726 .timeout = 1000,
3cb05c97 727 .gpio_cs = 14,
c9be0e39
MR
728};
729
730static unsigned long em_x270_libertas_pin_config[] = {
731 /* SSP2 */
732 GPIO19_SSP2_SCLK,
733 GPIO14_GPIO,
734 GPIO89_SSP2_TXD,
735 GPIO88_SSP2_RXD,
736};
737
738static int em_x270_libertas_setup(struct spi_device *spi)
739{
740 int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN");
741 if (err)
742 return err;
743
2f15cb59
MR
744 err = gpio_request(GPIO19_WLAN_STRAP, "WLAN STRAP");
745 if (err)
746 goto err_free_pwen;
747
748 if (machine_is_exeda()) {
749 err = gpio_request(GPIO37_WLAN_RST, "WLAN RST");
750 if (err)
751 goto err_free_strap;
752
753 gpio_direction_output(GPIO37_WLAN_RST, 1);
754 msleep(100);
755 }
756
c9be0e39 757 gpio_direction_output(GPIO19_WLAN_STRAP, 1);
2f15cb59 758 msleep(100);
c9be0e39
MR
759
760 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config));
761
762 gpio_direction_output(GPIO115_WLAN_PWEN, 0);
2f15cb59 763 msleep(100);
c9be0e39 764 gpio_set_value(GPIO115_WLAN_PWEN, 1);
2f15cb59 765 msleep(100);
c9be0e39
MR
766
767 spi->bits_per_word = 16;
768 spi_setup(spi);
769
770 return 0;
2f15cb59
MR
771
772err_free_strap:
773 gpio_free(GPIO19_WLAN_STRAP);
774err_free_pwen:
775 gpio_free(GPIO115_WLAN_PWEN);
776
777 return err;
c9be0e39
MR
778}
779
780static int em_x270_libertas_teardown(struct spi_device *spi)
781{
782 gpio_set_value(GPIO115_WLAN_PWEN, 0);
783 gpio_free(GPIO115_WLAN_PWEN);
2f15cb59
MR
784 gpio_free(GPIO19_WLAN_STRAP);
785
786 if (machine_is_exeda()) {
787 gpio_set_value(GPIO37_WLAN_RST, 0);
788 gpio_free(GPIO37_WLAN_RST);
789 }
c9be0e39
MR
790
791 return 0;
792}
793
794struct libertas_spi_platform_data em_x270_libertas_pdata = {
795 .use_dummy_writes = 1,
c9be0e39
MR
796 .setup = em_x270_libertas_setup,
797 .teardown = em_x270_libertas_teardown,
798};
799
28c88046
MR
800static struct spi_board_info em_x270_spi_devices[] __initdata = {
801 {
c9be0e39
MR
802 .modalias = "tdo24m",
803 .max_speed_hz = 1000000,
804 .bus_num = 1,
805 .chip_select = 0,
806 .controller_data = &em_x270_tdo24m_chip,
807 .platform_data = &em_x270_tdo24m_pdata,
808 },
809 {
810 .modalias = "libertas_spi",
811 .max_speed_hz = 13000000,
812 .bus_num = 2,
6384fdad 813 .irq = PXA_GPIO_TO_IRQ(116),
c9be0e39
MR
814 .chip_select = 0,
815 .controller_data = &em_x270_libertas_chip,
816 .platform_data = &em_x270_libertas_pdata,
28c88046
MR
817 },
818};
819
820static void __init em_x270_init_spi(void)
821{
822 pxa2xx_set_spi_info(1, &em_x270_spi_info);
c9be0e39 823 pxa2xx_set_spi_info(2, &em_x270_spi_2_info);
28c88046
MR
824 spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
825}
826#else
827static inline void em_x270_init_spi(void) {}
828#endif
829
303f2d7d 830#if defined(CONFIG_SND_PXA2XX_LIB_AC97)
c63a5751
MR
831static pxa2xx_audio_ops_t em_x270_ac97_info = {
832 .reset_gpio = 113,
833};
834
3c85bce6
MR
835static void __init em_x270_init_ac97(void)
836{
c63a5751 837 pxa_set_ac97_info(&em_x270_ac97_info);
3c85bce6
MR
838}
839#else
840static inline void em_x270_init_ac97(void) {}
841#endif
842
843#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
0a085a94 844static const unsigned int em_x270_module_matrix_keys[] = {
3c85bce6
MR
845 KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
846 KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
847 KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
848};
3d50527b 849
0a085a94
CX
850static struct matrix_keymap_data em_x270_matrix_keymap_data = {
851 .keymap = em_x270_module_matrix_keys,
852 .keymap_size = ARRAY_SIZE(em_x270_module_matrix_keys),
853};
854
7f14a787 855struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
3c85bce6
MR
856 /* code map for the matrix keys */
857 .matrix_key_rows = 3,
858 .matrix_key_cols = 3,
0a085a94 859 .matrix_keymap_data = &em_x270_matrix_keymap_data,
7f14a787
MR
860};
861
0a085a94 862static const unsigned int em_x270_exeda_matrix_keys[] = {
7f14a787
MR
863 KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
864 KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
865 KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
866 KEY(0, 6, KEY_ENTER), KEY(0, 7, KEY_SLASH),
867
868 KEY(1, 0, KEY_DOT), KEY(1, 1, KEY_M),
869 KEY(1, 2, KEY_N), KEY(1, 3, KEY_B),
870 KEY(1, 4, KEY_V), KEY(1, 5, KEY_C),
871 KEY(1, 6, KEY_X), KEY(1, 7, KEY_Z),
872
873 KEY(2, 0, KEY_LEFTSHIFT), KEY(2, 1, KEY_SEMICOLON),
874 KEY(2, 2, KEY_L), KEY(2, 3, KEY_K),
875 KEY(2, 4, KEY_J), KEY(2, 5, KEY_H),
876 KEY(2, 6, KEY_G), KEY(2, 7, KEY_F),
877
878 KEY(3, 0, KEY_D), KEY(3, 1, KEY_S),
879 KEY(3, 2, KEY_A), KEY(3, 3, KEY_TAB),
880 KEY(3, 4, KEY_BACKSPACE), KEY(3, 5, KEY_P),
881 KEY(3, 6, KEY_O), KEY(3, 7, KEY_I),
882
883 KEY(4, 0, KEY_U), KEY(4, 1, KEY_Y),
884 KEY(4, 2, KEY_T), KEY(4, 3, KEY_R),
885 KEY(4, 4, KEY_E), KEY(4, 5, KEY_W),
886 KEY(4, 6, KEY_Q), KEY(4, 7, KEY_MINUS),
887
888 KEY(5, 0, KEY_0), KEY(5, 1, KEY_9),
889 KEY(5, 2, KEY_8), KEY(5, 3, KEY_7),
890 KEY(5, 4, KEY_6), KEY(5, 5, KEY_5),
891 KEY(5, 6, KEY_4), KEY(5, 7, KEY_3),
892
893 KEY(6, 0, KEY_2), KEY(6, 1, KEY_1),
894 KEY(6, 2, KEY_ENTER), KEY(6, 3, KEY_END),
895 KEY(6, 4, KEY_DOWN), KEY(6, 5, KEY_UP),
896 KEY(6, 6, KEY_MENU), KEY(6, 7, KEY_F1),
897
898 KEY(7, 0, KEY_LEFT), KEY(7, 1, KEY_RIGHT),
899 KEY(7, 2, KEY_BACK), KEY(7, 3, KEY_HOME),
900 KEY(7, 4, 0), KEY(7, 5, 0),
901 KEY(7, 6, 0), KEY(7, 7, 0),
902};
903
0a085a94
CX
904static struct matrix_keymap_data em_x270_exeda_matrix_keymap_data = {
905 .keymap = em_x270_exeda_matrix_keys,
906 .keymap_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
907};
908
7f14a787
MR
909struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
910 /* code map for the matrix keys */
911 .matrix_key_rows = 8,
912 .matrix_key_cols = 8,
0a085a94 913 .matrix_keymap_data = &em_x270_exeda_matrix_keymap_data,
3c85bce6
MR
914};
915
916static void __init em_x270_init_keypad(void)
917{
7f14a787
MR
918 if (machine_is_em_x270())
919 pxa_set_keypad_info(&em_x270_module_keypad_info);
920 else
921 pxa_set_keypad_info(&em_x270_exeda_keypad_info);
3c85bce6
MR
922}
923#else
924static inline void em_x270_init_keypad(void) {}
925#endif
3d50527b 926
3c85bce6
MR
927#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
928static struct gpio_keys_button gpio_keys_button[] = {
929 [0] = {
930 .desc = "sleep/wakeup",
931 .code = KEY_SUSPEND,
932 .type = EV_PWR,
933 .gpio = 1,
934 .wakeup = 1,
935 },
936};
3d50527b 937
3c85bce6
MR
938static struct gpio_keys_platform_data em_x270_gpio_keys_data = {
939 .buttons = gpio_keys_button,
940 .nbuttons = 1,
941};
3d50527b 942
3c85bce6
MR
943static struct platform_device em_x270_gpio_keys = {
944 .name = "gpio-keys",
945 .id = -1,
946 .dev = {
947 .platform_data = &em_x270_gpio_keys_data,
948 },
949};
950
951static void __init em_x270_init_gpio_keys(void)
952{
953 platform_device_register(&em_x270_gpio_keys);
954}
955#else
956static inline void em_x270_init_gpio_keys(void) {}
957#endif
958
28c88046
MR
959/* Quick Capture Interface and sensor setup */
960#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
961static struct regulator *em_x270_camera_ldo;
962
a7f2bdb3 963static int em_x270_sensor_init(void)
28c88046
MR
964{
965 int ret;
966
76e3fc36 967 ret = gpio_request(cam_reset, "camera reset");
28c88046
MR
968 if (ret)
969 return ret;
970
76e3fc36 971 gpio_direction_output(cam_reset, 0);
28c88046
MR
972
973 em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
974 if (em_x270_camera_ldo == NULL) {
76e3fc36 975 gpio_free(cam_reset);
28c88046
MR
976 return -ENODEV;
977 }
978
979 ret = regulator_enable(em_x270_camera_ldo);
980 if (ret) {
981 regulator_put(em_x270_camera_ldo);
76e3fc36 982 gpio_free(cam_reset);
28c88046
MR
983 return ret;
984 }
985
76e3fc36 986 gpio_set_value(cam_reset, 1);
28c88046
MR
987
988 return 0;
989}
990
991struct pxacamera_platform_data em_x270_camera_platform_data = {
28c88046
MR
992 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
993 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
994 .mclk_10khz = 2600,
995};
996
997static int em_x270_sensor_power(struct device *dev, int on)
998{
999 int ret;
1000 int is_on = regulator_is_enabled(em_x270_camera_ldo);
1001
1002 if (on == is_on)
1003 return 0;
1004
76e3fc36 1005 gpio_set_value(cam_reset, !on);
28c88046
MR
1006
1007 if (on)
1008 ret = regulator_enable(em_x270_camera_ldo);
1009 else
1010 ret = regulator_disable(em_x270_camera_ldo);
1011
1012 if (ret)
1013 return ret;
1014
76e3fc36 1015 gpio_set_value(cam_reset, on);
28c88046
MR
1016
1017 return 0;
1018}
1019
28c88046
MR
1020static struct i2c_board_info em_x270_i2c_cam_info[] = {
1021 {
1022 I2C_BOARD_INFO("mt9m111", 0x48),
489db6a6
GL
1023 },
1024};
1025
1026static struct soc_camera_link iclink = {
1027 .bus_id = 0,
1028 .power = em_x270_sensor_power,
1029 .board_info = &em_x270_i2c_cam_info[0],
1030 .i2c_adapter_id = 0,
489db6a6
GL
1031};
1032
1033static struct platform_device em_x270_camera = {
1034 .name = "soc-camera-pdrv",
1035 .id = -1,
1036 .dev = {
28c88046
MR
1037 .platform_data = &iclink,
1038 },
1039};
1040
28c88046
MR
1041static void __init em_x270_init_camera(void)
1042{
a7f2bdb3
AO
1043 if (em_x270_sensor_init() == 0) {
1044 pxa_set_camera_info(&em_x270_camera_platform_data);
1045 platform_device_register(&em_x270_camera);
1046 }
28c88046
MR
1047}
1048#else
1049static inline void em_x270_init_camera(void) {}
1050#endif
1051
a37ed431
MR
1052static struct regulator_bulk_data em_x270_gps_consumer_supply = {
1053 .supply = "vcc gps",
1054};
1055
1056static struct regulator_userspace_consumer_data em_x270_gps_consumer_data = {
1057 .name = "vcc gps",
1058 .num_supplies = 1,
1059 .supplies = &em_x270_gps_consumer_supply,
1060};
1061
1062static struct platform_device em_x270_gps_userspace_consumer = {
1063 .name = "reg-userspace-consumer",
1064 .id = 0,
1065 .dev = {
1066 .platform_data = &em_x270_gps_consumer_data,
1067 },
1068};
1069
1070static struct regulator_bulk_data em_x270_gprs_consumer_supply = {
1071 .supply = "vcc gprs",
1072};
1073
1074static struct regulator_userspace_consumer_data em_x270_gprs_consumer_data = {
1075 .name = "vcc gprs",
1076 .num_supplies = 1,
1077 .supplies = &em_x270_gprs_consumer_supply
1078};
1079
1080static struct platform_device em_x270_gprs_userspace_consumer = {
1081 .name = "reg-userspace-consumer",
1082 .id = 1,
1083 .dev = {
1084 .platform_data = &em_x270_gprs_consumer_data,
1085 }
1086};
1087
1088static struct platform_device *em_x270_userspace_consumers[] = {
1089 &em_x270_gps_userspace_consumer,
1090 &em_x270_gprs_userspace_consumer,
1091};
1092
1093static void __init em_x270_userspace_consumers_init(void)
1094{
1095 platform_add_devices(ARRAY_AND_SIZE(em_x270_userspace_consumers));
1096}
1097
28c88046 1098/* DA9030 related initializations */
804d2312 1099#define REGULATOR_CONSUMER(_name, _dev_name, _supply) \
432adf18 1100 static struct regulator_consumer_supply _name##_consumers[] = { \
0bf189ab 1101 REGULATOR_SUPPLY(_supply, _dev_name), \
432adf18 1102 }
28c88046 1103
804d2312 1104REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
432adf18 1105REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
804d2312 1106REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");
432adf18 1107REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
804d2312 1108REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");
100a1d25 1109REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
432adf18
MR
1110
1111#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
1112 static struct regulator_init_data _ldo##_data = { \
1113 .constraints = { \
1114 .min_uV = _min_uV, \
1115 .max_uV = _max_uV, \
1116 .state_mem = { \
1117 .enabled = 0, \
1118 }, \
1119 .valid_ops_mask = _ops_mask, \
a37ed431 1120 .apply_uV = 1, \
432adf18
MR
1121 }, \
1122 .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \
1123 .consumer_supplies = _ldo##_consumers, \
1124 };
1125
1126REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
1127REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
1128REGULATOR_INIT(ldo10, 2000000, 3200000,
1129 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE);
1130REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
1131REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
100a1d25 1132REGULATOR_INIT(buck2, 1000000, 1650000, REGULATOR_CHANGE_VOLTAGE);
28c88046
MR
1133
1134struct led_info em_x270_led_info = {
1135 .name = "em-x270:orange",
1136 .default_trigger = "battery-charging-or-full",
1137};
1138
9f055c49 1139struct power_supply_info em_x270_psy_info = {
3690a0f4 1140 .name = "battery",
9f055c49
MR
1141 .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
1142 .voltage_max_design = 4200000,
1143 .voltage_min_design = 3000000,
1144 .use_for_apm = 1,
1145};
1146
1147static void em_x270_battery_low(void)
1148{
1d3e216f 1149#if defined(CONFIG_APM_EMULATION)
9f055c49 1150 apm_queue_event(APM_LOW_BATTERY);
1d3e216f 1151#endif
9f055c49
MR
1152}
1153
1154static void em_x270_battery_critical(void)
1155{
1d3e216f 1156#if defined(CONFIG_APM_EMULATION)
9f055c49 1157 apm_queue_event(APM_CRITICAL_SUSPEND);
1d3e216f 1158#endif
9f055c49
MR
1159}
1160
1161struct da9030_battery_info em_x270_batterty_info = {
1162 .battery_info = &em_x270_psy_info,
1163
1164 .charge_milliamp = 1000,
1165 .charge_millivolt = 4200,
1166
1167 .vbat_low = 3600,
1168 .vbat_crit = 3400,
1169 .vbat_charge_start = 4100,
1170 .vbat_charge_stop = 4200,
1171 .vbat_charge_restart = 4000,
1172
1173 .vcharge_min = 3200,
1174 .vcharge_max = 5500,
1175
1176 .tbat_low = 197,
1177 .tbat_high = 78,
1178 .tbat_restart = 100,
1179
1180 .batmon_interval = 0,
1181
1182 .battery_low = em_x270_battery_low,
1183 .battery_critical = em_x270_battery_critical,
1184};
1185
432adf18
MR
1186#define DA9030_SUBDEV(_name, _id, _pdata) \
1187 { \
1188 .name = "da903x-" #_name, \
1189 .id = DA9030_ID_##_id, \
1190 .platform_data = _pdata, \
28c88046 1191 }
432adf18
MR
1192
1193#define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data)
1194
1195struct da903x_subdev_info em_x270_da9030_subdevs[] = {
1196 DA9030_LDO(3),
1197 DA9030_LDO(5),
1198 DA9030_LDO(10),
1199 DA9030_LDO(12),
1200 DA9030_LDO(19),
1201
100a1d25
MR
1202 DA9030_SUBDEV(regulator, BUCK2, &buck2_data),
1203
432adf18
MR
1204 DA9030_SUBDEV(led, LED_PC, &em_x270_led_info),
1205 DA9030_SUBDEV(backlight, WLED, &em_x270_led_info),
9f055c49 1206 DA9030_SUBDEV(battery, BAT, &em_x270_batterty_info),
28c88046
MR
1207};
1208
1209static struct da903x_platform_data em_x270_da9030_info = {
1210 .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs),
1211 .subdevs = em_x270_da9030_subdevs,
1212};
1213
1214static struct i2c_board_info em_x270_i2c_pmic_info = {
1215 I2C_BOARD_INFO("da9030", 0x49),
6384fdad 1216 .irq = PXA_GPIO_TO_IRQ(0),
28c88046
MR
1217 .platform_data = &em_x270_da9030_info,
1218};
1219
1220static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = {
1221 .use_pio = 1,
1222};
1223
1224static void __init em_x270_init_da9030(void)
1225{
1226 pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info);
1227 i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
1228}
1229
76e3fc36
MR
1230static struct pca953x_platform_data exeda_gpio_ext_pdata = {
1231 .gpio_base = 128,
1232};
1233
1234static struct i2c_board_info exeda_i2c_info[] = {
1235 {
1236 I2C_BOARD_INFO("pca9555", 0x21),
1237 .platform_data = &exeda_gpio_ext_pdata,
1238 },
1239};
1240
1241static struct i2c_pxa_platform_data em_x270_i2c_info = {
1242 .fast_mode = 1,
1243};
1244
1245static void __init em_x270_init_i2c(void)
1246{
1247 pxa_set_i2c_info(&em_x270_i2c_info);
1248
1249 if (machine_is_exeda())
1250 i2c_register_board_info(0, ARRAY_AND_SIZE(exeda_i2c_info));
1251}
1252
4a697e83 1253static void __init em_x270_module_init(void)
3c85bce6
MR
1254{
1255 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
1256
4a697e83
MR
1257 mmc_cd = GPIO13_MMC_CD;
1258 nand_rb = GPIO56_NAND_RB;
1259 dm9000_flags = DM9000_PLATF_32BITONLY;
76e3fc36 1260 cam_reset = GPIO93_CAM_RESET;
128d88b8 1261 usb_hub_reset = GPIO16_USB_HUB_RESET;
4a697e83
MR
1262}
1263
7f14a787
MR
1264static void __init em_x270_exeda_init(void)
1265{
7f14a787
MR
1266 pxa2xx_mfp_config(ARRAY_AND_SIZE(exeda_pin_config));
1267
1268 mmc_cd = GPIO114_MMC_CD;
1269 nand_rb = GPIO20_NAND_RB;
1270 dm9000_flags = DM9000_PLATF_16BITONLY;
76e3fc36 1271 cam_reset = GPIO130_CAM_RESET;
128d88b8 1272 usb_hub_reset = GPIO10_USB_HUB_RESET;
7f14a787
MR
1273}
1274
4a697e83
MR
1275static void __init em_x270_init(void)
1276{
1277 pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config));
1278
cc155c6f
RK
1279 pxa_set_ffuart_info(NULL);
1280 pxa_set_btuart_info(NULL);
1281 pxa_set_stuart_info(NULL);
1282
9599d1db
MR
1283#ifdef CONFIG_PM
1284 pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
1285#endif
1286
7f14a787
MR
1287 if (machine_is_em_x270())
1288 em_x270_module_init();
1289 else if (machine_is_exeda())
1290 em_x270_exeda_init();
1291 else
1292 panic("Unsupported machine: %d\n", machine_arch_type);
4a697e83 1293
28c88046 1294 em_x270_init_da9030();
3c85bce6
MR
1295 em_x270_init_dm9000();
1296 em_x270_init_rtc();
1297 em_x270_init_nand();
28c88046 1298 em_x270_init_nor();
3c85bce6
MR
1299 em_x270_init_lcd();
1300 em_x270_init_mmc();
1301 em_x270_init_ohci();
1302 em_x270_init_keypad();
1303 em_x270_init_gpio_keys();
1304 em_x270_init_ac97();
28c88046 1305 em_x270_init_spi();
76e3fc36
MR
1306 em_x270_init_i2c();
1307 em_x270_init_camera();
a37ed431 1308 em_x270_userspace_consumers_init();
a927ef89
RJ
1309
1310 regulator_has_full_constraints();
3d50527b
MR
1311}
1312
3c85bce6 1313MACHINE_START(EM_X270, "Compulab EM-X270")
7375aba6 1314 .atag_offset = 0x100,
851982c1 1315 .map_io = pxa27x_map_io,
4e611091 1316 .nr_irqs = PXA_NR_IRQS,
3d50527b 1317 .init_irq = pxa27x_init_irq,
8a97ae2f 1318 .handle_irq = pxa27x_handle_irq,
6bb27d73 1319 .init_time = pxa_timer_init,
3d50527b 1320 .init_machine = em_x270_init,
271a74fc 1321 .restart = pxa_restart,
3d50527b 1322MACHINE_END
7f14a787
MR
1323
1324MACHINE_START(EXEDA, "Compulab eXeda")
7375aba6 1325 .atag_offset = 0x100,
851982c1 1326 .map_io = pxa27x_map_io,
4e611091 1327 .nr_irqs = PXA_NR_IRQS,
7f14a787 1328 .init_irq = pxa27x_init_irq,
8a97ae2f 1329 .handle_irq = pxa27x_handle_irq,
6bb27d73 1330 .init_time = pxa_timer_init,
7f14a787 1331 .init_machine = em_x270_init,
271a74fc 1332 .restart = pxa_restart,
7f14a787 1333MACHINE_END
This page took 0.465429 seconds and 5 git commands to generate.