Skip to contentSkip to conversation

sh: Move KEYSC platform data to sh7722

PATCH In review Magnus Damm 1 participant 1 message Mar 21, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 sh: Move KEYSC platform data to sh7722

Move KEYSC platform data to cpu-specific file. Use weak symbol for KEYSC board specific data structure so board code can override.

---

 arch/sh/boards/renesas/migor/setup.c   |   24 +-----------------------
 arch/sh/boards/se/7722/setup.c         |   24 +-----------------------
 arch/sh/kernel/cpu/sh4a/setup-sh7722.c |   26 ++++++++++++++++++++++++++
 3 files changed, 28 insertions(+), 46 deletions(-)
arch/sh/boards/renesas/migor/setup.c +1 -23
@@ -43,7 +43,7 @@ static struct platform_device smc91x_eth
 	.resource       = smc91x_eth_resources,
 };
 
-static struct sh_keysc_info sh_keysc_info = {
+struct sh_keysc_info sh_keysc_info = {
 	.mode = SH_KEYSC_MODE_2, /* KEYOUT0->4, KEYIN1->5 */
 	.scan_timing = 3,
 	.delay = 5,
@@ -56,30 +56,8 @@ static struct sh_keysc_info sh_keysc_inf
 	},
 };
 
-static struct resource sh_keysc_resources[] = {
-	[0] = {
-		.start  = 0x044b0000,
-		.end    = 0x044b000f,
-		.flags  = IORESOURCE_MEM,
-	},
-	[1] = {
-		.start  = 79,
-		.flags  = IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device sh_keysc_device = {
-	.name           = "sh_keysc",
-	.num_resources  = ARRAY_SIZE(sh_keysc_resources),
-	.resource       = sh_keysc_resources,
-	.dev	= {
-		.platform_data	= &sh_keysc_info,
-	},
-};
-
 static struct platform_device *migor_devices[] __initdata = {
 	&smc91x_eth_device,
-	&sh_keysc_device,
 };
 
 static int __init migor_devices_setup(void)
arch/sh/boards/se/7722/setup.c +1 -23
@@ -94,7 +94,7 @@ static struct platform_device cf_ide_dev
 	.resource       = cf_ide_resources,
 };
 
-static struct sh_keysc_info sh_keysc_info = {
+struct sh_keysc_info sh_keysc_info = {
 	.mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */
 	.scan_timing = 3,
 	.delay = 5,
@@ -109,32 +109,10 @@ static struct sh_keysc_info sh_keysc_inf
 	},
 };
 
-static struct resource sh_keysc_resources[] = {
-	[0] = {
-		.start  = 0x044b0000,
-		.end    = 0x044b000f,
-		.flags  = IORESOURCE_MEM,
-	},
-	[1] = {
-		.start  = 79,
-		.flags  = IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device sh_keysc_device = {
-	.name           = "sh_keysc",
-	.num_resources  = ARRAY_SIZE(sh_keysc_resources),
-	.resource       = sh_keysc_resources,
-	.dev	= {
-		.platform_data	= &sh_keysc_info,
-	},
-};
-
 static struct platform_device *se7722_devices[] __initdata = {
 	&heartbeat_device,
 	&smc91x_eth_device,
 	&cf_ide_device,
-	&sh_keysc_device,
 };
 
 static int __init se7722_devices_setup(void)
arch/sh/kernel/cpu/sh4a/setup-sh7722.c +26 -0
@@ -13,6 +13,7 @@
 #include <linux/serial_sci.h>
 #include <linux/mm.h>
 #include <asm/mmzone.h>
+#include <asm/sh_keysc.h>
 
 static struct resource usbf_resources[] = {
 	[0] = {
@@ -39,6 +40,30 @@ static struct platform_device usbf_devic
 	.resource	= usbf_resources,
 };
 
+struct sh_keysc_info __weak sh_keysc_info = {};
+
+static struct resource keysc_resources[] = {
+	[0] = {
+		.name	= "KEYSC",
+		.start  = 0x044b0000,
+		.end    = 0x044b000f,
+		.flags  = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start  = 79,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device keysc_device = {
+	.name           = "sh_keysc",
+	.num_resources  = ARRAY_SIZE(keysc_resources),
+	.resource       = keysc_resources,
+	.dev	= {
+		.platform_data	= &sh_keysc_info,
+	},
+};
+
 static struct plat_sci_port sci_platform_data[] = {
 	{
 		.mapbase	= 0xffe00000,
@@ -73,6 +98,7 @@ static struct platform_device sci_device
 
 static struct platform_device *sh7722_devices[] __initdata = {
 	&usbf_device,
+	&keysc_device,
 	&sci_device,
 };