blob: 67611dadb44ec0f7f811b5859e8d89f52518e093 [file] [log] [blame]
Mike Rapoport3d505272007-07-18 11:31:46 +01001/*
Mike Rapoport3c85bce2008-06-16 08:16:46 +01002 * Support for CompuLab EM-X270 platform
Mike Rapoport3d505272007-07-18 11:31:46 +01003 *
Mike Rapoport3c85bce2008-06-16 08:16:46 +01004 * Copyright (C) 2007, 2008 CompuLab, Ltd.
Mike Rapoport3d505272007-07-18 11:31:46 +01005 * 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>
Mike Rapoport7f14a782009-02-02 08:57:55 +020014#include <linux/delay.h>
Mike Rapoport3d505272007-07-18 11:31:46 +010015
16#include <linux/dm9000.h>
17#include <linux/rtc-v3020.h>
Mike Rapoport3d505272007-07-18 11:31:46 +010018#include <linux/mtd/nand.h>
19#include <linux/mtd/partitions.h>
Mike Rapoport28c88042008-12-03 09:38:10 +020020#include <linux/mtd/physmap.h>
Mike Rapoport3c85bce2008-06-16 08:16:46 +010021#include <linux/input.h>
22#include <linux/gpio_keys.h>
23#include <linux/gpio.h>
Mike Rapoport28c88042008-12-03 09:38:10 +020024#include <linux/mfd/da903x.h>
25#include <linux/regulator/machine.h>
26#include <linux/spi/spi.h>
27#include <linux/spi/tdo24m.h>
Mike Rapoportc9be0e32009-02-03 09:15:30 +020028#include <linux/spi/libertas_spi.h>
Mike Rapoport9f055c42009-02-02 08:57:53 +020029#include <linux/power_supply.h>
30#include <linux/apm-emulation.h>
Mike Rapoportc9be0e32009-02-03 09:15:30 +020031#include <linux/delay.h>
Mike Rapoport28c88042008-12-03 09:38:10 +020032
33#include <media/soc_camera.h>
Mike Rapoport3d505272007-07-18 11:31:46 +010034
35#include <asm/mach-types.h>
Mike Rapoport3d505272007-07-18 11:31:46 +010036#include <asm/mach/arch.h>
37
Eric Miao51c62982009-01-02 23:17:22 +080038#include <mach/pxa27x.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010039#include <mach/pxa27x-udc.h>
40#include <mach/audio.h>
41#include <mach/pxafb.h>
42#include <mach/ohci.h>
43#include <mach/mmc.h>
44#include <mach/pxa27x_keypad.h>
Mike Rapoport28c88042008-12-03 09:38:10 +020045#include <mach/i2c.h>
46#include <mach/camera.h>
47#include <mach/pxa2xx_spi.h>
Mike Rapoport3d505272007-07-18 11:31:46 +010048
49#include "generic.h"
Mike Rapoport6432f462009-02-02 08:57:51 +020050#include "devices.h"
Mike Rapoport3d505272007-07-18 11:31:46 +010051
Mike Rapoport7f14a782009-02-02 08:57:55 +020052/* EM-X270 specific GPIOs */
Mike Rapoport3c85bce2008-06-16 08:16:46 +010053#define GPIO13_MMC_CD (13)
Mike Rapoport6432f462009-02-02 08:57:51 +020054#define GPIO95_MMC_WP (95)
Mike Rapoport7f14a782009-02-02 08:57:55 +020055#define GPIO56_NAND_RB (56)
56
57/* eXeda specific GPIOs */
58#define GPIO114_MMC_CD (114)
59#define GPIO20_NAND_RB (20)
60#define GPIO38_SD_PWEN (38)
61
62/* common GPIOs */
63#define GPIO11_NAND_CS (11)
64#define GPIO93_CAM_RESET (93)
65#define GPIO41_ETHIRQ (41)
66#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
Mike Rapoportc9be0e32009-02-03 09:15:30 +020067#define GPIO115_WLAN_PWEN (115)
68#define GPIO19_WLAN_STRAP (19)
Mike Rapoport28c88042008-12-03 09:38:10 +020069
Mike Rapoport4a697e82009-02-02 08:57:54 +020070static int mmc_cd;
71static int nand_rb;
72static int dm9000_flags;
73
74static unsigned long common_pin_config[] = {
Mike Rapoport3c85bce2008-06-16 08:16:46 +010075 /* AC'97 */
76 GPIO28_AC97_BITCLK,
77 GPIO29_AC97_SDATA_IN_0,
78 GPIO30_AC97_SDATA_OUT,
79 GPIO31_AC97_SYNC,
80 GPIO98_AC97_SYSCLK,
81 GPIO113_AC97_nRESET,
82
83 /* BTUART */
84 GPIO42_BTUART_RXD,
85 GPIO43_BTUART_TXD,
86 GPIO44_BTUART_CTS,
87 GPIO45_BTUART_RTS,
88
89 /* STUART */
90 GPIO46_STUART_RXD,
91 GPIO47_STUART_TXD,
92
93 /* MCI controller */
94 GPIO32_MMC_CLK,
95 GPIO112_MMC_CMD,
96 GPIO92_MMC_DAT_0,
97 GPIO109_MMC_DAT_1,
98 GPIO110_MMC_DAT_2,
99 GPIO111_MMC_DAT_3,
100
101 /* LCD */
102 GPIO58_LCD_LDD_0,
103 GPIO59_LCD_LDD_1,
104 GPIO60_LCD_LDD_2,
105 GPIO61_LCD_LDD_3,
106 GPIO62_LCD_LDD_4,
107 GPIO63_LCD_LDD_5,
108 GPIO64_LCD_LDD_6,
109 GPIO65_LCD_LDD_7,
110 GPIO66_LCD_LDD_8,
111 GPIO67_LCD_LDD_9,
112 GPIO68_LCD_LDD_10,
113 GPIO69_LCD_LDD_11,
114 GPIO70_LCD_LDD_12,
115 GPIO71_LCD_LDD_13,
116 GPIO72_LCD_LDD_14,
117 GPIO73_LCD_LDD_15,
118 GPIO74_LCD_FCLK,
119 GPIO75_LCD_LCLK,
120 GPIO76_LCD_PCLK,
121 GPIO77_LCD_BIAS,
122
123 /* QCI */
124 GPIO84_CIF_FV,
125 GPIO25_CIF_LV,
126 GPIO53_CIF_MCLK,
127 GPIO54_CIF_PCLK,
128 GPIO81_CIF_DD_0,
129 GPIO55_CIF_DD_1,
130 GPIO51_CIF_DD_2,
131 GPIO50_CIF_DD_3,
132 GPIO52_CIF_DD_4,
133 GPIO48_CIF_DD_5,
134 GPIO17_CIF_DD_6,
135 GPIO12_CIF_DD_7,
136
137 /* I2C */
138 GPIO117_I2C_SCL,
139 GPIO118_I2C_SDA,
140
141 /* Keypad */
142 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
143 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
144 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
145 GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
146 GPIO39_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
147 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
148 GPIO91_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH,
149 GPIO36_KP_MKIN_7 | WAKEUP_ON_LEVEL_HIGH,
150 GPIO103_KP_MKOUT_0,
151 GPIO104_KP_MKOUT_1,
152 GPIO105_KP_MKOUT_2,
153 GPIO106_KP_MKOUT_3,
154 GPIO107_KP_MKOUT_4,
155 GPIO108_KP_MKOUT_5,
156 GPIO96_KP_MKOUT_6,
157 GPIO22_KP_MKOUT_7,
158
159 /* SSP1 */
160 GPIO26_SSP1_RXD,
161 GPIO23_SSP1_SCLK,
162 GPIO24_SSP1_SFRM,
163 GPIO57_SSP1_TXD,
164
165 /* SSP2 */
Mike Rapoportc9be0e32009-02-03 09:15:30 +0200166 GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */
167 GPIO14_GPIO,
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100168 GPIO89_SSP2_TXD,
169 GPIO88_SSP2_RXD,
170
171 /* SDRAM and local bus */
172 GPIO15_nCS_1,
173 GPIO78_nCS_2,
174 GPIO79_nCS_3,
175 GPIO80_nCS_4,
176 GPIO49_nPWE,
177 GPIO18_RDY,
178
179 /* GPIO */
Mike Rapoport6432f462009-02-02 08:57:51 +0200180 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100181
182 /* power controls */
183 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
Mike Rapoport28c88042008-12-03 09:38:10 +0200184 GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100185 GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */
186
187 /* NAND controls */
188 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100189
190 /* interrupts */
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100191 GPIO41_GPIO, /* DM9000 interrupt */
192};
193
Mike Rapoport4a697e82009-02-02 08:57:54 +0200194static unsigned long em_x270_pin_config[] = {
195 GPIO13_GPIO, /* MMC card detect */
196 GPIO56_GPIO, /* NAND Ready/Busy */
197 GPIO95_GPIO, /* MMC Write protect */
198};
199
Mike Rapoport7f14a782009-02-02 08:57:55 +0200200static unsigned long exeda_pin_config[] = {
201 GPIO20_GPIO, /* NAND Ready/Busy */
202 GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */
203 GPIO114_GPIO, /* MMC card detect */
204};
205
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100206#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
207static struct resource em_x270_dm9000_resource[] = {
Mike Rapoport3d505272007-07-18 11:31:46 +0100208 [0] = {
209 .start = PXA_CS2_PHYS,
210 .end = PXA_CS2_PHYS + 3,
211 .flags = IORESOURCE_MEM,
212 },
213 [1] = {
214 .start = PXA_CS2_PHYS + 8,
215 .end = PXA_CS2_PHYS + 8 + 0x3f,
216 .flags = IORESOURCE_MEM,
217 },
218 [2] = {
219 .start = EM_X270_ETHIRQ,
220 .end = EM_X270_ETHIRQ,
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100221 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
Mike Rapoport3d505272007-07-18 11:31:46 +0100222 }
223};
224
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100225static struct dm9000_plat_data em_x270_dm9000_platdata = {
Mike Rapoport4a697e82009-02-02 08:57:54 +0200226 .flags = DM9000_PLATF_NO_EEPROM,
Mike Rapoport3d505272007-07-18 11:31:46 +0100227};
228
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100229static struct platform_device em_x270_dm9000 = {
Mike Rapoport3d505272007-07-18 11:31:46 +0100230 .name = "dm9000",
231 .id = 0,
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100232 .num_resources = ARRAY_SIZE(em_x270_dm9000_resource),
233 .resource = em_x270_dm9000_resource,
Mike Rapoport3d505272007-07-18 11:31:46 +0100234 .dev = {
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100235 .platform_data = &em_x270_dm9000_platdata,
Mike Rapoport3d505272007-07-18 11:31:46 +0100236 }
237};
238
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100239static void __init em_x270_init_dm9000(void)
240{
Mike Rapoport4a697e82009-02-02 08:57:54 +0200241 em_x270_dm9000_platdata.flags |= dm9000_flags;
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100242 platform_device_register(&em_x270_dm9000);
243}
244#else
245static inline void em_x270_init_dm9000(void) {}
246#endif
Mike Rapoport3d505272007-07-18 11:31:46 +0100247
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100248/* V3020 RTC */
249#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
Mike Rapoport3d505272007-07-18 11:31:46 +0100250static struct resource em_x270_v3020_resource[] = {
251 [0] = {
252 .start = PXA_CS4_PHYS,
253 .end = PXA_CS4_PHYS + 3,
254 .flags = IORESOURCE_MEM,
255 },
256};
257
258static struct v3020_platform_data em_x270_v3020_platdata = {
259 .leftshift = 0,
260};
261
262static struct platform_device em_x270_rtc = {
263 .name = "v3020",
264 .num_resources = ARRAY_SIZE(em_x270_v3020_resource),
265 .resource = em_x270_v3020_resource,
266 .id = -1,
267 .dev = {
268 .platform_data = &em_x270_v3020_platdata,
269 }
270};
271
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100272static void __init em_x270_init_rtc(void)
273{
274 platform_device_register(&em_x270_rtc);
275}
276#else
277static inline void em_x270_init_rtc(void) {}
278#endif
Mike Rapoport3d505272007-07-18 11:31:46 +0100279
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100280/* NAND flash */
281#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
Mike Rapoport3d505272007-07-18 11:31:46 +0100282static inline void nand_cs_on(void)
283{
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100284 gpio_set_value(GPIO11_NAND_CS, 0);
Mike Rapoport3d505272007-07-18 11:31:46 +0100285}
286
287static void nand_cs_off(void)
288{
289 dsb();
290
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100291 gpio_set_value(GPIO11_NAND_CS, 1);
Mike Rapoport3d505272007-07-18 11:31:46 +0100292}
293
294/* hardware specific access to control-lines */
295static void em_x270_nand_cmd_ctl(struct mtd_info *mtd, int dat,
296 unsigned int ctrl)
297{
298 struct nand_chip *this = mtd->priv;
299 unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
300
301 dsb();
302
303 if (ctrl & NAND_CTRL_CHANGE) {
304 if (ctrl & NAND_ALE)
305 nandaddr |= (1 << 3);
306 else
307 nandaddr &= ~(1 << 3);
308 if (ctrl & NAND_CLE)
309 nandaddr |= (1 << 2);
310 else
311 nandaddr &= ~(1 << 2);
312 if (ctrl & NAND_NCE)
313 nand_cs_on();
314 else
315 nand_cs_off();
316 }
317
318 dsb();
319 this->IO_ADDR_W = (void __iomem *)nandaddr;
320 if (dat != NAND_CMD_NONE)
321 writel(dat, this->IO_ADDR_W);
322
323 dsb();
324}
325
326/* read device ready pin */
327static int em_x270_nand_device_ready(struct mtd_info *mtd)
328{
329 dsb();
330
Mike Rapoport4a697e82009-02-02 08:57:54 +0200331 return gpio_get_value(nand_rb);
Mike Rapoport3d505272007-07-18 11:31:46 +0100332}
333
334static struct mtd_partition em_x270_partition_info[] = {
335 [0] = {
336 .name = "em_x270-0",
337 .offset = 0,
338 .size = SZ_4M,
339 },
340 [1] = {
341 .name = "em_x270-1",
342 .offset = MTDPART_OFS_APPEND,
343 .size = MTDPART_SIZ_FULL
344 },
345};
346
347static const char *em_x270_part_probes[] = { "cmdlinepart", NULL };
348
349struct platform_nand_data em_x270_nand_platdata = {
350 .chip = {
351 .nr_chips = 1,
352 .chip_offset = 0,
353 .nr_partitions = ARRAY_SIZE(em_x270_partition_info),
354 .partitions = em_x270_partition_info,
355 .chip_delay = 20,
356 .part_probe_types = em_x270_part_probes,
357 },
358 .ctrl = {
359 .hwcontrol = 0,
360 .dev_ready = em_x270_nand_device_ready,
361 .select_chip = 0,
362 .cmd_ctrl = em_x270_nand_cmd_ctl,
363 },
364};
365
366static struct resource em_x270_nand_resource[] = {
367 [0] = {
368 .start = PXA_CS1_PHYS,
369 .end = PXA_CS1_PHYS + 12,
370 .flags = IORESOURCE_MEM,
371 },
372};
373
374static struct platform_device em_x270_nand = {
375 .name = "gen_nand",
376 .num_resources = ARRAY_SIZE(em_x270_nand_resource),
377 .resource = em_x270_nand_resource,
378 .id = -1,
379 .dev = {
380 .platform_data = &em_x270_nand_platdata,
381 }
382};
383
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100384static void __init em_x270_init_nand(void)
385{
386 int err;
Mike Rapoport3d505272007-07-18 11:31:46 +0100387
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100388 err = gpio_request(GPIO11_NAND_CS, "NAND CS");
389 if (err) {
390 pr_warning("EM-X270: failed to request NAND CS gpio\n");
391 return;
392 }
393
394 gpio_direction_output(GPIO11_NAND_CS, 1);
395
Mike Rapoport4a697e82009-02-02 08:57:54 +0200396 err = gpio_request(nand_rb, "NAND R/B");
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100397 if (err) {
398 pr_warning("EM-X270: failed to request NAND R/B gpio\n");
399 gpio_free(GPIO11_NAND_CS);
400 return;
401 }
402
Mike Rapoport4a697e82009-02-02 08:57:54 +0200403 gpio_direction_input(nand_rb);
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100404
405 platform_device_register(&em_x270_nand);
406}
407#else
408static inline void em_x270_init_nand(void) {}
409#endif
Mike Rapoport3d505272007-07-18 11:31:46 +0100410
Mike Rapoport28c88042008-12-03 09:38:10 +0200411#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
412static struct mtd_partition em_x270_nor_parts[] = {
413 {
414 .name = "Bootloader",
415 .offset = 0x00000000,
416 .size = 0x00050000,
417 .mask_flags = MTD_WRITEABLE /* force read-only */
418 }, {
419 .name = "Environment",
420 .offset = 0x00050000,
421 .size = 0x00010000,
422 }, {
423 .name = "Reserved",
424 .offset = 0x00060000,
425 .size = 0x00050000,
426 .mask_flags = MTD_WRITEABLE /* force read-only */
427 }, {
428 .name = "Splashscreen",
429 .offset = 0x000b0000,
430 .size = 0x00050000,
431 }
432};
433
434static struct physmap_flash_data em_x270_nor_data[] = {
435 [0] = {
436 .width = 2,
437 .parts = em_x270_nor_parts,
438 .nr_parts = ARRAY_SIZE(em_x270_nor_parts),
439 },
440};
441
442static struct resource em_x270_nor_flash_resource = {
443 .start = PXA_CS0_PHYS,
444 .end = PXA_CS0_PHYS + SZ_1M - 1,
445 .flags = IORESOURCE_MEM,
446};
447
448static struct platform_device em_x270_physmap_flash = {
449 .name = "physmap-flash",
450 .id = 0,
451 .num_resources = 1,
452 .resource = &em_x270_nor_flash_resource,
453 .dev = {
454 .platform_data = &em_x270_nor_data,
455 },
456};
457
458static void __init em_x270_init_nor(void)
459{
460 platform_device_register(&em_x270_physmap_flash);
461}
462#else
463static inline void em_x270_init_nor(void) {}
464#endif
465
Mike Rapoport3d505272007-07-18 11:31:46 +0100466/* PXA27x OHCI controller setup */
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100467#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
Mike Rapoport3d505272007-07-18 11:31:46 +0100468static int em_x270_ohci_init(struct device *dev)
469{
Mike Rapoport3d505272007-07-18 11:31:46 +0100470 /* enable port 2 transiever */
471 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE;
472
473 return 0;
474}
475
476static struct pxaohci_platform_data em_x270_ohci_platform_data = {
477 .port_mode = PMM_PERPORT_MODE,
Eric Miao097b5332008-09-27 15:49:57 +0800478 .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW,
Mike Rapoport3d505272007-07-18 11:31:46 +0100479 .init = em_x270_ohci_init,
480};
481
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100482static void __init em_x270_init_ohci(void)
483{
484 pxa_set_ohci_info(&em_x270_ohci_platform_data);
485}
486#else
487static inline void em_x270_init_ohci(void) {}
488#endif
Mike Rapoport3d505272007-07-18 11:31:46 +0100489
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100490/* MCI controller setup */
491#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
Mike Rapoport6432f462009-02-02 08:57:51 +0200492static struct regulator *em_x270_sdio_ldo;
493
Mike Rapoport3d505272007-07-18 11:31:46 +0100494static int em_x270_mci_init(struct device *dev,
495 irq_handler_t em_x270_detect_int,
496 void *data)
497{
Mike Rapoport6432f462009-02-02 08:57:51 +0200498 int err;
499
500 em_x270_sdio_ldo = regulator_get(dev, "vcc sdio");
501 if (IS_ERR(em_x270_sdio_ldo)) {
502 dev_err(dev, "can't request SDIO power supply: %ld\n",
503 PTR_ERR(em_x270_sdio_ldo));
504 return PTR_ERR(em_x270_sdio_ldo);
Mike Rapoport3d505272007-07-18 11:31:46 +0100505 }
506
Mike Rapoport4a697e82009-02-02 08:57:54 +0200507 err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
Mike Rapoport6432f462009-02-02 08:57:51 +0200508 IRQF_DISABLED | IRQF_TRIGGER_RISING |
509 IRQF_TRIGGER_FALLING,
510 "MMC card detect", data);
511 if (err) {
512 dev_err(dev, "can't request MMC card detect IRQ: %d\n", err);
513 goto err_irq;
514 }
515
Mike Rapoport7f14a782009-02-02 08:57:55 +0200516 if (machine_is_em_x270()) {
517 err = gpio_request(GPIO95_MMC_WP, "MMC WP");
518 if (err) {
519 dev_err(dev, "can't request MMC write protect: %d\n",
520 err);
521 goto err_gpio_wp;
522 }
523 gpio_direction_input(GPIO95_MMC_WP);
524 } else {
525 err = gpio_request(GPIO38_SD_PWEN, "sdio power");
526 if (err) {
527 dev_err(dev, "can't request MMC power control : %d\n",
528 err);
529 goto err_gpio_wp;
530 }
531 gpio_direction_output(GPIO38_SD_PWEN, 1);
Mike Rapoport6432f462009-02-02 08:57:51 +0200532 }
533
Mike Rapoport3d505272007-07-18 11:31:46 +0100534 return 0;
Mike Rapoport6432f462009-02-02 08:57:51 +0200535
536err_gpio_wp:
Mike Rapoport4a697e82009-02-02 08:57:54 +0200537 free_irq(gpio_to_irq(mmc_cd), data);
Mike Rapoport6432f462009-02-02 08:57:51 +0200538err_irq:
539 regulator_put(em_x270_sdio_ldo);
540
541 return err;
Mike Rapoport3d505272007-07-18 11:31:46 +0100542}
543
544static void em_x270_mci_setpower(struct device *dev, unsigned int vdd)
545{
Mike Rapoport6432f462009-02-02 08:57:51 +0200546 struct pxamci_platform_data* p_d = dev->platform_data;
547
548 if ((1 << vdd) & p_d->ocr_mask) {
549 int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000;
550
551 regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV);
552 regulator_enable(em_x270_sdio_ldo);
553 } else {
554 regulator_disable(em_x270_sdio_ldo);
555 }
Mike Rapoport3d505272007-07-18 11:31:46 +0100556}
557
558static void em_x270_mci_exit(struct device *dev, void *data)
559{
Mike Rapoport4a697e82009-02-02 08:57:54 +0200560 free_irq(gpio_to_irq(mmc_cd), data);
Mike Rapoport7f14a782009-02-02 08:57:55 +0200561 regulator_put(em_x270_sdio_ldo);
562
563 if (machine_is_em_x270())
564 gpio_free(GPIO95_MMC_WP);
565 else
566 gpio_free(GPIO38_SD_PWEN);
Mike Rapoport6432f462009-02-02 08:57:51 +0200567}
568
569static int em_x270_mci_get_ro(struct device *dev)
570{
571 return gpio_get_value(GPIO95_MMC_WP);
Mike Rapoport3d505272007-07-18 11:31:46 +0100572}
573
574static struct pxamci_platform_data em_x270_mci_platform_data = {
Mike Rapoport6432f462009-02-02 08:57:51 +0200575 .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23|
576 MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27|
577 MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
578 MMC_VDD_30_31|MMC_VDD_31_32,
Mike Rapoport3d505272007-07-18 11:31:46 +0100579 .init = em_x270_mci_init,
580 .setpower = em_x270_mci_setpower,
581 .exit = em_x270_mci_exit,
582};
583
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100584static void __init em_x270_init_mmc(void)
585{
Mike Rapoport7f14a782009-02-02 08:57:55 +0200586 if (machine_is_em_x270())
587 em_x270_mci_platform_data.get_ro = em_x270_mci_get_ro;
588
Mike Rapoport6432f462009-02-02 08:57:51 +0200589 em_x270_mci_platform_data.detect_delay = msecs_to_jiffies(250);
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100590 pxa_set_mci_info(&em_x270_mci_platform_data);
591}
592#else
593static inline void em_x270_init_mmc(void) {}
594#endif
595
Mike Rapoport28c88042008-12-03 09:38:10 +0200596/* LCD */
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100597#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
Mike Rapoport28c88042008-12-03 09:38:10 +0200598static struct pxafb_mode_info em_x270_lcd_modes[] = {
599 [0] = {
600 .pixclock = 38250,
601 .bpp = 16,
602 .xres = 480,
603 .yres = 640,
604 .hsync_len = 8,
605 .vsync_len = 2,
606 .left_margin = 8,
607 .upper_margin = 2,
608 .right_margin = 24,
609 .lower_margin = 4,
610 .sync = 0,
611 },
612 [1] = {
613 .pixclock = 153800,
614 .bpp = 16,
615 .xres = 240,
616 .yres = 320,
617 .hsync_len = 8,
618 .vsync_len = 2,
619 .left_margin = 8,
620 .upper_margin = 2,
621 .right_margin = 88,
622 .lower_margin = 2,
623 .sync = 0,
624 },
Mike Rapoport3d505272007-07-18 11:31:46 +0100625};
626
627static struct pxafb_mach_info em_x270_lcd = {
Mike Rapoport28c88042008-12-03 09:38:10 +0200628 .modes = em_x270_lcd_modes,
629 .num_modes = 2,
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100630 .lcd_conn = LCD_COLOR_TFT_16BPP,
Mike Rapoport3d505272007-07-18 11:31:46 +0100631};
Mike Rapoport28c88042008-12-03 09:38:10 +0200632
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100633static void __init em_x270_init_lcd(void)
634{
635 set_pxa_fb_info(&em_x270_lcd);
636}
637#else
638static inline void em_x270_init_lcd(void) {}
639#endif
640
Mike Rapoport28c88042008-12-03 09:38:10 +0200641#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
642static struct pxa2xx_spi_master em_x270_spi_info = {
643 .num_chipselect = 1,
644};
645
646static struct pxa2xx_spi_chip em_x270_tdo24m_chip = {
647 .rx_threshold = 1,
648 .tx_threshold = 1,
649};
650
651static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
652 .model = TDO35S,
653};
654
Mike Rapoportc9be0e32009-02-03 09:15:30 +0200655static struct pxa2xx_spi_master em_x270_spi_2_info = {
656 .num_chipselect = 1,
657 .enable_dma = 1,
658};
659
660static struct pxa2xx_spi_chip em_x270_libertas_chip = {
661 .rx_threshold = 1,
662 .tx_threshold = 1,
663 .timeout = 1000,
664};
665
666static unsigned long em_x270_libertas_pin_config[] = {
667 /* SSP2 */
668 GPIO19_SSP2_SCLK,
669 GPIO14_GPIO,
670 GPIO89_SSP2_TXD,
671 GPIO88_SSP2_RXD,
672};
673
674static int em_x270_libertas_setup(struct spi_device *spi)
675{
676 int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN");
677 if (err)
678 return err;
679
680 gpio_direction_output(GPIO19_WLAN_STRAP, 1);
681 mdelay(100);
682
683 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config));
684
685 gpio_direction_output(GPIO115_WLAN_PWEN, 0);
686 mdelay(100);
687 gpio_set_value(GPIO115_WLAN_PWEN, 1);
688 mdelay(100);
689
690 spi->bits_per_word = 16;
691 spi_setup(spi);
692
693 return 0;
694}
695
696static int em_x270_libertas_teardown(struct spi_device *spi)
697{
698 gpio_set_value(GPIO115_WLAN_PWEN, 0);
699 gpio_free(GPIO115_WLAN_PWEN);
700
701 return 0;
702}
703
704struct libertas_spi_platform_data em_x270_libertas_pdata = {
705 .use_dummy_writes = 1,
706 .gpio_cs = 14,
707 .setup = em_x270_libertas_setup,
708 .teardown = em_x270_libertas_teardown,
709};
710
Mike Rapoport28c88042008-12-03 09:38:10 +0200711static struct spi_board_info em_x270_spi_devices[] __initdata = {
712 {
Mike Rapoportc9be0e32009-02-03 09:15:30 +0200713 .modalias = "tdo24m",
714 .max_speed_hz = 1000000,
715 .bus_num = 1,
716 .chip_select = 0,
717 .controller_data = &em_x270_tdo24m_chip,
718 .platform_data = &em_x270_tdo24m_pdata,
719 },
720 {
721 .modalias = "libertas_spi",
722 .max_speed_hz = 13000000,
723 .bus_num = 2,
724 .irq = IRQ_GPIO(116),
725 .chip_select = 0,
726 .controller_data = &em_x270_libertas_chip,
727 .platform_data = &em_x270_libertas_pdata,
Mike Rapoport28c88042008-12-03 09:38:10 +0200728 },
729};
730
731static void __init em_x270_init_spi(void)
732{
733 pxa2xx_set_spi_info(1, &em_x270_spi_info);
Mike Rapoportc9be0e32009-02-03 09:15:30 +0200734 pxa2xx_set_spi_info(2, &em_x270_spi_2_info);
Mike Rapoport28c88042008-12-03 09:38:10 +0200735 spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
736}
737#else
738static inline void em_x270_init_spi(void) {}
739#endif
740
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100741#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
742static void __init em_x270_init_ac97(void)
743{
744 pxa_set_ac97_info(NULL);
745}
746#else
747static inline void em_x270_init_ac97(void) {}
748#endif
749
750#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
Mike Rapoport7f14a782009-02-02 08:57:55 +0200751static unsigned int em_x270_module_matrix_keys[] = {
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100752 KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
753 KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
754 KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
755};
756
Mike Rapoport7f14a782009-02-02 08:57:55 +0200757struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100758 /* code map for the matrix keys */
759 .matrix_key_rows = 3,
760 .matrix_key_cols = 3,
Mike Rapoport7f14a782009-02-02 08:57:55 +0200761 .matrix_key_map = em_x270_module_matrix_keys,
762 .matrix_key_map_size = ARRAY_SIZE(em_x270_module_matrix_keys),
763};
764
765static unsigned int em_x270_exeda_matrix_keys[] = {
766 KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
767 KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
768 KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
769 KEY(0, 6, KEY_ENTER), KEY(0, 7, KEY_SLASH),
770
771 KEY(1, 0, KEY_DOT), KEY(1, 1, KEY_M),
772 KEY(1, 2, KEY_N), KEY(1, 3, KEY_B),
773 KEY(1, 4, KEY_V), KEY(1, 5, KEY_C),
774 KEY(1, 6, KEY_X), KEY(1, 7, KEY_Z),
775
776 KEY(2, 0, KEY_LEFTSHIFT), KEY(2, 1, KEY_SEMICOLON),
777 KEY(2, 2, KEY_L), KEY(2, 3, KEY_K),
778 KEY(2, 4, KEY_J), KEY(2, 5, KEY_H),
779 KEY(2, 6, KEY_G), KEY(2, 7, KEY_F),
780
781 KEY(3, 0, KEY_D), KEY(3, 1, KEY_S),
782 KEY(3, 2, KEY_A), KEY(3, 3, KEY_TAB),
783 KEY(3, 4, KEY_BACKSPACE), KEY(3, 5, KEY_P),
784 KEY(3, 6, KEY_O), KEY(3, 7, KEY_I),
785
786 KEY(4, 0, KEY_U), KEY(4, 1, KEY_Y),
787 KEY(4, 2, KEY_T), KEY(4, 3, KEY_R),
788 KEY(4, 4, KEY_E), KEY(4, 5, KEY_W),
789 KEY(4, 6, KEY_Q), KEY(4, 7, KEY_MINUS),
790
791 KEY(5, 0, KEY_0), KEY(5, 1, KEY_9),
792 KEY(5, 2, KEY_8), KEY(5, 3, KEY_7),
793 KEY(5, 4, KEY_6), KEY(5, 5, KEY_5),
794 KEY(5, 6, KEY_4), KEY(5, 7, KEY_3),
795
796 KEY(6, 0, KEY_2), KEY(6, 1, KEY_1),
797 KEY(6, 2, KEY_ENTER), KEY(6, 3, KEY_END),
798 KEY(6, 4, KEY_DOWN), KEY(6, 5, KEY_UP),
799 KEY(6, 6, KEY_MENU), KEY(6, 7, KEY_F1),
800
801 KEY(7, 0, KEY_LEFT), KEY(7, 1, KEY_RIGHT),
802 KEY(7, 2, KEY_BACK), KEY(7, 3, KEY_HOME),
803 KEY(7, 4, 0), KEY(7, 5, 0),
804 KEY(7, 6, 0), KEY(7, 7, 0),
805};
806
807struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
808 /* code map for the matrix keys */
809 .matrix_key_rows = 8,
810 .matrix_key_cols = 8,
811 .matrix_key_map = em_x270_exeda_matrix_keys,
812 .matrix_key_map_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100813};
814
815static void __init em_x270_init_keypad(void)
816{
Mike Rapoport7f14a782009-02-02 08:57:55 +0200817 if (machine_is_em_x270())
818 pxa_set_keypad_info(&em_x270_module_keypad_info);
819 else
820 pxa_set_keypad_info(&em_x270_exeda_keypad_info);
Mike Rapoport3c85bce2008-06-16 08:16:46 +0100821}
822#else
823static inline void em_x270_init_keypad(void) {}
824#endif
825
826#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
827static struct gpio_keys_button gpio_keys_button[] = {
828 [0] = {
829 .desc = "sleep/wakeup",
830 .code = KEY_SUSPEND,
831 .type = EV_PWR,
832 .gpio = 1,
833 .wakeup = 1,
834 },
835};
836
837static struct gpio_keys_platform_data em_x270_gpio_keys_data = {
838 .buttons = gpio_keys_button,
839 .nbuttons = 1,
840};
841
842static struct platform_device em_x270_gpio_keys = {
843 .name = "gpio-keys",
844 .id = -1,
845 .dev = {
846 .platform_data = &em_x270_gpio_keys_data,
847 },
848};
849
850static void __init em_x270_init_gpio_keys(void)
851{
852 platform_device_register(&em_x270_gpio_keys);
853}
854#else
855static inline void em_x270_init_gpio_keys(void) {}
856#endif
Mike Rapoport3d505272007-07-18 11:31:46 +0100857
Mike Rapoport28c88042008-12-03 09:38:10 +0200858/* Quick Capture Interface and sensor setup */
859#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
860static struct regulator *em_x270_camera_ldo;
861
862static int em_x270_sensor_init(struct device *dev)
863{
864 int ret;
865
866 ret = gpio_request(GPIO93_CAM_RESET, "camera reset");
867 if (ret)
868 return ret;
869
870 gpio_direction_output(GPIO93_CAM_RESET, 0);
871
872 em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
873 if (em_x270_camera_ldo == NULL) {
874 gpio_free(GPIO93_CAM_RESET);
875 return -ENODEV;
876 }
877
878 ret = regulator_enable(em_x270_camera_ldo);
879 if (ret) {
880 regulator_put(em_x270_camera_ldo);
881 gpio_free(GPIO93_CAM_RESET);
882 return ret;
883 }
884
885 gpio_set_value(GPIO93_CAM_RESET, 1);
886
887 return 0;
888}
889
890struct pxacamera_platform_data em_x270_camera_platform_data = {
891 .init = em_x270_sensor_init,
892 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
893 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
894 .mclk_10khz = 2600,
895};
896
897static int em_x270_sensor_power(struct device *dev, int on)
898{
899 int ret;
900 int is_on = regulator_is_enabled(em_x270_camera_ldo);
901
902 if (on == is_on)
903 return 0;
904
905 gpio_set_value(GPIO93_CAM_RESET, !on);
906
907 if (on)
908 ret = regulator_enable(em_x270_camera_ldo);
909 else
910 ret = regulator_disable(em_x270_camera_ldo);
911
912 if (ret)
913 return ret;
914
915 gpio_set_value(GPIO93_CAM_RESET, on);
916
917 return 0;
918}
919
920static struct soc_camera_link iclink = {
921 .bus_id = 0,
922 .power = em_x270_sensor_power,
923};
924
925static struct i2c_board_info em_x270_i2c_cam_info[] = {
926 {
927 I2C_BOARD_INFO("mt9m111", 0x48),
928 .platform_data = &iclink,
929 },
930};
931
932static struct i2c_pxa_platform_data em_x270_i2c_info = {
933 .fast_mode = 1,
934};
935
936static void __init em_x270_init_camera(void)
937{
938 pxa_set_i2c_info(&em_x270_i2c_info);
939 i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info));
940 pxa_set_camera_info(&em_x270_camera_platform_data);
941}
942#else
943static inline void em_x270_init_camera(void) {}
944#endif
945
946/* DA9030 related initializations */
Mike Rapoport432adf12009-02-02 08:57:52 +0200947#define REGULATOR_CONSUMER(_name, _dev, _supply) \
948 static struct regulator_consumer_supply _name##_consumers[] = { \
949 { \
950 .dev = _dev, \
951 .supply = _supply, \
952 }, \
953 }
Mike Rapoport28c88042008-12-03 09:38:10 +0200954
Mike Rapoport432adf12009-02-02 08:57:52 +0200955REGULATOR_CONSUMER(ldo3, NULL, "vcc gps");
956REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
957REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
958REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
959REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs");
Mike Rapoport28c88042008-12-03 09:38:10 +0200960
Mike Rapoport432adf12009-02-02 08:57:52 +0200961#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
962 static struct regulator_init_data _ldo##_data = { \
963 .constraints = { \
964 .min_uV = _min_uV, \
965 .max_uV = _max_uV, \
966 .state_mem = { \
967 .enabled = 0, \
968 }, \
969 .valid_ops_mask = _ops_mask, \
970 }, \
971 .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \
972 .consumer_supplies = _ldo##_consumers, \
973 };
Mike Rapoport6432f462009-02-02 08:57:51 +0200974
Mike Rapoport432adf12009-02-02 08:57:52 +0200975REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
976REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
977REGULATOR_INIT(ldo10, 2000000, 3200000,
978 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE);
979REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
980REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
Mike Rapoport28c88042008-12-03 09:38:10 +0200981
982struct led_info em_x270_led_info = {
983 .name = "em-x270:orange",
984 .default_trigger = "battery-charging-or-full",
985};
986
Mike Rapoport9f055c42009-02-02 08:57:53 +0200987struct power_supply_info em_x270_psy_info = {
988 .name = "LP555597P6H-FPS",
989 .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
990 .voltage_max_design = 4200000,
991 .voltage_min_design = 3000000,
992 .use_for_apm = 1,
993};
994
995static void em_x270_battery_low(void)
996{
997 apm_queue_event(APM_LOW_BATTERY);
998}
999
1000static void em_x270_battery_critical(void)
1001{
1002 apm_queue_event(APM_CRITICAL_SUSPEND);
1003}
1004
1005struct da9030_battery_info em_x270_batterty_info = {
1006 .battery_info = &em_x270_psy_info,
1007
1008 .charge_milliamp = 1000,
1009 .charge_millivolt = 4200,
1010
1011 .vbat_low = 3600,
1012 .vbat_crit = 3400,
1013 .vbat_charge_start = 4100,
1014 .vbat_charge_stop = 4200,
1015 .vbat_charge_restart = 4000,
1016
1017 .vcharge_min = 3200,
1018 .vcharge_max = 5500,
1019
1020 .tbat_low = 197,
1021 .tbat_high = 78,
1022 .tbat_restart = 100,
1023
1024 .batmon_interval = 0,
1025
1026 .battery_low = em_x270_battery_low,
1027 .battery_critical = em_x270_battery_critical,
1028};
1029
Mike Rapoport432adf12009-02-02 08:57:52 +02001030#define DA9030_SUBDEV(_name, _id, _pdata) \
1031 { \
1032 .name = "da903x-" #_name, \
1033 .id = DA9030_ID_##_id, \
1034 .platform_data = _pdata, \
Mike Rapoport28c88042008-12-03 09:38:10 +02001035 }
Mike Rapoport432adf12009-02-02 08:57:52 +02001036
1037#define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data)
1038
1039struct da903x_subdev_info em_x270_da9030_subdevs[] = {
1040 DA9030_LDO(3),
1041 DA9030_LDO(5),
1042 DA9030_LDO(10),
1043 DA9030_LDO(12),
1044 DA9030_LDO(19),
1045
1046 DA9030_SUBDEV(led, LED_PC, &em_x270_led_info),
1047 DA9030_SUBDEV(backlight, WLED, &em_x270_led_info),
Mike Rapoport9f055c42009-02-02 08:57:53 +02001048 DA9030_SUBDEV(battery, BAT, &em_x270_batterty_info),
Mike Rapoport28c88042008-12-03 09:38:10 +02001049};
1050
1051static struct da903x_platform_data em_x270_da9030_info = {
1052 .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs),
1053 .subdevs = em_x270_da9030_subdevs,
1054};
1055
1056static struct i2c_board_info em_x270_i2c_pmic_info = {
1057 I2C_BOARD_INFO("da9030", 0x49),
1058 .irq = IRQ_GPIO(0),
1059 .platform_data = &em_x270_da9030_info,
1060};
1061
1062static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = {
1063 .use_pio = 1,
1064};
1065
1066static void __init em_x270_init_da9030(void)
1067{
1068 pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info);
1069 i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
1070}
1071
Mike Rapoport4a697e82009-02-02 08:57:54 +02001072static void __init em_x270_module_init(void)
Mike Rapoport3d505272007-07-18 11:31:46 +01001073{
Mike Rapoport7f14a782009-02-02 08:57:55 +02001074 pr_info("%s\n", __func__);
Mike Rapoport3c85bce2008-06-16 08:16:46 +01001075 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
Mike Rapoport3d505272007-07-18 11:31:46 +01001076
Mike Rapoport4a697e82009-02-02 08:57:54 +02001077 mmc_cd = GPIO13_MMC_CD;
1078 nand_rb = GPIO56_NAND_RB;
1079 dm9000_flags = DM9000_PLATF_32BITONLY;
1080}
1081
Mike Rapoport7f14a782009-02-02 08:57:55 +02001082static void __init em_x270_exeda_init(void)
1083{
1084 pr_info("%s\n", __func__);
1085 pxa2xx_mfp_config(ARRAY_AND_SIZE(exeda_pin_config));
1086
1087 mmc_cd = GPIO114_MMC_CD;
1088 nand_rb = GPIO20_NAND_RB;
1089 dm9000_flags = DM9000_PLATF_16BITONLY;
1090}
1091
Mike Rapoport4a697e82009-02-02 08:57:54 +02001092static void __init em_x270_init(void)
1093{
1094 pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config));
1095
Mike Rapoport7f14a782009-02-02 08:57:55 +02001096 if (machine_is_em_x270())
1097 em_x270_module_init();
1098 else if (machine_is_exeda())
1099 em_x270_exeda_init();
1100 else
1101 panic("Unsupported machine: %d\n", machine_arch_type);
Mike Rapoport4a697e82009-02-02 08:57:54 +02001102
Mike Rapoport28c88042008-12-03 09:38:10 +02001103 em_x270_init_da9030();
Mike Rapoport3c85bce2008-06-16 08:16:46 +01001104 em_x270_init_dm9000();
1105 em_x270_init_rtc();
1106 em_x270_init_nand();
Mike Rapoport28c88042008-12-03 09:38:10 +02001107 em_x270_init_nor();
Mike Rapoport3c85bce2008-06-16 08:16:46 +01001108 em_x270_init_lcd();
1109 em_x270_init_mmc();
1110 em_x270_init_ohci();
1111 em_x270_init_keypad();
1112 em_x270_init_gpio_keys();
1113 em_x270_init_ac97();
Mike Rapoport28c88042008-12-03 09:38:10 +02001114 em_x270_init_camera();
1115 em_x270_init_spi();
Mike Rapoport3d505272007-07-18 11:31:46 +01001116}
1117
Mike Rapoport3c85bce2008-06-16 08:16:46 +01001118MACHINE_START(EM_X270, "Compulab EM-X270")
Mike Rapoport3d505272007-07-18 11:31:46 +01001119 .boot_params = 0xa0000100,
1120 .phys_io = 0x40000000,
1121 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1122 .map_io = pxa_map_io,
1123 .init_irq = pxa27x_init_irq,
1124 .timer = &pxa_timer,
1125 .init_machine = em_x270_init,
1126MACHINE_END
Mike Rapoport7f14a782009-02-02 08:57:55 +02001127
1128MACHINE_START(EXEDA, "Compulab eXeda")
1129 .boot_params = 0xa0000100,
1130 .phys_io = 0x40000000,
1131 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1132 .map_io = pxa_map_io,
1133 .init_irq = pxa27x_init_irq,
1134 .timer = &pxa_timer,
1135 .init_machine = em_x270_init,
1136MACHINE_END