Skip to contentSkip to conversation

clk: qcom: Introduce clocks drivers for X1E80100

PATCH In review Sibi Sankar 3 participants 12 messages Nov 17, 2023 – Nov 20, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover clk: qcom: Introduce clocks drivers for X1E80100

This series adds initial clock support for the Qualcomm X1E80100 platform, aka Snapdragon X Elite.

Our v1 post of the patchsets adding support for Snapdragon X Elite SoC had the part number sc8380xp which is now updated to the new part number x1e80100 based on the new branding scheme and refers to the exact same SoC.

v2:
* Update the part number from sc8380xp to x1e80100.
* Use shared ops in the x1e80100 gcc driver [Bryan].
* Inline clock names [Konrad]
* Fix Kconfig [Krzysztof]
* Pick-up Rbs from the list.

Dependencies: None
Release Link: https://www.qualcomm.com/news/releases/2023/10/qualcomm-unleashes-snapdragon-x-elite--the-ai-super-charged-plat

Rajendra Nayak (4):
dt-bindings: clock: qcom: Add X1E80100 GCC clocks
clk: qcom: Add Global Clock controller (GCC) driver for X1E80100
dt-bindings: clock: qcom-rpmhcc: Add RPMHCC bindings for X1E80100
clk: qcom: rpmh: Add support for X1E80100 rpmh clocks

 .../bindings/clock/qcom,rpmhcc.yaml           |    1 +
 .../bindings/clock/qcom,x1e80100-gcc.yaml     |   72 +
 drivers/clk/qcom/Kconfig                      |   10 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/clk-rpmh.c                   |   26 +
 drivers/clk/qcom/gcc-x1e80100.c               | 6807 +++++++++++++++++
 include/dt-bindings/clock/qcom,x1e80100-gcc.h |  485 ++
 7 files changed, 7402 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,x1e80100-gcc.yaml
 create mode 100644 drivers/clk/qcom/gcc-x1e80100.c
 create mode 100644 include/dt-bindings/clock/qcom,x1e80100-gcc.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/4 dt-bindings: clock: qcom: Add X1E80100 GCC clocks

From: Rajendra Nayak <[email protected]>

Add device tree bindings for global clock controller on X1E80100 SoCs.

---

v2:
* Update the part number from sc8380xp to x1e80100.
* Pick-up Rbs from the list.

 .../bindings/clock/qcom,x1e80100-gcc.yaml     |  72 +++
 include/dt-bindings/clock/qcom,x1e80100-gcc.h | 485 ++++++++++++++++++
 2 files changed, 557 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,x1e80100-gcc.yaml
 create mode 100644 include/dt-bindings/clock/qcom,x1e80100-gcc.h
Documentation/devicetree/bindings/clock/qcom,x1e80100-gcc.yaml new file +72 -0
new file mode 100644
index 000000000000..14a796dbf8bc
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,x1e80100-gcc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Global Clock & Reset Controller on X1E80100
+
+maintainers:
+  - Rajendra Nayak <[email protected]>
+
+description: |
+  Qualcomm global clock control module provides the clocks, resets and power
+  domains on X1E80100
+
+  See also:: include/dt-bindings/clock/qcom,x1e80100-gcc.h
+
+properties:
+  compatible:
+    const: qcom,x1e80100-gcc
+
+  clocks:
+    items:
+      - description: Board XO source
+      - description: Sleep clock source
+      - description: PCIe 3 pipe clock
+      - description: PCIe 4 pipe clock
+      - description: PCIe 5 pipe clock
+      - description: PCIe 6a pipe clock
+      - description: PCIe 6b pipe clock
+      - description: USB QMP Phy 0 clock source
+      - description: USB QMP Phy 1 clock source
+      - description: USB QMP Phy 2 clock source
+
+  power-domains:
+    description:
+      A phandle and PM domain specifier for the CX power domain.
+    maxItems: 1
+
+required:
+  - compatible
+  - clocks
+  - power-domains
+
+allOf:
+  - $ref: qcom,gcc.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/power/qcom,rpmhpd.h>
+    clock-controller@100000 {
+      compatible = "qcom,x1e80100-gcc";
+      reg = <0x00100000 0x200000>;
+      clocks = <&bi_tcxo_div2>,
+               <&sleep_clk>,
+               <&pcie3_phy>,
+               <&pcie4_phy>,
+               <&pcie5_phy>,
+               <&pcie6a_phy>,
+               <&pcie6b_phy>,
+               <&usb_1_ss0_qmpphy 0>,
+               <&usb_1_ss1_qmpphy 1>,
+               <&usb_1_ss2_qmpphy 2>;
+      power-domains = <&rpmhpd RPMHPD_CX>;
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+
+...
include/dt-bindings/clock/qcom,x1e80100-gcc.h new file +485 -0

485 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/4 clk: qcom: Add Global Clock controller (GCC) driver for X1E80100

In reply to Sibi Sankar

From: Rajendra Nayak <[email protected]>

Add support for the global clock controller found on X1E80100 based devices.

---

v2:
* Update the part number from sc8380xp to x1e80100.
* Use shared ops in the x1e80100 gcc driver [Bryan].
* Inline clock names [Konrad]
* Fix Kconfig [Krzysztof]

 drivers/clk/qcom/Kconfig        |   10 +
 drivers/clk/qcom/Makefile       |    1 +
 drivers/clk/qcom/gcc-x1e80100.c | 6807 +++++++++++++++++++++++++++++++
 3 files changed, 6818 insertions(+)
 create mode 100644 drivers/clk/qcom/gcc-x1e80100.c
drivers/clk/qcom/Kconfig +10 -0
index ad1acd9b7426..e01a44202d53 100644
@@ -1116,4 +1116,14 @@ config SM_VIDEOCC_8450
 	  SM8450 devices.
 	  Say Y if you want to support video devices and functionality such as
 	  video encode/decode.
+
+config X1E_GCC_80100
+	tristate "X1E80100 Global Clock Controller"
+	depends on ARM64 || COMPILE_TEST
+	select QCOM_GDSC
+	help
+	  Support for the global clock controller on Qualcomm Technologies, Inc
+	  X1E80100 devices.
+	  Say Y if you want to use peripheral devices such as UART, SPI, I2C,
+	  USB, UFS, SD/eMMC, PCIe, etc.
 endif
drivers/clk/qcom/Makefile +1 -0
index 17edd73f9839..83309afd8904 100644
@@ -140,3 +140,4 @@ obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
 obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
 obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
 obj-$(CONFIG_KRAITCC) += krait-cc.o
+obj-$(CONFIG_X1E_GCC_80100) += gcc-x1e80100.o
drivers/clk/qcom/gcc-x1e80100.c new file +6807 -0

2,982 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#3 lore raw

Re: [PATCH V2 2/4] clk: qcom: Add Global Clock controller (GCC) driver for X1E80100

Quoted 1 line · Sibi Sankar

* Use shared ops in the x1e80100 gcc driver [Bryan].

This looks better to me now / more consistent with what we have in sc8280xp - where we do try to hit suspend and => retention/parking matters.

Could you give a bit more detail on why SDCC* doesn't warrant parking on X1E80100 as on SC8280XP though ?

---
bod

#4 lore raw

Re: [PATCH V2 2/4] clk: qcom: Add Global Clock controller (GCC) driver for X1E80100

Quoted 4 lines · Bryan O'Donoghue
Quoted 1 line · Sibi Sankar

* Use shared ops in the x1e80100 gcc driver [Bryan].

This looks better to me now / more consistent with what we have in sc8280xp - where we do try to hit suspend and => retention/parking matters.

Parking the clock is separate from putting the system to sleep.

IIUC we usually use shared ops on clocks that may have different users (e.g. not only controlled by Linux) and/or that are crucial to the functioning of hardware (like AXI clocks, which if gated would make the system crash on any access attempt, from any subsystem, unless turned on beforehand)

Perhaps Dmitry can use some clearer wording than me..

Konrad

#5 lore raw

Re: [PATCH V2 2/4] clk: qcom: Add Global Clock controller (GCC) driver for X1E80100

Quoted 6 lines · Konrad Dybcio
Quoted 4 lines · Bryan O'Donoghue
Quoted 1 line · Sibi Sankar

* Use shared ops in the x1e80100 gcc driver [Bryan].

This looks better to me now / more consistent with what we have in sc8280xp - where we do try to hit suspend and => retention/parking matters.

Parking the clock is separate from putting the system to sleep.

Yes but several of our clocks want to be parked, not switched off.. which obviously does matter in suspend.

Quoted 5 lines

IIUC we usually use shared ops on clocks that may have different users (e.g. not only controlled by Linux) and/or that are crucial to the functioning of hardware (like AXI clocks, which if gated would make the system crash on any access attempt, from any subsystem, unless turned on beforehand)

My question here for Sibi, is why sdcc2_apss_clk_src differs here from sc8280xp?

Is it wrong on sc8280xp or if correct sc8280xp then why is it not replicated here ?

https://lore.kernel.org/linux-arm-msm/[email protected]/

Also @Sibi I realise alot of this code is autogenerated - it would be worthwhile finding/fixing the script that does the generation to plug in shared_ops instead of floor_ops if the input material has the necessary flags.

---
bod

#6 lore raw

Re: [PATCH V2 2/4] clk: qcom: Add Global Clock controller (GCC) driver for X1E80100

Quoted 16 lines · Bryan O'Donoghue
Quoted 6 lines · Konrad Dybcio
Quoted 4 lines · Bryan O'Donoghue
Quoted 1 line · Sibi Sankar

* Use shared ops in the x1e80100 gcc driver [Bryan].

This looks better to me now / more consistent with what we have in sc8280xp - where we do try to hit suspend and => retention/parking matters.

Parking the clock is separate from putting the system to sleep.

Yes but several of our clocks want to be parked, not switched off.. which obviously does matter in suspend.

Quoted 5 lines

IIUC we usually use shared ops on clocks that may have different users (e.g. not only controlled by Linux) and/or that are crucial to the functioning of hardware (like AXI clocks, which if gated would make the system crash on any access attempt, from any subsystem, unless turned on beforehand)

Quoted 5 lines

My question here for Sibi, is why sdcc2_apss_clk_src differs here from sc8280xp?

Is it wrong on sc8280xp or if correct sc8280xp then why is it not replicated here ?

https://lore.kernel.org/linux-arm-msm/[email protected]/

Bryan,

5e4b7e82d497 ("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks")

The floor_ops was introduced in sdm845 ^^ and later propagated to all other QC SoCs later on. It makes sense to do the same for sc8280xp as well.

Quoted 2 lines

Also @Sibi I realise alot of this code is autogenerated - it would be worthwhile finding/fixing the script that does the generation to plug in shared_ops instead of floor_ops if the input material has the necessary flags.

floor_ops part isn't auto-generated (it comes out as shared_ops, but like you said it might make sense to include it as part of the generation process itself.

-Sibi

Quoted 3 lines

---
bod

#7 lore raw

Re: [PATCH V2 2/4] clk: qcom: Add Global Clock controller (GCC) driver for X1E80100

Quoted 7 lines · Sibi Sankar

Bryan,

5e4b7e82d497 ("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks")

The floor_ops was introduced in sdm845 ^^ and later propagated to all other QC SoCs later on. It makes sense to do the same for sc8280xp as well.

OK good enough.

Reviewed-by on v2 2/4
#8 lore raw

Re: [PATCH V2 2/4] clk: qcom: Add Global Clock controller (GCC) driver for X1E80100

In reply to Sibi Sankar
Quoted 11 lines · Sibi Sankar

From: Rajendra Nayak <[email protected]>

Add support for the global clock controller found on X1E80100 based devices.

---

Konrad

Reviewed-by on v2 2/4
#9 lore raw

Re: [PATCH V2 2/4] clk: qcom: Add Global Clock controller (GCC) driver for X1E80100

In reply to Sibi Sankar
Quoted 11 lines · Sibi Sankar

From: Rajendra Nayak <[email protected]>

Add support for the global clock controller found on X1E80100 based devices.

---

#10 lore raw

PATCH v2 3/4 dt-bindings: clock: qcom-rpmhcc: Add RPMHCC bindings for X1E80100

In reply to Sibi Sankar

From: Rajendra Nayak <[email protected]>

Add bindings and update documentation for clock rpmh driver on X1E80100 SoCs.

---

v2:
* Update the part number from sc8380xp to x1e80100.
* Pick-up Rbs from the list.

 Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml +1 -0
index 4eb5e59f6772..603da187d62e 100644
@@ -35,6 +35,7 @@ properties:
       - qcom,sm8350-rpmh-clk
       - qcom,sm8450-rpmh-clk
       - qcom,sm8550-rpmh-clk
+      - qcom,x1e80100-rpmh-clk
 
   clocks:
     maxItems: 1
Signature · 1 line
2.17.1
#11 lore raw

PATCH v2 4/4 clk: qcom: rpmh: Add support for X1E80100 rpmh clocks

In reply to Sibi Sankar

From: Rajendra Nayak <[email protected]>

Adds the RPMH clocks present in X1E80100 SoC

---

v2:
* Update the part number from sc8380xp to x1e80100.
* Pick-up Rbs from the list.

 drivers/clk/qcom/clk-rpmh.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/clk/qcom/clk-rpmh.c +26 -0
index 5d853fd43294..ce6f4363d2f7 100644
@@ -372,6 +372,9 @@ 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(clk3, _a2, "clka3", 2);
+DEFINE_CLK_RPMH_VRM(clk4, _a2, "clka4", 2);
+DEFINE_CLK_RPMH_VRM(clk5, _a2, "clka5", 2);
 DEFINE_CLK_RPMH_VRM(clk6, _a2, "clka6", 2);
 DEFINE_CLK_RPMH_VRM(clk7, _a2, "clka7", 2);
 DEFINE_CLK_RPMH_VRM(clk8, _a2, "clka8", 2);
@@ -737,6 +740,28 @@ static const struct clk_rpmh_desc clk_rpmh_sm4450 = {
 	.num_clks = ARRAY_SIZE(sm4450_rpmh_clocks),
 };
 
+static struct clk_hw *x1e80100_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_CLK3]		= &clk_rpmh_clk3_a2.hw,
+	[RPMH_RF_CLK3_A]	= &clk_rpmh_clk3_a2_ao.hw,
+	[RPMH_RF_CLK4]		= &clk_rpmh_clk4_a2.hw,
+	[RPMH_RF_CLK4_A]	= &clk_rpmh_clk4_a2_ao.hw,
+	[RPMH_RF_CLK5]		= &clk_rpmh_clk5_a2.hw,
+	[RPMH_RF_CLK5_A]	= &clk_rpmh_clk5_a2_ao.hw,
+};
+
+static const struct clk_rpmh_desc clk_rpmh_x1e80100 = {
+	.clks = x1e80100_rpmh_clocks,
+	.num_clks = ARRAY_SIZE(x1e80100_rpmh_clocks),
+};
+
 static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec,
 					 void *data)
 {
@@ -838,6 +863,7 @@ static const struct of_device_id clk_rpmh_match_table[] = {
 	{ .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},
+	{ .compatible = "qcom,x1e80100-rpmh-clk", .data = &clk_rpmh_x1e80100},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, clk_rpmh_match_table);
Signature · 1 line
2.17.1