board-omap3evm.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. /*
  2. * linux/arch/arm/mach-omap2/board-omap3evm.c
  3. *
  4. * Copyright (C) 2008 Texas Instruments
  5. *
  6. * Modified from mach-omap2/board-3430sdp.c
  7. *
  8. * Initial code: Syed Mohammed Khasim
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/delay.h>
  18. #include <linux/err.h>
  19. #include <linux/clk.h>
  20. #include <linux/gpio.h>
  21. #include <linux/input.h>
  22. #include <linux/input/matrix_keypad.h>
  23. #include <linux/leds.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/mtd/mtd.h>
  26. #include <linux/mtd/partitions.h>
  27. #include <linux/mtd/nand.h>
  28. #include <linux/spi/spi.h>
  29. #include <linux/spi/ads7846.h>
  30. #include <linux/i2c/twl.h>
  31. #include <linux/usb/otg.h>
  32. #include <linux/usb/nop-usb-xceiv.h>
  33. #include <linux/smsc911x.h>
  34. #include <linux/wl12xx.h>
  35. #include <linux/regulator/fixed.h>
  36. #include <linux/regulator/machine.h>
  37. #include <linux/mmc/host.h>
  38. #include <linux/export.h>
  39. #include <asm/mach-types.h>
  40. #include <asm/mach/arch.h>
  41. #include <asm/mach/map.h>
  42. #include <plat/usb.h>
  43. #include <linux/platform_data/mtd-nand-omap2.h>
  44. #include "common.h"
  45. #include <linux/platform_data/spi-omap2-mcspi.h>
  46. #include <video/omapdss.h>
  47. #include <video/omap-panel-tfp410.h>
  48. #include "mux.h"
  49. #include "sdram-micron-mt46h32m32lf-6.h"
  50. #include "hsmmc.h"
  51. #include "common-board-devices.h"
  52. #define OMAP3_EVM_TS_GPIO 175
  53. #define OMAP3_EVM_EHCI_VBUS 22
  54. #define OMAP3_EVM_EHCI_SELECT 61
  55. #define OMAP3EVM_ETHR_START 0x2c000000
  56. #define OMAP3EVM_ETHR_SIZE 1024
  57. #define OMAP3EVM_ETHR_ID_REV 0x50
  58. #define OMAP3EVM_ETHR_GPIO_IRQ 176
  59. #define OMAP3EVM_SMSC911X_CS 5
  60. /*
  61. * Eth Reset signal
  62. * 64 = Generation 1 (<=RevD)
  63. * 7 = Generation 2 (>=RevE)
  64. */
  65. #define OMAP3EVM_GEN1_ETHR_GPIO_RST 64
  66. #define OMAP3EVM_GEN2_ETHR_GPIO_RST 7
  67. /*
  68. * OMAP35x EVM revision
  69. * Run time detection of EVM revision is done by reading Ethernet
  70. * PHY ID -
  71. * GEN_1 = 0x01150000
  72. * GEN_2 = 0x92200000
  73. */
  74. enum {
  75. OMAP3EVM_BOARD_GEN_1 = 0, /* EVM Rev between A - D */
  76. OMAP3EVM_BOARD_GEN_2, /* EVM Rev >= Rev E */
  77. };
  78. static u8 omap3_evm_version;
  79. static u8 get_omap3_evm_rev(void)
  80. {
  81. return omap3_evm_version;
  82. }
  83. static void __init omap3_evm_get_revision(void)
  84. {
  85. void __iomem *ioaddr;
  86. unsigned int smsc_id;
  87. /* Ethernet PHY ID is stored at ID_REV register */
  88. ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
  89. if (!ioaddr)
  90. return;
  91. smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
  92. iounmap(ioaddr);
  93. switch (smsc_id) {
  94. /*SMSC9115 chipset*/
  95. case 0x01150000:
  96. omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
  97. break;
  98. /*SMSC 9220 chipset*/
  99. case 0x92200000:
  100. default:
  101. omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
  102. }
  103. }
  104. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  105. #include "gpmc-smsc911x.h"
  106. static struct omap_smsc911x_platform_data smsc911x_cfg = {
  107. .cs = OMAP3EVM_SMSC911X_CS,
  108. .gpio_irq = OMAP3EVM_ETHR_GPIO_IRQ,
  109. .gpio_reset = -EINVAL,
  110. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
  111. };
  112. static inline void __init omap3evm_init_smsc911x(void)
  113. {
  114. /* Configure ethernet controller reset gpio */
  115. if (cpu_is_omap3430()) {
  116. if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
  117. smsc911x_cfg.gpio_reset = OMAP3EVM_GEN1_ETHR_GPIO_RST;
  118. else
  119. smsc911x_cfg.gpio_reset = OMAP3EVM_GEN2_ETHR_GPIO_RST;
  120. }
  121. gpmc_smsc911x_init(&smsc911x_cfg);
  122. }
  123. #else
  124. static inline void __init omap3evm_init_smsc911x(void) { return; }
  125. #endif
  126. /*
  127. * OMAP3EVM LCD Panel control signals
  128. */
  129. #define OMAP3EVM_LCD_PANEL_LR 2
  130. #define OMAP3EVM_LCD_PANEL_UD 3
  131. #define OMAP3EVM_LCD_PANEL_INI 152
  132. #define OMAP3EVM_LCD_PANEL_ENVDD 153
  133. #define OMAP3EVM_LCD_PANEL_QVGA 154
  134. #define OMAP3EVM_LCD_PANEL_RESB 155
  135. #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
  136. #define OMAP3EVM_DVI_PANEL_EN_GPIO 199
  137. static struct gpio omap3_evm_dss_gpios[] __initdata = {
  138. { OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "lcd_panel_resb" },
  139. { OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "lcd_panel_ini" },
  140. { OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "lcd_panel_qvga" },
  141. { OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "lcd_panel_lr" },
  142. { OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "lcd_panel_ud" },
  143. { OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, "lcd_panel_envdd" },
  144. };
  145. static int lcd_enabled;
  146. static int dvi_enabled;
  147. static void __init omap3_evm_display_init(void)
  148. {
  149. int r;
  150. r = gpio_request_array(omap3_evm_dss_gpios,
  151. ARRAY_SIZE(omap3_evm_dss_gpios));
  152. if (r)
  153. printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
  154. }
  155. static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
  156. {
  157. if (dvi_enabled) {
  158. printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
  159. return -EINVAL;
  160. }
  161. gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0);
  162. if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
  163. gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
  164. else
  165. gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
  166. lcd_enabled = 1;
  167. return 0;
  168. }
  169. static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev)
  170. {
  171. gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1);
  172. if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
  173. gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
  174. else
  175. gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
  176. lcd_enabled = 0;
  177. }
  178. static struct omap_dss_device omap3_evm_lcd_device = {
  179. .name = "lcd",
  180. .driver_name = "sharp_ls_panel",
  181. .type = OMAP_DISPLAY_TYPE_DPI,
  182. .phy.dpi.data_lines = 18,
  183. .platform_enable = omap3_evm_enable_lcd,
  184. .platform_disable = omap3_evm_disable_lcd,
  185. };
  186. static int omap3_evm_enable_tv(struct omap_dss_device *dssdev)
  187. {
  188. return 0;
  189. }
  190. static void omap3_evm_disable_tv(struct omap_dss_device *dssdev)
  191. {
  192. }
  193. static struct omap_dss_device omap3_evm_tv_device = {
  194. .name = "tv",
  195. .driver_name = "venc",
  196. .type = OMAP_DISPLAY_TYPE_VENC,
  197. .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
  198. .platform_enable = omap3_evm_enable_tv,
  199. .platform_disable = omap3_evm_disable_tv,
  200. };
  201. static struct tfp410_platform_data dvi_panel = {
  202. .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO,
  203. };
  204. static struct omap_dss_device omap3_evm_dvi_device = {
  205. .name = "dvi",
  206. .type = OMAP_DISPLAY_TYPE_DPI,
  207. .driver_name = "tfp410",
  208. .data = &dvi_panel,
  209. .phy.dpi.data_lines = 24,
  210. };
  211. static struct omap_dss_device *omap3_evm_dss_devices[] = {
  212. &omap3_evm_lcd_device,
  213. &omap3_evm_tv_device,
  214. &omap3_evm_dvi_device,
  215. };
  216. static struct omap_dss_board_info omap3_evm_dss_data = {
  217. .num_devices = ARRAY_SIZE(omap3_evm_dss_devices),
  218. .devices = omap3_evm_dss_devices,
  219. .default_device = &omap3_evm_lcd_device,
  220. };
  221. static struct regulator_consumer_supply omap3evm_vmmc1_supply[] = {
  222. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
  223. };
  224. static struct regulator_consumer_supply omap3evm_vsim_supply[] = {
  225. REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
  226. };
  227. /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
  228. static struct regulator_init_data omap3evm_vmmc1 = {
  229. .constraints = {
  230. .min_uV = 1850000,
  231. .max_uV = 3150000,
  232. .valid_modes_mask = REGULATOR_MODE_NORMAL
  233. | REGULATOR_MODE_STANDBY,
  234. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  235. | REGULATOR_CHANGE_MODE
  236. | REGULATOR_CHANGE_STATUS,
  237. },
  238. .num_consumer_supplies = ARRAY_SIZE(omap3evm_vmmc1_supply),
  239. .consumer_supplies = omap3evm_vmmc1_supply,
  240. };
  241. /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
  242. static struct regulator_init_data omap3evm_vsim = {
  243. .constraints = {
  244. .min_uV = 1800000,
  245. .max_uV = 3000000,
  246. .valid_modes_mask = REGULATOR_MODE_NORMAL
  247. | REGULATOR_MODE_STANDBY,
  248. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  249. | REGULATOR_CHANGE_MODE
  250. | REGULATOR_CHANGE_STATUS,
  251. },
  252. .num_consumer_supplies = ARRAY_SIZE(omap3evm_vsim_supply),
  253. .consumer_supplies = omap3evm_vsim_supply,
  254. };
  255. static struct omap2_hsmmc_info mmc[] = {
  256. {
  257. .mmc = 1,
  258. .caps = MMC_CAP_4_BIT_DATA,
  259. .gpio_cd = -EINVAL,
  260. .gpio_wp = 63,
  261. .deferred = true,
  262. },
  263. #ifdef CONFIG_WL12XX_PLATFORM_DATA
  264. {
  265. .name = "wl1271",
  266. .mmc = 2,
  267. .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
  268. .gpio_wp = -EINVAL,
  269. .gpio_cd = -EINVAL,
  270. .nonremovable = true,
  271. },
  272. #endif
  273. {} /* Terminator */
  274. };
  275. static struct gpio_led gpio_leds[] = {
  276. {
  277. .name = "omap3evm::ledb",
  278. /* normally not visible (board underside) */
  279. .default_trigger = "default-on",
  280. .gpio = -EINVAL, /* gets replaced */
  281. .active_low = true,
  282. },
  283. };
  284. static struct gpio_led_platform_data gpio_led_info = {
  285. .leds = gpio_leds,
  286. .num_leds = ARRAY_SIZE(gpio_leds),
  287. };
  288. static struct platform_device leds_gpio = {
  289. .name = "leds-gpio",
  290. .id = -1,
  291. .dev = {
  292. .platform_data = &gpio_led_info,
  293. },
  294. };
  295. static int omap3evm_twl_gpio_setup(struct device *dev,
  296. unsigned gpio, unsigned ngpio)
  297. {
  298. int r, lcd_bl_en;
  299. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  300. mmc[0].gpio_cd = gpio + 0;
  301. omap_hsmmc_late_init(mmc);
  302. /*
  303. * Most GPIOs are for USB OTG. Some are mostly sent to
  304. * the P2 connector; notably LEDA for the LCD backlight.
  305. */
  306. /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
  307. lcd_bl_en = get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2 ?
  308. GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
  309. r = gpio_request_one(gpio + TWL4030_GPIO_MAX, lcd_bl_en, "EN_LCD_BKL");
  310. if (r)
  311. printk(KERN_ERR "failed to get/set lcd_bkl gpio\n");
  312. /* gpio + 7 == DVI Enable */
  313. gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
  314. /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
  315. gpio_leds[0].gpio = gpio + TWL4030_GPIO_MAX + 1;
  316. platform_device_register(&leds_gpio);
  317. /* Enable VBUS switch by setting TWL4030.GPIO2DIR as output
  318. * for starting USB tranceiver
  319. */
  320. #ifdef CONFIG_TWL4030_CORE
  321. if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
  322. u8 val;
  323. twl_i2c_read_u8(TWL4030_MODULE_GPIO, &val, REG_GPIODATADIR1);
  324. val |= 0x04; /* TWL4030.GPIO2DIR BIT at GPIODATADIR1(0x9B) */
  325. twl_i2c_write_u8(TWL4030_MODULE_GPIO, val, REG_GPIODATADIR1);
  326. }
  327. #endif
  328. return 0;
  329. }
  330. static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
  331. .use_leds = true,
  332. .setup = omap3evm_twl_gpio_setup,
  333. };
  334. static uint32_t board_keymap[] = {
  335. KEY(0, 0, KEY_LEFT),
  336. KEY(0, 1, KEY_DOWN),
  337. KEY(0, 2, KEY_ENTER),
  338. KEY(0, 3, KEY_M),
  339. KEY(1, 0, KEY_RIGHT),
  340. KEY(1, 1, KEY_UP),
  341. KEY(1, 2, KEY_I),
  342. KEY(1, 3, KEY_N),
  343. KEY(2, 0, KEY_A),
  344. KEY(2, 1, KEY_E),
  345. KEY(2, 2, KEY_J),
  346. KEY(2, 3, KEY_O),
  347. KEY(3, 0, KEY_B),
  348. KEY(3, 1, KEY_F),
  349. KEY(3, 2, KEY_K),
  350. KEY(3, 3, KEY_P)
  351. };
  352. static struct matrix_keymap_data board_map_data = {
  353. .keymap = board_keymap,
  354. .keymap_size = ARRAY_SIZE(board_keymap),
  355. };
  356. static struct twl4030_keypad_data omap3evm_kp_data = {
  357. .keymap_data = &board_map_data,
  358. .rows = 4,
  359. .cols = 4,
  360. .rep = 1,
  361. };
  362. /* ads7846 on SPI */
  363. static struct regulator_consumer_supply omap3evm_vio_supply[] = {
  364. REGULATOR_SUPPLY("vcc", "spi1.0"),
  365. };
  366. /* VIO for ads7846 */
  367. static struct regulator_init_data omap3evm_vio = {
  368. .constraints = {
  369. .min_uV = 1800000,
  370. .max_uV = 1800000,
  371. .apply_uV = true,
  372. .valid_modes_mask = REGULATOR_MODE_NORMAL
  373. | REGULATOR_MODE_STANDBY,
  374. .valid_ops_mask = REGULATOR_CHANGE_MODE
  375. | REGULATOR_CHANGE_STATUS,
  376. },
  377. .num_consumer_supplies = ARRAY_SIZE(omap3evm_vio_supply),
  378. .consumer_supplies = omap3evm_vio_supply,
  379. };
  380. #ifdef CONFIG_WL12XX_PLATFORM_DATA
  381. #define OMAP3EVM_WLAN_PMENA_GPIO (150)
  382. #define OMAP3EVM_WLAN_IRQ_GPIO (149)
  383. static struct regulator_consumer_supply omap3evm_vmmc2_supply[] = {
  384. REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
  385. };
  386. /* VMMC2 for driving the WL12xx module */
  387. static struct regulator_init_data omap3evm_vmmc2 = {
  388. .constraints = {
  389. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  390. },
  391. .num_consumer_supplies = ARRAY_SIZE(omap3evm_vmmc2_supply),
  392. .consumer_supplies = omap3evm_vmmc2_supply,
  393. };
  394. static struct fixed_voltage_config omap3evm_vwlan = {
  395. .supply_name = "vwl1271",
  396. .microvolts = 1800000, /* 1.80V */
  397. .gpio = OMAP3EVM_WLAN_PMENA_GPIO,
  398. .startup_delay = 70000, /* 70ms */
  399. .enable_high = 1,
  400. .enabled_at_boot = 0,
  401. .init_data = &omap3evm_vmmc2,
  402. };
  403. static struct platform_device omap3evm_wlan_regulator = {
  404. .name = "reg-fixed-voltage",
  405. .id = 1,
  406. .dev = {
  407. .platform_data = &omap3evm_vwlan,
  408. },
  409. };
  410. struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
  411. .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
  412. };
  413. #endif
  414. /* VAUX2 for USB */
  415. static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = {
  416. REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */
  417. REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */
  418. REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
  419. REGULATOR_SUPPLY("vaux2", NULL),
  420. };
  421. static struct regulator_init_data omap3evm_vaux2 = {
  422. .constraints = {
  423. .min_uV = 2800000,
  424. .max_uV = 2800000,
  425. .apply_uV = true,
  426. .valid_modes_mask = REGULATOR_MODE_NORMAL
  427. | REGULATOR_MODE_STANDBY,
  428. .valid_ops_mask = REGULATOR_CHANGE_MODE
  429. | REGULATOR_CHANGE_STATUS,
  430. },
  431. .num_consumer_supplies = ARRAY_SIZE(omap3evm_vaux2_supplies),
  432. .consumer_supplies = omap3evm_vaux2_supplies,
  433. };
  434. static struct twl4030_platform_data omap3evm_twldata = {
  435. /* platform_data for children goes here */
  436. .keypad = &omap3evm_kp_data,
  437. .gpio = &omap3evm_gpio_data,
  438. .vio = &omap3evm_vio,
  439. .vmmc1 = &omap3evm_vmmc1,
  440. .vsim = &omap3evm_vsim,
  441. };
  442. static int __init omap3_evm_i2c_init(void)
  443. {
  444. omap3_pmic_get_config(&omap3evm_twldata,
  445. TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC |
  446. TWL_COMMON_PDATA_AUDIO,
  447. TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
  448. omap3evm_twldata.vdac->constraints.apply_uV = true;
  449. omap3evm_twldata.vpll2->constraints.apply_uV = true;
  450. omap3_pmic_init("twl4030", &omap3evm_twldata);
  451. omap_register_i2c_bus(2, 400, NULL, 0);
  452. omap_register_i2c_bus(3, 400, NULL, 0);
  453. return 0;
  454. }
  455. static struct usbhs_omap_board_data usbhs_bdata __initdata = {
  456. .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
  457. .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
  458. .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
  459. .phy_reset = true,
  460. /* PHY reset GPIO will be runtime programmed based on EVM version */
  461. .reset_gpio_port[0] = -EINVAL,
  462. .reset_gpio_port[1] = -EINVAL,
  463. .reset_gpio_port[2] = -EINVAL
  464. };
  465. #ifdef CONFIG_OMAP_MUX
  466. static struct omap_board_mux omap35x_board_mux[] __initdata = {
  467. OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
  468. OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
  469. OMAP_PIN_OFF_WAKEUPENABLE),
  470. OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
  471. OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
  472. OMAP_PIN_OFF_WAKEUPENABLE),
  473. OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
  474. OMAP_PIN_OFF_NONE),
  475. OMAP3_MUX(GPMC_WAIT2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
  476. OMAP_PIN_OFF_NONE),
  477. #ifdef CONFIG_WL12XX_PLATFORM_DATA
  478. /* WLAN IRQ - GPIO 149 */
  479. OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
  480. /* WLAN POWER ENABLE - GPIO 150 */
  481. OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  482. /* MMC2 SDIO pin muxes for WL12xx */
  483. OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  484. OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  485. OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  486. OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  487. OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  488. OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  489. #endif
  490. { .reg_offset = OMAP_MUX_TERMINATOR },
  491. };
  492. static struct omap_board_mux omap36x_board_mux[] __initdata = {
  493. OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
  494. OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
  495. OMAP_PIN_OFF_WAKEUPENABLE),
  496. OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
  497. OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
  498. OMAP_PIN_OFF_WAKEUPENABLE),
  499. /* AM/DM37x EVM: DSS data bus muxed with sys_boot */
  500. OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  501. OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  502. OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  503. OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  504. OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  505. OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  506. OMAP3_MUX(SYS_BOOT0, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  507. OMAP3_MUX(SYS_BOOT1, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  508. OMAP3_MUX(SYS_BOOT3, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  509. OMAP3_MUX(SYS_BOOT4, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  510. OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  511. OMAP3_MUX(SYS_BOOT6, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
  512. #ifdef CONFIG_WL12XX_PLATFORM_DATA
  513. /* WLAN IRQ - GPIO 149 */
  514. OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
  515. /* WLAN POWER ENABLE - GPIO 150 */
  516. OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
  517. /* MMC2 SDIO pin muxes for WL12xx */
  518. OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  519. OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  520. OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  521. OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  522. OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  523. OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
  524. #endif
  525. { .reg_offset = OMAP_MUX_TERMINATOR },
  526. };
  527. #else
  528. #define omap35x_board_mux NULL
  529. #define omap36x_board_mux NULL
  530. #endif
  531. static struct omap_musb_board_data musb_board_data = {
  532. .interface_type = MUSB_INTERFACE_ULPI,
  533. .mode = MUSB_OTG,
  534. .power = 100,
  535. };
  536. static struct gpio omap3_evm_ehci_gpios[] __initdata = {
  537. { OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_HIGH, "enable EHCI VBUS" },
  538. { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" },
  539. };
  540. static void __init omap3_evm_wl12xx_init(void)
  541. {
  542. #ifdef CONFIG_WL12XX_PLATFORM_DATA
  543. int ret;
  544. /* WL12xx WLAN Init */
  545. omap3evm_wlan_data.irq = gpio_to_irq(OMAP3EVM_WLAN_IRQ_GPIO);
  546. ret = wl12xx_set_platform_data(&omap3evm_wlan_data);
  547. if (ret)
  548. pr_err("error setting wl12xx data: %d\n", ret);
  549. ret = platform_device_register(&omap3evm_wlan_regulator);
  550. if (ret)
  551. pr_err("error registering wl12xx device: %d\n", ret);
  552. #endif
  553. }
  554. static struct regulator_consumer_supply dummy_supplies[] = {
  555. REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
  556. REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
  557. };
  558. static struct mtd_partition omap3evm_nand_partitions[] = {
  559. /* All the partition sizes are listed in terms of NAND block size */
  560. {
  561. .name = "X-Loader",
  562. .offset = 0,
  563. .size = 4*(SZ_128K),
  564. .mask_flags = MTD_WRITEABLE
  565. },
  566. {
  567. .name = "U-Boot",
  568. .offset = MTDPART_OFS_APPEND,
  569. .size = 14*(SZ_128K),
  570. .mask_flags = MTD_WRITEABLE
  571. },
  572. {
  573. .name = "U-Boot Env",
  574. .offset = MTDPART_OFS_APPEND,
  575. .size = 2*(SZ_128K)
  576. },
  577. {
  578. .name = "Kernel",
  579. .offset = MTDPART_OFS_APPEND,
  580. .size = 40*(SZ_128K)
  581. },
  582. {
  583. .name = "File system",
  584. .size = MTDPART_SIZ_FULL,
  585. .offset = MTDPART_OFS_APPEND,
  586. },
  587. };
  588. static void __init omap3_evm_init(void)
  589. {
  590. struct omap_board_mux *obm;
  591. omap3_evm_get_revision();
  592. regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
  593. obm = (cpu_is_omap3630()) ? omap36x_board_mux : omap35x_board_mux;
  594. omap3_mux_init(obm, OMAP_PACKAGE_CBB);
  595. omap_mux_init_gpio(63, OMAP_PIN_INPUT);
  596. omap_hsmmc_init(mmc);
  597. if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
  598. omap3evm_twldata.vaux2 = &omap3evm_vaux2;
  599. omap3_evm_i2c_init();
  600. omap_display_init(&omap3_evm_dss_data);
  601. omap_serial_init();
  602. omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
  603. /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
  604. usb_nop_xceiv_register();
  605. if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
  606. /* enable EHCI VBUS using GPIO22 */
  607. omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP);
  608. /* Select EHCI port on main board */
  609. omap_mux_init_gpio(OMAP3_EVM_EHCI_SELECT,
  610. OMAP_PIN_INPUT_PULLUP);
  611. gpio_request_array(omap3_evm_ehci_gpios,
  612. ARRAY_SIZE(omap3_evm_ehci_gpios));
  613. /* setup EHCI phy reset config */
  614. omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
  615. usbhs_bdata.reset_gpio_port[1] = 21;
  616. /* EVM REV >= E can supply 500mA with EXTVBUS programming */
  617. musb_board_data.power = 500;
  618. musb_board_data.extvbus = 1;
  619. } else {
  620. /* setup EHCI phy reset on MDC */
  621. omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
  622. usbhs_bdata.reset_gpio_port[1] = 135;
  623. }
  624. usb_musb_init(&musb_board_data);
  625. usbhs_init(&usbhs_bdata);
  626. omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions,
  627. ARRAY_SIZE(omap3evm_nand_partitions));
  628. omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
  629. omap3evm_init_smsc911x();
  630. omap3_evm_display_init();
  631. omap3_evm_wl12xx_init();
  632. omap_twl4030_audio_init("omap3evm");
  633. }
  634. MACHINE_START(OMAP3EVM, "OMAP3 EVM")
  635. /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
  636. .atag_offset = 0x100,
  637. .reserve = omap_reserve,
  638. .map_io = omap3_map_io,
  639. .init_early = omap35xx_init_early,
  640. .init_irq = omap3_init_irq,
  641. .handle_irq = omap3_intc_handle_irq,
  642. .init_machine = omap3_evm_init,
  643. .init_late = omap35xx_init_late,
  644. .timer = &omap3_timer,
  645. .restart = omap_prcm_restart,
  646. MACHINE_END