netlink: Implment netlink_broadcast_filtered
[linux/fpc-iii.git] / arch / arm / mach-omap2 / board-am3517evm.c
blobc1c4389fbd8f5294d599943e338cf5d6ca748c40
1 /*
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>
23 #include <linux/i2c/pca953x.h>
25 #include <mach/hardware.h>
26 #include <mach/am35xx.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
31 #include <plat/board.h>
32 #include <plat/common.h>
33 #include <plat/usb.h>
34 #include <plat/display.h>
36 #include "mux.h"
38 #define LCD_PANEL_PWR 176
39 #define LCD_PANEL_BKLIGHT_PWR 182
40 #define LCD_PANEL_PWM 181
42 static struct i2c_board_info __initdata am3517evm_i2c_boardinfo[] = {
44 I2C_BOARD_INFO("s35390a", 0x30),
45 .type = "s35390a",
50 * RTC - S35390A
52 #define GPIO_RTCS35390A_IRQ 55
54 static void __init am3517_evm_rtc_init(void)
56 int r;
58 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP);
59 r = gpio_request(GPIO_RTCS35390A_IRQ, "rtcs35390a-irq");
60 if (r < 0) {
61 printk(KERN_WARNING "failed to request GPIO#%d\n",
62 GPIO_RTCS35390A_IRQ);
63 return;
65 r = gpio_direction_input(GPIO_RTCS35390A_IRQ);
66 if (r < 0) {
67 printk(KERN_WARNING "GPIO#%d cannot be configured as input\n",
68 GPIO_RTCS35390A_IRQ);
69 gpio_free(GPIO_RTCS35390A_IRQ);
70 return;
72 am3517evm_i2c_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
76 * I2C GPIO Expander - TCA6416
79 /* Mounted on Base-Board */
80 static struct pca953x_platform_data am3517evm_gpio_expander_info_0 = {
81 .gpio_base = OMAP_MAX_GPIO_LINES,
83 static struct i2c_board_info __initdata am3517evm_tca6416_info_0[] = {
85 I2C_BOARD_INFO("tca6416", 0x21),
86 .platform_data = &am3517evm_gpio_expander_info_0,
90 /* Mounted on UI Card */
91 static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_1 = {
92 .gpio_base = OMAP_MAX_GPIO_LINES + 16,
94 static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = {
95 .gpio_base = OMAP_MAX_GPIO_LINES + 32,
97 static struct i2c_board_info __initdata am3517evm_ui_tca6416_info[] = {
99 I2C_BOARD_INFO("tca6416", 0x20),
100 .platform_data = &am3517evm_ui_gpio_expander_info_1,
103 I2C_BOARD_INFO("tca6416", 0x21),
104 .platform_data = &am3517evm_ui_gpio_expander_info_2,
108 static int __init am3517_evm_i2c_init(void)
110 omap_register_i2c_bus(1, 400, NULL, 0);
111 omap_register_i2c_bus(2, 400, am3517evm_tca6416_info_0,
112 ARRAY_SIZE(am3517evm_tca6416_info_0));
113 omap_register_i2c_bus(3, 400, am3517evm_ui_tca6416_info,
114 ARRAY_SIZE(am3517evm_ui_tca6416_info));
116 return 0;
119 static int lcd_enabled;
120 static int dvi_enabled;
122 static void __init am3517_evm_display_init(void)
124 int r;
126 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP);
127 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN);
128 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN);
130 * Enable GPIO 182 = LCD Backlight Power
132 r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
133 if (r) {
134 printk(KERN_ERR "failed to get lcd_backlight_pwr\n");
135 return;
137 gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
139 * Enable GPIO 181 = LCD Panel PWM
141 r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
142 if (r) {
143 printk(KERN_ERR "failed to get lcd_pwm\n");
144 goto err_1;
146 gpio_direction_output(LCD_PANEL_PWM, 1);
148 * Enable GPIO 176 = LCD Panel Power enable pin
150 r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
151 if (r) {
152 printk(KERN_ERR "failed to get lcd_panel_pwr\n");
153 goto err_2;
155 gpio_direction_output(LCD_PANEL_PWR, 1);
157 printk(KERN_INFO "Display initialized successfully\n");
158 return;
160 err_2:
161 gpio_free(LCD_PANEL_PWM);
162 err_1:
163 gpio_free(LCD_PANEL_BKLIGHT_PWR);
166 static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev)
168 if (dvi_enabled) {
169 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
170 return -EINVAL;
172 gpio_set_value(LCD_PANEL_PWR, 1);
173 lcd_enabled = 1;
175 return 0;
178 static void am3517_evm_panel_disable_lcd(struct omap_dss_device *dssdev)
180 gpio_set_value(LCD_PANEL_PWR, 0);
181 lcd_enabled = 0;
184 static struct omap_dss_device am3517_evm_lcd_device = {
185 .type = OMAP_DISPLAY_TYPE_DPI,
186 .name = "lcd",
187 .driver_name = "sharp_lq_panel",
188 .phy.dpi.data_lines = 16,
189 .platform_enable = am3517_evm_panel_enable_lcd,
190 .platform_disable = am3517_evm_panel_disable_lcd,
193 static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev)
195 return 0;
198 static void am3517_evm_panel_disable_tv(struct omap_dss_device *dssdev)
202 static struct omap_dss_device am3517_evm_tv_device = {
203 .type = OMAP_DISPLAY_TYPE_VENC,
204 .name = "tv",
205 .driver_name = "venc",
206 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
207 .platform_enable = am3517_evm_panel_enable_tv,
208 .platform_disable = am3517_evm_panel_disable_tv,
211 static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev)
213 if (lcd_enabled) {
214 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
215 return -EINVAL;
217 dvi_enabled = 1;
219 return 0;
222 static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
224 dvi_enabled = 0;
227 static struct omap_dss_device am3517_evm_dvi_device = {
228 .type = OMAP_DISPLAY_TYPE_DPI,
229 .name = "dvi",
230 .driver_name = "generic_panel",
231 .phy.dpi.data_lines = 24,
232 .platform_enable = am3517_evm_panel_enable_dvi,
233 .platform_disable = am3517_evm_panel_disable_dvi,
236 static struct omap_dss_device *am3517_evm_dss_devices[] = {
237 &am3517_evm_lcd_device,
238 &am3517_evm_tv_device,
239 &am3517_evm_dvi_device,
242 static struct omap_dss_board_info am3517_evm_dss_data = {
243 .num_devices = ARRAY_SIZE(am3517_evm_dss_devices),
244 .devices = am3517_evm_dss_devices,
245 .default_device = &am3517_evm_lcd_device,
248 struct platform_device am3517_evm_dss_device = {
249 .name = "omapdss",
250 .id = -1,
251 .dev = {
252 .platform_data = &am3517_evm_dss_data,
257 * Board initialization
259 static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
262 static struct platform_device *am3517_evm_devices[] __initdata = {
263 &am3517_evm_dss_device,
266 static void __init am3517_evm_init_irq(void)
268 omap_board_config = am3517_evm_config;
269 omap_board_config_size = ARRAY_SIZE(am3517_evm_config);
271 omap2_init_common_hw(NULL, NULL);
272 omap_init_irq();
273 omap_gpio_init();
276 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
277 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
278 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
279 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
281 .phy_reset = true,
282 .reset_gpio_port[0] = 57,
283 .reset_gpio_port[1] = -EINVAL,
284 .reset_gpio_port[2] = -EINVAL
287 #ifdef CONFIG_OMAP_MUX
288 static struct omap_board_mux board_mux[] __initdata = {
289 { .reg_offset = OMAP_MUX_TERMINATOR },
291 #else
292 #define board_mux NULL
293 #endif
295 static void __init am3517_evm_init(void)
297 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
299 am3517_evm_i2c_init();
300 platform_add_devices(am3517_evm_devices,
301 ARRAY_SIZE(am3517_evm_devices));
303 omap_serial_init();
305 /* Configure GPIO for EHCI port */
306 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
307 usb_ehci_init(&ehci_pdata);
308 /* DSS */
309 am3517_evm_display_init();
311 /* RTC - S35390A */
312 am3517_evm_rtc_init();
314 i2c_register_board_info(1, am3517evm_i2c_boardinfo,
315 ARRAY_SIZE(am3517evm_i2c_boardinfo));
318 static void __init am3517_evm_map_io(void)
320 omap2_set_globals_343x();
321 omap34xx_map_common_io();
324 MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
325 .phys_io = 0x48000000,
326 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
327 .boot_params = 0x80000100,
328 .map_io = am3517_evm_map_io,
329 .init_irq = am3517_evm_init_irq,
330 .init_machine = am3517_evm_init,
331 .timer = &omap_timer,
332 MACHINE_END