0039-v6.1-clk-qcom-apss-ipq6018-fix-apcs_alias0_clk_src.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From 6b9d5ecd2913758780a0529f9b95392f330b721b Mon Sep 17 00:00:00 2001
  2. From: Robert Marko <[email protected]>
  3. Date: Fri, 19 Aug 2022 00:06:21 +0200
  4. Subject: [PATCH] clk: qcom: apss-ipq6018: fix apcs_alias0_clk_src
  5. While working on IPQ8074 APSS driver it was discovered that IPQ6018 and
  6. IPQ8074 use almost the same PLL and APSS clocks, however APSS driver is
  7. currently broken.
  8. More precisely apcs_alias0_clk_src is broken, it was added as regmap_mux
  9. clock.
  10. However after debugging why it was always stuck at 800Mhz, it was figured
  11. out that its not regmap_mux compatible at all.
  12. It is a simple mux but it uses RCG2 register layout and control bits, so
  13. utilize the new clk_rcg2_mux_closest_ops to correctly drive it while not
  14. having to provide a dummy frequency table.
  15. While we are here, use ARRAY_SIZE for number of parents.
  16. Tested on IPQ6018-CP01-C1 reference board and multiple IPQ8074 boards.
  17. Fixes: 5e77b4ef1b19 ("clk: qcom: Add ipq6018 apss clock controller")
  18. Signed-off-by: Robert Marko <[email protected]>
  19. Reviewed-by: Dmitry Baryshkov <[email protected]>
  20. Signed-off-by: Bjorn Andersson <[email protected]>
  21. Link: https://lore.kernel.org/r/[email protected]
  22. ---
  23. drivers/clk/qcom/apss-ipq6018.c | 13 ++++++-------
  24. 1 file changed, 6 insertions(+), 7 deletions(-)
  25. --- a/drivers/clk/qcom/apss-ipq6018.c
  26. +++ b/drivers/clk/qcom/apss-ipq6018.c
  27. @@ -16,7 +16,7 @@
  28. #include "clk-regmap.h"
  29. #include "clk-branch.h"
  30. #include "clk-alpha-pll.h"
  31. -#include "clk-regmap-mux.h"
  32. +#include "clk-rcg.h"
  33. enum {
  34. P_XO,
  35. @@ -33,16 +33,15 @@ static const struct parent_map parents_a
  36. { P_APSS_PLL_EARLY, 5 },
  37. };
  38. -static struct clk_regmap_mux apcs_alias0_clk_src = {
  39. - .reg = 0x0050,
  40. - .width = 3,
  41. - .shift = 7,
  42. +static struct clk_rcg2 apcs_alias0_clk_src = {
  43. + .cmd_rcgr = 0x0050,
  44. + .hid_width = 5,
  45. .parent_map = parents_apcs_alias0_clk_src_map,
  46. .clkr.hw.init = &(struct clk_init_data){
  47. .name = "apcs_alias0_clk_src",
  48. .parent_data = parents_apcs_alias0_clk_src,
  49. - .num_parents = 2,
  50. - .ops = &clk_regmap_mux_closest_ops,
  51. + .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src),
  52. + .ops = &clk_rcg2_mux_closest_ops,
  53. .flags = CLK_SET_RATE_PARENT,
  54. },
  55. };