aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-cm-t35.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-cm-t35.c')
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c255
1 files changed, 249 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 2626a9f8a73a..afa77caaff4d 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -32,6 +32,9 @@
32#include <linux/i2c/twl.h> 32#include <linux/i2c/twl.h>
33#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
34 34
35#include <linux/spi/spi.h>
36#include <linux/spi/tdo24m.h>
37
35#include <asm/mach-types.h> 38#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
37#include <asm/mach/map.h> 40#include <asm/mach/map.h>
@@ -41,12 +44,13 @@
41#include <plat/nand.h> 44#include <plat/nand.h>
42#include <plat/gpmc.h> 45#include <plat/gpmc.h>
43#include <plat/usb.h> 46#include <plat/usb.h>
47#include <plat/display.h>
44 48
45#include <mach/hardware.h> 49#include <mach/hardware.h>
46 50
47#include "mux.h" 51#include "mux.h"
48#include "sdram-micron-mt46h32m32lf-6.h" 52#include "sdram-micron-mt46h32m32lf-6.h"
49#include "mmc-twl4030.h" 53#include "hsmmc.h"
50 54
51#define CM_T35_GPIO_PENDOWN 57 55#define CM_T35_GPIO_PENDOWN 57
52 56
@@ -248,7 +252,6 @@ static inline void cm_t35_init_nand(void) {}
248 252
249#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 253#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
250 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 254 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
251#include <linux/spi/spi.h>
252#include <linux/spi/ads7846.h> 255#include <linux/spi/ads7846.h>
253 256
254#include <plat/mcspi.h> 257#include <plat/mcspi.h>
@@ -304,6 +307,193 @@ static void __init cm_t35_init_ads7846(void)
304static inline void cm_t35_init_ads7846(void) {} 307static inline void cm_t35_init_ads7846(void) {}
305#endif 308#endif
306 309
310#define CM_T35_LCD_EN_GPIO 157
311#define CM_T35_LCD_BL_GPIO 58
312#define CM_T35_DVI_EN_GPIO 54
313
314static int lcd_bl_gpio;
315static int lcd_en_gpio;
316static int dvi_en_gpio;
317
318static int lcd_enabled;
319static int dvi_enabled;
320
321static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev)
322{
323 if (dvi_enabled) {
324 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
325 return -EINVAL;
326 }
327
328 gpio_set_value(lcd_en_gpio, 1);
329 gpio_set_value(lcd_bl_gpio, 1);
330
331 lcd_enabled = 1;
332
333 return 0;
334}
335
336static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev)
337{
338 lcd_enabled = 0;
339
340 gpio_set_value(lcd_bl_gpio, 0);
341 gpio_set_value(lcd_en_gpio, 0);
342}
343
344static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
345{
346 if (lcd_enabled) {
347 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
348 return -EINVAL;
349 }
350
351 gpio_set_value(dvi_en_gpio, 0);
352 dvi_enabled = 1;
353
354 return 0;
355}
356
357static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev)
358{
359 gpio_set_value(dvi_en_gpio, 1);
360 dvi_enabled = 0;
361}
362
363static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev)
364{
365 return 0;
366}
367
368static void cm_t35_panel_disable_tv(struct omap_dss_device *dssdev)
369{
370}
371
372static struct omap_dss_device cm_t35_lcd_device = {
373 .name = "lcd",
374 .driver_name = "toppoly_tdo35s_panel",
375 .type = OMAP_DISPLAY_TYPE_DPI,
376 .phy.dpi.data_lines = 18,
377 .platform_enable = cm_t35_panel_enable_lcd,
378 .platform_disable = cm_t35_panel_disable_lcd,
379};
380
381static struct omap_dss_device cm_t35_dvi_device = {
382 .name = "dvi",
383 .driver_name = "generic_panel",
384 .type = OMAP_DISPLAY_TYPE_DPI,
385 .phy.dpi.data_lines = 24,
386 .platform_enable = cm_t35_panel_enable_dvi,
387 .platform_disable = cm_t35_panel_disable_dvi,
388};
389
390static struct omap_dss_device cm_t35_tv_device = {
391 .name = "tv",
392 .driver_name = "venc",
393 .type = OMAP_DISPLAY_TYPE_VENC,
394 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
395 .platform_enable = cm_t35_panel_enable_tv,
396 .platform_disable = cm_t35_panel_disable_tv,
397};
398
399static struct omap_dss_device *cm_t35_dss_devices[] = {
400 &cm_t35_lcd_device,
401 &cm_t35_dvi_device,
402 &cm_t35_tv_device,
403};
404
405static struct omap_dss_board_info cm_t35_dss_data = {
406 .num_devices = ARRAY_SIZE(cm_t35_dss_devices),
407 .devices = cm_t35_dss_devices,
408 .default_device = &cm_t35_dvi_device,
409};
410
411static struct platform_device cm_t35_dss_device = {
412 .name = "omapdss",
413 .id = -1,
414 .dev = {
415 .platform_data = &cm_t35_dss_data,
416 },
417};
418
419static struct omap2_mcspi_device_config tdo24m_mcspi_config = {
420 .turbo_mode = 0,
421 .single_channel = 1, /* 0: slave, 1: master */
422};
423
424static struct tdo24m_platform_data tdo24m_config = {
425 .model = TDO35S,
426};
427
428static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = {
429 {
430 .modalias = "tdo24m",
431 .bus_num = 4,
432 .chip_select = 0,
433 .max_speed_hz = 1000000,
434 .controller_data = &tdo24m_mcspi_config,
435 .platform_data = &tdo24m_config,
436 },
437};
438
439static void __init cm_t35_init_display(void)
440{
441 int err;
442
443 lcd_en_gpio = CM_T35_LCD_EN_GPIO;
444 lcd_bl_gpio = CM_T35_LCD_BL_GPIO;
445 dvi_en_gpio = CM_T35_DVI_EN_GPIO;
446
447 spi_register_board_info(cm_t35_lcd_spi_board_info,
448 ARRAY_SIZE(cm_t35_lcd_spi_board_info));
449
450 err = gpio_request(lcd_en_gpio, "LCD RST");
451 if (err) {
452 pr_err("CM-T35: failed to get LCD reset GPIO\n");
453 goto out;
454 }
455
456 err = gpio_request(lcd_bl_gpio, "LCD BL");
457 if (err) {
458 pr_err("CM-T35: failed to get LCD backlight control GPIO\n");
459 goto err_lcd_bl;
460 }
461
462 err = gpio_request(dvi_en_gpio, "DVI EN");
463 if (err) {
464 pr_err("CM-T35: failed to get DVI reset GPIO\n");
465 goto err_dvi_en;
466 }
467
468 gpio_export(lcd_en_gpio, 0);
469 gpio_export(lcd_bl_gpio, 0);
470 gpio_export(dvi_en_gpio, 0);
471 gpio_direction_output(lcd_en_gpio, 0);
472 gpio_direction_output(lcd_bl_gpio, 0);
473 gpio_direction_output(dvi_en_gpio, 1);
474
475 msleep(50);
476 gpio_set_value(lcd_en_gpio, 1);
477
478 err = platform_device_register(&cm_t35_dss_device);
479 if (err) {
480 pr_err("CM-T35: failed to register DSS device\n");
481 goto err_dev_reg;
482 }
483
484 return;
485
486err_dev_reg:
487 gpio_free(dvi_en_gpio);
488err_dvi_en:
489 gpio_free(lcd_bl_gpio);
490err_lcd_bl:
491 gpio_free(lcd_en_gpio);
492out:
493
494 return;
495}
496
307static struct regulator_consumer_supply cm_t35_vmmc1_supply = { 497static struct regulator_consumer_supply cm_t35_vmmc1_supply = {
308 .supply = "vmmc", 498 .supply = "vmmc",
309}; 499};
@@ -312,6 +502,16 @@ static struct regulator_consumer_supply cm_t35_vsim_supply = {
312 .supply = "vmmc_aux", 502 .supply = "vmmc_aux",
313}; 503};
314 504
505static struct regulator_consumer_supply cm_t35_vdac_supply = {
506 .supply = "vdda_dac",
507 .dev = &cm_t35_dss_device.dev,
508};
509
510static struct regulator_consumer_supply cm_t35_vdvi_supply = {
511 .supply = "vdvi",
512 .dev = &cm_t35_dss_device.dev,
513};
514
315/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ 515/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
316static struct regulator_init_data cm_t35_vmmc1 = { 516static struct regulator_init_data cm_t35_vmmc1 = {
317 .constraints = { 517 .constraints = {
@@ -342,6 +542,35 @@ static struct regulator_init_data cm_t35_vsim = {
342 .consumer_supplies = &cm_t35_vsim_supply, 542 .consumer_supplies = &cm_t35_vsim_supply,
343}; 543};
344 544
545/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
546static struct regulator_init_data cm_t35_vdac = {
547 .constraints = {
548 .min_uV = 1800000,
549 .max_uV = 1800000,
550 .valid_modes_mask = REGULATOR_MODE_NORMAL
551 | REGULATOR_MODE_STANDBY,
552 .valid_ops_mask = REGULATOR_CHANGE_MODE
553 | REGULATOR_CHANGE_STATUS,
554 },
555 .num_consumer_supplies = 1,
556 .consumer_supplies = &cm_t35_vdac_supply,
557};
558
559/* VPLL2 for digital video outputs */
560static struct regulator_init_data cm_t35_vpll2 = {
561 .constraints = {
562 .name = "VDVI",
563 .min_uV = 1800000,
564 .max_uV = 1800000,
565 .valid_modes_mask = REGULATOR_MODE_NORMAL
566 | REGULATOR_MODE_STANDBY,
567 .valid_ops_mask = REGULATOR_CHANGE_MODE
568 | REGULATOR_CHANGE_STATUS,
569 },
570 .num_consumer_supplies = 1,
571 .consumer_supplies = &cm_t35_vdvi_supply,
572};
573
345static struct twl4030_usb_data cm_t35_usb_data = { 574static struct twl4030_usb_data cm_t35_usb_data = {
346 .usb_mode = T2_USB_MODE_ULPI, 575 .usb_mode = T2_USB_MODE_ULPI,
347}; 576};
@@ -364,7 +593,7 @@ static struct twl4030_keypad_data cm_t35_kp_data = {
364 .rep = 1, 593 .rep = 1,
365}; 594};
366 595
367static struct twl4030_hsmmc_info mmc[] = { 596static struct omap2_hsmmc_info mmc[] = {
368 { 597 {
369 .mmc = 1, 598 .mmc = 1,
370 .wires = 4, 599 .wires = 4,
@@ -413,7 +642,7 @@ static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio,
413 642
414 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 643 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
415 mmc[0].gpio_cd = gpio + 0; 644 mmc[0].gpio_cd = gpio + 0;
416 twl4030_mmc_init(mmc); 645 omap2_hsmmc_init(mmc);
417 646
418 /* link regulators to MMC adapters */ 647 /* link regulators to MMC adapters */
419 cm_t35_vmmc1_supply.dev = mmc[0].dev; 648 cm_t35_vmmc1_supply.dev = mmc[0].dev;
@@ -445,6 +674,8 @@ static struct twl4030_platform_data cm_t35_twldata = {
445 .gpio = &cm_t35_gpio_data, 674 .gpio = &cm_t35_gpio_data,
446 .vmmc1 = &cm_t35_vmmc1, 675 .vmmc1 = &cm_t35_vmmc1,
447 .vsim = &cm_t35_vsim, 676 .vsim = &cm_t35_vsim,
677 .vdac = &cm_t35_vdac,
678 .vpll2 = &cm_t35_vpll2,
448}; 679};
449 680
450static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = { 681static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = {
@@ -479,7 +710,7 @@ static void __init cm_t35_init_irq(void)
479static void __init cm_t35_map_io(void) 710static void __init cm_t35_map_io(void)
480{ 711{
481 omap2_set_globals_343x(); 712 omap2_set_globals_343x();
482 omap2_map_common_io(); 713 omap34xx_map_common_io();
483} 714}
484 715
485static struct omap_board_mux board_mux[] __initdata = { 716static struct omap_board_mux board_mux[] __initdata = {
@@ -568,6 +799,11 @@ static struct omap_board_mux board_mux[] __initdata = {
568 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 799 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
569 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), 800 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
570 801
802 /* display controls */
803 OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
804 OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
805 OMAP3_MUX(GPMC_NCS3, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
806
571 /* TPS IRQ */ 807 /* TPS IRQ */
572 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \ 808 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \
573 OMAP_PIN_INPUT_PULLUP), 809 OMAP_PIN_INPUT_PULLUP),
@@ -575,6 +811,12 @@ static struct omap_board_mux board_mux[] __initdata = {
575 { .reg_offset = OMAP_MUX_TERMINATOR }, 811 { .reg_offset = OMAP_MUX_TERMINATOR },
576}; 812};
577 813
814static struct omap_musb_board_data musb_board_data = {
815 .interface_type = MUSB_INTERFACE_ULPI,
816 .mode = MUSB_OTG,
817 .power = 100,
818};
819
578static void __init cm_t35_init(void) 820static void __init cm_t35_init(void)
579{ 821{
580 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); 822 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
@@ -584,8 +826,9 @@ static void __init cm_t35_init(void)
584 cm_t35_init_ads7846(); 826 cm_t35_init_ads7846();
585 cm_t35_init_ethernet(); 827 cm_t35_init_ethernet();
586 cm_t35_init_led(); 828 cm_t35_init_led();
829 cm_t35_init_display();
587 830
588 usb_musb_init(); 831 usb_musb_init(&musb_board_data);
589} 832}
590 833
591MACHINE_START(CM_T35, "Compulab CM-T35") 834MACHINE_START(CM_T35, "Compulab CM-T35")