board-igep0020.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  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 "common.h"
  28. #include <plat/gpmc.h>
  29. #include <plat/usb.h>
  30. #include <video/omapdss.h>
  31. #include <video/omap-panel-dvi.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. .deferred = true,
  255. },
  256. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  257. {
  258. .mmc = 2,
  259. .caps = MMC_CAP_4_BIT_DATA,
  260. .gpio_cd = -EINVAL,
  261. .gpio_wp = -EINVAL,
  262. },
  263. #endif
  264. {} /* Terminator */
  265. };
  266. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  267. #include <linux/leds.h>
  268. static struct gpio_led igep_gpio_leds[] = {
  269. [0] = {
  270. .name = "gpio-led:red:d0",
  271. .default_trigger = "default-off"
  272. },
  273. [1] = {
  274. .name = "gpio-led:green:d0",
  275. .default_trigger = "default-off",
  276. },
  277. [2] = {
  278. .name = "gpio-led:red:d1",
  279. .default_trigger = "default-off",
  280. },
  281. [3] = {
  282. .name = "gpio-led:green:d1",
  283. .default_trigger = "heartbeat",
  284. .gpio = -EINVAL, /* gets replaced */
  285. .active_low = 1,
  286. },
  287. };
  288. static struct gpio_led_platform_data igep_led_pdata = {
  289. .leds = igep_gpio_leds,
  290. .num_leds = ARRAY_SIZE(igep_gpio_leds),
  291. };
  292. static struct platform_device igep_led_device = {
  293. .name = "leds-gpio",
  294. .id = -1,
  295. .dev = {
  296. .platform_data = &igep_led_pdata,
  297. },
  298. };
  299. static void __init igep_leds_init(void)
  300. {
  301. if (machine_is_igep0020()) {
  302. igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
  303. igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
  304. igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
  305. } else {
  306. igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
  307. igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
  308. igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
  309. }
  310. platform_device_register(&igep_led_device);
  311. }
  312. #else
  313. static struct gpio igep_gpio_leds[] __initdata = {
  314. { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d0" },
  315. { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" },
  316. { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d1" },
  317. };
  318. static inline void igep_leds_init(void)
  319. {
  320. int i;
  321. if (machine_is_igep0020()) {
  322. igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
  323. igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
  324. igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
  325. } else {
  326. igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
  327. igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
  328. igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
  329. }
  330. if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) {
  331. pr_warning("IGEP v2: Could not obtain leds gpios\n");
  332. return;
  333. }
  334. for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++)
  335. gpio_export(igep_gpio_leds[i].gpio, 0);
  336. }
  337. #endif
  338. static struct gpio igep2_twl_gpios[] = {
  339. { -EINVAL, GPIOF_IN, "GPIO_EHCI_NOC" },
  340. { -EINVAL, GPIOF_OUT_INIT_LOW, "GPIO_USBH_CPEN" },
  341. };
  342. static int igep_twl_gpio_setup(struct device *dev,
  343. unsigned gpio, unsigned ngpio)
  344. {
  345. int ret;
  346. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  347. mmc[0].gpio_cd = gpio + 0;
  348. omap_hsmmc_late_init(mmc);
  349. /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
  350. #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
  351. ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH,
  352. "gpio-led:green:d1");
  353. if (ret == 0)
  354. gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
  355. else
  356. pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n");
  357. #else
  358. igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
  359. #endif
  360. if (machine_is_igep0030())
  361. return 0;
  362. /*
  363. * REVISIT: need ehci-omap hooks for external VBUS
  364. * power switch and overcurrent detect
  365. */
  366. igep2_twl_gpios[0].gpio = gpio + 1;
  367. /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */
  368. igep2_twl_gpios[1].gpio = gpio + TWL4030_GPIO_MAX;
  369. ret = gpio_request_array(igep2_twl_gpios, ARRAY_SIZE(igep2_twl_gpios));
  370. if (ret < 0)
  371. pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
  372. return 0;
  373. };
  374. static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
  375. .gpio_base = OMAP_MAX_GPIO_LINES,
  376. .irq_base = TWL4030_GPIO_IRQ_BASE,
  377. .irq_end = TWL4030_GPIO_IRQ_END,
  378. .use_leds = true,
  379. .setup = igep_twl_gpio_setup,
  380. };
  381. static int igep2_enable_dvi(struct omap_dss_device *dssdev)
  382. {
  383. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
  384. return 0;
  385. }
  386. static void igep2_disable_dvi(struct omap_dss_device *dssdev)
  387. {
  388. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
  389. }
  390. static struct panel_dvi_platform_data dvi_panel = {
  391. .platform_enable = igep2_enable_dvi,
  392. .platform_disable = igep2_disable_dvi,
  393. .i2c_bus_num = 3,
  394. };
  395. static struct omap_dss_device igep2_dvi_device = {
  396. .type = OMAP_DISPLAY_TYPE_DPI,
  397. .name = "dvi",
  398. .driver_name = "dvi",
  399. .data = &dvi_panel,
  400. .phy.dpi.data_lines = 24,
  401. };
  402. static struct omap_dss_device *igep2_dss_devices[] = {
  403. &igep2_dvi_device
  404. };
  405. static struct omap_dss_board_info igep2_dss_data = {
  406. .num_devices = ARRAY_SIZE(igep2_dss_devices),
  407. .devices = igep2_dss_devices,
  408. .default_device = &igep2_dvi_device,
  409. };
  410. static void __init igep2_display_init(void)
  411. {
  412. int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH,
  413. "GPIO_DVI_PUP");
  414. if (err)
  415. pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
  416. }
  417. static struct platform_device *igep_devices[] __initdata = {
  418. &igep_vwlan_device,
  419. };
  420. static int igep2_keymap[] = {
  421. KEY(0, 0, KEY_LEFT),
  422. KEY(0, 1, KEY_RIGHT),
  423. KEY(0, 2, KEY_A),
  424. KEY(0, 3, KEY_B),
  425. KEY(1, 0, KEY_DOWN),
  426. KEY(1, 1, KEY_UP),
  427. KEY(1, 2, KEY_E),
  428. KEY(1, 3, KEY_F),
  429. KEY(2, 0, KEY_ENTER),
  430. KEY(2, 1, KEY_I),
  431. KEY(2, 2, KEY_J),
  432. KEY(2, 3, KEY_K),
  433. KEY(3, 0, KEY_M),
  434. KEY(3, 1, KEY_N),
  435. KEY(3, 2, KEY_O),
  436. KEY(3, 3, KEY_P)
  437. };
  438. static struct matrix_keymap_data igep2_keymap_data = {
  439. .keymap = igep2_keymap,
  440. .keymap_size = ARRAY_SIZE(igep2_keymap),
  441. };
  442. static struct twl4030_keypad_data igep2_keypad_pdata = {
  443. .keymap_data = &igep2_keymap_data,
  444. .rows = 4,
  445. .cols = 4,
  446. .rep = 1,
  447. };
  448. static struct twl4030_platform_data igep_twldata = {
  449. /* platform_data for children goes here */
  450. .gpio = &igep_twl4030_gpio_pdata,
  451. .vmmc1 = &igep_vmmc1,
  452. .vio = &igep_vio,
  453. };
  454. static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
  455. {
  456. I2C_BOARD_INFO("eeprom", 0x50),
  457. },
  458. };
  459. static void __init igep_i2c_init(void)
  460. {
  461. int ret;
  462. omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_USB, 0);
  463. if (machine_is_igep0020()) {
  464. /*
  465. * Bus 3 is attached to the DVI port where devices like the
  466. * pico DLP projector don't work reliably with 400kHz
  467. */
  468. ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
  469. ARRAY_SIZE(igep2_i2c3_boardinfo));
  470. if (ret)
  471. pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
  472. igep_twldata.keypad = &igep2_keypad_pdata;
  473. /* Get common pmic data */
  474. omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_AUDIO,
  475. TWL_COMMON_REGULATOR_VPLL2);
  476. igep_twldata.vpll2->constraints.apply_uV = true;
  477. igep_twldata.vpll2->constraints.name = "VDVI";
  478. }
  479. omap3_pmic_init("twl4030", &igep_twldata);
  480. }
  481. static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = {
  482. .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
  483. .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
  484. .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
  485. .phy_reset = true,
  486. .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
  487. .reset_gpio_port[1] = -EINVAL,
  488. .reset_gpio_port[2] = -EINVAL,
  489. };
  490. static const struct usbhs_omap_board_data igep3_usbhs_bdata __initconst = {
  491. .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
  492. .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
  493. .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
  494. .phy_reset = true,
  495. .reset_gpio_port[0] = -EINVAL,
  496. .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
  497. .reset_gpio_port[2] = -EINVAL,
  498. };
  499. #ifdef CONFIG_OMAP_MUX
  500. static struct omap_board_mux board_mux[] __initdata = {
  501. { .reg_offset = OMAP_MUX_TERMINATOR },
  502. };
  503. #endif
  504. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  505. static struct gpio igep_wlan_bt_gpios[] __initdata = {
  506. { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" },
  507. { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" },
  508. { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" },
  509. };
  510. static void __init igep_wlan_bt_init(void)
  511. {
  512. int err;
  513. /* GPIO's for WLAN-BT combo depends on hardware revision */
  514. if (hwrev == IGEP2_BOARD_HWREV_B) {
  515. igep_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD;
  516. igep_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET;
  517. igep_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET;
  518. } else if (hwrev == IGEP2_BOARD_HWREV_C || machine_is_igep0030()) {
  519. igep_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD;
  520. igep_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET;
  521. igep_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET;
  522. } else
  523. return;
  524. err = gpio_request_array(igep_wlan_bt_gpios,
  525. ARRAY_SIZE(igep_wlan_bt_gpios));
  526. if (err) {
  527. pr_warning("IGEP2: Could not obtain WIFI/BT gpios\n");
  528. return;
  529. }
  530. gpio_export(igep_wlan_bt_gpios[0].gpio, 0);
  531. gpio_export(igep_wlan_bt_gpios[1].gpio, 0);
  532. gpio_export(igep_wlan_bt_gpios[2].gpio, 0);
  533. gpio_set_value(igep_wlan_bt_gpios[1].gpio, 0);
  534. udelay(10);
  535. gpio_set_value(igep_wlan_bt_gpios[1].gpio, 1);
  536. }
  537. #else
  538. static inline void __init igep_wlan_bt_init(void) { }
  539. #endif
  540. static struct regulator_consumer_supply dummy_supplies[] = {
  541. REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
  542. REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
  543. };
  544. static void __init igep_init(void)
  545. {
  546. regulator_register_fixed(1, dummy_supplies, ARRAY_SIZE(dummy_supplies));
  547. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  548. /* Get IGEP2 hardware revision */
  549. igep2_get_revision();
  550. omap_hsmmc_init(mmc);
  551. /* Register I2C busses and drivers */
  552. igep_i2c_init();
  553. platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
  554. omap_serial_init();
  555. omap_sdrc_init(m65kxxxxam_sdrc_params,
  556. m65kxxxxam_sdrc_params);
  557. usb_musb_init(NULL);
  558. igep_flash_init();
  559. igep_leds_init();
  560. /*
  561. * WLAN-BT combo module from MuRata which has a Marvell WLAN
  562. * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
  563. */
  564. igep_wlan_bt_init();
  565. if (machine_is_igep0020()) {
  566. omap_display_init(&igep2_dss_data);
  567. igep2_display_init();
  568. igep2_init_smsc911x();
  569. usbhs_init(&igep2_usbhs_bdata);
  570. } else {
  571. usbhs_init(&igep3_usbhs_bdata);
  572. }
  573. }
  574. MACHINE_START(IGEP0020, "IGEP v2 board")
  575. .atag_offset = 0x100,
  576. .reserve = omap_reserve,
  577. .map_io = omap3_map_io,
  578. .init_early = omap35xx_init_early,
  579. .init_irq = omap3_init_irq,
  580. .handle_irq = omap3_intc_handle_irq,
  581. .init_machine = igep_init,
  582. .timer = &omap3_timer,
  583. .restart = omap_prcm_restart,
  584. MACHINE_END
  585. MACHINE_START(IGEP0030, "IGEP OMAP3 module")
  586. .atag_offset = 0x100,
  587. .reserve = omap_reserve,
  588. .map_io = omap3_map_io,
  589. .init_early = omap35xx_init_early,
  590. .init_irq = omap3_init_irq,
  591. .handle_irq = omap3_intc_handle_irq,
  592. .init_machine = igep_init,
  593. .timer = &omap3_timer,
  594. .restart = omap_prcm_restart,
  595. MACHINE_END