Skip to contentSkip to conversation

sh: ap325rxa MMC support using spi_gpio and mmc_spi

PATCH New Magnus Damm 1 participant 1 message Oct 22, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: ap325rxa MMC support using spi_gpio and mmc_spi

From: Magnus Damm <[email protected]>

This patch adds CN3 MMC support for ap325rxa using the mmc_spi driver on top of the bitbanging spi_gpio driver.

---

 arch/sh/boards/board-ap325rxa.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
arch/sh/boards/board-ap325rxa.c +29 -0
@@ -20,6 +20,8 @@
 #include <linux/i2c.h>
 #include <linux/smc911x.h>
 #include <linux/gpio.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_gpio.h>
 #include <media/soc_camera_platform.h>
 #include <media/sh_mobile_ceu.h>
 #include <video/sh_mobile_lcdc.h>
@@ -310,6 +312,20 @@ static struct platform_device ceu_device
 	},
 };
 
+struct spi_gpio_platform_data sdcard_cn3_platform_data = {
+	.sck = GPIO_PTD0,
+	.mosi = GPIO_PTD1,
+	.miso = GPIO_PTD2,
+	.num_chipselect = 1,
+};
+
+static struct platform_device sdcard_cn3_device = {
+	.name		= "spi_gpio",
+	.dev	= {
+		.platform_data	= &sdcard_cn3_platform_data,
+	},
+};
+
 static struct platform_device *ap325rxa_devices[] __initdata = {
 	&smc9118_device,
 	&ap325rxa_nor_flash_device,
@@ -319,6 +335,7 @@ static struct platform_device *ap325rxa_
 	&camera_device,
 #endif
 	&nand_flash_device,
+	&sdcard_cn3_device,
 };
 
 static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
@@ -327,6 +344,15 @@ static struct i2c_board_info __initdata 
 	},
 };
 
+static struct spi_board_info ap325rxa_spi_devices[] = {
+	{
+		.modalias = "mmc_spi",
+		.max_speed_hz = 5000000,
+		.chip_select = 0,
+		.controller_data = (void *) GPIO_PTD5,
+	},
+};
+
 static int __init ap325rxa_devices_setup(void)
 {
 	/* LD3 and LD4 LEDs */
@@ -426,6 +452,9 @@ static int __init ap325rxa_devices_setup
 	i2c_register_board_info(0, ap325rxa_i2c_devices,
 				ARRAY_SIZE(ap325rxa_i2c_devices));
 
+	spi_register_board_info(ap325rxa_spi_devices,
+				ARRAY_SIZE(ap325rxa_spi_devices));
+
 	return platform_add_devices(ap325rxa_devices,
 				ARRAY_SIZE(ap325rxa_devices));
 }