board-igep0020.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /*
  2. * Copyright (C) 2009 Integration Software and Electronic Engineering.
  3. *
  4. * Modified from mach-omap2/board-generic.c
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/delay.h>
  14. #include <linux/err.h>
  15. #include <linux/clk.h>
  16. #include <linux/io.h>
  17. #include <linux/gpio.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/input.h>
  20. #include <linux/regulator/machine.h>
  21. #include <linux/regulator/fixed.h>
  22. #include <linux/i2c/twl.h>
  23. #include <linux/mmc/host.h>
  24. #include <asm/mach-types.h>
  25. #include <asm/mach/arch.h>
  26. #include <plat/board.h>
  27. #include <plat/common.h>
  28. #include <plat/gpmc.h>
  29. #include <plat/usb.h>
  30. #include <video/omapdss.h>
  31. #include <video/omap-panel-generic-dpi.h>
  32. #include <plat/onenand.h>
  33. #include "mux.h"
  34. #include "hsmmc.h"
  35. #include "sdram-numonyx-m65kxxxxam.h"
  36. #include "common-board-devices.h"
  37. #define IGEP2_SMSC911X_CS 5
  38. #define IGEP2_SMSC911X_GPIO 176
  39. #define IGEP2_GPIO_USBH_NRESET 24
  40. #define IGEP2_GPIO_LED0_GREEN 26
  41. #define IGEP2_GPIO_LED0_RED 27
  42. #define IGEP2_GPIO_LED1_RED 28
  43. #define IGEP2_GPIO_DVI_PUP 170
  44. #define IGEP2_RB_GPIO_WIFI_NPD 94
  45. #define IGEP2_RB_GPIO_WIFI_NRESET 95
  46. #define IGEP2_RB_GPIO_BT_NRESET 137
  47. #define IGEP2_RC_GPIO_WIFI_NPD 138
  48. #define IGEP2_RC_GPIO_WIFI_NRESET 139
  49. #define IGEP2_RC_GPIO_BT_NRESET 137
  50. #define IGEP3_GPIO_LED0_GREEN 54
  51. #define IGEP3_GPIO_LED0_RED 53
  52. #define IGEP3_GPIO_LED1_RED 16
  53. #define IGEP3_GPIO_USBH_NRESET 183
  54. /*
  55. * IGEP2 Hardware Revision Table
  56. *
  57. * --------------------------------------------------------------------------
  58. * | Id. | Hw Rev. | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
  59. * --------------------------------------------------------------------------
  60. * | 0 | B | high | gpio94 | gpio95 | - |
  61. * | 0 | B/C (B-compatible) | high | gpio94 | gpio95 | gpio137 |
  62. * | 1 | C | low | gpio138 | gpio139 | gpio137 |
  63. * --------------------------------------------------------------------------
  64. */
  65. #define IGEP2_BOARD_HWREV_B 0
  66. #define IGEP2_BOARD_HWREV_C 1
  67. #define IGEP3_BOARD_HWREV 2
  68. static u8 hwrev;
  69. static void __init igep2_get_revision(void)
  70. {
  71. u8 ret;
  72. if (machine_is_igep0030()) {
  73. hwrev = IGEP3_BOARD_HWREV;
  74. return;
  75. }
  76. omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
  77. if (gpio_request_one(IGEP2_GPIO_LED1_RED, GPIOF_IN, "GPIO_HW0_REV")) {
  78. pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
  79. pr_err("IGEP2: Unknown Hardware Revision\n");
  80. return;
  81. }
  82. ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
  83. if (ret == 0) {
  84. pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
  85. hwrev = IGEP2_BOARD_HWREV_C;
  86. } else if (ret == 1) {
  87. pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
  88. hwrev = IGEP2_BOARD_HWREV_B;
  89. } else {
  90. pr_err("IGEP2: Unknown Hardware Revision\n");
  91. hwrev = -1;
  92. }
  93. gpio_free(IGEP2_GPIO_LED1_RED);
  94. }
  95. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  96. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  97. #define ONENAND_MAP 0x20000000
  98. /* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
  99. * Since the device is equipped with two DataRAMs, and two-plane NAND
  100. * Flash memory array, these two component enables simultaneous program
  101. * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
  102. * while Plane2 has only odd blocks such as block1, block3, block5.
  103. * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
  104. */
  105. static struct mtd_partition igep_onenand_partitions[] = {
  106. {
  107. .name = "X-Loader",
  108. .offset = 0,
  109. .size = 2 * (64*(2*2048))
  110. },
  111. {
  112. .name = "U-Boot",
  113. .offset = MTDPART_OFS_APPEND,
  114. .size = 6 * (64*(2*2048)),
  115. },
  116. {
  117. .name = "Environment",
  118. .offset = MTDPART_OFS_APPEND,
  119. .size = 2 * (64*(2*2048)),
  120. },
  121. {
  122. .name = "Kernel",
  123. .offset = MTDPART_OFS_APPEND,
  124. .size = 12 * (64*(2*2048)),
  125. },
  126. {
  127. .name = "File System",
  128. .offset = MTDPART_OFS_APPEND,
  129. .size = MTDPART_SIZ_FULL,
  130. },
  131. };
  132. static struct omap_onenand_platform_data igep_onenand_data = {
  133. .parts = igep_onenand_partitions,
  134. .nr_parts = ARRAY_SIZE(igep_onenand_partitions),
  135. .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
  136. };
  137. static struct platform_device igep_onenand_device = {
  138. .name = "omap2-onenand",
  139. .id = -1,
  140. .dev = {
  141. .platform_data = &igep_onenand_data,
  142. },
  143. };
  144. static void __init igep_flash_init(void)
  145. {
  146. u8 cs = 0;
  147. u8 onenandcs = GPMC_CS_NUM + 1;
  148. for (cs = 0; cs < GPMC_CS_NUM; cs++) {
  149. u32 ret;
  150. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
  151. /* Check if NAND/oneNAND is configured */
  152. if ((ret & 0xC00) == 0x800)
  153. /* NAND found */
  154. pr_err("IGEP: Unsupported NAND found\n");
  155. else {
  156. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
  157. if ((ret & 0x3F) == (ONENAND_MAP >> 24))
  158. /* ONENAND found */
  159. onenandcs = cs;
  160. }
  161. }
  162. if (onenandcs > GPMC_CS_NUM) {
  163. pr_err("IGEP: Unable to find configuration in GPMC\n");
  164. return;
  165. }
  166. igep_onenand_data.cs = onenandcs;
  167. if (platform_device_register(&igep_onenand_device) < 0)
  168. pr_err("IGEP: Unable to register OneNAND device\n");
  169. }
  170. #else
  171. static void __init igep_flash_init(void) {}
  172. #endif
  173. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  174. #include <linux/smsc911x.h>
  175. #include <plat/gpmc-smsc911x.h>
  176. static struct omap_smsc911x_platform_data smsc911x_cfg = {
  177. .cs = IGEP2_SMSC911X_CS,
  178. .gpio_irq = IGEP2_SMSC911X_GPIO,
  179. .gpio_reset = -EINVAL,
  180. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
  181. };
  182. static inline void __init igep2_init_smsc911x(void)
  183. {
  184. gpmc_smsc911x_init(&smsc911x_cfg);
  185. }
  186. #else
  187. static inline void __init igep2_init_smsc911x(void) { }
  188. #endif
  189. static struct regulator_consumer_supply igep_vmmc1_supply[] = {
  190. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
  191. };
  192. /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
  193. static struct regulator_init_data igep_vmmc1 = {
  194. .constraints = {
  195. .min_uV = 1850000,
  196. .max_uV = 3150000,
  197. .valid_modes_mask = REGULATOR_MODE_NORMAL
  198. | REGULATOR_MODE_STANDBY,
  199. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  200. | REGULATOR_CHANGE_MODE
  201. | REGULATOR_CHANGE_STATUS,
  202. },
  203. .num_consumer_supplies = ARRAY_SIZE(igep_vmmc1_supply),
  204. .consumer_supplies = igep_vmmc1_supply,
  205. };
  206. static struct regulator_consumer_supply igep_vio_supply[] = {
  207. REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
  208. };
  209. static struct regulator_init_data igep_vio = {
  210. .constraints = {
  211. .min_uV = 1800000,
  212. .max_uV = 1800000,
  213. .apply_uV = 1,
  214. .valid_modes_mask = REGULATOR_MODE_NORMAL
  215. | REGULATOR_MODE_STANDBY,
  216. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  217. | REGULATOR_CHANGE_MODE
  218. | REGULATOR_CHANGE_STATUS,
  219. },
  220. .num_consumer_supplies = ARRAY_SIZE(igep_vio_supply),
  221. .consumer_supplies = igep_vio_supply,
  222. };
  223. static struct regulator_consumer_supply igep_vmmc2_supply[] = {
  224. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
  225. };
  226. static struct regulator_init_data igep_vmmc2 = {
  227. .constraints = {
  228. .valid_modes_mask = REGULATOR_MODE_NORMAL,
  229. .always_on = 1,
  230. },
  231. .num_consumer_supplies = ARRAY_SIZE(igep_vmmc2_supply),
  232. .consumer_supplies = igep_vmmc2_supply,
  233. };
  234. static struct fixed_voltage_config igep_vwlan = {
  235. .supply_name = "vwlan",
  236. .microvolts = 3300000,
  237. .gpio = -EINVAL,
  238. .enabled_at_boot = 1,
  239. .init_data = &igep_vmmc2,
  240. };
  241. static struct platform_device igep_vwlan_device = {
  242. .name = "reg-fixed-voltage",
  243. .id = 0,
  244. .dev = {
  245. .platform_data = &igep_vwlan,
  246. },
  247. };
  248. static struct omap2_hsmmc_info mmc[] = {
  249. {
  250. .mmc = 1,
  251. .caps = MMC_CAP_4_BIT_DATA,
  252. .gpio_cd = -EINVAL,
  253. .gpio_wp = -EINVAL,
  254. },
  255. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  256. {
  257. .mmc = 2,
  258. .caps = MMC_CAP_4_BIT_DATA,
  259. .gpio_cd = -EINVAL,
  260. .gpio_wp = -EINVAL,
  261. },
  262. #endif
  263. {} /* Terminator */
  264. };
  265. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  266. #include <linux/leds.h>
  267. static struct gpio_led igep_gpio_leds[] = {
  268. [0] = {
  269. .name = "gpio-led:red:d0",
  270. .default_trigger = "default-off"
  271. },
  272. [1] = {
  273. .name = "gpio-led:green:d0",
  274. .default_trigger = "default-off",
  275. },
  276. [2] = {
  277. .name = "gpio-led:red:d1",
  278. .default_trigger = "default-off",
  279. },
  280. [3] = {
  281. .name = "gpio-led:green:d1",
  282. .default_trigger = "heartbeat",
  283. .gpio = -EINVAL, /* gets replaced */
  284. .active_low = 1,
  285. },
  286. };
  287. static struct gpio_led_platform_data igep_led_pdata = {
  288. .leds = igep_gpio_leds,
  289. .num_leds = ARRAY_SIZE(igep_gpio_leds),
  290. };
  291. static struct platform_device igep_led_device = {
  292. .name = "leds-gpio",
  293. .id = -1,
  294. .dev = {
  295. .platform_data = &igep_led_pdata,
  296. },
  297. };
  298. static void __init igep_leds_init(void)
  299. {
  300. if (machine_is_igep0020()) {
  301. igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
  302. igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
  303. igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
  304. } else {
  305. igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
  306. igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
  307. igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
  308. }
  309. platform_device_register(&igep_led_device);
  310. }
  311. #else
  312. static struct gpio igep_gpio_leds[] __initdata = {
  313. { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d0" },
  314. { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" },
  315. { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d1" },
  316. };
  317. static inline void igep_leds_init(void)
  318. {
  319. int i;
  320. if (machine_is_igep0020()) {
  321. igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
  322. igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
  323. igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
  324. } else {
  325. igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
  326. igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
  327. igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
  328. }
  329. if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) {
  330. pr_warning("IGEP v2: Could not obtain leds gpios\n");
  331. return;
  332. }
  333. for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++)
  334. gpio_export(igep_gpio_leds[i].gpio, 0);
  335. }
  336. #endif
  337. static struct gpio igep2_twl_gpios[] = {
  338. { -EINVAL, GPIOF_IN, "GPIO_EHCI_NOC" },
  339. { -EINVAL, GPIOF_OUT_INIT_LOW, "GPIO_USBH_CPEN" },
  340. };
  341. static int igep_twl_gpio_setup(struct device *dev,
  342. unsigned gpio, unsigned ngpio)
  343. {
  344. int ret;
  345. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  346. mmc[0].gpio_cd = gpio + 0;
  347. omap2_hsmmc_init(mmc);
  348. /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
  349. #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
  350. ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH,
  351. "gpio-led:green:d1");
  352. if (ret == 0)
  353. gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
  354. else
  355. pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n");
  356. #else
  357. igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
  358. #endif
  359. if (machine_is_igep0030())
  360. return 0;
  361. /*
  362. * REVISIT: need ehci-omap hooks for external VBUS
  363. * power switch and overcurrent detect
  364. */
  365. igep2_twl_gpios[0].gpio = gpio + 1;
  366. /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */
  367. igep2_twl_gpios[1].gpio = gpio + TWL4030_GPIO_MAX;
  368. ret = gpio_request_array(igep2_twl_gpios, ARRAY_SIZE(igep2_twl_gpios));
  369. if (ret < 0)
  370. pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
  371. return 0;
  372. };
  373. static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
  374. .gpio_base = OMAP_MAX_GPIO_LINES,
  375. .irq_base = TWL4030_GPIO_IRQ_BASE,
  376. .irq_end = TWL4030_GPIO_IRQ_END,
  377. .use_leds = true,
  378. .setup = igep_twl_gpio_setup,
  379. };
  380. static int igep2_enable_dvi(struct omap_dss_device *dssdev)
  381. {
  382. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
  383. return 0;
  384. }
  385. static void igep2_disable_dvi(struct omap_dss_device *dssdev)
  386. {
  387. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
  388. }
  389. static struct panel_generic_dpi_data dvi_panel = {
  390. .name = "generic",
  391. .platform_enable = igep2_enable_dvi,
  392. .platform_disable = igep2_disable_dvi,
  393. };
  394. static struct omap_dss_device igep2_dvi_device = {
  395. .type = OMAP_DISPLAY_TYPE_DPI,
  396. .name = "dvi",
  397. .driver_name = "generic_dpi_panel",
  398. .data = &dvi_panel,
  399. .phy.dpi.data_lines = 24,
  400. };
  401. static struct omap_dss_device *igep2_dss_devices[] = {
  402. &igep2_dvi_device
  403. };
  404. static struct omap_dss_board_info igep2_dss_data = {
  405. .num_devices = ARRAY_SIZE(igep2_dss_devices),
  406. .devices = igep2_dss_devices,
  407. .default_device = &igep2_dvi_device,
  408. };
  409. static void __init igep2_display_init(void)
  410. {
  411. int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH,
  412. "GPIO_DVI_PUP");
  413. if (err)
  414. pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
  415. }
  416. static struct platform_device *igep_devices[] __initdata = {
  417. &igep_vwlan_device,
  418. };
  419. static void __init igep_init_early(void)
  420. {
  421. omap2_init_common_infrastructure();
  422. omap2_init_common_devices(m65kxxxxam_sdrc_params,
  423. m65kxxxxam_sdrc_params);
  424. }
  425. static int igep2_keymap[] = {
  426. KEY(0, 0, KEY_LEFT),
  427. KEY(0, 1, KEY_RIGHT),
  428. KEY(0, 2, KEY_A),
  429. KEY(0, 3, KEY_B),
  430. KEY(1, 0, KEY_DOWN),
  431. KEY(1, 1, KEY_UP),
  432. KEY(1, 2, KEY_E),
  433. KEY(1, 3, KEY_F),
  434. KEY(2, 0, KEY_ENTER),
  435. KEY(2, 1, KEY_I),
  436. KEY(2, 2, KEY_J),
  437. KEY(2, 3, KEY_K),
  438. KEY(3, 0, KEY_M),
  439. KEY(3, 1, KEY_N),
  440. KEY(3, 2, KEY_O),
  441. KEY(3, 3, KEY_P)
  442. };
  443. static struct matrix_keymap_data igep2_keymap_data = {
  444. .keymap = igep2_keymap,
  445. .keymap_size = ARRAY_SIZE(igep2_keymap),
  446. };
  447. static struct twl4030_keypad_data igep2_keypad_pdata = {
  448. .keymap_data = &igep2_keymap_data,
  449. .rows = 4,
  450. .cols = 4,
  451. .rep = 1,
  452. };
  453. static struct twl4030_platform_data igep_twldata = {
  454. /* platform_data for children goes here */
  455. .gpio = &igep_twl4030_gpio_pdata,
  456. .vmmc1 = &igep_vmmc1,
  457. .vio = &igep_vio,
  458. };
  459. static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
  460. {
  461. I2C_BOARD_INFO("eeprom", 0x50),
  462. },
  463. };
  464. static void __init igep_i2c_init(void)
  465. {
  466. int ret;
  467. omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_USB, 0);
  468. if (machine_is_igep0020()) {
  469. /*
  470. * Bus 3 is attached to the DVI port where devices like the
  471. * pico DLP projector don't work reliably with 400kHz
  472. */
  473. ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
  474. ARRAY_SIZE(igep2_i2c3_boardinfo));
  475. if (ret)
  476. pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
  477. igep_twldata.keypad = &igep2_keypad_pdata;
  478. /* Get common pmic data */
  479. omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_AUDIO,
  480. TWL_COMMON_REGULATOR_VPLL2);
  481. igep_twldata.vpll2->constraints.apply_uV = true;
  482. igep_twldata.vpll2->constraints.name = "VDVI";
  483. }
  484. omap3_pmic_init("twl4030", &igep_twldata);
  485. }
  486. static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = {
  487. .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
  488. .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
  489. .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
  490. .phy_reset = true,
  491. .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
  492. .reset_gpio_port[1] = -EINVAL,
  493. .reset_gpio_port[2] = -EINVAL,
  494. };
  495. static const struct usbhs_omap_board_data igep3_usbhs_bdata __initconst = {
  496. .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
  497. .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
  498. .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
  499. .phy_reset = true,
  500. .reset_gpio_port[0] = -EINVAL,
  501. .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
  502. .reset_gpio_port[2] = -EINVAL,
  503. };
  504. #ifdef CONFIG_OMAP_MUX
  505. static struct omap_board_mux board_mux[] __initdata = {
  506. { .reg_offset = OMAP_MUX_TERMINATOR },
  507. };
  508. #endif
  509. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  510. static struct gpio igep_wlan_bt_gpios[] __initdata = {
  511. { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" },
  512. { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" },
  513. { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" },
  514. };
  515. static void __init igep_wlan_bt_init(void)
  516. {
  517. int err;
  518. /* GPIO's for WLAN-BT combo depends on hardware revision */
  519. if (hwrev == IGEP2_BOARD_HWREV_B) {
  520. igep_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD;
  521. igep_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET;
  522. igep_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET;
  523. } else if (hwrev == IGEP2_BOARD_HWREV_C || machine_is_igep0030()) {
  524. igep_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD;
  525. igep_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET;
  526. igep_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET;
  527. } else
  528. return;
  529. err = gpio_request_array(igep_wlan_bt_gpios,
  530. ARRAY_SIZE(igep_wlan_bt_gpios));
  531. if (err) {
  532. pr_warning("IGEP2: Could not obtain WIFI/BT gpios\n");
  533. return;
  534. }
  535. gpio_export(igep_wlan_bt_gpios[0].gpio, 0);
  536. gpio_export(igep_wlan_bt_gpios[1].gpio, 0);
  537. gpio_export(igep_wlan_bt_gpios[2].gpio, 0);
  538. gpio_set_value(igep_wlan_bt_gpios[1].gpio, 0);
  539. udelay(10);
  540. gpio_set_value(igep_wlan_bt_gpios[1].gpio, 1);
  541. }
  542. #else
  543. static inline void __init igep_wlan_bt_init(void) { }
  544. #endif
  545. static void __init igep_init(void)
  546. {
  547. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  548. /* Get IGEP2 hardware revision */
  549. igep2_get_revision();
  550. /* Register I2C busses and drivers */
  551. igep_i2c_init();
  552. platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
  553. omap_serial_init();
  554. usb_musb_init(NULL);
  555. igep_flash_init();
  556. igep_leds_init();
  557. /*
  558. * WLAN-BT combo module from MuRata which has a Marvell WLAN
  559. * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
  560. */
  561. igep_wlan_bt_init();
  562. if (machine_is_igep0020()) {
  563. omap_display_init(&igep2_dss_data);
  564. igep2_display_init();
  565. igep2_init_smsc911x();
  566. usbhs_init(&igep2_usbhs_bdata);
  567. } else {
  568. usbhs_init(&igep3_usbhs_bdata);
  569. }
  570. }
  571. MACHINE_START(IGEP0020, "IGEP v2 board")
  572. .boot_params = 0x80000100,
  573. .reserve = omap_reserve,
  574. .map_io = omap3_map_io,
  575. .init_early = igep_init_early,
  576. .init_irq = omap3_init_irq,
  577. .init_machine = igep_init,
  578. .timer = &omap3_timer,
  579. MACHINE_END
  580. MACHINE_START(IGEP0030, "IGEP OMAP3 module")
  581. .boot_params = 0x80000100,
  582. .reserve = omap_reserve,
  583. .map_io = omap3_map_io,
  584. .init_early = igep_init_early,
  585. .init_irq = omap3_init_irq,
  586. .init_machine = igep_init,
  587. .timer = &omap3_timer,
  588. MACHINE_END