1 From 317f8659bba01b307cbe4e9902d4e3d333fd7164 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Sun, 16 Jul 2017 12:39:17 +0200
4 Subject: [PATCH V2 4/8] tty/bcm63xx_uart: allow naming clock in device tree
6 Codify using a named clock for the refclk of the uart. This makes it
7 easier if we might need to add a gating clock (like present on the
10 Acked-by: Rob Herring <robh@kernel.org>
11 Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
13 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
15 Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt | 6 ++++++
16 drivers/tty/serial/bcm63xx_uart.c | 6 ++++--
17 2 files changed, 10 insertions(+), 2 deletions(-)
19 --- a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
20 +++ b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
21 @@ -11,6 +11,11 @@ Required properties:
22 - clocks: Clock driving the hardware; used to figure out the baud rate
28 +- clock-names: Should be "refclk".
32 uart0: serial@14e00520 {
33 @@ -19,6 +24,7 @@ Example:
34 interrupt-parent = <&periph_intc>;
36 clocks = <&periph_clk>;
37 + clock-names = "refclk";
41 --- a/drivers/tty/serial/bcm63xx_uart.c
42 +++ b/drivers/tty/serial/bcm63xx_uart.c
43 @@ -837,8 +837,10 @@ static int bcm_uart_probe(struct platfor
47 - clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) :
48 - clk_get(&pdev->dev, "refclk");
49 + clk = clk_get(&pdev->dev, "refclk");
50 + if (IS_ERR(clk) && pdev->dev.of_node)
51 + clk = of_clk_get(pdev->dev.of_node, 0);