sh: Migo-R MMC support using spi_gpio and mmc_spi.
authorMagnus Damm <damm@igel.co.jp>
Wed, 7 Jan 2009 11:36:10 +0000 (20:36 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 21 Jan 2009 08:43:23 +0000 (17:43 +0900)
This patch adds CN9 MMC support for MigoR using the mmc_spi
driver on top of the bitbanging spi_gpio driver.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/boards/mach-migor/setup.c

index 53537fec31944c590d1eba5eeb534b8044faed57..28e56c5809a2187f543afa749465651a29c47ded 100644 (file)
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_gpio.h>
+#include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
 #include <media/ov772x.h>
 #include <media/tw9910.h>
-#include <video/sh_mobile_lcdc.h>
 #include <asm/clock.h>
 #include <asm/machvec.h>
 #include <asm/io.h>
@@ -395,6 +397,20 @@ static struct tw9910_video_info tw9910_info = {
        }
 };
 
+struct spi_gpio_platform_data sdcard_cn9_platform_data = {
+       .sck = GPIO_PTD0,
+       .mosi = GPIO_PTD1,
+       .miso = GPIO_PTD2,
+       .num_chipselect = 1,
+};
+
+static struct platform_device sdcard_cn9_device = {
+       .name           = "spi_gpio",
+       .dev    = {
+               .platform_data  = &sdcard_cn9_platform_data,
+       },
+};
+
 static struct platform_device *migor_devices[] __initdata = {
        &smc91x_eth_device,
        &sh_keysc_device,
@@ -402,6 +418,7 @@ static struct platform_device *migor_devices[] __initdata = {
        &migor_ceu_device,
        &migor_nor_flash_device,
        &migor_nand_flash_device,
+       &sdcard_cn9_device,
 };
 
 static struct i2c_board_info migor_i2c_devices[] = {
@@ -422,6 +439,15 @@ static struct i2c_board_info migor_i2c_devices[] = {
        },
 };
 
+static struct spi_board_info migor_spi_devices[] = {
+       {
+               .modalias = "mmc_spi",
+               .max_speed_hz = 5000000,
+               .chip_select = 0,
+               .controller_data = (void *) GPIO_PTD5,
+       },
+};
+
 static int __init migor_devices_setup(void)
 {
        /* Lit D11 LED */
@@ -544,6 +570,9 @@ static int __init migor_devices_setup(void)
        i2c_register_board_info(0, migor_i2c_devices,
                                ARRAY_SIZE(migor_i2c_devices));
 
+       spi_register_board_info(migor_spi_devices,
+                               ARRAY_SIZE(migor_spi_devices));
+
        return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
 }
 __initcall(migor_devices_setup);