21 #include <linux/input.h>
32 #include <linux/i2c.h>
55 #define GPIO13_MMC_CD (13)
56 #define GPIO95_MMC_WP (95)
57 #define GPIO56_NAND_RB (56)
58 #define GPIO93_CAM_RESET (93)
59 #define GPIO16_USB_HUB_RESET (16)
62 #define GPIO114_MMC_CD (114)
63 #define GPIO20_NAND_RB (20)
64 #define GPIO38_SD_PWEN (38)
65 #define GPIO37_WLAN_RST (37)
66 #define GPIO95_TOUCHPAD_INT (95)
67 #define GPIO130_CAM_RESET (130)
68 #define GPIO10_USB_HUB_RESET (10)
71 #define GPIO11_NAND_CS (11)
72 #define GPIO41_ETHIRQ (41)
73 #define EM_X270_ETHIRQ PXA_GPIO_TO_IRQ(GPIO41_ETHIRQ)
74 #define GPIO115_WLAN_PWEN (115)
75 #define GPIO19_WLAN_STRAP (19)
76 #define GPIO9_USB_VBUS_EN (9)
80 static int dm9000_flags;
82 static int usb_hub_reset;
84 static unsigned long common_pin_config[] = {
184 static unsigned long em_x270_pin_config[] = {
192 static unsigned long exeda_pin_config[] = {
200 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
201 static struct resource em_x270_dm9000_resource[] = {
226 .num_resources =
ARRAY_SIZE(em_x270_dm9000_resource),
227 .resource = em_x270_dm9000_resource,
229 .platform_data = &em_x270_dm9000_platdata,
233 static void __init em_x270_init_dm9000(
void)
235 em_x270_dm9000_platdata.
flags |= dm9000_flags;
239 static inline void em_x270_init_dm9000(
void) {}
243 #if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
244 static struct resource em_x270_v3020_resource[] = {
258 .num_resources =
ARRAY_SIZE(em_x270_v3020_resource),
259 .resource = em_x270_v3020_resource,
262 .platform_data = &em_x270_v3020_platdata,
266 static void __init em_x270_init_rtc(
void)
271 static inline void em_x270_init_rtc(
void) {}
275 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
276 static inline void nand_cs_on(
void)
281 static void nand_cs_off(
void)
289 static void em_x270_nand_cmd_ctl(
struct mtd_info *mtd,
int dat,
299 nandaddr |= (1 << 3);
301 nandaddr &= ~(1 << 3);
303 nandaddr |= (1 << 2);
305 nandaddr &= ~(1 << 2);
321 static int em_x270_nand_device_ready(
struct mtd_info *mtd)
345 .nr_partitions =
ARRAY_SIZE(em_x270_partition_info),
346 .partitions = em_x270_partition_info,
351 .dev_ready = em_x270_nand_device_ready,
353 .cmd_ctrl = em_x270_nand_cmd_ctl,
357 static struct resource em_x270_nand_resource[] = {
367 .num_resources =
ARRAY_SIZE(em_x270_nand_resource),
368 .resource = em_x270_nand_resource,
371 .platform_data = &em_x270_nand_platdata,
375 static void __init em_x270_init_nand(
void)
381 pr_warning(
"EM-X270: failed to request NAND CS gpio\n");
389 pr_warning(
"EM-X270: failed to request NAND R/B gpio\n");
399 static inline void em_x270_init_nand(
void) {}
402 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
405 .
name =
"Bootloader",
406 .offset = 0x00000000,
410 .name =
"Environment",
411 .offset = 0x00050000,
415 .offset = 0x00060000,
419 .name =
"Splashscreen",
420 .offset = 0x000b0000,
428 .parts = em_x270_nor_parts,
433 static struct resource em_x270_nor_flash_resource = {
440 .
name =
"physmap-flash",
443 .resource = &em_x270_nor_flash_resource,
445 .platform_data = &em_x270_nor_data,
449 static void __init em_x270_init_nor(
void)
454 static inline void em_x270_init_nor(
void) {}
458 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
459 static struct regulator *em_x270_usb_ldo;
461 static int em_x270_usb_hub_init(
void)
466 if (IS_ERR(em_x270_usb_ldo))
467 return PTR_ERR(em_x270_usb_ldo);
471 goto err_free_usb_ldo;
475 goto err_free_vbus_gpio;
498 static int em_x270_ohci_init(
struct device *
dev)
503 err = em_x270_usb_hub_init();
505 pr_err(
"USB Hub initialization failed: %d\n", err);
513 static void em_x270_ohci_exit(
struct device *dev)
518 if (!IS_ERR(em_x270_usb_ldo)) {
529 .init = em_x270_ohci_init,
530 .exit = em_x270_ohci_exit,
533 static void __init em_x270_init_ohci(
void)
538 static inline void em_x270_init_ohci(
void) {}
542 #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
543 static struct regulator *em_x270_sdio_ldo;
545 static int em_x270_mci_init(
struct device *dev,
552 if (IS_ERR(em_x270_sdio_ldo)) {
553 dev_err(dev,
"can't request SDIO power supply: %ld\n",
554 PTR_ERR(em_x270_sdio_ldo));
555 return PTR_ERR(em_x270_sdio_ldo);
561 "MMC card detect", data);
563 dev_err(dev,
"can't request MMC card detect IRQ: %d\n", err);
567 if (machine_is_em_x270()) {
570 dev_err(dev,
"can't request MMC write protect: %d\n",
578 dev_err(dev,
"can't request MMC power control : %d\n",
595 static void em_x270_mci_setpower(
struct device *dev,
unsigned int vdd)
609 static void em_x270_mci_exit(
struct device *dev,
void *data)
614 if (machine_is_em_x270())
620 static int em_x270_mci_get_ro(
struct device *dev)
631 .init = em_x270_mci_init,
632 .setpower = em_x270_mci_setpower,
633 .exit = em_x270_mci_exit,
634 .gpio_card_detect = -1,
639 static void __init em_x270_init_mmc(
void)
641 if (machine_is_em_x270())
642 em_x270_mci_platform_data.
get_ro = em_x270_mci_get_ro;
647 static inline void em_x270_init_mmc(
void) {}
651 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
682 .
modes = em_x270_lcd_modes,
687 static void __init em_x270_init_lcd(
void)
692 static inline void em_x270_init_lcd(
void) {}
695 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
722 static unsigned long em_x270_libertas_pin_config[] = {
740 if (machine_is_exeda()) {
772 static int em_x270_libertas_teardown(
struct spi_device *spi)
778 if (machine_is_exeda()) {
788 .setup = em_x270_libertas_setup,
789 .teardown = em_x270_libertas_teardown,
794 .modalias =
"tdo24m",
795 .max_speed_hz = 1000000,
798 .controller_data = &em_x270_tdo24m_chip,
799 .platform_data = &em_x270_tdo24m_pdata,
802 .modalias =
"libertas_spi",
803 .max_speed_hz = 13000000,
807 .controller_data = &em_x270_libertas_chip,
808 .platform_data = &em_x270_libertas_pdata,
812 static void __init em_x270_init_spi(
void)
819 static inline void em_x270_init_spi(
void) {}
822 #if defined(CONFIG_SND_PXA2XX_LIB_AC97)
827 static void __init em_x270_init_ac97(
void)
832 static inline void em_x270_init_ac97(
void) {}
835 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
836 static unsigned int em_x270_module_matrix_keys[] = {
845 .matrix_key_cols = 3,
846 .matrix_key_map = em_x270_module_matrix_keys,
847 .matrix_key_map_size =
ARRAY_SIZE(em_x270_module_matrix_keys),
850 static unsigned int em_x270_exeda_matrix_keys[] = {
888 KEY(7, 4, 0),
KEY(7, 5, 0),
889 KEY(7, 6, 0),
KEY(7, 7, 0),
895 .matrix_key_cols = 8,
896 .matrix_key_map = em_x270_exeda_matrix_keys,
897 .matrix_key_map_size =
ARRAY_SIZE(em_x270_exeda_matrix_keys),
900 static void __init em_x270_init_keypad(
void)
902 if (machine_is_em_x270())
908 static inline void em_x270_init_keypad(
void) {}
911 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
914 .
desc =
"sleep/wakeup",
931 .platform_data = &em_x270_gpio_keys_data,
935 static void __init em_x270_init_gpio_keys(
void)
940 static inline void em_x270_init_gpio_keys(
void) {}
944 #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
945 static struct regulator *em_x270_camera_ldo;
947 static int em_x270_sensor_init(
void)
958 if (em_x270_camera_ldo ==
NULL) {
981 static int em_x270_sensor_power(
struct device *dev,
int on)
1012 .power = em_x270_sensor_power,
1013 .board_info = &em_x270_i2c_cam_info[0],
1014 .i2c_adapter_id = 0,
1018 .
name =
"soc-camera-pdrv",
1021 .platform_data = &iclink,
1025 static void __init em_x270_init_camera(
void)
1027 if (em_x270_sensor_init() == 0) {
1033 static inline void em_x270_init_camera(
void) {}
1037 .supply =
"vcc gps",
1043 .supplies = &em_x270_gps_consumer_supply,
1047 .name =
"reg-userspace-consumer",
1050 .platform_data = &em_x270_gps_consumer_data,
1055 .supply =
"vcc gprs",
1061 .supplies = &em_x270_gprs_consumer_supply
1065 .name =
"reg-userspace-consumer",
1068 .platform_data = &em_x270_gprs_consumer_data,
1073 &em_x270_gps_userspace_consumer,
1074 &em_x270_gprs_userspace_consumer,
1077 static void __init em_x270_userspace_consumers_init(
void)
1083 #define REGULATOR_CONSUMER(_name, _dev_name, _supply) \
1084 static struct regulator_consumer_supply _name##_consumers[] = { \
1085 REGULATOR_SUPPLY(_supply, _dev_name), \
1095 #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
1096 static struct regulator_init_data _ldo##_data = { \
1098 .min_uV = _min_uV, \
1099 .max_uV = _max_uV, \
1103 .valid_ops_mask = _ops_mask, \
1106 .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \
1107 .consumer_supplies = _ldo##_consumers, \
1119 .name =
"em-x270:orange",
1120 .default_trigger =
"battery-charging-or-full",
1126 .voltage_max_design = 4200000,
1127 .voltage_min_design = 3000000,
1131 static void em_x270_battery_low(
void)
1133 #if defined(CONFIG_APM_EMULATION)
1138 static void em_x270_battery_critical(
void)
1140 #if defined(CONFIG_APM_EMULATION)
1148 .charge_milliamp = 1000,
1149 .charge_millivolt = 4200,
1153 .vbat_charge_start = 4100,
1154 .vbat_charge_stop = 4200,
1155 .vbat_charge_restart = 4000,
1157 .vcharge_min = 3200,
1158 .vcharge_max = 5500,
1162 .tbat_restart = 100,
1164 .batmon_interval = 0,
1166 .battery_low = em_x270_battery_low,
1167 .battery_critical = em_x270_battery_critical,
1170 #define DA9030_SUBDEV(_name, _id, _pdata) \
1172 .name = "da903x-" #_name, \
1173 .id = DA9030_ID_##_id, \
1174 .platform_data = _pdata, \
1177 #define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data)
1194 .num_subdevs =
ARRAY_SIZE(em_x270_da9030_subdevs),
1201 .platform_data = &em_x270_da9030_info,
1208 static void __init em_x270_init_da9030(
void)
1221 .platform_data = &exeda_gpio_ext_pdata,
1229 static void __init em_x270_init_i2c(
void)
1233 if (machine_is_exeda())
1237 static void __init em_x270_module_init(
void)
1248 static void __init em_x270_exeda_init(
void)
1259 static void __init em_x270_init(
void)
1271 if (machine_is_em_x270())
1272 em_x270_module_init();
1273 else if (machine_is_exeda())
1274 em_x270_exeda_init();
1276 panic(
"Unsupported machine: %d\n", machine_arch_type);
1278 em_x270_init_da9030();
1279 em_x270_init_dm9000();
1281 em_x270_init_nand();
1285 em_x270_init_ohci();
1286 em_x270_init_keypad();
1287 em_x270_init_gpio_keys();
1288 em_x270_init_ac97();
1291 em_x270_init_camera();
1292 em_x270_userspace_consumers_init();
1296 .atag_offset = 0x100,
1302 .init_machine = em_x270_init,
1307 .atag_offset = 0x100,
1313 .init_machine = em_x270_init,