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