360-MIPS-ath79-export-UART1-reference-clock.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From: Daniel Golle <[email protected]>
  2. Subject: [PATCH] ath79: add support for Atheros AR934x HS UART
  3. AR934x chips also got the 'old' qca,ar9330-uart in addition to the
  4. 'new' ns16550a compatible one. Add support for UART1 clock selector as
  5. well as device-tree bindings in ar934x.dtsi to make use of that uart.
  6. Reported-by: Piotr Dymacz <[email protected]>
  7. Submitted-by: Daniel Golle <[email protected]>
  8. ---
  9. arch/mips/ath79/clock.c | 7 +++++++
  10. .../mips/include/asm/mach-ath79/ar71xx_regs.h | 1 +
  11. include/dt-bindings/clock/ath79-clk.h | 3 ++-
  12. 3 files changed, 10 insertions(+), 1 deletion(-)
  13. --- a/arch/mips/ath79/clock.c
  14. +++ b/arch/mips/ath79/clock.c
  15. @@ -40,6 +40,7 @@ static const char * const clk_names[ATH7
  16. [ATH79_CLK_AHB] = "ahb",
  17. [ATH79_CLK_REF] = "ref",
  18. [ATH79_CLK_MDIO] = "mdio",
  19. + [ATH79_CLK_UART1] = "uart1",
  20. };
  21. static const char * __init ath79_clk_name(int type)
  22. @@ -344,6 +345,9 @@ static void __init ar934x_clocks_init(vo
  23. if (clk_ctrl & AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL)
  24. ath79_set_clk(ATH79_CLK_MDIO, 100 * 1000 * 1000);
  25. + if (clk_ctrl & AR934X_PLL_SWITCH_CLOCK_CONTROL_UART1_CLK_SEL)
  26. + ath79_set_clk(ATH79_CLK_UART1, 100 * 1000 * 1000);
  27. +
  28. iounmap(dpll_base);
  29. }
  30. @@ -649,6 +653,9 @@ static void __init ath79_clocks_init_dt(
  31. if (!clks[ATH79_CLK_MDIO])
  32. clks[ATH79_CLK_MDIO] = clks[ATH79_CLK_REF];
  33. + if (!clks[ATH79_CLK_UART1])
  34. + clks[ATH79_CLK_UART1] = clks[ATH79_CLK_REF];
  35. +
  36. if (of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data)) {
  37. pr_err("%pOF: could not register clk provider\n", np);
  38. goto err_iounmap;
  39. --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  40. +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  41. @@ -348,6 +348,7 @@
  42. #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
  43. #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6)
  44. +#define AR934X_PLL_SWITCH_CLOCK_CONTROL_UART1_CLK_SEL BIT(7)
  45. #define QCA953X_PLL_CPU_CONFIG_REG 0x00
  46. #define QCA953X_PLL_DDR_CONFIG_REG 0x04
  47. --- a/include/dt-bindings/clock/ath79-clk.h
  48. +++ b/include/dt-bindings/clock/ath79-clk.h
  49. @@ -11,7 +11,8 @@
  50. #define ATH79_CLK_AHB 2
  51. #define ATH79_CLK_REF 3
  52. #define ATH79_CLK_MDIO 4
  53. +#define ATH79_CLK_UART1 5
  54. -#define ATH79_CLK_END 5
  55. +#define ATH79_CLK_END 6
  56. #endif /* __DT_BINDINGS_ATH79_CLK_H */