diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2011-03-31 12:56:58 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2011-03-31 12:56:58 +1100 |
commit | 65933b18c9f2f11d2f5b7b7ffc3b1844295048fb (patch) | |
tree | 081e210c1ac674e3b4f0a55132e4fe61ae29b597 /drivers | |
parent | e2ba9469bffa6409f1b57d7caa8ab1fd11ce4a68 (diff) |
Revert "sparc32,leon: Fixed APBUART frequency detection"
This reverts commit c897dcf6311ea9c8d24e96cc7f7fe9de58a0a6a2.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/apbuart.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index 19a943693e4c..12d4e7ca53ca 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c @@ -598,12 +598,24 @@ static struct platform_driver grlib_apbuart_of_driver = { static int grlib_apbuart_configure(void) { - struct device_node *np; - int line = 0; + struct device_node *np, *rp; + const u32 *prop; + int freq_khz, line = 0; + + /* 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; for_each_matching_node(np, apbuart_match) { const int *ampopts; - const u32 *freq_hz; const struct amba_prom_registers *regs; struct uart_port *port; unsigned long addr; @@ -612,10 +624,8 @@ static int grlib_apbuart_configure(void) if (ampopts && (*ampopts == 0)) continue; /* Ignore if used by another OS instance */ regs = of_get_property(np, "reg", NULL); - /* Frequency of APB Bus is frequency of UART */ - freq_hz = of_get_property(np, "freq", NULL); - if (!regs || !freq_hz || (*freq_hz == 0)) + if (!regs) continue; grlib_apbuart_nodes[line] = np; @@ -631,7 +641,7 @@ static int grlib_apbuart_configure(void) port->ops = &grlib_apbuart_ops; port->flags = UPF_BOOT_AUTOCONF; port->line = line; - port->uartclk = *freq_hz; + port->uartclk = freq_khz * 1000; port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line); line++; |