0032-MIPS-ath79-support-setting-up-clock-via-DT-on-all-So.patch 2.7 KB

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