em-x270.c 30 KB

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