serial: 8250_bcm2835aux: Use generic remapping code
authorLukas Wunner <lukas@wunner.de>
Thu, 16 Jan 2020 12:14:05 +0000 (13:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jan 2020 09:22:30 +0000 (10:22 +0100)
On probe the bcm2835aux UART driver misreports the register base address
as 0x0:

ttyS0 at MMIO 0x0 (irq = 53, base_baud = 50000000) is a 16550

That's because the driver remaps the registers itself.  Take advantage
of the generic remapping code in serial8250_request_std_resource() to
get a message with the correct address and to simplify the driver.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: Martin Sperl <kernel@martin.sperl.org>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/7d1a9bdb05090d8e465fd15cd26d6e81538d07f9.1579175223.git.lukas@wunner.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_bcm2835aux.c

index f03d38e..d21460c 100644 (file)
@@ -41,7 +41,7 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
        up.port.iotype = UPIO_MEM;
        up.port.fifosize = 8;
        up.port.flags = UPF_SHARE_IRQ | UPF_FIXED_PORT | UPF_FIXED_TYPE |
-                       UPF_SKIP_TEST;
+                       UPF_SKIP_TEST | UPF_IOREMAP;
 
        /* get the clock - this also enables the HW */
        data->clk = devm_clk_get(&pdev->dev, NULL);
@@ -64,10 +64,8 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
                dev_err(&pdev->dev, "memory resource not found");
                return -EINVAL;
        }
-       up.port.membase = devm_ioremap_resource(&pdev->dev, res);
-       ret = PTR_ERR_OR_ZERO(up.port.membase);
-       if (ret)
-               return ret;
+       up.port.mapbase = res->start;
+       up.port.mapsize = resource_size(res);
 
        /* Check for a fixed line number */
        ret = of_alias_get_id(pdev->dev.of_node, "serial");