OSDN Git Service

tty/bcm63xx_uart: allow naming clock in device tree
authorJonas Gorski <jonas.gorski@gmail.com>
Wed, 20 Sep 2017 11:14:04 +0000 (13:14 +0200)
committerJames Hogan <jhogan@kernel.org>
Tue, 7 Nov 2017 18:33:18 +0000 (18:33 +0000)
Codify using a named clock for the refclk of the uart. This makes it
easier if we might need to add a gating clock (like present on the
BCM6345).

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Kevin Cernekee <cernekee@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-mips@linux-mips.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-serial@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: bcm-kernel-feedback-list@broadcom.com
Patchwork: https://patchwork.linux-mips.org/patch/17328/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: James Hogan <jhogan@kernel.org>
Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
drivers/tty/serial/bcm63xx_uart.c

index 5c52e5e..8b2b046 100644 (file)
@@ -11,6 +11,11 @@ Required properties:
 - clocks: Clock driving the hardware; used to figure out the baud rate
   divisor.
 
+
+Optional properties:
+
+- clock-names: Should be "refclk".
+
 Example:
 
        uart0: serial@14e00520 {
@@ -19,6 +24,7 @@ Example:
                interrupt-parent = <&periph_intc>;
                interrupts = <2>;
                clocks = <&periph_clk>;
+               clock-names = "refclk";
        };
 
        clocks {
index afcc041..0385bd3 100644 (file)
@@ -846,8 +846,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
        if (!res_irq)
                return -ENODEV;
 
-       clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) :
-                                 clk_get(&pdev->dev, "refclk");
+       clk = clk_get(&pdev->dev, "refclk");
+       if (IS_ERR(clk) && pdev->dev.of_node)
+               clk = of_clk_get(pdev->dev.of_node, 0);
+
        if (IS_ERR(clk))
                return -ENODEV;