em-x270.c 30 KB

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