board-igep0020.c 17 KB

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