diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-am3517evm.c')
-rw-r--r-- | arch/arm/mach-omap2/board-am3517evm.c | 237 |
1 files changed, 236 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index b4e6eca0e8a9..70c18614773c 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -20,8 +20,10 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
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 | 24 | ||
24 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | #include <mach/am35xx.h> | ||
25 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
26 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
27 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
@@ -29,9 +31,228 @@ | |||
29 | #include <plat/board.h> | 31 | #include <plat/board.h> |
30 | #include <plat/common.h> | 32 | #include <plat/common.h> |
31 | #include <plat/usb.h> | 33 | #include <plat/usb.h> |
34 | #include <plat/display.h> | ||
32 | 35 | ||
33 | #include "mux.h" | 36 | #include "mux.h" |
34 | 37 | ||
38 | #define LCD_PANEL_PWR 176 | ||
39 | #define LCD_PANEL_BKLIGHT_PWR 182 | ||
40 | #define LCD_PANEL_PWM 181 | ||
41 | |||
42 | static struct i2c_board_info __initdata am3517evm_i2c_boardinfo[] = { | ||
43 | { | ||
44 | I2C_BOARD_INFO("s35390a", 0x30), | ||
45 | .type = "s35390a", | ||
46 | }, | ||
47 | }; | ||
48 | |||
49 | /* | ||
50 | * RTC - S35390A | ||
51 | */ | ||
52 | #define GPIO_RTCS35390A_IRQ 55 | ||
53 | |||
54 | static void __init am3517_evm_rtc_init(void) | ||
55 | { | ||
56 | int r; | ||
57 | |||
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; | ||
64 | } | ||
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; | ||
71 | } | ||
72 | am3517evm_i2c_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ); | ||
73 | } | ||
74 | |||
75 | /* | ||
76 | * I2C GPIO Expander - TCA6416 | ||
77 | */ | ||
78 | |||
79 | /* Mounted on Base-Board */ | ||
80 | static struct pca953x_platform_data am3517evm_gpio_expander_info_0 = { | ||
81 | .gpio_base = OMAP_MAX_GPIO_LINES, | ||
82 | }; | ||
83 | static struct i2c_board_info __initdata am3517evm_tca6416_info_0[] = { | ||
84 | { | ||
85 | I2C_BOARD_INFO("tca6416", 0x21), | ||
86 | .platform_data = &am3517evm_gpio_expander_info_0, | ||
87 | }, | ||
88 | }; | ||
89 | |||
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, | ||
93 | }; | ||
94 | static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = { | ||
95 | .gpio_base = OMAP_MAX_GPIO_LINES + 32, | ||
96 | }; | ||
97 | static struct i2c_board_info __initdata am3517evm_ui_tca6416_info[] = { | ||
98 | { | ||
99 | I2C_BOARD_INFO("tca6416", 0x20), | ||
100 | .platform_data = &am3517evm_ui_gpio_expander_info_1, | ||
101 | }, | ||
102 | { | ||
103 | I2C_BOARD_INFO("tca6416", 0x21), | ||
104 | .platform_data = &am3517evm_ui_gpio_expander_info_2, | ||
105 | }, | ||
106 | }; | ||
107 | |||
108 | static int __init am3517_evm_i2c_init(void) | ||
109 | { | ||
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)); | ||
115 | |||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | static int lcd_enabled; | ||
120 | static int dvi_enabled; | ||
121 | |||
122 | static void __init am3517_evm_display_init(void) | ||
123 | { | ||
124 | int r; | ||
125 | |||
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); | ||
129 | /* | ||
130 | * Enable GPIO 182 = LCD Backlight Power | ||
131 | */ | ||
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; | ||
136 | } | ||
137 | gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1); | ||
138 | /* | ||
139 | * Enable GPIO 181 = LCD Panel PWM | ||
140 | */ | ||
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; | ||
145 | } | ||
146 | gpio_direction_output(LCD_PANEL_PWM, 1); | ||
147 | /* | ||
148 | * Enable GPIO 176 = LCD Panel Power enable pin | ||
149 | */ | ||
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; | ||
154 | } | ||
155 | gpio_direction_output(LCD_PANEL_PWR, 1); | ||
156 | |||
157 | printk(KERN_INFO "Display initialized successfully\n"); | ||
158 | return; | ||
159 | |||
160 | err_2: | ||
161 | gpio_free(LCD_PANEL_PWM); | ||
162 | err_1: | ||
163 | gpio_free(LCD_PANEL_BKLIGHT_PWR); | ||
164 | } | ||
165 | |||
166 | static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
167 | { | ||
168 | if (dvi_enabled) { | ||
169 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | ||
170 | return -EINVAL; | ||
171 | } | ||
172 | gpio_set_value(LCD_PANEL_PWR, 1); | ||
173 | lcd_enabled = 1; | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static void am3517_evm_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
179 | { | ||
180 | gpio_set_value(LCD_PANEL_PWR, 0); | ||
181 | lcd_enabled = 0; | ||
182 | } | ||
183 | |||
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, | ||
191 | }; | ||
192 | |||
193 | static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev) | ||
194 | { | ||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static void am3517_evm_panel_disable_tv(struct omap_dss_device *dssdev) | ||
199 | { | ||
200 | } | ||
201 | |||
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, | ||
209 | }; | ||
210 | |||
211 | static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev) | ||
212 | { | ||
213 | if (lcd_enabled) { | ||
214 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | ||
215 | return -EINVAL; | ||
216 | } | ||
217 | dvi_enabled = 1; | ||
218 | |||
219 | return 0; | ||
220 | } | ||
221 | |||
222 | static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev) | ||
223 | { | ||
224 | dvi_enabled = 0; | ||
225 | } | ||
226 | |||
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, | ||
234 | }; | ||
235 | |||
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, | ||
240 | }; | ||
241 | |||
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, | ||
246 | }; | ||
247 | |||
248 | struct platform_device am3517_evm_dss_device = { | ||
249 | .name = "omapdss", | ||
250 | .id = -1, | ||
251 | .dev = { | ||
252 | .platform_data = &am3517_evm_dss_data, | ||
253 | }, | ||
254 | }; | ||
255 | |||
35 | /* | 256 | /* |
36 | * Board initialization | 257 | * Board initialization |
37 | */ | 258 | */ |
@@ -39,6 +260,7 @@ static struct omap_board_config_kernel am3517_evm_config[] __initdata = { | |||
39 | }; | 260 | }; |
40 | 261 | ||
41 | static struct platform_device *am3517_evm_devices[] __initdata = { | 262 | static struct platform_device *am3517_evm_devices[] __initdata = { |
263 | &am3517_evm_dss_device, | ||
42 | }; | 264 | }; |
43 | 265 | ||
44 | static void __init am3517_evm_init_irq(void) | 266 | static void __init am3517_evm_init_irq(void) |
@@ -72,18 +294,31 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
72 | 294 | ||
73 | static void __init am3517_evm_init(void) | 295 | static void __init am3517_evm_init(void) |
74 | { | 296 | { |
297 | am3517_evm_i2c_init(); | ||
298 | |||
75 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 299 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
76 | platform_add_devices(am3517_evm_devices, | 300 | platform_add_devices(am3517_evm_devices, |
77 | ARRAY_SIZE(am3517_evm_devices)); | 301 | ARRAY_SIZE(am3517_evm_devices)); |
78 | 302 | ||
79 | omap_serial_init(); | 303 | omap_serial_init(); |
304 | |||
305 | /* Configure GPIO for EHCI port */ | ||
306 | omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); | ||
80 | usb_ehci_init(&ehci_pdata); | 307 | usb_ehci_init(&ehci_pdata); |
308 | /* DSS */ | ||
309 | am3517_evm_display_init(); | ||
310 | |||
311 | /* RTC - S35390A */ | ||
312 | am3517_evm_rtc_init(); | ||
313 | |||
314 | i2c_register_board_info(1, am3517evm_i2c_boardinfo, | ||
315 | ARRAY_SIZE(am3517evm_i2c_boardinfo)); | ||
81 | } | 316 | } |
82 | 317 | ||
83 | static void __init am3517_evm_map_io(void) | 318 | static void __init am3517_evm_map_io(void) |
84 | { | 319 | { |
85 | omap2_set_globals_343x(); | 320 | omap2_set_globals_343x(); |
86 | omap2_map_common_io(); | 321 | omap34xx_map_common_io(); |
87 | } | 322 | } |
88 | 323 | ||
89 | MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM") | 324 | MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM") |