root/arch/arm/mach-pxa/em-x270.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. em_x270_init_dm9000
  2. em_x270_init_dm9000
  3. em_x270_init_rtc
  4. em_x270_init_rtc
  5. nand_cs_on
  6. nand_cs_off
  7. em_x270_nand_cmd_ctl
  8. em_x270_nand_device_ready
  9. em_x270_init_nand
  10. em_x270_init_nand
  11. em_x270_init_nor
  12. em_x270_init_nor
  13. em_x270_usb_hub_init
  14. em_x270_ohci_init
  15. em_x270_ohci_exit
  16. em_x270_init_ohci
  17. em_x270_init_ohci
  18. em_x270_mci_init
  19. em_x270_mci_setpower
  20. em_x270_mci_exit
  21. em_x270_init_mmc
  22. em_x270_init_mmc
  23. em_x270_init_lcd
  24. em_x270_init_lcd
  25. em_x270_libertas_setup
  26. em_x270_libertas_teardown
  27. em_x270_init_spi
  28. em_x270_init_spi
  29. em_x270_init_ac97
  30. em_x270_init_ac97
  31. em_x270_init_keypad
  32. em_x270_init_keypad
  33. em_x270_init_gpio_keys
  34. em_x270_init_gpio_keys
  35. em_x270_sensor_init
  36. em_x270_init_camera
  37. em_x270_init_camera
  38. em_x270_userspace_consumers_init
  39. em_x270_battery_low
  40. em_x270_battery_critical
  41. em_x270_init_da9030
  42. em_x270_init_i2c
  43. em_x270_module_init
  44. em_x270_exeda_init
  45. em_x270_init

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

/* [<][>][^][v][top][bottom][index][help] */