[PATCH 08/12] nomadik: switch to add_generic_device

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sun Jul 24 10:49:05 EDT 2011


Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 arch/arm/boards/nhk8815/setup.c |   18 +--------------
 arch/arm/mach-nomadik/8815.c    |   42 +++++++-------------------------------
 2 files changed, 10 insertions(+), 50 deletions(-)

diff --git a/arch/arm/boards/nhk8815/setup.c b/arch/arm/boards/nhk8815/setup.c
index b7fa50a..da6be93 100644
--- a/arch/arm/boards/nhk8815/setup.c
+++ b/arch/arm/boards/nhk8815/setup.c
@@ -33,21 +33,6 @@
 #include <mach/nand.h>
 #include <mach/fsmc.h>
 
-static struct resource nhk8815_network_resources[] = {
-	[0] = {
-		.start	= 0x34000300,
-		.size	= 16,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d nhk8815_network_dev = {
-	.id = -1,
-	.name = "smc91c111",
-	.num_resources	= ARRAY_SIZE(nhk8815_network_resources),
-	.resource	= nhk8815_network_resources,
-};
-
 static int nhk8815_nand_init(void)
 {
 	/* FSMC setup for nand chip select (8-bit nand in 8815NHK) */
@@ -104,7 +89,8 @@ static int nhk8815_devices_init(void)
 	writel(0x0000305b, FSMC_BCR(1));
 	writel(0x00033f33, FSMC_BTR(1));
 
-	register_device(&nhk8815_network_dev);
+	add_generic_device("smc91c111", -1, NULL, 0x34000300, 16,
+			   IORESOURCE_MEM, NULL);
 
 	register_device(&nhk8815_nand_device);
 
diff --git a/arch/arm/mach-nomadik/8815.c b/arch/arm/mach-nomadik/8815.c
index 9df32a3..f2b8fd0 100644
--- a/arch/arm/mach-nomadik/8815.c
+++ b/arch/arm/mach-nomadik/8815.c
@@ -40,46 +40,20 @@ void st8815_add_device_sdram(u32 size)
 	armlinux_add_dram(sdram_dev);
 }
 
-static struct resource uart0_serial_resources[] = {
-	[0] = {
-		.start	= NOMADIK_UART0_BASE,
-		.size	= 4096,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d uart0_serial_device = {
-	.id = 0,
-	.name = "uart-pl011",
-	.num_resources	= ARRAY_SIZE(uart0_serial_resources),
-	.resource	= uart0_serial_resources,
-};
-
-static struct resource uart1_serial_resources[] = {
-	[0] = {
-		.start	= NOMADIK_UART1_BASE,
-		.size	= 4096,
-		.flags	= IORESOURCE_MEM,
-	},
-};
-
-static struct device_d uart1_serial_device = {
-	.id = 1,
-	.name = "uart-pl011",
-	.num_resources	= ARRAY_SIZE(uart1_serial_resources),
-	.resource	= uart1_serial_resources,
-};
-
 void st8815_register_uart(unsigned id)
 {
+	resource_size_t start;
+	struct device_d *dev;
+
 	switch (id) {
 	case 0:
-		nmdk_clk_create(&st8815_clk_48, dev_name(&uart0_serial_device));
-		register_device(&uart0_serial_device);
+		start = NOMADIK_UART1_BASE;
 		break;
 	case 1:
-		nmdk_clk_create(&st8815_clk_48, dev_name(&uart1_serial_device));
-		register_device(&uart1_serial_device);
+		start = NOMADIK_UART1_BASE;
 		break;
 	}
+	dev = add_generic_device("uart-pl011", id, NULL, start, 4096,
+			   IORESOURCE_MEM, NULL);
+	nmdk_clk_create(&st8815_clk_48, dev_name(dev));
 }
-- 
1.7.5.4




More information about the barebox mailing list