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 <asm/mach-types.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
29 #include <plat/board.h>
30 #include <plat/common.h>
32 #include <plat/display.h>
36 #define LCD_PANEL_PWR 176
37 #define LCD_PANEL_BKLIGHT_PWR 182
38 #define LCD_PANEL_PWM 181
40 static int lcd_enabled;
41 static int dvi_enabled;
43 static void __init am3517_evm_display_init(void)
47 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP);
48 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN);
49 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN);
51 * Enable GPIO 182 = LCD Backlight Power
53 r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
55 printk(KERN_ERR "failed to get lcd_backlight_pwr\n");
58 gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
60 * Enable GPIO 181 = LCD Panel PWM
62 r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
64 printk(KERN_ERR "failed to get lcd_pwm\n");
67 gpio_direction_output(LCD_PANEL_PWM, 1);
69 * Enable GPIO 176 = LCD Panel Power enable pin
71 r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
73 printk(KERN_ERR "failed to get lcd_panel_pwr\n");
76 gpio_direction_output(LCD_PANEL_PWR, 1);
78 printk(KERN_INFO "Display initialized successfully\n");
82 gpio_free(LCD_PANEL_PWM);
84 gpio_free(LCD_PANEL_BKLIGHT_PWR);
87 static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev)
90 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
93 gpio_set_value(LCD_PANEL_PWR, 1);
99 static void am3517_evm_panel_disable_lcd(struct omap_dss_device *dssdev)
101 gpio_set_value(LCD_PANEL_PWR, 0);
105 static struct omap_dss_device am3517_evm_lcd_device = {
106 .type = OMAP_DISPLAY_TYPE_DPI,
108 .driver_name = "sharp_lq_panel",
109 .phy.dpi.data_lines = 16,
110 .platform_enable = am3517_evm_panel_enable_lcd,
111 .platform_disable = am3517_evm_panel_disable_lcd,
114 static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev)
119 static void am3517_evm_panel_disable_tv(struct omap_dss_device *dssdev)
123 static struct omap_dss_device am3517_evm_tv_device = {
124 .type = OMAP_DISPLAY_TYPE_VENC,
126 .driver_name = "venc",
127 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
128 .platform_enable = am3517_evm_panel_enable_tv,
129 .platform_disable = am3517_evm_panel_disable_tv,
132 static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev)
135 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
143 static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
148 static struct omap_dss_device am3517_evm_dvi_device = {
149 .type = OMAP_DISPLAY_TYPE_DPI,
151 .driver_name = "generic_panel",
152 .phy.dpi.data_lines = 24,
153 .platform_enable = am3517_evm_panel_enable_dvi,
154 .platform_disable = am3517_evm_panel_disable_dvi,
157 static struct omap_dss_device *am3517_evm_dss_devices[] = {
158 &am3517_evm_lcd_device,
159 &am3517_evm_tv_device,
160 &am3517_evm_dvi_device,
163 static struct omap_dss_board_info am3517_evm_dss_data = {
164 .num_devices = ARRAY_SIZE(am3517_evm_dss_devices),
165 .devices = am3517_evm_dss_devices,
166 .default_device = &am3517_evm_lcd_device,
169 struct platform_device am3517_evm_dss_device = {
173 .platform_data = &am3517_evm_dss_data,
178 * Board initialization
180 static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
183 static struct platform_device *am3517_evm_devices[] __initdata = {
184 &am3517_evm_dss_device,
187 static void __init am3517_evm_init_irq(void)
189 omap_board_config = am3517_evm_config;
190 omap_board_config_size = ARRAY_SIZE(am3517_evm_config);
192 omap2_init_common_hw(NULL, NULL);
197 static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
198 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
199 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
200 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
203 .reset_gpio_port[0] = 57,
204 .reset_gpio_port[1] = -EINVAL,
205 .reset_gpio_port[2] = -EINVAL
208 #ifdef CONFIG_OMAP_MUX
209 static struct omap_board_mux board_mux[] __initdata = {
210 { .reg_offset = OMAP_MUX_TERMINATOR },
213 #define board_mux NULL
216 static void __init am3517_evm_init(void)
218 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
219 platform_add_devices(am3517_evm_devices,
220 ARRAY_SIZE(am3517_evm_devices));
223 usb_ehci_init(&ehci_pdata);
225 am3517_evm_display_init();
228 static void __init am3517_evm_map_io(void)
230 omap2_set_globals_343x();
231 omap2_map_common_io();
234 MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
235 .phys_io = 0x48000000,
236 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
237 .boot_params = 0x80000100,
238 .map_io = am3517_evm_map_io,
239 .init_irq = am3517_evm_init_irq,
240 .init_machine = am3517_evm_init,
241 .timer = &omap_timer,