board-omap3evm.c 18 KB

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