board-omap3pandora.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /*
  2. * board-omap3pandora.c (Pandora Handheld Console)
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  16. * 02110-1301 USA
  17. *
  18. */
  19. #include <linux/init.h>
  20. #include <linux/kernel.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/spi/spi.h>
  23. #include <linux/regulator/machine.h>
  24. #include <linux/i2c/twl.h>
  25. #include <linux/wl12xx.h>
  26. #include <linux/mtd/partitions.h>
  27. #include <linux/mtd/nand.h>
  28. #include <linux/leds.h>
  29. #include <linux/input.h>
  30. #include <linux/input/matrix_keypad.h>
  31. #include <linux/gpio.h>
  32. #include <linux/gpio_keys.h>
  33. #include <linux/mmc/host.h>
  34. #include <linux/mmc/card.h>
  35. #include <linux/regulator/fixed.h>
  36. #include <linux/usb/phy.h>
  37. #include <linux/platform_data/spi-omap2-mcspi.h>
  38. #include <asm/mach-types.h>
  39. #include <asm/mach/arch.h>
  40. #include <asm/mach/map.h>
  41. #include "common.h"
  42. #include <video/omapdss.h>
  43. #include <video/omap-panel-data.h>
  44. #include <linux/platform_data/mtd-nand-omap2.h>
  45. #include "mux.h"
  46. #include "sdram-micron-mt46h32m32lf-6.h"
  47. #include "hsmmc.h"
  48. #include "common-board-devices.h"
  49. #include "gpmc-nand.h"
  50. #define PANDORA_WIFI_IRQ_GPIO 21
  51. #define PANDORA_WIFI_NRESET_GPIO 23
  52. #define OMAP3_PANDORA_TS_GPIO 94
  53. static struct mtd_partition omap3pandora_nand_partitions[] = {
  54. {
  55. .name = "xloader",
  56. .offset = 0,
  57. .size = 4 * NAND_BLOCK_SIZE,
  58. .mask_flags = MTD_WRITEABLE
  59. }, {
  60. .name = "uboot",
  61. .offset = MTDPART_OFS_APPEND,
  62. .size = 15 * NAND_BLOCK_SIZE,
  63. }, {
  64. .name = "uboot-env",
  65. .offset = MTDPART_OFS_APPEND,
  66. .size = 1 * NAND_BLOCK_SIZE,
  67. }, {
  68. .name = "boot",
  69. .offset = MTDPART_OFS_APPEND,
  70. .size = 80 * NAND_BLOCK_SIZE,
  71. }, {
  72. .name = "rootfs",
  73. .offset = MTDPART_OFS_APPEND,
  74. .size = MTDPART_SIZ_FULL,
  75. },
  76. };
  77. static struct omap_nand_platform_data pandora_nand_data = {
  78. .cs = 0,
  79. .devsize = NAND_BUSWIDTH_16,
  80. .xfer_type = NAND_OMAP_PREFETCH_DMA,
  81. .parts = omap3pandora_nand_partitions,
  82. .nr_parts = ARRAY_SIZE(omap3pandora_nand_partitions),
  83. };
  84. static struct gpio_led pandora_gpio_leds[] = {
  85. {
  86. .name = "pandora::sd1",
  87. .default_trigger = "mmc0",
  88. .gpio = 128,
  89. }, {
  90. .name = "pandora::sd2",
  91. .default_trigger = "mmc1",
  92. .gpio = 129,
  93. }, {
  94. .name = "pandora::bluetooth",
  95. .gpio = 158,
  96. }, {
  97. .name = "pandora::wifi",
  98. .gpio = 159,
  99. },
  100. };
  101. static struct gpio_led_platform_data pandora_gpio_led_data = {
  102. .leds = pandora_gpio_leds,
  103. .num_leds = ARRAY_SIZE(pandora_gpio_leds),
  104. };
  105. static struct platform_device pandora_leds_gpio = {
  106. .name = "leds-gpio",
  107. .id = -1,
  108. .dev = {
  109. .platform_data = &pandora_gpio_led_data,
  110. },
  111. };
  112. static struct platform_device pandora_backlight = {
  113. .name = "pandora-backlight",
  114. .id = -1,
  115. };
  116. #define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \
  117. { \
  118. .gpio = gpio_num, \
  119. .type = ev_type, \
  120. .code = ev_code, \
  121. .active_low = act_low, \
  122. .debounce_interval = 4, \
  123. .desc = "btn " descr, \
  124. }
  125. #define GPIO_BUTTON_LOW(gpio_num, event_code, description) \
  126. GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description)
  127. static struct gpio_keys_button pandora_gpio_keys[] = {
  128. GPIO_BUTTON_LOW(110, KEY_UP, "up"),
  129. GPIO_BUTTON_LOW(103, KEY_DOWN, "down"),
  130. GPIO_BUTTON_LOW(96, KEY_LEFT, "left"),
  131. GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"),
  132. GPIO_BUTTON_LOW(109, KEY_PAGEUP, "game 1"),
  133. GPIO_BUTTON_LOW(111, KEY_END, "game 2"),
  134. GPIO_BUTTON_LOW(106, KEY_PAGEDOWN, "game 3"),
  135. GPIO_BUTTON_LOW(101, KEY_HOME, "game 4"),
  136. GPIO_BUTTON_LOW(102, KEY_RIGHTSHIFT, "l"),
  137. GPIO_BUTTON_LOW(97, KEY_KPPLUS, "l2"),
  138. GPIO_BUTTON_LOW(105, KEY_RIGHTCTRL, "r"),
  139. GPIO_BUTTON_LOW(107, KEY_KPMINUS, "r2"),
  140. GPIO_BUTTON_LOW(104, KEY_LEFTCTRL, "ctrl"),
  141. GPIO_BUTTON_LOW(99, KEY_MENU, "menu"),
  142. GPIO_BUTTON_LOW(176, KEY_COFFEE, "hold"),
  143. GPIO_BUTTON(100, EV_KEY, KEY_LEFTALT, 0, "alt"),
  144. GPIO_BUTTON(108, EV_SW, SW_LID, 1, "lid"),
  145. };
  146. static struct gpio_keys_platform_data pandora_gpio_key_info = {
  147. .buttons = pandora_gpio_keys,
  148. .nbuttons = ARRAY_SIZE(pandora_gpio_keys),
  149. };
  150. static struct platform_device pandora_keys_gpio = {
  151. .name = "gpio-keys",
  152. .id = -1,
  153. .dev = {
  154. .platform_data = &pandora_gpio_key_info,
  155. },
  156. };
  157. static const uint32_t board_keymap[] = {
  158. /* row, col, code */
  159. KEY(0, 0, KEY_9),
  160. KEY(0, 1, KEY_8),
  161. KEY(0, 2, KEY_I),
  162. KEY(0, 3, KEY_J),
  163. KEY(0, 4, KEY_N),
  164. KEY(0, 5, KEY_M),
  165. KEY(1, 0, KEY_0),
  166. KEY(1, 1, KEY_7),
  167. KEY(1, 2, KEY_U),
  168. KEY(1, 3, KEY_H),
  169. KEY(1, 4, KEY_B),
  170. KEY(1, 5, KEY_SPACE),
  171. KEY(2, 0, KEY_BACKSPACE),
  172. KEY(2, 1, KEY_6),
  173. KEY(2, 2, KEY_Y),
  174. KEY(2, 3, KEY_G),
  175. KEY(2, 4, KEY_V),
  176. KEY(2, 5, KEY_FN),
  177. KEY(3, 0, KEY_O),
  178. KEY(3, 1, KEY_5),
  179. KEY(3, 2, KEY_T),
  180. KEY(3, 3, KEY_F),
  181. KEY(3, 4, KEY_C),
  182. KEY(4, 0, KEY_P),
  183. KEY(4, 1, KEY_4),
  184. KEY(4, 2, KEY_R),
  185. KEY(4, 3, KEY_D),
  186. KEY(4, 4, KEY_X),
  187. KEY(5, 0, KEY_K),
  188. KEY(5, 1, KEY_3),
  189. KEY(5, 2, KEY_E),
  190. KEY(5, 3, KEY_S),
  191. KEY(5, 4, KEY_Z),
  192. KEY(6, 0, KEY_L),
  193. KEY(6, 1, KEY_2),
  194. KEY(6, 2, KEY_W),
  195. KEY(6, 3, KEY_A),
  196. KEY(6, 4, KEY_DOT),
  197. KEY(7, 0, KEY_ENTER),
  198. KEY(7, 1, KEY_1),
  199. KEY(7, 2, KEY_Q),
  200. KEY(7, 3, KEY_LEFTSHIFT),
  201. KEY(7, 4, KEY_COMMA),
  202. };
  203. static struct matrix_keymap_data board_map_data = {
  204. .keymap = board_keymap,
  205. .keymap_size = ARRAY_SIZE(board_keymap),
  206. };
  207. static struct twl4030_keypad_data pandora_kp_data = {
  208. .keymap_data = &board_map_data,
  209. .rows = 8,
  210. .cols = 6,
  211. .rep = 1,
  212. };
  213. static struct panel_tpo_td043_data lcd_data = {
  214. .nreset_gpio = 157,
  215. };
  216. static struct omap_dss_device pandora_lcd_device = {
  217. .name = "lcd",
  218. .driver_name = "tpo_td043mtea1_panel",
  219. .type = OMAP_DISPLAY_TYPE_DPI,
  220. .phy.dpi.data_lines = 24,
  221. .data = &lcd_data,
  222. };
  223. static struct omap_dss_device pandora_tv_device = {
  224. .name = "tv",
  225. .driver_name = "venc",
  226. .type = OMAP_DISPLAY_TYPE_VENC,
  227. .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
  228. };
  229. static struct omap_dss_device *pandora_dss_devices[] = {
  230. &pandora_lcd_device,
  231. &pandora_tv_device,
  232. };
  233. static struct omap_dss_board_info pandora_dss_data = {
  234. .num_devices = ARRAY_SIZE(pandora_dss_devices),
  235. .devices = pandora_dss_devices,
  236. .default_device = &pandora_lcd_device,
  237. };
  238. static void pandora_wl1251_init_card(struct mmc_card *card)
  239. {
  240. /*
  241. * We have TI wl1251 attached to MMC3. Pass this information to
  242. * SDIO core because it can't be probed by normal methods.
  243. */
  244. card->quirks |= MMC_QUIRK_NONSTD_SDIO;
  245. card->cccr.wide_bus = 1;
  246. card->cis.vendor = 0x104c;
  247. card->cis.device = 0x9066;
  248. card->cis.blksize = 512;
  249. card->cis.max_dtr = 20000000;
  250. }
  251. static struct omap2_hsmmc_info omap3pandora_mmc[] = {
  252. {
  253. .mmc = 1,
  254. .caps = MMC_CAP_4_BIT_DATA,
  255. .gpio_cd = -EINVAL,
  256. .gpio_wp = 126,
  257. .ext_clock = 0,
  258. .deferred = true,
  259. },
  260. {
  261. .mmc = 2,
  262. .caps = MMC_CAP_4_BIT_DATA,
  263. .gpio_cd = -EINVAL,
  264. .gpio_wp = 127,
  265. .ext_clock = 1,
  266. .transceiver = true,
  267. .deferred = true,
  268. },
  269. {
  270. .mmc = 3,
  271. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
  272. .gpio_cd = -EINVAL,
  273. .gpio_wp = -EINVAL,
  274. .init_card = pandora_wl1251_init_card,
  275. },
  276. {} /* Terminator */
  277. };
  278. static int omap3pandora_twl_gpio_setup(struct device *dev,
  279. unsigned gpio, unsigned ngpio)
  280. {
  281. int ret, gpio_32khz;
  282. /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
  283. omap3pandora_mmc[0].gpio_cd = gpio + 0;
  284. omap3pandora_mmc[1].gpio_cd = gpio + 1;
  285. omap_hsmmc_late_init(omap3pandora_mmc);
  286. /* gpio + 13 drives 32kHz buffer for wifi module */
  287. gpio_32khz = gpio + 13;
  288. ret = gpio_request_one(gpio_32khz, GPIOF_OUT_INIT_HIGH, "wifi 32kHz");
  289. if (ret < 0) {
  290. pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret);
  291. return -ENODEV;
  292. }
  293. return 0;
  294. }
  295. static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
  296. .setup = omap3pandora_twl_gpio_setup,
  297. };
  298. static struct regulator_consumer_supply pandora_vmmc1_supply[] = {
  299. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
  300. };
  301. static struct regulator_consumer_supply pandora_vmmc2_supply[] = {
  302. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1")
  303. };
  304. static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
  305. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
  306. };
  307. static struct regulator_consumer_supply pandora_vdds_supplies[] = {
  308. REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
  309. REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
  310. REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
  311. REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
  312. };
  313. static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = {
  314. REGULATOR_SUPPLY("vcc", "display0"),
  315. };
  316. static struct regulator_consumer_supply pandora_usb_phy_supply[] = {
  317. REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */
  318. };
  319. /* ads7846 on SPI and 2 nub controllers on I2C */
  320. static struct regulator_consumer_supply pandora_vaux4_supplies[] = {
  321. REGULATOR_SUPPLY("vcc", "spi1.0"),
  322. REGULATOR_SUPPLY("vcc", "3-0066"),
  323. REGULATOR_SUPPLY("vcc", "3-0067"),
  324. };
  325. static struct regulator_consumer_supply pandora_adac_supply[] = {
  326. REGULATOR_SUPPLY("vcc", "soc-audio"),
  327. };
  328. /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
  329. static struct regulator_init_data pandora_vmmc1 = {
  330. .constraints = {
  331. .min_uV = 1850000,
  332. .max_uV = 3150000,
  333. .valid_modes_mask = REGULATOR_MODE_NORMAL
  334. | REGULATOR_MODE_STANDBY,
  335. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  336. | REGULATOR_CHANGE_MODE
  337. | REGULATOR_CHANGE_STATUS,
  338. },
  339. .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc1_supply),
  340. .consumer_supplies = pandora_vmmc1_supply,
  341. };
  342. /* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */
  343. static struct regulator_init_data pandora_vmmc2 = {
  344. .constraints = {
  345. .min_uV = 1850000,
  346. .max_uV = 3150000,
  347. .valid_modes_mask = REGULATOR_MODE_NORMAL
  348. | REGULATOR_MODE_STANDBY,
  349. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  350. | REGULATOR_CHANGE_MODE
  351. | REGULATOR_CHANGE_STATUS,
  352. },
  353. .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc2_supply),
  354. .consumer_supplies = pandora_vmmc2_supply,
  355. };
  356. /* VAUX1 for LCD */
  357. static struct regulator_init_data pandora_vaux1 = {
  358. .constraints = {
  359. .min_uV = 3000000,
  360. .max_uV = 3000000,
  361. .apply_uV = true,
  362. .valid_modes_mask = REGULATOR_MODE_NORMAL
  363. | REGULATOR_MODE_STANDBY,
  364. .valid_ops_mask = REGULATOR_CHANGE_MODE
  365. | REGULATOR_CHANGE_STATUS,
  366. },
  367. .num_consumer_supplies = ARRAY_SIZE(pandora_vcc_lcd_supply),
  368. .consumer_supplies = pandora_vcc_lcd_supply,
  369. };
  370. /* VAUX2 for USB host PHY */
  371. static struct regulator_init_data pandora_vaux2 = {
  372. .constraints = {
  373. .min_uV = 1800000,
  374. .max_uV = 1800000,
  375. .apply_uV = true,
  376. .valid_modes_mask = REGULATOR_MODE_NORMAL
  377. | REGULATOR_MODE_STANDBY,
  378. .valid_ops_mask = REGULATOR_CHANGE_MODE
  379. | REGULATOR_CHANGE_STATUS,
  380. },
  381. .num_consumer_supplies = ARRAY_SIZE(pandora_usb_phy_supply),
  382. .consumer_supplies = pandora_usb_phy_supply,
  383. };
  384. /* VAUX4 for ads7846 and nubs */
  385. static struct regulator_init_data pandora_vaux4 = {
  386. .constraints = {
  387. .min_uV = 2800000,
  388. .max_uV = 2800000,
  389. .apply_uV = true,
  390. .valid_modes_mask = REGULATOR_MODE_NORMAL
  391. | REGULATOR_MODE_STANDBY,
  392. .valid_ops_mask = REGULATOR_CHANGE_MODE
  393. | REGULATOR_CHANGE_STATUS,
  394. },
  395. .num_consumer_supplies = ARRAY_SIZE(pandora_vaux4_supplies),
  396. .consumer_supplies = pandora_vaux4_supplies,
  397. };
  398. /* VSIM for audio DAC */
  399. static struct regulator_init_data pandora_vsim = {
  400. .constraints = {
  401. .min_uV = 2800000,
  402. .max_uV = 2800000,
  403. .apply_uV = true,
  404. .valid_modes_mask = REGULATOR_MODE_NORMAL
  405. | REGULATOR_MODE_STANDBY,
  406. .valid_ops_mask = REGULATOR_CHANGE_MODE
  407. | REGULATOR_CHANGE_STATUS,
  408. },
  409. .num_consumer_supplies = ARRAY_SIZE(pandora_adac_supply),
  410. .consumer_supplies = pandora_adac_supply,
  411. };
  412. /* Fixed regulator internal to Wifi module */
  413. static struct regulator_init_data pandora_vmmc3 = {
  414. .constraints = {
  415. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  416. },
  417. .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc3_supply),
  418. .consumer_supplies = pandora_vmmc3_supply,
  419. };
  420. static struct fixed_voltage_config pandora_vwlan = {
  421. .supply_name = "vwlan",
  422. .microvolts = 1800000, /* 1.8V */
  423. .gpio = PANDORA_WIFI_NRESET_GPIO,
  424. .startup_delay = 50000, /* 50ms */
  425. .enable_high = 1,
  426. .enabled_at_boot = 0,
  427. .init_data = &pandora_vmmc3,
  428. };
  429. static struct platform_device pandora_vwlan_device = {
  430. .name = "reg-fixed-voltage",
  431. .id = 1,
  432. .dev = {
  433. .platform_data = &pandora_vwlan,
  434. },
  435. };
  436. static struct twl4030_bci_platform_data pandora_bci_data;
  437. static struct twl4030_power_data pandora_power_data = {
  438. .use_poweroff = true,
  439. };
  440. static struct twl4030_platform_data omap3pandora_twldata = {
  441. .gpio = &omap3pandora_gpio_data,
  442. .vmmc1 = &pandora_vmmc1,
  443. .vmmc2 = &pandora_vmmc2,
  444. .vaux1 = &pandora_vaux1,
  445. .vaux2 = &pandora_vaux2,
  446. .vaux4 = &pandora_vaux4,
  447. .vsim = &pandora_vsim,
  448. .keypad = &pandora_kp_data,
  449. .bci = &pandora_bci_data,
  450. .power = &pandora_power_data,
  451. };
  452. static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
  453. {
  454. I2C_BOARD_INFO("bq27500", 0x55),
  455. .flags = I2C_CLIENT_WAKE,
  456. },
  457. };
  458. static int __init omap3pandora_i2c_init(void)
  459. {
  460. omap3_pmic_get_config(&omap3pandora_twldata,
  461. TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO,
  462. TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
  463. omap3pandora_twldata.vdac->constraints.apply_uV = true;
  464. omap3pandora_twldata.vpll2->constraints.apply_uV = true;
  465. omap3pandora_twldata.vpll2->num_consumer_supplies =
  466. ARRAY_SIZE(pandora_vdds_supplies);
  467. omap3pandora_twldata.vpll2->consumer_supplies = pandora_vdds_supplies;
  468. omap3_pmic_init("tps65950", &omap3pandora_twldata);
  469. /* i2c2 pins are not connected */
  470. omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,
  471. ARRAY_SIZE(omap3pandora_i2c3_boardinfo));
  472. return 0;
  473. }
  474. static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
  475. {
  476. .modalias = "tpo_td043mtea1_panel_spi",
  477. .bus_num = 1,
  478. .chip_select = 1,
  479. .max_speed_hz = 375000,
  480. .platform_data = &pandora_lcd_device,
  481. }
  482. };
  483. static void __init pandora_wl1251_init(void)
  484. {
  485. struct wl12xx_platform_data pandora_wl1251_pdata;
  486. int ret;
  487. memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
  488. ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
  489. if (ret < 0)
  490. goto fail;
  491. pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
  492. if (pandora_wl1251_pdata.irq < 0)
  493. goto fail_irq;
  494. pandora_wl1251_pdata.use_eeprom = true;
  495. ret = wl12xx_set_platform_data(&pandora_wl1251_pdata);
  496. if (ret < 0)
  497. goto fail_irq;
  498. return;
  499. fail_irq:
  500. gpio_free(PANDORA_WIFI_IRQ_GPIO);
  501. fail:
  502. printk(KERN_ERR "wl1251 board initialisation failed\n");
  503. }
  504. static struct usbhs_phy_data phy_data[] __initdata = {
  505. {
  506. .port = 2,
  507. .reset_gpio = 16,
  508. .vcc_gpio = -EINVAL,
  509. },
  510. };
  511. static struct platform_device *omap3pandora_devices[] __initdata = {
  512. &pandora_leds_gpio,
  513. &pandora_keys_gpio,
  514. &pandora_vwlan_device,
  515. &pandora_backlight,
  516. };
  517. static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
  518. .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
  519. };
  520. #ifdef CONFIG_OMAP_MUX
  521. static struct omap_board_mux board_mux[] __initdata = {
  522. { .reg_offset = OMAP_MUX_TERMINATOR },
  523. };
  524. #endif
  525. static void __init omap3pandora_init(void)
  526. {
  527. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  528. omap_hsmmc_init(omap3pandora_mmc);
  529. omap3pandora_i2c_init();
  530. pandora_wl1251_init();
  531. platform_add_devices(omap3pandora_devices,
  532. ARRAY_SIZE(omap3pandora_devices));
  533. omap_display_init(&pandora_dss_data);
  534. omap_serial_init();
  535. omap_sdrc_init(mt46h32m32lf6_sdrc_params,
  536. mt46h32m32lf6_sdrc_params);
  537. spi_register_board_info(omap3pandora_spi_board_info,
  538. ARRAY_SIZE(omap3pandora_spi_board_info));
  539. omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
  540. usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
  541. usbhs_init(&usbhs_bdata);
  542. usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
  543. usb_musb_init(NULL);
  544. gpmc_nand_init(&pandora_nand_data, NULL);
  545. /* Ensure SDRC pins are mux'd for self-refresh */
  546. omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
  547. omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
  548. }
  549. MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
  550. .atag_offset = 0x100,
  551. .reserve = omap_reserve,
  552. .map_io = omap3_map_io,
  553. .init_early = omap35xx_init_early,
  554. .init_irq = omap3_init_irq,
  555. .handle_irq = omap3_intc_handle_irq,
  556. .init_machine = omap3pandora_init,
  557. .init_late = omap35xx_init_late,
  558. .init_time = omap3_sync32k_timer_init,
  559. .restart = omap3xxx_restart,
  560. MACHINE_END