Commit | Line | Data |
---|---|---|
9cbc3493 J |
1 | /* |
2 | * linux/arch/arm/mach-omap2/board-omap3evm.c | |
3 | * | |
4 | * Copyright (C) 2008 Guangzhou EMA-Tech | |
5 | * | |
6 | * Modified from mach-omap2/board-omap3evm.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/io.h> | |
22 | #include <linux/leds.h> | |
23 | #include <linux/gpio.h> | |
24 | #include <linux/input.h> | |
25 | #include <linux/gpio_keys.h> | |
26 | ||
27 | #include <linux/regulator/machine.h> | |
28 | #include <linux/i2c/twl.h> | |
29 | ||
30 | #include <mach/hardware.h> | |
31 | #include <asm/mach-types.h> | |
32 | #include <asm/mach/arch.h> | |
33 | #include <asm/mach/map.h> | |
34 | #include <asm/mach/flash.h> | |
35 | ||
36 | #include <plat/board.h> | |
37 | #include <plat/common.h> | |
38 | #include <plat/gpmc.h> | |
39 | #include <plat/nand.h> | |
40 | #include <plat/usb.h> | |
41 | #include <plat/timer-gp.h> | |
42 | #include <plat/display.h> | |
43 | ||
44 | #include <plat/mcspi.h> | |
45 | #include <linux/input/matrix_keypad.h> | |
46 | #include <linux/spi/spi.h> | |
47 | #include <linux/spi/ads7846.h> | |
48 | #include <linux/interrupt.h> | |
49 | #include <linux/smsc911x.h> | |
50 | #include <linux/i2c/at24.h> | |
51 | ||
52 | #include "sdram-micron-mt46h32m32lf-6.h" | |
53 | #include "mux.h" | |
54 | #include "hsmmc.h" | |
55 | ||
56 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | |
57 | #define OMAP3STALKER_ETHR_START 0x2c000000 | |
58 | #define OMAP3STALKER_ETHR_SIZE 1024 | |
59 | #define OMAP3STALKER_ETHR_GPIO_IRQ 19 | |
60 | #define OMAP3STALKER_SMC911X_CS 5 | |
61 | ||
62 | static struct resource omap3stalker_smsc911x_resources[] = { | |
63 | [0] = { | |
64 | .start = OMAP3STALKER_ETHR_START, | |
65 | .end = | |
66 | (OMAP3STALKER_ETHR_START + OMAP3STALKER_ETHR_SIZE - 1), | |
67 | .flags = IORESOURCE_MEM, | |
68 | }, | |
69 | [1] = { | |
70 | .start = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ), | |
71 | .end = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ), | |
72 | .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW), | |
73 | }, | |
74 | }; | |
75 | ||
76 | static struct smsc911x_platform_config smsc911x_config = { | |
77 | .phy_interface = PHY_INTERFACE_MODE_MII, | |
78 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | |
79 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | |
80 | .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), | |
81 | }; | |
82 | ||
83 | static struct platform_device omap3stalker_smsc911x_device = { | |
84 | .name = "smsc911x", | |
85 | .id = -1, | |
86 | .num_resources = ARRAY_SIZE(omap3stalker_smsc911x_resources), | |
87 | .resource = &omap3stalker_smsc911x_resources[0], | |
88 | .dev = { | |
89 | .platform_data = &smsc911x_config, | |
90 | }, | |
91 | }; | |
92 | ||
93 | static inline void __init omap3stalker_init_eth(void) | |
94 | { | |
95 | int eth_cs; | |
96 | struct clk *l3ck; | |
97 | unsigned int rate; | |
98 | ||
99 | eth_cs = OMAP3STALKER_SMC911X_CS; | |
100 | ||
101 | l3ck = clk_get(NULL, "l3_ck"); | |
102 | if (IS_ERR(l3ck)) | |
103 | rate = 100000000; | |
104 | else | |
105 | rate = clk_get_rate(l3ck); | |
106 | ||
107 | omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); | |
108 | if (gpio_request(OMAP3STALKER_ETHR_GPIO_IRQ, "SMC911x irq") < 0) { | |
109 | printk(KERN_ERR | |
110 | "Failed to request GPIO%d for smc911x IRQ\n", | |
111 | OMAP3STALKER_ETHR_GPIO_IRQ); | |
112 | return; | |
113 | } | |
114 | ||
115 | gpio_direction_input(OMAP3STALKER_ETHR_GPIO_IRQ); | |
116 | ||
117 | platform_device_register(&omap3stalker_smsc911x_device); | |
118 | } | |
119 | ||
120 | #else | |
121 | static inline void __init omap3stalker_init_eth(void) | |
122 | { | |
123 | return; | |
124 | } | |
125 | #endif | |
126 | ||
127 | /* | |
128 | * OMAP3 DSS control signals | |
129 | */ | |
130 | ||
131 | #define DSS_ENABLE_GPIO 199 | |
132 | #define LCD_PANEL_BKLIGHT_GPIO 210 | |
133 | #define ENABLE_VPLL2_DEV_GRP 0xE0 | |
134 | ||
135 | static int lcd_enabled; | |
136 | static int dvi_enabled; | |
137 | ||
138 | static void __init omap3_stalker_display_init(void) | |
139 | { | |
140 | return; | |
141 | } | |
142 | ||
143 | static int omap3_stalker_enable_lcd(struct omap_dss_device *dssdev) | |
144 | { | |
145 | if (dvi_enabled) { | |
146 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | |
147 | return -EINVAL; | |
148 | } | |
149 | gpio_set_value(DSS_ENABLE_GPIO, 1); | |
150 | gpio_set_value(LCD_PANEL_BKLIGHT_GPIO, 1); | |
151 | lcd_enabled = 1; | |
152 | return 0; | |
153 | } | |
154 | ||
155 | static void omap3_stalker_disable_lcd(struct omap_dss_device *dssdev) | |
156 | { | |
157 | gpio_set_value(DSS_ENABLE_GPIO, 0); | |
158 | gpio_set_value(LCD_PANEL_BKLIGHT_GPIO, 0); | |
159 | lcd_enabled = 0; | |
160 | } | |
161 | ||
162 | static struct omap_dss_device omap3_stalker_lcd_device = { | |
163 | .name = "lcd", | |
164 | .driver_name = "generic_panel", | |
165 | .phy.dpi.data_lines = 24, | |
166 | .type = OMAP_DISPLAY_TYPE_DPI, | |
167 | .platform_enable = omap3_stalker_enable_lcd, | |
168 | .platform_disable = omap3_stalker_disable_lcd, | |
169 | }; | |
170 | ||
171 | static int omap3_stalker_enable_tv(struct omap_dss_device *dssdev) | |
172 | { | |
173 | return 0; | |
174 | } | |
175 | ||
176 | static void omap3_stalker_disable_tv(struct omap_dss_device *dssdev) | |
177 | { | |
178 | } | |
179 | ||
180 | static struct omap_dss_device omap3_stalker_tv_device = { | |
181 | .name = "tv", | |
182 | .driver_name = "venc", | |
183 | .type = OMAP_DISPLAY_TYPE_VENC, | |
184 | #if defined(CONFIG_OMAP2_VENC_OUT_TYPE_SVIDEO) | |
185 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | |
186 | #elif defined(CONFIG_OMAP2_VENC_OUT_TYPE_COMPOSITE) | |
187 | .u.venc.type = OMAP_DSS_VENC_TYPE_COMPOSITE, | |
188 | #endif | |
189 | .platform_enable = omap3_stalker_enable_tv, | |
190 | .platform_disable = omap3_stalker_disable_tv, | |
191 | }; | |
192 | ||
193 | static int omap3_stalker_enable_dvi(struct omap_dss_device *dssdev) | |
194 | { | |
195 | if (lcd_enabled) { | |
196 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | |
197 | return -EINVAL; | |
198 | } | |
199 | gpio_set_value(DSS_ENABLE_GPIO, 1); | |
200 | dvi_enabled = 1; | |
201 | return 0; | |
202 | } | |
203 | ||
204 | static void omap3_stalker_disable_dvi(struct omap_dss_device *dssdev) | |
205 | { | |
206 | gpio_set_value(DSS_ENABLE_GPIO, 0); | |
207 | dvi_enabled = 0; | |
208 | } | |
209 | ||
210 | static struct omap_dss_device omap3_stalker_dvi_device = { | |
211 | .name = "dvi", | |
212 | .driver_name = "generic_panel", | |
213 | .type = OMAP_DISPLAY_TYPE_DPI, | |
214 | .phy.dpi.data_lines = 24, | |
215 | .platform_enable = omap3_stalker_enable_dvi, | |
216 | .platform_disable = omap3_stalker_disable_dvi, | |
217 | }; | |
218 | ||
219 | static struct omap_dss_device *omap3_stalker_dss_devices[] = { | |
220 | &omap3_stalker_lcd_device, | |
221 | &omap3_stalker_tv_device, | |
222 | &omap3_stalker_dvi_device, | |
223 | }; | |
224 | ||
225 | static struct omap_dss_board_info omap3_stalker_dss_data = { | |
226 | .num_devices = ARRAY_SIZE(omap3_stalker_dss_devices), | |
227 | .devices = omap3_stalker_dss_devices, | |
228 | .default_device = &omap3_stalker_dvi_device, | |
229 | }; | |
230 | ||
231 | static struct platform_device omap3_stalker_dss_device = { | |
232 | .name = "omapdss", | |
233 | .id = -1, | |
234 | .dev = { | |
235 | .platform_data = &omap3_stalker_dss_data, | |
236 | }, | |
237 | }; | |
238 | ||
239 | static struct regulator_consumer_supply omap3stalker_vmmc1_supply = { | |
240 | .supply = "vmmc", | |
241 | }; | |
242 | ||
243 | static struct regulator_consumer_supply omap3stalker_vsim_supply = { | |
244 | .supply = "vmmc_aux", | |
245 | }; | |
246 | ||
247 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | |
248 | static struct regulator_init_data omap3stalker_vmmc1 = { | |
249 | .constraints = { | |
250 | .min_uV = 1850000, | |
251 | .max_uV = 3150000, | |
252 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
253 | | REGULATOR_MODE_STANDBY, | |
254 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
255 | | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, | |
256 | }, | |
257 | .num_consumer_supplies = 1, | |
258 | .consumer_supplies = &omap3stalker_vmmc1_supply, | |
259 | }; | |
260 | ||
261 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ | |
262 | static struct regulator_init_data omap3stalker_vsim = { | |
263 | .constraints = { | |
264 | .min_uV = 1800000, | |
265 | .max_uV = 3000000, | |
266 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
267 | | REGULATOR_MODE_STANDBY, | |
268 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
269 | | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, | |
270 | }, | |
271 | .num_consumer_supplies = 1, | |
272 | .consumer_supplies = &omap3stalker_vsim_supply, | |
273 | }; | |
274 | ||
275 | static struct omap2_hsmmc_info mmc[] = { | |
276 | { | |
277 | .mmc = 1, | |
278 | .wires = 4, | |
279 | .gpio_cd = -EINVAL, | |
280 | .gpio_wp = 23, | |
281 | }, | |
282 | {} /* Terminator */ | |
283 | }; | |
284 | ||
285 | static struct gpio_keys_button gpio_buttons[] = { | |
286 | { | |
287 | .code = BTN_EXTRA, | |
288 | .gpio = 18, | |
289 | .desc = "user", | |
290 | .wakeup = 1, | |
291 | }, | |
292 | }; | |
293 | ||
294 | static struct gpio_keys_platform_data gpio_key_info = { | |
295 | .buttons = gpio_buttons, | |
296 | .nbuttons = ARRAY_SIZE(gpio_buttons), | |
297 | }; | |
298 | ||
299 | static struct platform_device keys_gpio = { | |
300 | .name = "gpio-keys", | |
301 | .id = -1, | |
302 | .dev = { | |
303 | .platform_data = &gpio_key_info, | |
304 | }, | |
305 | }; | |
306 | ||
307 | static struct gpio_led gpio_leds[] = { | |
308 | { | |
309 | .name = "stalker:D8:usr0", | |
310 | .default_trigger = "default-on", | |
311 | .gpio = 126, | |
312 | }, | |
313 | { | |
314 | .name = "stalker:D9:usr1", | |
315 | .default_trigger = "default-on", | |
316 | .gpio = 127, | |
317 | }, | |
318 | { | |
319 | .name = "stalker:D3:mmc0", | |
320 | .gpio = -EINVAL, /* gets replaced */ | |
321 | .active_low = true, | |
322 | .default_trigger = "mmc0", | |
323 | }, | |
324 | { | |
325 | .name = "stalker:D4:heartbeat", | |
326 | .gpio = -EINVAL, /* gets replaced */ | |
327 | .active_low = true, | |
328 | .default_trigger = "heartbeat", | |
329 | }, | |
330 | }; | |
331 | ||
332 | static struct gpio_led_platform_data gpio_led_info = { | |
333 | .leds = gpio_leds, | |
334 | .num_leds = ARRAY_SIZE(gpio_leds), | |
335 | }; | |
336 | ||
337 | static struct platform_device leds_gpio = { | |
338 | .name = "leds-gpio", | |
339 | .id = -1, | |
340 | .dev = { | |
341 | .platform_data = &gpio_led_info, | |
342 | }, | |
343 | }; | |
344 | ||
345 | static int | |
346 | omap3stalker_twl_gpio_setup(struct device *dev, | |
347 | unsigned gpio, unsigned ngpio) | |
348 | { | |
349 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | |
350 | omap_mux_init_gpio(23, OMAP_PIN_INPUT); | |
351 | mmc[0].gpio_cd = gpio + 0; | |
352 | omap2_hsmmc_init(mmc); | |
353 | ||
354 | /* link regulators to MMC adapters */ | |
355 | omap3stalker_vmmc1_supply.dev = mmc[0].dev; | |
356 | omap3stalker_vsim_supply.dev = mmc[0].dev; | |
357 | ||
358 | /* | |
359 | * Most GPIOs are for USB OTG. Some are mostly sent to | |
360 | * the P2 connector; notably LEDA for the LCD backlight. | |
361 | */ | |
362 | ||
363 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ | |
364 | gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); | |
365 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | |
366 | ||
367 | /* gpio + 7 == DVI Enable */ | |
368 | gpio_request(gpio + 7, "EN_DVI"); | |
369 | gpio_direction_output(gpio + 7, 0); | |
370 | ||
371 | /* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */ | |
372 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | |
373 | /* GPIO + 13 == ledsync (out, heartbeat) */ | |
374 | gpio_leds[3].gpio = gpio + 13; | |
375 | ||
376 | platform_device_register(&leds_gpio); | |
377 | return 0; | |
378 | } | |
379 | ||
380 | static struct twl4030_gpio_platform_data omap3stalker_gpio_data = { | |
381 | .gpio_base = OMAP_MAX_GPIO_LINES, | |
382 | .irq_base = TWL4030_GPIO_IRQ_BASE, | |
383 | .irq_end = TWL4030_GPIO_IRQ_END, | |
384 | .use_leds = true, | |
385 | .setup = omap3stalker_twl_gpio_setup, | |
386 | }; | |
387 | ||
388 | static struct twl4030_usb_data omap3stalker_usb_data = { | |
389 | .usb_mode = T2_USB_MODE_ULPI, | |
390 | }; | |
391 | ||
392 | static int board_keymap[] = { | |
393 | KEY(0, 0, KEY_LEFT), | |
394 | KEY(0, 1, KEY_DOWN), | |
395 | KEY(0, 2, KEY_ENTER), | |
396 | KEY(0, 3, KEY_M), | |
397 | ||
398 | KEY(1, 0, KEY_RIGHT), | |
399 | KEY(1, 1, KEY_UP), | |
400 | KEY(1, 2, KEY_I), | |
401 | KEY(1, 3, KEY_N), | |
402 | ||
403 | KEY(2, 0, KEY_A), | |
404 | KEY(2, 1, KEY_E), | |
405 | KEY(2, 2, KEY_J), | |
406 | KEY(2, 3, KEY_O), | |
407 | ||
408 | KEY(3, 0, KEY_B), | |
409 | KEY(3, 1, KEY_F), | |
410 | KEY(3, 2, KEY_K), | |
411 | KEY(3, 3, KEY_P) | |
412 | }; | |
413 | ||
414 | static struct matrix_keymap_data board_map_data = { | |
415 | .keymap = board_keymap, | |
416 | .keymap_size = ARRAY_SIZE(board_keymap), | |
417 | }; | |
418 | ||
419 | static struct twl4030_keypad_data omap3stalker_kp_data = { | |
420 | .keymap_data = &board_map_data, | |
421 | .rows = 4, | |
422 | .cols = 4, | |
423 | .rep = 1, | |
424 | }; | |
425 | ||
426 | static struct twl4030_madc_platform_data omap3stalker_madc_data = { | |
427 | .irq_line = 1, | |
428 | }; | |
429 | ||
430 | static struct twl4030_codec_audio_data omap3stalker_audio_data = { | |
431 | .audio_mclk = 26000000, | |
432 | }; | |
433 | ||
434 | static struct twl4030_codec_data omap3stalker_codec_data = { | |
435 | .audio_mclk = 26000000, | |
436 | .audio = &omap3stalker_audio_data, | |
437 | }; | |
438 | ||
439 | static struct regulator_consumer_supply omap3_stalker_vdda_dac_supply = { | |
440 | .supply = "vdda_dac", | |
441 | .dev = &omap3_stalker_dss_device.dev, | |
442 | }; | |
443 | ||
444 | /* VDAC for DSS driving S-Video */ | |
445 | static struct regulator_init_data omap3_stalker_vdac = { | |
446 | .constraints = { | |
447 | .min_uV = 1800000, | |
448 | .max_uV = 1800000, | |
449 | .apply_uV = true, | |
450 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
451 | | REGULATOR_MODE_STANDBY, | |
452 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
453 | | REGULATOR_CHANGE_STATUS, | |
454 | }, | |
455 | .num_consumer_supplies = 1, | |
456 | .consumer_supplies = &omap3_stalker_vdda_dac_supply, | |
457 | }; | |
458 | ||
459 | /* VPLL2 for digital video outputs */ | |
460 | static struct regulator_consumer_supply omap3_stalker_vpll2_supply = { | |
461 | .supply = "vdds_dsi", | |
462 | .dev = &omap3_stalker_lcd_device.dev, | |
463 | }; | |
464 | ||
465 | static struct regulator_init_data omap3_stalker_vpll2 = { | |
466 | .constraints = { | |
467 | .name = "VDVI", | |
468 | .min_uV = 1800000, | |
469 | .max_uV = 1800000, | |
470 | .apply_uV = true, | |
471 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
472 | | REGULATOR_MODE_STANDBY, | |
473 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
474 | | REGULATOR_CHANGE_STATUS, | |
475 | }, | |
476 | .num_consumer_supplies = 1, | |
477 | .consumer_supplies = &omap3_stalker_vpll2_supply, | |
478 | }; | |
479 | ||
480 | static struct twl4030_platform_data omap3stalker_twldata = { | |
481 | .irq_base = TWL4030_IRQ_BASE, | |
482 | .irq_end = TWL4030_IRQ_END, | |
483 | ||
484 | /* platform_data for children goes here */ | |
485 | .keypad = &omap3stalker_kp_data, | |
486 | .madc = &omap3stalker_madc_data, | |
487 | .usb = &omap3stalker_usb_data, | |
488 | .gpio = &omap3stalker_gpio_data, | |
489 | .codec = &omap3stalker_codec_data, | |
490 | .vdac = &omap3_stalker_vdac, | |
491 | .vpll2 = &omap3_stalker_vpll2, | |
492 | }; | |
493 | ||
494 | static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo[] = { | |
495 | { | |
496 | I2C_BOARD_INFO("twl4030", 0x48), | |
497 | .flags = I2C_CLIENT_WAKE, | |
498 | .irq = INT_34XX_SYS_NIRQ, | |
499 | .platform_data = &omap3stalker_twldata, | |
500 | }, | |
501 | }; | |
502 | ||
503 | static struct at24_platform_data fram_info = { | |
504 | .byte_len = (64 * 1024) / 8, | |
505 | .page_size = 8192, | |
506 | .flags = AT24_FLAG_ADDR16 | AT24_FLAG_IRUGO, | |
507 | }; | |
508 | ||
509 | static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo3[] = { | |
510 | { | |
511 | I2C_BOARD_INFO("24c64", 0x50), | |
512 | .flags = I2C_CLIENT_WAKE, | |
513 | .platform_data = &fram_info, | |
514 | }, | |
515 | }; | |
516 | ||
517 | static int __init omap3_stalker_i2c_init(void) | |
518 | { | |
519 | /* | |
520 | * REVISIT: These entries can be set in omap3evm_twl_data | |
521 | * after a merge with MFD tree | |
522 | */ | |
523 | omap3stalker_twldata.vmmc1 = &omap3stalker_vmmc1; | |
524 | omap3stalker_twldata.vsim = &omap3stalker_vsim; | |
525 | ||
526 | omap_register_i2c_bus(1, 2600, omap3stalker_i2c_boardinfo, | |
527 | ARRAY_SIZE(omap3stalker_i2c_boardinfo)); | |
528 | omap_register_i2c_bus(2, 400, NULL, 0); | |
529 | omap_register_i2c_bus(3, 400, omap3stalker_i2c_boardinfo3, | |
530 | ARRAY_SIZE(omap3stalker_i2c_boardinfo3)); | |
531 | return 0; | |
532 | } | |
533 | ||
534 | #define OMAP3_STALKER_TS_GPIO 175 | |
535 | static void ads7846_dev_init(void) | |
536 | { | |
537 | if (gpio_request(OMAP3_STALKER_TS_GPIO, "ADS7846 pendown") < 0) | |
538 | printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); | |
539 | ||
540 | gpio_direction_input(OMAP3_STALKER_TS_GPIO); | |
99716b66 | 541 | gpio_set_debounce(OMAP3_STALKER_TS_GPIO, 310); |
9cbc3493 J |
542 | } |
543 | ||
544 | static int ads7846_get_pendown_state(void) | |
545 | { | |
546 | return !gpio_get_value(OMAP3_STALKER_TS_GPIO); | |
547 | } | |
548 | ||
549 | static struct ads7846_platform_data ads7846_config = { | |
550 | .x_max = 0x0fff, | |
551 | .y_max = 0x0fff, | |
552 | .x_plate_ohms = 180, | |
553 | .pressure_max = 255, | |
554 | .debounce_max = 10, | |
555 | .debounce_tol = 3, | |
556 | .debounce_rep = 1, | |
557 | .get_pendown_state = ads7846_get_pendown_state, | |
558 | .keep_vref_on = 1, | |
559 | .settle_delay_usecs = 150, | |
560 | }; | |
561 | ||
562 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | |
563 | .turbo_mode = 0, | |
564 | .single_channel = 1, /* 0: slave, 1: master */ | |
565 | }; | |
566 | ||
567 | struct spi_board_info omap3stalker_spi_board_info[] = { | |
568 | [0] = { | |
569 | .modalias = "ads7846", | |
570 | .bus_num = 1, | |
571 | .chip_select = 0, | |
572 | .max_speed_hz = 1500000, | |
573 | .controller_data = &ads7846_mcspi_config, | |
574 | .irq = OMAP_GPIO_IRQ(OMAP3_STALKER_TS_GPIO), | |
575 | .platform_data = &ads7846_config, | |
576 | }, | |
577 | }; | |
578 | ||
579 | static struct omap_board_config_kernel omap3_stalker_config[] __initdata = { | |
580 | }; | |
581 | ||
582 | static void __init omap3_stalker_init_irq(void) | |
583 | { | |
584 | omap_board_config = omap3_stalker_config; | |
585 | omap_board_config_size = ARRAY_SIZE(omap3_stalker_config); | |
586 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL); | |
587 | omap_init_irq(); | |
588 | #ifdef CONFIG_OMAP_32K_TIMER | |
589 | omap2_gp_clockevent_set_gptimer(12); | |
590 | #endif | |
591 | omap_gpio_init(); | |
592 | } | |
593 | ||
594 | static struct platform_device *omap3_stalker_devices[] __initdata = { | |
595 | &omap3_stalker_dss_device, | |
596 | &keys_gpio, | |
597 | }; | |
598 | ||
599 | static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | |
600 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, | |
601 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | |
602 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | |
603 | ||
604 | .phy_reset = true, | |
605 | .reset_gpio_port[0] = -EINVAL, | |
606 | .reset_gpio_port[1] = 21, | |
607 | .reset_gpio_port[2] = -EINVAL, | |
608 | }; | |
609 | ||
610 | #ifdef CONFIG_OMAP_MUX | |
611 | static struct omap_board_mux board_mux[] __initdata = { | |
612 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP | | |
613 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE), | |
614 | OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | | |
615 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE), | |
616 | {.reg_offset = OMAP_MUX_TERMINATOR}, | |
617 | }; | |
618 | #else | |
619 | #define board_mux NULL | |
620 | #endif | |
621 | ||
622 | static struct omap_musb_board_data musb_board_data = { | |
623 | .interface_type = MUSB_INTERFACE_ULPI, | |
624 | .mode = MUSB_OTG, | |
625 | .power = 100, | |
626 | }; | |
627 | ||
628 | static void __init omap3_stalker_init(void) | |
629 | { | |
630 | omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); | |
631 | ||
632 | omap3_stalker_i2c_init(); | |
633 | ||
634 | platform_add_devices(omap3_stalker_devices, | |
635 | ARRAY_SIZE(omap3_stalker_devices)); | |
636 | ||
637 | spi_register_board_info(omap3stalker_spi_board_info, | |
638 | ARRAY_SIZE(omap3stalker_spi_board_info)); | |
639 | ||
640 | omap_serial_init(); | |
641 | usb_musb_init(&musb_board_data); | |
642 | usb_ehci_init(&ehci_pdata); | |
643 | ads7846_dev_init(); | |
644 | ||
645 | omap_mux_init_gpio(21, OMAP_PIN_OUTPUT); | |
646 | omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP); | |
647 | ||
648 | omap3stalker_init_eth(); | |
649 | omap3_stalker_display_init(); | |
650 | /* Ensure SDRC pins are mux'd for self-refresh */ | |
651 | omap_mux_init_signal("sdr_cke0", OMAP_PIN_OUTPUT); | |
652 | omap_mux_init_signal("sdr_cke1", OMAP_PIN_OUTPUT); | |
653 | } | |
654 | ||
655 | static void __init omap3_stalker_map_io(void) | |
656 | { | |
657 | omap2_set_globals_343x(); | |
658 | omap34xx_map_common_io(); | |
659 | } | |
660 | ||
661 | MACHINE_START(SBC3530, "OMAP3 STALKER") | |
662 | /* Maintainer: Jason Lam -lzg@ema-tech.com */ | |
663 | .phys_io = 0x48000000, | |
664 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, | |
665 | .boot_params = 0x80000100, | |
666 | .map_io = omap3_stalker_map_io, | |
667 | .init_irq = omap3_stalker_init_irq, | |
668 | .init_machine = omap3_stalker_init, | |
669 | .timer = &omap_timer, | |
670 | MACHINE_END |