1
0

0022-MIPS-ath79-move-legacy-wdt-and-uart-clock-aliases-ou.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. From 339c191a95e978353c9ba3aafab0261e14de109b Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <nbd@nbd.name>
  3. Date: Tue, 6 Mar 2018 13:22:43 +0100
  4. Subject: [PATCH 22/33] MIPS: ath79: move legacy "wdt" and "uart" clock aliases
  5. out of soc init
  6. Preparation for reusing functions for DT
  7. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8. Signed-off-by: John Crispin <john@phrozen.org>
  9. ---
  10. arch/mips/ath79/clock.c | 38 +++++++++++++++++---------------------
  11. 1 file changed, 17 insertions(+), 21 deletions(-)
  12. --- a/arch/mips/ath79/clock.c
  13. +++ b/arch/mips/ath79/clock.c
  14. @@ -110,9 +110,6 @@ static void __init ar71xx_clocks_init(vo
  15. ath79_set_clk(ATH79_CLK_CPU, cpu_rate);
  16. ath79_set_clk(ATH79_CLK_DDR, ddr_rate);
  17. ath79_set_clk(ATH79_CLK_AHB, ahb_rate);
  18. -
  19. - clk_add_alias("wdt", NULL, "ahb", NULL);
  20. - clk_add_alias("uart", NULL, "ahb", NULL);
  21. }
  22. static void __init ar724x_clk_init(struct clk *ref_clk, void __iomem *pll_base)
  23. @@ -140,9 +137,6 @@ static void __init ar724x_clocks_init(vo
  24. ref_clk = ath79_set_clk(ATH79_CLK_REF, AR724X_BASE_FREQ);
  25. ar724x_clk_init(ref_clk, ath79_pll_base);
  26. -
  27. - clk_add_alias("wdt", NULL, "ahb", NULL);
  28. - clk_add_alias("uart", NULL, "ahb", NULL);
  29. }
  30. static void __init ar9330_clk_init(struct clk *ref_clk, void __iomem *pll_base)
  31. @@ -218,9 +212,6 @@ static void __init ar933x_clocks_init(vo
  32. ref_clk = ath79_set_clk(ATH79_CLK_REF, ref_rate);
  33. ar9330_clk_init(ref_clk, ath79_pll_base);
  34. -
  35. - clk_add_alias("wdt", NULL, "ahb", NULL);
  36. - clk_add_alias("uart", NULL, "ref", NULL);
  37. }
  38. static u32 __init ar934x_get_pll_freq(u32 ref, u32 ref_div, u32 nint, u32 nfrac,
  39. @@ -353,9 +344,6 @@ static void __init ar934x_clocks_init(vo
  40. ath79_set_clk(ATH79_CLK_DDR, ddr_rate);
  41. ath79_set_clk(ATH79_CLK_AHB, ahb_rate);
  42. - clk_add_alias("wdt", NULL, "ref", NULL);
  43. - clk_add_alias("uart", NULL, "ref", NULL);
  44. -
  45. iounmap(dpll_base);
  46. }
  47. @@ -439,9 +427,6 @@ static void __init qca953x_clocks_init(v
  48. ath79_set_clk(ATH79_CLK_CPU, cpu_rate);
  49. ath79_set_clk(ATH79_CLK_DDR, ddr_rate);
  50. ath79_set_clk(ATH79_CLK_AHB, ahb_rate);
  51. -
  52. - clk_add_alias("wdt", NULL, "ref", NULL);
  53. - clk_add_alias("uart", NULL, "ref", NULL);
  54. }
  55. static void __init qca955x_clocks_init(void)
  56. @@ -524,9 +509,6 @@ static void __init qca955x_clocks_init(v
  57. ath79_set_clk(ATH79_CLK_CPU, cpu_rate);
  58. ath79_set_clk(ATH79_CLK_DDR, ddr_rate);
  59. ath79_set_clk(ATH79_CLK_AHB, ahb_rate);
  60. -
  61. - clk_add_alias("wdt", NULL, "ref", NULL);
  62. - clk_add_alias("uart", NULL, "ref", NULL);
  63. }
  64. static void __init qca956x_clocks_init(void)
  65. @@ -628,13 +610,13 @@ static void __init qca956x_clocks_init(v
  66. ath79_set_clk(ATH79_CLK_CPU, cpu_rate);
  67. ath79_set_clk(ATH79_CLK_DDR, ddr_rate);
  68. ath79_set_clk(ATH79_CLK_AHB, ahb_rate);
  69. -
  70. - clk_add_alias("wdt", NULL, "ref", NULL);
  71. - clk_add_alias("uart", NULL, "ref", NULL);
  72. }
  73. void __init ath79_clocks_init(void)
  74. {
  75. + const char *wdt;
  76. + const char *uart;
  77. +
  78. if (soc_is_ar71xx())
  79. ar71xx_clocks_init();
  80. else if (soc_is_ar724x() || soc_is_ar913x())
  81. @@ -651,6 +633,20 @@ void __init ath79_clocks_init(void)
  82. qca956x_clocks_init();
  83. else
  84. BUG();
  85. +
  86. + if (soc_is_ar71xx() || soc_is_ar724x() || soc_is_ar913x()) {
  87. + wdt = "ahb";
  88. + uart = "ahb";
  89. + } else if (soc_is_ar933x()) {
  90. + wdt = "ahb";
  91. + uart = "ref";
  92. + } else {
  93. + wdt = "ref";
  94. + uart = "ref";
  95. + }
  96. +
  97. + clk_add_alias("wdt", NULL, wdt, NULL);
  98. + clk_add_alias("uart", NULL, uart, NULL);
  99. }
  100. unsigned long __init