serial: 8250_tegra: Switch to use uart_read_port_properties()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 4 Mar 2024 12:27:14 +0000 (14:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Mar 2024 13:38:30 +0000 (13:38 +0000)
Since we have now a common helper to read port properties
use it instead of sparse home grown solution.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240304123035.758700-14-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_tegra.c

index ba352262df75a7b32c9fa6401abd012e5ccf0ec8..60a80d00d2519b600dfb4fb635f2f1e33551adad 100644 (file)
@@ -57,25 +57,11 @@ static int tegra_uart_probe(struct platform_device *pdev)
        port = &port8250.port;
        spin_lock_init(&port->lock);
 
-       port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT |
-                     UPF_FIXED_TYPE;
-       port->iotype = UPIO_MEM32;
-       port->regshift = 2;
+       port->flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_FIXED_TYPE;
        port->type = PORT_TEGRA;
-       port->irqflags |= IRQF_SHARED;
        port->dev = &pdev->dev;
        port->handle_break = tegra_uart_handle_break;
 
-       ret = of_alias_get_id(pdev->dev.of_node, "serial");
-       if (ret >= 0)
-               port->line = ret;
-
-       ret = platform_get_irq(pdev, 0);
-       if (ret < 0)
-               return ret;
-
-       port->irq = ret;
-
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res)
                return -ENODEV;
@@ -88,12 +74,18 @@ static int tegra_uart_probe(struct platform_device *pdev)
        port->mapbase = res->start;
        port->mapsize = resource_size(res);
 
+       ret = uart_read_port_properties(port);
+       if (ret)
+               return ret;
+
+       port->iotype = UPIO_MEM32;
+       port->regshift = 2;
+
        uart->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
        if (IS_ERR(uart->rst))
                return PTR_ERR(uart->rst);
 
-       if (device_property_read_u32(&pdev->dev, "clock-frequency",
-                                    &port->uartclk)) {
+       if (!port->uartclk) {
                uart->clk = devm_clk_get(&pdev->dev, NULL);
                if (IS_ERR(uart->clk)) {
                        dev_err(&pdev->dev, "failed to get clock!\n");