summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-versatile
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2011-07-23 03:47:54 +0800
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2011-07-23 09:23:42 +0800
commitc0ff8f7f47fa10b2e683cb0452f659c97aec186f (patch)
tree1487d6d692800e85419471d818f3e3ff6b305229 /arch/arm/mach-versatile
parent166388bcf67edaf932fc026ef98b8749562e50f9 (diff)
downloadbarebox-c0ff8f7f47fa10b2e683cb0452f659c97aec186f.tar.gz
barebox-c0ff8f7f47fa10b2e683cb0452f659c97aec186f.tar.xz
versatile: switch to add_generic_device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch/arm/mach-versatile')
-rw-r--r--arch/arm/mach-versatile/core.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 63cf4a5003..249d97a3d1 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)