Skip to contentSkip to conversation

Add Global Clock Controller (GCC) driver for SM7250

PATCH New Sreeshankar K 2 participants 4 messages Aug 16

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

cover Add Global Clock Controller (GCC) driver for SM7250

This patchset adds support for the global clock controller found on SM7250 based devices. This should allow most non-multimedia device drivers to probe and control their clocks.

Sreeshankar K (2):
clk: qcom: Add Global Clock Controller (GCC) driver for SM7250
dt-bindings: clock: Add GCC clock bindings for SM7250

 .../bindings/clock/qcom,gcc-sm7250.yaml       |   60 +
 drivers/clk/qcom/Kconfig                      |    9 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/gcc-sm7250.c                 | 2347 +++++++++++++++++
 include/dt-bindings/clock/qcom,gcc-sm7250.h   |  163 ++
 5 files changed, 2580 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sm7250.yaml
 create mode 100644 drivers/clk/qcom/gcc-sm7250.c
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm7250.h
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 clk: qcom: Add Global Clock Controller (GCC) driver for SM7250

Add support for the global clock controller found on SM7250 based devices. This should allow most non-multimedia device drivers to probe and control their clocks.

---
 drivers/clk/qcom/Kconfig      |    9 +
 drivers/clk/qcom/Makefile     |    1 +
 drivers/clk/qcom/gcc-sm7250.c | 2347 +++++++++++++++++++++++++++++++++
 3 files changed, 2357 insertions(+)
 create mode 100644 drivers/clk/qcom/gcc-sm7250.c
drivers/clk/qcom/Kconfig +9 -0
index 7d84c2f1d..3e1eac14e 100644
@@ -1416,6 +1416,15 @@ config SM_GCC_7150
 	  Say Y if you want to use peripheral devices such as UART,
 	  SPI, I2C, USB, SD/UFS, PCIe etc.
 
+config SM_GCC_7250
+        tristate "SM7250 Global Clock Controller"
+        depends on ARM64 || COMPILE_TEST
+        select QCOM_GDSC
+        help
+          Support for the global clock controller on SM7250 devices.
+          Say Y if you want to use peripheral devices such as UART,
+          SPI, I2C, USB, SD/UFS, PCIe etc.
+
 config SM_GCC_MILOS
 	tristate "Milos Global Clock Controller"
 	depends on ARM64 || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
index 58f9a5eb6..18414089c 100644
@@ -174,6 +174,7 @@ obj-$(CONFIG_SM_GCC_6125) += gcc-sm6125.o
 obj-$(CONFIG_SM_GCC_6350) += gcc-sm6350.o
 obj-$(CONFIG_SM_GCC_6375) += gcc-sm6375.o
 obj-$(CONFIG_SM_GCC_7150) += gcc-sm7150.o
+obj-$(CONFIG_SM_GCC_7250) += gcc-sm7250.o
 obj-$(CONFIG_SM_GCC_8150) += gcc-sm8150.o
 obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o
 obj-$(CONFIG_SM_GCC_8350) += gcc-sm8350.o
drivers/clk/qcom/gcc-sm7250.c new file +2347 -0

2,347 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/2] clk: qcom: Add Global Clock Controller (GCC) driver for SM7250

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [High] gcc_cpuss_gnoc_clk is incorrectly configured with its enable_reg pointing to its CBCR instead of a…

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] gcc_cpuss_gnoc_clk is incorrectly configured with its enable_reg pointing to its CBCR instead of a central vote register, and uses an invalid enable_mask.
- [Low] Unused static constant arrays gcc_parent_map_5 and gcc_parent_data_5.
- [Low] Incorrect space-based indentation in Kconfig block for SM_GCC_7250.
- [Low] The dt-bindings header file 'qcom,gcc-sm7250.h' is included but omitted from the commit tree.
--

--- Patch [1]: [PATCH 1/2] clk: qcom: Add Global Clock Controller (GCC) driver for SM7250 --- commit 3285603c7b98a0179a26091f983c989773cbb48c
Author: Sreeshankar K <[email protected]>

clk: qcom: Add Global Clock Controller (GCC) driver for SM7250

Add support for the global clock controller found on SM7250 based devices. This should allow most non-multimedia device drivers to probe and control their clocks.

drivers/clk/qcom/Kconfig config SM_GCC_7150 · line 1421

Quoted 10 lines
drivers/clk/qcom/Kconfig +3 -0
@@ -1416,6 +1416,15 @@ config SM_GCC_7150
 	  Say Y if you want to use peripheral devices such as UART,
 	  SPI, I2C, USB, SD/UFS, PCIe etc.
 
+config SM_GCC_7250
+        tristate "SM7250 Global Clock Controller"
+        depends on ARM64 || COMPILE_TEST

[Severity: Low]
This isn't a bug, but there appears to be space-based indentation instead of tabs in this Kconfig block.

Quoted 6 lines
drivers/clk/qcom/Kconfig +6 -0
+        select QCOM_GDSC
+        help
+          Support for the global clock controller on SM7250 devices.
+          Say Y if you want to use peripheral devices such as UART,
+          SPI, I2C, USB, SD/UFS, PCIe etc.
+

[ ... ]

Quoted 10 lines
drivers/clk/qcom/gcc-sm7250.c new file +5 -0
new file mode 100644
@@ -0,0 +1,2347 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2026, Sreeshankar K <[email protected]>
+ */

drivers/clk/qcom/gcc-sm7250.c line 15

Quoted 10 lines
drivers/clk/qcom/gcc-sm7250.c new file +10 -0
+
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/qcom,gcc-sm7250.h>

[Severity: Low]
Is this header file missing from the commit? The dt-bindings header qcom,gcc-sm7250.h does not appear to be included in the tree, which might cause a build failure.

Quoted 2 lines
drivers/clk/qcom/gcc-sm7250.c new file +2 -0
+
+#include "clk-alpha-pll.h"

[ ... ]

drivers/clk/qcom/gcc-sm7250.c line 183

Quoted 9 lines
drivers/clk/qcom/gcc-sm7250.c new file +9 -0
+static const struct parent_map gcc_parent_map_5[] = {
+	{ P_BI_TCXO, 0 },
+	{ P_SLEEP_CLK, 5 },
+};
+
+static const struct clk_parent_data gcc_parent_data_5[] = {
+	{ .fw_name = "bi_tcxo" },
+	{ .fw_name = "sleep_clk" },
+};

[Severity: Low]
Are the gcc_parent_map_5 and gcc_parent_data_5 arrays used anywhere in the driver? They seem to be defined but unreferenced, which could trigger unused-const-variable compiler warnings.

Quoted 2 lines
drivers/clk/qcom/gcc-sm7250.c new file +2 -0
+
+static const struct freq_tbl ftbl_gcc_cpuss_ahb_clk_src[] = {

[ ... ]

drivers/clk/qcom/gcc-sm7250.c line 856

Quoted 6 lines
drivers/clk/qcom/gcc-sm7250.c new file +6 -0
+static struct clk_branch gcc_cpuss_gnoc_clk = {
+	.halt_reg = 0x48064,
+	.halt_check = BRANCH_HALT_VOTED,
+	.clkr = {
+		.enable_reg = 0x48064,
+		.enable_mask = BIT(29),

[Severity: High]
Does gcc_cpuss_gnoc_clk use the correct enable_reg and enable_mask?

Since this clock uses BRANCH_HALT_VOTED, writing BIT(29) directly to its CBCR at 0x48064 instead of a central vote register (like 0x52000) might fail to properly enable the clock, potentially causing a timeout when waiting for the halt bit to clear.

Quoted 6 lines
drivers/clk/qcom/gcc-sm7250.c new file +6 -0
+		.hw.init = &(struct clk_init_data){
+			.name = "gcc_cpuss_gnoc_clk",
+			.ops = &clk_branch2_ops,
+		},
+	},
+};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH 2/2 dt-bindings: clock: Add GCC clock bindings for SM7250

In reply to Sreeshankar K

Add device tree bindings for global clock controller on SM7250 SoC.

---
 .../bindings/clock/qcom,gcc-sm7250.yaml       |  60 +++++++
 include/dt-bindings/clock/qcom,gcc-sm7250.h   | 163 ++++++++++++++++++
 2 files changed, 223 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sm7250.yaml
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm7250.h
Documentation/devicetree/bindings/clock/qcom,gcc-sm7250.yaml new file +60 -0
new file mode 100644
index 000000000..822df7dc1
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,gcc-sm7250.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Global Clock & Reset Controller on SM7250
+
+maintainers:
+  - Bjorn Andersson <[email protected]>
+  - Sreeshankar K <[email protected]>
+
+description: |
+  Qualcomm global clock control module provides the clocks, resets and power
+  domains on SM7250.
+
+  See also: include/dt-bindings/clock/qcom,gcc-sm7250.h
+
+properties:
+  compatible:
+    const: qcom,gcc-sm7250
+
+  clocks:
+    items:
+      - description: Board XO source
+      - description: Board active XO source
+      - description: Sleep clock source
+
+  clock-names:
+    items:
+      - const: bi_tcxo
+      - const: bi_tcxo_ao
+      - const: sleep_clk
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+  - '#power-domain-cells'
+
+allOf:
+  - $ref: qcom,gcc.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    clock-controller@100000 {
+      compatible = "qcom,gcc-sm7250";
+      reg = <0x00100000 0x1f0000>;
+      clocks = <&rpmhcc RPMH_CXO_CLK>,
+               <&rpmhcc RPMH_CXO_CLK_A>,
+               <&sleep_clk>;
+      clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk";
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+...
include/dt-bindings/clock/qcom,gcc-sm7250.h new file +163 -0

163 lines not on this page · raw message

Signature · 1 line
2.43.0