board-igep0020.c 18 KB

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