001-4.15-04-tty-bcm63xx_uart-allow-naming-clock-in-device-tree.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 317f8659bba01b307cbe4e9902d4e3d333fd7164 Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <[email protected]>
  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
  5. Codify using a named clock for the refclk of the uart. This makes it
  6. easier if we might need to add a gating clock (like present on the
  7. BCM6345).
  8. Acked-by: Rob Herring <[email protected]>
  9. Acked-by: Greg Kroah-Hartman <[email protected]>
  10. Reviewed-by: Florian Fainelli <[email protected]>
  11. Signed-off-by: Jonas Gorski <[email protected]>
  12. ---
  13. Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt | 6 ++++++
  14. drivers/tty/serial/bcm63xx_uart.c | 6 ++++--
  15. 2 files changed, 10 insertions(+), 2 deletions(-)
  16. --- a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
  17. +++ b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt
  18. @@ -11,6 +11,11 @@ Required properties:
  19. - clocks: Clock driving the hardware; used to figure out the baud rate
  20. divisor.
  21. +
  22. +Optional properties:
  23. +
  24. +- clock-names: Should be "refclk".
  25. +
  26. Example:
  27. uart0: serial@14e00520 {
  28. @@ -19,6 +24,7 @@ Example:
  29. interrupt-parent = <&periph_intc>;
  30. interrupts = <2>;
  31. clocks = <&periph_clk>;
  32. + clock-names = "refclk";
  33. };
  34. clocks {
  35. --- a/drivers/tty/serial/bcm63xx_uart.c
  36. +++ b/drivers/tty/serial/bcm63xx_uart.c
  37. @@ -841,8 +841,10 @@ static int bcm_uart_probe(struct platfor
  38. if (!res_irq)
  39. return -ENODEV;
  40. - clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) :
  41. - clk_get(&pdev->dev, "refclk");
  42. + clk = clk_get(&pdev->dev, "refclk");
  43. + if (IS_ERR(clk) && pdev->dev.of_node)
  44. + clk = of_clk_get(pdev->dev.of_node, 0);
  45. +
  46. if (IS_ERR(clk))
  47. return -ENODEV;