board-igep0020.c 18 KB

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