diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2010-12-17 17:06:26 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2010-12-17 17:06:26 +1100 |
commit | e0d72df71ba613ceee017714b6bdc73ecbc5aee1 (patch) | |
tree | 75a5d0027b3455e4c80c318adca1e306845bb247 | |
parent | b6be559faff5e1593aca1cf338854f0464f04d0b (diff) |
Revert "drivers: serial: apbuart: Handle OF failures gracefully"
This reverts commit 35c64e5d13c3d7d8c4ad061ad5e20498b9160c24.
-rw-r--r-- | drivers/serial/apbuart.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/drivers/serial/apbuart.c b/drivers/serial/apbuart.c index 2e84d9c3d419..cc01c650a144 100644 --- a/drivers/serial/apbuart.c +++ b/drivers/serial/apbuart.c @@ -593,44 +593,54 @@ static struct of_platform_driver grlib_apbuart_of_driver = { }; -static int grlib_apbuart_configure(void) +static void grlib_apbuart_configure(void) { + static int enum_done; struct device_node *np, *rp; + struct uart_port *port = NULL; const u32 *prop; - int freq_khz, line = 0; + int freq_khz; + int v = 0, d = 0; + unsigned int addr; + int irq, line; + struct amba_prom_registers *regs; + + if (enum_done) + return; /* Get bus frequency */ rp = of_find_node_by_path("/"); - if (!rp) - return -ENODEV; rp = of_get_next_child(rp, NULL); - if (!rp) - return -ENODEV; prop = of_get_property(rp, "clock-frequency", NULL); - if (!prop) - return -ENODEV; freq_khz = *prop; + line = 0; for_each_matching_node(np, apbuart_match) { - const int *irqs = of_get_property(np, "interrupts", NULL); - const struct amba_prom_registers *regs; - struct uart_port *port; - unsigned long addr; - regs = of_get_property(np, "reg", NULL); + int *vendor = (int *) of_get_property(np, "vendor", NULL); + int *device = (int *) of_get_property(np, "device", NULL); + int *irqs = (int *) of_get_property(np, "interrupts", NULL); + regs = (struct amba_prom_registers *) + of_get_property(np, "reg", NULL); + + if (vendor) + v = *vendor; + if (device) + d = *device; if (!irqs || !regs) - return -ENODEV; + return; grlib_apbuart_nodes[line] = np; addr = regs->phys_addr; + irq = *irqs; port = &grlib_apbuart_ports[line]; port->mapbase = addr; port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map)); - port->irq = *irqs; + port->irq = irq; port->iotype = UPIO_MEM; port->ops = &grlib_apbuart_ops; port->flags = UPF_BOOT_AUTOCONF; @@ -642,10 +652,12 @@ static int grlib_apbuart_configure(void) /* We support maximum UART_NR uarts ... */ if (line == UART_NR) break; + } + enum_done = 1; + grlib_apbuart_driver.nr = grlib_apbuart_port_nr = line; - return line ? 0 : -ENODEV; } static int __init grlib_apbuart_init(void) @@ -653,9 +665,7 @@ static int __init grlib_apbuart_init(void) int ret; /* Find all APBUARTS in device the tree and initialize their ports */ - ret = grlib_apbuart_configure(); - if (ret) - return ret; + grlib_apbuart_configure(); printk(KERN_INFO "Serial: GRLIB APBUART driver\n"); |