em-x270.c 30 KB

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