diff options
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/apbuart.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index 12d4e7ca53ca..19a943693e4c 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c | |||
@@ -598,24 +598,12 @@ static struct platform_driver grlib_apbuart_of_driver = { | |||
598 | 598 | ||
599 | static int grlib_apbuart_configure(void) | 599 | static int grlib_apbuart_configure(void) |
600 | { | 600 | { |
601 | struct device_node *np, *rp; | 601 | struct device_node *np; |
602 | const u32 *prop; | 602 | int line = 0; |
603 | int freq_khz, line = 0; | ||
604 | |||
605 | /* Get bus frequency */ | ||
606 | rp = of_find_node_by_path("/"); | ||
607 | if (!rp) | ||
608 | return -ENODEV; | ||
609 | rp = of_get_next_child(rp, NULL); | ||
610 | if (!rp) | ||
611 | return -ENODEV; | ||
612 | prop = of_get_property(rp, "clock-frequency", NULL); | ||
613 | if (!prop) | ||
614 | return -ENODEV; | ||
615 | freq_khz = *prop; | ||
616 | 603 | ||
617 | for_each_matching_node(np, apbuart_match) { | 604 | for_each_matching_node(np, apbuart_match) { |
618 | const int *ampopts; | 605 | const int *ampopts; |
606 | const u32 *freq_hz; | ||
619 | const struct amba_prom_registers *regs; | 607 | const struct amba_prom_registers *regs; |
620 | struct uart_port *port; | 608 | struct uart_port *port; |
621 | unsigned long addr; | 609 | unsigned long addr; |
@@ -624,8 +612,10 @@ static int grlib_apbuart_configure(void) | |||
624 | if (ampopts && (*ampopts == 0)) | 612 | if (ampopts && (*ampopts == 0)) |
625 | continue; /* Ignore if used by another OS instance */ | 613 | continue; /* Ignore if used by another OS instance */ |
626 | regs = of_get_property(np, "reg", NULL); | 614 | regs = of_get_property(np, "reg", NULL); |
615 | /* Frequency of APB Bus is frequency of UART */ | ||
616 | freq_hz = of_get_property(np, "freq", NULL); | ||
627 | 617 | ||
628 | if (!regs) | 618 | if (!regs || !freq_hz || (*freq_hz == 0)) |
629 | continue; | 619 | continue; |
630 | 620 | ||
631 | grlib_apbuart_nodes[line] = np; | 621 | grlib_apbuart_nodes[line] = np; |
@@ -641,7 +631,7 @@ static int grlib_apbuart_configure(void) | |||
641 | port->ops = &grlib_apbuart_ops; | 631 | port->ops = &grlib_apbuart_ops; |
642 | port->flags = UPF_BOOT_AUTOCONF; | 632 | port->flags = UPF_BOOT_AUTOCONF; |
643 | port->line = line; | 633 | port->line = line; |
644 | port->uartclk = freq_khz * 1000; | 634 | port->uartclk = *freq_hz; |
645 | port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line); | 635 | port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line); |
646 | line++; | 636 | line++; |
647 | 637 | ||