Commit | Line | Data |
---|---|---|
53c5ec31 SMK |
1 | /* |
2 | * linux/arch/arm/mach-omap2/board-omap3evm.c | |
3 | * | |
4 | * Copyright (C) 2008 Texas Instruments | |
5 | * | |
6 | * Modified from mach-omap2/board-3430sdp.c | |
7 | * | |
8 | * Initial code: Syed Mohammed Khasim | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License version 2 as | |
12 | * published by the Free Software Foundation. | |
13 | */ | |
14 | ||
15 | #include <linux/kernel.h> | |
16 | #include <linux/init.h> | |
17 | #include <linux/platform_device.h> | |
18 | #include <linux/delay.h> | |
19 | #include <linux/err.h> | |
20 | #include <linux/clk.h> | |
21 | #include <linux/gpio.h> | |
22 | #include <linux/input.h> | |
6135434a | 23 | #include <linux/input/matrix_keypad.h> |
53c5ec31 | 24 | #include <linux/leds.h> |
562138a4 | 25 | #include <linux/interrupt.h> |
53c5ec31 SMK |
26 | |
27 | #include <linux/spi/spi.h> | |
28 | #include <linux/spi/ads7846.h> | |
ebeb53e1 | 29 | #include <linux/i2c/twl.h> |
e8e2ff46 | 30 | #include <linux/usb/otg.h> |
562138a4 | 31 | #include <linux/smsc911x.h> |
53c5ec31 | 32 | |
1a7ec135 MR |
33 | #include <linux/regulator/machine.h> |
34 | ||
53c5ec31 SMK |
35 | #include <mach/hardware.h> |
36 | #include <asm/mach-types.h> | |
37 | #include <asm/mach/arch.h> | |
38 | #include <asm/mach/map.h> | |
39 | ||
ce491cf8 | 40 | #include <plat/board.h> |
ce491cf8 TL |
41 | #include <plat/usb.h> |
42 | #include <plat/common.h> | |
43 | #include <plat/mcspi.h> | |
703e3061 | 44 | #include <plat/display.h> |
53c5ec31 | 45 | |
ca5742bd | 46 | #include "mux.h" |
53c5ec31 | 47 | #include "sdram-micron-mt46h32m32lf-6.h" |
d02a900b | 48 | #include "hsmmc.h" |
53c5ec31 SMK |
49 | |
50 | #define OMAP3_EVM_TS_GPIO 175 | |
e8e51d29 AKG |
51 | #define OMAP3_EVM_EHCI_VBUS 22 |
52 | #define OMAP3_EVM_EHCI_SELECT 61 | |
53c5ec31 SMK |
53 | |
54 | #define OMAP3EVM_ETHR_START 0x2c000000 | |
55 | #define OMAP3EVM_ETHR_SIZE 1024 | |
db408023 | 56 | #define OMAP3EVM_ETHR_ID_REV 0x50 |
53c5ec31 | 57 | #define OMAP3EVM_ETHR_GPIO_IRQ 176 |
562138a4 | 58 | #define OMAP3EVM_SMSC911X_CS 5 |
53c5ec31 | 59 | |
db408023 AKG |
60 | static u8 omap3_evm_version; |
61 | ||
62 | u8 get_omap3_evm_rev(void) | |
63 | { | |
64 | return omap3_evm_version; | |
65 | } | |
66 | EXPORT_SYMBOL(get_omap3_evm_rev); | |
67 | ||
68 | static void __init omap3_evm_get_revision(void) | |
69 | { | |
70 | void __iomem *ioaddr; | |
71 | unsigned int smsc_id; | |
72 | ||
73 | /* Ethernet PHY ID is stored at ID_REV register */ | |
74 | ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K); | |
75 | if (!ioaddr) | |
76 | return; | |
77 | smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000; | |
78 | iounmap(ioaddr); | |
79 | ||
80 | switch (smsc_id) { | |
81 | /*SMSC9115 chipset*/ | |
82 | case 0x01150000: | |
83 | omap3_evm_version = OMAP3EVM_BOARD_GEN_1; | |
84 | break; | |
85 | /*SMSC 9220 chipset*/ | |
86 | case 0x92200000: | |
87 | default: | |
88 | omap3_evm_version = OMAP3EVM_BOARD_GEN_2; | |
89 | } | |
90 | } | |
91 | ||
562138a4 S |
92 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
93 | static struct resource omap3evm_smsc911x_resources[] = { | |
53c5ec31 SMK |
94 | [0] = { |
95 | .start = OMAP3EVM_ETHR_START, | |
96 | .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1), | |
97 | .flags = IORESOURCE_MEM, | |
98 | }, | |
99 | [1] = { | |
100 | .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), | |
101 | .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), | |
562138a4 | 102 | .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW), |
53c5ec31 SMK |
103 | }, |
104 | }; | |
105 | ||
562138a4 S |
106 | static struct smsc911x_platform_config smsc911x_config = { |
107 | .phy_interface = PHY_INTERFACE_MODE_MII, | |
108 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | |
109 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | |
110 | .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), | |
111 | }; | |
112 | ||
113 | static struct platform_device omap3evm_smsc911x_device = { | |
114 | .name = "smsc911x", | |
53c5ec31 | 115 | .id = -1, |
562138a4 S |
116 | .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources), |
117 | .resource = &omap3evm_smsc911x_resources[0], | |
118 | .dev = { | |
119 | .platform_data = &smsc911x_config, | |
120 | }, | |
53c5ec31 SMK |
121 | }; |
122 | ||
562138a4 | 123 | static inline void __init omap3evm_init_smsc911x(void) |
53c5ec31 SMK |
124 | { |
125 | int eth_cs; | |
126 | struct clk *l3ck; | |
127 | unsigned int rate; | |
128 | ||
562138a4 | 129 | eth_cs = OMAP3EVM_SMSC911X_CS; |
53c5ec31 SMK |
130 | |
131 | l3ck = clk_get(NULL, "l3_ck"); | |
132 | if (IS_ERR(l3ck)) | |
133 | rate = 100000000; | |
134 | else | |
135 | rate = clk_get_rate(l3ck); | |
136 | ||
562138a4 S |
137 | if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) { |
138 | printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", | |
53c5ec31 SMK |
139 | OMAP3EVM_ETHR_GPIO_IRQ); |
140 | return; | |
141 | } | |
142 | ||
143 | gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); | |
562138a4 | 144 | platform_device_register(&omap3evm_smsc911x_device); |
53c5ec31 SMK |
145 | } |
146 | ||
562138a4 S |
147 | #else |
148 | static inline void __init omap3evm_init_smsc911x(void) { return; } | |
149 | #endif | |
150 | ||
703e3061 VH |
151 | /* |
152 | * OMAP3EVM LCD Panel control signals | |
153 | */ | |
154 | #define OMAP3EVM_LCD_PANEL_LR 2 | |
155 | #define OMAP3EVM_LCD_PANEL_UD 3 | |
156 | #define OMAP3EVM_LCD_PANEL_INI 152 | |
157 | #define OMAP3EVM_LCD_PANEL_ENVDD 153 | |
158 | #define OMAP3EVM_LCD_PANEL_QVGA 154 | |
159 | #define OMAP3EVM_LCD_PANEL_RESB 155 | |
160 | #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 | |
161 | #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 | |
162 | ||
163 | static int lcd_enabled; | |
164 | static int dvi_enabled; | |
165 | ||
166 | static void __init omap3_evm_display_init(void) | |
167 | { | |
168 | int r; | |
169 | ||
170 | r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb"); | |
171 | if (r) { | |
172 | printk(KERN_ERR "failed to get lcd_panel_resb\n"); | |
173 | return; | |
174 | } | |
175 | gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1); | |
176 | ||
177 | r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini"); | |
178 | if (r) { | |
179 | printk(KERN_ERR "failed to get lcd_panel_ini\n"); | |
180 | goto err_1; | |
181 | } | |
182 | gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1); | |
183 | ||
184 | r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga"); | |
185 | if (r) { | |
186 | printk(KERN_ERR "failed to get lcd_panel_qvga\n"); | |
187 | goto err_2; | |
188 | } | |
189 | gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0); | |
190 | ||
191 | r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr"); | |
192 | if (r) { | |
193 | printk(KERN_ERR "failed to get lcd_panel_lr\n"); | |
194 | goto err_3; | |
195 | } | |
196 | gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1); | |
197 | ||
198 | r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud"); | |
199 | if (r) { | |
200 | printk(KERN_ERR "failed to get lcd_panel_ud\n"); | |
201 | goto err_4; | |
202 | } | |
203 | gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1); | |
204 | ||
205 | r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd"); | |
206 | if (r) { | |
207 | printk(KERN_ERR "failed to get lcd_panel_envdd\n"); | |
208 | goto err_5; | |
209 | } | |
210 | gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0); | |
211 | ||
212 | return; | |
213 | ||
214 | err_5: | |
215 | gpio_free(OMAP3EVM_LCD_PANEL_UD); | |
216 | err_4: | |
217 | gpio_free(OMAP3EVM_LCD_PANEL_LR); | |
218 | err_3: | |
219 | gpio_free(OMAP3EVM_LCD_PANEL_QVGA); | |
220 | err_2: | |
221 | gpio_free(OMAP3EVM_LCD_PANEL_INI); | |
222 | err_1: | |
223 | gpio_free(OMAP3EVM_LCD_PANEL_RESB); | |
224 | ||
225 | } | |
226 | ||
227 | static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) | |
228 | { | |
229 | if (dvi_enabled) { | |
230 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | |
231 | return -EINVAL; | |
232 | } | |
233 | gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0); | |
234 | ||
235 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) | |
236 | gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); | |
237 | else | |
238 | gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); | |
239 | ||
240 | lcd_enabled = 1; | |
241 | return 0; | |
242 | } | |
243 | ||
244 | static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev) | |
245 | { | |
246 | gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1); | |
247 | ||
248 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) | |
249 | gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); | |
250 | else | |
251 | gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); | |
252 | ||
253 | lcd_enabled = 0; | |
254 | } | |
255 | ||
256 | static struct omap_dss_device omap3_evm_lcd_device = { | |
257 | .name = "lcd", | |
258 | .driver_name = "sharp_ls_panel", | |
259 | .type = OMAP_DISPLAY_TYPE_DPI, | |
260 | .phy.dpi.data_lines = 18, | |
261 | .platform_enable = omap3_evm_enable_lcd, | |
262 | .platform_disable = omap3_evm_disable_lcd, | |
263 | }; | |
264 | ||
265 | static int omap3_evm_enable_tv(struct omap_dss_device *dssdev) | |
266 | { | |
267 | return 0; | |
268 | } | |
269 | ||
270 | static void omap3_evm_disable_tv(struct omap_dss_device *dssdev) | |
271 | { | |
272 | } | |
273 | ||
274 | static struct omap_dss_device omap3_evm_tv_device = { | |
275 | .name = "tv", | |
276 | .driver_name = "venc", | |
277 | .type = OMAP_DISPLAY_TYPE_VENC, | |
278 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | |
279 | .platform_enable = omap3_evm_enable_tv, | |
280 | .platform_disable = omap3_evm_disable_tv, | |
281 | }; | |
282 | ||
283 | static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev) | |
284 | { | |
285 | if (lcd_enabled) { | |
286 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | |
287 | return -EINVAL; | |
288 | } | |
289 | ||
290 | gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 1); | |
291 | ||
292 | dvi_enabled = 1; | |
293 | return 0; | |
294 | } | |
295 | ||
296 | static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev) | |
297 | { | |
298 | gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 0); | |
299 | ||
300 | dvi_enabled = 0; | |
301 | } | |
302 | ||
303 | static struct omap_dss_device omap3_evm_dvi_device = { | |
304 | .name = "dvi", | |
305 | .driver_name = "generic_panel", | |
306 | .type = OMAP_DISPLAY_TYPE_DPI, | |
307 | .phy.dpi.data_lines = 24, | |
308 | .platform_enable = omap3_evm_enable_dvi, | |
309 | .platform_disable = omap3_evm_disable_dvi, | |
310 | }; | |
311 | ||
312 | static struct omap_dss_device *omap3_evm_dss_devices[] = { | |
313 | &omap3_evm_lcd_device, | |
314 | &omap3_evm_tv_device, | |
315 | &omap3_evm_dvi_device, | |
316 | }; | |
317 | ||
318 | static struct omap_dss_board_info omap3_evm_dss_data = { | |
319 | .num_devices = ARRAY_SIZE(omap3_evm_dss_devices), | |
320 | .devices = omap3_evm_dss_devices, | |
321 | .default_device = &omap3_evm_lcd_device, | |
322 | }; | |
323 | ||
324 | static struct platform_device omap3_evm_dss_device = { | |
325 | .name = "omapdss", | |
326 | .id = -1, | |
327 | .dev = { | |
328 | .platform_data = &omap3_evm_dss_data, | |
329 | }, | |
330 | }; | |
331 | ||
1a7ec135 MR |
332 | static struct regulator_consumer_supply omap3evm_vmmc1_supply = { |
333 | .supply = "vmmc", | |
334 | }; | |
335 | ||
336 | static struct regulator_consumer_supply omap3evm_vsim_supply = { | |
337 | .supply = "vmmc_aux", | |
338 | }; | |
339 | ||
340 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | |
341 | static struct regulator_init_data omap3evm_vmmc1 = { | |
342 | .constraints = { | |
343 | .min_uV = 1850000, | |
344 | .max_uV = 3150000, | |
345 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
346 | | REGULATOR_MODE_STANDBY, | |
347 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
348 | | REGULATOR_CHANGE_MODE | |
349 | | REGULATOR_CHANGE_STATUS, | |
350 | }, | |
351 | .num_consumer_supplies = 1, | |
352 | .consumer_supplies = &omap3evm_vmmc1_supply, | |
353 | }; | |
354 | ||
355 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ | |
356 | static struct regulator_init_data omap3evm_vsim = { | |
357 | .constraints = { | |
358 | .min_uV = 1800000, | |
359 | .max_uV = 3000000, | |
360 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
361 | | REGULATOR_MODE_STANDBY, | |
362 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
363 | | REGULATOR_CHANGE_MODE | |
364 | | REGULATOR_CHANGE_STATUS, | |
365 | }, | |
366 | .num_consumer_supplies = 1, | |
367 | .consumer_supplies = &omap3evm_vsim_supply, | |
368 | }; | |
369 | ||
68ff0423 | 370 | static struct omap2_hsmmc_info mmc[] = { |
53c5ec31 SMK |
371 | { |
372 | .mmc = 1, | |
373 | .wires = 4, | |
374 | .gpio_cd = -EINVAL, | |
375 | .gpio_wp = 63, | |
376 | }, | |
377 | {} /* Terminator */ | |
378 | }; | |
379 | ||
380 | static struct gpio_led gpio_leds[] = { | |
381 | { | |
382 | .name = "omap3evm::ledb", | |
383 | /* normally not visible (board underside) */ | |
384 | .default_trigger = "default-on", | |
385 | .gpio = -EINVAL, /* gets replaced */ | |
386 | .active_low = true, | |
387 | }, | |
388 | }; | |
389 | ||
390 | static struct gpio_led_platform_data gpio_led_info = { | |
391 | .leds = gpio_leds, | |
392 | .num_leds = ARRAY_SIZE(gpio_leds), | |
393 | }; | |
394 | ||
395 | static struct platform_device leds_gpio = { | |
396 | .name = "leds-gpio", | |
397 | .id = -1, | |
398 | .dev = { | |
399 | .platform_data = &gpio_led_info, | |
400 | }, | |
401 | }; | |
402 | ||
403 | ||
404 | static int omap3evm_twl_gpio_setup(struct device *dev, | |
405 | unsigned gpio, unsigned ngpio) | |
406 | { | |
407 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | |
4896e394 | 408 | omap_mux_init_gpio(63, OMAP_PIN_INPUT); |
53c5ec31 | 409 | mmc[0].gpio_cd = gpio + 0; |
68ff0423 | 410 | omap2_hsmmc_init(mmc); |
53c5ec31 | 411 | |
1a7ec135 MR |
412 | /* link regulators to MMC adapters */ |
413 | omap3evm_vmmc1_supply.dev = mmc[0].dev; | |
414 | omap3evm_vsim_supply.dev = mmc[0].dev; | |
415 | ||
53c5ec31 SMK |
416 | /* |
417 | * Most GPIOs are for USB OTG. Some are mostly sent to | |
418 | * the P2 connector; notably LEDA for the LCD backlight. | |
419 | */ | |
420 | ||
703e3061 VH |
421 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ |
422 | gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); | |
423 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | |
424 | ||
425 | /* gpio + 7 == DVI Enable */ | |
426 | gpio_request(gpio + 7, "EN_DVI"); | |
427 | gpio_direction_output(gpio + 7, 0); | |
428 | ||
53c5ec31 SMK |
429 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
430 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | |
431 | ||
432 | platform_device_register(&leds_gpio); | |
433 | ||
434 | return 0; | |
435 | } | |
436 | ||
437 | static struct twl4030_gpio_platform_data omap3evm_gpio_data = { | |
438 | .gpio_base = OMAP_MAX_GPIO_LINES, | |
439 | .irq_base = TWL4030_GPIO_IRQ_BASE, | |
440 | .irq_end = TWL4030_GPIO_IRQ_END, | |
441 | .use_leds = true, | |
442 | .setup = omap3evm_twl_gpio_setup, | |
443 | }; | |
444 | ||
445 | static struct twl4030_usb_data omap3evm_usb_data = { | |
446 | .usb_mode = T2_USB_MODE_ULPI, | |
447 | }; | |
448 | ||
4f543332 | 449 | static int board_keymap[] = { |
53c5ec31 | 450 | KEY(0, 0, KEY_LEFT), |
0621d756 SP |
451 | KEY(0, 1, KEY_DOWN), |
452 | KEY(0, 2, KEY_ENTER), | |
453 | KEY(0, 3, KEY_M), | |
454 | ||
455 | KEY(1, 0, KEY_RIGHT), | |
53c5ec31 | 456 | KEY(1, 1, KEY_UP), |
0621d756 SP |
457 | KEY(1, 2, KEY_I), |
458 | KEY(1, 3, KEY_N), | |
459 | ||
460 | KEY(2, 0, KEY_A), | |
461 | KEY(2, 1, KEY_E), | |
53c5ec31 | 462 | KEY(2, 2, KEY_J), |
0621d756 SP |
463 | KEY(2, 3, KEY_O), |
464 | ||
465 | KEY(3, 0, KEY_B), | |
466 | KEY(3, 1, KEY_F), | |
467 | KEY(3, 2, KEY_K), | |
53c5ec31 SMK |
468 | KEY(3, 3, KEY_P) |
469 | }; | |
470 | ||
4f543332 TL |
471 | static struct matrix_keymap_data board_map_data = { |
472 | .keymap = board_keymap, | |
473 | .keymap_size = ARRAY_SIZE(board_keymap), | |
474 | }; | |
475 | ||
53c5ec31 | 476 | static struct twl4030_keypad_data omap3evm_kp_data = { |
4f543332 | 477 | .keymap_data = &board_map_data, |
53c5ec31 SMK |
478 | .rows = 4, |
479 | .cols = 4, | |
53c5ec31 SMK |
480 | .rep = 1, |
481 | }; | |
482 | ||
483 | static struct twl4030_madc_platform_data omap3evm_madc_data = { | |
484 | .irq_line = 1, | |
485 | }; | |
486 | ||
e86fa0b4 PU |
487 | static struct twl4030_codec_audio_data omap3evm_audio_data = { |
488 | .audio_mclk = 26000000, | |
489 | }; | |
490 | ||
491 | static struct twl4030_codec_data omap3evm_codec_data = { | |
6df74efb | 492 | .audio_mclk = 26000000, |
e86fa0b4 PU |
493 | .audio = &omap3evm_audio_data, |
494 | }; | |
495 | ||
703e3061 VH |
496 | static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = { |
497 | .supply = "vdda_dac", | |
498 | .dev = &omap3_evm_dss_device.dev, | |
499 | }; | |
500 | ||
501 | /* VDAC for DSS driving S-Video */ | |
502 | static struct regulator_init_data omap3_evm_vdac = { | |
503 | .constraints = { | |
504 | .min_uV = 1800000, | |
505 | .max_uV = 1800000, | |
506 | .apply_uV = true, | |
507 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
508 | | REGULATOR_MODE_STANDBY, | |
509 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
510 | | REGULATOR_CHANGE_STATUS, | |
511 | }, | |
512 | .num_consumer_supplies = 1, | |
513 | .consumer_supplies = &omap3_evm_vdda_dac_supply, | |
514 | }; | |
515 | ||
516 | /* VPLL2 for digital video outputs */ | |
517 | static struct regulator_consumer_supply omap3_evm_vpll2_supply = { | |
518 | .supply = "vdvi", | |
519 | .dev = &omap3_evm_lcd_device.dev, | |
520 | }; | |
521 | ||
522 | static struct regulator_init_data omap3_evm_vpll2 = { | |
523 | .constraints = { | |
524 | .name = "VDVI", | |
525 | .min_uV = 1800000, | |
526 | .max_uV = 1800000, | |
527 | .apply_uV = true, | |
528 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
529 | | REGULATOR_MODE_STANDBY, | |
530 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
531 | | REGULATOR_CHANGE_STATUS, | |
532 | }, | |
533 | .num_consumer_supplies = 1, | |
534 | .consumer_supplies = &omap3_evm_vpll2_supply, | |
535 | }; | |
536 | ||
53c5ec31 SMK |
537 | static struct twl4030_platform_data omap3evm_twldata = { |
538 | .irq_base = TWL4030_IRQ_BASE, | |
539 | .irq_end = TWL4030_IRQ_END, | |
540 | ||
541 | /* platform_data for children goes here */ | |
542 | .keypad = &omap3evm_kp_data, | |
543 | .madc = &omap3evm_madc_data, | |
544 | .usb = &omap3evm_usb_data, | |
545 | .gpio = &omap3evm_gpio_data, | |
e86fa0b4 | 546 | .codec = &omap3evm_codec_data, |
703e3061 VH |
547 | .vdac = &omap3_evm_vdac, |
548 | .vpll2 = &omap3_evm_vpll2, | |
53c5ec31 SMK |
549 | }; |
550 | ||
551 | static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { | |
552 | { | |
553 | I2C_BOARD_INFO("twl4030", 0x48), | |
554 | .flags = I2C_CLIENT_WAKE, | |
555 | .irq = INT_34XX_SYS_NIRQ, | |
556 | .platform_data = &omap3evm_twldata, | |
557 | }, | |
558 | }; | |
559 | ||
560 | static int __init omap3_evm_i2c_init(void) | |
561 | { | |
1a7ec135 MR |
562 | /* |
563 | * REVISIT: These entries can be set in omap3evm_twl_data | |
564 | * after a merge with MFD tree | |
565 | */ | |
566 | omap3evm_twldata.vmmc1 = &omap3evm_vmmc1; | |
567 | omap3evm_twldata.vsim = &omap3evm_vsim; | |
568 | ||
53c5ec31 SMK |
569 | omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo, |
570 | ARRAY_SIZE(omap3evm_i2c_boardinfo)); | |
571 | omap_register_i2c_bus(2, 400, NULL, 0); | |
572 | omap_register_i2c_bus(3, 400, NULL, 0); | |
573 | return 0; | |
574 | } | |
575 | ||
53c5ec31 SMK |
576 | static void ads7846_dev_init(void) |
577 | { | |
578 | if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0) | |
579 | printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); | |
580 | ||
581 | gpio_direction_input(OMAP3_EVM_TS_GPIO); | |
582 | ||
583 | omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1); | |
584 | omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa); | |
585 | } | |
586 | ||
587 | static int ads7846_get_pendown_state(void) | |
588 | { | |
589 | return !gpio_get_value(OMAP3_EVM_TS_GPIO); | |
590 | } | |
591 | ||
592 | struct ads7846_platform_data ads7846_config = { | |
593 | .x_max = 0x0fff, | |
594 | .y_max = 0x0fff, | |
595 | .x_plate_ohms = 180, | |
596 | .pressure_max = 255, | |
597 | .debounce_max = 10, | |
598 | .debounce_tol = 3, | |
599 | .debounce_rep = 1, | |
600 | .get_pendown_state = ads7846_get_pendown_state, | |
601 | .keep_vref_on = 1, | |
602 | .settle_delay_usecs = 150, | |
7a44ad2f | 603 | .wakeup = true, |
53c5ec31 SMK |
604 | }; |
605 | ||
606 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | |
607 | .turbo_mode = 0, | |
608 | .single_channel = 1, /* 0: slave, 1: master */ | |
609 | }; | |
610 | ||
611 | struct spi_board_info omap3evm_spi_board_info[] = { | |
612 | [0] = { | |
613 | .modalias = "ads7846", | |
614 | .bus_num = 1, | |
615 | .chip_select = 0, | |
616 | .max_speed_hz = 1500000, | |
617 | .controller_data = &ads7846_mcspi_config, | |
618 | .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO), | |
619 | .platform_data = &ads7846_config, | |
620 | }, | |
621 | }; | |
622 | ||
b3c6df3a | 623 | static struct omap_board_config_kernel omap3_evm_config[] __initdata = { |
b3c6df3a PW |
624 | }; |
625 | ||
53c5ec31 SMK |
626 | static void __init omap3_evm_init_irq(void) |
627 | { | |
b3c6df3a PW |
628 | omap_board_config = omap3_evm_config; |
629 | omap_board_config_size = ARRAY_SIZE(omap3_evm_config); | |
58cda884 | 630 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL); |
53c5ec31 SMK |
631 | omap_init_irq(); |
632 | omap_gpio_init(); | |
53c5ec31 SMK |
633 | } |
634 | ||
53c5ec31 | 635 | static struct platform_device *omap3_evm_devices[] __initdata = { |
703e3061 | 636 | &omap3_evm_dss_device, |
53c5ec31 SMK |
637 | }; |
638 | ||
6f69a181 | 639 | static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = { |
58a5491c FB |
640 | |
641 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, | |
642 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | |
643 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | |
644 | ||
645 | .phy_reset = true, | |
e8e51d29 | 646 | /* PHY reset GPIO will be runtime programmed based on EVM version */ |
58a5491c | 647 | .reset_gpio_port[0] = -EINVAL, |
e8e51d29 | 648 | .reset_gpio_port[1] = -EINVAL, |
58a5491c FB |
649 | .reset_gpio_port[2] = -EINVAL |
650 | }; | |
651 | ||
ca5742bd TL |
652 | #ifdef CONFIG_OMAP_MUX |
653 | static struct omap_board_mux board_mux[] __initdata = { | |
aa6912d8 | 654 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP | |
f3a8cde6 | 655 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
aa6912d8 | 656 | OMAP_PIN_OFF_WAKEUPENABLE), |
87520aae | 657 | OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
7a44ad2f | 658 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW), |
ca5742bd TL |
659 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
660 | }; | |
661 | #else | |
662 | #define board_mux NULL | |
663 | #endif | |
664 | ||
884b8369 MM |
665 | static struct omap_musb_board_data musb_board_data = { |
666 | .interface_type = MUSB_INTERFACE_ULPI, | |
667 | .mode = MUSB_OTG, | |
668 | .power = 100, | |
669 | }; | |
670 | ||
53c5ec31 SMK |
671 | static void __init omap3_evm_init(void) |
672 | { | |
db408023 | 673 | omap3_evm_get_revision(); |
ca5742bd | 674 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
db408023 | 675 | |
53c5ec31 SMK |
676 | omap3_evm_i2c_init(); |
677 | ||
678 | platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); | |
53c5ec31 SMK |
679 | |
680 | spi_register_board_info(omap3evm_spi_board_info, | |
681 | ARRAY_SIZE(omap3evm_spi_board_info)); | |
682 | ||
683 | omap_serial_init(); | |
1a4f4637 | 684 | |
e8e2ff46 GAK |
685 | /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ |
686 | usb_nop_xceiv_register(); | |
1a4f4637 | 687 | |
e8e51d29 AKG |
688 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { |
689 | /* enable EHCI VBUS using GPIO22 */ | |
4896e394 | 690 | omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); |
e8e51d29 AKG |
691 | gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); |
692 | gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); | |
693 | gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); | |
694 | ||
695 | /* Select EHCI port on main board */ | |
4896e394 | 696 | omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); |
e8e51d29 AKG |
697 | gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); |
698 | gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); | |
699 | gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); | |
700 | ||
701 | /* setup EHCI phy reset config */ | |
4896e394 | 702 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); |
e8e51d29 AKG |
703 | ehci_pdata.reset_gpio_port[1] = 21; |
704 | ||
705 | } else { | |
706 | /* setup EHCI phy reset on MDC */ | |
4896e394 | 707 | omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); |
e8e51d29 AKG |
708 | ehci_pdata.reset_gpio_port[1] = 135; |
709 | } | |
884b8369 | 710 | usb_musb_init(&musb_board_data); |
58a5491c | 711 | usb_ehci_init(&ehci_pdata); |
53c5ec31 | 712 | ads7846_dev_init(); |
562138a4 | 713 | omap3evm_init_smsc911x(); |
703e3061 | 714 | omap3_evm_display_init(); |
53c5ec31 SMK |
715 | } |
716 | ||
717 | static void __init omap3_evm_map_io(void) | |
718 | { | |
719 | omap2_set_globals_343x(); | |
6fbd55d0 | 720 | omap34xx_map_common_io(); |
53c5ec31 SMK |
721 | } |
722 | ||
723 | MACHINE_START(OMAP3EVM, "OMAP3 EVM") | |
724 | /* Maintainer: Syed Mohammed Khasim - Texas Instruments */ | |
725 | .phys_io = 0x48000000, | |
b4224b23 | 726 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
53c5ec31 SMK |
727 | .boot_params = 0x80000100, |
728 | .map_io = omap3_evm_map_io, | |
729 | .init_irq = omap3_evm_init_irq, | |
730 | .init_machine = omap3_evm_init, | |
731 | .timer = &omap_timer, | |
732 | MACHINE_END |