diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-am3517evm.c')
-rw-r--r-- | arch/arm/mach-omap2/board-am3517evm.c | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index c1c4389fbd8f..19b9e415710d 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <linux/i2c/pca953x.h> | 23 | #include <linux/i2c/pca953x.h> |
24 | #include <linux/can/platform/ti_hecc.h> | ||
25 | #include <linux/davinci_emac.h> | ||
24 | 26 | ||
25 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
26 | #include <mach/am35xx.h> | 28 | #include <mach/am35xx.h> |
@@ -30,11 +32,106 @@ | |||
30 | 32 | ||
31 | #include <plat/board.h> | 33 | #include <plat/board.h> |
32 | #include <plat/common.h> | 34 | #include <plat/common.h> |
35 | #include <plat/control.h> | ||
33 | #include <plat/usb.h> | 36 | #include <plat/usb.h> |
34 | #include <plat/display.h> | 37 | #include <plat/display.h> |
35 | 38 | ||
36 | #include "mux.h" | 39 | #include "mux.h" |
37 | 40 | ||
41 | #define AM35XX_EVM_PHY_MASK (0xF) | ||
42 | #define AM35XX_EVM_MDIO_FREQUENCY (1000000) | ||
43 | |||
44 | static 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, | ||
48 | }; | ||
49 | |||
50 | static struct resource am3517_emac_resources[] = { | ||
51 | { | ||
52 | .start = AM35XX_IPSS_EMAC_BASE, | ||
53 | .end = AM35XX_IPSS_EMAC_BASE + 0x3FFFF, | ||
54 | .flags = IORESOURCE_MEM, | ||
55 | }, | ||
56 | { | ||
57 | .start = INT_35XX_EMAC_C0_RXTHRESH_IRQ, | ||
58 | .end = INT_35XX_EMAC_C0_RXTHRESH_IRQ, | ||
59 | .flags = IORESOURCE_IRQ, | ||
60 | }, | ||
61 | { | ||
62 | .start = INT_35XX_EMAC_C0_RX_PULSE_IRQ, | ||
63 | .end = INT_35XX_EMAC_C0_RX_PULSE_IRQ, | ||
64 | .flags = IORESOURCE_IRQ, | ||
65 | }, | ||
66 | { | ||
67 | .start = INT_35XX_EMAC_C0_TX_PULSE_IRQ, | ||
68 | .end = INT_35XX_EMAC_C0_TX_PULSE_IRQ, | ||
69 | .flags = IORESOURCE_IRQ, | ||
70 | }, | ||
71 | { | ||
72 | .start = INT_35XX_EMAC_C0_MISC_PULSE_IRQ, | ||
73 | .end = INT_35XX_EMAC_C0_MISC_PULSE_IRQ, | ||
74 | .flags = IORESOURCE_IRQ, | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | static struct platform_device am3517_emac_device = { | ||
79 | .name = "davinci_emac", | ||
80 | .id = -1, | ||
81 | .num_resources = ARRAY_SIZE(am3517_emac_resources), | ||
82 | .resource = am3517_emac_resources, | ||
83 | }; | ||
84 | |||
85 | static void am3517_enable_ethernet_int(void) | ||
86 | { | ||
87 | u32 regval; | ||
88 | |||
89 | regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
90 | regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR | | ||
91 | AM35XX_CPGMAC_C0_TX_PULSE_CLR | | ||
92 | AM35XX_CPGMAC_C0_MISC_PULSE_CLR | | ||
93 | AM35XX_CPGMAC_C0_RX_THRESH_CLR); | ||
94 | omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
95 | regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
96 | } | ||
97 | |||
98 | static void am3517_disable_ethernet_int(void) | ||
99 | { | ||
100 | u32 regval; | ||
101 | |||
102 | regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
103 | regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR | | ||
104 | AM35XX_CPGMAC_C0_TX_PULSE_CLR); | ||
105 | omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
106 | regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); | ||
107 | } | ||
108 | |||
109 | void am3517_evm_ethernet_init(struct emac_platform_data *pdata) | ||
110 | { | ||
111 | unsigned int regval; | ||
112 | |||
113 | pdata->ctrl_reg_offset = AM35XX_EMAC_CNTRL_OFFSET; | ||
114 | pdata->ctrl_mod_reg_offset = AM35XX_EMAC_CNTRL_MOD_OFFSET; | ||
115 | 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; | ||
118 | pdata->version = EMAC_VERSION_2; | ||
119 | pdata->hw_ram_addr = AM35XX_EMAC_HW_RAM_ADDR; | ||
120 | pdata->interrupt_enable = am3517_enable_ethernet_int; | ||
121 | pdata->interrupt_disable = am3517_disable_ethernet_int; | ||
122 | am3517_emac_device.dev.platform_data = pdata; | ||
123 | platform_device_register(&am3517_emac_device); | ||
124 | |||
125 | regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); | ||
126 | regval = regval & (~(AM35XX_CPGMACSS_SW_RST)); | ||
127 | omap_ctrl_writel(regval, AM35XX_CONTROL_IP_SW_RESET); | ||
128 | regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); | ||
129 | |||
130 | return ; | ||
131 | } | ||
132 | |||
133 | |||
134 | |||
38 | #define LCD_PANEL_PWR 176 | 135 | #define LCD_PANEL_PWR 176 |
39 | #define LCD_PANEL_BKLIGHT_PWR 182 | 136 | #define LCD_PANEL_BKLIGHT_PWR 182 |
40 | #define LCD_PANEL_PWM 181 | 137 | #define LCD_PANEL_PWM 181 |
@@ -119,6 +216,8 @@ static int __init am3517_evm_i2c_init(void) | |||
119 | static int lcd_enabled; | 216 | static int lcd_enabled; |
120 | static int dvi_enabled; | 217 | static int dvi_enabled; |
121 | 218 | ||
219 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ | ||
220 | defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) | ||
122 | static void __init am3517_evm_display_init(void) | 221 | static void __init am3517_evm_display_init(void) |
123 | { | 222 | { |
124 | int r; | 223 | int r; |
@@ -162,6 +261,9 @@ err_2: | |||
162 | err_1: | 261 | err_1: |
163 | gpio_free(LCD_PANEL_BKLIGHT_PWR); | 262 | gpio_free(LCD_PANEL_BKLIGHT_PWR); |
164 | } | 263 | } |
264 | #else | ||
265 | static void __init am3517_evm_display_init(void) {} | ||
266 | #endif | ||
165 | 267 | ||
166 | static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev) | 268 | static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev) |
167 | { | 269 | { |
@@ -275,7 +377,12 @@ static void __init am3517_evm_init_irq(void) | |||
275 | 377 | ||
276 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | 378 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
277 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | 379 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
380 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ | ||
381 | defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) | ||
382 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
383 | #else | ||
278 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | 384 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, |
385 | #endif | ||
279 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | 386 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
280 | 387 | ||
281 | .phy_reset = true, | 388 | .phy_reset = true, |
@@ -292,6 +399,42 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
292 | #define board_mux NULL | 399 | #define board_mux NULL |
293 | #endif | 400 | #endif |
294 | 401 | ||
402 | |||
403 | static struct resource am3517_hecc_resources[] = { | ||
404 | { | ||
405 | .start = AM35XX_IPSS_HECC_BASE, | ||
406 | .end = AM35XX_IPSS_HECC_BASE + 0x3FFF, | ||
407 | .flags = IORESOURCE_MEM, | ||
408 | }, | ||
409 | { | ||
410 | .start = INT_35XX_HECC0_IRQ, | ||
411 | .end = INT_35XX_HECC0_IRQ, | ||
412 | .flags = IORESOURCE_IRQ, | ||
413 | }, | ||
414 | }; | ||
415 | |||
416 | static struct platform_device am3517_hecc_device = { | ||
417 | .name = "ti_hecc", | ||
418 | .id = -1, | ||
419 | .num_resources = ARRAY_SIZE(am3517_hecc_resources), | ||
420 | .resource = am3517_hecc_resources, | ||
421 | }; | ||
422 | |||
423 | static struct ti_hecc_platform_data am3517_evm_hecc_pdata = { | ||
424 | .scc_hecc_offset = AM35XX_HECC_SCC_HECC_OFFSET, | ||
425 | .scc_ram_offset = AM35XX_HECC_SCC_RAM_OFFSET, | ||
426 | .hecc_ram_offset = AM35XX_HECC_RAM_OFFSET, | ||
427 | .mbx_offset = AM35XX_HECC_MBOX_OFFSET, | ||
428 | .int_line = AM35XX_HECC_INT_LINE, | ||
429 | .version = AM35XX_HECC_VERSION, | ||
430 | }; | ||
431 | |||
432 | static void am3517_evm_hecc_init(struct ti_hecc_platform_data *pdata) | ||
433 | { | ||
434 | am3517_hecc_device.dev.platform_data = pdata; | ||
435 | platform_device_register(&am3517_hecc_device); | ||
436 | } | ||
437 | |||
295 | static void __init am3517_evm_init(void) | 438 | static void __init am3517_evm_init(void) |
296 | { | 439 | { |
297 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 440 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
@@ -305,6 +448,7 @@ static void __init am3517_evm_init(void) | |||
305 | /* Configure GPIO for EHCI port */ | 448 | /* Configure GPIO for EHCI port */ |
306 | omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); | 449 | omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); |
307 | usb_ehci_init(&ehci_pdata); | 450 | usb_ehci_init(&ehci_pdata); |
451 | am3517_evm_hecc_init(&am3517_evm_hecc_pdata); | ||
308 | /* DSS */ | 452 | /* DSS */ |
309 | am3517_evm_display_init(); | 453 | am3517_evm_display_init(); |
310 | 454 | ||
@@ -313,6 +457,8 @@ static void __init am3517_evm_init(void) | |||
313 | 457 | ||
314 | i2c_register_board_info(1, am3517evm_i2c_boardinfo, | 458 | i2c_register_board_info(1, am3517evm_i2c_boardinfo, |
315 | ARRAY_SIZE(am3517evm_i2c_boardinfo)); | 459 | ARRAY_SIZE(am3517evm_i2c_boardinfo)); |
460 | /*Ethernet*/ | ||
461 | am3517_evm_ethernet_init(&am3517_evm_emac_pdata); | ||
316 | } | 462 | } |
317 | 463 | ||
318 | static void __init am3517_evm_map_io(void) | 464 | static void __init am3517_evm_map_io(void) |