aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-overo.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-03-22 01:27:36 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-03-22 01:27:36 -0400
commitda49252fb0392d8196833ef3da92e48fb371f8d7 (patch)
tree1299899f7513a900b2229b8cde289bca8c41d2f5 /arch/arm/mach-omap2/board-overo.c
parenteddecbb601c9ea3fab7e67d7892010fc9426d1e6 (diff)
parentb295d6e593e02168fdafc5db11464b6d51cf239d (diff)
Merge branch 'for-paul' of git://gitorious.org/linux-omap-dss2/linux
Conflicts: arch/arm/mach-omap2/board-overo.c Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-omap2/board-overo.c')
-rw-r--r--arch/arm/mach-omap2/board-overo.c357
1 files changed, 323 insertions, 34 deletions
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index d0961945c65a..59ca33326b8c 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -28,6 +28,8 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/i2c/twl.h> 29#include <linux/i2c/twl.h>
30#include <linux/regulator/machine.h> 30#include <linux/regulator/machine.h>
31#include <linux/regulator/fixed.h>
32#include <linux/spi/spi.h>
31 33
32#include <linux/mtd/mtd.h> 34#include <linux/mtd/mtd.h>
33#include <linux/mtd/nand.h> 35#include <linux/mtd/nand.h>
@@ -41,10 +43,14 @@
41 43
42#include <plat/board.h> 44#include <plat/board.h>
43#include <plat/common.h> 45#include <plat/common.h>
46#include <plat/display.h>
47#include <plat/panel-generic-dpi.h>
44#include <mach/gpio.h> 48#include <mach/gpio.h>
45#include <plat/gpmc.h> 49#include <plat/gpmc.h>
46#include <mach/hardware.h> 50#include <mach/hardware.h>
47#include <plat/nand.h> 51#include <plat/nand.h>
52#include <plat/mcspi.h>
53#include <plat/mux.h>
48#include <plat/usb.h> 54#include <plat/usb.h>
49 55
50#include "mux.h" 56#include "mux.h"
@@ -68,8 +74,6 @@
68#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 74#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
69 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 75 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
70 76
71#include <plat/mcspi.h>
72#include <linux/spi/spi.h>
73#include <linux/spi/ads7846.h> 77#include <linux/spi/ads7846.h>
74 78
75static struct omap2_mcspi_device_config ads7846_mcspi_config = { 79static struct omap2_mcspi_device_config ads7846_mcspi_config = {
@@ -94,16 +98,32 @@ static struct ads7846_platform_data ads7846_config = {
94 .keep_vref_on = 1, 98 .keep_vref_on = 1,
95}; 99};
96 100
97static struct spi_board_info overo_spi_board_info[] __initdata = { 101/* fixed regulator for ads7846 */
98 { 102static struct regulator_consumer_supply ads7846_supply =
99 .modalias = "ads7846", 103 REGULATOR_SUPPLY("vcc", "spi1.0");
100 .bus_num = 1, 104
101 .chip_select = 0, 105static struct regulator_init_data vads7846_regulator = {
102 .max_speed_hz = 1500000, 106 .constraints = {
103 .controller_data = &ads7846_mcspi_config, 107 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
104 .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN), 108 },
105 .platform_data = &ads7846_config, 109 .num_consumer_supplies = 1,
106 } 110 .consumer_supplies = &ads7846_supply,
111};
112
113static struct fixed_voltage_config vads7846 = {
114 .supply_name = "vads7846",
115 .microvolts = 3300000, /* 3.3V */
116 .gpio = -EINVAL,
117 .startup_delay = 0,
118 .init_data = &vads7846_regulator,
119};
120
121static struct platform_device vads7846_device = {
122 .name = "reg-fixed-voltage",
123 .id = 1,
124 .dev = {
125 .platform_data = &vads7846,
126 },
107}; 127};
108 128
109static void __init overo_ads7846_init(void) 129static void __init overo_ads7846_init(void)
@@ -116,8 +136,7 @@ static void __init overo_ads7846_init(void)
116 return; 136 return;
117 } 137 }
118 138
119 spi_register_board_info(overo_spi_board_info, 139 platform_device_register(&vads7846_device);
120 ARRAY_SIZE(overo_spi_board_info));
121} 140}
122 141
123#else 142#else
@@ -233,6 +252,137 @@ static inline void __init overo_init_smsc911x(void)
233static inline void __init overo_init_smsc911x(void) { return; } 252static inline void __init overo_init_smsc911x(void) { return; }
234#endif 253#endif
235 254
255/* DSS */
256static int lcd_enabled;
257static int dvi_enabled;
258
259#define OVERO_GPIO_LCD_EN 144
260#define OVERO_GPIO_LCD_BL 145
261
262static void __init overo_display_init(void)
263{
264 if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) &&
265 (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0))
266 gpio_export(OVERO_GPIO_LCD_EN, 0);
267 else
268 printk(KERN_ERR "could not obtain gpio for "
269 "OVERO_GPIO_LCD_EN\n");
270
271 if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) &&
272 (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0))
273 gpio_export(OVERO_GPIO_LCD_BL, 0);
274 else
275 printk(KERN_ERR "could not obtain gpio for "
276 "OVERO_GPIO_LCD_BL\n");
277}
278
279static int overo_panel_enable_dvi(struct omap_dss_device *dssdev)
280{
281 if (lcd_enabled) {
282 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
283 return -EINVAL;
284 }
285 dvi_enabled = 1;
286
287 return 0;
288}
289
290static void overo_panel_disable_dvi(struct omap_dss_device *dssdev)
291{
292 dvi_enabled = 0;
293}
294
295static struct panel_generic_dpi_data dvi_panel = {
296 .name = "generic",
297 .platform_enable = overo_panel_enable_dvi,
298 .platform_disable = overo_panel_disable_dvi,
299};
300
301static struct omap_dss_device overo_dvi_device = {
302 .name = "dvi",
303 .type = OMAP_DISPLAY_TYPE_DPI,
304 .driver_name = "generic_dpi_panel",
305 .data = &dvi_panel,
306 .phy.dpi.data_lines = 24,
307};
308
309static struct omap_dss_device overo_tv_device = {
310 .name = "tv",
311 .driver_name = "venc",
312 .type = OMAP_DISPLAY_TYPE_VENC,
313 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
314};
315
316static int overo_panel_enable_lcd(struct omap_dss_device *dssdev)
317{
318 if (dvi_enabled) {
319 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
320 return -EINVAL;
321 }
322
323 gpio_set_value(OVERO_GPIO_LCD_EN, 1);
324 gpio_set_value(OVERO_GPIO_LCD_BL, 1);
325 lcd_enabled = 1;
326 return 0;
327}
328
329static void overo_panel_disable_lcd(struct omap_dss_device *dssdev)
330{
331 gpio_set_value(OVERO_GPIO_LCD_EN, 0);
332 gpio_set_value(OVERO_GPIO_LCD_BL, 0);
333 lcd_enabled = 0;
334}
335
336static struct panel_generic_dpi_data lcd43_panel = {
337 .name = "samsung_lte430wq_f0c",
338 .platform_enable = overo_panel_enable_lcd,
339 .platform_disable = overo_panel_disable_lcd,
340};
341
342static struct omap_dss_device overo_lcd43_device = {
343 .name = "lcd43",
344 .type = OMAP_DISPLAY_TYPE_DPI,
345 .driver_name = "generic_dpi_panel",
346 .data = &lcd43_panel,
347 .phy.dpi.data_lines = 24,
348};
349
350#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
351 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
352static struct omap_dss_device overo_lcd35_device = {
353 .type = OMAP_DISPLAY_TYPE_DPI,
354 .name = "lcd35",
355 .driver_name = "lgphilips_lb035q02_panel",
356 .phy.dpi.data_lines = 24,
357 .platform_enable = overo_panel_enable_lcd,
358 .platform_disable = overo_panel_disable_lcd,
359};
360#endif
361
362static struct omap_dss_device *overo_dss_devices[] = {
363 &overo_dvi_device,
364 &overo_tv_device,
365#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
366 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
367 &overo_lcd35_device,
368#endif
369 &overo_lcd43_device,
370};
371
372static struct omap_dss_board_info overo_dss_data = {
373 .num_devices = ARRAY_SIZE(overo_dss_devices),
374 .devices = overo_dss_devices,
375 .default_device = &overo_dvi_device,
376};
377
378static struct regulator_consumer_supply overo_vdda_dac_supply =
379 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
380
381static struct regulator_consumer_supply overo_vdds_dsi_supply[] = {
382 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
383 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
384};
385
236static struct mtd_partition overo_nand_partitions[] = { 386static struct mtd_partition overo_nand_partitions[] = {
237 { 387 {
238 .name = "xloader", 388 .name = "xloader",
@@ -323,6 +473,93 @@ static struct regulator_consumer_supply overo_vmmc1_supply = {
323 .supply = "vmmc", 473 .supply = "vmmc",
324}; 474};
325 475
476#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
477#include <linux/leds.h>
478
479static struct gpio_led gpio_leds[] = {
480 {
481 .name = "overo:red:gpio21",
482 .default_trigger = "heartbeat",
483 .gpio = 21,
484 .active_low = true,
485 },
486 {
487 .name = "overo:blue:gpio22",
488 .default_trigger = "none",
489 .gpio = 22,
490 .active_low = true,
491 },
492 {
493 .name = "overo:blue:COM",
494 .default_trigger = "mmc0",
495 .gpio = -EINVAL, /* gets replaced */
496 .active_low = true,
497 },
498};
499
500static struct gpio_led_platform_data gpio_leds_pdata = {
501 .leds = gpio_leds,
502 .num_leds = ARRAY_SIZE(gpio_leds),
503};
504
505static struct platform_device gpio_leds_device = {
506 .name = "leds-gpio",
507 .id = -1,
508 .dev = {
509 .platform_data = &gpio_leds_pdata,
510 },
511};
512
513static void __init overo_init_led(void)
514{
515 platform_device_register(&gpio_leds_device);
516}
517
518#else
519static inline void __init overo_init_led(void) { return; }
520#endif
521
522#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
523#include <linux/input.h>
524#include <linux/gpio_keys.h>
525
526static struct gpio_keys_button gpio_buttons[] = {
527 {
528 .code = BTN_0,
529 .gpio = 23,
530 .desc = "button0",
531 .wakeup = 1,
532 },
533 {
534 .code = BTN_1,
535 .gpio = 14,
536 .desc = "button1",
537 .wakeup = 1,
538 },
539};
540
541static struct gpio_keys_platform_data gpio_keys_pdata = {
542 .buttons = gpio_buttons,
543 .nbuttons = ARRAY_SIZE(gpio_buttons),
544};
545
546static struct platform_device gpio_keys_device = {
547 .name = "gpio-keys",
548 .id = -1,
549 .dev = {
550 .platform_data = &gpio_keys_pdata,
551 },
552};
553
554static void __init overo_init_keys(void)
555{
556 platform_device_register(&gpio_keys_device);
557}
558
559#else
560static inline void __init overo_init_keys(void) { return; }
561#endif
562
326static int overo_twl_gpio_setup(struct device *dev, 563static int overo_twl_gpio_setup(struct device *dev,
327 unsigned gpio, unsigned ngpio) 564 unsigned gpio, unsigned ngpio)
328{ 565{
@@ -330,6 +567,11 @@ static int overo_twl_gpio_setup(struct device *dev,
330 567
331 overo_vmmc1_supply.dev = mmc[0].dev; 568 overo_vmmc1_supply.dev = mmc[0].dev;
332 569
570#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
571 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
572 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
573#endif
574
333 return 0; 575 return 0;
334} 576}
335 577
@@ -337,6 +579,7 @@ static struct twl4030_gpio_platform_data overo_gpio_data = {
337 .gpio_base = OMAP_MAX_GPIO_LINES, 579 .gpio_base = OMAP_MAX_GPIO_LINES,
338 .irq_base = TWL4030_GPIO_IRQ_BASE, 580 .irq_base = TWL4030_GPIO_IRQ_BASE,
339 .irq_end = TWL4030_GPIO_IRQ_END, 581 .irq_end = TWL4030_GPIO_IRQ_END,
582 .use_leds = true,
340 .setup = overo_twl_gpio_setup, 583 .setup = overo_twl_gpio_setup,
341}; 584};
342 585
@@ -358,6 +601,35 @@ static struct regulator_init_data overo_vmmc1 = {
358 .consumer_supplies = &overo_vmmc1_supply, 601 .consumer_supplies = &overo_vmmc1_supply,
359}; 602};
360 603
604/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
605static struct regulator_init_data overo_vdac = {
606 .constraints = {
607 .min_uV = 1800000,
608 .max_uV = 1800000,
609 .valid_modes_mask = REGULATOR_MODE_NORMAL
610 | REGULATOR_MODE_STANDBY,
611 .valid_ops_mask = REGULATOR_CHANGE_MODE
612 | REGULATOR_CHANGE_STATUS,
613 },
614 .num_consumer_supplies = 1,
615 .consumer_supplies = &overo_vdda_dac_supply,
616};
617
618/* VPLL2 for digital video outputs */
619static struct regulator_init_data overo_vpll2 = {
620 .constraints = {
621 .name = "VDVI",
622 .min_uV = 1800000,
623 .max_uV = 1800000,
624 .valid_modes_mask = REGULATOR_MODE_NORMAL
625 | REGULATOR_MODE_STANDBY,
626 .valid_ops_mask = REGULATOR_CHANGE_MODE
627 | REGULATOR_CHANGE_STATUS,
628 },
629 .num_consumer_supplies = ARRAY_SIZE(overo_vdds_dsi_supply),
630 .consumer_supplies = overo_vdds_dsi_supply,
631};
632
361static struct twl4030_codec_audio_data overo_audio_data; 633static struct twl4030_codec_audio_data overo_audio_data;
362 634
363static struct twl4030_codec_data overo_codec_data = { 635static struct twl4030_codec_data overo_codec_data = {
@@ -365,8 +637,6 @@ static struct twl4030_codec_data overo_codec_data = {
365 .audio = &overo_audio_data, 637 .audio = &overo_audio_data,
366}; 638};
367 639
368/* mmc2 (WLAN) and Bluetooth don't use twl4030 regulators */
369
370static struct twl4030_platform_data overo_twldata = { 640static struct twl4030_platform_data overo_twldata = {
371 .irq_base = TWL4030_IRQ_BASE, 641 .irq_base = TWL4030_IRQ_BASE,
372 .irq_end = TWL4030_IRQ_END, 642 .irq_end = TWL4030_IRQ_END,
@@ -374,6 +644,8 @@ static struct twl4030_platform_data overo_twldata = {
374 .usb = &overo_usb_data, 644 .usb = &overo_usb_data,
375 .codec = &overo_codec_data, 645 .codec = &overo_codec_data,
376 .vmmc1 = &overo_vmmc1, 646 .vmmc1 = &overo_vmmc1,
647 .vdac = &overo_vdac,
648 .vpll2 = &overo_vpll2,
377}; 649};
378 650
379static struct i2c_board_info __initdata overo_i2c_boardinfo[] = { 651static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
@@ -394,18 +666,38 @@ static int __init overo_i2c_init(void)
394 return 0; 666 return 0;
395} 667}
396 668
397static struct platform_device overo_lcd_device = { 669static struct spi_board_info overo_spi_board_info[] __initdata = {
398 .name = "overo_lcd", 670#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
399 .id = -1, 671 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
400}; 672 {
401 673 .modalias = "ads7846",
402static struct omap_lcd_config overo_lcd_config __initdata = { 674 .bus_num = 1,
403 .ctrl_name = "internal", 675 .chip_select = 0,
676 .max_speed_hz = 1500000,
677 .controller_data = &ads7846_mcspi_config,
678 .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
679 .platform_data = &ads7846_config,
680 },
681#endif
682#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
683 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
684 {
685 .modalias = "lgphilips_lb035q02_panel-spi",
686 .bus_num = 1,
687 .chip_select = 1,
688 .max_speed_hz = 500000,
689 .mode = SPI_MODE_3,
690 },
691#endif
404}; 692};
405 693
406static struct omap_board_config_kernel overo_config[] __initdata = { 694static int __init overo_spi_init(void)
407 { OMAP_TAG_LCD, &overo_lcd_config }, 695{
408}; 696 overo_ads7846_init();
697 spi_register_board_info(overo_spi_board_info,
698 ARRAY_SIZE(overo_spi_board_info));
699 return 0;
700}
409 701
410static void __init overo_init_early(void) 702static void __init overo_init_early(void)
411{ 703{
@@ -414,15 +706,10 @@ static void __init overo_init_early(void)
414 mt46h32m32lf6_sdrc_params); 706 mt46h32m32lf6_sdrc_params);
415} 707}
416 708
417static struct platform_device *overo_devices[] __initdata = {
418 &overo_lcd_device,
419};
420
421static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 709static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
422 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 710 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
423 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 711 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
424 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 712 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
425
426 .phy_reset = true, 713 .phy_reset = true,
427 .reset_gpio_port[0] = -EINVAL, 714 .reset_gpio_port[0] = -EINVAL,
428 .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET, 715 .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
@@ -444,16 +731,18 @@ static struct omap_musb_board_data musb_board_data = {
444static void __init overo_init(void) 731static void __init overo_init(void)
445{ 732{
446 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 733 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
447 omap_board_config = overo_config;
448 omap_board_config_size = ARRAY_SIZE(overo_config);
449 overo_i2c_init(); 734 overo_i2c_init();
450 platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices)); 735 omap_display_init(&overo_dss_data);
451 omap_serial_init(); 736 omap_serial_init();
452 overo_flash_init(); 737 overo_flash_init();
453 usb_musb_init(&musb_board_data); 738 usb_musb_init(&musb_board_data);
454 usbhs_init(&usbhs_bdata); 739 usbhs_init(&usbhs_bdata);
740 overo_spi_init();
455 overo_ads7846_init(); 741 overo_ads7846_init();
456 overo_init_smsc911x(); 742 overo_init_smsc911x();
743 overo_display_init();
744 overo_init_led();
745 overo_init_keys();
457 746
458 /* Ensure SDRC pins are mux'd for self-refresh */ 747 /* Ensure SDRC pins are mux'd for self-refresh */
459 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 748 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);