From 10544f128c338aeb7f63c002ad7eee67aa0e6acf Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Wed, 30 Mar 2011 01:12:40 +0000 Subject: sparc32, leon: APBUART driver must use archdata to get IRQ number See Commit id 1636f8ac2b08410df4766449f7c86b912443cd99 (sparc/of: Move of_device fields into struct pdev_archdata), this patch is similar to 19e4875fb21a69fbf620e84769a74d189c69c58d (of/sparc: fix build regression from of_device changes) Signed-off-by: Daniel Hellstrom Acked-by: Sam Ravnborg Signed-off-by: David S. Miller --- drivers/tty/serial/apbuart.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index 1ab999b04ef3..12d4e7ca53ca 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c @@ -555,10 +555,9 @@ static struct uart_driver grlib_apbuart_driver = { static int __devinit apbuart_probe(struct platform_device *op) { - int i = -1; + int i; struct uart_port *port = NULL; - i = 0; for (i = 0; i < grlib_apbuart_port_nr; i++) { if (op->dev.of_node == grlib_apbuart_nodes[i]) break; @@ -566,6 +565,7 @@ static int __devinit apbuart_probe(struct platform_device *op) port = &grlib_apbuart_ports[i]; port->dev = &op->dev; + port->irq = op->archdata.irqs[0]; uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port); @@ -615,7 +615,7 @@ static int grlib_apbuart_configure(void) freq_khz = *prop; for_each_matching_node(np, apbuart_match) { - const int *irqs, *ampopts; + const int *ampopts; const struct amba_prom_registers *regs; struct uart_port *port; unsigned long addr; @@ -623,11 +623,9 @@ static int grlib_apbuart_configure(void) ampopts = of_get_property(np, "ampopts", NULL); if (ampopts && (*ampopts == 0)) continue; /* Ignore if used by another OS instance */ - - irqs = of_get_property(np, "interrupts", NULL); regs = of_get_property(np, "reg", NULL); - if (!irqs || !regs) + if (!regs) continue; grlib_apbuart_nodes[line] = np; @@ -638,7 +636,7 @@ static int grlib_apbuart_configure(void) port->mapbase = addr; port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map)); - port->irq = *irqs; + port->irq = 0; port->iotype = UPIO_MEM; port->ops = &grlib_apbuart_ops; port->flags = UPF_BOOT_AUTOCONF; -- cgit v1.2.3 From c897dcf6311ea9c8d24e96cc7f7fe9de58a0a6a2 Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Wed, 30 Mar 2011 01:12:41 +0000 Subject: sparc32,leon: Fixed APBUART frequency detection The UARTs may be located on different APB buses, thus have different UART clock frequency. The system frequency is not the same (but often) as the UART frequency, rather the APB bus frequency that the APBUART is located at has the same frequency, so this looks at the "freq" property instead. Signed-off-by: Daniel Hellstrom Signed-off-by: David S. Miller --- drivers/tty/serial/apbuart.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'drivers') 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 = { static int grlib_apbuart_configure(void) { - 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; + struct device_node *np; + int line = 0; 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; @@ -624,8 +612,10 @@ 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) + if (!regs || !freq_hz || (*freq_hz == 0)) continue; grlib_apbuart_nodes[line] = np; @@ -641,7 +631,7 @@ static int grlib_apbuart_configure(void) port->ops = &grlib_apbuart_ops; port->flags = UPF_BOOT_AUTOCONF; port->line = line; - port->uartclk = freq_khz * 1000; + port->uartclk = *freq_hz; port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line); line++; -- cgit v1.2.3 From 6cd7a63756a68ad5e718b42aa108e27c19425743 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 30 Mar 2011 21:11:35 -0700 Subject: apbuart: Depend upon sparc. It absolutely needs to be able to get at pdev_archdata members which are sparc specific. Signed-off-by: David S. Miller Reported-by: Stephen Rothwell --- drivers/tty/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index e1aee37270f5..80484af781e1 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1506,7 +1506,7 @@ config SERIAL_BCM63XX_CONSOLE config SERIAL_GRLIB_GAISLER_APBUART tristate "GRLIB APBUART serial support" - depends on OF + depends on OF && SPARC select SERIAL_CORE ---help--- Add support for the GRLIB APBUART serial port. -- cgit v1.2.3