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