Skip to contentSkip to conversation

sh: SuperH Mobile SDHI changes

PATCH In review Magnus Damm 4 participants 12 messages Oct 2, 2009 – Oct 8, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover sh: SuperH Mobile SDHI changes

sh: SuperH Mobile SDHI changes

[PATCH 01/07] mfd: Add SuperH Mobile SDHI platform driver [PATCH 02/07] mmc: Add SuperH to the tmio-mmc Kconfig [PATCH 03/07] mmc: Remove const from tmio-mmc platform data [PATCH 04/07] sh: SDHI platform data to the Migo-R board [PATCH 05/07] sh: SDHI platform data to the AP325RXA board [PATCH 06/07] sh: SDHI platform data to the SE7724 board [PATCH 07/07] sh: SDHI platform data to the kfr2r09 board

These patches contain the SuperH specific changes needed for the tmio-mmc driver to work with SuperH Mobile SDHI hardware.

The tmio-mmc patch 0001-MMC-hardware-abstraction-for-CNF-area.patch by Ian Molton is needed for correct run time behaviour. Without this patch the tmio-mmc probe() fails gracefully.

I suggest merging the series in the SuperH tree. Not sure about the best way to merge the patch by Ian.

---

 arch/sh/boards/board-ap325rxa.c     |   52 ++++++------
 arch/sh/boards/mach-kfr2r09/setup.c |   33 +++++++
 arch/sh/boards/mach-migor/setup.c   |   52 ++++++------
 arch/sh/boards/mach-se/7724/setup.c |   33 +++++++
 drivers/mfd/Kconfig                 |    8 +
 drivers/mfd/Makefile                |    1 
 drivers/mfd/sh_mobile_sdhi.c        |  149 ++++++++++++++++++++++++++++++++++-
 drivers/mmc/host/Kconfig            |    2 
 include/linux/mfd/tmio.h            |    2 
 9 files changed, 279 insertions(+), 53 deletions(-)
#1 lore raw

PATCH 1/7 mfd: Add SuperH Mobile SDHI platform driver

From: Magnus Damm <[email protected]>

This patch adds an MFD driver for the SuperH Mobile SDHI hardware block. At this point the driver simply wraps the tmio-mmc driver with some clock code. In the future this driver is the place to put SDHI specific hotplug code.

---

 drivers/mfd/Kconfig          |    8 ++
 drivers/mfd/Makefile         |    1 
 drivers/mfd/sh_mobile_sdhi.c |  145 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+)
drivers/mfd/Kconfig +8 -0
@@ -35,6 +35,14 @@ config MFD_ASIC3
 	  This driver supports the ASIC3 multifunction chip found on many
 	  PDAs (mainly iPAQ and HTC based ones)
 
+config MFD_SH_MOBILE_SDHI
+	bool "Support for SuperH Mobile SDHI"
+	depends on SUPERH
+	select MFD_CORE
+	 ---help---
+	  This driver supports the SDHI hardware block found in many
+	  SuperH Mobile SoC:s.
+
 config MFD_DM355EVM_MSP
 	bool "DaVinci DM355 EVM microcontroller"
 	depends on I2C && MACH_DAVINCI_DM355_EVM
drivers/mfd/Makefile +1 -0
@@ -4,6 +4,7 @@
 
 obj-$(CONFIG_MFD_SM501)		+= sm501.o
 obj-$(CONFIG_MFD_ASIC3)		+= asic3.o
+obj-$(CONFIG_MFD_SH_MOBILE_SDHI)		+= sh_mobile_sdhi.o
 
 obj-$(CONFIG_HTC_EGPIO)		+= htc-egpio.o
 obj-$(CONFIG_HTC_PASIC3)	+= htc-pasic3.o
drivers/mfd/sh_mobile_sdhi.c new file +145 -0

145 lines not on this page · raw message

#2 lore raw

PATCH 2/7 mmc: Add SuperH to the tmio-mmc Kconfig

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add SUPERH to the Kconfig dependencies for tmio_mmc.

This change allows us to drive the SDHI hardware blocks found in SuperH Mobile with tmio_mmc.

---

 drivers/mmc/host/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/Kconfig +1 -1
@@ -288,7 +288,7 @@ config MMC_SDRICOH_CS
 
 config MMC_TMIO
 	tristate "Toshiba Mobile IO Controller (TMIO) MMC/SD function support"
-	depends on MFD_TMIO || MFD_ASIC3
+	depends on MFD_TMIO || MFD_ASIC3 || SUPERH
 	help
 	  This provides support for the SD/MMC cell found in TC6393XB,
 	  T7L66XB and also HTC ASIC3
#3 lore raw

PATCH 3/7 mmc: Remove const from tmio-mmc platform data

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove const from the hclk member of the tmio-mmc platform data. This to allow assigning a value dynamically to the platform data in the SuperH Mobile SDHI driver.

---

Depends on the SuperH Mobile SDHI driver.

 drivers/mfd/sh_mobile_sdhi.c |    4 +---
 include/linux/mfd/tmio.h     |    2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/mfd/sh_mobile_sdhi.c +1 -3
@@ -84,9 +84,7 @@ static int __init sh_mobile_sdhi_probe(s
 	}
 
 	clk_enable(priv->clk);
-
-	/* FIXME: silly const unsigned int hclk */
-	*(unsigned int *)&priv->mmc_data.hclk = clk_get_rate(priv->clk);
+	priv->mmc_data.hclk = clk_get_rate(priv->clk);
 
 	memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
 	priv->cell_mmc.driver_data = &priv->mmc_data;
include/linux/mfd/tmio.h +1 -1
@@ -53,7 +53,7 @@ void tmio_core_mmc_clk_div(void __iomem 
  * data for the MMC controller
  */
 struct tmio_mmc_data {
-	const unsigned int		hclk;
+	unsigned int		hclk;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_no_clk_div)(struct platform_device *host, int state);
 };
#4 lore raw

PATCH 4/7 sh: SDHI platform data to the Migo-R board

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Convert the Migo-R board to use sh_mobile_sdhi for the SD Card connected to CN9 instead of mmc_spi.

---

 arch/sh/boards/mach-migor/setup.c |   52 +++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 24 deletions(-)
arch/sh/boards/mach-migor/setup.c +28 -24
@@ -18,8 +18,6 @@
 #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>
@@ -390,17 +388,25 @@ static struct platform_device migor_ceu_
 	},
 };
 
-struct spi_gpio_platform_data sdcard_cn9_platform_data = {
-	.sck = GPIO_PTD0,
-	.mosi = GPIO_PTD1,
-	.miso = GPIO_PTD2,
-	.num_chipselect = 1,
+static struct resource sdhi_cn9_resources[] = {
+	[0] = {
+		.name	= "SDHI",
+		.start	= 0x04ce0000,
+		.end	= 0x04ce01ff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= 101,
+		.flags  = IORESOURCE_IRQ,
+	},
 };
 
-static struct platform_device sdcard_cn9_device = {
-	.name		= "spi_gpio",
-	.dev	= {
-		.platform_data	= &sdcard_cn9_platform_data,
+static struct platform_device sdhi_cn9_device = {
+	.name		= "sh_mobile_sdhi",
+	.num_resources	= ARRAY_SIZE(sdhi_cn9_resources),
+	.resource	= sdhi_cn9_resources,
+	.archdata = {
+		.hwblk_id = HWBLK_SDHI,
 	},
 };
 
@@ -467,20 +473,11 @@ static struct platform_device *migor_dev
 	&migor_ceu_device,
 	&migor_nor_flash_device,
 	&migor_nand_flash_device,
-	&sdcard_cn9_device,
+	&sdhi_cn9_device,
 	&migor_camera[0],
 	&migor_camera[1],
 };
 
-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)
 {
 
@@ -525,6 +522,16 @@ static int __init migor_devices_setup(vo
 	gpio_request(GPIO_PTA1, NULL);
 	gpio_direction_input(GPIO_PTA1);
 
+	/* SDHI */
+	gpio_request(GPIO_FN_SDHICD, NULL);
+	gpio_request(GPIO_FN_SDHIWP, NULL);
+	gpio_request(GPIO_FN_SDHID3, NULL);
+	gpio_request(GPIO_FN_SDHID2, NULL);
+	gpio_request(GPIO_FN_SDHID1, NULL);
+	gpio_request(GPIO_FN_SDHID0, NULL);
+	gpio_request(GPIO_FN_SDHICMD, NULL);
+	gpio_request(GPIO_FN_SDHICLK, NULL);
+
 	/* Touch Panel */
 	gpio_request(GPIO_FN_IRQ6, NULL);
 
@@ -612,9 +619,6 @@ static int __init migor_devices_setup(vo
 	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));
 }
 arch_initcall(migor_devices_setup);
#5 lore raw

PATCH 5/7 sh: SDHI platform data to the AP325RXA board

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Convert the AP325 board to use sh_mobile_sdhi for the SD Card connected to CN3 instead of mmc_spi.

---

 arch/sh/boards/board-ap325rxa.c |   52 +++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 24 deletions(-)
arch/sh/boards/board-ap325rxa.c +28 -24
@@ -20,8 +20,6 @@
 #include <linux/i2c.h>
 #include <linux/smsc911x.h>
 #include <linux/gpio.h>
-#include <linux/spi/spi.h>
-#include <linux/spi/spi_gpio.h>
 #include <media/ov772x.h>
 #include <media/soc_camera.h>
 #include <media/soc_camera_platform.h>
@@ -409,17 +407,25 @@ 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 resource sdhi0_cn3_resources[] = {
+	[0] = {
+		.name	= "SDHI0",
+		.start	= 0x04ce0000,
+		.end	= 0x04ce01ff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= 101,
+		.flags  = IORESOURCE_IRQ,
+	},
 };
 
-static struct platform_device sdcard_cn3_device = {
-	.name		= "spi_gpio",
-	.dev	= {
-		.platform_data	= &sdcard_cn3_platform_data,
+static struct platform_device sdhi0_cn3_device = {
+	.name		= "sh_mobile_sdhi",
+	.num_resources	= ARRAY_SIZE(sdhi0_cn3_resources),
+	.resource	= sdhi0_cn3_resources,
+	.archdata = {
+		.hwblk_id = HWBLK_SDHI0,
 	},
 };
 
@@ -470,20 +476,11 @@ static struct platform_device *ap325rxa_
 	&lcdc_device,
 	&ceu_device,
 	&nand_flash_device,
-	&sdcard_cn3_device,
+	&sdhi0_cn3_device,
 	&ap325rxa_camera[0],
 	&ap325rxa_camera[1],
 };
 
-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 */
@@ -578,12 +575,19 @@ static int __init ap325rxa_devices_setup
 
 	platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20);
 
+	/* SDHI0 */
+	gpio_request(GPIO_FN_SDHI0CD_PTD, NULL);
+	gpio_request(GPIO_FN_SDHI0WP_PTD, NULL);
+	gpio_request(GPIO_FN_SDHI0D3_PTD, NULL);
+	gpio_request(GPIO_FN_SDHI0D2_PTD, NULL);
+	gpio_request(GPIO_FN_SDHI0D1_PTD, NULL);
+	gpio_request(GPIO_FN_SDHI0D0_PTD, NULL);
+	gpio_request(GPIO_FN_SDHI0CMD_PTD, NULL);
+	gpio_request(GPIO_FN_SDHI0CLK_PTD, NULL);
+
 	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));
 }
#6 lore raw

PATCH 6/7 sh: SDHI platform data to the SE7724 board

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add SD Card support to the se7724 board using the
sh_mobile_sdhi driver hooked up to SDHI0 and CN7.

---

 arch/sh/boards/mach-se/7724/setup.c |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/sh/boards/mach-se/7724/setup.c +33 -0
@@ -448,6 +448,28 @@ static struct platform_device sh7724_usb
 	.resource	= sh7724_usb1_gadget_resources,
 };
 
+static struct resource sdhi0_cn7_resources[] = {
+	[0] = {
+		.name	= "SDHI0",
+		.start  = 0x04ce0000,
+		.end    = 0x04ce01ff,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = 101,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sdhi0_cn7_device = {
+	.name           = "sh_mobile_sdhi",
+	.num_resources  = ARRAY_SIZE(sdhi0_cn7_resources),
+	.resource       = sdhi0_cn7_resources,
+	.archdata = {
+		.hwblk_id = HWBLK_SDHI0,
+	},
+};
+
 static struct platform_device *ms7724se_devices[] __initdata = {
 	&heartbeat_device,
 	&smc91x_eth_device,
@@ -460,6 +482,7 @@ static struct platform_device *ms7724se_
 	&sh7724_usb0_host_device,
 	&sh7724_usb1_gadget_device,
 	&fsi_device,
+	&sdhi0_cn7_device,
 };
 
 #define EEPROM_OP   0xBA206000
@@ -698,6 +721,16 @@ static int __init devices_setup(void)
 	clk_set_rate(&fsimcka_clk, 11000);
 	clk_put(fsia_clk);
 
+	/* SDHI0 connected to cn7 */
+	gpio_request(GPIO_FN_SDHI0CD, NULL);
+	gpio_request(GPIO_FN_SDHI0WP, NULL);
+	gpio_request(GPIO_FN_SDHI0D3, NULL);
+	gpio_request(GPIO_FN_SDHI0D2, NULL);
+	gpio_request(GPIO_FN_SDHI0D1, NULL);
+	gpio_request(GPIO_FN_SDHI0D0, NULL);
+	gpio_request(GPIO_FN_SDHI0CMD, NULL);
+	gpio_request(GPIO_FN_SDHI0CLK, NULL);
+
 	/*
 	 * enable SH-Eth
 	 *
#7 lore raw

PATCH 7/7 sh: SDHI platform data to the kfr2r09 board

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add SD Card support to the kfr2r09 board using the sh_mobile_sdhi driver hooked up to SDHI0 and yc304.

---

 arch/sh/boards/mach-kfr2r09/setup.c |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/sh/boards/mach-kfr2r09/setup.c +33 -0
@@ -212,11 +212,34 @@ static struct platform_device kfr2r09_us
 	.resource	= kfr2r09_usb0_gadget_resources,
 };
 
+static struct resource kfr2r09_sh_sdhi0_resources[] = {
+	[0] = {
+		.name	= "SDHI0",
+		.start  = 0x04ce0000,
+		.end    = 0x04ce01ff,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = 101,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device kfr2r09_sh_sdhi0_device = {
+	.name           = "sh_mobile_sdhi",
+	.num_resources  = ARRAY_SIZE(kfr2r09_sh_sdhi0_resources),
+	.resource       = kfr2r09_sh_sdhi0_resources,
+	.archdata = {
+		.hwblk_id = HWBLK_SDHI0,
+	},
+};
+
 static struct platform_device *kfr2r09_devices[] __initdata = {
 	&kfr2r09_nor_flash_device,
 	&kfr2r09_nand_flash_device,
 	&kfr2r09_sh_keysc_device,
 	&kfr2r09_sh_lcdc_device,
+	&kfr2r09_sh_sdhi0_device,
 };
 
 #define BSC_CS0BCR 0xfec10004
@@ -361,6 +384,16 @@ static int __init kfr2r09_devices_setup(
 	if (kfr2r09_usb0_gadget_setup() = 0)
 		platform_device_register(&kfr2r09_usb0_gadget_device);
 
+	/* SDHI0 connected to yc304 */
+	gpio_request(GPIO_FN_SDHI0CD, NULL);
+	gpio_request(GPIO_FN_SDHI0WP, NULL);
+	gpio_request(GPIO_FN_SDHI0D3, NULL);
+	gpio_request(GPIO_FN_SDHI0D2, NULL);
+	gpio_request(GPIO_FN_SDHI0D1, NULL);
+	gpio_request(GPIO_FN_SDHI0D0, NULL);
+	gpio_request(GPIO_FN_SDHI0CMD, NULL);
+	gpio_request(GPIO_FN_SDHI0CLK, NULL);
+
 	return platform_add_devices(kfr2r09_devices,
 				    ARRAY_SIZE(kfr2r09_devices));
 }
#8 lore raw
In reply to Magnus Damm

I'm ok with the superH patches now. Those that depend on my patchset which will be waiting on ASIC3 (my patchset needs to support ASIC3 to avoid breaking already merged drivers).

Andrew: am I passing MMC patches via you?

2009/10/2 Magnus Damm <[email protected]>:

Quoted 34 lines

sh: SuperH Mobile SDHI changes

[PATCH 01/07] mfd: Add SuperH Mobile SDHI platform driver [PATCH 02/07] mmc: Add SuperH to the tmio-mmc Kconfig [PATCH 03/07] mmc: Remove const from tmio-mmc platform data [PATCH 04/07] sh: SDHI platform data to the Migo-R board [PATCH 05/07] sh: SDHI platform data to the AP325RXA board [PATCH 06/07] sh: SDHI platform data to the SE7724 board [PATCH 07/07] sh: SDHI platform data to the kfr2r09 board

These patches contain the SuperH specific changes needed for the tmio-mmc driver to work with SuperH Mobile SDHI hardware.

The tmio-mmc patch 0001-MMC-hardware-abstraction-for-CNF-area.patch by Ian Molton is needed for correct run time behaviour. Without this patch the tmio-mmc probe() fails gracefully.

I suggest merging the series in the SuperH tree. Not sure about the best way to merge the patch by Ian.

---

 arch/sh/boards/board-ap325rxa.c     |   52 ++++++------ arch/sh/boards/mach-kfr2r09/setup.c |   33 +++++++ arch/sh/boards/mach-migor/setup.c   |   52 ++++++------ arch/sh/boards/mach-se/7724/setup.c |   33 +++++++ drivers/mfd/Kconfig                 |    8 +
 drivers/mfd/Makefile                |    1 drivers/mfd/sh_mobile_sdhi.c        |  149 ++++++++++++++++++++++++++++++++++- drivers/mmc/host/Kconfig            |    2 include/linux/mfd/tmio.h            |    2

 9 files changed, 279 insertions(+), 53 deletions(-)
Signature · 3 lines
Ian Molton
Linux, Automotive, and other hacking:
http://www.mnementh.co.uk/
#9 lore raw
Quoted 6 lines · On Fri, 2 Oct 2009 19:23:28 +0100 Ian Molton <[email protected]> wrote:

I'm ok with the superH patches now. Those that depend on my patchset which will be waiting on ASIC3 (my patchset needs to support ASIC3 to avoid breaking already merged drivers).

Andrew: am I passing MMC patches via you?

yup.

I can't locate 0001-MMC-hardware-abstraction-for-CNF-area.patch anywhere so I can't help with this merge.

#10 lore raw
In reply to Magnus Damm
Quoted 13 lines · Magnus Damm

sh: SuperH Mobile SDHI changes

[PATCH 01/07] mfd: Add SuperH Mobile SDHI platform driver [PATCH 02/07] mmc: Add SuperH to the tmio-mmc Kconfig [PATCH 03/07] mmc: Remove const from tmio-mmc platform data [PATCH 04/07] sh: SDHI platform data to the Migo-R board [PATCH 05/07] sh: SDHI platform data to the AP325RXA board [PATCH 06/07] sh: SDHI platform data to the SE7724 board [PATCH 07/07] sh: SDHI platform data to the kfr2r09 board

These patches contain the SuperH specific changes needed for the tmio-mmc driver to work with SuperH Mobile SDHI hardware.

Quoted 8 lines

The tmio-mmc patch 0001-MMC-hardware-abstraction-for-CNF-area.patch by Ian Molton is needed for correct run time behaviour. Without this patch the tmio-mmc probe() fails gracefully.

I suggest merging the series in the SuperH tree. Not sure about the best way to merge the patch by Ian.

At least patch 3/7 depends on Ian's patch being merged first, so there's little point in merging this series until that hits upstream. So I'll hold off on this for now.

#11 lore raw

Im awaiting a reply from the linux-next folk

2009/10/5 Paul Mundt <[email protected]>:

Quoted 27 lines · Magnus Damm
Quoted 13 lines

sh: SuperH Mobile SDHI changes

[PATCH 01/07] mfd: Add SuperH Mobile SDHI platform driver [PATCH 02/07] mmc: Add SuperH to the tmio-mmc Kconfig [PATCH 03/07] mmc: Remove const from tmio-mmc platform data [PATCH 04/07] sh: SDHI platform data to the Migo-R board [PATCH 05/07] sh: SDHI platform data to the AP325RXA board [PATCH 06/07] sh: SDHI platform data to the SE7724 board [PATCH 07/07] sh: SDHI platform data to the kfr2r09 board

These patches contain the SuperH specific changes needed for the tmio-mmc driver to work with SuperH Mobile SDHI hardware.

Quoted 8 lines

The tmio-mmc patch 0001-MMC-hardware-abstraction-for-CNF-area.patch by Ian Molton is needed for correct run time behaviour. Without this patch the tmio-mmc probe() fails gracefully.

I suggest merging the series in the SuperH tree. Not sure about the best way to merge the patch by Ian.

At least patch 3/7 depends on Ian's patch being merged first, so there's little point in merging this series until that hits upstream. So I'll hold off on this for now.

Signature · 3 lines
Ian Molton
Linux, Automotive, and other hacking:
http://www.mnementh.co.uk/