Skip to contentSkip to conversation

ARM: mach-shmobile: ap4evb SDHI0 platform data

PATCH In review Magnus Damm 2 participants 5 messages Mar 10, 2010

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

PATCH 1/1 ARM: mach-shmobile: ap4evb SDHI0 platform data

From: Magnus Damm <[email protected]>

Add SDHI0 platform data for the AP4EVB board.

---

Depends on "ARM: mach-shmobile: sh7372 SDHI vector merge".

 arch/arm/mach-shmobile/board-ap4evb.c |   39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm/mach-shmobile/board-ap4evb.c +39 -0
@@ -31,6 +31,7 @@
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/input/sh_keysc.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 #include <mach/common.h>
 #include <mach/sh7372.h>
 #include <asm/mach-types.h>
@@ -206,10 +207,38 @@ static struct platform_device keysc_devi
 	},
 };
 
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info = {
+};
+
+static struct resource sdhi0_resources[] = {
+	[0] = {
+		.name	= "SDHI0",
+		.start  = 0xe6850000,
+		.end    = 0xe68501ff,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = 96,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sdhi0_device = {
+	.name           = "sh_mobile_sdhi",
+	.num_resources  = ARRAY_SIZE(sdhi0_resources),
+	.resource       = sdhi0_resources,
+	.id             = 0,
+	.dev	= {
+		.platform_data	= &sdhi0_info,
+	},
+};
+
 static struct platform_device *ap4evb_devices[] __initdata = {
 	&nor_flash_device,
 	&smc911x_device,
 	&keysc_device,
+	&sdhi0_device,
 };
 
 static struct map_desc ap4evb_io_desc[] __initdata = {
@@ -286,6 +315,16 @@ static void __init ap4evb_init(void)
 	gpio_request(GPIO_FN_KEYIN3_133, NULL);
 	gpio_request(GPIO_FN_KEYIN4,     NULL);
 
+	/* SDHI0 */
+	gpio_request(GPIO_FN_SDHICD0, NULL);
+	gpio_request(GPIO_FN_SDHIWP0, NULL);
+	gpio_request(GPIO_FN_SDHICMD0, NULL);
+	gpio_request(GPIO_FN_SDHICLK0, NULL);
+	gpio_request(GPIO_FN_SDHID0_3, NULL);
+	gpio_request(GPIO_FN_SDHID0_2, NULL);
+	gpio_request(GPIO_FN_SDHID0_1, NULL);
+	gpio_request(GPIO_FN_SDHID0_0, NULL);
+
 	sh7372_add_standard_devices();
 
 	platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
#1 lore raw

arch/arm/mach-shmobile/board-ap4evb.c static struct platform_device keysc_devi · line 213

Quoted 8 lines · Magnus Damm
arch/arm/mach-shmobile/board-ap4evb.c +4 -0
@@ -206,10 +207,38 @@ static struct platform_device keysc_devi
 	},
 };
 
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info = {
+};
+

Try again?

arch/arm/mach-shmobile/board-ap4evb.c static struct platform_device keysc_devi · line 219

Quoted 6 lines
arch/arm/mach-shmobile/board-ap4evb.c +6 -0
+static struct resource sdhi0_resources[] = {
+	[0] = {
+		.name	= "SDHI0",
+		.start  = 0xe6850000,
+		.end    = 0xe68501ff,
+		.flags  = IORESOURCE_MEM,

If you aren't going to use a useful name for the resource, then the name can just be left unset, this will ensure that the driver core assigns the resource a name matching the device name/id pair.

So if left unset you would end up with "sh_mobile_sdhi.0" in /proc/iomem, which could be more intuitive.

author maintainer
#2 lore raw
In reply to Magnus Damm
Quoted 10 lines · Paul Mundt

arch/arm/mach-shmobile/board-ap4evb.c static struct platform_device keysc_devi · line 213

Quoted 8 lines · Magnus Damm
arch/arm/mach-shmobile/board-ap4evb.c +4 -0
@@ -206,10 +207,38 @@ static struct platform_device keysc_devi
       },
  };
 
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info = {
+};
+

Try again?

The sh_mobile_sdhi driver allows omitting the platform data, so perhaps that's a better idea.

Quoted 10 lines

arch/arm/mach-shmobile/board-ap4evb.c static struct platform_device keysc_devi · line 219

Quoted 6 lines
arch/arm/mach-shmobile/board-ap4evb.c +6 -0
+static struct resource sdhi0_resources[] = {
+     [0] = {
+             .name   = "SDHI0",
+             .start  = 0xe6850000,
+             .end    = 0xe68501ff,
+             .flags  = IORESOURCE_MEM,

If you aren't going to use a useful name for the resource, then the name can just be left unset, this will ensure that the driver core assigns the resource a name matching the device name/id pair.

The data sheet refers to this hardware block as SDHI0.

Quoted 2 lines

So if left unset you would end up with "sh_mobile_sdhi.0" in /proc/iomem, which could be more intuitive.

Sure, that's also an option. For sh7724 (and perhaps earlier SH-Mobile) most resources use the data sheet name for /proc/iomem.

/ magnus

#3 lore raw
In reply to Magnus Damm
Quoted 6 lines · Magnus Damm
Quoted 5 lines · Paul Mundt
Quoted 4 lines · Magnus Damm
(quoted diff) +0 -0
@@ -206,10 +207,38 @@ static struct platform_device keysc_devi
 ? ? ? },
 ?};
 
Quoted 9 lines
Quoted 5 lines

arch/arm/mach-shmobile/board-ap4evb.c static struct platform_device keysc_devi · line 213

Quoted 4 lines
arch/arm/mach-shmobile/board-ap4evb.c +4 -0
+/* SDHI0 */
+static struct sh_mobile_sdhi_info sdhi0_info = {
+};
+

Try again?

The sh_mobile_sdhi driver allows omitting the platform data, so perhaps that's a better idea.

If the driver didn't allow for omitting platform data it would be crap, and broken. We do not condone silly driver behaviour.

Quoted 11 lines
Quoted 10 lines

Review static struct platform_device keysc_devi · line 219

Quoted 6 lines
(quoted diff) +6 -0
+static struct resource sdhi0_resources[] = {
+ ? ? [0] = {
+ ? ? ? ? ? ? .name ? = "SDHI0",
+ ? ? ? ? ? ? .start ?= 0xe6850000,
+ ? ? ? ? ? ? .end ? ?= 0xe68501ff,
+ ? ? ? ? ? ? .flags ?= IORESOURCE_MEM,

If you aren't going to use a useful name for the resource, then the name can just be left unset, this will ensure that the driver core assigns the resource a name matching the device name/id pair.

Quoted 8 lines

The data sheet refers to this hardware block as SDHI0.

Quoted 2 lines

So if left unset you would end up with "sh_mobile_sdhi.0" in /proc/iomem, which could be more intuitive.

Sure, that's also an option. For sh7724 (and perhaps earlier SH-Mobile) most resources use the data sheet name for /proc/iomem.

Leaving it as it is in the data sheet is of course fine, but many of these blocks have absurdly generic names. Also note that in this case /proc/iomem and /proc/interrupts and so on will have an inconsistency between the naming, so we have a mixture of SDHI0 and sh_mobile_sdhi.0.

Perhaps some people find this separation useful, but it quickly turns in to a mess with things like 12 TMU channels all using slightly different naming conventions.

author maintainer
#4 lore raw

PATCH 1/1 ARM: mach-shmobile: ap4evb SDHI0 platform data V2

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add SDHI0 platform data for the AP4EVB board V2.

---

Depends on "ARM: mach-shmobile: sh7372 SDHI vector merge".

Changes since V1:
- dropped empty platform data structure

 arch/arm/mach-shmobile/board-ap4evb.c |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm/mach-shmobile/board-ap4evb.c +32 -0
@@ -206,10 +206,32 @@ static struct platform_device keysc_devi
 	},
 };
 
+/* SDHI0 */
+static struct resource sdhi0_resources[] = {
+	[0] = {
+		.name	= "SDHI0",
+		.start  = 0xe6850000,
+		.end    = 0xe68501ff,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = 96,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sdhi0_device = {
+	.name           = "sh_mobile_sdhi",
+	.num_resources  = ARRAY_SIZE(sdhi0_resources),
+	.resource       = sdhi0_resources,
+	.id             = 0,
+};
+
 static struct platform_device *ap4evb_devices[] __initdata = {
 	&nor_flash_device,
 	&smc911x_device,
 	&keysc_device,
+	&sdhi0_device,
 };
 
 static struct map_desc ap4evb_io_desc[] __initdata = {
@@ -286,6 +308,16 @@ static void __init ap4evb_init(void)
 	gpio_request(GPIO_FN_KEYIN3_133, NULL);
 	gpio_request(GPIO_FN_KEYIN4,     NULL);
 
+	/* SDHI0 */
+	gpio_request(GPIO_FN_SDHICD0, NULL);
+	gpio_request(GPIO_FN_SDHIWP0, NULL);
+	gpio_request(GPIO_FN_SDHICMD0, NULL);
+	gpio_request(GPIO_FN_SDHICLK0, NULL);
+	gpio_request(GPIO_FN_SDHID0_3, NULL);
+	gpio_request(GPIO_FN_SDHID0_2, NULL);
+	gpio_request(GPIO_FN_SDHID0_1, NULL);
+	gpio_request(GPIO_FN_SDHID0_0, NULL);
+
 	sh7372_add_standard_devices();
 
 	platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));