board-igep0020.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  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", "mmci-omap-hs.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", "mmci-omap-hs.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", "mmci-omap-hs.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 platform_device igep2_dss_device = {
  418. .name = "omapdss",
  419. .id = -1,
  420. .dev = {
  421. .platform_data = &igep2_dss_data,
  422. },
  423. };
  424. static struct regulator_consumer_supply igep2_vpll2_supply = {
  425. .supply = "vdds_dsi",
  426. .dev = &igep2_dss_device.dev,
  427. };
  428. static struct regulator_init_data igep2_vpll2 = {
  429. .constraints = {
  430. .name = "VDVI",
  431. .min_uV = 1800000,
  432. .max_uV = 1800000,
  433. .apply_uV = true,
  434. .valid_modes_mask = REGULATOR_MODE_NORMAL
  435. | REGULATOR_MODE_STANDBY,
  436. .valid_ops_mask = REGULATOR_CHANGE_MODE
  437. | REGULATOR_CHANGE_STATUS,
  438. },
  439. .num_consumer_supplies = 1,
  440. .consumer_supplies = &igep2_vpll2_supply,
  441. };
  442. static void __init igep2_display_init(void)
  443. {
  444. if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") &&
  445. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1))
  446. pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
  447. }
  448. static struct platform_device *igep2_devices[] __initdata = {
  449. &igep2_dss_device,
  450. &igep2_vwlan_device,
  451. };
  452. static void __init igep2_init_irq(void)
  453. {
  454. omap2_init_common_infrastructure();
  455. omap2_init_common_devices(m65kxxxxam_sdrc_params,
  456. m65kxxxxam_sdrc_params);
  457. omap_init_irq();
  458. }
  459. static struct twl4030_codec_audio_data igep2_audio_data = {
  460. .audio_mclk = 26000000,
  461. };
  462. static struct twl4030_codec_data igep2_codec_data = {
  463. .audio_mclk = 26000000,
  464. .audio = &igep2_audio_data,
  465. };
  466. static int igep2_keymap[] = {
  467. KEY(0, 0, KEY_LEFT),
  468. KEY(0, 1, KEY_RIGHT),
  469. KEY(0, 2, KEY_A),
  470. KEY(0, 3, KEY_B),
  471. KEY(1, 0, KEY_DOWN),
  472. KEY(1, 1, KEY_UP),
  473. KEY(1, 2, KEY_E),
  474. KEY(1, 3, KEY_F),
  475. KEY(2, 0, KEY_ENTER),
  476. KEY(2, 1, KEY_I),
  477. KEY(2, 2, KEY_J),
  478. KEY(2, 3, KEY_K),
  479. KEY(3, 0, KEY_M),
  480. KEY(3, 1, KEY_N),
  481. KEY(3, 2, KEY_O),
  482. KEY(3, 3, KEY_P)
  483. };
  484. static struct matrix_keymap_data igep2_keymap_data = {
  485. .keymap = igep2_keymap,
  486. .keymap_size = ARRAY_SIZE(igep2_keymap),
  487. };
  488. static struct twl4030_keypad_data igep2_keypad_pdata = {
  489. .keymap_data = &igep2_keymap_data,
  490. .rows = 4,
  491. .cols = 4,
  492. .rep = 1,
  493. };
  494. static struct twl4030_platform_data igep2_twldata = {
  495. .irq_base = TWL4030_IRQ_BASE,
  496. .irq_end = TWL4030_IRQ_END,
  497. /* platform_data for children goes here */
  498. .usb = &igep2_usb_data,
  499. .codec = &igep2_codec_data,
  500. .gpio = &igep2_twl4030_gpio_pdata,
  501. .keypad = &igep2_keypad_pdata,
  502. .vmmc1 = &igep2_vmmc1,
  503. .vpll2 = &igep2_vpll2,
  504. .vio = &igep2_vio,
  505. };
  506. static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
  507. {
  508. I2C_BOARD_INFO("twl4030", 0x48),
  509. .flags = I2C_CLIENT_WAKE,
  510. .irq = INT_34XX_SYS_NIRQ,
  511. .platform_data = &igep2_twldata,
  512. },
  513. };
  514. static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
  515. {
  516. I2C_BOARD_INFO("eeprom", 0x50),
  517. },
  518. };
  519. static void __init igep2_i2c_init(void)
  520. {
  521. int ret;
  522. ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo,
  523. ARRAY_SIZE(igep2_i2c1_boardinfo));
  524. if (ret)
  525. pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret);
  526. /*
  527. * Bus 3 is attached to the DVI port where devices like the pico DLP
  528. * projector don't work reliably with 400kHz
  529. */
  530. ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
  531. ARRAY_SIZE(igep2_i2c3_boardinfo));
  532. if (ret)
  533. pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
  534. }
  535. static struct omap_musb_board_data musb_board_data = {
  536. .interface_type = MUSB_INTERFACE_ULPI,
  537. .mode = MUSB_OTG,
  538. .power = 100,
  539. };
  540. static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
  541. .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
  542. .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  543. .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  544. .phy_reset = true,
  545. .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
  546. .reset_gpio_port[1] = -EINVAL,
  547. .reset_gpio_port[2] = -EINVAL,
  548. };
  549. #ifdef CONFIG_OMAP_MUX
  550. static struct omap_board_mux board_mux[] __initdata = {
  551. { .reg_offset = OMAP_MUX_TERMINATOR },
  552. };
  553. #endif
  554. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  555. static void __init igep2_wlan_bt_init(void)
  556. {
  557. unsigned npd, wreset, btreset;
  558. /* GPIO's for WLAN-BT combo depends on hardware revision */
  559. if (hwrev == IGEP2_BOARD_HWREV_B) {
  560. npd = IGEP2_RB_GPIO_WIFI_NPD;
  561. wreset = IGEP2_RB_GPIO_WIFI_NRESET;
  562. btreset = IGEP2_RB_GPIO_BT_NRESET;
  563. } else if (hwrev == IGEP2_BOARD_HWREV_C) {
  564. npd = IGEP2_RC_GPIO_WIFI_NPD;
  565. wreset = IGEP2_RC_GPIO_WIFI_NRESET;
  566. btreset = IGEP2_RC_GPIO_BT_NRESET;
  567. } else
  568. return;
  569. /* Set GPIO's for WLAN-BT combo module */
  570. if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
  571. (gpio_direction_output(npd, 1) == 0)) {
  572. gpio_export(npd, 0);
  573. } else
  574. pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
  575. if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
  576. (gpio_direction_output(wreset, 1) == 0)) {
  577. gpio_export(wreset, 0);
  578. gpio_set_value(wreset, 0);
  579. udelay(10);
  580. gpio_set_value(wreset, 1);
  581. } else
  582. pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
  583. if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
  584. (gpio_direction_output(btreset, 1) == 0)) {
  585. gpio_export(btreset, 0);
  586. } else
  587. pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
  588. }
  589. #else
  590. static inline void __init igep2_wlan_bt_init(void) { }
  591. #endif
  592. static void __init igep2_init(void)
  593. {
  594. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  595. /* Get IGEP2 hardware revision */
  596. igep2_get_revision();
  597. /* Register I2C busses and drivers */
  598. igep2_i2c_init();
  599. platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
  600. omap_serial_init();
  601. usb_musb_init(&musb_board_data);
  602. usb_ehci_init(&ehci_pdata);
  603. igep2_flash_init();
  604. igep2_leds_init();
  605. igep2_display_init();
  606. igep2_init_smsc911x();
  607. /*
  608. * WLAN-BT combo module from MuRata wich has a Marvell WLAN
  609. * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
  610. */
  611. igep2_wlan_bt_init();
  612. }
  613. MACHINE_START(IGEP0020, "IGEP v2 board")
  614. .boot_params = 0x80000100,
  615. .map_io = omap3_map_io,
  616. .reserve = omap_reserve,
  617. .init_irq = igep2_init_irq,
  618. .init_machine = igep2_init,
  619. .timer = &omap_timer,
  620. MACHINE_END