Merge tag 'v3.15-rc1' into patchwork
[firefly-linux-kernel-4.4.55.git] / drivers / tty / serial / bcm63xx_uart.c
index 78e82b017b928bb55982cb4b015a2e81a6862c46..a47421e4627c5b7c0796bd72c42db572e1b8f938 100644 (file)
@@ -30,6 +30,8 @@
 #include <linux/serial.h>
 #include <linux/serial_core.h>
 #include <linux/serial_bcm63xx.h>
+#include <linux/io.h>
+#include <linux/of.h>
 
 #define BCM63XX_NR_UARTS       2
 
@@ -588,7 +590,7 @@ static int bcm_uart_request_port(struct uart_port *port)
 {
        unsigned int size;
 
-       size = RSET_UART_SIZE;
+       size = UART_REG_SIZE;
        if (!request_mem_region(port->mapbase, size, "bcm63xx")) {
                dev_err(port->dev, "Memory region busy\n");
                return -EBUSY;
@@ -608,7 +610,7 @@ static int bcm_uart_request_port(struct uart_port *port)
  */
 static void bcm_uart_release_port(struct uart_port *port)
 {
-       release_mem_region(port->mapbase, RSET_UART_SIZE);
+       release_mem_region(port->mapbase, UART_REG_SIZE);
        iounmap(port->membase);
 }
 
@@ -805,6 +807,9 @@ static int bcm_uart_probe(struct platform_device *pdev)
        struct clk *clk;
        int ret;
 
+       if (pdev->dev.of_node)
+               pdev->id = of_alias_get_id(pdev->dev.of_node, "uart");
+
        if (pdev->id < 0 || pdev->id >= BCM63XX_NR_UARTS)
                return -EINVAL;
 
@@ -856,6 +861,12 @@ static int bcm_uart_remove(struct platform_device *pdev)
        return 0;
 }
 
+static const struct of_device_id bcm63xx_of_match[] = {
+       { .compatible = "brcm,bcm6345-uart" },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, bcm63xx_of_match);
+
 /*
  * platform driver stuff
  */
@@ -865,6 +876,7 @@ static struct platform_driver bcm_uart_platform_driver = {
        .driver = {
                .owner = THIS_MODULE,
                .name  = "bcm63xx_uart",
+               .of_match_table = bcm63xx_of_match,
        },
 };