board-omap3evm.c 21 KB

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