Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177039
b: refs/heads/master
c: 1ce4da7
h: refs/heads/master
i:
  177037: 9020fd1
  177035: 2519050
  177031: 4e9a3dd
  177023: 9c92da6
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Dec 15, 2009
1 parent 8461237 commit d94856a
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e0aa51f54faa0659b529143de6c608e76675326f
refs/heads/master: 1ce4da7a502ea637748bc55460fc43eb2acc4f01
97 changes: 95 additions & 2 deletions trunk/arch/sh/boards/mach-ecovec24/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <linux/usb/r8a66597.h>
#include <linux/i2c.h>
#include <linux/i2c/tsc2007.h>
#include <linux/spi/spi.h>
#include <linux/spi/sh_msiof.h>
#include <linux/spi/mmc_spi.h>
#include <linux/mmc/host.h>
#include <linux/input.h>
#include <linux/input/sh_keysc.h>
#include <linux/mfd/sh_mobile_sdhi.h>
Expand Down Expand Up @@ -421,6 +425,7 @@ static struct i2c_board_info ts_i2c_clients = {
.irq = IRQ0,
};

#ifdef CONFIG_MFD_SH_MOBILE_SDHI
/* SHDI0 */
static void sdhi0_set_pwr(struct platform_device *pdev, int state)
{
Expand Down Expand Up @@ -493,6 +498,73 @@ static struct platform_device sdhi1_device = {
},
};

#else

static int mmc_spi_get_ro(struct device *dev)
{
return gpio_get_value(GPIO_PTY6);
}

static int mmc_spi_get_cd(struct device *dev)
{
return !gpio_get_value(GPIO_PTY7);
}

static void mmc_spi_setpower(struct device *dev, unsigned int maskval)
{
gpio_set_value(GPIO_PTB6, maskval ? 1 : 0);
}

static struct mmc_spi_platform_data mmc_spi_info = {
.get_ro = mmc_spi_get_ro,
.get_cd = mmc_spi_get_cd,
.caps = MMC_CAP_NEEDS_POLL,
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */
.setpower = mmc_spi_setpower,
};

static struct spi_board_info spi_bus[] = {
{
.modalias = "mmc_spi",
.platform_data = &mmc_spi_info,
.max_speed_hz = 5000000,
.mode = SPI_MODE_0,
.controller_data = (void *) GPIO_PTM4,
},
};

static struct sh_msiof_spi_info msiof0_data = {
.num_chipselect = 1,
};

static struct resource msiof0_resources[] = {
[0] = {
.name = "MSIOF0",
.start = 0xa4c40000,
.end = 0xa4c40063,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 84,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device msiof0_device = {
.name = "spi_sh_msiof",
.id = 0, /* MSIOF0 */
.dev = {
.platform_data = &msiof0_data,
},
.num_resources = ARRAY_SIZE(msiof0_resources),
.resource = msiof0_resources,
.archdata = {
.hwblk_id = HWBLK_MSIOF0,
},
};

#endif

static struct platform_device *ecovec_devices[] __initdata = {
&heartbeat_device,
&nor_flash_device,
Expand All @@ -503,8 +575,12 @@ static struct platform_device *ecovec_devices[] __initdata = {
&ceu0_device,
&ceu1_device,
&keysc_device,
#ifdef CONFIG_MFD_SH_MOBILE_SDHI
&sdhi0_device,
&sdhi1_device,
#else
&msiof0_device,
#endif
};

#define EEPROM_ADDR 0x50
Expand Down Expand Up @@ -773,7 +849,8 @@ static int __init arch_setup(void)
gpio_direction_input(GPIO_PTR5);
gpio_direction_input(GPIO_PTR6);

/* enable SDHI0 (needs DS2.4 set to ON) */
#ifdef CONFIG_MFD_SH_MOBILE_SDHI
/* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
gpio_request(GPIO_FN_SDHI0CD, NULL);
gpio_request(GPIO_FN_SDHI0WP, NULL);
gpio_request(GPIO_FN_SDHI0CMD, NULL);
Expand All @@ -785,7 +862,7 @@ static int __init arch_setup(void)
gpio_request(GPIO_PTB6, NULL);
gpio_direction_output(GPIO_PTB6, 0);

/* enable SDHI1 (needs DS2.6,7 set to ON,OFF) */
/* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
gpio_request(GPIO_FN_SDHI1CD, NULL);
gpio_request(GPIO_FN_SDHI1WP, NULL);
gpio_request(GPIO_FN_SDHI1CMD, NULL);
Expand All @@ -799,6 +876,22 @@ static int __init arch_setup(void)

/* I/O buffer drive ability is high for SDHI1 */
ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
#else
/* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
gpio_request(GPIO_FN_MSIOF0_RXD, NULL);
gpio_request(GPIO_FN_MSIOF0_TSCK, NULL);
gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */
gpio_direction_output(GPIO_PTM4, 1); /* active low CS */
gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */
gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
gpio_request(GPIO_PTY6, NULL); /* write protect */
gpio_direction_input(GPIO_PTY6);
gpio_request(GPIO_PTY7, NULL); /* card detect */
gpio_direction_input(GPIO_PTY7);

spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
#endif

/* enable I2C device */
i2c_register_board_info(1, i2c1_devices,
Expand Down

0 comments on commit d94856a

Please sign in to comment.