em-x270.c 30 KB

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