2
0

0079-clk-qcom-Add-basic-support-for-APQ8064-global-clock-.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. From 0f171b8a6e1723f0ce6f98f8b3fba7d2583088c1 Mon Sep 17 00:00:00 2001
  2. From: Kumar Gala <[email protected]>
  3. Date: Fri, 4 Apr 2014 11:31:29 -0500
  4. Subject: [PATCH 079/182] clk: qcom: Add basic support for APQ8064 global
  5. clock controller clocks
  6. The APQ8064 and MSM8960 share a significant amount of clock data and
  7. code between the two SoCs. Rather than duplicating the data we just add
  8. support for a unqiue APQ8064 clock table into the MSM8960 code.
  9. For now add just enough clocks to get a basic serial port going on an
  10. APQ8064 device.
  11. Signed-off-by: Kumar Gala <[email protected]>
  12. Reviewed-by: Stephen Boyd <[email protected]>
  13. Signed-off-by: Mike Turquette <[email protected]>
  14. [[email protected]: trivial conflict due to missing ipq8064 support]
  15. ---
  16. .../devicetree/bindings/clock/qcom,gcc.txt | 1 +
  17. drivers/clk/qcom/Kconfig | 4 +--
  18. drivers/clk/qcom/gcc-msm8960.c | 30 ++++++++++++++++++--
  19. 3 files changed, 30 insertions(+), 5 deletions(-)
  20. --- a/Documentation/devicetree/bindings/clock/qcom,gcc.txt
  21. +++ b/Documentation/devicetree/bindings/clock/qcom,gcc.txt
  22. @@ -4,6 +4,7 @@ Qualcomm Global Clock & Reset Controller
  23. Required properties :
  24. - compatible : shall contain only one of the following:
  25. + "qcom,gcc-apq8064"
  26. "qcom,gcc-msm8660"
  27. "qcom,gcc-msm8960"
  28. "qcom,gcc-msm8974"
  29. --- a/drivers/clk/qcom/Kconfig
  30. +++ b/drivers/clk/qcom/Kconfig
  31. @@ -13,10 +13,10 @@ config MSM_GCC_8660
  32. i2c, USB, SD/eMMC, etc.
  33. config MSM_GCC_8960
  34. - tristate "MSM8960 Global Clock Controller"
  35. + tristate "APQ8064/MSM8960 Global Clock Controller"
  36. depends on COMMON_CLK_QCOM
  37. help
  38. - Support for the global clock controller on msm8960 devices.
  39. + Support for the global clock controller on apq8064/msm8960 devices.
  40. Say Y if you want to use peripheral devices such as UART, SPI,
  41. i2c, USB, SD/eMMC, SATA, PCIe, etc.
  42. --- a/drivers/clk/qcom/gcc-msm8960.c
  43. +++ b/drivers/clk/qcom/gcc-msm8960.c
  44. @@ -1,5 +1,5 @@
  45. /*
  46. - * Copyright (c) 2013, The Linux Foundation. All rights reserved.
  47. + * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
  48. *
  49. * This software is licensed under the terms of the GNU General Public
  50. * License version 2, as published by the Free Software Foundation, and
  51. @@ -2868,6 +2868,16 @@ static const struct qcom_reset_map gcc_m
  52. [RIVA_RESET] = { 0x35e0 },
  53. };
  54. +static struct clk_regmap *gcc_apq8064_clks[] = {
  55. + [PLL8] = &pll8.clkr,
  56. + [PLL8_VOTE] = &pll8_vote,
  57. + [GSBI7_UART_SRC] = &gsbi7_uart_src.clkr,
  58. + [GSBI7_UART_CLK] = &gsbi7_uart_clk.clkr,
  59. + [GSBI7_QUP_SRC] = &gsbi7_qup_src.clkr,
  60. + [GSBI7_QUP_CLK] = &gsbi7_qup_clk.clkr,
  61. + [GSBI7_H_CLK] = &gsbi7_h_clk.clkr,
  62. +};
  63. +
  64. static const struct regmap_config gcc_msm8960_regmap_config = {
  65. .reg_bits = 32,
  66. .reg_stride = 4,
  67. @@ -2884,8 +2894,17 @@ static const struct qcom_cc_desc gcc_msm
  68. .num_resets = ARRAY_SIZE(gcc_msm8960_resets),
  69. };
  70. +static const struct qcom_cc_desc gcc_apq8064_desc = {
  71. + .config = &gcc_msm8960_regmap_config,
  72. + .clks = gcc_apq8064_clks,
  73. + .num_clks = ARRAY_SIZE(gcc_apq8064_clks),
  74. + .resets = gcc_msm8960_resets,
  75. + .num_resets = ARRAY_SIZE(gcc_msm8960_resets),
  76. +};
  77. +
  78. static const struct of_device_id gcc_msm8960_match_table[] = {
  79. - { .compatible = "qcom,gcc-msm8960" },
  80. + { .compatible = "qcom,gcc-msm8960", .data = &gcc_msm8960_desc },
  81. + { .compatible = "qcom,gcc-apq8064", .data = &gcc_apq8064_desc },
  82. { }
  83. };
  84. MODULE_DEVICE_TABLE(of, gcc_msm8960_match_table);
  85. @@ -2894,6 +2913,11 @@ static int gcc_msm8960_probe(struct plat
  86. {
  87. struct clk *clk;
  88. struct device *dev = &pdev->dev;
  89. + const struct of_device_id *match;
  90. +
  91. + match = of_match_device(gcc_msm8960_match_table, &pdev->dev);
  92. + if (!match)
  93. + return -EINVAL;
  94. /* Temporary until RPM clocks supported */
  95. clk = clk_register_fixed_rate(dev, "cxo", NULL, CLK_IS_ROOT, 19200000);
  96. @@ -2904,7 +2928,7 @@ static int gcc_msm8960_probe(struct plat
  97. if (IS_ERR(clk))
  98. return PTR_ERR(clk);
  99. - return qcom_cc_probe(pdev, &gcc_msm8960_desc);
  100. + return qcom_cc_probe(pdev, match->data);
  101. }
  102. static int gcc_msm8960_remove(struct platform_device *pdev)