2 * Support for CompuLab EM-X270 platform
4 * Copyright (C) 2007, 2008 CompuLab, Ltd.
5 * Author: Mike Rapoport <mike@compulab.co.il>
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.
12 #include <linux/irq.h>
13 #include <linux/platform_device.h>
14 #include <linux/delay.h>
16 #include <linux/dm9000.h>
17 #include <linux/rtc-v3020.h>
18 #include <linux/mtd/nand.h>
19 #include <linux/mtd/partitions.h>
20 #include <linux/mtd/physmap.h>
21 #include <linux/input.h>
22 #include <linux/gpio_keys.h>
23 #include <linux/gpio.h>
24 #include <linux/mfd/da903x.h>
25 #include <linux/regulator/machine.h>
26 #include <linux/spi/spi.h>
27 #include <linux/spi/tdo24m.h>
28 #include <linux/spi/libertas_spi.h>
29 #include <linux/power_supply.h>
30 #include <linux/apm-emulation.h>
31 #include <linux/delay.h>
33 #include <media/soc_camera.h>
35 #include <asm/mach-types.h>
36 #include <asm/mach/arch.h>
38 #include <mach/pxa27x.h>
39 #include <mach/pxa27x-udc.h>
40 #include <mach/audio.h>
41 #include <mach/pxafb.h>
42 #include <mach/ohci.h>
44 #include <mach/pxa27x_keypad.h>
46 #include <mach/camera.h>
47 #include <mach/pxa2xx_spi.h>
52 /* EM-X270 specific GPIOs */
53 #define GPIO13_MMC_CD (13)
54 #define GPIO95_MMC_WP (95)
55 #define GPIO56_NAND_RB (56)
57 /* eXeda specific GPIOs */
58 #define GPIO114_MMC_CD (114)
59 #define GPIO20_NAND_RB (20)
60 #define GPIO38_SD_PWEN (38)
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)
67 #define GPIO115_WLAN_PWEN (115)
68 #define GPIO19_WLAN_STRAP (19)
72 static int dm9000_flags;
74 static unsigned long common_pin_config[] = {
77 GPIO29_AC97_SDATA_IN_0,
78 GPIO30_AC97_SDATA_OUT,
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,
166 GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */
171 /* SDRAM and local bus */
180 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */
183 GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
184 GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */
185 GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */
188 GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
191 GPIO41_GPIO, /* DM9000 interrupt */
194 static unsigned long em_x270_pin_config[] = {
195 GPIO13_GPIO, /* MMC card detect */
196 GPIO56_GPIO, /* NAND Ready/Busy */
197 GPIO95_GPIO, /* MMC Write protect */
200 static 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 */
206 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
207 static struct resource em_x270_dm9000_resource[] = {
209 .start = PXA_CS2_PHYS,
210 .end = PXA_CS2_PHYS + 3,
211 .flags = IORESOURCE_MEM,
214 .start = PXA_CS2_PHYS + 8,
215 .end = PXA_CS2_PHYS + 8 + 0x3f,
216 .flags = IORESOURCE_MEM,
219 .start = EM_X270_ETHIRQ,
220 .end = EM_X270_ETHIRQ,
221 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
225 static struct dm9000_plat_data em_x270_dm9000_platdata = {
226 .flags = DM9000_PLATF_NO_EEPROM,
229 static struct platform_device em_x270_dm9000 = {
232 .num_resources = ARRAY_SIZE(em_x270_dm9000_resource),
233 .resource = em_x270_dm9000_resource,
235 .platform_data = &em_x270_dm9000_platdata,
239 static void __init em_x270_init_dm9000(void)
241 em_x270_dm9000_platdata.flags |= dm9000_flags;
242 platform_device_register(&em_x270_dm9000);
245 static inline void em_x270_init_dm9000(void) {}
249 #if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
250 static struct resource em_x270_v3020_resource[] = {
252 .start = PXA_CS4_PHYS,
253 .end = PXA_CS4_PHYS + 3,
254 .flags = IORESOURCE_MEM,
258 static struct v3020_platform_data em_x270_v3020_platdata = {
262 static struct platform_device em_x270_rtc = {
264 .num_resources = ARRAY_SIZE(em_x270_v3020_resource),
265 .resource = em_x270_v3020_resource,
268 .platform_data = &em_x270_v3020_platdata,
272 static void __init em_x270_init_rtc(void)
274 platform_device_register(&em_x270_rtc);
277 static inline void em_x270_init_rtc(void) {}
281 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
282 static inline void nand_cs_on(void)
284 gpio_set_value(GPIO11_NAND_CS, 0);
287 static void nand_cs_off(void)
291 gpio_set_value(GPIO11_NAND_CS, 1);
294 /* hardware specific access to control-lines */
295 static void em_x270_nand_cmd_ctl(struct mtd_info *mtd, int dat,
298 struct nand_chip *this = mtd->priv;
299 unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
303 if (ctrl & NAND_CTRL_CHANGE) {
305 nandaddr |= (1 << 3);
307 nandaddr &= ~(1 << 3);
309 nandaddr |= (1 << 2);
311 nandaddr &= ~(1 << 2);
319 this->IO_ADDR_W = (void __iomem *)nandaddr;
320 if (dat != NAND_CMD_NONE)
321 writel(dat, this->IO_ADDR_W);
326 /* read device ready pin */
327 static int em_x270_nand_device_ready(struct mtd_info *mtd)
331 return gpio_get_value(nand_rb);
334 static struct mtd_partition em_x270_partition_info[] = {
342 .offset = MTDPART_OFS_APPEND,
343 .size = MTDPART_SIZ_FULL
347 static const char *em_x270_part_probes[] = { "cmdlinepart", NULL };
349 struct platform_nand_data em_x270_nand_platdata = {
353 .nr_partitions = ARRAY_SIZE(em_x270_partition_info),
354 .partitions = em_x270_partition_info,
356 .part_probe_types = em_x270_part_probes,
360 .dev_ready = em_x270_nand_device_ready,
362 .cmd_ctrl = em_x270_nand_cmd_ctl,
366 static struct resource em_x270_nand_resource[] = {
368 .start = PXA_CS1_PHYS,
369 .end = PXA_CS1_PHYS + 12,
370 .flags = IORESOURCE_MEM,
374 static struct platform_device em_x270_nand = {
376 .num_resources = ARRAY_SIZE(em_x270_nand_resource),
377 .resource = em_x270_nand_resource,
380 .platform_data = &em_x270_nand_platdata,
384 static void __init em_x270_init_nand(void)
388 err = gpio_request(GPIO11_NAND_CS, "NAND CS");
390 pr_warning("EM-X270: failed to request NAND CS gpio\n");
394 gpio_direction_output(GPIO11_NAND_CS, 1);
396 err = gpio_request(nand_rb, "NAND R/B");
398 pr_warning("EM-X270: failed to request NAND R/B gpio\n");
399 gpio_free(GPIO11_NAND_CS);
403 gpio_direction_input(nand_rb);
405 platform_device_register(&em_x270_nand);
408 static inline void em_x270_init_nand(void) {}
411 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
412 static struct mtd_partition em_x270_nor_parts[] = {
414 .name = "Bootloader",
415 .offset = 0x00000000,
417 .mask_flags = MTD_WRITEABLE /* force read-only */
419 .name = "Environment",
420 .offset = 0x00050000,
424 .offset = 0x00060000,
426 .mask_flags = MTD_WRITEABLE /* force read-only */
428 .name = "Splashscreen",
429 .offset = 0x000b0000,
434 static struct physmap_flash_data em_x270_nor_data[] = {
437 .parts = em_x270_nor_parts,
438 .nr_parts = ARRAY_SIZE(em_x270_nor_parts),
442 static struct resource em_x270_nor_flash_resource = {
443 .start = PXA_CS0_PHYS,
444 .end = PXA_CS0_PHYS + SZ_1M - 1,
445 .flags = IORESOURCE_MEM,
448 static struct platform_device em_x270_physmap_flash = {
449 .name = "physmap-flash",
452 .resource = &em_x270_nor_flash_resource,
454 .platform_data = &em_x270_nor_data,
458 static void __init em_x270_init_nor(void)
460 platform_device_register(&em_x270_physmap_flash);
463 static inline void em_x270_init_nor(void) {}
466 /* PXA27x OHCI controller setup */
467 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
468 static int em_x270_ohci_init(struct device *dev)
470 /* enable port 2 transiever */
471 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE;
476 static struct pxaohci_platform_data em_x270_ohci_platform_data = {
477 .port_mode = PMM_PERPORT_MODE,
478 .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW,
479 .init = em_x270_ohci_init,
482 static void __init em_x270_init_ohci(void)
484 pxa_set_ohci_info(&em_x270_ohci_platform_data);
487 static inline void em_x270_init_ohci(void) {}
490 /* MCI controller setup */
491 #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
492 static struct regulator *em_x270_sdio_ldo;
494 static int em_x270_mci_init(struct device *dev,
495 irq_handler_t em_x270_detect_int,
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);
507 err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
508 IRQF_DISABLED | IRQF_TRIGGER_RISING |
509 IRQF_TRIGGER_FALLING,
510 "MMC card detect", data);
512 dev_err(dev, "can't request MMC card detect IRQ: %d\n", err);
516 if (machine_is_em_x270()) {
517 err = gpio_request(GPIO95_MMC_WP, "MMC WP");
519 dev_err(dev, "can't request MMC write protect: %d\n",
523 gpio_direction_input(GPIO95_MMC_WP);
525 err = gpio_request(GPIO38_SD_PWEN, "sdio power");
527 dev_err(dev, "can't request MMC power control : %d\n",
531 gpio_direction_output(GPIO38_SD_PWEN, 1);
537 free_irq(gpio_to_irq(mmc_cd), data);
539 regulator_put(em_x270_sdio_ldo);
544 static void em_x270_mci_setpower(struct device *dev, unsigned int vdd)
546 struct pxamci_platform_data* p_d = dev->platform_data;
548 if ((1 << vdd) & p_d->ocr_mask) {
549 int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000;
551 regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV);
552 regulator_enable(em_x270_sdio_ldo);
554 regulator_disable(em_x270_sdio_ldo);
558 static void em_x270_mci_exit(struct device *dev, void *data)
560 free_irq(gpio_to_irq(mmc_cd), data);
561 regulator_put(em_x270_sdio_ldo);
563 if (machine_is_em_x270())
564 gpio_free(GPIO95_MMC_WP);
566 gpio_free(GPIO38_SD_PWEN);
569 static int em_x270_mci_get_ro(struct device *dev)
571 return gpio_get_value(GPIO95_MMC_WP);
574 static struct pxamci_platform_data em_x270_mci_platform_data = {
575 .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,
579 .init = em_x270_mci_init,
580 .setpower = em_x270_mci_setpower,
581 .exit = em_x270_mci_exit,
584 static void __init em_x270_init_mmc(void)
586 if (machine_is_em_x270())
587 em_x270_mci_platform_data.get_ro = em_x270_mci_get_ro;
589 em_x270_mci_platform_data.detect_delay = msecs_to_jiffies(250);
590 pxa_set_mci_info(&em_x270_mci_platform_data);
593 static inline void em_x270_init_mmc(void) {}
597 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
598 static struct pxafb_mode_info em_x270_lcd_modes[] = {
627 static struct pxafb_mach_info em_x270_lcd = {
628 .modes = em_x270_lcd_modes,
630 .lcd_conn = LCD_COLOR_TFT_16BPP,
633 static void __init em_x270_init_lcd(void)
635 set_pxa_fb_info(&em_x270_lcd);
638 static inline void em_x270_init_lcd(void) {}
641 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
642 static struct pxa2xx_spi_master em_x270_spi_info = {
646 static struct pxa2xx_spi_chip em_x270_tdo24m_chip = {
652 static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
656 static struct pxa2xx_spi_master em_x270_spi_2_info = {
661 static struct pxa2xx_spi_chip em_x270_libertas_chip = {
667 static unsigned long em_x270_libertas_pin_config[] = {
675 static int em_x270_libertas_setup(struct spi_device *spi)
677 int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN");
681 gpio_direction_output(GPIO19_WLAN_STRAP, 1);
684 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config));
686 gpio_direction_output(GPIO115_WLAN_PWEN, 0);
688 gpio_set_value(GPIO115_WLAN_PWEN, 1);
691 spi->bits_per_word = 16;
697 static int em_x270_libertas_teardown(struct spi_device *spi)
699 gpio_set_value(GPIO115_WLAN_PWEN, 0);
700 gpio_free(GPIO115_WLAN_PWEN);
705 struct libertas_spi_platform_data em_x270_libertas_pdata = {
706 .use_dummy_writes = 1,
708 .setup = em_x270_libertas_setup,
709 .teardown = em_x270_libertas_teardown,
712 static struct spi_board_info em_x270_spi_devices[] __initdata = {
714 .modalias = "tdo24m",
715 .max_speed_hz = 1000000,
718 .controller_data = &em_x270_tdo24m_chip,
719 .platform_data = &em_x270_tdo24m_pdata,
722 .modalias = "libertas_spi",
723 .max_speed_hz = 13000000,
725 .irq = IRQ_GPIO(116),
727 .controller_data = &em_x270_libertas_chip,
728 .platform_data = &em_x270_libertas_pdata,
732 static void __init em_x270_init_spi(void)
734 pxa2xx_set_spi_info(1, &em_x270_spi_info);
735 pxa2xx_set_spi_info(2, &em_x270_spi_2_info);
736 spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
739 static inline void em_x270_init_spi(void) {}
742 #if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
743 static void __init em_x270_init_ac97(void)
745 pxa_set_ac97_info(NULL);
748 static inline void em_x270_init_ac97(void) {}
751 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
752 static unsigned int em_x270_module_matrix_keys[] = {
753 KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
754 KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
755 KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
758 struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
759 /* code map for the matrix keys */
760 .matrix_key_rows = 3,
761 .matrix_key_cols = 3,
762 .matrix_key_map = em_x270_module_matrix_keys,
763 .matrix_key_map_size = ARRAY_SIZE(em_x270_module_matrix_keys),
766 static unsigned int em_x270_exeda_matrix_keys[] = {
767 KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
768 KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
769 KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
770 KEY(0, 6, KEY_ENTER), KEY(0, 7, KEY_SLASH),
772 KEY(1, 0, KEY_DOT), KEY(1, 1, KEY_M),
773 KEY(1, 2, KEY_N), KEY(1, 3, KEY_B),
774 KEY(1, 4, KEY_V), KEY(1, 5, KEY_C),
775 KEY(1, 6, KEY_X), KEY(1, 7, KEY_Z),
777 KEY(2, 0, KEY_LEFTSHIFT), KEY(2, 1, KEY_SEMICOLON),
778 KEY(2, 2, KEY_L), KEY(2, 3, KEY_K),
779 KEY(2, 4, KEY_J), KEY(2, 5, KEY_H),
780 KEY(2, 6, KEY_G), KEY(2, 7, KEY_F),
782 KEY(3, 0, KEY_D), KEY(3, 1, KEY_S),
783 KEY(3, 2, KEY_A), KEY(3, 3, KEY_TAB),
784 KEY(3, 4, KEY_BACKSPACE), KEY(3, 5, KEY_P),
785 KEY(3, 6, KEY_O), KEY(3, 7, KEY_I),
787 KEY(4, 0, KEY_U), KEY(4, 1, KEY_Y),
788 KEY(4, 2, KEY_T), KEY(4, 3, KEY_R),
789 KEY(4, 4, KEY_E), KEY(4, 5, KEY_W),
790 KEY(4, 6, KEY_Q), KEY(4, 7, KEY_MINUS),
792 KEY(5, 0, KEY_0), KEY(5, 1, KEY_9),
793 KEY(5, 2, KEY_8), KEY(5, 3, KEY_7),
794 KEY(5, 4, KEY_6), KEY(5, 5, KEY_5),
795 KEY(5, 6, KEY_4), KEY(5, 7, KEY_3),
797 KEY(6, 0, KEY_2), KEY(6, 1, KEY_1),
798 KEY(6, 2, KEY_ENTER), KEY(6, 3, KEY_END),
799 KEY(6, 4, KEY_DOWN), KEY(6, 5, KEY_UP),
800 KEY(6, 6, KEY_MENU), KEY(6, 7, KEY_F1),
802 KEY(7, 0, KEY_LEFT), KEY(7, 1, KEY_RIGHT),
803 KEY(7, 2, KEY_BACK), KEY(7, 3, KEY_HOME),
804 KEY(7, 4, 0), KEY(7, 5, 0),
805 KEY(7, 6, 0), KEY(7, 7, 0),
808 struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
809 /* code map for the matrix keys */
810 .matrix_key_rows = 8,
811 .matrix_key_cols = 8,
812 .matrix_key_map = em_x270_exeda_matrix_keys,
813 .matrix_key_map_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
816 static void __init em_x270_init_keypad(void)
818 if (machine_is_em_x270())
819 pxa_set_keypad_info(&em_x270_module_keypad_info);
821 pxa_set_keypad_info(&em_x270_exeda_keypad_info);
824 static inline void em_x270_init_keypad(void) {}
827 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
828 static struct gpio_keys_button gpio_keys_button[] = {
830 .desc = "sleep/wakeup",
838 static struct gpio_keys_platform_data em_x270_gpio_keys_data = {
839 .buttons = gpio_keys_button,
843 static struct platform_device em_x270_gpio_keys = {
847 .platform_data = &em_x270_gpio_keys_data,
851 static void __init em_x270_init_gpio_keys(void)
853 platform_device_register(&em_x270_gpio_keys);
856 static inline void em_x270_init_gpio_keys(void) {}
859 /* Quick Capture Interface and sensor setup */
860 #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
861 static struct regulator *em_x270_camera_ldo;
863 static int em_x270_sensor_init(struct device *dev)
867 ret = gpio_request(GPIO93_CAM_RESET, "camera reset");
871 gpio_direction_output(GPIO93_CAM_RESET, 0);
873 em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
874 if (em_x270_camera_ldo == NULL) {
875 gpio_free(GPIO93_CAM_RESET);
879 ret = regulator_enable(em_x270_camera_ldo);
881 regulator_put(em_x270_camera_ldo);
882 gpio_free(GPIO93_CAM_RESET);
886 gpio_set_value(GPIO93_CAM_RESET, 1);
891 struct pxacamera_platform_data em_x270_camera_platform_data = {
892 .init = em_x270_sensor_init,
893 .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
894 PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
898 static int em_x270_sensor_power(struct device *dev, int on)
901 int is_on = regulator_is_enabled(em_x270_camera_ldo);
906 gpio_set_value(GPIO93_CAM_RESET, !on);
909 ret = regulator_enable(em_x270_camera_ldo);
911 ret = regulator_disable(em_x270_camera_ldo);
916 gpio_set_value(GPIO93_CAM_RESET, on);
921 static struct soc_camera_link iclink = {
923 .power = em_x270_sensor_power,
926 static struct i2c_board_info em_x270_i2c_cam_info[] = {
928 I2C_BOARD_INFO("mt9m111", 0x48),
929 .platform_data = &iclink,
933 static struct i2c_pxa_platform_data em_x270_i2c_info = {
937 static void __init em_x270_init_camera(void)
939 pxa_set_i2c_info(&em_x270_i2c_info);
940 i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info));
941 pxa_set_camera_info(&em_x270_camera_platform_data);
944 static inline void em_x270_init_camera(void) {}
947 /* DA9030 related initializations */
948 #define REGULATOR_CONSUMER(_name, _dev, _supply) \
949 static struct regulator_consumer_supply _name##_consumers[] = { \
956 REGULATOR_CONSUMER(ldo3, NULL, "vcc gps");
957 REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
958 REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio");
959 REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
960 REGULATOR_CONSUMER(ldo19, NULL, "vcc gprs");
962 #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
963 static struct regulator_init_data _ldo##_data = { \
970 .valid_ops_mask = _ops_mask, \
972 .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \
973 .consumer_supplies = _ldo##_consumers, \
976 REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
977 REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
978 REGULATOR_INIT(ldo10, 2000000, 3200000,
979 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE);
980 REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
981 REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
983 struct led_info em_x270_led_info = {
984 .name = "em-x270:orange",
985 .default_trigger = "battery-charging-or-full",
988 struct power_supply_info em_x270_psy_info = {
989 .name = "LP555597P6H-FPS",
990 .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
991 .voltage_max_design = 4200000,
992 .voltage_min_design = 3000000,
996 static void em_x270_battery_low(void)
998 apm_queue_event(APM_LOW_BATTERY);
1001 static void em_x270_battery_critical(void)
1003 apm_queue_event(APM_CRITICAL_SUSPEND);
1006 struct da9030_battery_info em_x270_batterty_info = {
1007 .battery_info = &em_x270_psy_info,
1009 .charge_milliamp = 1000,
1010 .charge_millivolt = 4200,
1014 .vbat_charge_start = 4100,
1015 .vbat_charge_stop = 4200,
1016 .vbat_charge_restart = 4000,
1018 .vcharge_min = 3200,
1019 .vcharge_max = 5500,
1023 .tbat_restart = 100,
1025 .batmon_interval = 0,
1027 .battery_low = em_x270_battery_low,
1028 .battery_critical = em_x270_battery_critical,
1031 #define DA9030_SUBDEV(_name, _id, _pdata) \
1033 .name = "da903x-" #_name, \
1034 .id = DA9030_ID_##_id, \
1035 .platform_data = _pdata, \
1038 #define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data)
1040 struct da903x_subdev_info em_x270_da9030_subdevs[] = {
1047 DA9030_SUBDEV(led, LED_PC, &em_x270_led_info),
1048 DA9030_SUBDEV(backlight, WLED, &em_x270_led_info),
1049 DA9030_SUBDEV(battery, BAT, &em_x270_batterty_info),
1052 static struct da903x_platform_data em_x270_da9030_info = {
1053 .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs),
1054 .subdevs = em_x270_da9030_subdevs,
1057 static struct i2c_board_info em_x270_i2c_pmic_info = {
1058 I2C_BOARD_INFO("da9030", 0x49),
1060 .platform_data = &em_x270_da9030_info,
1063 static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = {
1067 static void __init em_x270_init_da9030(void)
1069 pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info);
1070 i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
1073 static void __init em_x270_module_init(void)
1075 pr_info("%s\n", __func__);
1076 pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
1078 mmc_cd = GPIO13_MMC_CD;
1079 nand_rb = GPIO56_NAND_RB;
1080 dm9000_flags = DM9000_PLATF_32BITONLY;
1083 static void __init em_x270_exeda_init(void)
1085 pr_info("%s\n", __func__);
1086 pxa2xx_mfp_config(ARRAY_AND_SIZE(exeda_pin_config));
1088 mmc_cd = GPIO114_MMC_CD;
1089 nand_rb = GPIO20_NAND_RB;
1090 dm9000_flags = DM9000_PLATF_16BITONLY;
1093 static void __init em_x270_init(void)
1095 pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config));
1097 if (machine_is_em_x270())
1098 em_x270_module_init();
1099 else if (machine_is_exeda())
1100 em_x270_exeda_init();
1102 panic("Unsupported machine: %d\n", machine_arch_type);
1104 em_x270_init_da9030();
1105 em_x270_init_dm9000();
1107 em_x270_init_nand();
1111 em_x270_init_ohci();
1112 em_x270_init_keypad();
1113 em_x270_init_gpio_keys();
1114 em_x270_init_ac97();
1115 em_x270_init_camera();
1119 MACHINE_START(EM_X270, "Compulab EM-X270")
1120 .boot_params = 0xa0000100,
1121 .phys_io = 0x40000000,
1122 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1123 .map_io = pxa_map_io,
1124 .init_irq = pxa27x_init_irq,
1125 .timer = &pxa_timer,
1126 .init_machine = em_x270_init,
1129 MACHINE_START(EXEDA, "Compulab eXeda")
1130 .boot_params = 0xa0000100,
1131 .phys_io = 0x40000000,
1132 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
1133 .map_io = pxa_map_io,
1134 .init_irq = pxa27x_init_irq,
1135 .timer = &pxa_timer,
1136 .init_machine = em_x270_init,