0053-clk-mediatek-enable-critical-clocks.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From c8fd103d6c07af5db47f061b70759b7c69169656 Mon Sep 17 00:00:00 2001
  2. From: John Crispin <blogic@openwrt.org>
  3. Date: Thu, 31 Mar 2016 06:46:51 +0200
  4. Subject: [PATCH 053/102] clk: mediatek: enable critical clocks
  5. Signed-off-by: John Crispin <blogic@openwrt.org>
  6. ---
  7. drivers/clk/mediatek/clk-mt2701.c | 22 ++++++++++++++++++++--
  8. 1 file changed, 20 insertions(+), 2 deletions(-)
  9. --- a/drivers/clk/mediatek/clk-mt2701.c
  10. +++ b/drivers/clk/mediatek/clk-mt2701.c
  11. @@ -573,6 +573,20 @@ static const struct mtk_gate top_clks[]
  12. GATE_TOP_AUD(CLK_TOP_AUD_I2S6_MCLK, "aud_i2s6_mclk", "aud_k6_src_div", 28),
  13. };
  14. +static struct clk_onecell_data *mt7623_top_clk_data __initdata;
  15. +static struct clk_onecell_data *mt7623_pll_clk_data __initdata;
  16. +
  17. +static void __init mtk_clk_enable_critical(void)
  18. +{
  19. + if (!mt7623_top_clk_data || !mt7623_pll_clk_data)
  20. + return;
  21. +
  22. + clk_prepare_enable(mt7623_pll_clk_data->clks[CLK_APMIXED_ARMPLL]);
  23. + clk_prepare_enable(mt7623_top_clk_data->clks[CLK_TOP_MEM_SEL]);
  24. + clk_prepare_enable(mt7623_top_clk_data->clks[CLK_TOP_DDRPHYCFG_SEL]);
  25. + clk_prepare_enable(mt7623_top_clk_data->clks[CLK_TOP_RTC_SEL]);
  26. +}
  27. +
  28. static void __init mtk_topckgen_init(struct device_node *node)
  29. {
  30. struct clk_onecell_data *clk_data;
  31. @@ -585,7 +599,7 @@ static void __init mtk_topckgen_init(str
  32. return;
  33. }
  34. - clk_data = mtk_alloc_clk_data(CLK_TOP_NR);
  35. + mt7623_top_clk_data = clk_data = mtk_alloc_clk_data(CLK_TOP_NR);
  36. mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
  37. clk_data);
  38. @@ -606,6 +620,8 @@ static void __init mtk_topckgen_init(str
  39. if (r)
  40. pr_err("%s(): could not register clock provider: %d\n",
  41. __func__, r);
  42. +
  43. + mtk_clk_enable_critical();
  44. }
  45. CLK_OF_DECLARE(mtk_topckgen, "mediatek,mt2701-topckgen", mtk_topckgen_init);
  46. @@ -1202,7 +1218,7 @@ static void __init mtk_apmixedsys_init(s
  47. struct clk_onecell_data *clk_data;
  48. int r;
  49. - clk_data = mtk_alloc_clk_data(ARRAY_SIZE(apmixed_plls));
  50. + mt7623_pll_clk_data = clk_data = mtk_alloc_clk_data(ARRAY_SIZE(apmixed_plls));
  51. if (!clk_data)
  52. return;
  53. @@ -1213,6 +1229,8 @@ static void __init mtk_apmixedsys_init(s
  54. if (r)
  55. pr_err("%s(): could not register clock provider: %d\n",
  56. __func__, r);
  57. +
  58. + mtk_clk_enable_critical();
  59. }
  60. CLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt2701-apmixedsys",
  61. mtk_apmixedsys_init);