em-x270.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302
  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/platform_data/rtc-v3020.h>
  16. #include <linux/mtd/rawnand.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/regulator/fixed.h>
  25. #include <linux/spi/spi.h>
  26. #include <linux/spi/tdo24m.h>
  27. #include <linux/spi/libertas_spi.h>
  28. #include <linux/spi/pxa2xx_spi.h>
  29. #include <linux/power_supply.h>
  30. #include <linux/apm-emulation.h>
  31. #include <linux/i2c.h>
  32. #include <linux/platform_data/pca953x.h>
  33. #include <linux/platform_data/i2c-pxa.h>
  34. #include <linux/regulator/userspace-consumer.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/mach/arch.h>
  37. #include "pxa27x.h"
  38. #include "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/media/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_to_nand(mtd);
  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. .dev_ready = em_x270_nand_device_ready,
  304. .select_chip = 0,
  305. .cmd_ctrl = em_x270_nand_cmd_ctl,
  306. },
  307. };
  308. static struct resource em_x270_nand_resource[] = {
  309. [0] = {
  310. .start = PXA_CS1_PHYS,
  311. .end = PXA_CS1_PHYS + 12,
  312. .flags = IORESOURCE_MEM,
  313. },
  314. };
  315. static struct platform_device em_x270_nand = {
  316. .name = "gen_nand",
  317. .num_resources = ARRAY_SIZE(em_x270_nand_resource),
  318. .resource = em_x270_nand_resource,
  319. .id = -1,
  320. .dev = {
  321. .platform_data = &em_x270_nand_platdata,
  322. }
  323. };
  324. static void __init em_x270_init_nand(void)
  325. {
  326. int err;
  327. err = gpio_request(GPIO11_NAND_CS, "NAND CS");
  328. if (err) {
  329. pr_warn("EM-X270: failed to request NAND CS gpio\n");
  330. return;
  331. }
  332. gpio_direction_output(GPIO11_NAND_CS, 1);
  333. err = gpio_request(nand_rb, "NAND R/B");
  334. if (err) {
  335. pr_warn("EM-X270: failed to request NAND R/B gpio\n");
  336. gpio_free(GPIO11_NAND_CS);
  337. return;
  338. }
  339. gpio_direction_input(nand_rb);
  340. platform_device_register(&em_x270_nand);
  341. }
  342. #else
  343. static inline void em_x270_init_nand(void) {}
  344. #endif
  345. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  346. static struct mtd_partition em_x270_nor_parts[] = {
  347. {
  348. .name = "Bootloader",
  349. .offset = 0x00000000,
  350. .size = 0x00050000,
  351. .mask_flags = MTD_WRITEABLE /* force read-only */
  352. }, {
  353. .name = "Environment",
  354. .offset = 0x00050000,
  355. .size = 0x00010000,
  356. }, {
  357. .name = "Reserved",
  358. .offset = 0x00060000,
  359. .size = 0x00050000,
  360. .mask_flags = MTD_WRITEABLE /* force read-only */
  361. }, {
  362. .name = "Splashscreen",
  363. .offset = 0x000b0000,
  364. .size = 0x00050000,
  365. }
  366. };
  367. static struct physmap_flash_data em_x270_nor_data[] = {
  368. [0] = {
  369. .width = 2,
  370. .parts = em_x270_nor_parts,
  371. .nr_parts = ARRAY_SIZE(em_x270_nor_parts),
  372. },
  373. };
  374. static struct resource em_x270_nor_flash_resource = {
  375. .start = PXA_CS0_PHYS,
  376. .end = PXA_CS0_PHYS + SZ_1M - 1,
  377. .flags = IORESOURCE_MEM,
  378. };
  379. static struct platform_device em_x270_physmap_flash = {
  380. .name = "physmap-flash",
  381. .id = 0,
  382. .num_resources = 1,
  383. .resource = &em_x270_nor_flash_resource,
  384. .dev = {
  385. .platform_data = &em_x270_nor_data,
  386. },
  387. };
  388. static void __init em_x270_init_nor(void)
  389. {
  390. platform_device_register(&em_x270_physmap_flash);
  391. }
  392. #else
  393. static inline void em_x270_init_nor(void) {}
  394. #endif
  395. /* PXA27x OHCI controller setup */
  396. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  397. static struct regulator *em_x270_usb_ldo;
  398. static int em_x270_usb_hub_init(void)
  399. {
  400. int err;
  401. em_x270_usb_ldo = regulator_get(NULL, "vcc usb");
  402. if (IS_ERR(em_x270_usb_ldo))
  403. return PTR_ERR(em_x270_usb_ldo);
  404. err = gpio_request(GPIO9_USB_VBUS_EN, "vbus en");
  405. if (err)
  406. goto err_free_usb_ldo;
  407. err = gpio_request(usb_hub_reset, "hub rst");
  408. if (err)
  409. goto err_free_vbus_gpio;
  410. /* USB Hub power-on and reset */
  411. gpio_direction_output(usb_hub_reset, 1);
  412. gpio_direction_output(GPIO9_USB_VBUS_EN, 0);
  413. err = regulator_enable(em_x270_usb_ldo);
  414. if (err)
  415. goto err_free_rst_gpio;
  416. gpio_set_value(usb_hub_reset, 0);
  417. gpio_set_value(usb_hub_reset, 1);
  418. regulator_disable(em_x270_usb_ldo);
  419. err = regulator_enable(em_x270_usb_ldo);
  420. if (err)
  421. goto err_free_rst_gpio;
  422. gpio_set_value(usb_hub_reset, 0);
  423. gpio_set_value(GPIO9_USB_VBUS_EN, 1);
  424. return 0;
  425. err_free_rst_gpio:
  426. gpio_free(usb_hub_reset);
  427. err_free_vbus_gpio:
  428. gpio_free(GPIO9_USB_VBUS_EN);
  429. err_free_usb_ldo:
  430. regulator_put(em_x270_usb_ldo);
  431. return err;
  432. }
  433. static int em_x270_ohci_init(struct device *dev)
  434. {
  435. int err;
  436. /* we don't want to entirely disable USB if the HUB init failed */
  437. err = em_x270_usb_hub_init();
  438. if (err)
  439. pr_err("USB Hub initialization failed: %d\n", err);
  440. /* enable port 2 transiever */
  441. UP2OCR = UP2OCR_HXS | UP2OCR_HXOE;
  442. return 0;
  443. }
  444. static void em_x270_ohci_exit(struct device *dev)
  445. {
  446. gpio_free(usb_hub_reset);
  447. gpio_free(GPIO9_USB_VBUS_EN);
  448. if (!IS_ERR(em_x270_usb_ldo)) {
  449. if (regulator_is_enabled(em_x270_usb_ldo))
  450. regulator_disable(em_x270_usb_ldo);
  451. regulator_put(em_x270_usb_ldo);
  452. }
  453. }
  454. static struct pxaohci_platform_data em_x270_ohci_platform_data = {
  455. .port_mode = PMM_PERPORT_MODE,
  456. .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW,
  457. .init = em_x270_ohci_init,
  458. .exit = em_x270_ohci_exit,
  459. };
  460. static void __init em_x270_init_ohci(void)
  461. {
  462. pxa_set_ohci_info(&em_x270_ohci_platform_data);
  463. }
  464. #else
  465. static inline void em_x270_init_ohci(void) {}
  466. #endif
  467. /* MCI controller setup */
  468. #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
  469. static struct regulator *em_x270_sdio_ldo;
  470. static int em_x270_mci_init(struct device *dev,
  471. irq_handler_t em_x270_detect_int,
  472. void *data)
  473. {
  474. int err;
  475. em_x270_sdio_ldo = regulator_get(dev, "vcc sdio");
  476. if (IS_ERR(em_x270_sdio_ldo)) {
  477. dev_err(dev, "can't request SDIO power supply: %ld\n",
  478. PTR_ERR(em_x270_sdio_ldo));
  479. return PTR_ERR(em_x270_sdio_ldo);
  480. }
  481. err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
  482. IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
  483. "MMC card detect", data);
  484. if (err) {
  485. dev_err(dev, "can't request MMC card detect IRQ: %d\n", err);
  486. goto err_irq;
  487. }
  488. if (machine_is_em_x270()) {
  489. err = gpio_request(GPIO95_MMC_WP, "MMC WP");
  490. if (err) {
  491. dev_err(dev, "can't request MMC write protect: %d\n",
  492. err);
  493. goto err_gpio_wp;
  494. }
  495. gpio_direction_input(GPIO95_MMC_WP);
  496. } else {
  497. err = gpio_request(GPIO38_SD_PWEN, "sdio power");
  498. if (err) {
  499. dev_err(dev, "can't request MMC power control : %d\n",
  500. err);
  501. goto err_gpio_wp;
  502. }
  503. gpio_direction_output(GPIO38_SD_PWEN, 1);
  504. }
  505. return 0;
  506. err_gpio_wp:
  507. free_irq(gpio_to_irq(mmc_cd), data);
  508. err_irq:
  509. regulator_put(em_x270_sdio_ldo);
  510. return err;
  511. }
  512. static int em_x270_mci_setpower(struct device *dev, unsigned int vdd)
  513. {
  514. struct pxamci_platform_data* p_d = dev->platform_data;
  515. if ((1 << vdd) & p_d->ocr_mask) {
  516. int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000;
  517. regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV);
  518. return regulator_enable(em_x270_sdio_ldo);
  519. } else {
  520. regulator_disable(em_x270_sdio_ldo);
  521. }
  522. return 0;
  523. }
  524. static void em_x270_mci_exit(struct device *dev, void *data)
  525. {
  526. free_irq(gpio_to_irq(mmc_cd), data);
  527. regulator_put(em_x270_sdio_ldo);
  528. if (machine_is_em_x270())
  529. gpio_free(GPIO95_MMC_WP);
  530. else
  531. gpio_free(GPIO38_SD_PWEN);
  532. }
  533. static int em_x270_mci_get_ro(struct device *dev)
  534. {
  535. return gpio_get_value(GPIO95_MMC_WP);
  536. }
  537. static struct pxamci_platform_data em_x270_mci_platform_data = {
  538. .detect_delay_ms = 250,
  539. .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23|
  540. MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27|
  541. MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
  542. MMC_VDD_30_31|MMC_VDD_31_32,
  543. .init = em_x270_mci_init,
  544. .setpower = em_x270_mci_setpower,
  545. .exit = em_x270_mci_exit,
  546. .gpio_card_detect = -1,
  547. .gpio_card_ro = -1,
  548. .gpio_power = -1,
  549. };
  550. static void __init em_x270_init_mmc(void)
  551. {
  552. if (machine_is_em_x270())
  553. em_x270_mci_platform_data.get_ro = em_x270_mci_get_ro;
  554. pxa_set_mci_info(&em_x270_mci_platform_data);
  555. }
  556. #else
  557. static inline void em_x270_init_mmc(void) {}
  558. #endif
  559. /* LCD */
  560. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  561. static struct pxafb_mode_info em_x270_lcd_modes[] = {
  562. [0] = {
  563. .pixclock = 38250,
  564. .bpp = 16,
  565. .xres = 480,
  566. .yres = 640,
  567. .hsync_len = 8,
  568. .vsync_len = 2,
  569. .left_margin = 8,
  570. .upper_margin = 2,
  571. .right_margin = 24,
  572. .lower_margin = 4,
  573. .sync = 0,
  574. },
  575. [1] = {
  576. .pixclock = 153800,
  577. .bpp = 16,
  578. .xres = 240,
  579. .yres = 320,
  580. .hsync_len = 8,
  581. .vsync_len = 2,
  582. .left_margin = 8,
  583. .upper_margin = 2,
  584. .right_margin = 88,
  585. .lower_margin = 2,
  586. .sync = 0,
  587. },
  588. };
  589. static struct pxafb_mach_info em_x270_lcd = {
  590. .modes = em_x270_lcd_modes,
  591. .num_modes = 2,
  592. .lcd_conn = LCD_COLOR_TFT_16BPP,
  593. };
  594. static void __init em_x270_init_lcd(void)
  595. {
  596. pxa_set_fb_info(NULL, &em_x270_lcd);
  597. }
  598. #else
  599. static inline void em_x270_init_lcd(void) {}
  600. #endif
  601. #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
  602. static struct pxa2xx_spi_master em_x270_spi_info = {
  603. .num_chipselect = 1,
  604. };
  605. static struct pxa2xx_spi_chip em_x270_tdo24m_chip = {
  606. .rx_threshold = 1,
  607. .tx_threshold = 1,
  608. .gpio_cs = -1,
  609. };
  610. static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
  611. .model = TDO35S,
  612. };
  613. static struct pxa2xx_spi_master em_x270_spi_2_info = {
  614. .num_chipselect = 1,
  615. .enable_dma = 1,
  616. };
  617. static struct pxa2xx_spi_chip em_x270_libertas_chip = {
  618. .rx_threshold = 1,
  619. .tx_threshold = 1,
  620. .timeout = 1000,
  621. .gpio_cs = 14,
  622. };
  623. static unsigned long em_x270_libertas_pin_config[] = {
  624. /* SSP2 */
  625. GPIO19_SSP2_SCLK,
  626. GPIO14_GPIO,
  627. GPIO89_SSP2_TXD,
  628. GPIO88_SSP2_RXD,
  629. };
  630. static int em_x270_libertas_setup(struct spi_device *spi)
  631. {
  632. int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN");
  633. if (err)
  634. return err;
  635. err = gpio_request(GPIO19_WLAN_STRAP, "WLAN STRAP");
  636. if (err)
  637. goto err_free_pwen;
  638. if (machine_is_exeda()) {
  639. err = gpio_request(GPIO37_WLAN_RST, "WLAN RST");
  640. if (err)
  641. goto err_free_strap;
  642. gpio_direction_output(GPIO37_WLAN_RST, 1);
  643. msleep(100);
  644. }
  645. gpio_direction_output(GPIO19_WLAN_STRAP, 1);
  646. msleep(100);
  647. pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config));
  648. gpio_direction_output(GPIO115_WLAN_PWEN, 0);
  649. msleep(100);
  650. gpio_set_value(GPIO115_WLAN_PWEN, 1);
  651. msleep(100);
  652. spi->bits_per_word = 16;
  653. spi_setup(spi);
  654. return 0;
  655. err_free_strap:
  656. gpio_free(GPIO19_WLAN_STRAP);
  657. err_free_pwen:
  658. gpio_free(GPIO115_WLAN_PWEN);
  659. return err;
  660. }
  661. static int em_x270_libertas_teardown(struct spi_device *spi)
  662. {
  663. gpio_set_value(GPIO115_WLAN_PWEN, 0);
  664. gpio_free(GPIO115_WLAN_PWEN);
  665. gpio_free(GPIO19_WLAN_STRAP);
  666. if (machine_is_exeda()) {
  667. gpio_set_value(GPIO37_WLAN_RST, 0);
  668. gpio_free(GPIO37_WLAN_RST);
  669. }
  670. return 0;
  671. }
  672. struct libertas_spi_platform_data em_x270_libertas_pdata = {
  673. .use_dummy_writes = 1,
  674. .setup = em_x270_libertas_setup,
  675. .teardown = em_x270_libertas_teardown,
  676. };
  677. static struct spi_board_info em_x270_spi_devices[] __initdata = {
  678. {
  679. .modalias = "tdo24m",
  680. .max_speed_hz = 1000000,
  681. .bus_num = 1,
  682. .chip_select = 0,
  683. .controller_data = &em_x270_tdo24m_chip,
  684. .platform_data = &em_x270_tdo24m_pdata,
  685. },
  686. {
  687. .modalias = "libertas_spi",
  688. .max_speed_hz = 13000000,
  689. .bus_num = 2,
  690. .irq = PXA_GPIO_TO_IRQ(116),
  691. .chip_select = 0,
  692. .controller_data = &em_x270_libertas_chip,
  693. .platform_data = &em_x270_libertas_pdata,
  694. },
  695. };
  696. static void __init em_x270_init_spi(void)
  697. {
  698. pxa2xx_set_spi_info(1, &em_x270_spi_info);
  699. pxa2xx_set_spi_info(2, &em_x270_spi_2_info);
  700. spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
  701. }
  702. #else
  703. static inline void em_x270_init_spi(void) {}
  704. #endif
  705. #if defined(CONFIG_SND_PXA2XX_LIB_AC97)
  706. static pxa2xx_audio_ops_t em_x270_ac97_info = {
  707. .reset_gpio = 113,
  708. };
  709. static void __init em_x270_init_ac97(void)
  710. {
  711. pxa_set_ac97_info(&em_x270_ac97_info);
  712. }
  713. #else
  714. static inline void em_x270_init_ac97(void) {}
  715. #endif
  716. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  717. static const unsigned int em_x270_module_matrix_keys[] = {
  718. KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
  719. KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
  720. KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
  721. };
  722. static struct matrix_keymap_data em_x270_matrix_keymap_data = {
  723. .keymap = em_x270_module_matrix_keys,
  724. .keymap_size = ARRAY_SIZE(em_x270_module_matrix_keys),
  725. };
  726. struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
  727. /* code map for the matrix keys */
  728. .matrix_key_rows = 3,
  729. .matrix_key_cols = 3,
  730. .matrix_keymap_data = &em_x270_matrix_keymap_data,
  731. };
  732. static const unsigned int em_x270_exeda_matrix_keys[] = {
  733. KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
  734. KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
  735. KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
  736. KEY(0, 6, KEY_ENTER), KEY(0, 7, KEY_SLASH),
  737. KEY(1, 0, KEY_DOT), KEY(1, 1, KEY_M),
  738. KEY(1, 2, KEY_N), KEY(1, 3, KEY_B),
  739. KEY(1, 4, KEY_V), KEY(1, 5, KEY_C),
  740. KEY(1, 6, KEY_X), KEY(1, 7, KEY_Z),
  741. KEY(2, 0, KEY_LEFTSHIFT), KEY(2, 1, KEY_SEMICOLON),
  742. KEY(2, 2, KEY_L), KEY(2, 3, KEY_K),
  743. KEY(2, 4, KEY_J), KEY(2, 5, KEY_H),
  744. KEY(2, 6, KEY_G), KEY(2, 7, KEY_F),
  745. KEY(3, 0, KEY_D), KEY(3, 1, KEY_S),
  746. KEY(3, 2, KEY_A), KEY(3, 3, KEY_TAB),
  747. KEY(3, 4, KEY_BACKSPACE), KEY(3, 5, KEY_P),
  748. KEY(3, 6, KEY_O), KEY(3, 7, KEY_I),
  749. KEY(4, 0, KEY_U), KEY(4, 1, KEY_Y),
  750. KEY(4, 2, KEY_T), KEY(4, 3, KEY_R),
  751. KEY(4, 4, KEY_E), KEY(4, 5, KEY_W),
  752. KEY(4, 6, KEY_Q), KEY(4, 7, KEY_MINUS),
  753. KEY(5, 0, KEY_0), KEY(5, 1, KEY_9),
  754. KEY(5, 2, KEY_8), KEY(5, 3, KEY_7),
  755. KEY(5, 4, KEY_6), KEY(5, 5, KEY_5),
  756. KEY(5, 6, KEY_4), KEY(5, 7, KEY_3),
  757. KEY(6, 0, KEY_2), KEY(6, 1, KEY_1),
  758. KEY(6, 2, KEY_ENTER), KEY(6, 3, KEY_END),
  759. KEY(6, 4, KEY_DOWN), KEY(6, 5, KEY_UP),
  760. KEY(6, 6, KEY_MENU), KEY(6, 7, KEY_F1),
  761. KEY(7, 0, KEY_LEFT), KEY(7, 1, KEY_RIGHT),
  762. KEY(7, 2, KEY_BACK), KEY(7, 3, KEY_HOME),
  763. KEY(7, 4, 0), KEY(7, 5, 0),
  764. KEY(7, 6, 0), KEY(7, 7, 0),
  765. };
  766. static struct matrix_keymap_data em_x270_exeda_matrix_keymap_data = {
  767. .keymap = em_x270_exeda_matrix_keys,
  768. .keymap_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
  769. };
  770. struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
  771. /* code map for the matrix keys */
  772. .matrix_key_rows = 8,
  773. .matrix_key_cols = 8,
  774. .matrix_keymap_data = &em_x270_exeda_matrix_keymap_data,
  775. };
  776. static void __init em_x270_init_keypad(void)
  777. {
  778. if (machine_is_em_x270())
  779. pxa_set_keypad_info(&em_x270_module_keypad_info);
  780. else
  781. pxa_set_keypad_info(&em_x270_exeda_keypad_info);
  782. }
  783. #else
  784. static inline void em_x270_init_keypad(void) {}
  785. #endif
  786. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  787. static struct gpio_keys_button gpio_keys_button[] = {
  788. [0] = {
  789. .desc = "sleep/wakeup",
  790. .code = KEY_SUSPEND,
  791. .type = EV_PWR,
  792. .gpio = 1,
  793. .wakeup = 1,
  794. },
  795. };
  796. static struct gpio_keys_platform_data em_x270_gpio_keys_data = {
  797. .buttons = gpio_keys_button,
  798. .nbuttons = 1,
  799. };
  800. static struct platform_device em_x270_gpio_keys = {
  801. .name = "gpio-keys",
  802. .id = -1,
  803. .dev = {
  804. .platform_data = &em_x270_gpio_keys_data,
  805. },
  806. };
  807. static void __init em_x270_init_gpio_keys(void)
  808. {
  809. platform_device_register(&em_x270_gpio_keys);
  810. }
  811. #else
  812. static inline void em_x270_init_gpio_keys(void) {}
  813. #endif
  814. /* Quick Capture Interface and sensor setup */
  815. #if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
  816. static int em_x270_sensor_init(void)
  817. {
  818. int ret;
  819. ret = gpio_request(cam_reset, "camera reset");
  820. if (ret)
  821. return ret;
  822. gpio_direction_output(cam_reset, 0);
  823. gpio_set_value(cam_reset, 1);
  824. return 0;
  825. }
  826. static struct regulator_consumer_supply camera_dummy_supplies[] = {
  827. REGULATOR_SUPPLY("vdd", "0-005d"),
  828. };
  829. static struct regulator_init_data camera_dummy_initdata = {
  830. .consumer_supplies = camera_dummy_supplies,
  831. .num_consumer_supplies = ARRAY_SIZE(camera_dummy_supplies),
  832. .constraints = {
  833. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  834. },
  835. };
  836. static struct fixed_voltage_config camera_dummy_config = {
  837. .supply_name = "camera_vdd",
  838. .input_supply = "vcc cam",
  839. .microvolts = 2800000,
  840. .gpio = -1,
  841. .enable_high = 0,
  842. .init_data = &camera_dummy_initdata,
  843. };
  844. static struct platform_device camera_supply_dummy_device = {
  845. .name = "reg-fixed-voltage",
  846. .id = 1,
  847. .dev = {
  848. .platform_data = &camera_dummy_config,
  849. },
  850. };
  851. struct pxacamera_platform_data em_x270_camera_platform_data = {
  852. .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
  853. PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
  854. .mclk_10khz = 2600,
  855. .sensor_i2c_adapter_id = 0,
  856. .sensor_i2c_address = 0x5d,
  857. };
  858. static void __init em_x270_init_camera(void)
  859. {
  860. if (em_x270_sensor_init() == 0)
  861. pxa_set_camera_info(&em_x270_camera_platform_data);
  862. platform_device_register(&camera_supply_dummy_device);
  863. }
  864. #else
  865. static inline void em_x270_init_camera(void) {}
  866. #endif
  867. static struct regulator_bulk_data em_x270_gps_consumer_supply = {
  868. .supply = "vcc gps",
  869. };
  870. static struct regulator_userspace_consumer_data em_x270_gps_consumer_data = {
  871. .name = "vcc gps",
  872. .num_supplies = 1,
  873. .supplies = &em_x270_gps_consumer_supply,
  874. };
  875. static struct platform_device em_x270_gps_userspace_consumer = {
  876. .name = "reg-userspace-consumer",
  877. .id = 0,
  878. .dev = {
  879. .platform_data = &em_x270_gps_consumer_data,
  880. },
  881. };
  882. static struct regulator_bulk_data em_x270_gprs_consumer_supply = {
  883. .supply = "vcc gprs",
  884. };
  885. static struct regulator_userspace_consumer_data em_x270_gprs_consumer_data = {
  886. .name = "vcc gprs",
  887. .num_supplies = 1,
  888. .supplies = &em_x270_gprs_consumer_supply
  889. };
  890. static struct platform_device em_x270_gprs_userspace_consumer = {
  891. .name = "reg-userspace-consumer",
  892. .id = 1,
  893. .dev = {
  894. .platform_data = &em_x270_gprs_consumer_data,
  895. }
  896. };
  897. static struct platform_device *em_x270_userspace_consumers[] = {
  898. &em_x270_gps_userspace_consumer,
  899. &em_x270_gprs_userspace_consumer,
  900. };
  901. static void __init em_x270_userspace_consumers_init(void)
  902. {
  903. platform_add_devices(ARRAY_AND_SIZE(em_x270_userspace_consumers));
  904. }
  905. /* DA9030 related initializations */
  906. #define REGULATOR_CONSUMER(_name, _dev_name, _supply) \
  907. static struct regulator_consumer_supply _name##_consumers[] = { \
  908. REGULATOR_SUPPLY(_supply, _dev_name), \
  909. }
  910. REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
  911. REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
  912. REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");
  913. REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
  914. REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");
  915. REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
  916. #define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
  917. static struct regulator_init_data _ldo##_data = { \
  918. .constraints = { \
  919. .min_uV = _min_uV, \
  920. .max_uV = _max_uV, \
  921. .state_mem = { \
  922. .enabled = 0, \
  923. }, \
  924. .valid_ops_mask = _ops_mask, \
  925. .apply_uV = 1, \
  926. }, \
  927. .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \
  928. .consumer_supplies = _ldo##_consumers, \
  929. };
  930. REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
  931. REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
  932. REGULATOR_INIT(ldo10, 2000000, 3200000,
  933. REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE);
  934. REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
  935. REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
  936. REGULATOR_INIT(buck2, 1000000, 1650000, REGULATOR_CHANGE_VOLTAGE);
  937. struct led_info em_x270_led_info = {
  938. .name = "em-x270:orange",
  939. .default_trigger = "battery-charging-or-full",
  940. };
  941. struct power_supply_info em_x270_psy_info = {
  942. .name = "battery",
  943. .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
  944. .voltage_max_design = 4200000,
  945. .voltage_min_design = 3000000,
  946. .use_for_apm = 1,
  947. };
  948. static void em_x270_battery_low(void)
  949. {
  950. #if defined(CONFIG_APM_EMULATION)
  951. apm_queue_event(APM_LOW_BATTERY);
  952. #endif
  953. }
  954. static void em_x270_battery_critical(void)
  955. {
  956. #if defined(CONFIG_APM_EMULATION)
  957. apm_queue_event(APM_CRITICAL_SUSPEND);
  958. #endif
  959. }
  960. struct da9030_battery_info em_x270_batterty_info = {
  961. .battery_info = &em_x270_psy_info,
  962. .charge_milliamp = 1000,
  963. .charge_millivolt = 4200,
  964. .vbat_low = 3600,
  965. .vbat_crit = 3400,
  966. .vbat_charge_start = 4100,
  967. .vbat_charge_stop = 4200,
  968. .vbat_charge_restart = 4000,
  969. .vcharge_min = 3200,
  970. .vcharge_max = 5500,
  971. .tbat_low = 197,
  972. .tbat_high = 78,
  973. .tbat_restart = 100,
  974. .batmon_interval = 0,
  975. .battery_low = em_x270_battery_low,
  976. .battery_critical = em_x270_battery_critical,
  977. };
  978. #define DA9030_SUBDEV(_name, _id, _pdata) \
  979. { \
  980. .name = "da903x-" #_name, \
  981. .id = DA9030_ID_##_id, \
  982. .platform_data = _pdata, \
  983. }
  984. #define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data)
  985. struct da903x_subdev_info em_x270_da9030_subdevs[] = {
  986. DA9030_LDO(3),
  987. DA9030_LDO(5),
  988. DA9030_LDO(10),
  989. DA9030_LDO(12),
  990. DA9030_LDO(19),
  991. DA9030_SUBDEV(regulator, BUCK2, &buck2_data),
  992. DA9030_SUBDEV(led, LED_PC, &em_x270_led_info),
  993. DA9030_SUBDEV(backlight, WLED, &em_x270_led_info),
  994. DA9030_SUBDEV(battery, BAT, &em_x270_batterty_info),
  995. };
  996. static struct da903x_platform_data em_x270_da9030_info = {
  997. .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs),
  998. .subdevs = em_x270_da9030_subdevs,
  999. };
  1000. static struct i2c_board_info em_x270_i2c_pmic_info = {
  1001. I2C_BOARD_INFO("da9030", 0x49),
  1002. .irq = PXA_GPIO_TO_IRQ(0),
  1003. .platform_data = &em_x270_da9030_info,
  1004. };
  1005. static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = {
  1006. .use_pio = 1,
  1007. };
  1008. static void __init em_x270_init_da9030(void)
  1009. {
  1010. pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info);
  1011. i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
  1012. }
  1013. static struct pca953x_platform_data exeda_gpio_ext_pdata = {
  1014. .gpio_base = 128,
  1015. };
  1016. static struct i2c_board_info exeda_i2c_info[] = {
  1017. {
  1018. I2C_BOARD_INFO("pca9555", 0x21),
  1019. .platform_data = &exeda_gpio_ext_pdata,
  1020. },
  1021. };
  1022. static struct i2c_pxa_platform_data em_x270_i2c_info = {
  1023. .fast_mode = 1,
  1024. };
  1025. static void __init em_x270_init_i2c(void)
  1026. {
  1027. pxa_set_i2c_info(&em_x270_i2c_info);
  1028. if (machine_is_exeda())
  1029. i2c_register_board_info(0, ARRAY_AND_SIZE(exeda_i2c_info));
  1030. }
  1031. static void __init em_x270_module_init(void)
  1032. {
  1033. pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
  1034. mmc_cd = GPIO13_MMC_CD;
  1035. nand_rb = GPIO56_NAND_RB;
  1036. dm9000_flags = DM9000_PLATF_32BITONLY;
  1037. cam_reset = GPIO93_CAM_RESET;
  1038. usb_hub_reset = GPIO16_USB_HUB_RESET;
  1039. }
  1040. static void __init em_x270_exeda_init(void)
  1041. {
  1042. pxa2xx_mfp_config(ARRAY_AND_SIZE(exeda_pin_config));
  1043. mmc_cd = GPIO114_MMC_CD;
  1044. nand_rb = GPIO20_NAND_RB;
  1045. dm9000_flags = DM9000_PLATF_16BITONLY;
  1046. cam_reset = GPIO130_CAM_RESET;
  1047. usb_hub_reset = GPIO10_USB_HUB_RESET;
  1048. }
  1049. static void __init em_x270_init(void)
  1050. {
  1051. pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config));
  1052. pxa_set_ffuart_info(NULL);
  1053. pxa_set_btuart_info(NULL);
  1054. pxa_set_stuart_info(NULL);
  1055. #ifdef CONFIG_PM
  1056. pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
  1057. #endif
  1058. if (machine_is_em_x270())
  1059. em_x270_module_init();
  1060. else if (machine_is_exeda())
  1061. em_x270_exeda_init();
  1062. else
  1063. panic("Unsupported machine: %d\n", machine_arch_type);
  1064. em_x270_init_da9030();
  1065. em_x270_init_dm9000();
  1066. em_x270_init_rtc();
  1067. em_x270_init_nand();
  1068. em_x270_init_nor();
  1069. em_x270_init_lcd();
  1070. em_x270_init_mmc();
  1071. em_x270_init_ohci();
  1072. em_x270_init_keypad();
  1073. em_x270_init_gpio_keys();
  1074. em_x270_init_ac97();
  1075. em_x270_init_spi();
  1076. em_x270_init_i2c();
  1077. em_x270_init_camera();
  1078. em_x270_userspace_consumers_init();
  1079. regulator_has_full_constraints();
  1080. }
  1081. MACHINE_START(EM_X270, "Compulab EM-X270")
  1082. .atag_offset = 0x100,
  1083. .map_io = pxa27x_map_io,
  1084. .nr_irqs = PXA_NR_IRQS,
  1085. .init_irq = pxa27x_init_irq,
  1086. .handle_irq = pxa27x_handle_irq,
  1087. .init_time = pxa_timer_init,
  1088. .init_machine = em_x270_init,
  1089. .restart = pxa_restart,
  1090. MACHINE_END
  1091. MACHINE_START(EXEDA, "Compulab eXeda")
  1092. .atag_offset = 0x100,
  1093. .map_io = pxa27x_map_io,
  1094. .nr_irqs = PXA_NR_IRQS,
  1095. .init_irq = pxa27x_init_irq,
  1096. .handle_irq = pxa27x_handle_irq,
  1097. .init_time = pxa_timer_init,
  1098. .init_machine = em_x270_init,
  1099. .restart = pxa_restart,
  1100. MACHINE_END