mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 07/12] versatile: switch to add_generic_device
Date: Sun, 24 Jul 2011 16:49:04 +0200	[thread overview]
Message-ID: <1311518949-6990-7-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20110724144441.GA10295@game.jcrosoft.org>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/versatile/versatilepb.c |   10 +-----
 arch/arm/mach-versatile/core.c          |   48 ++++++++-----------------------
 2 files changed, 14 insertions(+), 44 deletions(-)

diff --git a/arch/arm/boards/versatile/versatilepb.c b/arch/arm/boards/versatile/versatilepb.c
index 830be93..fdd77e5 100644
--- a/arch/arm/boards/versatile/versatilepb.c
+++ b/arch/arm/boards/versatile/versatilepb.c
@@ -40,13 +40,6 @@ static int vpb_console_init(void)
 }
 console_initcall(vpb_console_init);
 
-static struct device_d smc911x_dev = {
-	.id		= -1,
-	.name		= "smc91c111",
-	.map_base	= VERSATILE_ETH_BASE,
-	.size		= 64 * 1024,
-};
-
 static int vpb_devices_init(void)
 {
 	versatile_add_sdram(64 * 1024 *1024);
@@ -55,7 +48,8 @@ static int vpb_devices_init(void)
 	devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
 	devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");
 
-	register_device(&smc911x_dev);
+	add_generic_device("smc91c111", -1, NULL, VERSATILE_ETH_BASE, 64 * 1024,
+			   IORESOURCE_MEM, NULL);
 
 	armlinux_set_architecture(MACH_TYPE_VERSATILE_PB);
 	armlinux_set_bootparams((void *)(0x00000100));
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 63cf4a5..249d97a 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -51,34 +51,6 @@ void versatile_add_sdram(u32 size)
 	armlinux_add_dram(sdram_dev);
 }
 
-static struct device_d uart0_serial_device = {
-	.id = 0,
-	.name = "uart-pl011",
-	.map_base = VERSATILE_UART0_BASE,
-	.size = 4096,
-};
-
-static struct device_d uart1_serial_device = {
-	.id = 1,
-	.name = "uart-pl011",
-	.map_base = VERSATILE_UART1_BASE,
-	.size = 4096,
-};
-
-static struct device_d uart2_serial_device = {
-	.id = 2,
-	.name = "uart-pl011",
-	.map_base = VERSATILE_UART2_BASE,
-	.size = 4096,
-};
-
-static struct device_d uart3_serial_device = {
-	.id = 3,
-	.name = "uart-pl011",
-	.map_base = VERSATILE_UART3_BASE,
-	.size = 4096,
-};
-
 struct clk {
 	unsigned long rate;
 };
@@ -178,24 +150,28 @@ core_initcall(vpb_clocksource_init);
 
 void versatile_register_uart(unsigned id)
 {
+	resource_size_t start;
+	struct device_d *dev;
+
 	switch (id) {
 	case 0:
-		vpb_clk_create(&ref_clk_24, dev_name(&uart0_serial_device));
-		register_device(&uart0_serial_device);
+		start = VERSATILE_UART0_BASE;
 		break;
 	case 1:
-		vpb_clk_create(&ref_clk_24, dev_name(&uart1_serial_device));
-		register_device(&uart1_serial_device);
+		start = VERSATILE_UART1_BASE;
 		break;
 	case 2:
-		vpb_clk_create(&ref_clk_24, dev_name(&uart2_serial_device));
-		register_device(&uart2_serial_device);
+		start = VERSATILE_UART2_BASE;
 		break;
 	case 3:
-		vpb_clk_create(&ref_clk_24, dev_name(&uart3_serial_device));
-		register_device(&uart3_serial_device);
+		start = VERSATILE_UART3_BASE;
 		break;
+	default:
+		return;
 	}
+	dev = add_generic_device("uart-pl011", id, NULL, start, 4096,
+			   IORESOURCE_MEM, NULL);
+	vpb_clk_create(&ref_clk_24, dev_name(dev));
 }
 
 void __noreturn reset_cpu (unsigned long ignored)
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-07-24 15:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 14:44 [PATCH 0/12] more device rework Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:48 ` [PATCH 01/12] drivers/bus: move to drivers/base Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:48 ` [PATCH 02/12] drivers: move resource generic management to driver/base/resource.c Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` [PATCH 03/12 v2] resource: introduce add_generic_device to register simple device Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` [PATCH 04/12 v2] at91: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` [PATCH 05/12 v2] imx/devices: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` [PATCH 06/12] resource: introduce add_cfi_device to register simple cfi device Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-07-24 14:49 ` [PATCH 08/12] nomadik: switch to add_generic_device Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` [PATCH 09/12] mci: switch to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` [PATCH 10/12] ata/bios: convert to struct resource Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` [PATCH 11/12] i2c: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-24 14:49 ` [PATCH 12/12] nand: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-25  9:32 ` [PATCH 0/12] more device rework Sascha Hauer
2011-07-25 13:39   ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-26  6:56     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311518949-6990-7-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox