0025-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. From 6325626de001df98aebe51f3008b1aca05798d19 Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <[email protected]>
  3. Date: Tue, 6 Mar 2018 13:26:27 +0100
  4. Subject: [PATCH 25/33] MIPS: ath79: support setting up clock via DT on all SoC
  5. types
  6. Use the same functions as the legacy code
  7. Signed-off-by: Felix Fietkau <[email protected]>
  8. Signed-off-by: John Crispin <[email protected]>
  9. ---
  10. arch/mips/ath79/clock.c | 39 ++++++++++++++++++++++-----------------
  11. 1 file changed, 22 insertions(+), 17 deletions(-)
  12. --- a/arch/mips/ath79/clock.c
  13. +++ b/arch/mips/ath79/clock.c
  14. @@ -669,16 +669,6 @@ ath79_get_sys_clk_rate(const char *id)
  15. #ifdef CONFIG_OF
  16. static void __init ath79_clocks_init_dt(struct device_node *np)
  17. {
  18. - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
  19. -}
  20. -
  21. -CLK_OF_DECLARE(ar7100, "qca,ar7100-pll", ath79_clocks_init_dt);
  22. -CLK_OF_DECLARE(ar7240, "qca,ar7240-pll", ath79_clocks_init_dt);
  23. -CLK_OF_DECLARE(ar9340, "qca,ar9340-pll", ath79_clocks_init_dt);
  24. -CLK_OF_DECLARE(ar9550, "qca,qca9550-pll", ath79_clocks_init_dt);
  25. -
  26. -static void __init ath79_clocks_init_dt_ng(struct device_node *np)
  27. -{
  28. struct clk *ref_clk;
  29. void __iomem *pll_base;
  30. @@ -692,14 +682,21 @@ static void __init ath79_clocks_init_dt_
  31. goto err_clk;
  32. }
  33. - if (of_device_is_compatible(np, "qca,ar9130-pll"))
  34. + if (of_device_is_compatible(np, "qca,ar7100-pll"))
  35. + ar71xx_clocks_init(pll_base);
  36. + else if (of_device_is_compatible(np, "qca,ar7240-pll") ||
  37. + of_device_is_compatible(np, "qca,ar9130-pll"))
  38. ar724x_clocks_init(pll_base);
  39. else if (of_device_is_compatible(np, "qca,ar9330-pll"))
  40. ar933x_clocks_init(pll_base);
  41. - else {
  42. - pr_err("%pOF: could not find any appropriate clk_init()\n", np);
  43. - goto err_iounmap;
  44. - }
  45. + else if (of_device_is_compatible(np, "qca,ar9340-pll"))
  46. + ar934x_clocks_init(pll_base);
  47. + else if (of_device_is_compatible(np, "qca,qca9530-pll"))
  48. + qca953x_clocks_init(pll_base);
  49. + else if (of_device_is_compatible(np, "qca,qca9550-pll"))
  50. + qca955x_clocks_init(pll_base);
  51. + else if (of_device_is_compatible(np, "qca,qca9560-pll"))
  52. + qca956x_clocks_init(pll_base);
  53. if (of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data)) {
  54. pr_err("%pOF: could not register clk provider\n", np);
  55. @@ -714,6 +711,14 @@ err_iounmap:
  56. err_clk:
  57. clk_put(ref_clk);
  58. }
  59. -CLK_OF_DECLARE(ar9130_clk, "qca,ar9130-pll", ath79_clocks_init_dt_ng);
  60. -CLK_OF_DECLARE(ar9330_clk, "qca,ar9330-pll", ath79_clocks_init_dt_ng);
  61. +
  62. +CLK_OF_DECLARE(ar7100_clk, "qca,ar7100-pll", ath79_clocks_init_dt);
  63. +CLK_OF_DECLARE(ar7240_clk, "qca,ar7240-pll", ath79_clocks_init_dt);
  64. +CLK_OF_DECLARE(ar9130_clk, "qca,ar9130-pll", ath79_clocks_init_dt);
  65. +CLK_OF_DECLARE(ar9330_clk, "qca,ar9330-pll", ath79_clocks_init_dt);
  66. +CLK_OF_DECLARE(ar9340_clk, "qca,ar9340-pll", ath79_clocks_init_dt);
  67. +CLK_OF_DECLARE(ar9530_clk, "qca,qca9530-pll", ath79_clocks_init_dt);
  68. +CLK_OF_DECLARE(ar9550_clk, "qca,qca9550-pll", ath79_clocks_init_dt);
  69. +CLK_OF_DECLARE(ar9560_clk, "qca,qca9560-pll", ath79_clocks_init_dt);
  70. +
  71. #endif