Skip to contentSkip to conversation

Add GCC and RPMh clock support for SDX65

PATCH Applied [email protected] 3 participants 14 messages Dec 2, 2021 – Dec 7, 2021

Subsystems (4)

v6 of 7 Applied Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add GCC and RPMh clock support for SDX65

From: Vamsi Krishna Lanka <[email protected]>

Hello,
Changes from v5:
- Collected Vinod Koul's and Rob's Reviewed-by for the patches
- Rebased on the latest tip of Torvald's tree (MAINTAINERS: co-maintain random.c)

Changes from v4:
- Fixed comments from vinod koul on Clock Alpha PLL and GCC driver support patches
- Addressed Rob's comments related to GCC dt-binding patch
- Collected Vinod Koul's Reviewed-by for the dt-bindings patches

Changes from v3:
- Fixed DTbindings and unused variables errors reported by kernel test bot
- Rebased on top of v5.16-rc1

Changes from v2:
- Addressed Taniya Das and Vinod Koul's comments related to adding LUCID_EVO PLL type and rpmh support patches
- Collected Rob's Acked-by for the dt-bindings patches

Changes from v1:
- Addressed Bjorn's comments related to the GCC support patch
- Collected Bjorn's and Rob's Reviewed-by for the dt-bindings patches

This patch series adds bindings and device driver changes for GCC, pdc and RPMh clock support for SDX65 Platform.

Thanks,
Vamsi

Vamsi Krishna Lanka (2):
clk: qcom: Add LUCID_EVO PLL type for SDX65
clk: qcom: Add SDX65 GCC support

Vamsi krishna Lanka (3):
dt-bindings: clock: Add SDX65 GCC clock bindings
dt-bindings: clock: Introduce RPMHCC bindings for SDX65
clk: qcom: Add support for SDX65 RPMh clocks

 .../bindings/clock/qcom,gcc-sdx65.yaml        |   80 +
 .../bindings/clock/qcom,rpmhcc.yaml           |    1 +
 drivers/clk/qcom/Kconfig                      |    8 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/clk-alpha-pll.c              |  204 ++-
 drivers/clk/qcom/clk-alpha-pll.h              |    3 +
 drivers/clk/qcom/clk-rpmh.c                   |   25 +
 drivers/clk/qcom/gcc-sdx65.c                  | 1603 +++++++++++++++++
 include/dt-bindings/clock/qcom,gcc-sdx65.h    |  122 ++
 9 files changed, 2021 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sdx65.yaml
 create mode 100644 drivers/clk/qcom/gcc-sdx65.c
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sdx65.h

base-commit: 58e1100fdc5990b0cc0d4beaf2562a92e621ac7d

Signature · 1 line
2.33.1
#1 lore raw

PATCH v6 1/5 dt-bindings: clock: Add SDX65 GCC clock bindings

From: Vamsi krishna Lanka <[email protected]>

Add device tree bindings for global clock controller on SDX65 SOCs.

---
 .../bindings/clock/qcom,gcc-sdx65.yaml        |  80 ++++++++++++
 include/dt-bindings/clock/qcom,gcc-sdx65.h    | 122 ++++++++++++++++++
 2 files changed, 202 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sdx65.yaml
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sdx65.h
Documentation/devicetree/bindings/clock/qcom,gcc-sdx65.yaml new file +80 -0
new file mode 100644
index 000000000000..16c4cdc7b4d6
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,gcc-sdx65.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Global Clock & Reset Controller Binding for SDX65
+
+maintainers:
+  - Vamsi krishna Lanka <[email protected]>
+
+description: |
+  Qualcomm global clock control module which supports the clocks, resets and
+  power domains on SDX65
+
+  See also:
+  - dt-bindings/clock/qcom,gcc-sdx65.h
+
+properties:
+  compatible:
+    const: qcom,gcc-sdx65
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Board XO source
+      - description: Board active XO source
+      - description: Sleep clock source
+      - description: PCIE Pipe clock source
+      - description: USB3 phy wrapper pipe clock source
+      - description: PLL test clock source (Optional clock)
+    minItems: 5
+
+  clock-names:
+    items:
+      - const: bi_tcxo
+      - const: bi_tcxo_ao
+      - const: sleep_clk
+      - const: pcie_pipe_clk
+      - const: usb3_phy_wrapper_gcc_usb30_pipe_clk
+      - const: core_bi_pll_test_se # Optional clock
+    minItems: 5
+
+  '#clock-cells':
+    const: 1
+
+  '#reset-cells':
+    const: 1
+
+  '#power-domain-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+  - '#reset-cells'
+  - '#power-domain-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    clock-controller@100000 {
+      compatible = "qcom,gcc-sdx65";
+      reg = <0x100000 0x1f7400>;
+      clocks = <&rpmhcc RPMH_CXO_CLK>, <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>,
+               <&pcie_pipe_clk>, <&usb3_phy_wrapper_gcc_usb30_pipe_clk>, <&pll_test_clk>;
+      clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk",
+                    "pcie_pipe_clk", "usb3_phy_wrapper_gcc_usb30_pipe_clk", "core_bi_pll_test_se";
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+...
include/dt-bindings/clock/qcom,gcc-sdx65.h new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
2.33.1
#2 lore raw

PATCH v6 2/5 clk: qcom: Add LUCID_EVO PLL type for SDX65

In reply to [email protected]

From: Vamsi Krishna Lanka <[email protected]>

Add a LUCID_EVO PLL type for SDX65 SoC from Qualcomm.

---
 drivers/clk/qcom/clk-alpha-pll.c | 204 +++++++++++++++++++++++++++----
 drivers/clk/qcom/clk-alpha-pll.h |   3 +
 2 files changed, 181 insertions(+), 26 deletions(-)
drivers/clk/qcom/clk-alpha-pll.c +178 -26
index eaedcceb766f..e0c67b76d8ac 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2015, 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/kernel.h>
@@ -139,6 +140,20 @@ const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = {
 		[PLL_OFF_OPMODE] = 0x28,
 		[PLL_OFF_STATUS] = 0x38,
 	},
+	[CLK_ALPHA_PLL_TYPE_LUCID_EVO] = {
+		[PLL_OFF_OPMODE] = 0x04,
+		[PLL_OFF_STATUS] = 0x0c,
+		[PLL_OFF_L_VAL] = 0x10,
+		[PLL_OFF_ALPHA_VAL] = 0x14,
+		[PLL_OFF_USER_CTL] = 0x18,
+		[PLL_OFF_USER_CTL_U] = 0x1c,
+		[PLL_OFF_CONFIG_CTL] = 0x20,
+		[PLL_OFF_CONFIG_CTL_U] = 0x24,
+		[PLL_OFF_CONFIG_CTL_U1] = 0x28,
+		[PLL_OFF_TEST_CTL] = 0x2c,
+		[PLL_OFF_TEST_CTL_U] = 0x30,
+		[PLL_OFF_TEST_CTL_U1] = 0x34,
+        },
 };
 EXPORT_SYMBOL_GPL(clk_alpha_pll_regs);
 
@@ -175,6 +190,10 @@ EXPORT_SYMBOL_GPL(clk_alpha_pll_regs);
 #define LUCID_5LPE_PLL_LATCH_INPUT	BIT(14)
 #define LUCID_5LPE_ENABLE_VOTE_RUN	BIT(21)
 
+/* LUCID EVO PLL specific settings and offsets */
+#define LUCID_EVO_ENABLE_VOTE_RUN       BIT(25)
+#define LUCID_EVO_PLL_L_VAL_MASK        GENMASK(15, 0)
+
 /* ZONDA PLL specific */
 #define ZONDA_PLL_OUT_MASK	0xf
 #define ZONDA_STAY_IN_CFA	BIT(16)
@@ -1741,35 +1760,47 @@ static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate,
 					  LUCID_5LPE_ALPHA_PLL_ACK_LATCH);
 }
 
+static int __clk_lucid_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
+                                            unsigned long parent_rate, unsigned long enable_vote_run)
+{
+        struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw);
+	struct regmap *regmap = pll->clkr.regmap;
+        int i, val = 0, div, ret;
+        u32 mask;
+
+        /*
+         * If the PLL is in FSM mode, then treat set_rate callback as a
+         * no-operation.
+         */
+        ret = regmap_read(regmap, PLL_USER_CTL(pll), &val);
+        if (ret)
+                return ret;
+
+        if (val & enable_vote_run)
+                return 0;
+
+        if (!pll->post_div_table) {
+                pr_err("Missing the post_div_table for the PLL\n");
+                return -EINVAL;
+        }
+
+        div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
+        for (i = 0; i < pll->num_post_div; i++) {
+                if (pll->post_div_table[i].div == div) {
+                        val = pll->post_div_table[i].val;
+                        break;
+                }
+        }
+
+        mask = GENMASK(pll->width + pll->post_div_shift - 1, pll->post_div_shift);
+        return regmap_update_bits(pll->clkr.regmap, PLL_USER_CTL(pll),
+                                  mask, val << pll->post_div_shift);
+}
+
 static int clk_lucid_5lpe_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
 					       unsigned long parent_rate)
 {
-	struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw);
-	int i, val = 0, div, ret;
-	u32 mask;
-
-	/*
-	 * If the PLL is in FSM mode, then treat set_rate callback as a
-	 * no-operation.
-	 */
-	ret = regmap_read(pll->clkr.regmap, PLL_USER_CTL(pll), &val);
-	if (ret)
-		return ret;
-
-	if (val & LUCID_5LPE_ENABLE_VOTE_RUN)
-		return 0;
-
-	div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
-	for (i = 0; i < pll->num_post_div; i++) {
-		if (pll->post_div_table[i].div == div) {
-			val = pll->post_div_table[i].val;
-			break;
-		}
-	}
-
-	mask = GENMASK(pll->width + pll->post_div_shift - 1, pll->post_div_shift);
-	return regmap_update_bits(pll->clkr.regmap, PLL_USER_CTL(pll),
-				  mask, val << pll->post_div_shift);
+	return __clk_lucid_pll_postdiv_set_rate(hw, rate, parent_rate, LUCID_5LPE_ENABLE_VOTE_RUN);
 }
 
 const struct clk_ops clk_alpha_pll_lucid_5lpe_ops = {
@@ -1951,3 +1982,124 @@ const struct clk_ops clk_alpha_pll_zonda_ops = {
 	.set_rate = clk_zonda_pll_set_rate,
 };
 EXPORT_SYMBOL(clk_alpha_pll_zonda_ops);
+
+static int alpha_pll_lucid_evo_enable(struct clk_hw *hw)
+{
+	struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
+	struct regmap *regmap = pll->clkr.regmap;
+	u32 val;
+	int ret;
+
+	ret = regmap_read(regmap, PLL_USER_CTL(pll), &val);
+	if (ret)
+		return ret;
+
+	/* If in FSM mode, just vote for it */
+	if (val & LUCID_EVO_ENABLE_VOTE_RUN) {
+		ret = clk_enable_regmap(hw);
+		if (ret)
+			return ret;
+		return wait_for_pll_enable_lock(pll);
+	}
+
+	/* Check if PLL is already enabled */
+	ret = trion_pll_is_enabled(pll, regmap);
+	if (ret < 0)
+		return ret;
+	else if (ret) {
+		pr_warn("%s PLL is already enabled\n", clk_hw_get_name(&pll->clkr.hw));
+		return 0;
+	}
+
+	ret = regmap_update_bits(regmap, PLL_MODE(pll), PLL_RESET_N, PLL_RESET_N);
+	if (ret)
+		return ret;
+
+	/* Set operation mode to RUN */
+	regmap_write(regmap, PLL_OPMODE(pll), PLL_RUN);
+
+	ret = wait_for_pll_enable_lock(pll);
+	if (ret)
+		return ret;
+
+	/* Enable the PLL outputs */
+	ret = regmap_update_bits(regmap, PLL_USER_CTL(pll), PLL_OUT_MASK, PLL_OUT_MASK);
+	if (ret)
+		return ret;
+
+	/* Enable the global PLL outputs */
+	ret = regmap_update_bits(regmap, PLL_MODE(pll), PLL_OUTCTRL, PLL_OUTCTRL);
+	if (ret)
+		return ret;
+
+	/* Ensure that the write above goes through before returning. */
+	mb();
+	return ret;
+}
+
+static void alpha_pll_lucid_evo_disable(struct clk_hw *hw)
+{
+	struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
+	struct regmap *regmap = pll->clkr.regmap;
+	u32 val;
+	int ret;
+
+	ret = regmap_read(regmap, PLL_USER_CTL(pll), &val);
+	if (ret)
+		return;
+
+	/* If in FSM mode, just unvote it */
+	if (val & LUCID_EVO_ENABLE_VOTE_RUN) {
+		clk_disable_regmap(hw);
+		return;
+	}
+
+	/* Disable the global PLL output */
+	ret = regmap_update_bits(regmap, PLL_MODE(pll), PLL_OUTCTRL, 0);
+	if (ret)
+		return;
+
+	/* Disable the PLL outputs */
+	ret = regmap_update_bits(regmap, PLL_USER_CTL(pll), PLL_OUT_MASK, 0);
+	if (ret)
+		return;
+
+	/* Place the PLL mode in STANDBY */
+	regmap_write(regmap, PLL_OPMODE(pll), PLL_STANDBY);
+}
+
+static unsigned long alpha_pll_lucid_evo_recalc_rate(struct clk_hw *hw,
+						     unsigned long parent_rate)
+{
+	struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
+	struct regmap *regmap = pll->clkr.regmap;
+	u32 l, frac;
+
+	regmap_read(regmap, PLL_L_VAL(pll), &l);
+	l &= LUCID_EVO_PLL_L_VAL_MASK;
+	regmap_read(regmap, PLL_ALPHA_VAL(pll), &frac);
+
+	return alpha_pll_calc_rate(parent_rate, l, frac, pll_alpha_width(pll));
+}
+
+static int clk_lucid_evo_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
+					      unsigned long parent_rate)
+{
+	return __clk_lucid_pll_postdiv_set_rate(hw, rate, parent_rate, LUCID_EVO_ENABLE_VOTE_RUN);
+}
+
+const struct clk_ops clk_alpha_pll_fixed_lucid_evo_ops = {
+	.enable = alpha_pll_lucid_evo_enable,
+	.disable = alpha_pll_lucid_evo_disable,
+	.is_enabled = clk_trion_pll_is_enabled,
+	.recalc_rate = alpha_pll_lucid_evo_recalc_rate,
+	.round_rate = clk_alpha_pll_round_rate,
+};
+EXPORT_SYMBOL_GPL(clk_alpha_pll_fixed_lucid_evo_ops);
+
+const struct clk_ops clk_alpha_pll_postdiv_lucid_evo_ops = {
+	.recalc_rate = clk_alpha_pll_postdiv_fabia_recalc_rate,
+	.round_rate = clk_alpha_pll_postdiv_fabia_round_rate,
+	.set_rate = clk_lucid_evo_pll_postdiv_set_rate,
+};
+EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_lucid_evo_ops);
drivers/clk/qcom/clk-alpha-pll.h +3 -0
index 55e4fa47912f..6e9907deaf30 100644
@@ -17,6 +17,7 @@ enum {
 	CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION,
 	CLK_ALPHA_PLL_TYPE_AGERA,
 	CLK_ALPHA_PLL_TYPE_ZONDA,
+	CLK_ALPHA_PLL_TYPE_LUCID_EVO,
 	CLK_ALPHA_PLL_TYPE_MAX,
 };
 
@@ -151,6 +152,8 @@ extern const struct clk_ops clk_alpha_pll_postdiv_lucid_5lpe_ops;
 
 extern const struct clk_ops clk_alpha_pll_zonda_ops;
 #define clk_alpha_pll_postdiv_zonda_ops clk_alpha_pll_postdiv_fabia_ops
+extern const struct clk_ops clk_alpha_pll_fixed_lucid_evo_ops;
+extern const struct clk_ops clk_alpha_pll_postdiv_lucid_evo_ops;
 
 void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
 			     const struct alpha_pll_config *config);
Signature · 1 line
2.33.1
maintainer
#3 lore raw

Re: [PATCH v6 2/5] clk: qcom: Add LUCID_EVO PLL type for SDX65

Quoting [email protected] (2021-12-01 16:21:32)

drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate, · line 1767

Quoted 13 lines
drivers/clk/qcom/clk-alpha-pll.c +5 -0
index eaedcceb766f..e0c67b76d8ac 100644
@@ -1741,35 +1760,47 @@ static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate,
                                          LUCID_5LPE_ALPHA_PLL_ACK_LATCH);
 }
 
+static int __clk_lucid_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
+                                            unsigned long parent_rate, unsigned long enable_vote_run)
+{
+        struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw);
+       struct regmap *regmap = pll->clkr.regmap;

What's going on with the tabbing here?

drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate, · line 1768

Quoted 1 line
drivers/clk/qcom/clk-alpha-pll.c +1 -0
+        int i, val = 0, div, ret;

Do we need to initialize to 0?

Quoted 5 lines
drivers/clk/qcom/clk-alpha-pll.c +5 -0
+        u32 mask;
+
+        /*
+         * If the PLL is in FSM mode, then treat set_rate callback as a
+         * no-operation.

drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate, · line 1783

Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c +10 -0
+         */
+        ret = regmap_read(regmap, PLL_USER_CTL(pll), &val);
+        if (ret)
+                return ret;
+
+        if (val & enable_vote_run)
+                return 0;
+
+        if (!pll->post_div_table) {
+                pr_err("Missing the post_div_table for the PLL\n");

Probably useful to know which PLL is missing a table here.

#4 lore raw

Re: [PATCH v6 2/5] clk: qcom: Add LUCID_EVO PLL type for SDX65

Quoted 9 lines · Stephen Boyd

Quoting [email protected] (2021-12-01 16:21:32)

Quoted 8 lines
drivers/clk/qcom/clk-alpha-pll.c +0 -0
index eaedcceb766f..e0c67b76d8ac 100644
@@ -1741,35 +1760,47 @@ static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate,
                                          LUCID_5LPE_ALPHA_PLL_ACK_LATCH);
 }
 
Quoted 7 lines

drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate, · line 1767

Quoted 5 lines
drivers/clk/qcom/clk-alpha-pll.c +5 -0
+static int __clk_lucid_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
+                                            unsigned long parent_rate, unsigned long enable_vote_run)
+{
+        struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw);
+       struct regmap *regmap = pll->clkr.regmap;

What's going on with the tabbing here?

Yes, actually i used a tab instead of space here. I will correct it.

Quoted 4 lines

drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate, · line 1768

Quoted 2 lines
drivers/clk/qcom/clk-alpha-pll.c +1 -0
+        int i, val = 0, div, ret;

Do we need to initialize to 0?

Not needed. Will remove.

Quoted 10 lines
Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c +9 -0
+        u32 mask;
+
+        /*
+         * If the PLL is in FSM mode, then treat set_rate callback as a
+         * no-operation.
+         */
+        ret = regmap_read(regmap, PLL_USER_CTL(pll), &val);
+        if (ret)
+                return ret;
Quoted 8 lines

drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate, · line 1783

Quoted 6 lines
drivers/clk/qcom/clk-alpha-pll.c +6 -0
+
+        if (val & enable_vote_run)
+                return 0;
+
+        if (!pll->post_div_table) {
+                pr_err("Missing the post_div_table for the PLL\n");

Probably useful to know which PLL is missing a table here.

I think that's a good idea on returning which PLL is missing a table.

Thanks,
Vamsi

#5 lore raw

PATCH v6 3/5 clk: qcom: Add SDX65 GCC support

In reply to [email protected]

From: Vamsi Krishna Lanka <[email protected]>

Add Global Clock Controller (GCC) support for SDX65 SoCs from Qualcomm.

---
 drivers/clk/qcom/Kconfig     |    8 +
 drivers/clk/qcom/Makefile    |    1 +
 drivers/clk/qcom/gcc-sdx65.c | 1603 ++++++++++++++++++++++++++++++++++
 3 files changed, 1612 insertions(+)
 create mode 100644 drivers/clk/qcom/gcc-sdx65.c
drivers/clk/qcom/Kconfig +8 -0
index 74efc82127e1..6cd0634cea41 100644
@@ -564,6 +564,14 @@ config SM_CAMCC_8250
 	  Support for the camera clock controller on SM8250 devices.
 	  Say Y if you want to support camera devices and camera functionality.
 
+config SDX_GCC_65
+	tristate "SDX65 Global Clock Controller"
+	select QCOM_GDSC
+	help
+	  Support for the global clock controller on SDX65 devices.
+	  Say Y if you want to use peripheral devices such as UART,
+	  SPI, I2C, USB, SD/UFS, PCIe etc.
+
 config SM_DISPCC_8250
 	tristate "SM8150 and SM8250 Display Clock Controller"
 	depends on SM_GCC_8150 || SM_GCC_8250
drivers/clk/qcom/Makefile +1 -0
index 1718c34d3551..3d855c14cc23 100644
@@ -83,6 +83,7 @@ obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o
 obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o
 obj-$(CONFIG_SDX_GCC_55) += gcc-sdx55.o
 obj-$(CONFIG_SM_CAMCC_8250) += camcc-sm8250.o
+obj-$(CONFIG_SDX_GCC_65) += gcc-sdx65.o
 obj-$(CONFIG_SM_DISPCC_8250) += dispcc-sm8250.o
 obj-$(CONFIG_SM_GCC_6115) += gcc-sm6115.o
 obj-$(CONFIG_SM_GCC_6125) += gcc-sm6125.o
drivers/clk/qcom/gcc-sdx65.c new file +1603 -0

1,603 lines not on this page · raw message

Signature · 1 line
2.33.1
maintainer
#6 lore raw

Re: [PATCH v6 3/5] clk: qcom: Add SDX65 GCC support

Quoting [email protected] (2021-12-01 16:21:33)

Quoted 11 lines
drivers/clk/qcom/gcc-sdx65.c new file +11 -0
+static struct clk_branch gcc_gp3_clk = {
+       .halt_reg = 0x39000,
+       .halt_check = BRANCH_HALT,
+       .clkr = {
+               .enable_reg = 0x39000,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_gp3_clk",
+                       .parent_data = &(const struct clk_parent_data){
+                               .hw = &gcc_gp3_clk_src.clkr.hw,
+                       },

drivers/clk/qcom/gcc-sdx65.c line 987

Quoted 10 lines
drivers/clk/qcom/gcc-sdx65.c new file +10 -0
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_pcie_0_clkref_en = {
+       .halt_reg = 0x88004,
+       /* The clock controller does not handle the status bit for

Please leave /* on it's own line for multiline comments.

drivers/clk/qcom/gcc-sdx65.c line 990

Quoted 3 lines
drivers/clk/qcom/gcc-sdx65.c new file +3 -0
+        * the clocks with gdscs(powerdomains) in hw controlled mode
+        * and hence avoid checking for the status bit of those clocks
+        * by setting the BRANCH_HALT_DELAY flag */

And */ too

Quoted 10 lines
drivers/clk/qcom/gcc-sdx65.c new file +10 -0
+       .halt_check = BRANCH_HALT_DELAY,
+       .clkr = {
+               .enable_reg = 0x88004,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_pcie_0_clkref_en",
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
#7 lore raw

Re: [PATCH v6 3/5] clk: qcom: Add SDX65 GCC support

Quoted 16 lines · Stephen Boyd

Quoting [email protected] (2021-12-01 16:21:33)

Quoted 15 lines
drivers/clk/qcom/gcc-sdx65.c new file +15 -0
+static struct clk_branch gcc_gp3_clk = {
+       .halt_reg = 0x39000,
+       .halt_check = BRANCH_HALT,
+       .clkr = {
+               .enable_reg = 0x39000,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_gp3_clk",
+                       .parent_data = &(const struct clk_parent_data){
+                               .hw = &gcc_gp3_clk_src.clkr.hw,
+                       },
+                       .num_parents = 1,
+                       .flags = CLK_SET_RATE_PARENT,
+                       .ops = &clk_branch2_ops,
+               },
Quoted 8 lines

drivers/clk/qcom/gcc-sdx65.c line 987

Quoted 6 lines
drivers/clk/qcom/gcc-sdx65.c new file +6 -0
+       },
+};
+
+static struct clk_branch gcc_pcie_0_clkref_en = {
+       .halt_reg = 0x88004,
+       /* The clock controller does not handle the status bit for

Please leave /* on it's own line for multiline comments.

Will do.

Quoted 6 lines

drivers/clk/qcom/gcc-sdx65.c line 990

Quoted 4 lines
drivers/clk/qcom/gcc-sdx65.c new file +3 -0
+        * the clocks with gdscs(powerdomains) in hw controlled mode
+        * and hence avoid checking for the status bit of those clocks
+        * by setting the BRANCH_HALT_DELAY flag */

And */ too

Will do.

Quoted 11 lines

drivers/clk/qcom/gcc-sdx65.c line 1000

Quoted 11 lines
drivers/clk/qcom/gcc-sdx65.c new file +10 -0
+       .halt_check = BRANCH_HALT_DELAY,
+       .clkr = {
+               .enable_reg = 0x88004,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_pcie_0_clkref_en",
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};

Thanks,
Vamsi

#8 lore raw

PATCH v6 4/5 dt-bindings: clock: Introduce RPMHCC bindings for SDX65

In reply to [email protected]

From: Vamsi krishna Lanka <[email protected]>

Add compatible for SDX65 RPMHCC.

---
 Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml +1 -0
index 72212970e6f5..0e7e05e38bb2 100644
@@ -22,6 +22,7 @@ properties:
       - qcom,sc8180x-rpmh-clk
       - qcom,sdm845-rpmh-clk
       - qcom,sdx55-rpmh-clk
+      - qcom,sdx65-rpmh-clk
       - qcom,sm6350-rpmh-clk
       - qcom,sm8150-rpmh-clk
       - qcom,sm8250-rpmh-clk
Signature · 1 line
2.33.1
#9 lore raw

Re: (subset) [PATCH v6 4/5] dt-bindings: clock: Introduce RPMHCC bindings for SDX65

Quoted 5 lines · On Wed, 1 Dec 2021 16:21:34 -0800, [email protected] wrote:

From: Vamsi krishna Lanka <[email protected]>

Add compatible for SDX65 RPMHCC.

Applied, thanks!

[4/5] dt-bindings: clock: Introduce RPMHCC bindings for SDX65

      commit: aa848c8ee8915b2a8c973d90f1c7f8e96d17fd25

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>
#10 lore raw

PATCH v6 5/5 clk: qcom: Add support for SDX65 RPMh clocks

In reply to [email protected]

From: Vamsi krishna Lanka <[email protected]>

Add support for clocks maintained by RPMh in SDX65 SoCs.

---
 drivers/clk/qcom/clk-rpmh.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/clk/qcom/clk-rpmh.c +25 -0
index 441d7a20e6f3..30b26fb96514 100644
@@ -556,6 +556,30 @@ static const struct clk_rpmh_desc clk_rpmh_sm6350 = {
 	.num_clks = ARRAY_SIZE(sm6350_rpmh_clocks),
 };
 
+DEFINE_CLK_RPMH_VRM(sdx65, ln_bb_clk1, ln_bb_clk1_ao, "lnbclka1", 4);
+
+static struct clk_hw *sdx65_rpmh_clocks[] = {
+	[RPMH_CXO_CLK]          = &sc7280_bi_tcxo.hw,
+	[RPMH_CXO_CLK_A]        = &sc7280_bi_tcxo_ao.hw,
+	[RPMH_LN_BB_CLK1]       = &sdx65_ln_bb_clk1.hw,
+	[RPMH_LN_BB_CLK1_A]     = &sdx65_ln_bb_clk1_ao.hw,
+	[RPMH_RF_CLK1]          = &sdm845_rf_clk1.hw,
+	[RPMH_RF_CLK1_A]        = &sdm845_rf_clk1_ao.hw,
+	[RPMH_RF_CLK2]          = &sdm845_rf_clk2.hw,
+	[RPMH_RF_CLK2_A]        = &sdm845_rf_clk2_ao.hw,
+	[RPMH_RF_CLK3]          = &sdm845_rf_clk3.hw,
+	[RPMH_RF_CLK3_A]        = &sdm845_rf_clk3_ao.hw,
+	[RPMH_RF_CLK4]          = &sm8350_rf_clk4.hw,
+	[RPMH_RF_CLK4_A]        = &sm8350_rf_clk4_ao.hw,
+	[RPMH_IPA_CLK]          = &sdm845_ipa.hw,
+	[RPMH_QPIC_CLK]         = &sdx55_qpic_clk.hw,
+};
+
+static const struct clk_rpmh_desc clk_rpmh_sdx65 = {
+	.clks = sdx65_rpmh_clocks,
+	.num_clks = ARRAY_SIZE(sdx65_rpmh_clocks),
+};
+
 static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec,
 					 void *data)
 {
@@ -643,6 +667,7 @@ static const struct of_device_id clk_rpmh_match_table[] = {
 	{ .compatible = "qcom,sc8180x-rpmh-clk", .data = &clk_rpmh_sc8180x},
 	{ .compatible = "qcom,sdm845-rpmh-clk", .data = &clk_rpmh_sdm845},
 	{ .compatible = "qcom,sdx55-rpmh-clk",  .data = &clk_rpmh_sdx55},
+	{ .compatible = "qcom,sdx65-rpmh-clk",  .data = &clk_rpmh_sdx65},
 	{ .compatible = "qcom,sm6350-rpmh-clk", .data = &clk_rpmh_sm6350},
 	{ .compatible = "qcom,sm8150-rpmh-clk", .data = &clk_rpmh_sm8150},
 	{ .compatible = "qcom,sm8250-rpmh-clk", .data = &clk_rpmh_sm8250},
Signature · 1 line
2.33.1
#11 lore raw

Re: [PATCH v6 5/5] clk: qcom: Add support for SDX65 RPMh clocks

Quoted 7 lines · On Wed 01 Dec 18:21 CST 2021, [email protected] wrote:

From: Vamsi krishna Lanka <[email protected]>

Add support for clocks maintained by RPMh in SDX65 SoCs.

The two RPMh patches are independent of the PLL/GCC patches, so I have picked up the RPMh patches from this series.

Please respin the PLL & GCC patches per Stephen's feedback.

PS. checkpatch --strict complains that the author signature doesn't match the Signed-off-by, because you have a lowercase 'k' in the From, but uppercase in the s-o-b. Can you please make sure the two matches in the future?

Thanks,
Bjorn

Quoted 50 lines
---
 drivers/clk/qcom/clk-rpmh.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/clk/qcom/clk-rpmh.c +25 -0
index 441d7a20e6f3..30b26fb96514 100644
@@ -556,6 +556,30 @@ static const struct clk_rpmh_desc clk_rpmh_sm6350 = {
 	.num_clks = ARRAY_SIZE(sm6350_rpmh_clocks),
 };
 
+DEFINE_CLK_RPMH_VRM(sdx65, ln_bb_clk1, ln_bb_clk1_ao, "lnbclka1", 4);
+
+static struct clk_hw *sdx65_rpmh_clocks[] = {
+	[RPMH_CXO_CLK]          = &sc7280_bi_tcxo.hw,
+	[RPMH_CXO_CLK_A]        = &sc7280_bi_tcxo_ao.hw,
+	[RPMH_LN_BB_CLK1]       = &sdx65_ln_bb_clk1.hw,
+	[RPMH_LN_BB_CLK1_A]     = &sdx65_ln_bb_clk1_ao.hw,
+	[RPMH_RF_CLK1]          = &sdm845_rf_clk1.hw,
+	[RPMH_RF_CLK1_A]        = &sdm845_rf_clk1_ao.hw,
+	[RPMH_RF_CLK2]          = &sdm845_rf_clk2.hw,
+	[RPMH_RF_CLK2_A]        = &sdm845_rf_clk2_ao.hw,
+	[RPMH_RF_CLK3]          = &sdm845_rf_clk3.hw,
+	[RPMH_RF_CLK3_A]        = &sdm845_rf_clk3_ao.hw,
+	[RPMH_RF_CLK4]          = &sm8350_rf_clk4.hw,
+	[RPMH_RF_CLK4_A]        = &sm8350_rf_clk4_ao.hw,
+	[RPMH_IPA_CLK]          = &sdm845_ipa.hw,
+	[RPMH_QPIC_CLK]         = &sdx55_qpic_clk.hw,
+};
+
+static const struct clk_rpmh_desc clk_rpmh_sdx65 = {
+	.clks = sdx65_rpmh_clocks,
+	.num_clks = ARRAY_SIZE(sdx65_rpmh_clocks),
+};
+
 static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec,
 					 void *data)
 {
@@ -643,6 +667,7 @@ static const struct of_device_id clk_rpmh_match_table[] = {
 	{ .compatible = "qcom,sc8180x-rpmh-clk", .data = &clk_rpmh_sc8180x},
 	{ .compatible = "qcom,sdm845-rpmh-clk", .data = &clk_rpmh_sdm845},
 	{ .compatible = "qcom,sdx55-rpmh-clk",  .data = &clk_rpmh_sdx55},
+	{ .compatible = "qcom,sdx65-rpmh-clk",  .data = &clk_rpmh_sdx65},
 	{ .compatible = "qcom,sm6350-rpmh-clk", .data = &clk_rpmh_sm6350},
 	{ .compatible = "qcom,sm8150-rpmh-clk", .data = &clk_rpmh_sm8150},
 	{ .compatible = "qcom,sm8250-rpmh-clk", .data = &clk_rpmh_sm8250},
Signature · 1 line
2.33.1
#12 lore raw

Re: (subset) [PATCH v6 5/5] clk: qcom: Add support for SDX65 RPMh clocks

In reply to [email protected]
Quoted 5 lines · On Wed, 1 Dec 2021 16:21:35 -0800, [email protected] wrote:

From: Vamsi krishna Lanka <[email protected]>

Add support for clocks maintained by RPMh in SDX65 SoCs.

Applied, thanks!

[5/5] clk: qcom: Add support for SDX65 RPMh clocks

      commit: 40affbf8e615addd8cc877f0a4fff1faafc4bb34

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>
#13 lore raw

Re: (subset) [PATCH v6 0/5] Add GCC and RPMh clock support for SDX65

In reply to [email protected]
Quoted 8 lines · On Wed, 1 Dec 2021 16:21:30 -0800, [email protected] wrote:

From: Vamsi Krishna Lanka <[email protected]>

Hello,
Changes from v5:
- Collected Vinod Koul's and Rob's Reviewed-by for the patches
- Rebased on the latest tip of Torvald's tree (MAINTAINERS: co-maintain random.c)

[...]

Applied, thanks!

[4/5] dt-bindings: clock: Introduce RPMHCC bindings for SDX65

      commit: aa848c8ee8915b2a8c973d90f1c7f8e96d17fd25
[5/5] clk: qcom: Add support for SDX65 RPMh clocks
      commit: 40affbf8e615addd8cc877f0a4fff1faafc4bb34

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>