These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / tty / serial / of_serial.c
index 137381e..de50296 100644 (file)
 #include <linux/nwpserial.h>
 #include <linux/clk.h>
 
+#ifdef CONFIG_SERIAL_8250_MODULE
+#define CONFIG_SERIAL_8250 CONFIG_SERIAL_8250_MODULE
+#endif
+
 #include "8250/8250.h"
 
 struct of_serial_info {
@@ -67,14 +71,17 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
        if (of_property_read_u32(np, "clock-frequency", &clk)) {
 
                /* Get clk rate through clk driver if present */
-               info->clk = clk_get(&ofdev->dev, NULL);
+               info->clk = devm_clk_get(&ofdev->dev, NULL);
                if (IS_ERR(info->clk)) {
                        dev_warn(&ofdev->dev,
                                "clk or clock-frequency not defined\n");
                        return PTR_ERR(info->clk);
                }
 
-               clk_prepare_enable(info->clk);
+               ret = clk_prepare_enable(info->clk);
+               if (ret < 0)
+                       return ret;
+
                clk = clk_get_rate(info->clk);
        }
        /* If current-speed was set, then try not to change it. */
@@ -147,6 +154,11 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
                break;
        }
 
+       if (IS_ENABLED(CONFIG_SERIAL_8250_FSL) &&
+           (of_device_is_compatible(np, "fsl,ns16550") ||
+            of_device_is_compatible(np, "fsl,16550-FIFO64")))
+               port->handle_irq = fsl8250_handle_irq;
+
        return 0;
 out:
        if (info->clk)
@@ -188,7 +200,6 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
        {
                struct uart_8250_port port8250;
                memset(&port8250, 0, sizeof(port8250));
-               port.type = port_type;
                port8250.port = port;
 
                if (port.fifosize)
@@ -348,6 +359,7 @@ static const struct of_device_id of_platform_serial_table[] = {
 #endif
        { /* end of list */ },
 };
+MODULE_DEVICE_TABLE(of, of_platform_serial_table);
 
 static struct platform_driver of_platform_serial_driver = {
        .driver = {