aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c97
1 files changed, 95 insertions, 2 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 826e62326d51..cfd958c613d4 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -19,6 +19,10 @@
19#include <linux/usb/r8a66597.h> 19#include <linux/usb/r8a66597.h>
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/i2c/tsc2007.h> 21#include <linux/i2c/tsc2007.h>
22#include <linux/spi/spi.h>
23#include <linux/spi/sh_msiof.h>
24#include <linux/spi/mmc_spi.h>
25#include <linux/mmc/host.h>
22#include <linux/input.h> 26#include <linux/input.h>
23#include <linux/input/sh_keysc.h> 27#include <linux/input/sh_keysc.h>
24#include <linux/mfd/sh_mobile_sdhi.h> 28#include <linux/mfd/sh_mobile_sdhi.h>
@@ -421,6 +425,7 @@ static struct i2c_board_info ts_i2c_clients = {
421 .irq = IRQ0, 425 .irq = IRQ0,
422}; 426};
423 427
428#ifdef CONFIG_MFD_SH_MOBILE_SDHI
424/* SHDI0 */ 429/* SHDI0 */
425static void sdhi0_set_pwr(struct platform_device *pdev, int state) 430static void sdhi0_set_pwr(struct platform_device *pdev, int state)
426{ 431{
@@ -493,6 +498,73 @@ static struct platform_device sdhi1_device = {
493 }, 498 },
494}; 499};
495 500
501#else
502
503static int mmc_spi_get_ro(struct device *dev)
504{
505 return gpio_get_value(GPIO_PTY6);
506}
507
508static int mmc_spi_get_cd(struct device *dev)
509{
510 return !gpio_get_value(GPIO_PTY7);
511}
512
513static void mmc_spi_setpower(struct device *dev, unsigned int maskval)
514{
515 gpio_set_value(GPIO_PTB6, maskval ? 1 : 0);
516}
517
518static struct mmc_spi_platform_data mmc_spi_info = {
519 .get_ro = mmc_spi_get_ro,
520 .get_cd = mmc_spi_get_cd,
521 .caps = MMC_CAP_NEEDS_POLL,
522 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */
523 .setpower = mmc_spi_setpower,
524};
525
526static struct spi_board_info spi_bus[] = {
527 {
528 .modalias = "mmc_spi",
529 .platform_data = &mmc_spi_info,
530 .max_speed_hz = 5000000,
531 .mode = SPI_MODE_0,
532 .controller_data = (void *) GPIO_PTM4,
533 },
534};
535
536static struct sh_msiof_spi_info msiof0_data = {
537 .num_chipselect = 1,
538};
539
540static struct resource msiof0_resources[] = {
541 [0] = {
542 .name = "MSIOF0",
543 .start = 0xa4c40000,
544 .end = 0xa4c40063,
545 .flags = IORESOURCE_MEM,
546 },
547 [1] = {
548 .start = 84,
549 .flags = IORESOURCE_IRQ,
550 },
551};
552
553static struct platform_device msiof0_device = {
554 .name = "spi_sh_msiof",
555 .id = 0, /* MSIOF0 */
556 .dev = {
557 .platform_data = &msiof0_data,
558 },
559 .num_resources = ARRAY_SIZE(msiof0_resources),
560 .resource = msiof0_resources,
561 .archdata = {
562 .hwblk_id = HWBLK_MSIOF0,
563 },
564};
565
566#endif
567
496static struct platform_device *ecovec_devices[] __initdata = { 568static struct platform_device *ecovec_devices[] __initdata = {
497 &heartbeat_device, 569 &heartbeat_device,
498 &nor_flash_device, 570 &nor_flash_device,
@@ -503,8 +575,12 @@ static struct platform_device *ecovec_devices[] __initdata = {
503 &ceu0_device, 575 &ceu0_device,
504 &ceu1_device, 576 &ceu1_device,
505 &keysc_device, 577 &keysc_device,
578#ifdef CONFIG_MFD_SH_MOBILE_SDHI
506 &sdhi0_device, 579 &sdhi0_device,
507 &sdhi1_device, 580 &sdhi1_device,
581#else
582 &msiof0_device,
583#endif
508}; 584};
509 585
510#define EEPROM_ADDR 0x50 586#define EEPROM_ADDR 0x50
@@ -773,7 +849,8 @@ static int __init arch_setup(void)
773 gpio_direction_input(GPIO_PTR5); 849 gpio_direction_input(GPIO_PTR5);
774 gpio_direction_input(GPIO_PTR6); 850 gpio_direction_input(GPIO_PTR6);
775 851
776 /* enable SDHI0 (needs DS2.4 set to ON) */ 852#ifdef CONFIG_MFD_SH_MOBILE_SDHI
853 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
777 gpio_request(GPIO_FN_SDHI0CD, NULL); 854 gpio_request(GPIO_FN_SDHI0CD, NULL);
778 gpio_request(GPIO_FN_SDHI0WP, NULL); 855 gpio_request(GPIO_FN_SDHI0WP, NULL);
779 gpio_request(GPIO_FN_SDHI0CMD, NULL); 856 gpio_request(GPIO_FN_SDHI0CMD, NULL);
@@ -785,7 +862,7 @@ static int __init arch_setup(void)
785 gpio_request(GPIO_PTB6, NULL); 862 gpio_request(GPIO_PTB6, NULL);
786 gpio_direction_output(GPIO_PTB6, 0); 863 gpio_direction_output(GPIO_PTB6, 0);
787 864
788 /* enable SDHI1 (needs DS2.6,7 set to ON,OFF) */ 865 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
789 gpio_request(GPIO_FN_SDHI1CD, NULL); 866 gpio_request(GPIO_FN_SDHI1CD, NULL);
790 gpio_request(GPIO_FN_SDHI1WP, NULL); 867 gpio_request(GPIO_FN_SDHI1WP, NULL);
791 gpio_request(GPIO_FN_SDHI1CMD, NULL); 868 gpio_request(GPIO_FN_SDHI1CMD, NULL);
@@ -799,6 +876,22 @@ static int __init arch_setup(void)
799 876
800 /* I/O buffer drive ability is high for SDHI1 */ 877 /* I/O buffer drive ability is high for SDHI1 */
801 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA); 878 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
879#else
880 /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
881 gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
882 gpio_request(GPIO_FN_MSIOF0_RXD, NULL);
883 gpio_request(GPIO_FN_MSIOF0_TSCK, NULL);
884 gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */
885 gpio_direction_output(GPIO_PTM4, 1); /* active low CS */
886 gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */
887 gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
888 gpio_request(GPIO_PTY6, NULL); /* write protect */
889 gpio_direction_input(GPIO_PTY6);
890 gpio_request(GPIO_PTY7, NULL); /* card detect */
891 gpio_direction_input(GPIO_PTY7);
892
893 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
894#endif
802 895
803 /* enable I2C device */ 896 /* enable I2C device */
804 i2c_register_board_info(1, i2c1_devices, 897 i2c_register_board_info(1, i2c1_devices,