usb: Fix linker errors with CONFIG_PM=n
[deliverable/linux.git] / arch / arm / mach-omap2 / board-am3517evm.c
CommitLineData
c625327e
RL
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
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/gpio.h>
5d4292a5 23#include <linux/i2c/pca953x.h>
91733631 24#include <linux/can/platform/ti_hecc.h>
56881d28 25#include <linux/davinci_emac.h>
c625327e
RL
26
27#include <mach/hardware.h>
e3d4d0a2 28#include <mach/am35xx.h>
c625327e
RL
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32
33#include <plat/board.h>
34#include <plat/common.h>
56881d28 35#include <plat/control.h>
c625327e 36#include <plat/usb.h>
c3d33329 37#include <plat/display.h>
c625327e 38
ca5742bd
TL
39#include "mux.h"
40
56881d28
S
41#define AM35XX_EVM_PHY_MASK (0xF)
42#define AM35XX_EVM_MDIO_FREQUENCY (1000000)
43
44static 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
50static 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
78static 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
85static 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
98static 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
109void 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
c3d33329
VH
135#define LCD_PANEL_PWR 176
136#define LCD_PANEL_BKLIGHT_PWR 182
137#define LCD_PANEL_PWM 181
138
b91da669 139static struct i2c_board_info __initdata am3517evm_i2c1_boardinfo[] = {
f2afbbb8
VH
140 {
141 I2C_BOARD_INFO("s35390a", 0x30),
142 .type = "s35390a",
143 },
144};
145
146/*
147 * RTC - S35390A
148 */
149#define GPIO_RTCS35390A_IRQ 55
150
151static void __init am3517_evm_rtc_init(void)
152{
153 int r;
154
155 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP);
156 r = gpio_request(GPIO_RTCS35390A_IRQ, "rtcs35390a-irq");
157 if (r < 0) {
158 printk(KERN_WARNING "failed to request GPIO#%d\n",
159 GPIO_RTCS35390A_IRQ);
160 return;
161 }
162 r = gpio_direction_input(GPIO_RTCS35390A_IRQ);
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 }
b91da669 169 am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
f2afbbb8
VH
170}
171
5d4292a5
VH
172/*
173 * I2C GPIO Expander - TCA6416
174 */
175
176/* Mounted on Base-Board */
177static struct pca953x_platform_data am3517evm_gpio_expander_info_0 = {
178 .gpio_base = OMAP_MAX_GPIO_LINES,
179};
b91da669 180static struct i2c_board_info __initdata am3517evm_i2c2_boardinfo[] = {
5d4292a5
VH
181 {
182 I2C_BOARD_INFO("tca6416", 0x21),
183 .platform_data = &am3517evm_gpio_expander_info_0,
184 },
185};
186
187/* Mounted on UI Card */
188static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_1 = {
189 .gpio_base = OMAP_MAX_GPIO_LINES + 16,
190};
191static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = {
192 .gpio_base = OMAP_MAX_GPIO_LINES + 32,
193};
b91da669 194static struct i2c_board_info __initdata am3517evm_i2c3_boardinfo[] = {
5d4292a5
VH
195 {
196 I2C_BOARD_INFO("tca6416", 0x20),
197 .platform_data = &am3517evm_ui_gpio_expander_info_1,
198 },
199 {
200 I2C_BOARD_INFO("tca6416", 0x21),
201 .platform_data = &am3517evm_ui_gpio_expander_info_2,
202 },
203};
204
1f738dc3
VH
205static int __init am3517_evm_i2c_init(void)
206{
207 omap_register_i2c_bus(1, 400, NULL, 0);
b91da669 208 omap_register_i2c_bus(2, 400, am3517evm_i2c2_boardinfo,
209 ARRAY_SIZE(am3517evm_i2c2_boardinfo));
210 omap_register_i2c_bus(3, 400, am3517evm_i2c3_boardinfo,
211 ARRAY_SIZE(am3517evm_i2c3_boardinfo));
1f738dc3
VH
212
213 return 0;
214}
215
c3d33329
VH
216static int lcd_enabled;
217static int dvi_enabled;
218
de997718
AKG
219#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
220 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE)
c3d33329
VH
221static void __init am3517_evm_display_init(void)
222{
223 int r;
224
225 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP);
226 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN);
227 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN);
228 /*
229 * Enable GPIO 182 = LCD Backlight Power
230 */
231 r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
232 if (r) {
233 printk(KERN_ERR "failed to get lcd_backlight_pwr\n");
234 return;
235 }
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
256 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}
de997718
AKG
264#else
265static void __init am3517_evm_display_init(void) {}
266#endif
c3d33329
VH
267
268static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev)
269{
270 if (dvi_enabled) {
271 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
272 return -EINVAL;
273 }
274 gpio_set_value(LCD_PANEL_PWR, 1);
275 lcd_enabled = 1;
276
277 return 0;
278}
279
280static void am3517_evm_panel_disable_lcd(struct omap_dss_device *dssdev)
281{
282 gpio_set_value(LCD_PANEL_PWR, 0);
283 lcd_enabled = 0;
284}
285
286static struct omap_dss_device am3517_evm_lcd_device = {
287 .type = OMAP_DISPLAY_TYPE_DPI,
288 .name = "lcd",
289 .driver_name = "sharp_lq_panel",
290 .phy.dpi.data_lines = 16,
291 .platform_enable = am3517_evm_panel_enable_lcd,
292 .platform_disable = am3517_evm_panel_disable_lcd,
293};
294
295static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev)
296{
297 return 0;
298}
299
300static void am3517_evm_panel_disable_tv(struct omap_dss_device *dssdev)
301{
302}
303
304static struct omap_dss_device am3517_evm_tv_device = {
305 .type = OMAP_DISPLAY_TYPE_VENC,
306 .name = "tv",
307 .driver_name = "venc",
308 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
309 .platform_enable = am3517_evm_panel_enable_tv,
310 .platform_disable = am3517_evm_panel_disable_tv,
311};
312
313static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev)
314{
315 if (lcd_enabled) {
316 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
317 return -EINVAL;
318 }
319 dvi_enabled = 1;
320
321 return 0;
322}
323
324static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
325{
326 dvi_enabled = 0;
327}
328
329static struct omap_dss_device am3517_evm_dvi_device = {
330 .type = OMAP_DISPLAY_TYPE_DPI,
331 .name = "dvi",
332 .driver_name = "generic_panel",
333 .phy.dpi.data_lines = 24,
334 .platform_enable = am3517_evm_panel_enable_dvi,
335 .platform_disable = am3517_evm_panel_disable_dvi,
336};
337
338static struct omap_dss_device *am3517_evm_dss_devices[] = {
339 &am3517_evm_lcd_device,
340 &am3517_evm_tv_device,
341 &am3517_evm_dvi_device,
342};
343
344static struct omap_dss_board_info am3517_evm_dss_data = {
345 .num_devices = ARRAY_SIZE(am3517_evm_dss_devices),
346 .devices = am3517_evm_dss_devices,
347 .default_device = &am3517_evm_lcd_device,
348};
349
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
c625327e
RL
358/*
359 * Board initialization
360 */
361static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
362};
363
364static struct platform_device *am3517_evm_devices[] __initdata = {
c3d33329 365 &am3517_evm_dss_device,
c625327e
RL
366};
367
368static void __init am3517_evm_init_irq(void)
369{
370 omap_board_config = am3517_evm_config;
371 omap_board_config_size = ARRAY_SIZE(am3517_evm_config);
372
373 omap2_init_common_hw(NULL, NULL);
374 omap_init_irq();
375 omap_gpio_init();
376}
377
6f69a181 378static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
c625327e 379 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
de997718
AKG
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
c625327e 384 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
de997718 385#endif
c625327e
RL
386 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
387
388 .phy_reset = true,
389 .reset_gpio_port[0] = 57,
390 .reset_gpio_port[1] = -EINVAL,
391 .reset_gpio_port[2] = -EINVAL
392};
393
ca5742bd
TL
394#ifdef CONFIG_OMAP_MUX
395static struct omap_board_mux board_mux[] __initdata = {
396 { .reg_offset = OMAP_MUX_TERMINATOR },
397};
398#else
399#define board_mux NULL
400#endif
401
91733631
S
402
403static 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
416static 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
423static 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
432static 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
c625327e
RL
438static void __init am3517_evm_init(void)
439{
ca5742bd 440 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
5241b6b3 441
442 am3517_evm_i2c_init();
c625327e
RL
443 platform_add_devices(am3517_evm_devices,
444 ARRAY_SIZE(am3517_evm_devices));
445
446 omap_serial_init();
fec3eebd
AKG
447
448 /* Configure GPIO for EHCI port */
449 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
c625327e 450 usb_ehci_init(&ehci_pdata);
91733631 451 am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
c3d33329
VH
452 /* DSS */
453 am3517_evm_display_init();
f2afbbb8
VH
454
455 /* RTC - S35390A */
456 am3517_evm_rtc_init();
457
b91da669 458 i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
459 ARRAY_SIZE(am3517evm_i2c1_boardinfo));
56881d28
S
460 /*Ethernet*/
461 am3517_evm_ethernet_init(&am3517_evm_emac_pdata);
c625327e
RL
462}
463
c625327e
RL
464MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
465 .phys_io = 0x48000000,
466 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
467 .boot_params = 0x80000100,
869fef41 468 .map_io = omap3_map_io,
71ee7dad 469 .reserve = omap_reserve,
c625327e
RL
470 .init_irq = am3517_evm_init_irq,
471 .init_machine = am3517_evm_init,
472 .timer = &omap_timer,
473MACHINE_END
This page took 0.121224 seconds and 5 git commands to generate.