board-omap3evm.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  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/spi/spi.h>
  26. #include <linux/spi/ads7846.h>
  27. #include <linux/i2c/twl.h>
  28. #include <linux/usb/otg.h>
  29. #include <linux/smsc911x.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/mmc/host.h>
  32. #include <mach/hardware.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/map.h>
  36. #include <plat/board.h>
  37. #include <plat/usb.h>
  38. #include <plat/common.h>
  39. #include <plat/mcspi.h>
  40. #include <plat/display.h>
  41. #include "mux.h"
  42. #include "sdram-micron-mt46h32m32lf-6.h"
  43. #include "hsmmc.h"
  44. #define OMAP3_EVM_TS_GPIO 175
  45. #define OMAP3_EVM_EHCI_VBUS 22
  46. #define OMAP3_EVM_EHCI_SELECT 61
  47. #define OMAP3EVM_ETHR_START 0x2c000000
  48. #define OMAP3EVM_ETHR_SIZE 1024
  49. #define OMAP3EVM_ETHR_ID_REV 0x50
  50. #define OMAP3EVM_ETHR_GPIO_IRQ 176
  51. #define OMAP3EVM_SMSC911X_CS 5
  52. static u8 omap3_evm_version;
  53. u8 get_omap3_evm_rev(void)
  54. {
  55. return omap3_evm_version;
  56. }
  57. EXPORT_SYMBOL(get_omap3_evm_rev);
  58. static void __init omap3_evm_get_revision(void)
  59. {
  60. void __iomem *ioaddr;
  61. unsigned int smsc_id;
  62. /* Ethernet PHY ID is stored at ID_REV register */
  63. ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
  64. if (!ioaddr)
  65. return;
  66. smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
  67. iounmap(ioaddr);
  68. switch (smsc_id) {
  69. /*SMSC9115 chipset*/
  70. case 0x01150000:
  71. omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
  72. break;
  73. /*SMSC 9220 chipset*/
  74. case 0x92200000:
  75. default:
  76. omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
  77. }
  78. }
  79. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  80. static struct resource omap3evm_smsc911x_resources[] = {
  81. [0] = {
  82. .start = OMAP3EVM_ETHR_START,
  83. .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
  84. .flags = IORESOURCE_MEM,
  85. },
  86. [1] = {
  87. .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
  88. .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
  89. .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
  90. },
  91. };
  92. static struct smsc911x_platform_config smsc911x_config = {
  93. .phy_interface = PHY_INTERFACE_MODE_MII,
  94. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  95. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  96. .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
  97. };
  98. static struct platform_device omap3evm_smsc911x_device = {
  99. .name = "smsc911x",
  100. .id = -1,
  101. .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources),
  102. .resource = &omap3evm_smsc911x_resources[0],
  103. .dev = {
  104. .platform_data = &smsc911x_config,
  105. },
  106. };
  107. static inline void __init omap3evm_init_smsc911x(void)
  108. {
  109. int eth_cs;
  110. struct clk *l3ck;
  111. unsigned int rate;
  112. eth_cs = OMAP3EVM_SMSC911X_CS;
  113. l3ck = clk_get(NULL, "l3_ck");
  114. if (IS_ERR(l3ck))
  115. rate = 100000000;
  116. else
  117. rate = clk_get_rate(l3ck);
  118. if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
  119. printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
  120. OMAP3EVM_ETHR_GPIO_IRQ);
  121. return;
  122. }
  123. gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
  124. platform_device_register(&omap3evm_smsc911x_device);
  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 int lcd_enabled;
  141. static int dvi_enabled;
  142. static void __init omap3_evm_display_init(void)
  143. {
  144. int r;
  145. r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb");
  146. if (r) {
  147. printk(KERN_ERR "failed to get lcd_panel_resb\n");
  148. return;
  149. }
  150. gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
  151. r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
  152. if (r) {
  153. printk(KERN_ERR "failed to get lcd_panel_ini\n");
  154. goto err_1;
  155. }
  156. gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
  157. r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
  158. if (r) {
  159. printk(KERN_ERR "failed to get lcd_panel_qvga\n");
  160. goto err_2;
  161. }
  162. gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
  163. r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
  164. if (r) {
  165. printk(KERN_ERR "failed to get lcd_panel_lr\n");
  166. goto err_3;
  167. }
  168. gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
  169. r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
  170. if (r) {
  171. printk(KERN_ERR "failed to get lcd_panel_ud\n");
  172. goto err_4;
  173. }
  174. gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
  175. r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
  176. if (r) {
  177. printk(KERN_ERR "failed to get lcd_panel_envdd\n");
  178. goto err_5;
  179. }
  180. gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
  181. return;
  182. err_5:
  183. gpio_free(OMAP3EVM_LCD_PANEL_UD);
  184. err_4:
  185. gpio_free(OMAP3EVM_LCD_PANEL_LR);
  186. err_3:
  187. gpio_free(OMAP3EVM_LCD_PANEL_QVGA);
  188. err_2:
  189. gpio_free(OMAP3EVM_LCD_PANEL_INI);
  190. err_1:
  191. gpio_free(OMAP3EVM_LCD_PANEL_RESB);
  192. }
  193. static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
  194. {
  195. if (dvi_enabled) {
  196. printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
  197. return -EINVAL;
  198. }
  199. gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0);
  200. if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
  201. gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
  202. else
  203. gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
  204. lcd_enabled = 1;
  205. return 0;
  206. }
  207. static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev)
  208. {
  209. gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1);
  210. if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
  211. gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
  212. else
  213. gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
  214. lcd_enabled = 0;
  215. }
  216. static struct omap_dss_device omap3_evm_lcd_device = {
  217. .name = "lcd",
  218. .driver_name = "sharp_ls_panel",
  219. .type = OMAP_DISPLAY_TYPE_DPI,
  220. .phy.dpi.data_lines = 18,
  221. .platform_enable = omap3_evm_enable_lcd,
  222. .platform_disable = omap3_evm_disable_lcd,
  223. };
  224. static int omap3_evm_enable_tv(struct omap_dss_device *dssdev)
  225. {
  226. return 0;
  227. }
  228. static void omap3_evm_disable_tv(struct omap_dss_device *dssdev)
  229. {
  230. }
  231. static struct omap_dss_device omap3_evm_tv_device = {
  232. .name = "tv",
  233. .driver_name = "venc",
  234. .type = OMAP_DISPLAY_TYPE_VENC,
  235. .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
  236. .platform_enable = omap3_evm_enable_tv,
  237. .platform_disable = omap3_evm_disable_tv,
  238. };
  239. static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev)
  240. {
  241. if (lcd_enabled) {
  242. printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
  243. return -EINVAL;
  244. }
  245. gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 1);
  246. dvi_enabled = 1;
  247. return 0;
  248. }
  249. static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev)
  250. {
  251. gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 0);
  252. dvi_enabled = 0;
  253. }
  254. static struct omap_dss_device omap3_evm_dvi_device = {
  255. .name = "dvi",
  256. .driver_name = "generic_panel",
  257. .type = OMAP_DISPLAY_TYPE_DPI,
  258. .phy.dpi.data_lines = 24,
  259. .platform_enable = omap3_evm_enable_dvi,
  260. .platform_disable = omap3_evm_disable_dvi,
  261. };
  262. static struct omap_dss_device *omap3_evm_dss_devices[] = {
  263. &omap3_evm_lcd_device,
  264. &omap3_evm_tv_device,
  265. &omap3_evm_dvi_device,
  266. };
  267. static struct omap_dss_board_info omap3_evm_dss_data = {
  268. .num_devices = ARRAY_SIZE(omap3_evm_dss_devices),
  269. .devices = omap3_evm_dss_devices,
  270. .default_device = &omap3_evm_lcd_device,
  271. };
  272. static struct platform_device omap3_evm_dss_device = {
  273. .name = "omapdss",
  274. .id = -1,
  275. .dev = {
  276. .platform_data = &omap3_evm_dss_data,
  277. },
  278. };
  279. static struct regulator_consumer_supply omap3evm_vmmc1_supply = {
  280. .supply = "vmmc",
  281. };
  282. static struct regulator_consumer_supply omap3evm_vsim_supply = {
  283. .supply = "vmmc_aux",
  284. };
  285. /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
  286. static struct regulator_init_data omap3evm_vmmc1 = {
  287. .constraints = {
  288. .min_uV = 1850000,
  289. .max_uV = 3150000,
  290. .valid_modes_mask = REGULATOR_MODE_NORMAL
  291. | REGULATOR_MODE_STANDBY,
  292. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  293. | REGULATOR_CHANGE_MODE
  294. | REGULATOR_CHANGE_STATUS,
  295. },
  296. .num_consumer_supplies = 1,
  297. .consumer_supplies = &omap3evm_vmmc1_supply,
  298. };
  299. /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
  300. static struct regulator_init_data omap3evm_vsim = {
  301. .constraints = {
  302. .min_uV = 1800000,
  303. .max_uV = 3000000,
  304. .valid_modes_mask = REGULATOR_MODE_NORMAL
  305. | REGULATOR_MODE_STANDBY,
  306. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  307. | REGULATOR_CHANGE_MODE
  308. | REGULATOR_CHANGE_STATUS,
  309. },
  310. .num_consumer_supplies = 1,
  311. .consumer_supplies = &omap3evm_vsim_supply,
  312. };
  313. static struct omap2_hsmmc_info mmc[] = {
  314. {
  315. .mmc = 1,
  316. .caps = MMC_CAP_4_BIT_DATA,
  317. .gpio_cd = -EINVAL,
  318. .gpio_wp = 63,
  319. },
  320. {} /* Terminator */
  321. };
  322. static struct gpio_led gpio_leds[] = {
  323. {
  324. .name = "omap3evm::ledb",
  325. /* normally not visible (board underside) */
  326. .default_trigger = "default-on",
  327. .gpio = -EINVAL, /* gets replaced */
  328. .active_low = true,
  329. },
  330. };
  331. static struct gpio_led_platform_data gpio_led_info = {
  332. .leds = gpio_leds,
  333. .num_leds = ARRAY_SIZE(gpio_leds),
  334. };
  335. static struct platform_device leds_gpio = {
  336. .name = "leds-gpio",
  337. .id = -1,
  338. .dev = {
  339. .platform_data = &gpio_led_info,
  340. },
  341. };
  342. static int omap3evm_twl_gpio_setup(struct device *dev,
  343. unsigned gpio, unsigned ngpio)
  344. {
  345. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  346. omap_mux_init_gpio(63, OMAP_PIN_INPUT);
  347. mmc[0].gpio_cd = gpio + 0;
  348. omap2_hsmmc_init(mmc);
  349. /* link regulators to MMC adapters */
  350. omap3evm_vmmc1_supply.dev = mmc[0].dev;
  351. omap3evm_vsim_supply.dev = mmc[0].dev;
  352. /*
  353. * Most GPIOs are for USB OTG. Some are mostly sent to
  354. * the P2 connector; notably LEDA for the LCD backlight.
  355. */
  356. /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
  357. gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL");
  358. gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
  359. /* gpio + 7 == DVI Enable */
  360. gpio_request(gpio + 7, "EN_DVI");
  361. gpio_direction_output(gpio + 7, 0);
  362. /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
  363. gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
  364. platform_device_register(&leds_gpio);
  365. return 0;
  366. }
  367. static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
  368. .gpio_base = OMAP_MAX_GPIO_LINES,
  369. .irq_base = TWL4030_GPIO_IRQ_BASE,
  370. .irq_end = TWL4030_GPIO_IRQ_END,
  371. .use_leds = true,
  372. .setup = omap3evm_twl_gpio_setup,
  373. };
  374. static struct twl4030_usb_data omap3evm_usb_data = {
  375. .usb_mode = T2_USB_MODE_ULPI,
  376. };
  377. static uint32_t board_keymap[] = {
  378. KEY(0, 0, KEY_LEFT),
  379. KEY(0, 1, KEY_DOWN),
  380. KEY(0, 2, KEY_ENTER),
  381. KEY(0, 3, KEY_M),
  382. KEY(1, 0, KEY_RIGHT),
  383. KEY(1, 1, KEY_UP),
  384. KEY(1, 2, KEY_I),
  385. KEY(1, 3, KEY_N),
  386. KEY(2, 0, KEY_A),
  387. KEY(2, 1, KEY_E),
  388. KEY(2, 2, KEY_J),
  389. KEY(2, 3, KEY_O),
  390. KEY(3, 0, KEY_B),
  391. KEY(3, 1, KEY_F),
  392. KEY(3, 2, KEY_K),
  393. KEY(3, 3, KEY_P)
  394. };
  395. static struct matrix_keymap_data board_map_data = {
  396. .keymap = board_keymap,
  397. .keymap_size = ARRAY_SIZE(board_keymap),
  398. };
  399. static struct twl4030_keypad_data omap3evm_kp_data = {
  400. .keymap_data = &board_map_data,
  401. .rows = 4,
  402. .cols = 4,
  403. .rep = 1,
  404. };
  405. static struct twl4030_madc_platform_data omap3evm_madc_data = {
  406. .irq_line = 1,
  407. };
  408. static struct twl4030_codec_audio_data omap3evm_audio_data = {
  409. .audio_mclk = 26000000,
  410. };
  411. static struct twl4030_codec_data omap3evm_codec_data = {
  412. .audio_mclk = 26000000,
  413. .audio = &omap3evm_audio_data,
  414. };
  415. static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = {
  416. .supply = "vdda_dac",
  417. .dev = &omap3_evm_dss_device.dev,
  418. };
  419. /* VDAC for DSS driving S-Video */
  420. static struct regulator_init_data omap3_evm_vdac = {
  421. .constraints = {
  422. .min_uV = 1800000,
  423. .max_uV = 1800000,
  424. .apply_uV = true,
  425. .valid_modes_mask = REGULATOR_MODE_NORMAL
  426. | REGULATOR_MODE_STANDBY,
  427. .valid_ops_mask = REGULATOR_CHANGE_MODE
  428. | REGULATOR_CHANGE_STATUS,
  429. },
  430. .num_consumer_supplies = 1,
  431. .consumer_supplies = &omap3_evm_vdda_dac_supply,
  432. };
  433. /* VPLL2 for digital video outputs */
  434. static struct regulator_consumer_supply omap3_evm_vpll2_supply =
  435. REGULATOR_SUPPLY("vdds_dsi", "omapdss");
  436. static struct regulator_init_data omap3_evm_vpll2 = {
  437. .constraints = {
  438. .min_uV = 1800000,
  439. .max_uV = 1800000,
  440. .apply_uV = true,
  441. .valid_modes_mask = REGULATOR_MODE_NORMAL
  442. | REGULATOR_MODE_STANDBY,
  443. .valid_ops_mask = REGULATOR_CHANGE_MODE
  444. | REGULATOR_CHANGE_STATUS,
  445. },
  446. .num_consumer_supplies = 1,
  447. .consumer_supplies = &omap3_evm_vpll2_supply,
  448. };
  449. static struct twl4030_platform_data omap3evm_twldata = {
  450. .irq_base = TWL4030_IRQ_BASE,
  451. .irq_end = TWL4030_IRQ_END,
  452. /* platform_data for children goes here */
  453. .keypad = &omap3evm_kp_data,
  454. .madc = &omap3evm_madc_data,
  455. .usb = &omap3evm_usb_data,
  456. .gpio = &omap3evm_gpio_data,
  457. .codec = &omap3evm_codec_data,
  458. .vdac = &omap3_evm_vdac,
  459. .vpll2 = &omap3_evm_vpll2,
  460. };
  461. static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
  462. {
  463. I2C_BOARD_INFO("twl4030", 0x48),
  464. .flags = I2C_CLIENT_WAKE,
  465. .irq = INT_34XX_SYS_NIRQ,
  466. .platform_data = &omap3evm_twldata,
  467. },
  468. };
  469. static int __init omap3_evm_i2c_init(void)
  470. {
  471. /*
  472. * REVISIT: These entries can be set in omap3evm_twl_data
  473. * after a merge with MFD tree
  474. */
  475. omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
  476. omap3evm_twldata.vsim = &omap3evm_vsim;
  477. omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
  478. ARRAY_SIZE(omap3evm_i2c_boardinfo));
  479. omap_register_i2c_bus(2, 400, NULL, 0);
  480. omap_register_i2c_bus(3, 400, NULL, 0);
  481. return 0;
  482. }
  483. static void ads7846_dev_init(void)
  484. {
  485. if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
  486. printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
  487. gpio_direction_input(OMAP3_EVM_TS_GPIO);
  488. gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
  489. }
  490. static int ads7846_get_pendown_state(void)
  491. {
  492. return !gpio_get_value(OMAP3_EVM_TS_GPIO);
  493. }
  494. static struct ads7846_platform_data ads7846_config = {
  495. .x_max = 0x0fff,
  496. .y_max = 0x0fff,
  497. .x_plate_ohms = 180,
  498. .pressure_max = 255,
  499. .debounce_max = 10,
  500. .debounce_tol = 3,
  501. .debounce_rep = 1,
  502. .get_pendown_state = ads7846_get_pendown_state,
  503. .keep_vref_on = 1,
  504. .settle_delay_usecs = 150,
  505. .wakeup = true,
  506. };
  507. static struct omap2_mcspi_device_config ads7846_mcspi_config = {
  508. .turbo_mode = 0,
  509. .single_channel = 1, /* 0: slave, 1: master */
  510. };
  511. static struct spi_board_info omap3evm_spi_board_info[] = {
  512. [0] = {
  513. .modalias = "ads7846",
  514. .bus_num = 1,
  515. .chip_select = 0,
  516. .max_speed_hz = 1500000,
  517. .controller_data = &ads7846_mcspi_config,
  518. .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
  519. .platform_data = &ads7846_config,
  520. },
  521. };
  522. static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
  523. };
  524. static void __init omap3_evm_init_irq(void)
  525. {
  526. omap_board_config = omap3_evm_config;
  527. omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
  528. omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
  529. omap_init_irq();
  530. omap_gpio_init();
  531. }
  532. static struct platform_device *omap3_evm_devices[] __initdata = {
  533. &omap3_evm_dss_device,
  534. };
  535. static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
  536. .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  537. .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
  538. .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  539. .phy_reset = true,
  540. /* PHY reset GPIO will be runtime programmed based on EVM version */
  541. .reset_gpio_port[0] = -EINVAL,
  542. .reset_gpio_port[1] = -EINVAL,
  543. .reset_gpio_port[2] = -EINVAL
  544. };
  545. #ifdef CONFIG_OMAP_MUX
  546. static struct omap_board_mux board_mux[] __initdata = {
  547. OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
  548. OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
  549. OMAP_PIN_OFF_WAKEUPENABLE),
  550. OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
  551. OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW),
  552. { .reg_offset = OMAP_MUX_TERMINATOR },
  553. };
  554. #else
  555. #define board_mux NULL
  556. #endif
  557. static struct omap_musb_board_data musb_board_data = {
  558. .interface_type = MUSB_INTERFACE_ULPI,
  559. .mode = MUSB_OTG,
  560. .power = 100,
  561. };
  562. static void __init omap3_evm_init(void)
  563. {
  564. omap3_evm_get_revision();
  565. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  566. omap3_evm_i2c_init();
  567. platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
  568. spi_register_board_info(omap3evm_spi_board_info,
  569. ARRAY_SIZE(omap3evm_spi_board_info));
  570. omap_serial_init();
  571. /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
  572. usb_nop_xceiv_register();
  573. if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
  574. /* enable EHCI VBUS using GPIO22 */
  575. omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
  576. gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
  577. gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
  578. gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
  579. /* Select EHCI port on main board */
  580. omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
  581. gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
  582. gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
  583. gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
  584. /* setup EHCI phy reset config */
  585. omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
  586. ehci_pdata.reset_gpio_port[1] = 21;
  587. /* EVM REV >= E can supply 500mA with EXTVBUS programming */
  588. musb_board_data.power = 500;
  589. musb_board_data.extvbus = 1;
  590. } else {
  591. /* setup EHCI phy reset on MDC */
  592. omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
  593. ehci_pdata.reset_gpio_port[1] = 135;
  594. }
  595. usb_musb_init(&musb_board_data);
  596. usb_ehci_init(&ehci_pdata);
  597. ads7846_dev_init();
  598. omap3evm_init_smsc911x();
  599. omap3_evm_display_init();
  600. }
  601. MACHINE_START(OMAP3EVM, "OMAP3 EVM")
  602. /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
  603. .boot_params = 0x80000100,
  604. .map_io = omap3_map_io,
  605. .reserve = omap_reserve,
  606. .init_irq = omap3_evm_init_irq,
  607. .init_machine = omap3_evm_init,
  608. .timer = &omap_timer,
  609. MACHINE_END