board-omap3pandora.c 18 KB

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