diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2011-12-08 05:42:15 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-12-08 05:42:15 -0500 |
commit | 2a32daf117bdd1958d9297b19f1684737e742723 (patch) | |
tree | 18de3ca82d69fc0c9a13641688acdbe38e0d9139 /arch/mips/alchemy | |
parent | e734ae13f125096f8467f90e00c27166860245cd (diff) |
MIPS: Alchemy: Touchscreen support on DB1100
Wire up the ADS7846 touchscreen controller on the DB1100.
Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2879/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy')
-rw-r--r-- | arch/mips/alchemy/devboards/db1000.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c index 5206d2fbe0c6..1b81dbf6b804 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c | |||
@@ -28,6 +28,9 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/pm.h> | 30 | #include <linux/pm.h> |
31 | #include <linux/spi/spi.h> | ||
32 | #include <linux/spi/spi_gpio.h> | ||
33 | #include <linux/spi/ads7846.h> | ||
31 | #include <asm/mach-au1x00/au1000.h> | 34 | #include <asm/mach-au1x00/au1000.h> |
32 | #include <asm/mach-au1x00/au1000_dma.h> | 35 | #include <asm/mach-au1x00/au1000_dma.h> |
33 | #include <asm/mach-au1x00/au1100_mmc.h> | 36 | #include <asm/mach-au1x00/au1100_mmc.h> |
@@ -424,6 +427,43 @@ static struct platform_device db1000_irda_dev = { | |||
424 | .num_resources = ARRAY_SIZE(au1000_irda_res), | 427 | .num_resources = ARRAY_SIZE(au1000_irda_res), |
425 | }; | 428 | }; |
426 | 429 | ||
430 | /******************************************************************************/ | ||
431 | |||
432 | static struct ads7846_platform_data db1100_touch_pd = { | ||
433 | .model = 7846, | ||
434 | .vref_mv = 3300, | ||
435 | .gpio_pendown = 21, | ||
436 | }; | ||
437 | |||
438 | static struct spi_gpio_platform_data db1100_spictl_pd = { | ||
439 | .sck = 209, | ||
440 | .mosi = 208, | ||
441 | .miso = 207, | ||
442 | .num_chipselect = 1, | ||
443 | }; | ||
444 | |||
445 | static struct spi_board_info db1100_spi_info[] __initdata = { | ||
446 | [0] = { | ||
447 | .modalias = "ads7846", | ||
448 | .max_speed_hz = 3250000, | ||
449 | .bus_num = 0, | ||
450 | .chip_select = 0, | ||
451 | .mode = 0, | ||
452 | .irq = AU1100_GPIO21_INT, | ||
453 | .platform_data = &db1100_touch_pd, | ||
454 | .controller_data = (void *)210, /* for spi_gpio: CS# GPIO210 */ | ||
455 | }, | ||
456 | }; | ||
457 | |||
458 | static struct platform_device db1100_spi_dev = { | ||
459 | .name = "spi_gpio", | ||
460 | .id = 0, | ||
461 | .dev = { | ||
462 | .platform_data = &db1100_spictl_pd, | ||
463 | }, | ||
464 | }; | ||
465 | |||
466 | |||
427 | static struct platform_device *db1x00_devs[] = { | 467 | static struct platform_device *db1x00_devs[] = { |
428 | &db1x00_codec_dev, | 468 | &db1x00_codec_dev, |
429 | &alchemy_ac97c_dma_dev, | 469 | &alchemy_ac97c_dma_dev, |
@@ -440,12 +480,14 @@ static struct platform_device *db1100_devs[] = { | |||
440 | &db1100_mmc0_dev, | 480 | &db1100_mmc0_dev, |
441 | &db1100_mmc1_dev, | 481 | &db1100_mmc1_dev, |
442 | &db1000_irda_dev, | 482 | &db1000_irda_dev, |
483 | &db1100_spi_dev, | ||
443 | }; | 484 | }; |
444 | 485 | ||
445 | static int __init db1000_dev_init(void) | 486 | static int __init db1000_dev_init(void) |
446 | { | 487 | { |
447 | int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); | 488 | int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); |
448 | int c0, c1, d0, d1, s0, s1; | 489 | int c0, c1, d0, d1, s0, s1; |
490 | unsigned long pfc; | ||
449 | 491 | ||
450 | if (board == BCSR_WHOAMI_DB1500) { | 492 | if (board == BCSR_WHOAMI_DB1500) { |
451 | c0 = AU1500_GPIO2_INT; | 493 | c0 = AU1500_GPIO2_INT; |
@@ -464,6 +506,20 @@ static int __init db1000_dev_init(void) | |||
464 | 506 | ||
465 | gpio_direction_input(19); /* sd0 cd# */ | 507 | gpio_direction_input(19); /* sd0 cd# */ |
466 | gpio_direction_input(20); /* sd1 cd# */ | 508 | gpio_direction_input(20); /* sd1 cd# */ |
509 | gpio_direction_input(21); /* touch pendown# */ | ||
510 | gpio_direction_input(207); /* SPI MISO */ | ||
511 | gpio_direction_output(208, 0); /* SPI MOSI */ | ||
512 | gpio_direction_output(209, 1); /* SPI SCK */ | ||
513 | gpio_direction_output(210, 1); /* SPI CS# */ | ||
514 | |||
515 | /* spi_gpio on SSI0 pins */ | ||
516 | pfc = __raw_readl((void __iomem *)SYS_PINFUNC); | ||
517 | pfc |= (1 << 0); /* SSI0 pins as GPIOs */ | ||
518 | __raw_writel(pfc, (void __iomem *)SYS_PINFUNC); | ||
519 | wmb(); | ||
520 | |||
521 | spi_register_board_info(db1100_spi_info, | ||
522 | ARRAY_SIZE(db1100_spi_info)); | ||
467 | 523 | ||
468 | platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs)); | 524 | platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs)); |
469 | } else if (board == BCSR_WHOAMI_DB1000) { | 525 | } else if (board == BCSR_WHOAMI_DB1000) { |