board-am3517evm.c 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. /*
  2. * linux/arch/arm/mach-omap2/board-am3517evm.c
  3. *
  4. * Copyright (C) 2009 Texas Instruments Incorporated
  5. * Author: Ranjith Lohithakshan <ranjithl@ti.com>
  6. *
  7. * Based on mach-omap2/board-omap3evm.c
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation version 2.
  12. *
  13. * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
  14. * whether express or implied; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/clk.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/gpio.h>
  23. #include <linux/platform_data/pca953x.h>
  24. #include <linux/can/platform/ti_hecc.h>
  25. #include <linux/davinci_emac.h>
  26. #include <linux/mmc/host.h>
  27. #include <linux/usb/musb.h>
  28. #include <linux/platform_data/gpio-omap.h>
  29. #include "am35xx.h"
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/map.h>
  33. #include "common.h"
  34. #include <video/omapdss.h>
  35. #include <video/omap-panel-data.h>
  36. #include "am35xx-emac.h"
  37. #include "mux.h"
  38. #include "control.h"
  39. #include "hsmmc.h"
  40. #define LCD_PANEL_PWR 176
  41. #define LCD_PANEL_BKLIGHT_PWR 182
  42. #define LCD_PANEL_PWM 181
  43. static struct i2c_board_info __initdata am3517evm_i2c1_boardinfo[] = {
  44. {
  45. I2C_BOARD_INFO("s35390a", 0x30),
  46. },
  47. };
  48. /*
  49. * RTC - S35390A
  50. */
  51. #define GPIO_RTCS35390A_IRQ 55
  52. static void __init am3517_evm_rtc_init(void)
  53. {
  54. int r;
  55. omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP);
  56. r = gpio_request_one(GPIO_RTCS35390A_IRQ, GPIOF_IN, "rtcs35390a-irq");
  57. if (r < 0) {
  58. printk(KERN_WARNING "failed to request GPIO#%d\n",
  59. GPIO_RTCS35390A_IRQ);
  60. return;
  61. }
  62. am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
  63. }
  64. /*
  65. * I2C GPIO Expander - TCA6416
  66. */
  67. /* Mounted on Base-Board */
  68. static struct pca953x_platform_data am3517evm_gpio_expander_info_0 = {
  69. .gpio_base = OMAP_MAX_GPIO_LINES,
  70. };
  71. static struct i2c_board_info __initdata am3517evm_i2c2_boardinfo[] = {
  72. {
  73. I2C_BOARD_INFO("tlv320aic23", 0x1A),
  74. },
  75. {
  76. I2C_BOARD_INFO("tca6416", 0x21),
  77. .platform_data = &am3517evm_gpio_expander_info_0,
  78. },
  79. };
  80. /* Mounted on UI Card */
  81. static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_1 = {
  82. .gpio_base = OMAP_MAX_GPIO_LINES + 16,
  83. };
  84. static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = {
  85. .gpio_base = OMAP_MAX_GPIO_LINES + 32,
  86. };
  87. static struct i2c_board_info __initdata am3517evm_i2c3_boardinfo[] = {
  88. {
  89. I2C_BOARD_INFO("tca6416", 0x20),
  90. .platform_data = &am3517evm_ui_gpio_expander_info_1,
  91. },
  92. {
  93. I2C_BOARD_INFO("tca6416", 0x21),
  94. .platform_data = &am3517evm_ui_gpio_expander_info_2,
  95. },
  96. };
  97. static int __init am3517_evm_i2c_init(void)
  98. {
  99. omap_register_i2c_bus(1, 400, NULL, 0);
  100. omap_register_i2c_bus(2, 400, am3517evm_i2c2_boardinfo,
  101. ARRAY_SIZE(am3517evm_i2c2_boardinfo));
  102. omap_register_i2c_bus(3, 400, am3517evm_i2c3_boardinfo,
  103. ARRAY_SIZE(am3517evm_i2c3_boardinfo));
  104. return 0;
  105. }
  106. static const struct display_timing am3517_evm_lcd_videomode = {
  107. .pixelclock = { 0, 9000000, 0 },
  108. .hactive = { 0, 480, 0 },
  109. .hfront_porch = { 0, 3, 0 },
  110. .hback_porch = { 0, 2, 0 },
  111. .hsync_len = { 0, 42, 0 },
  112. .vactive = { 0, 272, 0 },
  113. .vfront_porch = { 0, 3, 0 },
  114. .vback_porch = { 0, 2, 0 },
  115. .vsync_len = { 0, 11, 0 },
  116. .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
  117. DISPLAY_FLAGS_DE_LOW | DISPLAY_FLAGS_PIXDATA_POSEDGE,
  118. };
  119. static struct panel_dpi_platform_data am3517_evm_lcd_pdata = {
  120. .name = "lcd",
  121. .source = "dpi.0",
  122. .data_lines = 16,
  123. .display_timing = &am3517_evm_lcd_videomode,
  124. .enable_gpio = LCD_PANEL_PWR,
  125. .backlight_gpio = LCD_PANEL_BKLIGHT_PWR,
  126. };
  127. static struct platform_device am3517_evm_lcd_device = {
  128. .name = "panel-dpi",
  129. .id = 0,
  130. .dev.platform_data = &am3517_evm_lcd_pdata,
  131. };
  132. static struct connector_dvi_platform_data am3517_evm_dvi_connector_pdata = {
  133. .name = "dvi",
  134. .source = "tfp410.0",
  135. .i2c_bus_num = -1,
  136. };
  137. static struct platform_device am3517_evm_dvi_connector_device = {
  138. .name = "connector-dvi",
  139. .id = 0,
  140. .dev.platform_data = &am3517_evm_dvi_connector_pdata,
  141. };
  142. static struct encoder_tfp410_platform_data am3517_evm_tfp410_pdata = {
  143. .name = "tfp410.0",
  144. .source = "dpi.0",
  145. .data_lines = 24,
  146. .power_down_gpio = -1,
  147. };
  148. static struct platform_device am3517_evm_tfp410_device = {
  149. .name = "tfp410",
  150. .id = 0,
  151. .dev.platform_data = &am3517_evm_tfp410_pdata,
  152. };
  153. static struct connector_atv_platform_data am3517_evm_tv_pdata = {
  154. .name = "tv",
  155. .source = "venc.0",
  156. .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
  157. .invert_polarity = false,
  158. };
  159. static struct platform_device am3517_evm_tv_connector_device = {
  160. .name = "connector-analog-tv",
  161. .id = 0,
  162. .dev.platform_data = &am3517_evm_tv_pdata,
  163. };
  164. static struct omap_dss_board_info am3517_evm_dss_data = {
  165. .default_display_name = "lcd",
  166. };
  167. static void __init am3517_evm_display_init(void)
  168. {
  169. gpio_request_one(LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd panel pwm");
  170. omap_display_init(&am3517_evm_dss_data);
  171. platform_device_register(&am3517_evm_tfp410_device);
  172. platform_device_register(&am3517_evm_dvi_connector_device);
  173. platform_device_register(&am3517_evm_lcd_device);
  174. platform_device_register(&am3517_evm_tv_connector_device);
  175. }
  176. /*
  177. * Board initialization
  178. */
  179. static struct omap_musb_board_data musb_board_data = {
  180. .interface_type = MUSB_INTERFACE_ULPI,
  181. .mode = MUSB_OTG,
  182. .power = 500,
  183. .set_phy_power = am35x_musb_phy_power,
  184. .clear_irq = am35x_musb_clear_irq,
  185. .set_mode = am35x_set_mode,
  186. .reset = am35x_musb_reset,
  187. };
  188. static __init void am3517_evm_musb_init(void)
  189. {
  190. u32 devconf2;
  191. /*
  192. * Set up USB clock/mode in the DEVCONF2 register.
  193. */
  194. devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2);
  195. /* USB2.0 PHY reference clock is 13 MHz */
  196. devconf2 &= ~(CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE);
  197. devconf2 |= CONF2_REFFREQ_13MHZ | CONF2_SESENDEN | CONF2_VBDTCTEN
  198. | CONF2_DATPOL;
  199. omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
  200. usb_musb_init(&musb_board_data);
  201. }
  202. static __init void am3517_evm_mcbsp1_init(void)
  203. {
  204. u32 devconf0;
  205. /* McBSP1 CLKR/FSR signal to be connected to CLKX/FSX pin */
  206. devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
  207. devconf0 |= OMAP2_MCBSP1_CLKR_MASK | OMAP2_MCBSP1_FSR_MASK;
  208. omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0);
  209. }
  210. static struct usbhs_phy_data phy_data[] __initdata = {
  211. {
  212. .port = 1,
  213. .reset_gpio = 57,
  214. .vcc_gpio = -EINVAL,
  215. },
  216. };
  217. static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
  218. .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
  219. #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
  220. defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
  221. .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
  222. #else
  223. .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
  224. #endif
  225. };
  226. #ifdef CONFIG_OMAP_MUX
  227. static struct omap_board_mux board_mux[] __initdata = {
  228. /* USB OTG DRVVBUS offset = 0x212 */
  229. OMAP3_MUX(SAD2D_MCAD23, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
  230. { .reg_offset = OMAP_MUX_TERMINATOR },
  231. };
  232. #endif
  233. static struct resource am3517_hecc_resources[] = {
  234. {
  235. .start = AM35XX_IPSS_HECC_BASE,
  236. .end = AM35XX_IPSS_HECC_BASE + 0x3FFF,
  237. .flags = IORESOURCE_MEM,
  238. },
  239. {
  240. .start = 24 + OMAP_INTC_START,
  241. .flags = IORESOURCE_IRQ,
  242. },
  243. };
  244. static struct platform_device am3517_hecc_device = {
  245. .name = "ti_hecc",
  246. .id = -1,
  247. .num_resources = ARRAY_SIZE(am3517_hecc_resources),
  248. .resource = am3517_hecc_resources,
  249. };
  250. static struct ti_hecc_platform_data am3517_evm_hecc_pdata = {
  251. .scc_hecc_offset = AM35XX_HECC_SCC_HECC_OFFSET,
  252. .scc_ram_offset = AM35XX_HECC_SCC_RAM_OFFSET,
  253. .hecc_ram_offset = AM35XX_HECC_RAM_OFFSET,
  254. .mbx_offset = AM35XX_HECC_MBOX_OFFSET,
  255. .int_line = AM35XX_HECC_INT_LINE,
  256. .version = AM35XX_HECC_VERSION,
  257. };
  258. static void am3517_evm_hecc_init(struct ti_hecc_platform_data *pdata)
  259. {
  260. am3517_hecc_device.dev.platform_data = pdata;
  261. platform_device_register(&am3517_hecc_device);
  262. }
  263. static struct omap2_hsmmc_info mmc[] = {
  264. {
  265. .mmc = 1,
  266. .caps = MMC_CAP_4_BIT_DATA,
  267. .gpio_cd = 127,
  268. .gpio_wp = 126,
  269. },
  270. {
  271. .mmc = 2,
  272. .caps = MMC_CAP_4_BIT_DATA,
  273. .gpio_cd = 128,
  274. .gpio_wp = 129,
  275. },
  276. {} /* Terminator */
  277. };
  278. static void __init am3517_evm_init(void)
  279. {
  280. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  281. am3517_evm_i2c_init();
  282. am3517_evm_display_init();
  283. omap_serial_init();
  284. omap_sdrc_init(NULL, NULL);
  285. /* Configure GPIO for EHCI port */
  286. omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
  287. usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
  288. usbhs_init(&usbhs_bdata);
  289. am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
  290. /* RTC - S35390A */
  291. am3517_evm_rtc_init();
  292. i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
  293. ARRAY_SIZE(am3517evm_i2c1_boardinfo));
  294. /*Ethernet*/
  295. am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1);
  296. /* MUSB */
  297. am3517_evm_musb_init();
  298. /* McBSP1 */
  299. am3517_evm_mcbsp1_init();
  300. /* MMC init function */
  301. omap_hsmmc_init(mmc);
  302. }
  303. MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
  304. .atag_offset = 0x100,
  305. .reserve = omap_reserve,
  306. .map_io = omap3_map_io,
  307. .init_early = am35xx_init_early,
  308. .init_irq = omap3_init_irq,
  309. .handle_irq = omap3_intc_handle_irq,
  310. .init_machine = am3517_evm_init,
  311. .init_late = am35xx_init_late,
  312. .init_time = omap3_sync32k_timer_init,
  313. .restart = omap3xxx_restart,
  314. MACHINE_END