board-omap3pandora.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  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/spi/ads7846.h>
  24. #include <linux/regulator/machine.h>
  25. #include <linux/i2c/twl.h>
  26. #include <linux/wl12xx.h>
  27. #include <linux/mtd/partitions.h>
  28. #include <linux/mtd/nand.h>
  29. #include <linux/leds.h>
  30. #include <linux/input.h>
  31. #include <linux/input/matrix_keypad.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 <asm/mach-types.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/map.h>
  39. #include <plat/board.h>
  40. #include <plat/common.h>
  41. #include <mach/gpio.h>
  42. #include <mach/hardware.h>
  43. #include <plat/mcspi.h>
  44. #include <plat/usb.h>
  45. #include <plat/display.h>
  46. #include <plat/nand.h>
  47. #include "mux.h"
  48. #include "sdram-micron-mt46h32m32lf-6.h"
  49. #include "hsmmc.h"
  50. #define PANDORA_WIFI_IRQ_GPIO 21
  51. #define PANDORA_WIFI_NRESET_GPIO 23
  52. #define OMAP3_PANDORA_TS_GPIO 94
  53. #define NAND_BLOCK_SIZE SZ_128K
  54. static struct mtd_partition omap3pandora_nand_partitions[] = {
  55. {
  56. .name = "xloader",
  57. .offset = 0,
  58. .size = 4 * NAND_BLOCK_SIZE,
  59. .mask_flags = MTD_WRITEABLE
  60. }, {
  61. .name = "uboot",
  62. .offset = MTDPART_OFS_APPEND,
  63. .size = 15 * NAND_BLOCK_SIZE,
  64. }, {
  65. .name = "uboot-env",
  66. .offset = MTDPART_OFS_APPEND,
  67. .size = 1 * NAND_BLOCK_SIZE,
  68. }, {
  69. .name = "boot",
  70. .offset = MTDPART_OFS_APPEND,
  71. .size = 80 * NAND_BLOCK_SIZE,
  72. }, {
  73. .name = "rootfs",
  74. .offset = MTDPART_OFS_APPEND,
  75. .size = MTDPART_SIZ_FULL,
  76. },
  77. };
  78. static struct omap_nand_platform_data pandora_nand_data = {
  79. .cs = 0,
  80. .devsize = 1, /* '0' for 8-bit, '1' for 16-bit device */
  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. #define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \
  113. { \
  114. .gpio = gpio_num, \
  115. .type = ev_type, \
  116. .code = ev_code, \
  117. .active_low = act_low, \
  118. .debounce_interval = 4, \
  119. .desc = "btn " descr, \
  120. }
  121. #define GPIO_BUTTON_LOW(gpio_num, event_code, description) \
  122. GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description)
  123. static struct gpio_keys_button pandora_gpio_keys[] = {
  124. GPIO_BUTTON_LOW(110, KEY_UP, "up"),
  125. GPIO_BUTTON_LOW(103, KEY_DOWN, "down"),
  126. GPIO_BUTTON_LOW(96, KEY_LEFT, "left"),
  127. GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"),
  128. GPIO_BUTTON_LOW(109, KEY_PAGEUP, "game 1"),
  129. GPIO_BUTTON_LOW(111, KEY_END, "game 2"),
  130. GPIO_BUTTON_LOW(106, KEY_PAGEDOWN, "game 3"),
  131. GPIO_BUTTON_LOW(101, KEY_HOME, "game 4"),
  132. GPIO_BUTTON_LOW(102, KEY_RIGHTSHIFT, "l"),
  133. GPIO_BUTTON_LOW(97, KEY_KPPLUS, "l2"),
  134. GPIO_BUTTON_LOW(105, KEY_RIGHTCTRL, "r"),
  135. GPIO_BUTTON_LOW(107, KEY_KPMINUS, "r2"),
  136. GPIO_BUTTON_LOW(104, KEY_LEFTCTRL, "ctrl"),
  137. GPIO_BUTTON_LOW(99, KEY_MENU, "menu"),
  138. GPIO_BUTTON_LOW(176, KEY_COFFEE, "hold"),
  139. GPIO_BUTTON(100, EV_KEY, KEY_LEFTALT, 0, "alt"),
  140. GPIO_BUTTON(108, EV_SW, SW_LID, 1, "lid"),
  141. };
  142. static struct gpio_keys_platform_data pandora_gpio_key_info = {
  143. .buttons = pandora_gpio_keys,
  144. .nbuttons = ARRAY_SIZE(pandora_gpio_keys),
  145. };
  146. static struct platform_device pandora_keys_gpio = {
  147. .name = "gpio-keys",
  148. .id = -1,
  149. .dev = {
  150. .platform_data = &pandora_gpio_key_info,
  151. },
  152. };
  153. static const uint32_t board_keymap[] = {
  154. /* row, col, code */
  155. KEY(0, 0, KEY_9),
  156. KEY(0, 1, KEY_8),
  157. KEY(0, 2, KEY_I),
  158. KEY(0, 3, KEY_J),
  159. KEY(0, 4, KEY_N),
  160. KEY(0, 5, KEY_M),
  161. KEY(1, 0, KEY_0),
  162. KEY(1, 1, KEY_7),
  163. KEY(1, 2, KEY_U),
  164. KEY(1, 3, KEY_H),
  165. KEY(1, 4, KEY_B),
  166. KEY(1, 5, KEY_SPACE),
  167. KEY(2, 0, KEY_BACKSPACE),
  168. KEY(2, 1, KEY_6),
  169. KEY(2, 2, KEY_Y),
  170. KEY(2, 3, KEY_G),
  171. KEY(2, 4, KEY_V),
  172. KEY(2, 5, KEY_FN),
  173. KEY(3, 0, KEY_O),
  174. KEY(3, 1, KEY_5),
  175. KEY(3, 2, KEY_T),
  176. KEY(3, 3, KEY_F),
  177. KEY(3, 4, KEY_C),
  178. KEY(4, 0, KEY_P),
  179. KEY(4, 1, KEY_4),
  180. KEY(4, 2, KEY_R),
  181. KEY(4, 3, KEY_D),
  182. KEY(4, 4, KEY_X),
  183. KEY(5, 0, KEY_K),
  184. KEY(5, 1, KEY_3),
  185. KEY(5, 2, KEY_E),
  186. KEY(5, 3, KEY_S),
  187. KEY(5, 4, KEY_Z),
  188. KEY(6, 0, KEY_L),
  189. KEY(6, 1, KEY_2),
  190. KEY(6, 2, KEY_W),
  191. KEY(6, 3, KEY_A),
  192. KEY(6, 4, KEY_DOT),
  193. KEY(7, 0, KEY_ENTER),
  194. KEY(7, 1, KEY_1),
  195. KEY(7, 2, KEY_Q),
  196. KEY(7, 3, KEY_LEFTSHIFT),
  197. KEY(7, 4, KEY_COMMA),
  198. };
  199. static struct matrix_keymap_data board_map_data = {
  200. .keymap = board_keymap,
  201. .keymap_size = ARRAY_SIZE(board_keymap),
  202. };
  203. static struct twl4030_keypad_data pandora_kp_data = {
  204. .keymap_data = &board_map_data,
  205. .rows = 8,
  206. .cols = 6,
  207. .rep = 1,
  208. };
  209. static struct omap_dss_device pandora_lcd_device = {
  210. .name = "lcd",
  211. .driver_name = "tpo_td043mtea1_panel",
  212. .type = OMAP_DISPLAY_TYPE_DPI,
  213. .phy.dpi.data_lines = 24,
  214. .reset_gpio = 157,
  215. };
  216. static struct omap_dss_device pandora_tv_device = {
  217. .name = "tv",
  218. .driver_name = "venc",
  219. .type = OMAP_DISPLAY_TYPE_VENC,
  220. .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
  221. };
  222. static struct omap_dss_device *pandora_dss_devices[] = {
  223. &pandora_lcd_device,
  224. &pandora_tv_device,
  225. };
  226. static struct omap_dss_board_info pandora_dss_data = {
  227. .num_devices = ARRAY_SIZE(pandora_dss_devices),
  228. .devices = pandora_dss_devices,
  229. .default_device = &pandora_lcd_device,
  230. };
  231. static struct platform_device pandora_dss_device = {
  232. .name = "omapdss",
  233. .id = -1,
  234. .dev = {
  235. .platform_data = &pandora_dss_data,
  236. },
  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. },
  259. {
  260. .mmc = 2,
  261. .caps = MMC_CAP_4_BIT_DATA,
  262. .gpio_cd = -EINVAL,
  263. .gpio_wp = 127,
  264. .ext_clock = 1,
  265. .transceiver = true,
  266. },
  267. {
  268. .mmc = 3,
  269. .caps = MMC_CAP_4_BIT_DATA,
  270. .gpio_cd = -EINVAL,
  271. .gpio_wp = -EINVAL,
  272. .init_card = pandora_wl1251_init_card,
  273. },
  274. {} /* Terminator */
  275. };
  276. static int omap3pandora_twl_gpio_setup(struct device *dev,
  277. unsigned gpio, unsigned ngpio)
  278. {
  279. int ret, gpio_32khz;
  280. /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
  281. omap3pandora_mmc[0].gpio_cd = gpio + 0;
  282. omap3pandora_mmc[1].gpio_cd = gpio + 1;
  283. omap2_hsmmc_init(omap3pandora_mmc);
  284. /* gpio + 13 drives 32kHz buffer for wifi module */
  285. gpio_32khz = gpio + 13;
  286. ret = gpio_request(gpio_32khz, "wifi 32kHz");
  287. if (ret < 0) {
  288. pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret);
  289. goto fail;
  290. }
  291. ret = gpio_direction_output(gpio_32khz, 1);
  292. if (ret < 0) {
  293. pr_err("Cannot set GPIO line %d, ret=%d\n", gpio_32khz, ret);
  294. goto fail_direction;
  295. }
  296. return 0;
  297. fail_direction:
  298. gpio_free(gpio_32khz);
  299. fail:
  300. return -ENODEV;
  301. }
  302. static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
  303. .gpio_base = OMAP_MAX_GPIO_LINES,
  304. .irq_base = TWL4030_GPIO_IRQ_BASE,
  305. .irq_end = TWL4030_GPIO_IRQ_END,
  306. .setup = omap3pandora_twl_gpio_setup,
  307. };
  308. static struct regulator_consumer_supply pandora_vmmc1_supply =
  309. REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0");
  310. static struct regulator_consumer_supply pandora_vmmc2_supply =
  311. REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1");
  312. static struct regulator_consumer_supply pandora_vmmc3_supply =
  313. REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.2");
  314. static struct regulator_consumer_supply pandora_vdda_dac_supply =
  315. REGULATOR_SUPPLY("vdda_dac", "omapdss");
  316. static struct regulator_consumer_supply pandora_vdds_supplies[] = {
  317. REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
  318. REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
  319. };
  320. static struct regulator_consumer_supply pandora_vcc_lcd_supply =
  321. REGULATOR_SUPPLY("vcc", "display0");
  322. static struct regulator_consumer_supply pandora_usb_phy_supply =
  323. REGULATOR_SUPPLY("hsusb0", "ehci-omap.0");
  324. /* ads7846 on SPI and 2 nub controllers on I2C */
  325. static struct regulator_consumer_supply pandora_vaux4_supplies[] = {
  326. REGULATOR_SUPPLY("vcc", "spi1.0"),
  327. REGULATOR_SUPPLY("vcc", "3-0066"),
  328. REGULATOR_SUPPLY("vcc", "3-0067"),
  329. };
  330. static struct regulator_consumer_supply pandora_adac_supply =
  331. REGULATOR_SUPPLY("vcc", "soc-audio");
  332. /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
  333. static struct regulator_init_data pandora_vmmc1 = {
  334. .constraints = {
  335. .min_uV = 1850000,
  336. .max_uV = 3150000,
  337. .valid_modes_mask = REGULATOR_MODE_NORMAL
  338. | REGULATOR_MODE_STANDBY,
  339. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  340. | REGULATOR_CHANGE_MODE
  341. | REGULATOR_CHANGE_STATUS,
  342. },
  343. .num_consumer_supplies = 1,
  344. .consumer_supplies = &pandora_vmmc1_supply,
  345. };
  346. /* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */
  347. static struct regulator_init_data pandora_vmmc2 = {
  348. .constraints = {
  349. .min_uV = 1850000,
  350. .max_uV = 3150000,
  351. .valid_modes_mask = REGULATOR_MODE_NORMAL
  352. | REGULATOR_MODE_STANDBY,
  353. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  354. | REGULATOR_CHANGE_MODE
  355. | REGULATOR_CHANGE_STATUS,
  356. },
  357. .num_consumer_supplies = 1,
  358. .consumer_supplies = &pandora_vmmc2_supply,
  359. };
  360. /* VDAC for DSS driving S-Video */
  361. static struct regulator_init_data pandora_vdac = {
  362. .constraints = {
  363. .min_uV = 1800000,
  364. .max_uV = 1800000,
  365. .apply_uV = true,
  366. .valid_modes_mask = REGULATOR_MODE_NORMAL
  367. | REGULATOR_MODE_STANDBY,
  368. .valid_ops_mask = REGULATOR_CHANGE_MODE
  369. | REGULATOR_CHANGE_STATUS,
  370. },
  371. .num_consumer_supplies = 1,
  372. .consumer_supplies = &pandora_vdda_dac_supply,
  373. };
  374. /* VPLL2 for digital video outputs */
  375. static struct regulator_init_data pandora_vpll2 = {
  376. .constraints = {
  377. .min_uV = 1800000,
  378. .max_uV = 1800000,
  379. .apply_uV = true,
  380. .valid_modes_mask = REGULATOR_MODE_NORMAL
  381. | REGULATOR_MODE_STANDBY,
  382. .valid_ops_mask = REGULATOR_CHANGE_MODE
  383. | REGULATOR_CHANGE_STATUS,
  384. },
  385. .num_consumer_supplies = ARRAY_SIZE(pandora_vdds_supplies),
  386. .consumer_supplies = pandora_vdds_supplies,
  387. };
  388. /* VAUX1 for LCD */
  389. static struct regulator_init_data pandora_vaux1 = {
  390. .constraints = {
  391. .min_uV = 3000000,
  392. .max_uV = 3000000,
  393. .apply_uV = true,
  394. .valid_modes_mask = REGULATOR_MODE_NORMAL
  395. | REGULATOR_MODE_STANDBY,
  396. .valid_ops_mask = REGULATOR_CHANGE_MODE
  397. | REGULATOR_CHANGE_STATUS,
  398. },
  399. .num_consumer_supplies = 1,
  400. .consumer_supplies = &pandora_vcc_lcd_supply,
  401. };
  402. /* VAUX2 for USB host PHY */
  403. static struct regulator_init_data pandora_vaux2 = {
  404. .constraints = {
  405. .min_uV = 1800000,
  406. .max_uV = 1800000,
  407. .apply_uV = true,
  408. .valid_modes_mask = REGULATOR_MODE_NORMAL
  409. | REGULATOR_MODE_STANDBY,
  410. .valid_ops_mask = REGULATOR_CHANGE_MODE
  411. | REGULATOR_CHANGE_STATUS,
  412. },
  413. .num_consumer_supplies = 1,
  414. .consumer_supplies = &pandora_usb_phy_supply,
  415. };
  416. /* VAUX4 for ads7846 and nubs */
  417. static struct regulator_init_data pandora_vaux4 = {
  418. .constraints = {
  419. .min_uV = 2800000,
  420. .max_uV = 2800000,
  421. .apply_uV = true,
  422. .valid_modes_mask = REGULATOR_MODE_NORMAL
  423. | REGULATOR_MODE_STANDBY,
  424. .valid_ops_mask = REGULATOR_CHANGE_MODE
  425. | REGULATOR_CHANGE_STATUS,
  426. },
  427. .num_consumer_supplies = ARRAY_SIZE(pandora_vaux4_supplies),
  428. .consumer_supplies = pandora_vaux4_supplies,
  429. };
  430. /* VSIM for audio DAC */
  431. static struct regulator_init_data pandora_vsim = {
  432. .constraints = {
  433. .min_uV = 2800000,
  434. .max_uV = 2800000,
  435. .apply_uV = true,
  436. .valid_modes_mask = REGULATOR_MODE_NORMAL
  437. | REGULATOR_MODE_STANDBY,
  438. .valid_ops_mask = REGULATOR_CHANGE_MODE
  439. | REGULATOR_CHANGE_STATUS,
  440. },
  441. .num_consumer_supplies = 1,
  442. .consumer_supplies = &pandora_adac_supply,
  443. };
  444. /* Fixed regulator internal to Wifi module */
  445. static struct regulator_init_data pandora_vmmc3 = {
  446. .constraints = {
  447. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  448. },
  449. .num_consumer_supplies = 1,
  450. .consumer_supplies = &pandora_vmmc3_supply,
  451. };
  452. static struct fixed_voltage_config pandora_vwlan = {
  453. .supply_name = "vwlan",
  454. .microvolts = 1800000, /* 1.8V */
  455. .gpio = PANDORA_WIFI_NRESET_GPIO,
  456. .startup_delay = 50000, /* 50ms */
  457. .enable_high = 1,
  458. .enabled_at_boot = 0,
  459. .init_data = &pandora_vmmc3,
  460. };
  461. static struct platform_device pandora_vwlan_device = {
  462. .name = "reg-fixed-voltage",
  463. .id = 1,
  464. .dev = {
  465. .platform_data = &pandora_vwlan,
  466. },
  467. };
  468. static struct twl4030_usb_data omap3pandora_usb_data = {
  469. .usb_mode = T2_USB_MODE_ULPI,
  470. };
  471. static struct twl4030_codec_audio_data omap3pandora_audio_data = {
  472. .audio_mclk = 26000000,
  473. };
  474. static struct twl4030_codec_data omap3pandora_codec_data = {
  475. .audio_mclk = 26000000,
  476. .audio = &omap3pandora_audio_data,
  477. };
  478. static struct twl4030_bci_platform_data pandora_bci_data;
  479. static struct twl4030_platform_data omap3pandora_twldata = {
  480. .irq_base = TWL4030_IRQ_BASE,
  481. .irq_end = TWL4030_IRQ_END,
  482. .gpio = &omap3pandora_gpio_data,
  483. .usb = &omap3pandora_usb_data,
  484. .codec = &omap3pandora_codec_data,
  485. .vmmc1 = &pandora_vmmc1,
  486. .vmmc2 = &pandora_vmmc2,
  487. .vdac = &pandora_vdac,
  488. .vpll2 = &pandora_vpll2,
  489. .vaux1 = &pandora_vaux1,
  490. .vaux2 = &pandora_vaux2,
  491. .vaux4 = &pandora_vaux4,
  492. .vsim = &pandora_vsim,
  493. .keypad = &pandora_kp_data,
  494. .bci = &pandora_bci_data,
  495. };
  496. static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = {
  497. {
  498. I2C_BOARD_INFO("tps65950", 0x48),
  499. .flags = I2C_CLIENT_WAKE,
  500. .irq = INT_34XX_SYS_NIRQ,
  501. .platform_data = &omap3pandora_twldata,
  502. },
  503. };
  504. static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
  505. {
  506. I2C_BOARD_INFO("bq27500", 0x55),
  507. .flags = I2C_CLIENT_WAKE,
  508. },
  509. };
  510. static int __init omap3pandora_i2c_init(void)
  511. {
  512. omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo,
  513. ARRAY_SIZE(omap3pandora_i2c_boardinfo));
  514. /* i2c2 pins are not connected */
  515. omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,
  516. ARRAY_SIZE(omap3pandora_i2c3_boardinfo));
  517. return 0;
  518. }
  519. static void __init omap3pandora_ads7846_init(void)
  520. {
  521. int gpio = OMAP3_PANDORA_TS_GPIO;
  522. int ret;
  523. ret = gpio_request(gpio, "ads7846_pen_down");
  524. if (ret < 0) {
  525. printk(KERN_ERR "Failed to request GPIO %d for "
  526. "ads7846 pen down IRQ\n", gpio);
  527. return;
  528. }
  529. gpio_direction_input(gpio);
  530. }
  531. static int ads7846_get_pendown_state(void)
  532. {
  533. return !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
  534. }
  535. static struct ads7846_platform_data ads7846_config = {
  536. .x_max = 0x0fff,
  537. .y_max = 0x0fff,
  538. .x_plate_ohms = 180,
  539. .pressure_max = 255,
  540. .debounce_max = 10,
  541. .debounce_tol = 3,
  542. .debounce_rep = 1,
  543. .get_pendown_state = ads7846_get_pendown_state,
  544. .keep_vref_on = 1,
  545. };
  546. static struct omap2_mcspi_device_config ads7846_mcspi_config = {
  547. .turbo_mode = 0,
  548. .single_channel = 1, /* 0: slave, 1: master */
  549. };
  550. static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
  551. {
  552. .modalias = "ads7846",
  553. .bus_num = 1,
  554. .chip_select = 0,
  555. .max_speed_hz = 1500000,
  556. .controller_data = &ads7846_mcspi_config,
  557. .irq = OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO),
  558. .platform_data = &ads7846_config,
  559. }, {
  560. .modalias = "tpo_td043mtea1_panel_spi",
  561. .bus_num = 1,
  562. .chip_select = 1,
  563. .max_speed_hz = 375000,
  564. .platform_data = &pandora_lcd_device,
  565. }
  566. };
  567. static void __init omap3pandora_init_irq(void)
  568. {
  569. omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
  570. mt46h32m32lf6_sdrc_params);
  571. omap_init_irq();
  572. omap_gpio_init();
  573. }
  574. static void pandora_wl1251_set_power(bool enable)
  575. {
  576. /*
  577. * Keep power always on until wl1251_sdio driver learns to re-init
  578. * the chip after powering it down and back up.
  579. */
  580. }
  581. static struct wl12xx_platform_data pandora_wl1251_pdata = {
  582. .set_power = pandora_wl1251_set_power,
  583. .use_eeprom = true,
  584. };
  585. static struct platform_device pandora_wl1251_data = {
  586. .name = "wl1251_data",
  587. .id = -1,
  588. .dev = {
  589. .platform_data = &pandora_wl1251_pdata,
  590. },
  591. };
  592. static void pandora_wl1251_init(void)
  593. {
  594. int ret;
  595. ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq");
  596. if (ret < 0)
  597. goto fail;
  598. ret = gpio_direction_input(PANDORA_WIFI_IRQ_GPIO);
  599. if (ret < 0)
  600. goto fail_irq;
  601. pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
  602. if (pandora_wl1251_pdata.irq < 0)
  603. goto fail_irq;
  604. return;
  605. fail_irq:
  606. gpio_free(PANDORA_WIFI_IRQ_GPIO);
  607. fail:
  608. printk(KERN_ERR "wl1251 board initialisation failed\n");
  609. }
  610. static struct platform_device *omap3pandora_devices[] __initdata = {
  611. &pandora_leds_gpio,
  612. &pandora_keys_gpio,
  613. &pandora_dss_device,
  614. &pandora_wl1251_data,
  615. &pandora_vwlan_device,
  616. };
  617. static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
  618. .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
  619. .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  620. .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  621. .phy_reset = true,
  622. .reset_gpio_port[0] = 16,
  623. .reset_gpio_port[1] = -EINVAL,
  624. .reset_gpio_port[2] = -EINVAL
  625. };
  626. #ifdef CONFIG_OMAP_MUX
  627. static struct omap_board_mux board_mux[] __initdata = {
  628. { .reg_offset = OMAP_MUX_TERMINATOR },
  629. };
  630. #else
  631. #define board_mux NULL
  632. #endif
  633. static struct omap_musb_board_data musb_board_data = {
  634. .interface_type = MUSB_INTERFACE_ULPI,
  635. .mode = MUSB_OTG,
  636. .power = 100,
  637. };
  638. static void __init omap3pandora_init(void)
  639. {
  640. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  641. omap3pandora_i2c_init();
  642. pandora_wl1251_init();
  643. platform_add_devices(omap3pandora_devices,
  644. ARRAY_SIZE(omap3pandora_devices));
  645. omap_serial_init();
  646. spi_register_board_info(omap3pandora_spi_board_info,
  647. ARRAY_SIZE(omap3pandora_spi_board_info));
  648. omap3pandora_ads7846_init();
  649. usb_ehci_init(&ehci_pdata);
  650. usb_musb_init(&musb_board_data);
  651. gpmc_nand_init(&pandora_nand_data);
  652. /* Ensure SDRC pins are mux'd for self-refresh */
  653. omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
  654. omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
  655. }
  656. MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
  657. .boot_params = 0x80000100,
  658. .map_io = omap3_map_io,
  659. .reserve = omap_reserve,
  660. .init_irq = omap3pandora_init_irq,
  661. .init_machine = omap3pandora_init,
  662. .timer = &omap_timer,
  663. MACHINE_END