diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3touchbook.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3touchbook.c | 168 |
1 files changed, 36 insertions, 132 deletions
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c index 663c62d271e8..5f649faf7377 100644 --- a/arch/arm/mach-omap2/board-omap3touchbook.c +++ b/arch/arm/mach-omap2/board-omap3touchbook.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/mtd/mtd.h> | 27 | #include <linux/mtd/mtd.h> |
28 | #include <linux/mtd/partitions.h> | 28 | #include <linux/mtd/partitions.h> |
29 | #include <linux/mtd/nand.h> | 29 | #include <linux/mtd/nand.h> |
30 | #include <linux/mmc/host.h> | ||
30 | 31 | ||
31 | #include <plat/mcspi.h> | 32 | #include <plat/mcspi.h> |
32 | #include <linux/spi/spi.h> | 33 | #include <linux/spi/spi.h> |
@@ -47,21 +48,20 @@ | |||
47 | #include <plat/gpmc.h> | 48 | #include <plat/gpmc.h> |
48 | #include <plat/nand.h> | 49 | #include <plat/nand.h> |
49 | #include <plat/usb.h> | 50 | #include <plat/usb.h> |
50 | #include <plat/timer-gp.h> | ||
51 | 51 | ||
52 | #include "mux.h" | 52 | #include "mux.h" |
53 | #include "hsmmc.h" | 53 | #include "hsmmc.h" |
54 | #include "timer-gp.h" | ||
55 | #include "common-board-devices.h" | ||
54 | 56 | ||
55 | #include <asm/setup.h> | 57 | #include <asm/setup.h> |
56 | 58 | ||
57 | #define NAND_BLOCK_SIZE SZ_128K | ||
58 | |||
59 | #define OMAP3_AC_GPIO 136 | 59 | #define OMAP3_AC_GPIO 136 |
60 | #define OMAP3_TS_GPIO 162 | 60 | #define OMAP3_TS_GPIO 162 |
61 | #define TB_BL_PWM_TIMER 9 | 61 | #define TB_BL_PWM_TIMER 9 |
62 | #define TB_KILL_POWER_GPIO 168 | 62 | #define TB_KILL_POWER_GPIO 168 |
63 | 63 | ||
64 | unsigned long touchbook_revision; | 64 | static unsigned long touchbook_revision; |
65 | 65 | ||
66 | static struct mtd_partition omap3touchbook_nand_partitions[] = { | 66 | static struct mtd_partition omap3touchbook_nand_partitions[] = { |
67 | /* All the partition sizes are listed in terms of NAND block size */ | 67 | /* All the partition sizes are listed in terms of NAND block size */ |
@@ -94,21 +94,12 @@ static struct mtd_partition omap3touchbook_nand_partitions[] = { | |||
94 | }, | 94 | }, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static struct omap_nand_platform_data omap3touchbook_nand_data = { | ||
98 | .options = NAND_BUSWIDTH_16, | ||
99 | .parts = omap3touchbook_nand_partitions, | ||
100 | .nr_parts = ARRAY_SIZE(omap3touchbook_nand_partitions), | ||
101 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ | ||
102 | .nand_setup = NULL, | ||
103 | .dev_ready = NULL, | ||
104 | }; | ||
105 | |||
106 | #include "sdram-micron-mt46h32m32lf-6.h" | 97 | #include "sdram-micron-mt46h32m32lf-6.h" |
107 | 98 | ||
108 | static struct omap2_hsmmc_info mmc[] = { | 99 | static struct omap2_hsmmc_info mmc[] = { |
109 | { | 100 | { |
110 | .mmc = 1, | 101 | .mmc = 1, |
111 | .wires = 8, | 102 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
112 | .gpio_wp = 29, | 103 | .gpio_wp = 29, |
113 | }, | 104 | }, |
114 | {} /* Terminator */ | 105 | {} /* Terminator */ |
@@ -153,13 +144,11 @@ static int touchbook_twl_gpio_setup(struct device *dev, | |||
153 | /* REVISIT: need ehci-omap hooks for external VBUS | 144 | /* REVISIT: need ehci-omap hooks for external VBUS |
154 | * power switch and overcurrent detect | 145 | * power switch and overcurrent detect |
155 | */ | 146 | */ |
156 | 147 | gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"); | |
157 | gpio_request(gpio + 1, "EHCI_nOC"); | ||
158 | gpio_direction_input(gpio + 1); | ||
159 | 148 | ||
160 | /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ | 149 | /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ |
161 | gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); | 150 | gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW, |
162 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | 151 | "nEN_USB_PWR"); |
163 | 152 | ||
164 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | 153 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ |
165 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 154 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
@@ -251,9 +240,7 @@ static struct twl4030_usb_data touchbook_usb_data = { | |||
251 | .usb_mode = T2_USB_MODE_ULPI, | 240 | .usb_mode = T2_USB_MODE_ULPI, |
252 | }; | 241 | }; |
253 | 242 | ||
254 | static struct twl4030_codec_audio_data touchbook_audio_data = { | 243 | static struct twl4030_codec_audio_data touchbook_audio_data; |
255 | .audio_mclk = 26000000, | ||
256 | }; | ||
257 | 244 | ||
258 | static struct twl4030_codec_data touchbook_codec_data = { | 245 | static struct twl4030_codec_data touchbook_codec_data = { |
259 | .audio_mclk = 26000000, | 246 | .audio_mclk = 26000000, |
@@ -274,15 +261,6 @@ static struct twl4030_platform_data touchbook_twldata = { | |||
274 | .vpll2 = &touchbook_vpll2, | 261 | .vpll2 = &touchbook_vpll2, |
275 | }; | 262 | }; |
276 | 263 | ||
277 | static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = { | ||
278 | { | ||
279 | I2C_BOARD_INFO("twl4030", 0x48), | ||
280 | .flags = I2C_CLIENT_WAKE, | ||
281 | .irq = INT_34XX_SYS_NIRQ, | ||
282 | .platform_data = &touchbook_twldata, | ||
283 | }, | ||
284 | }; | ||
285 | |||
286 | static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { | 264 | static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { |
287 | { | 265 | { |
288 | I2C_BOARD_INFO("bq27200", 0x55), | 266 | I2C_BOARD_INFO("bq27200", 0x55), |
@@ -292,8 +270,7 @@ static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { | |||
292 | static int __init omap3_touchbook_i2c_init(void) | 270 | static int __init omap3_touchbook_i2c_init(void) |
293 | { | 271 | { |
294 | /* Standard TouchBook bus */ | 272 | /* Standard TouchBook bus */ |
295 | omap_register_i2c_bus(1, 2600, touchbook_i2c_boardinfo, | 273 | omap3_pmic_init("twl4030", &touchbook_twldata); |
296 | ARRAY_SIZE(touchbook_i2c_boardinfo)); | ||
297 | 274 | ||
298 | /* Additional TouchBook bus */ | 275 | /* Additional TouchBook bus */ |
299 | omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo, | 276 | omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo, |
@@ -302,19 +279,7 @@ static int __init omap3_touchbook_i2c_init(void) | |||
302 | return 0; | 279 | return 0; |
303 | } | 280 | } |
304 | 281 | ||
305 | static void __init omap3_ads7846_init(void) | 282 | static struct ads7846_platform_data ads7846_pdata = { |
306 | { | ||
307 | if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) { | ||
308 | printk(KERN_ERR "Failed to request GPIO %d for " | ||
309 | "ads7846 pen down IRQ\n", OMAP3_TS_GPIO); | ||
310 | return; | ||
311 | } | ||
312 | |||
313 | gpio_direction_input(OMAP3_TS_GPIO); | ||
314 | gpio_set_debounce(OMAP3_TS_GPIO, 310); | ||
315 | } | ||
316 | |||
317 | static struct ads7846_platform_data ads7846_config = { | ||
318 | .x_min = 100, | 283 | .x_min = 100, |
319 | .y_min = 265, | 284 | .y_min = 265, |
320 | .x_max = 3950, | 285 | .x_max = 3950, |
@@ -328,23 +293,6 @@ static struct ads7846_platform_data ads7846_config = { | |||
328 | .keep_vref_on = 1, | 293 | .keep_vref_on = 1, |
329 | }; | 294 | }; |
330 | 295 | ||
331 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | ||
332 | .turbo_mode = 0, | ||
333 | .single_channel = 1, /* 0: slave, 1: master */ | ||
334 | }; | ||
335 | |||
336 | static struct spi_board_info omap3_ads7846_spi_board_info[] __initdata = { | ||
337 | { | ||
338 | .modalias = "ads7846", | ||
339 | .bus_num = 4, | ||
340 | .chip_select = 0, | ||
341 | .max_speed_hz = 1500000, | ||
342 | .controller_data = &ads7846_mcspi_config, | ||
343 | .irq = OMAP_GPIO_IRQ(OMAP3_TS_GPIO), | ||
344 | .platform_data = &ads7846_config, | ||
345 | } | ||
346 | }; | ||
347 | |||
348 | static struct gpio_led gpio_leds[] = { | 296 | static struct gpio_led gpio_leds[] = { |
349 | { | 297 | { |
350 | .name = "touchbook::usr0", | 298 | .name = "touchbook::usr0", |
@@ -412,22 +360,21 @@ static struct omap_board_config_kernel omap3_touchbook_config[] __initdata = { | |||
412 | static struct omap_board_mux board_mux[] __initdata = { | 360 | static struct omap_board_mux board_mux[] __initdata = { |
413 | { .reg_offset = OMAP_MUX_TERMINATOR }, | 361 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
414 | }; | 362 | }; |
415 | #else | ||
416 | #define board_mux NULL | ||
417 | #endif | 363 | #endif |
418 | 364 | ||
365 | static void __init omap3_touchbook_init_early(void) | ||
366 | { | ||
367 | omap2_init_common_infrastructure(); | ||
368 | omap2_init_common_devices(mt46h32m32lf6_sdrc_params, | ||
369 | mt46h32m32lf6_sdrc_params); | ||
370 | } | ||
371 | |||
419 | static void __init omap3_touchbook_init_irq(void) | 372 | static void __init omap3_touchbook_init_irq(void) |
420 | { | 373 | { |
421 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | ||
422 | omap_board_config = omap3_touchbook_config; | ||
423 | omap_board_config_size = ARRAY_SIZE(omap3_touchbook_config); | ||
424 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, | ||
425 | mt46h32m32lf6_sdrc_params); | ||
426 | omap_init_irq(); | 374 | omap_init_irq(); |
427 | #ifdef CONFIG_OMAP_32K_TIMER | 375 | #ifdef CONFIG_OMAP_32K_TIMER |
428 | omap2_gp_clockevent_set_gptimer(12); | 376 | omap2_gp_clockevent_set_gptimer(12); |
429 | #endif | 377 | #endif |
430 | omap_gpio_init(); | ||
431 | } | 378 | } |
432 | 379 | ||
433 | static struct platform_device *omap3_touchbook_devices[] __initdata = { | 380 | static struct platform_device *omap3_touchbook_devices[] __initdata = { |
@@ -436,44 +383,11 @@ static struct platform_device *omap3_touchbook_devices[] __initdata = { | |||
436 | &keys_gpio, | 383 | &keys_gpio, |
437 | }; | 384 | }; |
438 | 385 | ||
439 | static void __init omap3touchbook_flash_init(void) | 386 | static const struct usbhs_omap_board_data usbhs_bdata __initconst = { |
440 | { | ||
441 | u8 cs = 0; | ||
442 | u8 nandcs = GPMC_CS_NUM + 1; | ||
443 | |||
444 | /* find out the chip-select on which NAND exists */ | ||
445 | while (cs < GPMC_CS_NUM) { | ||
446 | u32 ret = 0; | ||
447 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
448 | |||
449 | if ((ret & 0xC00) == 0x800) { | ||
450 | printk(KERN_INFO "Found NAND on CS%d\n", cs); | ||
451 | if (nandcs > GPMC_CS_NUM) | ||
452 | nandcs = cs; | ||
453 | } | ||
454 | cs++; | ||
455 | } | ||
456 | |||
457 | if (nandcs > GPMC_CS_NUM) { | ||
458 | printk(KERN_INFO "NAND: Unable to find configuration " | ||
459 | "in GPMC\n "); | ||
460 | return; | ||
461 | } | ||
462 | |||
463 | if (nandcs < GPMC_CS_NUM) { | ||
464 | omap3touchbook_nand_data.cs = nandcs; | ||
465 | |||
466 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); | ||
467 | if (gpmc_nand_init(&omap3touchbook_nand_data) < 0) | ||
468 | printk(KERN_ERR "Unable to register NAND device\n"); | ||
469 | } | ||
470 | } | ||
471 | 387 | ||
472 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | 388 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
473 | 389 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | |
474 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | 390 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, |
475 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | ||
476 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
477 | 391 | ||
478 | .phy_reset = true, | 392 | .phy_reset = true, |
479 | .reset_gpio_port[0] = -EINVAL, | 393 | .reset_gpio_port[0] = -EINVAL, |
@@ -483,15 +397,10 @@ static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | |||
483 | 397 | ||
484 | static void omap3_touchbook_poweroff(void) | 398 | static void omap3_touchbook_poweroff(void) |
485 | { | 399 | { |
486 | int r; | 400 | int pwr_off = TB_KILL_POWER_GPIO; |
487 | 401 | ||
488 | r = gpio_request(TB_KILL_POWER_GPIO, "DVI reset"); | 402 | if (gpio_request_one(pwr_off, GPIOF_OUT_INIT_LOW, "DVI reset") < 0) |
489 | if (r < 0) { | ||
490 | printk(KERN_ERR "Unable to get kill power GPIO\n"); | 403 | printk(KERN_ERR "Unable to get kill power GPIO\n"); |
491 | return; | ||
492 | } | ||
493 | |||
494 | gpio_direction_output(TB_KILL_POWER_GPIO, 0); | ||
495 | } | 404 | } |
496 | 405 | ||
497 | static int __init early_touchbook_revision(char *p) | 406 | static int __init early_touchbook_revision(char *p) |
@@ -503,14 +412,12 @@ static int __init early_touchbook_revision(char *p) | |||
503 | } | 412 | } |
504 | early_param("tbr", early_touchbook_revision); | 413 | early_param("tbr", early_touchbook_revision); |
505 | 414 | ||
506 | static struct omap_musb_board_data musb_board_data = { | ||
507 | .interface_type = MUSB_INTERFACE_ULPI, | ||
508 | .mode = MUSB_OTG, | ||
509 | .power = 100, | ||
510 | }; | ||
511 | |||
512 | static void __init omap3_touchbook_init(void) | 415 | static void __init omap3_touchbook_init(void) |
513 | { | 416 | { |
417 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | ||
418 | omap_board_config = omap3_touchbook_config; | ||
419 | omap_board_config_size = ARRAY_SIZE(omap3_touchbook_config); | ||
420 | |||
514 | pm_power_off = omap3_touchbook_poweroff; | 421 | pm_power_off = omap3_touchbook_poweroff; |
515 | 422 | ||
516 | omap3_touchbook_i2c_init(); | 423 | omap3_touchbook_i2c_init(); |
@@ -519,17 +426,15 @@ static void __init omap3_touchbook_init(void) | |||
519 | omap_serial_init(); | 426 | omap_serial_init(); |
520 | 427 | ||
521 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); | 428 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); |
522 | gpio_request(176, "DVI_nPD"); | ||
523 | /* REVISIT leave DVI powered down until it's needed ... */ | 429 | /* REVISIT leave DVI powered down until it's needed ... */ |
524 | gpio_direction_output(176, true); | 430 | gpio_request_one(176, GPIOF_OUT_INIT_HIGH, "DVI_nPD"); |
525 | 431 | ||
526 | /* Touchscreen and accelerometer */ | 432 | /* Touchscreen and accelerometer */ |
527 | spi_register_board_info(omap3_ads7846_spi_board_info, | 433 | omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); |
528 | ARRAY_SIZE(omap3_ads7846_spi_board_info)); | 434 | usb_musb_init(NULL); |
529 | omap3_ads7846_init(); | 435 | usbhs_init(&usbhs_bdata); |
530 | usb_musb_init(&musb_board_data); | 436 | omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions, |
531 | usb_ehci_init(&ehci_pdata); | 437 | ARRAY_SIZE(omap3touchbook_nand_partitions)); |
532 | omap3touchbook_flash_init(); | ||
533 | 438 | ||
534 | /* Ensure SDRC pins are mux'd for self-refresh */ | 439 | /* Ensure SDRC pins are mux'd for self-refresh */ |
535 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 440 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
@@ -538,11 +443,10 @@ static void __init omap3_touchbook_init(void) | |||
538 | 443 | ||
539 | MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board") | 444 | MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board") |
540 | /* Maintainer: Gregoire Gentil - http://www.alwaysinnovating.com */ | 445 | /* Maintainer: Gregoire Gentil - http://www.alwaysinnovating.com */ |
541 | .phys_io = 0x48000000, | ||
542 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, | ||
543 | .boot_params = 0x80000100, | 446 | .boot_params = 0x80000100, |
544 | .map_io = omap3_map_io, | ||
545 | .reserve = omap_reserve, | 447 | .reserve = omap_reserve, |
448 | .map_io = omap3_map_io, | ||
449 | .init_early = omap3_touchbook_init_early, | ||
546 | .init_irq = omap3_touchbook_init_irq, | 450 | .init_irq = omap3_touchbook_init_irq, |
547 | .init_machine = omap3_touchbook_init, | 451 | .init_machine = omap3_touchbook_init, |
548 | .timer = &omap_timer, | 452 | .timer = &omap_timer, |