aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-am3517evm.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mach-omap2/board-am3517evm.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mach-omap2/board-am3517evm.c')
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c199
1 files changed, 113 insertions, 86 deletions
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 4d0f58592864..63af4171c043 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -18,6 +18,7 @@
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/clk.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
22#include <linux/gpio.h> 23#include <linux/gpio.h>
23#include <linux/i2c/pca953x.h> 24#include <linux/i2c/pca953x.h>
@@ -32,25 +33,44 @@
32 33
33#include <plat/board.h> 34#include <plat/board.h>
34#include <plat/common.h> 35#include <plat/common.h>
35#include <plat/control.h>
36#include <plat/usb.h> 36#include <plat/usb.h>
37#include <plat/display.h> 37#include <video/omapdss.h>
38#include <video/omap-panel-generic-dpi.h>
38 39
39#include "mux.h" 40#include "mux.h"
41#include "control.h"
40 42
41#define AM35XX_EVM_PHY_MASK (0xF)
42#define AM35XX_EVM_MDIO_FREQUENCY (1000000) 43#define AM35XX_EVM_MDIO_FREQUENCY (1000000)
43 44
45static struct mdio_platform_data am3517_evm_mdio_pdata = {
46 .bus_freq = AM35XX_EVM_MDIO_FREQUENCY,
47};
48
49static struct resource am3517_mdio_resources[] = {
50 {
51 .start = AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET,
52 .end = AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET +
53 SZ_4K - 1,
54 .flags = IORESOURCE_MEM,
55 },
56};
57
58static struct platform_device am3517_mdio_device = {
59 .name = "davinci_mdio",
60 .id = 0,
61 .num_resources = ARRAY_SIZE(am3517_mdio_resources),
62 .resource = am3517_mdio_resources,
63 .dev.platform_data = &am3517_evm_mdio_pdata,
64};
65
44static struct emac_platform_data am3517_evm_emac_pdata = { 66static struct emac_platform_data am3517_evm_emac_pdata = {
45 .phy_mask = AM35XX_EVM_PHY_MASK,
46 .mdio_max_freq = AM35XX_EVM_MDIO_FREQUENCY,
47 .rmii_en = 1, 67 .rmii_en = 1,
48}; 68};
49 69
50static struct resource am3517_emac_resources[] = { 70static struct resource am3517_emac_resources[] = {
51 { 71 {
52 .start = AM35XX_IPSS_EMAC_BASE, 72 .start = AM35XX_IPSS_EMAC_BASE,
53 .end = AM35XX_IPSS_EMAC_BASE + 0x3FFFF, 73 .end = AM35XX_IPSS_EMAC_BASE + 0x2FFFF,
54 .flags = IORESOURCE_MEM, 74 .flags = IORESOURCE_MEM,
55 }, 75 },
56 { 76 {
@@ -106,14 +126,13 @@ static void am3517_disable_ethernet_int(void)
106 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); 126 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
107} 127}
108 128
109void am3517_evm_ethernet_init(struct emac_platform_data *pdata) 129static void am3517_evm_ethernet_init(struct emac_platform_data *pdata)
110{ 130{
111 unsigned int regval; 131 unsigned int regval;
112 132
113 pdata->ctrl_reg_offset = AM35XX_EMAC_CNTRL_OFFSET; 133 pdata->ctrl_reg_offset = AM35XX_EMAC_CNTRL_OFFSET;
114 pdata->ctrl_mod_reg_offset = AM35XX_EMAC_CNTRL_MOD_OFFSET; 134 pdata->ctrl_mod_reg_offset = AM35XX_EMAC_CNTRL_MOD_OFFSET;
115 pdata->ctrl_ram_offset = AM35XX_EMAC_CNTRL_RAM_OFFSET; 135 pdata->ctrl_ram_offset = AM35XX_EMAC_CNTRL_RAM_OFFSET;
116 pdata->mdio_reg_offset = AM35XX_EMAC_MDIO_OFFSET;
117 pdata->ctrl_ram_size = AM35XX_EMAC_CNTRL_RAM_SIZE; 136 pdata->ctrl_ram_size = AM35XX_EMAC_CNTRL_RAM_SIZE;
118 pdata->version = EMAC_VERSION_2; 137 pdata->version = EMAC_VERSION_2;
119 pdata->hw_ram_addr = AM35XX_EMAC_HW_RAM_ADDR; 138 pdata->hw_ram_addr = AM35XX_EMAC_HW_RAM_ADDR;
@@ -121,6 +140,9 @@ void am3517_evm_ethernet_init(struct emac_platform_data *pdata)
121 pdata->interrupt_disable = am3517_disable_ethernet_int; 140 pdata->interrupt_disable = am3517_disable_ethernet_int;
122 am3517_emac_device.dev.platform_data = pdata; 141 am3517_emac_device.dev.platform_data = pdata;
123 platform_device_register(&am3517_emac_device); 142 platform_device_register(&am3517_emac_device);
143 platform_device_register(&am3517_mdio_device);
144 clk_add_alias(NULL, dev_name(&am3517_mdio_device.dev),
145 NULL, &am3517_emac_device.dev);
124 146
125 regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); 147 regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
126 regval = regval & (~(AM35XX_CPGMACSS_SW_RST)); 148 regval = regval & (~(AM35XX_CPGMACSS_SW_RST));
@@ -139,7 +161,6 @@ void am3517_evm_ethernet_init(struct emac_platform_data *pdata)
139static struct i2c_board_info __initdata am3517evm_i2c1_boardinfo[] = { 161static struct i2c_board_info __initdata am3517evm_i2c1_boardinfo[] = {
140 { 162 {
141 I2C_BOARD_INFO("s35390a", 0x30), 163 I2C_BOARD_INFO("s35390a", 0x30),
142 .type = "s35390a",
143 }, 164 },
144}; 165};
145 166
@@ -153,19 +174,14 @@ static void __init am3517_evm_rtc_init(void)
153 int r; 174 int r;
154 175
155 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP); 176 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP);
156 r = gpio_request(GPIO_RTCS35390A_IRQ, "rtcs35390a-irq"); 177
178 r = gpio_request_one(GPIO_RTCS35390A_IRQ, GPIOF_IN, "rtcs35390a-irq");
157 if (r < 0) { 179 if (r < 0) {
158 printk(KERN_WARNING "failed to request GPIO#%d\n", 180 printk(KERN_WARNING "failed to request GPIO#%d\n",
159 GPIO_RTCS35390A_IRQ); 181 GPIO_RTCS35390A_IRQ);
160 return; 182 return;
161 } 183 }
162 r = gpio_direction_input(GPIO_RTCS35390A_IRQ); 184
163 if (r < 0) {
164 printk(KERN_WARNING "GPIO#%d cannot be configured as input\n",
165 GPIO_RTCS35390A_IRQ);
166 gpio_free(GPIO_RTCS35390A_IRQ);
167 return;
168 }
169 am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ); 185 am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
170} 186}
171 187
@@ -179,6 +195,9 @@ static struct pca953x_platform_data am3517evm_gpio_expander_info_0 = {
179}; 195};
180static struct i2c_board_info __initdata am3517evm_i2c2_boardinfo[] = { 196static struct i2c_board_info __initdata am3517evm_i2c2_boardinfo[] = {
181 { 197 {
198 I2C_BOARD_INFO("tlv320aic23", 0x1A),
199 },
200 {
182 I2C_BOARD_INFO("tca6416", 0x21), 201 I2C_BOARD_INFO("tca6416", 0x21),
183 .platform_data = &am3517evm_gpio_expander_info_0, 202 .platform_data = &am3517evm_gpio_expander_info_0,
184 }, 203 },
@@ -218,6 +237,15 @@ static int dvi_enabled;
218 237
219#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ 238#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
220 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) 239 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
240static struct gpio am3517_evm_dss_gpios[] __initdata = {
241 /* GPIO 182 = LCD Backlight Power */
242 { LCD_PANEL_BKLIGHT_PWR, GPIOF_OUT_INIT_HIGH, "lcd_backlight_pwr" },
243 /* GPIO 181 = LCD Panel PWM */
244 { LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd bl enable" },
245 /* GPIO 176 = LCD Panel Power enable pin */
246 { LCD_PANEL_PWR, GPIOF_OUT_INIT_HIGH, "dvi enable" },
247};
248
221static void __init am3517_evm_display_init(void) 249static void __init am3517_evm_display_init(void)
222{ 250{
223 int r; 251 int r;
@@ -225,41 +253,15 @@ static void __init am3517_evm_display_init(void)
225 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP); 253 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP);
226 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN); 254 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN);
227 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN); 255 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN);
228 /* 256
229 * Enable GPIO 182 = LCD Backlight Power 257 r = gpio_request_array(am3517_evm_dss_gpios,
230 */ 258 ARRAY_SIZE(am3517_evm_dss_gpios));
231 r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
232 if (r) { 259 if (r) {
233 printk(KERN_ERR "failed to get lcd_backlight_pwr\n"); 260 printk(KERN_ERR "failed to get DSS panel control GPIOs\n");
234 return; 261 return;
235 } 262 }
236 gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
237 /*
238 * Enable GPIO 181 = LCD Panel PWM
239 */
240 r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
241 if (r) {
242 printk(KERN_ERR "failed to get lcd_pwm\n");
243 goto err_1;
244 }
245 gpio_direction_output(LCD_PANEL_PWM, 1);
246 /*
247 * Enable GPIO 176 = LCD Panel Power enable pin
248 */
249 r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
250 if (r) {
251 printk(KERN_ERR "failed to get lcd_panel_pwr\n");
252 goto err_2;
253 }
254 gpio_direction_output(LCD_PANEL_PWR, 1);
255 263
256 printk(KERN_INFO "Display initialized successfully\n"); 264 printk(KERN_INFO "Display initialized successfully\n");
257 return;
258
259err_2:
260 gpio_free(LCD_PANEL_PWM);
261err_1:
262 gpio_free(LCD_PANEL_BKLIGHT_PWR);
263} 265}
264#else 266#else
265static void __init am3517_evm_display_init(void) {} 267static void __init am3517_evm_display_init(void) {}
@@ -283,13 +285,18 @@ static void am3517_evm_panel_disable_lcd(struct omap_dss_device *dssdev)
283 lcd_enabled = 0; 285 lcd_enabled = 0;
284} 286}
285 287
288static struct panel_generic_dpi_data lcd_panel = {
289 .name = "sharp_lq",
290 .platform_enable = am3517_evm_panel_enable_lcd,
291 .platform_disable = am3517_evm_panel_disable_lcd,
292};
293
286static struct omap_dss_device am3517_evm_lcd_device = { 294static struct omap_dss_device am3517_evm_lcd_device = {
287 .type = OMAP_DISPLAY_TYPE_DPI, 295 .type = OMAP_DISPLAY_TYPE_DPI,
288 .name = "lcd", 296 .name = "lcd",
289 .driver_name = "sharp_lq_panel", 297 .driver_name = "generic_dpi_panel",
298 .data = &lcd_panel,
290 .phy.dpi.data_lines = 16, 299 .phy.dpi.data_lines = 16,
291 .platform_enable = am3517_evm_panel_enable_lcd,
292 .platform_disable = am3517_evm_panel_disable_lcd,
293}; 300};
294 301
295static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev) 302static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev)
@@ -326,13 +333,18 @@ static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
326 dvi_enabled = 0; 333 dvi_enabled = 0;
327} 334}
328 335
336static struct panel_generic_dpi_data dvi_panel = {
337 .name = "generic",
338 .platform_enable = am3517_evm_panel_enable_dvi,
339 .platform_disable = am3517_evm_panel_disable_dvi,
340};
341
329static struct omap_dss_device am3517_evm_dvi_device = { 342static struct omap_dss_device am3517_evm_dvi_device = {
330 .type = OMAP_DISPLAY_TYPE_DPI, 343 .type = OMAP_DISPLAY_TYPE_DPI,
331 .name = "dvi", 344 .name = "dvi",
332 .driver_name = "generic_panel", 345 .driver_name = "generic_dpi_panel",
346 .data = &dvi_panel,
333 .phy.dpi.data_lines = 24, 347 .phy.dpi.data_lines = 24,
334 .platform_enable = am3517_evm_panel_enable_dvi,
335 .platform_disable = am3517_evm_panel_disable_dvi,
336}; 348};
337 349
338static struct omap_dss_device *am3517_evm_dss_devices[] = { 350static struct omap_dss_device *am3517_evm_dss_devices[] = {
@@ -347,43 +359,53 @@ static struct omap_dss_board_info am3517_evm_dss_data = {
347 .default_device = &am3517_evm_lcd_device, 359 .default_device = &am3517_evm_lcd_device,
348}; 360};
349 361
350struct platform_device am3517_evm_dss_device = {
351 .name = "omapdss",
352 .id = -1,
353 .dev = {
354 .platform_data = &am3517_evm_dss_data,
355 },
356};
357
358/* 362/*
359 * Board initialization 363 * Board initialization
360 */ 364 */
361static struct omap_board_config_kernel am3517_evm_config[] __initdata = { 365static void __init am3517_evm_init_early(void)
362}; 366{
367 omap2_init_common_infrastructure();
368 omap2_init_common_devices(NULL, NULL);
369}
363 370
364static struct platform_device *am3517_evm_devices[] __initdata = { 371static struct omap_musb_board_data musb_board_data = {
365 &am3517_evm_dss_device, 372 .interface_type = MUSB_INTERFACE_ULPI,
373 .mode = MUSB_OTG,
374 .power = 500,
375 .set_phy_power = am35x_musb_phy_power,
376 .clear_irq = am35x_musb_clear_irq,
377 .set_mode = am35x_set_mode,
378 .reset = am35x_musb_reset,
366}; 379};
367 380
368static void __init am3517_evm_init_irq(void) 381static __init void am3517_evm_musb_init(void)
369{ 382{
370 omap_board_config = am3517_evm_config; 383 u32 devconf2;
371 omap_board_config_size = ARRAY_SIZE(am3517_evm_config); 384
385 /*
386 * Set up USB clock/mode in the DEVCONF2 register.
387 */
388 devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2);
372 389
373 omap2_init_common_hw(NULL, NULL); 390 /* USB2.0 PHY reference clock is 13 MHz */
374 omap_init_irq(); 391 devconf2 &= ~(CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE);
375 omap_gpio_init(); 392 devconf2 |= CONF2_REFFREQ_13MHZ | CONF2_SESENDEN | CONF2_VBDTCTEN
393 | CONF2_DATPOL;
394
395 omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
396
397 usb_musb_init(&musb_board_data);
376} 398}
377 399
378static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { 400static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
379 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, 401 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
380#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ 402#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
381 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) 403 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
382 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, 404 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
383#else 405#else
384 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, 406 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
385#endif 407#endif
386 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, 408 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
387 409
388 .phy_reset = true, 410 .phy_reset = true,
389 .reset_gpio_port[0] = 57, 411 .reset_gpio_port[0] = 57,
@@ -393,10 +415,10 @@ static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
393 415
394#ifdef CONFIG_OMAP_MUX 416#ifdef CONFIG_OMAP_MUX
395static struct omap_board_mux board_mux[] __initdata = { 417static struct omap_board_mux board_mux[] __initdata = {
418 /* USB OTG DRVVBUS offset = 0x212 */
419 OMAP3_MUX(SAD2D_MCAD23, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
396 { .reg_offset = OMAP_MUX_TERMINATOR }, 420 { .reg_offset = OMAP_MUX_TERMINATOR },
397}; 421};
398#else
399#define board_mux NULL
400#endif 422#endif
401 423
402 424
@@ -435,19 +457,22 @@ static void am3517_evm_hecc_init(struct ti_hecc_platform_data *pdata)
435 platform_device_register(&am3517_hecc_device); 457 platform_device_register(&am3517_hecc_device);
436} 458}
437 459
460static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
461};
462
438static void __init am3517_evm_init(void) 463static void __init am3517_evm_init(void)
439{ 464{
465 omap_board_config = am3517_evm_config;
466 omap_board_config_size = ARRAY_SIZE(am3517_evm_config);
440 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 467 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
441 468
442 am3517_evm_i2c_init(); 469 am3517_evm_i2c_init();
443 platform_add_devices(am3517_evm_devices, 470 omap_display_init(&am3517_evm_dss_data);
444 ARRAY_SIZE(am3517_evm_devices));
445
446 omap_serial_init(); 471 omap_serial_init();
447 472
448 /* Configure GPIO for EHCI port */ 473 /* Configure GPIO for EHCI port */
449 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); 474 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
450 usb_ehci_init(&ehci_pdata); 475 usbhs_init(&usbhs_bdata);
451 am3517_evm_hecc_init(&am3517_evm_hecc_pdata); 476 am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
452 /* DSS */ 477 /* DSS */
453 am3517_evm_display_init(); 478 am3517_evm_display_init();
@@ -459,15 +484,17 @@ static void __init am3517_evm_init(void)
459 ARRAY_SIZE(am3517evm_i2c1_boardinfo)); 484 ARRAY_SIZE(am3517evm_i2c1_boardinfo));
460 /*Ethernet*/ 485 /*Ethernet*/
461 am3517_evm_ethernet_init(&am3517_evm_emac_pdata); 486 am3517_evm_ethernet_init(&am3517_evm_emac_pdata);
487
488 /* MUSB */
489 am3517_evm_musb_init();
462} 490}
463 491
464MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM") 492MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
465 .phys_io = 0x48000000,
466 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
467 .boot_params = 0x80000100, 493 .boot_params = 0x80000100,
468 .map_io = omap3_map_io,
469 .reserve = omap_reserve, 494 .reserve = omap_reserve,
470 .init_irq = am3517_evm_init_irq, 495 .map_io = omap3_map_io,
496 .init_early = am3517_evm_init_early,
497 .init_irq = omap_init_irq,
471 .init_machine = am3517_evm_init, 498 .init_machine = am3517_evm_init,
472 .timer = &omap_timer, 499 .timer = &omap_timer,
473MACHINE_END 500MACHINE_END