Skip to contentSkip to conversation

clk: qcom: Add support for SM8550

PATCH Applied Abel Vesa 3 participants 10 messages Jan 4, 2023 – Jan 6, 2023

Subsystems (4)

v8 of 9 Applied Latest is v9 →

lore
Share & tools
lore

Abel Vesa

author
#0 lore raw

v8 cover clk: qcom: Add support for SM8550

This patchset adds more clocks support for the Qualcomm SM8550 SoC, It adds the TCSR clock controller driver and the rpmh clocks.

Changes since v7:
* Replaced RPMH_CXO_PAD_CLK with RPMH_CXO_CLK in the TCSR CC binding schema example

To: Andy Gross <[email protected]>
To: Bjorn Andersson <[email protected]>
To: Konrad Dybcio <[email protected]>
To: Michael Turquette <[email protected]>
To: Stephen Boyd <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Abel Vesa (4):
dt-bindings: clock: Add SM8550 TCSR CC clocks
dt-bindings: clock: Add RPMHCC for SM8550
clk: qcom: rpmh: Add support for SM8550 rpmh clocks
clk: qcom: Add TCSR clock driver for SM8550

 .../bindings/clock/qcom,rpmhcc.yaml           |   1 +
 .../bindings/clock/qcom,sm8550-tcsr.yaml      |  55 +++++
 drivers/clk/qcom/Kconfig                      |   7 +
 drivers/clk/qcom/Makefile                     |   1 +
 drivers/clk/qcom/clk-rpmh.c                   |  36 ++++
 drivers/clk/qcom/tcsrcc-sm8550.c              | 192 ++++++++++++++++++
 include/dt-bindings/clock/qcom,sm8550-tcsr.h  |  18 ++
 7 files changed, 310 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sm8550-tcsr.yaml
 create mode 100644 drivers/clk/qcom/tcsrcc-sm8550.c
 create mode 100644 include/dt-bindings/clock/qcom,sm8550-tcsr.h
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v8 1/4 dt-bindings: clock: Add SM8550 TCSR CC clocks

Add bindings documentation for clock TCSR driver on SM8550.

---
 .../bindings/clock/qcom,sm8550-tcsr.yaml      | 55 +++++++++++++++++++
 include/dt-bindings/clock/qcom,sm8550-tcsr.h  | 18 ++++++
 2 files changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sm8550-tcsr.yaml
 create mode 100644 include/dt-bindings/clock/qcom,sm8550-tcsr.h
Documentation/devicetree/bindings/clock/qcom,sm8550-tcsr.yaml new file +55 -0
new file mode 100644
index 000000000000..1bf1a41fd89c
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,sm8550-tcsr.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm TCSR Clock Controller on SM8550
+
+maintainers:
+  - Bjorn Andersson <[email protected]>
+
+description: |
+  Qualcomm TCSR clock control module provides the clocks, resets and
+  power domains on SM8550
+
+  See also:: include/dt-bindings/clock/qcom,sm8550-tcsr.h
+
+properties:
+  compatible:
+    items:
+      - const: qcom,sm8550-tcsr
+      - const: syscon
+
+  clocks:
+    items:
+      - description: TCXO pad clock
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+  '#reset-cells':
+    const: 1
+
+required:
+  - compatible
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+
+    clock-controller@1fc0000 {
+      compatible = "qcom,sm8550-tcsr", "syscon";
+      reg = <0x1fc0000 0x30000>;
+      clocks = <&rpmhcc RPMH_CXO_CLK>;
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+    };
+
+...
include/dt-bindings/clock/qcom,sm8550-tcsr.h new file +18 -0
new file mode 100644
index 000000000000..091cb76f953a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright (c) 2022, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022, Linaro Limited
+ */
+
+#ifndef _DT_BINDINGS_CLK_QCOM_TCSR_CC_SM8550_H
+#define _DT_BINDINGS_CLK_QCOM_TCSR_CC_SM8550_H
+
+/* TCSR CC clocks */
+#define TCSR_PCIE_0_CLKREF_EN					0
+#define TCSR_PCIE_1_CLKREF_EN					1
+#define TCSR_UFS_CLKREF_EN					2
+#define TCSR_UFS_PAD_CLKREF_EN					3
+#define TCSR_USB2_CLKREF_EN					4
+#define TCSR_USB3_CLKREF_EN					5
+
+#endif
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v8 2/4 dt-bindings: clock: Add RPMHCC for SM8550

In reply to Abel Vesa

Add bindings and update documentation for clock rpmh driver on SM8550.

---
 Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml +1 -0
index cf25ba0419e2..6d7d699aaff9 100644
@@ -31,6 +31,7 @@ properties:
       - qcom,sm8250-rpmh-clk
       - qcom,sm8350-rpmh-clk
       - qcom,sm8450-rpmh-clk
+      - qcom,sm8550-rpmh-clk
 
   clocks:
     maxItems: 1
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v8 3/4 clk: qcom: rpmh: Add support for SM8550 rpmh clocks

In reply to Abel Vesa

Adds the RPMH clocks present in SM8550 SoC.

---
 drivers/clk/qcom/clk-rpmh.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
drivers/clk/qcom/clk-rpmh.c +36 -0
index 586a810c682c..7db5a53d73f0 100644
@@ -366,6 +366,16 @@ DEFINE_CLK_RPMH_VRM(rf_clk2, _d, "rfclkd2", 1);
 DEFINE_CLK_RPMH_VRM(rf_clk3, _d, "rfclkd3", 1);
 DEFINE_CLK_RPMH_VRM(rf_clk4, _d, "rfclkd4", 1);
 
+DEFINE_CLK_RPMH_VRM(clk1, _a1, "clka1", 1);
+DEFINE_CLK_RPMH_VRM(clk2, _a1, "clka2", 1);
+DEFINE_CLK_RPMH_VRM(clk3, _a1, "clka3", 1);
+DEFINE_CLK_RPMH_VRM(clk4, _a1, "clka4", 1);
+DEFINE_CLK_RPMH_VRM(clk5, _a1, "clka5", 1);
+
+DEFINE_CLK_RPMH_VRM(clk6, _a2, "clka6", 2);
+DEFINE_CLK_RPMH_VRM(clk7, _a2, "clka7", 2);
+DEFINE_CLK_RPMH_VRM(clk8, _a2, "clka8", 2);
+
 DEFINE_CLK_RPMH_VRM(div_clk1, _div2, "divclka1", 2);
 
 DEFINE_CLK_RPMH_BCM(ce, "CE0");
@@ -576,6 +586,31 @@ static const struct clk_rpmh_desc clk_rpmh_sm8450 = {
 	.num_clks = ARRAY_SIZE(sm8450_rpmh_clocks),
 };
 
+static struct clk_hw *sm8550_rpmh_clocks[] = {
+	[RPMH_CXO_CLK]		= &clk_rpmh_bi_tcxo_div2.hw,
+	[RPMH_CXO_CLK_A]	= &clk_rpmh_bi_tcxo_div2_ao.hw,
+	[RPMH_LN_BB_CLK1]	= &clk_rpmh_clk6_a2.hw,
+	[RPMH_LN_BB_CLK1_A]	= &clk_rpmh_clk6_a2_ao.hw,
+	[RPMH_LN_BB_CLK2]	= &clk_rpmh_clk7_a2.hw,
+	[RPMH_LN_BB_CLK2_A]	= &clk_rpmh_clk7_a2_ao.hw,
+	[RPMH_LN_BB_CLK3]	= &clk_rpmh_clk8_a2.hw,
+	[RPMH_LN_BB_CLK3_A]	= &clk_rpmh_clk8_a2_ao.hw,
+	[RPMH_RF_CLK1]		= &clk_rpmh_clk1_a1.hw,
+	[RPMH_RF_CLK1_A]	= &clk_rpmh_clk1_a1_ao.hw,
+	[RPMH_RF_CLK2]		= &clk_rpmh_clk2_a1.hw,
+	[RPMH_RF_CLK2_A]	= &clk_rpmh_clk2_a1_ao.hw,
+	[RPMH_RF_CLK3]		= &clk_rpmh_clk3_a1.hw,
+	[RPMH_RF_CLK3_A]	= &clk_rpmh_clk3_a1_ao.hw,
+	[RPMH_RF_CLK4]		= &clk_rpmh_clk4_a1.hw,
+	[RPMH_RF_CLK4_A]	= &clk_rpmh_clk4_a1_ao.hw,
+	[RPMH_IPA_CLK]		= &clk_rpmh_ipa.hw,
+};
+
+static const struct clk_rpmh_desc clk_rpmh_sm8550 = {
+	.clks = sm8550_rpmh_clocks,
+	.num_clks = ARRAY_SIZE(sm8550_rpmh_clocks),
+};
+
 static struct clk_hw *sc7280_rpmh_clocks[] = {
 	[RPMH_CXO_CLK]      = &clk_rpmh_bi_tcxo_div4.hw,
 	[RPMH_CXO_CLK_A]    = &clk_rpmh_bi_tcxo_div4_ao.hw,
@@ -742,6 +777,7 @@ static const struct of_device_id clk_rpmh_match_table[] = {
 	{ .compatible = "qcom,sm8250-rpmh-clk", .data = &clk_rpmh_sm8250},
 	{ .compatible = "qcom,sm8350-rpmh-clk", .data = &clk_rpmh_sm8350},
 	{ .compatible = "qcom,sm8450-rpmh-clk", .data = &clk_rpmh_sm8450},
+	{ .compatible = "qcom,sm8550-rpmh-clk", .data = &clk_rpmh_sm8550},
 	{ .compatible = "qcom,sc7280-rpmh-clk", .data = &clk_rpmh_sc7280},
 	{ }
 };
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v8 3/4] clk: qcom: rpmh: Add support for SM8550 rpmh clocks

Quoted 7 lines · Abel Vesa

Adds the RPMH clocks present in SM8550 SoC.

---
  drivers/clk/qcom/clk-rpmh.c | 36 ++++++++++++++++++++++++++++++++++++
  1 file changed, 36 insertions(+)

I think the plan was to have the _PAD clock as a child node of the rpmcc. Is it still the planned implementation?

Signature · 2 lines
With best wishes
Dmitry
author
#5 lore raw

Re: [PATCH v8 3/4] clk: qcom: rpmh: Add support for SM8550 rpmh clocks

Quoted 11 lines · Dmitry Baryshkov
Quoted 7 lines · Abel Vesa

Adds the RPMH clocks present in SM8550 SoC.

---
  drivers/clk/qcom/clk-rpmh.c | 36 ++++++++++++++++++++++++++++++++++++
  1 file changed, 36 insertions(+)

I think the plan was to have the _PAD clock as a child node of the rpmcc. Is it still the planned implementation?

Yes. Here is how the dts rpmhcc node will look like:

         rpmhcc: clock-controller {
                 compatible = "qcom,sm8550-rpmh-clk";
                 #clock-cells = <1>;
                 clock-names = "xo";
                 clocks = <&xo_board>;

                 bi_tcxo_div2: bi-tcxo-div2-clk {
                         #clock-cells = <0>;
                         compatible = "fixed-factor-clock";
                         clocks = <&rpmhcc RPMH_CXO_CLK>;
                         clock-mult = <1>;
                         clock-div = <2>;
                 };

                 bi_tcxo_ao_div2: bi-tcxo-div2-ao-clk {
                         #clock-cells = <0>;
                         compatible = "fixed-factor-clock";
                         clocks = <&rpmhcc RPMH_CXO_CLK_A>;
                         clock-mult = <1>;
                         clock-div = <2>;
                 };
         };

The clock nodes will be probed on of_clk_init.

Quoted 5 lines
Signature · 3 lines
-- 
With best wishes
Dmitry
#6 lore raw

Re: [PATCH v8 3/4] clk: qcom: rpmh: Add support for SM8550 rpmh clocks

Quoted 29 lines · Abel Vesa
Quoted 11 lines · Dmitry Baryshkov
Quoted 7 lines · Abel Vesa

Adds the RPMH clocks present in SM8550 SoC.

---
   drivers/clk/qcom/clk-rpmh.c | 36 ++++++++++++++++++++++++++++++++++++
   1 file changed, 36 insertions(+)

I think the plan was to have the _PAD clock as a child node of the rpmcc. Is it still the planned implementation?

Yes. Here is how the dts rpmhcc node will look like:

          rpmhcc: clock-controller {
                  compatible = "qcom,sm8550-rpmh-clk";
                  #clock-cells = <1>;
                  clock-names = "xo";
                  clocks = <&xo_board>;

                  bi_tcxo_div2: bi-tcxo-div2-clk {
                          #clock-cells = <0>;
                          compatible = "fixed-factor-clock";
                          clocks = <&rpmhcc RPMH_CXO_CLK>;
                          clock-mult = <1>;
                          clock-div = <2>;
                  };
Quoted 8 lines
                  bi_tcxo_ao_div2: bi-tcxo-div2-ao-clk {
                          #clock-cells = <0>;
                          compatible = "fixed-factor-clock";
                          clocks = <&rpmhcc RPMH_CXO_CLK_A>;
                          clock-mult = <1>;
                          clock-div = <2>;
                  };
          };

Does this snippet pass bindings validation?

Quoted 2 lines

The clock nodes will be probed on of_clk_init.

Ah, I see. of_clk_init() will initialize clocks even if the parent device is not fully probed. Thank you for the explanation!

Signature · 2 lines
With best wishes
Dmitry
maintainer
#7 lore raw

Re: [PATCH v8 3/4] clk: qcom: rpmh: Add support for SM8550 rpmh clocks

In reply to Abel Vesa
Quoted 15 lines · Abel Vesa
Quoted 11 lines · Dmitry Baryshkov
Quoted 7 lines · Abel Vesa

Adds the RPMH clocks present in SM8550 SoC.

---
  drivers/clk/qcom/clk-rpmh.c | 36 ++++++++++++++++++++++++++++++++++++
  1 file changed, 36 insertions(+)

I think the plan was to have the _PAD clock as a child node of the rpmcc. Is it still the planned implementation?

Yes. Here is how the dts rpmhcc node will look like:

Quoted 7 lines
         rpmhcc: clock-controller {
                 compatible = "qcom,sm8550-rpmh-clk";
                 #clock-cells = <1>;
                 clock-names = "xo";
                 clocks = <&xo_board>;

                 bi_tcxo_div2: bi-tcxo-div2-clk {

Considering that the remainder of the clock exposed (except ipa clock) by the rpmhcc provider represent clock signals coming out of the pmic; and that this divider is not located in the aoss (rsc), I don't think these nodes should live here.

/clocks seems perfectly fine to me.

Regards,
Bjorn

Quoted 23 lines
                         #clock-cells = <0>;
                         compatible = "fixed-factor-clock";
                         clocks = <&rpmhcc RPMH_CXO_CLK>;
                         clock-mult = <1>;
                         clock-div = <2>;
                 };

                 bi_tcxo_ao_div2: bi-tcxo-div2-ao-clk {
                         #clock-cells = <0>;
                         compatible = "fixed-factor-clock";
                         clocks = <&rpmhcc RPMH_CXO_CLK_A>;
                         clock-mult = <1>;
                         clock-div = <2>;
                 };
         };

The clock nodes will be probed on of_clk_init.

Quoted 5 lines
Signature · 3 lines
-- 
With best wishes
Dmitry
author
#8 lore raw

PATCH v8 4/4 clk: qcom: Add TCSR clock driver for SM8550

In reply to Abel Vesa

The TCSR clock controller found on SM8550 provides refclks for PCIE, USB and UFS. Add clock driver for it.

This patch is based on initial code downstream.

---
 drivers/clk/qcom/Kconfig         |   7 ++
 drivers/clk/qcom/Makefile        |   1 +
 drivers/clk/qcom/tcsrcc-sm8550.c | 192 +++++++++++++++++++++++++++++++
 3 files changed, 200 insertions(+)
 create mode 100644 drivers/clk/qcom/tcsrcc-sm8550.c
drivers/clk/qcom/Kconfig +7 -0
index 70d43f0a8919..b9f5505d68f0 100644
@@ -797,6 +797,13 @@ config SM_GPUCC_8350
 	  Say Y if you want to support graphics controller devices and
 	  functionality such as 3D graphics.
 
+config SM_TCSRCC_8550
+	tristate "SM8550 TCSR Clock Controller"
+	select QCOM_GDSC
+	help
+	  Support for the TCSR clock controller on SM8550 devices.
+	  Say Y if you want to use peripheral devices such as SD/UFS.
+
 config SM_VIDEOCC_8150
 	tristate "SM8150 Video Clock Controller"
 	select SM_GCC_8150
drivers/clk/qcom/Makefile +1 -0
index f18c446a97ea..f5ce429c724c 100644
@@ -112,6 +112,7 @@ obj-$(CONFIG_SM_GPUCC_6350) += gpucc-sm6350.o
 obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o
 obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o
 obj-$(CONFIG_SM_GPUCC_8350) += gpucc-sm8350.o
+obj-$(CONFIG_SM_TCSRCC_8550) += tcsrcc-sm8550.o
 obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o
 obj-$(CONFIG_SM_VIDEOCC_8250) += videocc-sm8250.o
 obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
drivers/clk/qcom/tcsrcc-sm8550.c new file +192 -0

192 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer Applied
#9 lore raw
In reply to Abel Vesa
Quoted 8 lines · Abel Vesa

This patchset adds more clocks support for the Qualcomm SM8550 SoC, It adds the TCSR clock controller driver and the rpmh clocks.

Changes since v7:
* Replaced RPMH_CXO_PAD_CLK with RPMH_CXO_CLK in the TCSR CC binding schema example

[...]

Applied, thanks!

[1/4] dt-bindings: clock: Add SM8550 TCSR CC clocks

      commit: d8aa375bd70681b76c6bd5fe93bab6011e16a0fb
[2/4] dt-bindings: clock: Add RPMHCC for SM8550
      commit: ffcdd6907e9a1fdccd9350147d0f59cafb87e768
[3/4] clk: qcom: rpmh: Add support for SM8550 rpmh clocks
      commit: 478a573be730dd704ab6acee43f40d91fe8c808a
[4/4] clk: qcom: Add TCSR clock driver for SM8550
      commit: e9a7b78b20889d2325bef4a1eb39c1088858ab81

Best regards,

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