board-igep0020.c 18 KB

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