Skip to contentSkip to conversation

Add NSS clock controller support for IPQ9574

PATCH Superseded Devi Priya 8 participants 35 messages Aug 25, 2023 – Oct 17, 2023

Subsystems (8)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Devi Priya

author
#0 lore raw

v2 cover Add NSS clock controller support for IPQ9574

Add bindings, driver and devicetree node for networking sub system clock controller on IPQ9574. Also add support for NSS Huayra type alpha PLL and add support for gpll0_out_aux clock which serves as the parent for some nss clocks.

The NSS clock controller driver depends on the below patchset which adds support for multiple configurations for same frequency.
https://lore.kernel.org/linux-arm-msm/[email protected]/

Changes in V2:
- Detailed change logs are added to the respective patches.

V1 can be found at:
https://lore.kernel.org/linux-arm-msm/[email protected]/

Devi Priya (7):
clk: qcom: clk-alpha-pll: Add NSS HUAYRA ALPHA PLL support for ipq9574
dt-bindings: clock: gcc-ipq9574: Add definition for GPLL0_OUT_AUX
clk: qcom: gcc-ipq9574: Add gpll0_out_aux clock
dt-bindings: clock: Add ipq9574 NSSCC clock and reset definitions
clk: qcom: Add NSS clock Controller driver for IPQ9574
arm64: dts: qcom: ipq9574: Add support for nsscc node
arm64: defconfig: Build NSS Clock Controller driver for IPQ9574

 .../bindings/clock/qcom,ipq9574-nsscc.yaml    |  107 +
 arch/arm64/boot/dts/qcom/ipq9574.dtsi         |   48 +
 arch/arm64/configs/defconfig                  |    1 +
 drivers/clk/qcom/Kconfig                      |    7 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/clk-alpha-pll.c              |   12 +
 drivers/clk/qcom/clk-alpha-pll.h              |    1 +
 drivers/clk/qcom/gcc-ipq9574.c                |   16 +
 drivers/clk/qcom/nsscc-ipq9574.c              | 3109 +++++++++++++++++
 include/dt-bindings/clock/qcom,ipq9574-gcc.h  |    1 +
 .../dt-bindings/clock/qcom,ipq9574-nsscc.h    |  152 +
 .../dt-bindings/reset/qcom,ipq9574-nsscc.h    |  134 +
 12 files changed, 3589 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,ipq9574-nsscc.yaml
 create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c
 create mode 100644 include/dt-bindings/clock/qcom,ipq9574-nsscc.h
 create mode 100644 include/dt-bindings/reset/qcom,ipq9574-nsscc.h
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/7 clk: qcom: clk-alpha-pll: Add NSS HUAYRA ALPHA PLL support for ipq9574

Add support for NSS Huayra alpha pll found on ipq9574 SoCs. Programming sequence is the same as that of Huayra type Alpha PLL, so we can re-use the same.

---
Changes in V2:
- Picked up the R-b tag

 drivers/clk/qcom/clk-alpha-pll.c | 12 ++++++++++++
 drivers/clk/qcom/clk-alpha-pll.h |  1 +
 2 files changed, 13 insertions(+)
drivers/clk/qcom/clk-alpha-pll.c +12 -0
index e4ef645f65d1..1c2a72840cd2 100644
@@ -228,6 +228,18 @@ const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = {
 		[PLL_OFF_ALPHA_VAL] = 0x24,
 		[PLL_OFF_ALPHA_VAL_U] = 0x28,
 	},
+
+	[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA] =  {
+		[PLL_OFF_L_VAL] = 0x04,
+		[PLL_OFF_ALPHA_VAL] = 0x08,
+		[PLL_OFF_TEST_CTL] = 0x0c,
+		[PLL_OFF_TEST_CTL_U] = 0x10,
+		[PLL_OFF_USER_CTL] = 0x14,
+		[PLL_OFF_CONFIG_CTL] = 0x18,
+		[PLL_OFF_CONFIG_CTL_U] = 0x1c,
+		[PLL_OFF_STATUS] = 0x20,
+	},
+
 };
 EXPORT_SYMBOL_GPL(clk_alpha_pll_regs);
 
drivers/clk/qcom/clk-alpha-pll.h +1 -0
index e4bd863027ab..cb079a6ed96a 100644
@@ -28,6 +28,7 @@ enum {
 	CLK_ALPHA_PLL_TYPE_BRAMMO_EVO,
 	CLK_ALPHA_PLL_TYPE_STROMER,
 	CLK_ALPHA_PLL_TYPE_STROMER_PLUS,
+	CLK_ALPHA_PLL_TYPE_NSS_HUAYRA,
 	CLK_ALPHA_PLL_TYPE_MAX,
 };
 
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH V2 1/7] clk: qcom: clk-alpha-pll: Add NSS HUAYRA ALPHA PLL support for ipq9574

Quoting Devi Priya (2023-08-25 02:12:28)

drivers/clk/qcom/clk-alpha-pll.c const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = { · line 231

Quoted 9 lines
drivers/clk/qcom/clk-alpha-pll.c +1 -0
index e4ef645f65d1..1c2a72840cd2 100644
@@ -228,6 +228,18 @@ const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = {
                [PLL_OFF_ALPHA_VAL] = 0x24,
                [PLL_OFF_ALPHA_VAL_U] = 0x28,
        },
+

Why the extra newline? All other types aren't this way.

Quoted 11 lines
drivers/clk/qcom/clk-alpha-pll.c +11 -0
+       [CLK_ALPHA_PLL_TYPE_NSS_HUAYRA] =  {
+               [PLL_OFF_L_VAL] = 0x04,
+               [PLL_OFF_ALPHA_VAL] = 0x08,
+               [PLL_OFF_TEST_CTL] = 0x0c,
+               [PLL_OFF_TEST_CTL_U] = 0x10,
+               [PLL_OFF_USER_CTL] = 0x14,
+               [PLL_OFF_CONFIG_CTL] = 0x18,
+               [PLL_OFF_CONFIG_CTL_U] = 0x1c,
+               [PLL_OFF_STATUS] = 0x20,
+       },
+
author
#3 lore raw

Re: [PATCH V2 1/7] clk: qcom: clk-alpha-pll: Add NSS HUAYRA ALPHA PLL support for ipq9574

Quoted 12 lines · Stephen Boyd

Quoting Devi Priya (2023-08-25 02:12:28)

drivers/clk/qcom/clk-alpha-pll.c const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = { · line 231

Quoted 9 lines
drivers/clk/qcom/clk-alpha-pll.c +1 -0
index e4ef645f65d1..1c2a72840cd2 100644
@@ -228,6 +228,18 @@ const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = {
                 [PLL_OFF_ALPHA_VAL] = 0x24,
                 [PLL_OFF_ALPHA_VAL_U] = 0x28,
         },
+

Why the extra newline? All other types aren't this way.

Sure, will drop it in V3

Thanks,
Devi Priya

Quoted 12 lines
Quoted 12 lines
drivers/clk/qcom/clk-alpha-pll.c +11 -0
+       [CLK_ALPHA_PLL_TYPE_NSS_HUAYRA] =  {
+               [PLL_OFF_L_VAL] = 0x04,
+               [PLL_OFF_ALPHA_VAL] = 0x08,
+               [PLL_OFF_TEST_CTL] = 0x0c,
+               [PLL_OFF_TEST_CTL_U] = 0x10,
+               [PLL_OFF_USER_CTL] = 0x14,
+               [PLL_OFF_CONFIG_CTL] = 0x18,
+               [PLL_OFF_CONFIG_CTL_U] = 0x1c,
+               [PLL_OFF_STATUS] = 0x20,
+       },
+
author
#4 lore raw

PATCH v2 2/7 dt-bindings: clock: gcc-ipq9574: Add definition for GPLL0_OUT_AUX

In reply to Devi Priya

Add the definition for GPLL0_OUT_AUX clock.

---
 include/dt-bindings/clock/qcom,ipq9574-gcc.h | 1 +
 1 file changed, 1 insertion(+)
include/dt-bindings/clock/qcom,ipq9574-gcc.h +1 -0
index 08fd3a37acaa..f5749bf53898 100644
@@ -216,4 +216,5 @@
 #define GCC_CRYPTO_AHB_CLK				207
 #define GCC_USB0_PIPE_CLK				208
 #define GCC_USB0_SLEEP_CLK				209
+#define GPLL0_OUT_AUX					210
 #endif
Signature · 1 line
2.34.1
Acked-by on v2 2/7
#5 lore raw

Re: [PATCH V2 2/7] dt-bindings: clock: gcc-ipq9574: Add definition for GPLL0_OUT_AUX

Quoted 5 lines · Devi Priya

Add the definition for GPLL0_OUT_AUX clock.

---
 include/dt-bindings/clock/qcom,ipq9574-gcc.h | 1 +

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw

Re: [PATCH V2 2/7] dt-bindings: clock: gcc-ipq9574: Add definition for GPLL0_OUT_AUX

In reply to Devi Priya
Quoted 12 lines · Devi Priya

Add the definition for GPLL0_OUT_AUX clock.

---
 include/dt-bindings/clock/qcom,ipq9574-gcc.h | 1 +
 1 file changed, 1 insertion(+)
include/dt-bindings/clock/qcom,ipq9574-gcc.h +0 -0
index 08fd3a37acaa..f5749bf53898 100644

include/dt-bindings/clock/qcom,ipq9574-gcc.h line 219

Quoted 4 lines
include/dt-bindings/clock/qcom,ipq9574-gcc.h +1 -0
@@ -216,4 +216,5 @@
 #define GCC_CRYPTO_AHB_CLK				207
 #define GCC_USB0_PIPE_CLK				208
 #define GCC_USB0_SLEEP_CLK				209
+#define GPLL0_OUT_AUX					210

Although you remove here blank line...

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#7 lore raw

PATCH v2 3/7 clk: qcom: gcc-ipq9574: Add gpll0_out_aux clock

In reply to Devi Priya

Add support for gpll0_out_aux clock which acts as the parent for certain networking subsystem (nss) clocks.

---
 drivers/clk/qcom/gcc-ipq9574.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/clk/qcom/gcc-ipq9574.c +16 -0
index 8f430367299e..495a66f7d29a 100644
@@ -107,6 +107,21 @@ static struct clk_alpha_pll_postdiv gpll0 = {
 	},
 };
 
+static struct clk_alpha_pll_postdiv gpll0_out_aux = {
+	.offset = 0x20000,
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.width = 4,
+	.clkr.hw.init = &(const struct clk_init_data) {
+		.name = "gpll0_out_aux",
+		.parent_hws = (const struct clk_hw *[]) {
+			&gpll0_main.clkr.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,
+		.ops = &clk_alpha_pll_postdiv_ro_ops,
+	},
+};
+
 static struct clk_alpha_pll gpll4_main = {
 	.offset = 0x22000,
 	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
@@ -4144,6 +4159,7 @@ static struct clk_regmap *gcc_ipq9574_clks[] = {
 	[GCC_SNOC_PCIE1_1LANE_S_CLK] = &gcc_snoc_pcie1_1lane_s_clk.clkr,
 	[GCC_SNOC_PCIE2_2LANE_S_CLK] = &gcc_snoc_pcie2_2lane_s_clk.clkr,
 	[GCC_SNOC_PCIE3_2LANE_S_CLK] = &gcc_snoc_pcie3_2lane_s_clk.clkr,
+	[GPLL0_OUT_AUX] = &gpll0_out_aux.clkr,
 };
 
 static const struct qcom_reset_map gcc_ipq9574_resets[] = {
Signature · 1 line
2.34.1
#8 lore raw

Re: [PATCH V2 3/7] clk: qcom: gcc-ipq9574: Add gpll0_out_aux clock

Quoted 17 lines · Devi Priya

Add support for gpll0_out_aux clock which acts as the parent for certain networking subsystem (nss) clocks.

---
  drivers/clk/qcom/gcc-ipq9574.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
drivers/clk/qcom/gcc-ipq9574.c +1 -0
index 8f430367299e..495a66f7d29a 100644
@@ -107,6 +107,21 @@ static struct clk_alpha_pll_postdiv gpll0 = {
  	},
  };
 
+static struct clk_alpha_pll_postdiv gpll0_out_aux = {

drivers/clk/qcom/gcc-ipq9574.c static struct clk_alpha_pll_postdiv gpll0 = { · line 120

Quoted 10 lines
drivers/clk/qcom/gcc-ipq9574.c +10 -0
+	.offset = 0x20000,
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.width = 4,
+	.clkr.hw.init = &(const struct clk_init_data) {
+		.name = "gpll0_out_aux",
+		.parent_hws = (const struct clk_hw *[]) {
+			&gpll0_main.clkr.hw
+		},
+		.num_parents = 1,
+		.flags = CLK_SET_RATE_PARENT,

You might need to drop the member 'flags '. Please refer https://lore.kernel.org/linux-arm-msm/[email protected]/

I will send the patch to drop the flags in the existing driver sometime next week.

Thanks,

Quoted 15 lines
drivers/clk/qcom/gcc-ipq9574.c +5 -0
+		.ops = &clk_alpha_pll_postdiv_ro_ops,
+	},
+};
+
  static struct clk_alpha_pll gpll4_main = {
  	.offset = 0x22000,
  	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
@@ -4144,6 +4159,7 @@ static struct clk_regmap *gcc_ipq9574_clks[] = {
  	[GCC_SNOC_PCIE1_1LANE_S_CLK] = &gcc_snoc_pcie1_1lane_s_clk.clkr,
  	[GCC_SNOC_PCIE2_2LANE_S_CLK] = &gcc_snoc_pcie2_2lane_s_clk.clkr,
  	[GCC_SNOC_PCIE3_2LANE_S_CLK] = &gcc_snoc_pcie3_2lane_s_clk.clkr,
+	[GPLL0_OUT_AUX] = &gpll0_out_aux.clkr,
  };
 
  static const struct qcom_reset_map gcc_ipq9574_resets[] = {
author
#9 lore raw

PATCH v2 4/7 dt-bindings: clock: Add ipq9574 NSSCC clock and reset definitions

In reply to Devi Priya

Add NSSCC clock and reset definitions for ipq9574.

---
Changes in V2:
- Referenced gcc.yaml and dropped the duplicate properties from the binding
- Updated Uniphy clock names
- Added nssnoc clocks and clock-names

 .../bindings/clock/qcom,ipq9574-nsscc.yaml    | 107 ++++++++++++
 .../dt-bindings/clock/qcom,ipq9574-nsscc.h    | 152 ++++++++++++++++++
 .../dt-bindings/reset/qcom,ipq9574-nsscc.h    | 134 +++++++++++++++
 3 files changed, 393 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,ipq9574-nsscc.yaml
 create mode 100644 include/dt-bindings/clock/qcom,ipq9574-nsscc.h
 create mode 100644 include/dt-bindings/reset/qcom,ipq9574-nsscc.h
Documentation/devicetree/bindings/clock/qcom,ipq9574-nsscc.yaml new file +107 -0
new file mode 100644
index 000000000000..570a9c654781
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,ipq9574-nsscc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Networking Sub System Clock & Reset Controller on IPQ9574
+
+maintainers:
+  - Bjorn Andersson <[email protected]>
+  - Anusha Rao <[email protected]>
+
+description: |
+  Qualcomm networking sub system clock control module provides the clocks,
+  resets and power domains on IPQ9574
+
+  See also::
+    include/dt-bindings/clock/qcom,ipq9574-nsscc.h
+    include/dt-bindings/reset/qcom,ipq9574-nsscc.h
+
+properties:
+  compatible:
+    const: qcom,ipq9574-nsscc
+
+  clocks:
+    items:
+      - description: NSSNOC NSSCC clock source
+      - description: NSSNOC SNOC clock source
+      - description: NSSNOC SNOC_1 clock source
+      - description: Bias PLL cc clock source
+      - description: Bias PLL nss noc clock source
+      - description: Bias PLL ubi nc clock source
+      - description: GCC GPLL0 OUT AUX clock source
+      - description: Uniphy0 NSS Rx clock source
+      - description: Uniphy0 NSS Tx clock source
+      - description: Uniphy1 NSS Rx clock source
+      - description: Uniphy1 NSS Tx clock source
+      - description: Uniphy2 NSS Rx clock source
+      - description: Uniphy2 NSS Tx clock source
+      - description: Board XO source
+
+  clock-names:
+    items:
+      - const: nssnoc_nsscc
+      - const: nssnoc_snoc
+      - const: nssnoc_snoc_1
+      - const: bias_pll_cc_clk
+      - const: bias_pll_nss_noc_clk
+      - const: bias_pll_ubi_nc_clk
+      - const: gpll0_out_aux
+      - const: uniphy0_nss_rx_clk
+      - const: uniphy0_nss_tx_clk
+      - const: uniphy1_nss_rx_clk
+      - const: uniphy1_nss_tx_clk
+      - const: uniphy2_nss_rx_clk
+      - const: uniphy2_nss_tx_clk
+      - const: xo_board_clk
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+
+allOf:
+  - $ref: qcom,gcc.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,ipq9574-gcc.h>
+    clock-controller@39b00000 {
+      compatible = "qcom,ipq9574-nsscc";
+      reg = <0x39b00000 0x80000>;
+      clocks = <&gcc GCC_NSSNOC_NSSCC_CLK>,
+               <&gcc GCC_NSSNOC_SNOC_CLK>,
+               <&gcc GCC_NSSNOC_SNOC_1_CLK>,
+               <&bias_pll_cc_clk>,
+               <&bias_pll_nss_noc_clk>,
+               <&bias_pll_ubi_nc_clk>,
+               <&gcc GPLL0_OUT_AUX>,
+               <&uniphy 0>,
+               <&uniphy 1>,
+               <&uniphy 2>,
+               <&uniphy 3>,
+               <&uniphy 4>,
+               <&uniphy 5>,
+               <&xo_board_clk>;
+      clock-names = "nssnoc_nsscc",
+                    "nssnoc_snoc",
+                    "nssnoc_snoc_1",
+                    "bias_pll_cc_clk",
+                    "bias_pll_nss_noc_clk",
+                    "bias_pll_ubi_nc_clk",
+                    "gpll0_out_aux",
+                    "uniphy0_nss_rx_clk",
+                    "uniphy0_nss_tx_clk",
+                    "uniphy1_nss_rx_clk",
+                    "uniphy1_nss_tx_clk",
+                    "uniphy2_nss_rx_clk",
+                    "uniphy2_nss_tx_clk",
+                    "xo_board_clk";
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+...
include/dt-bindings/clock/qcom,ipq9574-nsscc.h new file +152 -0

152 lines not on this page · raw message

include/dt-bindings/reset/qcom,ipq9574-nsscc.h new file +134 -0

134 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#10 lore raw

Re: [PATCH V2 4/7] dt-bindings: clock: Add ipq9574 NSSCC clock and reset definitions

Quoted 10 lines · Devi Priya

Add NSSCC clock and reset definitions for ipq9574.

---
Changes in V2:
- Referenced gcc.yaml and dropped the duplicate properties from the binding
- Updated Uniphy clock names
- Added nssnoc clocks and clock-names

Quoted 8 lines
 .../bindings/clock/qcom,ipq9574-nsscc.yaml    | 107 ++++++++++++
 .../dt-bindings/clock/qcom,ipq9574-nsscc.h    | 152 ++++++++++++++++++
 .../dt-bindings/reset/qcom,ipq9574-nsscc.h    | 134 +++++++++++++++
 3 files changed, 393 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,ipq9574-nsscc.yaml
 create mode 100644 include/dt-bindings/clock/qcom,ipq9574-nsscc.h
 create mode 100644 include/dt-bindings/reset/qcom,ipq9574-nsscc.h

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/clock/qcom,ipq9574-nsscc.example.dts:28.26-27 syntax error FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/clock/qcom,ipq9574-nsscc.example.dtb] Error 1 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1500: dt_binding_check] Error 2
make: *** [Makefile:234: __sub-make] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

Reviewed-by on v2 4/7
#11 lore raw

Re: [PATCH V2 4/7] dt-bindings: clock: Add ipq9574 NSSCC clock and reset definitions

In reply to Devi Priya
Quoted 9 lines · Devi Priya

Add NSSCC clock and reset definitions for ipq9574.

---
Changes in V2:
- Referenced gcc.yaml and dropped the duplicate properties from the binding
- Updated Uniphy clock names
- Added nssnoc clocks and clock-names

Rob's bot report is a result of patch #2 failing to apply.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#12 lore raw

Re: [PATCH V2 4/7] dt-bindings: clock: Add ipq9574 NSSCC clock and reset definitions

Quoted 12 lines · Krzysztof Kozlowski
Quoted 9 lines · Devi Priya

Add NSSCC clock and reset definitions for ipq9574.

---
Changes in V2:
- Referenced gcc.yaml and dropped the duplicate properties from the binding
- Updated Uniphy clock names
- Added nssnoc clocks and clock-names

Quoted 3 lines

Rob's bot report is a result of patch #2 failing to apply.

I assume changes will be needed here to drop clock-names.

Best regards,
Krzysztof

author
#13 lore raw

PATCH v2 5/7 clk: qcom: Add NSS clock Controller driver for IPQ9574

In reply to Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc clocks as critical & added pm_clk for nssnoc clocks
- Updated the uniphy clock names

 drivers/clk/qcom/Kconfig         |    7 +
 drivers/clk/qcom/Makefile        |    1 +
 drivers/clk/qcom/nsscc-ipq9574.c | 3109 ++++++++++++++++++++++++++++++
 3 files changed, 3117 insertions(+)
 create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c
drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
 	  i2c, USB, SD/eMMC, etc. Select this for the root clock
 	  of ipq9574.
 
+config IPQ_NSSCC_9574
+	tristate "IPQ9574 NSS Clock Controller"
+	depends on ARM64 || COMPILE_TEST
+	depends on IPQ_GCC_9574
+	help
+	  Support for NSS clock controller on ipq9574 devices.
+
 config MSM_GCC_8660
 	tristate "MSM8660 Global Clock Controller"
 	depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
 obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
 obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
 obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)	+= nsscc-ipq9574.o
 obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
 obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
 obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +3109 -0

2,980 lines not on this page · raw message

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

Signature · 1 line
2.34.1

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

#14 lore raw

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 79 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc clocks as critical & added pm_clk for nssnoc clocks
- Updated the uniphy clock names

 drivers/clk/qcom/Kconfig         |    7 +
 drivers/clk/qcom/Makefile        |    1 +
 drivers/clk/qcom/nsscc-ipq9574.c | 3109 ++++++++++++++++++++++++++++++
 3 files changed, 3117 insertions(+)
 create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c
drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
          i2c, USB, SD/eMMC, etc. Select this for the root clock
          of ipq9574.
 
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+
 config MSM_GCC_8660
        tristate "MSM8660 Global Clock Controller"
        depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
 obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
 obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
 obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o
 obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
 obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
 obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"

drivers/clk/qcom/nsscc-ipq9574.c line 34

Quoted 10 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

drivers/clk/qcom/nsscc-ipq9574.c line 45

Quoted 11 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +11 -0
+       DT_BIAS_PLL_CC_CLK,
+       DT_BIAS_PLL_NSS_NOC_CLK,
+       DT_BIAS_PLL_UBI_NC_CLK,
+       DT_GCC_GPLL0_OUT_AUX,
+       DT_UNIPHY0_NSS_RX_CLK,
+       DT_UNIPHY0_NSS_TX_CLK,
+       DT_UNIPHY1_NSS_RX_CLK,
+       DT_UNIPHY1_NSS_TX_CLK,
+       DT_UNIPHY2_NSS_RX_CLK,
+       DT_UNIPHY2_NSS_TX_CLK,
+       DT_XO,

As I wrote, please move DT_XO closer to the beginning of the list.

Quoted 54 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +54 -0
+};
+
+enum {
+       P_BIAS_PLL_CC_CLK,
+       P_BIAS_PLL_NSS_NOC_CLK,
+       P_BIAS_PLL_UBI_NC_CLK,
+       P_GCC_GPLL0_OUT_AUX,
+       P_UBI32_PLL_OUT_MAIN,
+       P_UNIPHY0_NSS_RX_CLK,
+       P_UNIPHY0_NSS_TX_CLK,
+       P_UNIPHY1_NSS_RX_CLK,
+       P_UNIPHY1_NSS_TX_CLK,
+       P_UNIPHY2_NSS_RX_CLK,
+       P_UNIPHY2_NSS_TX_CLK,
+       P_XO,
+};
+
+static const struct alpha_pll_config ubi32_pll_config = {
+       .l = 0x3e,
+       .alpha = 0x6666,
+       .config_ctl_val = 0x200d4aa8,
+       .config_ctl_hi_val = 0x3c,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .pre_div_val = 0x0,
+       .pre_div_mask = BIT(12),
+       .post_div_val = 0x0,
+       .post_div_mask = GENMASK(9, 8),
+       .alpha_en_mask = BIT(24),
+       .test_ctl_val = 0x1c0000c0,
+       .test_ctl_hi_val = 0x4000,
+};
+
+static struct clk_alpha_pll ubi32_pll_main = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .flags = SUPPORTS_DYNAMIC_UPDATE,
+       .clkr = {
+               .hw.init = &(const struct clk_init_data) {
+                       .name = "ubi32_pll_main",
+                       .parent_data = &(const struct clk_parent_data) {
+                               .index = DT_XO,
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_huayra_ops,
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv ubi32_pll = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .width = 2,
+       .clkr.hw.init = &(const struct clk_init_data) {

drivers/clk/qcom/nsscc-ipq9574.c line 109

Quoted 10 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+               .name = "ubi32_pll",
+               .parent_hws = (const struct clk_hw *[]) {
+                       &ubi32_pll_main.clkr.hw
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+

[skipped clock tables, LGTM]

Quoted 12 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +12 -0
+static const struct of_device_id nss_cc_ipq9574_match_table[] = {
+       { .compatible = "qcom,ipq9574-nsscc" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, nss_cc_ipq9574_match_table);
+
+static int nss_cc_ipq9574_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       struct qcom_cc_desc nsscc_ipq9574_desc = nss_cc_ipq9574_desc;
+
+       int ret;

drivers/clk/qcom/nsscc-ipq9574.c line 3062

Quoted 10 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+
+       ret = devm_pm_runtime_enable(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
+       ret = devm_pm_clk_create(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_nsscc");

As we are switching to DT indices, better add new API that takes index rather than mixing indices and names.

Quoted 50 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +47 -1
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_nsscc clock\n");
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc");
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc clock\n");
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc_1");
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc_1 clock\n");
+               return ret;
+       }
+
+       ret = pm_runtime_get(&pdev->dev);
+       if (ret)
+               return ret;
+
+       regmap = qcom_cc_map(pdev, &nsscc_ipq9574_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       clk_alpha_pll_configure(&ubi32_pll_main, regmap, &ubi32_pll_config);
+
+       return qcom_cc_really_probe(pdev, &nsscc_ipq9574_desc, regmap);
+}
+
+static const struct dev_pm_ops nss_cc_pm_ops = {
+       SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
+};
+
+static struct platform_driver nss_cc_ipq9574_driver = {
+       .probe = nss_cc_ipq9574_probe,
+       .driver = {
+               .name = "qcom,nsscc-ipq9574",
+               .of_match_table = nss_cc_ipq9574_match_table,
+               .pm = &nss_cc_pm_ops,
+       },
+};
+
+module_platform_driver(nss_cc_ipq9574_driver);
+
+MODULE_DESCRIPTION("QTI NSS_CC IPQ9574 Driver");
+MODULE_LICENSE("GPL");
--

2.34.1

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

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 85 lines · Dmitry Baryshkov
Quoted 84 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc clocks as critical & added pm_clk for nssnoc clocks
- Updated the uniphy clock names

  drivers/clk/qcom/Kconfig         |    7 +
  drivers/clk/qcom/Makefile        |    1 +
  drivers/clk/qcom/nsscc-ipq9574.c | 3109 ++++++++++++++++++++++++++++++
  3 files changed, 3117 insertions(+)

create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c

drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
           i2c, USB, SD/eMMC, etc. Select this for the root clock
           of ipq9574.
 
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+
  config MSM_GCC_8660
         tristate "MSM8660 Global Clock Controller"
         depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
  obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
  obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
  obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o
  obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
  obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
  obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +29 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c line 34

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the changes merged?

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Quoted 99 lines

drivers/clk/qcom/nsscc-ipq9574.c line 45

Quoted 12 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +11 -0
+       DT_BIAS_PLL_CC_CLK,
+       DT_BIAS_PLL_NSS_NOC_CLK,
+       DT_BIAS_PLL_UBI_NC_CLK,
+       DT_GCC_GPLL0_OUT_AUX,
+       DT_UNIPHY0_NSS_RX_CLK,
+       DT_UNIPHY0_NSS_TX_CLK,
+       DT_UNIPHY1_NSS_RX_CLK,
+       DT_UNIPHY1_NSS_TX_CLK,
+       DT_UNIPHY2_NSS_RX_CLK,
+       DT_UNIPHY2_NSS_TX_CLK,
+       DT_XO,

As I wrote, please move DT_XO closer to the beginning of the list.

Quoted 54 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +54 -0
+};
+
+enum {
+       P_BIAS_PLL_CC_CLK,
+       P_BIAS_PLL_NSS_NOC_CLK,
+       P_BIAS_PLL_UBI_NC_CLK,
+       P_GCC_GPLL0_OUT_AUX,
+       P_UBI32_PLL_OUT_MAIN,
+       P_UNIPHY0_NSS_RX_CLK,
+       P_UNIPHY0_NSS_TX_CLK,
+       P_UNIPHY1_NSS_RX_CLK,
+       P_UNIPHY1_NSS_TX_CLK,
+       P_UNIPHY2_NSS_RX_CLK,
+       P_UNIPHY2_NSS_TX_CLK,
+       P_XO,
+};
+
+static const struct alpha_pll_config ubi32_pll_config = {
+       .l = 0x3e,
+       .alpha = 0x6666,
+       .config_ctl_val = 0x200d4aa8,
+       .config_ctl_hi_val = 0x3c,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .pre_div_val = 0x0,
+       .pre_div_mask = BIT(12),
+       .post_div_val = 0x0,
+       .post_div_mask = GENMASK(9, 8),
+       .alpha_en_mask = BIT(24),
+       .test_ctl_val = 0x1c0000c0,
+       .test_ctl_hi_val = 0x4000,
+};
+
+static struct clk_alpha_pll ubi32_pll_main = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .flags = SUPPORTS_DYNAMIC_UPDATE,
+       .clkr = {
+               .hw.init = &(const struct clk_init_data) {
+                       .name = "ubi32_pll_main",
+                       .parent_data = &(const struct clk_parent_data) {
+                               .index = DT_XO,
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_huayra_ops,
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv ubi32_pll = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .width = 2,
+       .clkr.hw.init = &(const struct clk_init_data) {

drivers/clk/qcom/nsscc-ipq9574.c line 109

Quoted 10 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+               .name = "ubi32_pll",
+               .parent_hws = (const struct clk_hw *[]) {
+                       &ubi32_pll_main.clkr.hw
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+

[skipped clock tables, LGTM]

Quoted 17 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +17 -0
+static const struct of_device_id nss_cc_ipq9574_match_table[] = {
+       { .compatible = "qcom,ipq9574-nsscc" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, nss_cc_ipq9574_match_table);
+
+static int nss_cc_ipq9574_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       struct qcom_cc_desc nsscc_ipq9574_desc = nss_cc_ipq9574_desc;
+
+       int ret;
+
+       ret = devm_pm_runtime_enable(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c line 3062

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+       ret = devm_pm_clk_create(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_nsscc");

As we are switching to DT indices, better add new API that takes index rather than mixing indices and names.

sure okay

Thanks,
Devi Priya

Quoted 53 lines
Quoted 51 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +47 -1
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_nsscc clock\n");
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc");
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc clock\n");
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc_1");
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc_1 clock\n");
+               return ret;
+       }
+
+       ret = pm_runtime_get(&pdev->dev);
+       if (ret)
+               return ret;
+
+       regmap = qcom_cc_map(pdev, &nsscc_ipq9574_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       clk_alpha_pll_configure(&ubi32_pll_main, regmap, &ubi32_pll_config);
+
+       return qcom_cc_really_probe(pdev, &nsscc_ipq9574_desc, regmap);
+}
+
+static const struct dev_pm_ops nss_cc_pm_ops = {
+       SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
+};
+
+static struct platform_driver nss_cc_ipq9574_driver = {
+       .probe = nss_cc_ipq9574_probe,
+       .driver = {
+               .name = "qcom,nsscc-ipq9574",
+               .of_match_table = nss_cc_ipq9574_match_table,
+               .pm = &nss_cc_pm_ops,
+       },
+};
+
+module_platform_driver(nss_cc_ipq9574_driver);
+
+MODULE_DESCRIPTION("QTI NSS_CC IPQ9574 Driver");
+MODULE_LICENSE("GPL");
--

2.34.1

author
#16 lore raw

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 97 lines · Devi Priya
Quoted 86 lines · Dmitry Baryshkov
Quoted 85 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based devices.

---
  Changes in V2:
         - Added depends on ARM64 || COMPILE_TEST in Kconfig
         - Added module_platform_driver
         - Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc clocks as critical & added pm_clk for nssnoc clocks
         - Updated the uniphy clock names

  drivers/clk/qcom/Kconfig         |    7 + drivers/clk/qcom/Makefile        |    1 + drivers/clk/qcom/nsscc-ipq9574.c | 3109 ++++++++++++++++++++++++++++++

  3 files changed, 3117 insertions(+)

  create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c

drivers/clk/qcom/Kconfig +0 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574

           i2c, USB, SD/eMMC, etc. Select this for the root clock of ipq9574.

drivers/clk/qcom/Kconfig +7 -0
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+

  config MSM_GCC_8660
         tristate "MSM8660 Global Clock Controller" depends on ARM || COMPILE_TEST

drivers/clk/qcom/Makefile +0 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o

  obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o +obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o

drivers/clk/qcom/nsscc-ipq9574.c new file +4 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights 

reserved.
+ */

drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c line 34

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Quoted 8 lines

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the changes merged?

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Hi Dmitry,
Just curious to know if we could send out the next series with the proposed approach if that holds good.

Thanks,
Devi Priya

Quoted 168 lines
Quoted 99 lines
Quoted 12 lines

+       DT_BIAS_PLL_CC_CLK,
+       DT_BIAS_PLL_NSS_NOC_CLK,
+       DT_BIAS_PLL_UBI_NC_CLK,
+       DT_GCC_GPLL0_OUT_AUX,
+       DT_UNIPHY0_NSS_RX_CLK,
+       DT_UNIPHY0_NSS_TX_CLK,
+       DT_UNIPHY1_NSS_RX_CLK,
+       DT_UNIPHY1_NSS_TX_CLK,
+       DT_UNIPHY2_NSS_RX_CLK,
+       DT_UNIPHY2_NSS_TX_CLK,
+       DT_XO,

As I wrote, please move DT_XO closer to the beginning of the list.

Quoted 54 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +54 -0
+};
+
+enum {
+       P_BIAS_PLL_CC_CLK,
+       P_BIAS_PLL_NSS_NOC_CLK,
+       P_BIAS_PLL_UBI_NC_CLK,
+       P_GCC_GPLL0_OUT_AUX,
+       P_UBI32_PLL_OUT_MAIN,
+       P_UNIPHY0_NSS_RX_CLK,
+       P_UNIPHY0_NSS_TX_CLK,
+       P_UNIPHY1_NSS_RX_CLK,
+       P_UNIPHY1_NSS_TX_CLK,
+       P_UNIPHY2_NSS_RX_CLK,
+       P_UNIPHY2_NSS_TX_CLK,
+       P_XO,
+};
+
+static const struct alpha_pll_config ubi32_pll_config = {
+       .l = 0x3e,
+       .alpha = 0x6666,
+       .config_ctl_val = 0x200d4aa8,
+       .config_ctl_hi_val = 0x3c,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .pre_div_val = 0x0,
+       .pre_div_mask = BIT(12),
+       .post_div_val = 0x0,
+       .post_div_mask = GENMASK(9, 8),
+       .alpha_en_mask = BIT(24),
+       .test_ctl_val = 0x1c0000c0,
+       .test_ctl_hi_val = 0x4000,
+};
+
+static struct clk_alpha_pll ubi32_pll_main = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .flags = SUPPORTS_DYNAMIC_UPDATE,
+       .clkr = {
+               .hw.init = &(const struct clk_init_data) {
+                       .name = "ubi32_pll_main",
+                       .parent_data = &(const struct clk_parent_data) {
+                               .index = DT_XO,
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_huayra_ops,
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv ubi32_pll = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .width = 2,
+       .clkr.hw.init = &(const struct clk_init_data) {

drivers/clk/qcom/nsscc-ipq9574.c line 109

Quoted 10 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+               .name = "ubi32_pll",
+               .parent_hws = (const struct clk_hw *[]) {
+                       &ubi32_pll_main.clkr.hw
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+

[skipped clock tables, LGTM]

Quoted 17 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +17 -0
+static const struct of_device_id nss_cc_ipq9574_match_table[] = {
+       { .compatible = "qcom,ipq9574-nsscc" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, nss_cc_ipq9574_match_table);
+
+static int nss_cc_ipq9574_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       struct qcom_cc_desc nsscc_ipq9574_desc = nss_cc_ipq9574_desc;
+
+       int ret;
+
+       ret = devm_pm_runtime_enable(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
Quoted 8 lines
Quoted 5 lines

+       ret = devm_pm_clk_create(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_nsscc");

As we are switching to DT indices, better add new API that takes index rather than mixing indices and names.

sure okay

Thanks,
Devi Priya

Quoted 57 lines
Quoted 55 lines

+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_nsscc clock\n");
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc"); +       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc clock\n");
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc_1"); +       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc_1 clock\n");
+               return ret;
+       }

drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+
+       ret = pm_runtime_get(&pdev->dev);
+       if (ret)
+               return ret;
+
+       regmap = qcom_cc_map(pdev, &nsscc_ipq9574_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       clk_alpha_pll_configure(&ubi32_pll_main, regmap, 

&ubi32_pll_config);

drivers/clk/qcom/nsscc-ipq9574.c new file +21 -0
+
+       return qcom_cc_really_probe(pdev, &nsscc_ipq9574_desc, regmap);
+}
+
+static const struct dev_pm_ops nss_cc_pm_ops = {
+       SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
+};
+
+static struct platform_driver nss_cc_ipq9574_driver = {
+       .probe = nss_cc_ipq9574_probe,
+       .driver = {
+               .name = "qcom,nsscc-ipq9574",
+               .of_match_table = nss_cc_ipq9574_match_table,
+               .pm = &nss_cc_pm_ops,
+       },
+};
+
+module_platform_driver(nss_cc_ipq9574_driver);
+
+MODULE_DESCRIPTION("QTI NSS_CC IPQ9574 Driver");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.34.1
#17 lore raw

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 116 lines · Devi Priya
Quoted 112 lines · Devi Priya
Quoted 90 lines · Dmitry Baryshkov
Quoted 88 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based
devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc
clocks as critical
& added pm_clk for nssnoc clocks
- Updated the uniphy clock names

  drivers/clk/qcom/Kconfig         |    7 +
  drivers/clk/qcom/Makefile        |    1 +
  drivers/clk/qcom/nsscc-ipq9574.c | 3109 ++++++++++++++++++++++++++++++
  3 files changed, 3117 insertions(+)

create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c

drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
           i2c, USB, SD/eMMC, etc. Select this for the root clock
           of ipq9574.
 
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+
  config MSM_GCC_8660
         tristate "MSM8660 Global Clock Controller"
         depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
  obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
  obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
  obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o
  obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
  obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
  obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +4 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights

reserved.
+ */

drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c line 34

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the changes merged?

Quoted 5 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Hi Dmitry,
Just curious to know if we could send out the next series with the proposed approach if that holds good.

The answer really depends on the structure of your hardware. The issue is that once you commit the device bindings,you have to support them forever. So, if you commit the NSS clock support without interconnects in place, you have to keep this ANOC/SNOC/etc code forever, even after you land the interconnect. So I'd suggest landing the icc driver first (or at least implementing and sending to the mailing list), so that we can see how all these pieces fit together.

Quoted 171 lines

Thanks,
Devi Priya

Quoted 168 lines
Quoted 99 lines

drivers/clk/qcom/nsscc-ipq9574.c line 45

Quoted 12 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +11 -0
+       DT_BIAS_PLL_CC_CLK,
+       DT_BIAS_PLL_NSS_NOC_CLK,
+       DT_BIAS_PLL_UBI_NC_CLK,
+       DT_GCC_GPLL0_OUT_AUX,
+       DT_UNIPHY0_NSS_RX_CLK,
+       DT_UNIPHY0_NSS_TX_CLK,
+       DT_UNIPHY1_NSS_RX_CLK,
+       DT_UNIPHY1_NSS_TX_CLK,
+       DT_UNIPHY2_NSS_RX_CLK,
+       DT_UNIPHY2_NSS_TX_CLK,
+       DT_XO,

As I wrote, please move DT_XO closer to the beginning of the list.

Quoted 54 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +54 -0
+};
+
+enum {
+       P_BIAS_PLL_CC_CLK,
+       P_BIAS_PLL_NSS_NOC_CLK,
+       P_BIAS_PLL_UBI_NC_CLK,
+       P_GCC_GPLL0_OUT_AUX,
+       P_UBI32_PLL_OUT_MAIN,
+       P_UNIPHY0_NSS_RX_CLK,
+       P_UNIPHY0_NSS_TX_CLK,
+       P_UNIPHY1_NSS_RX_CLK,
+       P_UNIPHY1_NSS_TX_CLK,
+       P_UNIPHY2_NSS_RX_CLK,
+       P_UNIPHY2_NSS_TX_CLK,
+       P_XO,
+};
+
+static const struct alpha_pll_config ubi32_pll_config = {
+       .l = 0x3e,
+       .alpha = 0x6666,
+       .config_ctl_val = 0x200d4aa8,
+       .config_ctl_hi_val = 0x3c,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .pre_div_val = 0x0,
+       .pre_div_mask = BIT(12),
+       .post_div_val = 0x0,
+       .post_div_mask = GENMASK(9, 8),
+       .alpha_en_mask = BIT(24),
+       .test_ctl_val = 0x1c0000c0,
+       .test_ctl_hi_val = 0x4000,
+};
+
+static struct clk_alpha_pll ubi32_pll_main = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .flags = SUPPORTS_DYNAMIC_UPDATE,
+       .clkr = {
+               .hw.init = &(const struct clk_init_data) {
+                       .name = "ubi32_pll_main",
+                       .parent_data = &(const struct clk_parent_data) {
+                               .index = DT_XO,
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_huayra_ops,
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv ubi32_pll = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .width = 2,
+       .clkr.hw.init = &(const struct clk_init_data) {

drivers/clk/qcom/nsscc-ipq9574.c line 109

Quoted 10 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+               .name = "ubi32_pll",
+               .parent_hws = (const struct clk_hw *[]) {
+                       &ubi32_pll_main.clkr.hw
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+

[skipped clock tables, LGTM]

Quoted 17 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +17 -0
+static const struct of_device_id nss_cc_ipq9574_match_table[] = {
+       { .compatible = "qcom,ipq9574-nsscc" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, nss_cc_ipq9574_match_table);
+
+static int nss_cc_ipq9574_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       struct qcom_cc_desc nsscc_ipq9574_desc = nss_cc_ipq9574_desc;
+
+       int ret;
+
+       ret = devm_pm_runtime_enable(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c line 3062

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+       ret = devm_pm_clk_create(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_nsscc");

As we are switching to DT indices, better add new API that takes index rather than mixing indices and names.

sure okay

Thanks,
Devi Priya

Quoted 57 lines
Quoted 55 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +2 -0
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_nsscc

clock\n");

drivers/clk/qcom/nsscc-ipq9574.c new file +6 -0
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc");
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc

clock\n");

drivers/clk/qcom/nsscc-ipq9574.c new file +6 -0
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc_1");
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc_1

clock\n");

drivers/clk/qcom/nsscc-ipq9574.c new file +12 -0
+               return ret;
+       }
+
+       ret = pm_runtime_get(&pdev->dev);
+       if (ret)
+               return ret;
+
+       regmap = qcom_cc_map(pdev, &nsscc_ipq9574_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       clk_alpha_pll_configure(&ubi32_pll_main, regmap,

&ubi32_pll_config);

drivers/clk/qcom/nsscc-ipq9574.c new file +21 -1
+
+       return qcom_cc_really_probe(pdev, &nsscc_ipq9574_desc, regmap);
+}
+
+static const struct dev_pm_ops nss_cc_pm_ops = {
+       SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
+};
+
+static struct platform_driver nss_cc_ipq9574_driver = {
+       .probe = nss_cc_ipq9574_probe,
+       .driver = {
+               .name = "qcom,nsscc-ipq9574",
+               .of_match_table = nss_cc_ipq9574_match_table,
+               .pm = &nss_cc_pm_ops,
+       },
+};
+
+module_platform_driver(nss_cc_ipq9574_driver);
+
+MODULE_DESCRIPTION("QTI NSS_CC IPQ9574 Driver");
+MODULE_LICENSE("GPL");
--

2.34.1

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

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 123 lines · Dmitry Baryshkov
Quoted 116 lines · Devi Priya
Quoted 112 lines · Devi Priya
Quoted 90 lines · Dmitry Baryshkov
Quoted 88 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based
devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc
clocks as critical
& added pm_clk for nssnoc clocks
- Updated the uniphy clock names

   drivers/clk/qcom/Kconfig         |    7 +
   drivers/clk/qcom/Makefile        |    1 +
   drivers/clk/qcom/nsscc-ipq9574.c | 3109 ++++++++++++++++++++++++++++++
   3 files changed, 3117 insertions(+)

create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c

drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
            i2c, USB, SD/eMMC, etc. Select this for the root clock
            of ipq9574.
 
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+
   config MSM_GCC_8660
          tristate "MSM8660 Global Clock Controller"
          depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
   obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
   obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
   obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o
   obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
   obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
   obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +4 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights

reserved.
+ */

drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c line 34

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the changes merged?

Quoted 5 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Hi Dmitry,
Just curious to know if we could send out the next series with the proposed approach if that holds good.

Quoted 7 lines

The answer really depends on the structure of your hardware. The issue is that once you commit the device bindings,you have to support them forever. So, if you commit the NSS clock support without interconnects in place, you have to keep this ANOC/SNOC/etc code forever, even after you land the interconnect. So I'd suggest landing the icc driver first (or at least implementing and sending to the mailing list), so that we can see how all these pieces fit together.

Hi Dmitry,
Unlike MSM chipsets, IPQ chipsets does not have any use case wherein the NOC clocks have to be scaled. So if these clocks can be enabled in the probe, there is no need for an interconnect driver at all. The same applies to both ipq9574 and ipq5332 SoCs.

Thanks,
Devi Priya

Quoted 175 lines
Quoted 172 lines

Thanks,
Devi Priya

Quoted 168 lines
Quoted 99 lines

drivers/clk/qcom/nsscc-ipq9574.c line 45

Quoted 12 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +11 -0
+       DT_BIAS_PLL_CC_CLK,
+       DT_BIAS_PLL_NSS_NOC_CLK,
+       DT_BIAS_PLL_UBI_NC_CLK,
+       DT_GCC_GPLL0_OUT_AUX,
+       DT_UNIPHY0_NSS_RX_CLK,
+       DT_UNIPHY0_NSS_TX_CLK,
+       DT_UNIPHY1_NSS_RX_CLK,
+       DT_UNIPHY1_NSS_TX_CLK,
+       DT_UNIPHY2_NSS_RX_CLK,
+       DT_UNIPHY2_NSS_TX_CLK,
+       DT_XO,

As I wrote, please move DT_XO closer to the beginning of the list.

Quoted 54 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +54 -0
+};
+
+enum {
+       P_BIAS_PLL_CC_CLK,
+       P_BIAS_PLL_NSS_NOC_CLK,
+       P_BIAS_PLL_UBI_NC_CLK,
+       P_GCC_GPLL0_OUT_AUX,
+       P_UBI32_PLL_OUT_MAIN,
+       P_UNIPHY0_NSS_RX_CLK,
+       P_UNIPHY0_NSS_TX_CLK,
+       P_UNIPHY1_NSS_RX_CLK,
+       P_UNIPHY1_NSS_TX_CLK,
+       P_UNIPHY2_NSS_RX_CLK,
+       P_UNIPHY2_NSS_TX_CLK,
+       P_XO,
+};
+
+static const struct alpha_pll_config ubi32_pll_config = {
+       .l = 0x3e,
+       .alpha = 0x6666,
+       .config_ctl_val = 0x200d4aa8,
+       .config_ctl_hi_val = 0x3c,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .pre_div_val = 0x0,
+       .pre_div_mask = BIT(12),
+       .post_div_val = 0x0,
+       .post_div_mask = GENMASK(9, 8),
+       .alpha_en_mask = BIT(24),
+       .test_ctl_val = 0x1c0000c0,
+       .test_ctl_hi_val = 0x4000,
+};
+
+static struct clk_alpha_pll ubi32_pll_main = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .flags = SUPPORTS_DYNAMIC_UPDATE,
+       .clkr = {
+               .hw.init = &(const struct clk_init_data) {
+                       .name = "ubi32_pll_main",
+                       .parent_data = &(const struct clk_parent_data) {
+                               .index = DT_XO,
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_huayra_ops,
+               },
+       },
+};
+
+static struct clk_alpha_pll_postdiv ubi32_pll = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .width = 2,
+       .clkr.hw.init = &(const struct clk_init_data) {

drivers/clk/qcom/nsscc-ipq9574.c line 109

Quoted 10 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+               .name = "ubi32_pll",
+               .parent_hws = (const struct clk_hw *[]) {
+                       &ubi32_pll_main.clkr.hw
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+

[skipped clock tables, LGTM]

Quoted 17 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +17 -0
+static const struct of_device_id nss_cc_ipq9574_match_table[] = {
+       { .compatible = "qcom,ipq9574-nsscc" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, nss_cc_ipq9574_match_table);
+
+static int nss_cc_ipq9574_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       struct qcom_cc_desc nsscc_ipq9574_desc = nss_cc_ipq9574_desc;
+
+       int ret;
+
+       ret = devm_pm_runtime_enable(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c line 3062

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+       ret = devm_pm_clk_create(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_nsscc");

As we are switching to DT indices, better add new API that takes index rather than mixing indices and names.

sure okay

Thanks,
Devi Priya

Quoted 57 lines
Quoted 55 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +2 -0
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_nsscc

clock\n");

drivers/clk/qcom/nsscc-ipq9574.c new file +6 -0
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc");
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc

clock\n");

drivers/clk/qcom/nsscc-ipq9574.c new file +6 -0
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc_1");
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc_1

clock\n");

drivers/clk/qcom/nsscc-ipq9574.c new file +12 -0
+               return ret;
+       }
+
+       ret = pm_runtime_get(&pdev->dev);
+       if (ret)
+               return ret;
+
+       regmap = qcom_cc_map(pdev, &nsscc_ipq9574_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       clk_alpha_pll_configure(&ubi32_pll_main, regmap,

&ubi32_pll_config);

drivers/clk/qcom/nsscc-ipq9574.c new file +21 -1
+
+       return qcom_cc_really_probe(pdev, &nsscc_ipq9574_desc, regmap);
+}
+
+static const struct dev_pm_ops nss_cc_pm_ops = {
+       SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
+};
+
+static struct platform_driver nss_cc_ipq9574_driver = {
+       .probe = nss_cc_ipq9574_probe,
+       .driver = {
+               .name = "qcom,nsscc-ipq9574",
+               .of_match_table = nss_cc_ipq9574_match_table,
+               .pm = &nss_cc_pm_ops,
+       },
+};
+
+module_platform_driver(nss_cc_ipq9574_driver);
+
+MODULE_DESCRIPTION("QTI NSS_CC IPQ9574 Driver");
+MODULE_LICENSE("GPL");
--

2.34.1

author
#19 lore raw

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 135 lines · Devi Priya
Quoted 124 lines · Dmitry Baryshkov
Quoted 117 lines · Devi Priya
Quoted 113 lines · Devi Priya
Quoted 91 lines · Dmitry Baryshkov
Quoted 89 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based
devices.

---
   Changes in V2:
          - Added depends on ARM64 || COMPILE_TEST in Kconfig
          - Added module_platform_driver
          - Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc clocks as critical
             & added pm_clk for nssnoc clocks
          - Updated the uniphy clock names

   drivers/clk/qcom/Kconfig         |    7 +
   drivers/clk/qcom/Makefile        |    1 +
   drivers/clk/qcom/nsscc-ipq9574.c | 3109
++++++++++++++++++++++++++++++

   3 files changed, 3117 insertions(+)

   create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c

drivers/clk/qcom/Kconfig +0 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574

            i2c, USB, SD/eMMC, etc. Select this for the root clock of ipq9574.

drivers/clk/qcom/Kconfig +7 -0
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+

   config MSM_GCC_8660
          tristate "MSM8660 Global Clock Controller" depends on ARM || COMPILE_TEST

drivers/clk/qcom/Makefile +0 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o

   obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o +obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o

drivers/clk/qcom/nsscc-ipq9574.c new file +4 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights

reserved.
+ */

drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c line 34

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the changes merged?

Quoted 5 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Hi Dmitry,
Just curious to know if we could send out the next series with the proposed approach if that holds good.

Quoted 7 lines

The answer really depends on the structure of your hardware. The issue is that once you commit the device bindings,you have to support them forever. So, if you commit the NSS clock support without interconnects in place, you have to keep this ANOC/SNOC/etc code forever, even after you land the interconnect. So I'd suggest landing the icc driver first (or at least implementing and sending to the mailing list), so that we can see how all these pieces fit together.

Quoted 6 lines

Hi Dmitry,
Unlike MSM chipsets, IPQ chipsets does not have any use case wherein the NOC clocks have to be scaled. So if these clocks can be enabled in the probe, there is no need for an interconnect driver at all. The same applies to both ipq9574 and ipq5332 SoCs.

Hi Dmitry,
Just curious to know if we can go ahead with the proposed solution of enabling the NOC clocks in the probe as these clocks need not be scaled in IPQ chipsets & hence there would be no need for an ICC driver in ipq9574 & ipq5332 targets.

Thanks,
Devi Priya

Quoted 179 lines

Thanks,
Devi Priya

Quoted 177 lines
Quoted 174 lines

Thanks,
Devi Priya

Quoted 170 lines
Quoted 100 lines
Quoted 12 lines

+       DT_BIAS_PLL_CC_CLK,
+       DT_BIAS_PLL_NSS_NOC_CLK,
+       DT_BIAS_PLL_UBI_NC_CLK,
+       DT_GCC_GPLL0_OUT_AUX,
+       DT_UNIPHY0_NSS_RX_CLK,
+       DT_UNIPHY0_NSS_TX_CLK,
+       DT_UNIPHY1_NSS_RX_CLK,
+       DT_UNIPHY1_NSS_TX_CLK,
+       DT_UNIPHY2_NSS_RX_CLK,
+       DT_UNIPHY2_NSS_TX_CLK,
+       DT_XO,

As I wrote, please move DT_XO closer to the beginning of the list.

Quoted 55 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +41 -0
+};
+
+enum {
+       P_BIAS_PLL_CC_CLK,
+       P_BIAS_PLL_NSS_NOC_CLK,
+       P_BIAS_PLL_UBI_NC_CLK,
+       P_GCC_GPLL0_OUT_AUX,
+       P_UBI32_PLL_OUT_MAIN,
+       P_UNIPHY0_NSS_RX_CLK,
+       P_UNIPHY0_NSS_TX_CLK,
+       P_UNIPHY1_NSS_RX_CLK,
+       P_UNIPHY1_NSS_TX_CLK,
+       P_UNIPHY2_NSS_RX_CLK,
+       P_UNIPHY2_NSS_TX_CLK,
+       P_XO,
+};
+
+static const struct alpha_pll_config ubi32_pll_config = {
+       .l = 0x3e,
+       .alpha = 0x6666,
+       .config_ctl_val = 0x200d4aa8,
+       .config_ctl_hi_val = 0x3c,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .pre_div_val = 0x0,
+       .pre_div_mask = BIT(12),
+       .post_div_val = 0x0,
+       .post_div_mask = GENMASK(9, 8),
+       .alpha_en_mask = BIT(24),
+       .test_ctl_val = 0x1c0000c0,
+       .test_ctl_hi_val = 0x4000,
+};
+
+static struct clk_alpha_pll ubi32_pll_main = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .flags = SUPPORTS_DYNAMIC_UPDATE,
+       .clkr = {
+               .hw.init = &(const struct clk_init_data) {
+                       .name = "ubi32_pll_main",
+                       .parent_data = &(const struct 

clk_parent_data) {
+                               .index = DT_XO, +                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_huayra_ops, +               },
+       },

drivers/clk/qcom/nsscc-ipq9574.c new file +7 -0
+};
+
+static struct clk_alpha_pll_postdiv ubi32_pll = {
+       .offset = 0x28000,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_NSS_HUAYRA],
+       .width = 2,
+       .clkr.hw.init = &(const struct clk_init_data) {

drivers/clk/qcom/nsscc-ipq9574.c line 109

Quoted 10 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+               .name = "ubi32_pll",
+               .parent_hws = (const struct clk_hw *[]) {
+                       &ubi32_pll_main.clkr.hw
+               },
+               .num_parents = 1,
+               .ops = &clk_alpha_pll_postdiv_ro_ops,
+               .flags = CLK_SET_RATE_PARENT,
+       },
+};
+

[skipped clock tables, LGTM]

Quoted 17 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +17 -0
+static const struct of_device_id nss_cc_ipq9574_match_table[] = {
+       { .compatible = "qcom,ipq9574-nsscc" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, nss_cc_ipq9574_match_table);
+
+static int nss_cc_ipq9574_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       struct qcom_cc_desc nsscc_ipq9574_desc = nss_cc_ipq9574_desc;
+
+       int ret;
+
+       ret = devm_pm_runtime_enable(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
Quoted 8 lines
Quoted 5 lines

+       ret = devm_pm_clk_create(&pdev->dev);
+       if (ret < 0)
+               return ret;
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_nsscc");

As we are switching to DT indices, better add new API that takes index rather than mixing indices and names.

sure okay

Thanks,
Devi Priya

Quoted 58 lines
Quoted 56 lines

+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_nsscc clock\n");
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc"); +       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc clock\n");
+               return ret;
+       }
+
+       ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_snoc_1"); +       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to acquire nssnoc_snoc_1 clock\n");
+               return ret;
+       }

drivers/clk/qcom/nsscc-ipq9574.c new file +10 -0
+
+       ret = pm_runtime_get(&pdev->dev);
+       if (ret)
+               return ret;
+
+       regmap = qcom_cc_map(pdev, &nsscc_ipq9574_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       clk_alpha_pll_configure(&ubi32_pll_main, regmap,

&ubi32_pll_config);
+
+       return qcom_cc_really_probe(pdev, &nsscc_ipq9574_desc, regmap);

drivers/clk/qcom/nsscc-ipq9574.c new file +19 -0
+}
+
+static const struct dev_pm_ops nss_cc_pm_ops = {
+       SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
+};
+
+static struct platform_driver nss_cc_ipq9574_driver = {
+       .probe = nss_cc_ipq9574_probe,
+       .driver = {
+               .name = "qcom,nsscc-ipq9574",
+               .of_match_table = nss_cc_ipq9574_match_table,
+               .pm = &nss_cc_pm_ops,
+       },
+};
+
+module_platform_driver(nss_cc_ipq9574_driver);
+
+MODULE_DESCRIPTION("QTI NSS_CC IPQ9574 Driver");
+MODULE_LICENSE("GPL");
Signature · 1 line
2.34.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#20 lore raw

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 149 lines · Devi Priya
Quoted 138 lines · Devi Priya
Quoted 127 lines · Dmitry Baryshkov
Quoted 119 lines · Devi Priya
Quoted 115 lines · Devi Priya
Quoted 91 lines · Dmitry Baryshkov
Quoted 89 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based
devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc
clocks as critical
& added pm_clk for nssnoc clocks
- Updated the uniphy clock names

   drivers/clk/qcom/Kconfig         |    7 +
   drivers/clk/qcom/Makefile        |    1 +
   drivers/clk/qcom/nsscc-ipq9574.c | 3109
++++++++++++++++++++++++++++++
   3 files changed, 3117 insertions(+)

create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c

drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
            i2c, USB, SD/eMMC, etc. Select this for the root clock
            of ipq9574.
 
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+
   config MSM_GCC_8660
          tristate "MSM8660 Global Clock Controller"
          depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
   obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
   obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
   obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o
   obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
   obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
   obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +4 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights

reserved.
+ */

drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits
and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the
changes merged?

Quoted 5 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Hi Dmitry,
Just curious to know if we could send out the next series with the proposed approach if that holds good.

Quoted 7 lines

The answer really depends on the structure of your hardware. The issue is that once you commit the device bindings,you have to support them forever. So, if you commit the NSS clock support without interconnects in place, you have to keep this ANOC/SNOC/etc code forever, even after you land the interconnect. So I'd suggest landing the icc driver first (or at least implementing and sending to the mailing list), so that we can see how all these pieces fit together.

Quoted 6 lines

Hi Dmitry,
Unlike MSM chipsets, IPQ chipsets does not have any use case wherein the NOC clocks have to be scaled. So if these clocks can be enabled in the probe, there is no need for an interconnect driver at all. The same applies to both ipq9574 and ipq5332 SoCs.

Quoted 5 lines

Hi Dmitry,
Just curious to know if we can go ahead with the proposed solution of enabling the NOC clocks in the probe as these clocks need not be scaled in IPQ chipsets & hence there would be no need for an ICC driver in ipq9574 & ipq5332 targets.

In the probe of which driver?

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

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 150 lines · Dmitry Baryshkov
Quoted 149 lines · Devi Priya
Quoted 144 lines · Devi Priya
Quoted 127 lines · Dmitry Baryshkov
Quoted 119 lines · Devi Priya
Quoted 115 lines · Devi Priya
Quoted 91 lines · Dmitry Baryshkov
Quoted 89 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based
devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc
clocks as critical
& added pm_clk for nssnoc clocks
- Updated the uniphy clock names

drivers/clk/qcom/Kconfig | 7 +
drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/nsscc-ipq9574.c | 3109
++++++++++++++++++++++++++++++

    3 files changed, 3117 insertions(+)
    create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c
drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
             i2c, USB, SD/eMMC, etc. Select this for the root clock
             of ipq9574.
 
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+
    config MSM_GCC_8660
           tristate "MSM8660 Global Clock Controller"
           depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
    obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
    obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
    obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o
    obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
    obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
    obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +4 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights

reserved.
+ */

drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits
and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the
changes merged?

Quoted 5 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Hi Dmitry,
Just curious to know if we could send out the next series with the proposed approach if that holds good.

Quoted 7 lines

The answer really depends on the structure of your hardware. The issue is that once you commit the device bindings,you have to support them forever. So, if you commit the NSS clock support without interconnects in place, you have to keep this ANOC/SNOC/etc code forever, even after you land the interconnect. So I'd suggest landing the icc driver first (or at least implementing and sending to the mailing list), so that we can see how all these pieces fit together.

Hi Dmitry,
Unlike MSM chipsets, IPQ chipsets does not have any use case wherein the NOC clocks have to be scaled. So if these clocks can be enabled in the probe, there is no need for an interconnect driver at all. The same applies to both ipq9574 and ipq5332 SoCs.

Quoted 7 lines
Quoted 5 lines

Hi Dmitry,
Just curious to know if we can go ahead with the proposed solution of enabling the NOC clocks in the probe as these clocks need not be scaled in IPQ chipsets & hence there would be no need for an ICC driver in ipq9574 & ipq5332 targets.

In the probe of which driver?

GCC driver of ipq9574 & ipq5332 targets.

Thanks,
Devi Priya

Quoted 3 lines

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#22 lore raw

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 154 lines · Devi Priya
Quoted 150 lines · Dmitry Baryshkov
Quoted 149 lines · Devi Priya
Quoted 144 lines · Devi Priya
Quoted 127 lines · Dmitry Baryshkov
Quoted 119 lines · Devi Priya
Quoted 115 lines · Devi Priya
Quoted 91 lines · Dmitry Baryshkov
Quoted 89 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based
devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc
clocks as critical
& added pm_clk for nssnoc clocks
- Updated the uniphy clock names

drivers/clk/qcom/Kconfig | 7 +
drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/nsscc-ipq9574.c | 3109
++++++++++++++++++++++++++++++

    3 files changed, 3117 insertions(+)
    create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c
drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
             i2c, USB, SD/eMMC, etc. Select this for the root clock
             of ipq9574.
 
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+
    config MSM_GCC_8660
           tristate "MSM8660 Global Clock Controller"
           depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
    obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
    obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
    obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o
    obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
    obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
    obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +4 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights

reserved.
+ */

drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits
and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the
changes merged?

Quoted 5 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Hi Dmitry,
Just curious to know if we could send out the next series with the proposed approach if that holds good.

Quoted 7 lines

The answer really depends on the structure of your hardware. The issue is that once you commit the device bindings,you have to support them forever. So, if you commit the NSS clock support without interconnects in place, you have to keep this ANOC/SNOC/etc code forever, even after you land the interconnect. So I'd suggest landing the icc driver first (or at least implementing and sending to the mailing list), so that we can see how all these pieces fit together.

Hi Dmitry,
Unlike MSM chipsets, IPQ chipsets does not have any use case wherein the NOC clocks have to be scaled. So if these clocks can be enabled in the probe, there is no need for an interconnect driver at all. The same applies to both ipq9574 and ipq5332 SoCs.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Hi Dmitry,
Just curious to know if we can go ahead with the proposed solution of enabling the NOC clocks in the probe as these clocks need not be scaled in IPQ chipsets & hence there would be no need for an ICC driver in ipq9574 & ipq5332 targets.

In the probe of which driver?

GCC driver of ipq9574 & ipq5332 targets.

Would you need to handle these clocks additionally in the suspend/resume path? Will this increase the power consumption of the board?

Generally, I'd say this looks like a bad idea. Consider all the troubles we are undergoing now while sorting out the NIU clocks on RPM and RPMH platforms.
So, unless you are 100% sure that this is a permanent solution (like AHB clocks being always on), I'd kindly suggest implementing the NoC attachment properly. In the end, other Qualcomm platforms use ICC drivers, so by following this pattern we will have more common code paths.

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

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 168 lines · Dmitry Baryshkov
Quoted 154 lines · Devi Priya
Quoted 150 lines · Dmitry Baryshkov
Quoted 149 lines · Devi Priya
Quoted 144 lines · Devi Priya
Quoted 127 lines · Dmitry Baryshkov
Quoted 119 lines · Devi Priya
Quoted 115 lines · Devi Priya
Quoted 91 lines · Dmitry Baryshkov
Quoted 89 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based
devices.

---
Changes in V2:
- Added depends on ARM64 || COMPILE_TEST in Kconfig
- Added module_platform_driver
- Dropped patch [2/6] - clk: qcom: gcc-ipq9574: Mark nssnoc
clocks as critical
& added pm_clk for nssnoc clocks
- Updated the uniphy clock names

drivers/clk/qcom/Kconfig | 7 +
drivers/clk/qcom/Makefile | 1 +
drivers/clk/qcom/nsscc-ipq9574.c | 3109
++++++++++++++++++++++++++++++

     3 files changed, 3117 insertions(+)
     create mode 100644 drivers/clk/qcom/nsscc-ipq9574.c
drivers/clk/qcom/Kconfig +7 -0
index bd9bfb11b328..3ecc11e2c8e3 100644
@@ -203,6 +203,13 @@ config IPQ_GCC_9574
              i2c, USB, SD/eMMC, etc. Select this for the root clock
              of ipq9574.
 
+config IPQ_NSSCC_9574
+       tristate "IPQ9574 NSS Clock Controller"
+       depends on ARM64 || COMPILE_TEST
+       depends on IPQ_GCC_9574
+       help
+         Support for NSS clock controller on ipq9574 devices.
+
     config MSM_GCC_8660
            tristate "MSM8660 Global Clock Controller"
            depends on ARM || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 4790c8cca426..3f084928962e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
     obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
     obj-$(CONFIG_IPQ_GCC_8074) += gcc-ipq8074.o
     obj-$(CONFIG_IPQ_GCC_9574) += gcc-ipq9574.o
+obj-$(CONFIG_IPQ_NSSCC_9574)   += nsscc-ipq9574.o
     obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o
     obj-$(CONFIG_MDM_GCC_9607) += gcc-mdm9607.o
     obj-$(CONFIG_MDM_GCC_9615) += gcc-mdm9615.o
drivers/clk/qcom/nsscc-ipq9574.c new file +4 -0
new file mode 100644
index 000000000000..65bdb449ae5f
@@ -0,0 +1,3109 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights

reserved.
+ */

drivers/clk/qcom/nsscc-ipq9574.c new file +24 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/pm_clock.h>
+#include <linux/pm_runtime.h>
+
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "common.h"
+#include "reset.h"
+
Quoted 8 lines

drivers/clk/qcom/nsscc-ipq9574.c

Quoted 5 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +5 -0
+/* Need to match the order of clocks in DT binding */
+enum {
+       DT_NSSNOC_NSSCC_CLK,
+       DT_NSSNOC_SNOC_CLK,
+       DT_NSSNOC_SNOC_1_CLK,

Not using the index makes it seem that these clocks are not used, until one scrolls down to pm_clks.

Okay, got it

Quoted 3 lines

BTW: The NSSNOC_SNOC clocks make it look like there is an interconnect here (not a simple NIU).

Hi Dmitry, We are exploring on the ICC driver. In the meantime to unblock PCIe/NSS changes getting merged, shall we use regmap_update_bits
and turn on the critical NSSNOC clocks, ANOC & SNOC pcie clocks in the probe function of the gcc driver itself as like sm8550 driver to get the
changes merged?

Quoted 5 lines
Quoted 1 line

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/clk/qcom/gcc-sm8550.c#n3347

Hi Dmitry,
Just curious to know if we could send out the next series with the proposed approach if that holds good.

Quoted 7 lines

The answer really depends on the structure of your hardware. The issue is that once you commit the device bindings,you have to support them forever. So, if you commit the NSS clock support without interconnects in place, you have to keep this ANOC/SNOC/etc code forever, even after you land the interconnect. So I'd suggest landing the icc driver first (or at least implementing and sending to the mailing list), so that we can see how all these pieces fit together.

Hi Dmitry,
Unlike MSM chipsets, IPQ chipsets does not have any use case wherein the NOC clocks have to be scaled. So if these clocks can be enabled in the probe, there is no need for an interconnect driver at all. The same applies to both ipq9574 and ipq5332 SoCs.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Hi Dmitry,
Just curious to know if we can go ahead with the proposed solution of enabling the NOC clocks in the probe as these clocks need not be scaled in IPQ chipsets & hence there would be no need for an ICC driver in ipq9574 & ipq5332 targets.

In the probe of which driver?

GCC driver of ipq9574 & ipq5332 targets.

Would you need to handle these clocks additionally in the suspend/resume path? Will this increase the power consumption of the board?

Quoted 9 lines

Generally, I'd say this looks like a bad idea. Consider all the troubles we are undergoing now while sorting out the NIU clocks on RPM and RPMH platforms.
So, unless you are 100% sure that this is a permanent solution (like AHB clocks being always on), I'd kindly suggest implementing the NoC attachment properly. In the end, other Qualcomm platforms use ICC drivers, so by following this pattern we will have more common code paths.

Hi Dmitry,

Having these clocks always on seems to be a permanent solution and we do not foresee any issues in our SoCs.

Thanks,
Devi Priya

#24 lore raw

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

In reply to Devi Priya
Quoted 5 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based devices.

---

[...]

drivers/clk/qcom/nsscc-ipq9574.c line 2908

Quoted 1 line
drivers/clk/qcom/nsscc-ipq9574.c new file +1 -0
+	[UBI3_CLKRST_CLAMP_ENABLE] = { 0x28A04, 9 },

Please make all hex lowercase.

[...]

drivers/clk/qcom/nsscc-ipq9574.c line 3006

Quoted 1 line
drivers/clk/qcom/nsscc-ipq9574.c new file +1 -0
+	[PPE_FULL_RESET] = { 0x28A08, 0, 1, 0x1E0000 },

{ .reg = 0x28a08, .bitmask = GENMASK(foo,bar) },

[...]

drivers/clk/qcom/nsscc-ipq9574.c line 3065

Quoted 12 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +12 -0
+	ret = devm_pm_runtime_enable(&pdev->dev);
+	if (ret < 0)
+		return ret;
+
+	ret = devm_pm_clk_create(&pdev->dev);
+	if (ret < 0)
+		return ret;
+
+	ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_nsscc");
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Failed to acquire nssnoc_nsscc clock\n");
+		return ret;

dev_err_probe, everywhere?

Konrad

author
#25 lore raw

Re: [PATCH V2 5/7] clk: qcom: Add NSS clock Controller driver for IPQ9574

Quoted 10 lines · Konrad Dybcio
Quoted 5 lines · Devi Priya

Add Networking Sub System Clock Controller(NSSCC) driver for ipq9574 based devices.

---

[...]

drivers/clk/qcom/nsscc-ipq9574.c line 2908

Quoted 1 line
drivers/clk/qcom/nsscc-ipq9574.c new file +1 -0
+	[UBI3_CLKRST_CLAMP_ENABLE] = { 0x28A04, 9 },

Please make all hex lowercase.

Okay

Quoted 5 lines

[...]

drivers/clk/qcom/nsscc-ipq9574.c line 3006

Quoted 1 line
drivers/clk/qcom/nsscc-ipq9574.c new file +1 -0
+	[PPE_FULL_RESET] = { 0x28A08, 0, 1, 0x1E0000 },

{ .reg = 0x28a08, .bitmask = GENMASK(foo,bar) },

Sure, okay

Quoted 16 lines

[...]

drivers/clk/qcom/nsscc-ipq9574.c line 3065

Quoted 12 lines
drivers/clk/qcom/nsscc-ipq9574.c new file +12 -0
+	ret = devm_pm_runtime_enable(&pdev->dev);
+	if (ret < 0)
+		return ret;
+
+	ret = devm_pm_clk_create(&pdev->dev);
+	if (ret < 0)
+		return ret;
+
+	ret = of_pm_clk_add_clk(&pdev->dev, "nssnoc_nsscc");
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Failed to acquire nssnoc_nsscc clock\n");
+		return ret;

dev_err_probe, everywhere?

Okay

Thanks,
Devi Priya

Quoted 2 lines

Konrad

author
#26 lore raw

PATCH v2 6/7 arm64: dts: qcom: ipq9574: Add support for nsscc node

In reply to Devi Priya

Add a node for the nss clock controller found on ipq9574 based devices.

---
Changes in V2:
- Dropped the fixed clock node gcc_gpll0_out_aux and added support for the same in gcc driver
- Updated the node name to clock-controller@39b00000
- Added clock-names to retrieve the nssnoc clocks and add them to the list of pm clocks in nss driver

 arch/arm64/boot/dts/qcom/ipq9574.dtsi | 48 +++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
arch/arm64/boot/dts/qcom/ipq9574.dtsi +48 -0
index 51aba071c1eb..903311547e96 100644
@@ -10,6 +10,8 @@
 #include <dt-bindings/clock/qcom,ipq9574-gcc.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/reset/qcom,ipq9574-gcc.h>
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
@@ -18,6 +20,24 @@ / {
 	#size-cells = <2>;
 
 	clocks {
+		bias_pll_cc_clk: bias-pll-cc-clk {
+			compatible = "fixed-clock";
+			clock-frequency = <1200000000>;
+			#clock-cells = <0>;
+		};
+
+		bias_pll_nss_noc_clk: bias-pll-nss-noc-clk {
+			compatible = "fixed-clock";
+			clock-frequency = <461500000>;
+			#clock-cells = <0>;
+		};
+
+		bias_pll_ubi_nc_clk: bias-pll-ubi-nc-clk {
+			compatible = "fixed-clock";
+			clock-frequency = <353000000>;
+			#clock-cells = <0>;
+		};
+
 		sleep_clk: sleep-clk {
 			compatible = "fixed-clock";
 			#clock-cells = <0>;
@@ -722,6 +742,34 @@ frame@b128000 {
 				status = "disabled";
 			};
 		};
+
+		nsscc: clock-controller@39b00000 {
+			compatible = "qcom,ipq9574-nsscc";
+			reg = <0x39b00000 0x80000>;
+			clocks = <&gcc GCC_NSSNOC_NSSCC_CLK>,
+				 <&gcc GCC_NSSNOC_SNOC_CLK>,
+				 <&gcc GCC_NSSNOC_SNOC_1_CLK>,
+				 <&bias_pll_cc_clk>,
+				 <&bias_pll_nss_noc_clk>,
+				 <&bias_pll_ubi_nc_clk>,
+				 <&gcc GPLL0_OUT_AUX>,
+				 <0>,
+				 <0>,
+				 <0>,
+				 <0>,
+				 <0>,
+				 <0>,
+				 <&xo_board_clk>;
+			clock-names = "nssnoc_nsscc", "nssnoc_snoc", "nssnoc_snoc_1",
+				      "bias_pll_cc_clk", "bias_pll_nss_noc_clk",
+				      "bias_pll_ubi_nc_clk", "gpll0_out_aux", "uniphy0_nss_rx_clk",
+				      "uniphy0_nss_tx_clk", "uniphy1_nss_rx_clk",
+				      "uniphy1_nss_tx_clk", "uniphy2_nss_rx_clk",
+				      "uniphy2_nss_tx_clk", "xo_board_clk";
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			#power-domain-cells = <1>;
+		};
 	};
 
 	thermal-zones {
Signature · 1 line
2.34.1
#27 lore raw

Re: [PATCH V2 6/7] arm64: dts: qcom: ipq9574: Add support for nsscc node

Quoted 39 lines · Devi Priya

Add a node for the nss clock controller found on ipq9574 based devices.

---
Changes in V2:
- Dropped the fixed clock node gcc_gpll0_out_aux and added support for the same in gcc driver
- Updated the node name to clock-controller@39b00000
- Added clock-names to retrieve the nssnoc clocks and add them to the list of pm clocks in nss driver

 arch/arm64/boot/dts/qcom/ipq9574.dtsi | 48 +++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
arch/arm64/boot/dts/qcom/ipq9574.dtsi +9 -0
index 51aba071c1eb..903311547e96 100644
@@ -10,6 +10,8 @@
 #include <dt-bindings/clock/qcom,ipq9574-gcc.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/reset/qcom,ipq9574-gcc.h>
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
@@ -18,6 +20,24 @@ / {
        #size-cells = <2>;
 
        clocks {
+               bias_pll_cc_clk: bias-pll-cc-clk {
+                       compatible = "fixed-clock";
+                       clock-frequency = <1200000000>;
+                       #clock-cells = <0>;
+               };
+
+               bias_pll_nss_noc_clk: bias-pll-nss-noc-clk {

arch/arm64/boot/dts/qcom/ipq9574.dtsi / { · line 39

Quoted 10 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +10 -0
+                       compatible = "fixed-clock";
+                       clock-frequency = <461500000>;
+                       #clock-cells = <0>;
+               };
+
+               bias_pll_ubi_nc_clk: bias-pll-ubi-nc-clk {
+                       compatible = "fixed-clock";
+                       clock-frequency = <353000000>;
+                       #clock-cells = <0>;
+               };

Which part provides these clocks?

Quoted 16 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +9 -0
+
                sleep_clk: sleep-clk {
                        compatible = "fixed-clock";
                        #clock-cells = <0>;
@@ -722,6 +742,34 @@ frame@b128000 {
                                status = "disabled";
                        };
                };
+
+               nsscc: clock-controller@39b00000 {
+                       compatible = "qcom,ipq9574-nsscc";
+                       reg = <0x39b00000 0x80000>;
+                       clocks = <&gcc GCC_NSSNOC_NSSCC_CLK>,
+                                <&gcc GCC_NSSNOC_SNOC_CLK>,
+                                <&gcc GCC_NSSNOC_SNOC_1_CLK>,
+                                <&bias_pll_cc_clk>,

arch/arm64/boot/dts/qcom/ipq9574.dtsi frame@b128000 { · line 762

Quoted 10 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +10 -0
+                                <&bias_pll_nss_noc_clk>,
+                                <&bias_pll_ubi_nc_clk>,
+                                <&gcc GPLL0_OUT_AUX>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <&xo_board_clk>;

If you move xo_board closer to the start of the list, it will be slightly easier to review.

arch/arm64/boot/dts/qcom/ipq9574.dtsi frame@b128000 { · line 768

Quoted 6 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +6 -0
+                       clock-names = "nssnoc_nsscc", "nssnoc_snoc", "nssnoc_snoc_1",
+                                     "bias_pll_cc_clk", "bias_pll_nss_noc_clk",
+                                     "bias_pll_ubi_nc_clk", "gpll0_out_aux", "uniphy0_nss_rx_clk",
+                                     "uniphy0_nss_tx_clk", "uniphy1_nss_rx_clk",
+                                     "uniphy1_nss_tx_clk", "uniphy2_nss_rx_clk",
+                                     "uniphy2_nss_tx_clk", "xo_board_clk";

You are using clock indices. Please drop clock-names.

Quoted 10 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +4 -1
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+                       #power-domain-cells = <1>;
+               };
        };
 
        thermal-zones {
--

2.34.1

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

Re: [PATCH V2 6/7] arm64: dts: qcom: ipq9574: Add support for nsscc node

Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Devi Priya

Add a node for the nss clock controller found on ipq9574 based devices.

---
Changes in V2:
- Dropped the fixed clock node gcc_gpll0_out_aux and added support for the same in gcc driver
- Updated the node name to clock-controller@39b00000
- Added clock-names to retrieve the nssnoc clocks and add them to the list of pm clocks in nss driver

  arch/arm64/boot/dts/qcom/ipq9574.dtsi | 48 +++++++++++++++++++++++++++
  1 file changed, 48 insertions(+)
arch/arm64/boot/dts/qcom/ipq9574.dtsi +13 -0
index 51aba071c1eb..903311547e96 100644
@@ -10,6 +10,8 @@
  #include <dt-bindings/clock/qcom,ipq9574-gcc.h>
  #include <dt-bindings/interrupt-controller/arm-gic.h>
  #include <dt-bindings/reset/qcom,ipq9574-gcc.h>
+#include <dt-bindings/clock/qcom,ipq9574-nsscc.h>
+#include <dt-bindings/reset/qcom,ipq9574-nsscc.h>
  #include <dt-bindings/thermal/thermal.h>
 
  / {
@@ -18,6 +20,24 @@ / {
         #size-cells = <2>;
 
         clocks {
+               bias_pll_cc_clk: bias-pll-cc-clk {
+                       compatible = "fixed-clock";
+                       clock-frequency = <1200000000>;
+                       #clock-cells = <0>;
+               };
+
+               bias_pll_nss_noc_clk: bias-pll-nss-noc-clk {
+                       compatible = "fixed-clock";
+                       clock-frequency = <461500000>;
+                       #clock-cells = <0>;
+               };
Quoted 8 lines

arch/arm64/boot/dts/qcom/ipq9574.dtsi / { · line 39

Quoted 6 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +6 -0
+
+               bias_pll_ubi_nc_clk: bias-pll-ubi-nc-clk {
+                       compatible = "fixed-clock";
+                       clock-frequency = <353000000>;
+                       #clock-cells = <0>;
+               };

Which part provides these clocks?

The Bias PLL generates these clocks based on the reference clock.

Quoted 22 lines
Quoted 22 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +14 -0
+
                 sleep_clk: sleep-clk {
                         compatible = "fixed-clock";
                         #clock-cells = <0>;
@@ -722,6 +742,34 @@ frame@b128000 {
                                 status = "disabled";
                         };
                 };
+
+               nsscc: clock-controller@39b00000 {
+                       compatible = "qcom,ipq9574-nsscc";
+                       reg = <0x39b00000 0x80000>;
+                       clocks = <&gcc GCC_NSSNOC_NSSCC_CLK>,
+                                <&gcc GCC_NSSNOC_SNOC_CLK>,
+                                <&gcc GCC_NSSNOC_SNOC_1_CLK>,
+                                <&bias_pll_cc_clk>,
+                                <&bias_pll_nss_noc_clk>,
+                                <&bias_pll_ubi_nc_clk>,
+                                <&gcc GPLL0_OUT_AUX>,
+                                <0>,
+                                <0>,
Quoted 8 lines

arch/arm64/boot/dts/qcom/ipq9574.dtsi frame@b128000 { · line 762

Quoted 5 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +5 -0
+                                <0>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <&xo_board_clk>;

If you move xo_board closer to the start of the list, it will be slightly easier to review.

Sure okay

Quoted 9 lines

arch/arm64/boot/dts/qcom/ipq9574.dtsi frame@b128000 { · line 768

Quoted 7 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +6 -0
+                       clock-names = "nssnoc_nsscc", "nssnoc_snoc", "nssnoc_snoc_1",
+                                     "bias_pll_cc_clk", "bias_pll_nss_noc_clk",
+                                     "bias_pll_ubi_nc_clk", "gpll0_out_aux", "uniphy0_nss_rx_clk",
+                                     "uniphy0_nss_tx_clk", "uniphy1_nss_rx_clk",
+                                     "uniphy1_nss_tx_clk", "uniphy2_nss_rx_clk",
+                                     "uniphy2_nss_tx_clk", "xo_board_clk";

You are using clock indices. Please drop clock-names.

Sure okay

Thanks,
Devi Priya

Quoted 13 lines
Quoted 11 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +4 -1
+                       #clock-cells = <1>;
+                       #reset-cells = <1>;
+                       #power-domain-cells = <1>;
+               };
         };
 
         thermal-zones {
--

2.34.1

#29 lore raw

Re: [PATCH V2 6/7] arm64: dts: qcom: ipq9574: Add support for nsscc node

In reply to Dmitry Baryshkov

Hi Dmitry,

Quoted 45 lines · Dmitry Baryshkov
Quoted 30 lines · Devi Priya

Add a node for the nss clock controller found on ipq9574 based devices.

---
Changes in V2:
- Dropped the fixed clock node gcc_gpll0_out_aux and added support for the same in gcc driver
- Updated the node name to clock-controller@39b00000
- Added clock-names to retrieve the nssnoc clocks and add them to the list of pm clocks in nss driver

 arch/arm64/boot/dts/qcom/ipq9574.dtsi | 48 +++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
arch/arm64/boot/dts/qcom/ipq9574.dtsi +8 -0
index 51aba071c1eb..903311547e96 100644
@@ -722,6 +742,34 @@ frame@b128000 {
                                status = "disabled";
                        };
                };
+
+               nsscc: clock-controller@39b00000 {
+                       compatible = "qcom,ipq9574-nsscc";
+                       reg = <0x39b00000 0x80000>;
+                       clocks = <&gcc GCC_NSSNOC_NSSCC_CLK>,
+                                <&gcc GCC_NSSNOC_SNOC_CLK>,
+                                <&gcc GCC_NSSNOC_SNOC_1_CLK>,
+                                <&bias_pll_cc_clk>,

arch/arm64/boot/dts/qcom/ipq9574.dtsi frame@b128000 { · line 762

Quoted 10 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +10 -0
+                                <&bias_pll_nss_noc_clk>,
+                                <&bias_pll_ubi_nc_clk>,
+                                <&gcc GPLL0_OUT_AUX>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <0>,
+                                <&xo_board_clk>;

If you move xo_board closer to the start of the list, it will be slightly easier to review.

Quoted 8 lines

arch/arm64/boot/dts/qcom/ipq9574.dtsi frame@b128000 { · line 768

Quoted 6 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +6 -0
+                       clock-names = "nssnoc_nsscc", "nssnoc_snoc", "nssnoc_snoc_1",
+                                     "bias_pll_cc_clk", "bias_pll_nss_noc_clk",
+                                     "bias_pll_ubi_nc_clk", "gpll0_out_aux", "uniphy0_nss_rx_clk",
+                                     "uniphy0_nss_tx_clk", "uniphy1_nss_rx_clk",
+                                     "uniphy1_nss_tx_clk", "uniphy2_nss_rx_clk",
+                                     "uniphy2_nss_tx_clk", "xo_board_clk";

You are using clock indices. Please drop clock-names.

What do you mean by "using clock indices"?
Note that the "clock-names" property is required according to the DT bindings.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#30 lore raw

Re: [PATCH V2 6/7] arm64: dts: qcom: ipq9574: Add support for nsscc node

Quoted 8 lines · Geert Uytterhoeven
Quoted 8 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +6 -0
+                       clock-names = "nssnoc_nsscc", "nssnoc_snoc", "nssnoc_snoc_1",
+                                     "bias_pll_cc_clk", "bias_pll_nss_noc_clk",
+                                     "bias_pll_ubi_nc_clk", "gpll0_out_aux", "uniphy0_nss_rx_clk",
+                                     "uniphy0_nss_tx_clk", "uniphy1_nss_rx_clk",
+                                     "uniphy1_nss_tx_clk", "uniphy2_nss_rx_clk",
+                                     "uniphy2_nss_tx_clk", "xo_board_clk";
Quoted 4 lines
Quoted 1 line

You are using clock indices. Please drop clock-names.

What do you mean by "using clock indices"?
Note that the "clock-names" property is required according to the DT bindings.

Indeed, thanks for pointing this out. Probably bindings should be changed.

Best regards,
Krzysztof

#31 lore raw

Re: [PATCH V2 6/7] arm64: dts: qcom: ipq9574: Add support for nsscc node

Hi Krzysztof,

Quoted 9 lines · Krzysztof Kozlowski
Quoted 8 lines · Geert Uytterhoeven
Quoted 8 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +6 -0
+                       clock-names = "nssnoc_nsscc", "nssnoc_snoc", "nssnoc_snoc_1",
+                                     "bias_pll_cc_clk", "bias_pll_nss_noc_clk",
+                                     "bias_pll_ubi_nc_clk", "gpll0_out_aux", "uniphy0_nss_rx_clk",
+                                     "uniphy0_nss_tx_clk", "uniphy1_nss_rx_clk",
+                                     "uniphy1_nss_tx_clk", "uniphy2_nss_rx_clk",
+                                     "uniphy2_nss_tx_clk", "xo_board_clk";
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

You are using clock indices. Please drop clock-names.

What do you mean by "using clock indices"?
Note that the "clock-names" property is required according to the DT bindings.

Indeed, thanks for pointing this out. Probably bindings should be changed.

But what's so great about not having "clock-names"? There are _14_ input clocks.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#32 lore raw

Re: [PATCH V2 6/7] arm64: dts: qcom: ipq9574: Add support for nsscc node

Quoted 15 lines · Geert Uytterhoeven

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Geert Uytterhoeven
Quoted 9 lines

arch/arm64/boot/dts/qcom/ipq9574.dtsi frame@b128000 { · line 768

Quoted 7 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +6 -0
+                       clock-names = "nssnoc_nsscc", "nssnoc_snoc", "nssnoc_snoc_1",
+                                     "bias_pll_cc_clk", "bias_pll_nss_noc_clk",
+                                     "bias_pll_ubi_nc_clk", "gpll0_out_aux", "uniphy0_nss_rx_clk",
+                                     "uniphy0_nss_tx_clk", "uniphy1_nss_rx_clk",
+                                     "uniphy1_nss_tx_clk", "uniphy2_nss_rx_clk",
+                                     "uniphy2_nss_tx_clk", "xo_board_clk";

You are using clock indices. Please drop clock-names.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

What do you mean by "using clock indices"?
Note that the "clock-names" property is required according to the DT bindings.

Indeed, thanks for pointing this out. Probably bindings should be changed.

But what's so great about not having "clock-names"? There are _14_ input clocks.

clk_parent_data has an "index" member, which lets us bind clocks[n] to parent[n]. With the DT properties being ABI, including the order of entries within, that lets us get rid of clock-names and the matching is marginally faster.

Konrad

#33 lore raw

Re: [PATCH V2 6/7] arm64: dts: qcom: ipq9574: Add support for nsscc node

In reply to Geert Uytterhoeven
Quoted 15 lines · Geert Uytterhoeven

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Geert Uytterhoeven
Quoted 9 lines

arch/arm64/boot/dts/qcom/ipq9574.dtsi frame@b128000 { · line 768

Quoted 7 lines
arch/arm64/boot/dts/qcom/ipq9574.dtsi +6 -0
+                       clock-names = "nssnoc_nsscc", "nssnoc_snoc", "nssnoc_snoc_1",
+                                     "bias_pll_cc_clk", "bias_pll_nss_noc_clk",
+                                     "bias_pll_ubi_nc_clk", "gpll0_out_aux", "uniphy0_nss_rx_clk",
+                                     "uniphy0_nss_tx_clk", "uniphy1_nss_rx_clk",
+                                     "uniphy1_nss_tx_clk", "uniphy2_nss_rx_clk",
+                                     "uniphy2_nss_tx_clk", "xo_board_clk";

You are using clock indices. Please drop clock-names.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

What do you mean by "using clock indices"?
Note that the "clock-names" property is required according to the DT bindings.

Indeed, thanks for pointing this out. Probably bindings should be changed.

But what's so great about not having "clock-names"? There are _14_ input clocks.

There is nothing particularly wrong. They are just not used by Linux implementation and they confuse people into thinking items are not strictly ordered. Thus agreement long time ago for Qualcomm clock controllers was to drop the clock-names to avoid that confusion and make it explicit.

Best regards,
Krzysztof

author
#34 lore raw

PATCH v2 7/7 arm64: defconfig: Build NSS Clock Controller driver for IPQ9574

In reply to Devi Priya

Build Qualcomm IPQ9574 NSSCC driver.

---
Changes in V2:
- Build IPQ9574 NSSCC driver as a module

 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 5315789f4868..a6406eef43c8 100644
@@ -1211,6 +1211,7 @@ CONFIG_IPQ_GCC_5018=y
 CONFIG_IPQ_GCC_6018=y
 CONFIG_IPQ_GCC_8074=y
 CONFIG_IPQ_GCC_9574=y
+CONFIG_IPQ_NSSCC_9574=m
 CONFIG_MSM_GCC_8916=y
 CONFIG_MSM_GCC_8994=y
 CONFIG_MSM_GCC_8996=y
Signature · 1 line
2.34.1