em-x270.c 30 KB

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