em-x270.c 30 KB

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