board-igep0020.c 18 KB

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