003-mv-cxo-pxo-xo-into-DT.patch 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. From a085f877a882b465fce74188c9d8efd12bd5acd4 Mon Sep 17 00:00:00 2001
  2. From: Stephen Boyd <sboyd@codeaurora.org>
  3. Date: Mon, 26 Oct 2015 18:10:09 -0700
  4. Subject: clk: qcom: Move cxo/pxo/xo into dt files
  5. Put these clocks into the dt files instead of registering them
  6. from C code. This provides a few benefits. It allows us to
  7. specify the frequency of these clocks at the board level instead
  8. of hard-coding them in the driver. It allows us to insert an RPM
  9. clock in between the consumers of the crystals and the actual
  10. clock. And finally, it helps us transition the GCC driver to use
  11. RPM clocks when that configuration is enabled.
  12. Cc: Georgi Djakov <georgi.djakov@linaro.org>
  13. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
  14. ---
  15. drivers/clk/qcom/gcc-apq8084.c | 16 +++++++---------
  16. drivers/clk/qcom/gcc-ipq806x.c | 14 ++++++--------
  17. drivers/clk/qcom/gcc-msm8660.c | 15 +++++++--------
  18. drivers/clk/qcom/gcc-msm8960.c | 14 ++++++--------
  19. drivers/clk/qcom/gcc-msm8974.c | 17 +++++++----------
  20. 5 files changed, 33 insertions(+), 43 deletions(-)
  21. --- a/drivers/clk/qcom/gcc-apq8084.c
  22. +++ b/drivers/clk/qcom/gcc-apq8084.c
  23. @@ -3607,18 +3607,16 @@ MODULE_DEVICE_TABLE(of, gcc_apq8084_matc
  24. static int gcc_apq8084_probe(struct platform_device *pdev)
  25. {
  26. - struct clk *clk;
  27. + int ret;
  28. struct device *dev = &pdev->dev;
  29. - /* Temporary until RPM clocks supported */
  30. - clk = clk_register_fixed_rate(dev, "xo", NULL, CLK_IS_ROOT, 19200000);
  31. - if (IS_ERR(clk))
  32. - return PTR_ERR(clk);
  33. + ret = qcom_cc_register_board_clk(dev, "xo_board", "xo", 19200000);
  34. + if (ret)
  35. + return ret;
  36. - clk = clk_register_fixed_rate(dev, "sleep_clk_src", NULL,
  37. - CLK_IS_ROOT, 32768);
  38. - if (IS_ERR(clk))
  39. - return PTR_ERR(clk);
  40. + ret = qcom_cc_register_sleep_clk(dev);
  41. + if (ret)
  42. + return ret;
  43. return qcom_cc_probe(pdev, &gcc_apq8084_desc);
  44. }
  45. --- a/drivers/clk/qcom/gcc-ipq806x.c
  46. +++ b/drivers/clk/qcom/gcc-ipq806x.c
  47. @@ -3023,19 +3023,17 @@ MODULE_DEVICE_TABLE(of, gcc_ipq806x_matc
  48. static int gcc_ipq806x_probe(struct platform_device *pdev)
  49. {
  50. - struct clk *clk;
  51. struct device *dev = &pdev->dev;
  52. struct regmap *regmap;
  53. int ret;
  54. - /* Temporary until RPM clocks supported */
  55. - clk = clk_register_fixed_rate(dev, "cxo", NULL, CLK_IS_ROOT, 25000000);
  56. - if (IS_ERR(clk))
  57. - return PTR_ERR(clk);
  58. + ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 25000000);
  59. + if (ret)
  60. + return ret;
  61. - clk = clk_register_fixed_rate(dev, "pxo", NULL, CLK_IS_ROOT, 25000000);
  62. - if (IS_ERR(clk))
  63. - return PTR_ERR(clk);
  64. + ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 25000000);
  65. + if (ret)
  66. + return ret;
  67. ret = qcom_cc_probe(pdev, &gcc_ipq806x_desc);
  68. if (ret)
  69. --- a/drivers/clk/qcom/gcc-msm8660.c
  70. +++ b/drivers/clk/qcom/gcc-msm8660.c
  71. @@ -2720,17 +2720,16 @@ MODULE_DEVICE_TABLE(of, gcc_msm8660_matc
  72. static int gcc_msm8660_probe(struct platform_device *pdev)
  73. {
  74. - struct clk *clk;
  75. + int ret;
  76. struct device *dev = &pdev->dev;
  77. - /* Temporary until RPM clocks supported */
  78. - clk = clk_register_fixed_rate(dev, "cxo", NULL, CLK_IS_ROOT, 19200000);
  79. - if (IS_ERR(clk))
  80. - return PTR_ERR(clk);
  81. + ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 19200000);
  82. + if (ret)
  83. + return ret;
  84. - clk = clk_register_fixed_rate(dev, "pxo", NULL, CLK_IS_ROOT, 27000000);
  85. - if (IS_ERR(clk))
  86. - return PTR_ERR(clk);
  87. + ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 27000000);
  88. + if (ret)
  89. + return ret;
  90. return qcom_cc_probe(pdev, &gcc_msm8660_desc);
  91. }
  92. --- a/drivers/clk/qcom/gcc-msm8960.c
  93. +++ b/drivers/clk/qcom/gcc-msm8960.c
  94. @@ -3503,7 +3503,6 @@ MODULE_DEVICE_TABLE(of, gcc_msm8960_matc
  95. static int gcc_msm8960_probe(struct platform_device *pdev)
  96. {
  97. - struct clk *clk;
  98. struct device *dev = &pdev->dev;
  99. const struct of_device_id *match;
  100. struct platform_device *tsens;
  101. @@ -3513,14 +3512,13 @@ static int gcc_msm8960_probe(struct plat
  102. if (!match)
  103. return -EINVAL;
  104. - /* Temporary until RPM clocks supported */
  105. - clk = clk_register_fixed_rate(dev, "cxo", NULL, CLK_IS_ROOT, 19200000);
  106. - if (IS_ERR(clk))
  107. - return PTR_ERR(clk);
  108. + ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 19200000);
  109. + if (ret)
  110. + return ret;
  111. - clk = clk_register_fixed_rate(dev, "pxo", NULL, CLK_IS_ROOT, 27000000);
  112. - if (IS_ERR(clk))
  113. - return PTR_ERR(clk);
  114. + ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 27000000);
  115. + if (ret)
  116. + return ret;
  117. ret = qcom_cc_probe(pdev, match->data);
  118. if (ret)
  119. --- a/drivers/clk/qcom/gcc-msm8974.c
  120. +++ b/drivers/clk/qcom/gcc-msm8974.c
  121. @@ -2717,7 +2717,7 @@ static void msm8974_pro_clock_override(v
  122. static int gcc_msm8974_probe(struct platform_device *pdev)
  123. {
  124. - struct clk *clk;
  125. + int ret;
  126. struct device *dev = &pdev->dev;
  127. bool pro;
  128. const struct of_device_id *id;
  129. @@ -2730,16 +2730,13 @@ static int gcc_msm8974_probe(struct plat
  130. if (pro)
  131. msm8974_pro_clock_override();
  132. - /* Temporary until RPM clocks supported */
  133. - clk = clk_register_fixed_rate(dev, "xo", NULL, CLK_IS_ROOT, 19200000);
  134. - if (IS_ERR(clk))
  135. - return PTR_ERR(clk);
  136. -
  137. - /* Should move to DT node? */
  138. - clk = clk_register_fixed_rate(dev, "sleep_clk_src", NULL,
  139. - CLK_IS_ROOT, 32768);
  140. - if (IS_ERR(clk))
  141. - return PTR_ERR(clk);
  142. + ret = qcom_cc_register_board_clk(dev, "xo_board", "xo", 19200000);
  143. + if (ret)
  144. + return ret;
  145. +
  146. + ret = qcom_cc_register_sleep_clk(dev);
  147. + if (ret)
  148. + return ret;
  149. return qcom_cc_probe(pdev, &gcc_msm8974_desc);
  150. }