em-x270.c 28 KB

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