board-igep0020.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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/regulator/machine.h>
  20. #include <linux/i2c/twl.h>
  21. #include <linux/mmc/host.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <plat/board.h>
  25. #include <plat/common.h>
  26. #include <plat/gpmc.h>
  27. #include <plat/usb.h>
  28. #include <plat/display.h>
  29. #include <plat/onenand.h>
  30. #include "mux.h"
  31. #include "hsmmc.h"
  32. #include "sdram-numonyx-m65kxxxxam.h"
  33. #define IGEP2_SMSC911X_CS 5
  34. #define IGEP2_SMSC911X_GPIO 176
  35. #define IGEP2_GPIO_USBH_NRESET 24
  36. #define IGEP2_GPIO_LED0_GREEN 26
  37. #define IGEP2_GPIO_LED0_RED 27
  38. #define IGEP2_GPIO_LED1_RED 28
  39. #define IGEP2_GPIO_DVI_PUP 170
  40. #define IGEP2_RB_GPIO_WIFI_NPD 94
  41. #define IGEP2_RB_GPIO_WIFI_NRESET 95
  42. #define IGEP2_RB_GPIO_BT_NRESET 137
  43. #define IGEP2_RC_GPIO_WIFI_NPD 138
  44. #define IGEP2_RC_GPIO_WIFI_NRESET 139
  45. #define IGEP2_RC_GPIO_BT_NRESET 137
  46. /*
  47. * IGEP2 Hardware Revision Table
  48. *
  49. * --------------------------------------------------------------------------
  50. * | Id. | Hw Rev. | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
  51. * --------------------------------------------------------------------------
  52. * | 0 | B | high | gpio94 | gpio95 | - |
  53. * | 0 | B/C (B-compatible) | high | gpio94 | gpio95 | gpio137 |
  54. * | 1 | C | low | gpio138 | gpio139 | gpio137 |
  55. * --------------------------------------------------------------------------
  56. */
  57. #define IGEP2_BOARD_HWREV_B 0
  58. #define IGEP2_BOARD_HWREV_C 1
  59. static u8 hwrev;
  60. static void __init igep2_get_revision(void)
  61. {
  62. u8 ret;
  63. omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
  64. if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) &&
  65. (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) {
  66. ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
  67. if (ret == 0) {
  68. pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
  69. hwrev = IGEP2_BOARD_HWREV_C;
  70. } else if (ret == 1) {
  71. pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
  72. hwrev = IGEP2_BOARD_HWREV_B;
  73. } else {
  74. pr_err("IGEP2: Unknown Hardware Revision\n");
  75. hwrev = -1;
  76. }
  77. } else {
  78. pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
  79. pr_err("IGEP2: Unknown Hardware Revision\n");
  80. }
  81. gpio_free(IGEP2_GPIO_LED1_RED);
  82. }
  83. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  84. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  85. #define ONENAND_MAP 0x20000000
  86. /* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
  87. * Since the device is equipped with two DataRAMs, and two-plane NAND
  88. * Flash memory array, these two component enables simultaneous program
  89. * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
  90. * while Plane2 has only odd blocks such as block1, block3, block5.
  91. * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
  92. */
  93. static struct mtd_partition igep2_onenand_partitions[] = {
  94. {
  95. .name = "X-Loader",
  96. .offset = 0,
  97. .size = 2 * (64*(2*2048))
  98. },
  99. {
  100. .name = "U-Boot",
  101. .offset = MTDPART_OFS_APPEND,
  102. .size = 6 * (64*(2*2048)),
  103. },
  104. {
  105. .name = "Environment",
  106. .offset = MTDPART_OFS_APPEND,
  107. .size = 2 * (64*(2*2048)),
  108. },
  109. {
  110. .name = "Kernel",
  111. .offset = MTDPART_OFS_APPEND,
  112. .size = 12 * (64*(2*2048)),
  113. },
  114. {
  115. .name = "File System",
  116. .offset = MTDPART_OFS_APPEND,
  117. .size = MTDPART_SIZ_FULL,
  118. },
  119. };
  120. static struct omap_onenand_platform_data igep2_onenand_data = {
  121. .parts = igep2_onenand_partitions,
  122. .nr_parts = ARRAY_SIZE(igep2_onenand_partitions),
  123. .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
  124. };
  125. static struct platform_device igep2_onenand_device = {
  126. .name = "omap2-onenand",
  127. .id = -1,
  128. .dev = {
  129. .platform_data = &igep2_onenand_data,
  130. },
  131. };
  132. static void __init igep2_flash_init(void)
  133. {
  134. u8 cs = 0;
  135. u8 onenandcs = GPMC_CS_NUM + 1;
  136. while (cs < GPMC_CS_NUM) {
  137. u32 ret = 0;
  138. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
  139. /* Check if NAND/oneNAND is configured */
  140. if ((ret & 0xC00) == 0x800)
  141. /* NAND found */
  142. pr_err("IGEP v2: Unsupported NAND found\n");
  143. else {
  144. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
  145. if ((ret & 0x3F) == (ONENAND_MAP >> 24))
  146. /* ONENAND found */
  147. onenandcs = cs;
  148. }
  149. cs++;
  150. }
  151. if (onenandcs > GPMC_CS_NUM) {
  152. pr_err("IGEP v2: Unable to find configuration in GPMC\n");
  153. return;
  154. }
  155. if (onenandcs < GPMC_CS_NUM) {
  156. igep2_onenand_data.cs = onenandcs;
  157. if (platform_device_register(&igep2_onenand_device) < 0)
  158. pr_err("IGEP v2: Unable to register OneNAND device\n");
  159. }
  160. }
  161. #else
  162. static void __init igep2_flash_init(void) {}
  163. #endif
  164. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  165. #include <linux/smsc911x.h>
  166. static struct smsc911x_platform_config igep2_smsc911x_config = {
  167. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  168. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  169. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS ,
  170. .phy_interface = PHY_INTERFACE_MODE_MII,
  171. };
  172. static struct resource igep2_smsc911x_resources[] = {
  173. {
  174. .flags = IORESOURCE_MEM,
  175. },
  176. {
  177. .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
  178. .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
  179. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  180. },
  181. };
  182. static struct platform_device igep2_smsc911x_device = {
  183. .name = "smsc911x",
  184. .id = 0,
  185. .num_resources = ARRAY_SIZE(igep2_smsc911x_resources),
  186. .resource = igep2_smsc911x_resources,
  187. .dev = {
  188. .platform_data = &igep2_smsc911x_config,
  189. },
  190. };
  191. static inline void __init igep2_init_smsc911x(void)
  192. {
  193. unsigned long cs_mem_base;
  194. if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
  195. pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n");
  196. gpmc_cs_free(IGEP2_SMSC911X_CS);
  197. return;
  198. }
  199. igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
  200. igep2_smsc911x_resources[0].end = cs_mem_base + 0xff;
  201. if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
  202. (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) {
  203. gpio_export(IGEP2_SMSC911X_GPIO, 0);
  204. } else {
  205. pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n");
  206. return;
  207. }
  208. platform_device_register(&igep2_smsc911x_device);
  209. }
  210. #else
  211. static inline void __init igep2_init_smsc911x(void) { }
  212. #endif
  213. static struct omap_board_config_kernel igep2_config[] __initdata = {
  214. };
  215. static struct regulator_consumer_supply igep2_vmmc1_supply = {
  216. .supply = "vmmc",
  217. };
  218. /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
  219. static struct regulator_init_data igep2_vmmc1 = {
  220. .constraints = {
  221. .min_uV = 1850000,
  222. .max_uV = 3150000,
  223. .valid_modes_mask = REGULATOR_MODE_NORMAL
  224. | REGULATOR_MODE_STANDBY,
  225. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  226. | REGULATOR_CHANGE_MODE
  227. | REGULATOR_CHANGE_STATUS,
  228. },
  229. .num_consumer_supplies = 1,
  230. .consumer_supplies = &igep2_vmmc1_supply,
  231. };
  232. static struct omap2_hsmmc_info mmc[] = {
  233. {
  234. .mmc = 1,
  235. .caps = MMC_CAP_4_BIT_DATA,
  236. .gpio_cd = -EINVAL,
  237. .gpio_wp = -EINVAL,
  238. },
  239. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  240. {
  241. .mmc = 2,
  242. .caps = MMC_CAP_4_BIT_DATA,
  243. .gpio_cd = -EINVAL,
  244. .gpio_wp = -EINVAL,
  245. },
  246. #endif
  247. {} /* Terminator */
  248. };
  249. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  250. #include <linux/leds.h>
  251. static struct gpio_led igep2_gpio_leds[] = {
  252. [0] = {
  253. .name = "gpio-led:red:d0",
  254. .gpio = IGEP2_GPIO_LED0_RED,
  255. .default_trigger = "default-off"
  256. },
  257. [1] = {
  258. .name = "gpio-led:green:d0",
  259. .gpio = IGEP2_GPIO_LED0_GREEN,
  260. .default_trigger = "default-off",
  261. },
  262. [2] = {
  263. .name = "gpio-led:red:d1",
  264. .gpio = IGEP2_GPIO_LED1_RED,
  265. .default_trigger = "default-off",
  266. },
  267. [3] = {
  268. .name = "gpio-led:green:d1",
  269. .default_trigger = "heartbeat",
  270. .gpio = -EINVAL, /* gets replaced */
  271. },
  272. };
  273. static struct gpio_led_platform_data igep2_led_pdata = {
  274. .leds = igep2_gpio_leds,
  275. .num_leds = ARRAY_SIZE(igep2_gpio_leds),
  276. };
  277. static struct platform_device igep2_led_device = {
  278. .name = "leds-gpio",
  279. .id = -1,
  280. .dev = {
  281. .platform_data = &igep2_led_pdata,
  282. },
  283. };
  284. static void __init igep2_leds_init(void)
  285. {
  286. platform_device_register(&igep2_led_device);
  287. }
  288. #else
  289. static inline void igep2_leds_init(void)
  290. {
  291. if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) &&
  292. (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) {
  293. gpio_export(IGEP2_GPIO_LED0_RED, 0);
  294. gpio_set_value(IGEP2_GPIO_LED0_RED, 0);
  295. } else
  296. pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
  297. if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) &&
  298. (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) {
  299. gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
  300. gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0);
  301. } else
  302. pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
  303. if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) &&
  304. (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) {
  305. gpio_export(IGEP2_GPIO_LED1_RED, 0);
  306. gpio_set_value(IGEP2_GPIO_LED1_RED, 0);
  307. } else
  308. pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
  309. }
  310. #endif
  311. static int igep2_twl_gpio_setup(struct device *dev,
  312. unsigned gpio, unsigned ngpio)
  313. {
  314. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  315. mmc[0].gpio_cd = gpio + 0;
  316. omap2_hsmmc_init(mmc);
  317. /*
  318. * link regulators to MMC adapters ... we "know" the
  319. * regulators will be set up only *after* we return.
  320. */
  321. igep2_vmmc1_supply.dev = mmc[0].dev;
  322. /*
  323. * REVISIT: need ehci-omap hooks for external VBUS
  324. * power switch and overcurrent detect
  325. */
  326. if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) ||
  327. (gpio_direction_input(gpio + 1) < 0))
  328. pr_err("IGEP2: Could not obtain gpio for EHCI NOC");
  329. /*
  330. * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN
  331. * (out, active low)
  332. */
  333. if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) ||
  334. (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0))
  335. pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
  336. /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
  337. #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
  338. if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0)
  339. && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) {
  340. gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
  341. gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0);
  342. } else
  343. pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n");
  344. #else
  345. igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
  346. #endif
  347. return 0;
  348. };
  349. static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = {
  350. .gpio_base = OMAP_MAX_GPIO_LINES,
  351. .irq_base = TWL4030_GPIO_IRQ_BASE,
  352. .irq_end = TWL4030_GPIO_IRQ_END,
  353. .use_leds = true,
  354. .setup = igep2_twl_gpio_setup,
  355. };
  356. static struct twl4030_usb_data igep2_usb_data = {
  357. .usb_mode = T2_USB_MODE_ULPI,
  358. };
  359. static int igep2_enable_dvi(struct omap_dss_device *dssdev)
  360. {
  361. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
  362. return 0;
  363. }
  364. static void igep2_disable_dvi(struct omap_dss_device *dssdev)
  365. {
  366. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
  367. }
  368. static struct omap_dss_device igep2_dvi_device = {
  369. .type = OMAP_DISPLAY_TYPE_DPI,
  370. .name = "dvi",
  371. .driver_name = "generic_panel",
  372. .phy.dpi.data_lines = 24,
  373. .platform_enable = igep2_enable_dvi,
  374. .platform_disable = igep2_disable_dvi,
  375. };
  376. static struct omap_dss_device *igep2_dss_devices[] = {
  377. &igep2_dvi_device
  378. };
  379. static struct omap_dss_board_info igep2_dss_data = {
  380. .num_devices = ARRAY_SIZE(igep2_dss_devices),
  381. .devices = igep2_dss_devices,
  382. .default_device = &igep2_dvi_device,
  383. };
  384. static struct platform_device igep2_dss_device = {
  385. .name = "omapdss",
  386. .id = -1,
  387. .dev = {
  388. .platform_data = &igep2_dss_data,
  389. },
  390. };
  391. static struct regulator_consumer_supply igep2_vpll2_supply = {
  392. .supply = "vdds_dsi",
  393. .dev = &igep2_dss_device.dev,
  394. };
  395. static struct regulator_init_data igep2_vpll2 = {
  396. .constraints = {
  397. .name = "VDVI",
  398. .min_uV = 1800000,
  399. .max_uV = 1800000,
  400. .apply_uV = true,
  401. .valid_modes_mask = REGULATOR_MODE_NORMAL
  402. | REGULATOR_MODE_STANDBY,
  403. .valid_ops_mask = REGULATOR_CHANGE_MODE
  404. | REGULATOR_CHANGE_STATUS,
  405. },
  406. .num_consumer_supplies = 1,
  407. .consumer_supplies = &igep2_vpll2_supply,
  408. };
  409. static void __init igep2_display_init(void)
  410. {
  411. if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") &&
  412. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1))
  413. pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
  414. }
  415. static struct platform_device *igep2_devices[] __initdata = {
  416. &igep2_dss_device,
  417. };
  418. static void __init igep2_init_irq(void)
  419. {
  420. omap_board_config = igep2_config;
  421. omap_board_config_size = ARRAY_SIZE(igep2_config);
  422. omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);
  423. omap_init_irq();
  424. omap_gpio_init();
  425. }
  426. static struct twl4030_codec_audio_data igep2_audio_data = {
  427. .audio_mclk = 26000000,
  428. };
  429. static struct twl4030_codec_data igep2_codec_data = {
  430. .audio_mclk = 26000000,
  431. .audio = &igep2_audio_data,
  432. };
  433. static struct twl4030_platform_data igep2_twldata = {
  434. .irq_base = TWL4030_IRQ_BASE,
  435. .irq_end = TWL4030_IRQ_END,
  436. /* platform_data for children goes here */
  437. .usb = &igep2_usb_data,
  438. .codec = &igep2_codec_data,
  439. .gpio = &igep2_twl4030_gpio_pdata,
  440. .vmmc1 = &igep2_vmmc1,
  441. .vpll2 = &igep2_vpll2,
  442. };
  443. static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
  444. {
  445. I2C_BOARD_INFO("twl4030", 0x48),
  446. .flags = I2C_CLIENT_WAKE,
  447. .irq = INT_34XX_SYS_NIRQ,
  448. .platform_data = &igep2_twldata,
  449. },
  450. };
  451. static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
  452. {
  453. I2C_BOARD_INFO("eeprom", 0x50),
  454. },
  455. };
  456. static void __init igep2_i2c_init(void)
  457. {
  458. int ret;
  459. ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo,
  460. ARRAY_SIZE(igep2_i2c1_boardinfo));
  461. if (ret)
  462. pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret);
  463. /*
  464. * Bus 3 is attached to the DVI port where devices like the pico DLP
  465. * projector don't work reliably with 400kHz
  466. */
  467. ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
  468. ARRAY_SIZE(igep2_i2c3_boardinfo));
  469. if (ret)
  470. pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
  471. }
  472. static struct omap_musb_board_data musb_board_data = {
  473. .interface_type = MUSB_INTERFACE_ULPI,
  474. .mode = MUSB_OTG,
  475. .power = 100,
  476. };
  477. static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
  478. .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
  479. .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  480. .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  481. .phy_reset = true,
  482. .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
  483. .reset_gpio_port[1] = -EINVAL,
  484. .reset_gpio_port[2] = -EINVAL,
  485. };
  486. #ifdef CONFIG_OMAP_MUX
  487. static struct omap_board_mux board_mux[] __initdata = {
  488. { .reg_offset = OMAP_MUX_TERMINATOR },
  489. };
  490. #else
  491. #define board_mux NULL
  492. #endif
  493. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  494. static void __init igep2_wlan_bt_init(void)
  495. {
  496. unsigned npd, wreset, btreset;
  497. /* GPIO's for WLAN-BT combo depends on hardware revision */
  498. if (hwrev == IGEP2_BOARD_HWREV_B) {
  499. npd = IGEP2_RB_GPIO_WIFI_NPD;
  500. wreset = IGEP2_RB_GPIO_WIFI_NRESET;
  501. btreset = IGEP2_RB_GPIO_BT_NRESET;
  502. } else if (hwrev == IGEP2_BOARD_HWREV_C) {
  503. npd = IGEP2_RC_GPIO_WIFI_NPD;
  504. wreset = IGEP2_RC_GPIO_WIFI_NRESET;
  505. btreset = IGEP2_RC_GPIO_BT_NRESET;
  506. } else
  507. return;
  508. /* Set GPIO's for WLAN-BT combo module */
  509. if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
  510. (gpio_direction_output(npd, 1) == 0)) {
  511. gpio_export(npd, 0);
  512. } else
  513. pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
  514. if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
  515. (gpio_direction_output(wreset, 1) == 0)) {
  516. gpio_export(wreset, 0);
  517. gpio_set_value(wreset, 0);
  518. udelay(10);
  519. gpio_set_value(wreset, 1);
  520. } else
  521. pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
  522. if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
  523. (gpio_direction_output(btreset, 1) == 0)) {
  524. gpio_export(btreset, 0);
  525. } else
  526. pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
  527. }
  528. #else
  529. static inline void __init igep2_wlan_bt_init(void) { }
  530. #endif
  531. static void __init igep2_init(void)
  532. {
  533. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  534. /* Get IGEP2 hardware revision */
  535. igep2_get_revision();
  536. /* Register I2C busses and drivers */
  537. igep2_i2c_init();
  538. platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
  539. omap_serial_init();
  540. usb_musb_init(&musb_board_data);
  541. usb_ehci_init(&ehci_pdata);
  542. igep2_flash_init();
  543. igep2_leds_init();
  544. igep2_display_init();
  545. igep2_init_smsc911x();
  546. /*
  547. * WLAN-BT combo module from MuRata wich has a Marvell WLAN
  548. * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
  549. */
  550. igep2_wlan_bt_init();
  551. }
  552. MACHINE_START(IGEP0020, "IGEP v2 board")
  553. .boot_params = 0x80000100,
  554. .map_io = omap3_map_io,
  555. .reserve = omap_reserve,
  556. .init_irq = igep2_init_irq,
  557. .init_machine = igep2_init,
  558. .timer = &omap_timer,
  559. MACHINE_END