Commit 1238c684 authored by Yusuke Goda's avatar Yusuke Goda Committed by Paul Mundt

sh: Add support MMCIF for ecovec

This patch adds MMCIF platform data for the Ecovec board.
Signed-off-by: default avatarYusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 8fa76f7e
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mfd/sh_mobile_sdhi.h> #include <linux/mfd/sh_mobile_sdhi.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mmcif.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -435,7 +437,7 @@ static struct i2c_board_info ts_i2c_clients = { ...@@ -435,7 +437,7 @@ static struct i2c_board_info ts_i2c_clients = {
}; };
#ifdef CONFIG_MFD_SH_MOBILE_SDHI #ifdef CONFIG_MFD_SH_MOBILE_SDHI
/* SHDI0 */ /* SDHI0 */
static void sdhi0_set_pwr(struct platform_device *pdev, int state) static void sdhi0_set_pwr(struct platform_device *pdev, int state)
{ {
gpio_set_value(GPIO_PTB6, state); gpio_set_value(GPIO_PTB6, state);
...@@ -473,7 +475,8 @@ static struct platform_device sdhi0_device = { ...@@ -473,7 +475,8 @@ static struct platform_device sdhi0_device = {
}, },
}; };
/* SHDI1 */ #if !defined(CONFIG_MMC_SH_MMCIF)
/* SDHI1 */
static void sdhi1_set_pwr(struct platform_device *pdev, int state) static void sdhi1_set_pwr(struct platform_device *pdev, int state)
{ {
gpio_set_value(GPIO_PTB7, state); gpio_set_value(GPIO_PTB7, state);
...@@ -510,6 +513,7 @@ static struct platform_device sdhi1_device = { ...@@ -510,6 +513,7 @@ static struct platform_device sdhi1_device = {
.hwblk_id = HWBLK_SDHI1, .hwblk_id = HWBLK_SDHI1,
}, },
}; };
#endif /* CONFIG_MMC_SH_MMCIF */
#else #else
...@@ -818,6 +822,58 @@ static struct platform_device vou_device = { ...@@ -818,6 +822,58 @@ static struct platform_device vou_device = {
}, },
}; };
#if defined(CONFIG_MMC_SH_MMCIF)
/* SH_MMCIF */
static void mmcif_set_pwr(struct platform_device *pdev, int state)
{
gpio_set_value(GPIO_PTB7, state);
}
static void mmcif_down_pwr(struct platform_device *pdev)
{
gpio_set_value(GPIO_PTB7, 0);
}
static struct resource sh_mmcif_resources[] = {
[0] = {
.name = "SH_MMCIF",
.start = 0xA4CA0000,
.end = 0xA4CA00FF,
.flags = IORESOURCE_MEM,
},
[1] = {
/* MMC2I */
.start = 29,
.flags = IORESOURCE_IRQ,
},
[2] = {
/* MMC3I */
.start = 30,
.flags = IORESOURCE_IRQ,
},
};
struct sh_mmcif_plat_data sh_mmcif_plat = {
.set_pwr = mmcif_set_pwr,
.down_pwr = mmcif_down_pwr,
.sup_pclk = 0, /* SH7724: Max Pclk/2 */
.caps = MMC_CAP_4_BIT_DATA |
MMC_CAP_8_BIT_DATA |
MMC_CAP_NEEDS_POLL,
.ocr = MMC_VDD_32_33 | MMC_VDD_33_34,
};
static struct platform_device sh_mmcif_device = {
.name = "sh_mmcif",
.id = 0,
.dev = {
.platform_data = &sh_mmcif_plat,
},
.num_resources = ARRAY_SIZE(sh_mmcif_resources),
.resource = sh_mmcif_resources,
};
#endif
static struct platform_device *ecovec_devices[] __initdata = { static struct platform_device *ecovec_devices[] __initdata = {
&heartbeat_device, &heartbeat_device,
&nor_flash_device, &nor_flash_device,
...@@ -830,7 +886,9 @@ static struct platform_device *ecovec_devices[] __initdata = { ...@@ -830,7 +886,9 @@ static struct platform_device *ecovec_devices[] __initdata = {
&keysc_device, &keysc_device,
#ifdef CONFIG_MFD_SH_MOBILE_SDHI #ifdef CONFIG_MFD_SH_MOBILE_SDHI
&sdhi0_device, &sdhi0_device,
#if !defined(CONFIG_MMC_SH_MMCIF)
&sdhi1_device, &sdhi1_device,
#endif
#else #else
&msiof0_device, &msiof0_device,
#endif #endif
...@@ -840,6 +898,9 @@ static struct platform_device *ecovec_devices[] __initdata = { ...@@ -840,6 +898,9 @@ static struct platform_device *ecovec_devices[] __initdata = {
&fsi_device, &fsi_device,
&irda_device, &irda_device,
&vou_device, &vou_device,
#if defined(CONFIG_MMC_SH_MMCIF)
&sh_mmcif_device,
#endif
}; };
#ifdef CONFIG_I2C #ifdef CONFIG_I2C
...@@ -1133,6 +1194,7 @@ static int __init arch_setup(void) ...@@ -1133,6 +1194,7 @@ static int __init arch_setup(void)
gpio_request(GPIO_PTB6, NULL); gpio_request(GPIO_PTB6, NULL);
gpio_direction_output(GPIO_PTB6, 0); gpio_direction_output(GPIO_PTB6, 0);
#if !defined(CONFIG_MMC_SH_MMCIF)
/* enable SDHI1 on CN12 (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_SDHI1CD, NULL);
gpio_request(GPIO_FN_SDHI1WP, NULL); gpio_request(GPIO_FN_SDHI1WP, NULL);
...@@ -1147,6 +1209,7 @@ static int __init arch_setup(void) ...@@ -1147,6 +1209,7 @@ static int __init arch_setup(void)
/* I/O buffer drive ability is high for SDHI1 */ /* I/O buffer drive ability is high for SDHI1 */
__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA); __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
#endif /* CONFIG_MMC_SH_MMCIF */
#else #else
/* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */ /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
gpio_request(GPIO_FN_MSIOF0_TXD, NULL); gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
...@@ -1222,6 +1285,25 @@ static int __init arch_setup(void) ...@@ -1222,6 +1285,25 @@ static int __init arch_setup(void)
gpio_request(GPIO_PTU5, NULL); gpio_request(GPIO_PTU5, NULL);
gpio_direction_output(GPIO_PTU5, 0); gpio_direction_output(GPIO_PTU5, 0);
#if defined(CONFIG_MMC_SH_MMCIF)
/* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
gpio_request(GPIO_FN_MMC_D7, NULL);
gpio_request(GPIO_FN_MMC_D6, NULL);
gpio_request(GPIO_FN_MMC_D5, NULL);
gpio_request(GPIO_FN_MMC_D4, NULL);
gpio_request(GPIO_FN_MMC_D3, NULL);
gpio_request(GPIO_FN_MMC_D2, NULL);
gpio_request(GPIO_FN_MMC_D1, NULL);
gpio_request(GPIO_FN_MMC_D0, NULL);
gpio_request(GPIO_FN_MMC_CLK, NULL);
gpio_request(GPIO_FN_MMC_CMD, NULL);
gpio_request(GPIO_PTB7, NULL);
gpio_direction_output(GPIO_PTB7, 0);
/* I/O buffer drive ability is high for MMCIF */
__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
#endif
/* enable I2C device */ /* enable I2C device */
i2c_register_board_info(0, i2c0_devices, i2c_register_board_info(0, i2c0_devices,
ARRAY_SIZE(i2c0_devices)); ARRAY_SIZE(i2c0_devices));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment