2 * linux/arch/arm/mach-omap2/board-am3517evm.c
4 * Copyright (C) 2009 Texas Instruments Incorporated
5 * Author: Ranjith Lohithakshan <ranjithl@ti.com>
7 * Based on mach-omap2/board-omap3evm.c
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.
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.
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/gpio.h>
24 #include <mach/hardware.h>
25 #include <mach/am35xx.h>
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
30 #include <plat/board.h>
31 #include <plat/common.h>
33 #include <plat/display.h>
37 #define LCD_PANEL_PWR 176
38 #define LCD_PANEL_BKLIGHT_PWR 182
39 #define LCD_PANEL_PWM 181
41 static int lcd_enabled;
42 static int dvi_enabled;
44 static void __init am3517_evm_display_init(void)
48 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP);
49 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN);
50 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN);
52 * Enable GPIO 182 = LCD Backlight Power
54 r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
56 printk(KERN_ERR "failed to get lcd_backlight_pwr\n");
59 gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
61 * Enable GPIO 181 = LCD Panel PWM
63 r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
65 printk(KERN_ERR "failed to get lcd_pwm\n");
68 gpio_direction_output(LCD_PANEL_PWM, 1);
70 * Enable GPIO 176 = LCD Panel Power enable pin
72 r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
74 printk(KERN_ERR "failed to get lcd_panel_pwr\n");
77 gpio_direction_output(LCD_PANEL_PWR, 1);
79 printk(KERN_INFO "Display initialized successfully\n");
83 gpio_free(LCD_PANEL_PWM);
85 gpio_free(LCD_PANEL_BKLIGHT_PWR);
88 static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev)
91 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
94 gpio_set_value(LCD_PANEL_PWR, 1);
100 static void am3517_evm_panel_disable_lcd(struct omap_dss_device *dssdev)
102 gpio_set_value(LCD_PANEL_PWR, 0);
106 static struct omap_dss_device am3517_evm_lcd_device = {
107 .type = OMAP_DISPLAY_TYPE_DPI,
109 .driver_name = "sharp_lq_panel",
110 .phy.dpi.data_lines = 16,
111 .platform_enable = am3517_evm_panel_enable_lcd,
112 .platform_disable = am3517_evm_panel_disable_lcd,
115 static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev)
120 static void am3517_evm_panel_disable_tv(struct omap_dss_device *dssdev)
124 static struct omap_dss_device am3517_evm_tv_device = {
125 .type = OMAP_DISPLAY_TYPE_VENC,
127 .driver_name = "venc",
128 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
129 .platform_enable = am3517_evm_panel_enable_tv,
130 .platform_disable = am3517_evm_panel_disable_tv,
133 static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev)
136 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
144 static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
149 static struct omap_dss_device am3517_evm_dvi_device = {
150 .type = OMAP_DISPLAY_TYPE_DPI,
152 .driver_name = "generic_panel",
153 .phy.dpi.data_lines = 24,
154 .platform_enable = am3517_evm_panel_enable_dvi,
155 .platform_disable = am3517_evm_panel_disable_dvi,
158 static struct omap_dss_device *am3517_evm_dss_devices[] = {
159 &am3517_evm_lcd_device,
160 &am3517_evm_tv_device,
161 &am3517_evm_dvi_device,
164 static struct omap_dss_board_info am3517_evm_dss_data = {
165 .num_devices = ARRAY_SIZE(am3517_evm_dss_devices),
166 .devices = am3517_evm_dss_devices,
167 .default_device = &am3517_evm_lcd_device,
170 struct platform_device am3517_evm_dss_device = {
174 .platform_data = &am3517_evm_dss_data,
179 * Board initialization
181 static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
184 static struct platform_device *am3517_evm_devices[] __initdata = {
185 &am3517_evm_dss_device,
188 static void __init am3517_evm_init_irq(void)
190 omap_board_config = am3517_evm_config;
191 omap_board_config_size = ARRAY_SIZE(am3517_evm_config);
193 omap2_init_common_hw(NULL, NULL);
198 static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
199 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
200 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
201 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
204 .reset_gpio_port[0] = 57,
205 .reset_gpio_port[1] = -EINVAL,
206 .reset_gpio_port[2] = -EINVAL
209 #ifdef CONFIG_OMAP_MUX
210 static struct omap_board_mux board_mux[] __initdata = {
211 { .reg_offset = OMAP_MUX_TERMINATOR },
214 #define board_mux NULL
217 static void __init am3517_evm_init(void)
219 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
220 platform_add_devices(am3517_evm_devices,
221 ARRAY_SIZE(am3517_evm_devices));
224 usb_ehci_init(&ehci_pdata);
226 am3517_evm_display_init();
229 static void __init am3517_evm_map_io(void)
231 omap2_set_globals_343x();
232 omap34xx_map_common_io();
235 MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
236 .phys_io = 0x48000000,
237 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
238 .boot_params = 0x80000100,
239 .map_io = am3517_evm_map_io,
240 .init_irq = am3517_evm_init_irq,
241 .init_machine = am3517_evm_init,
242 .timer = &omap_timer,