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