Skip to contentSkip to conversation

Add GCC for SM4250/6115

PATCH Superseded Iskren Chernev 3 participants 5 messages Jun 27, 2021 – Jul 27, 2021

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add GCC for SM4250/6115

This patch adds support for the Global Clock Controller on QCom SM4250 and SM6115, codename bengal. The code is taken from OnePlus repo [1]. The two platforms are identical so there is only one compat string.

[1]: https://github.com/OnePlusOSS/android_kernel_oneplus_sm4250

v1: https://lkml.org/lkml/2021/6/22/1131

Changes from v1:
- remove sm4250 compat, there will be a single sm6115.dtsi for both platforms

Iskren Chernev (2):
dt-bindings: clk: qcom: gcc-sm6115: Document SM6115 GCC
clk: qcom: Add Global Clock controller (GCC) driver for SM6115

 .../bindings/clock/qcom,gcc-sm6115.yaml       |   72 +
 drivers/clk/qcom/Kconfig                      |    7 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/gcc-sm6115.c                 | 3623 +++++++++++++++++
 include/dt-bindings/clock/qcom,gcc-sm6115.h   |  201 +
 5 files changed, 3904 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sm6115.yaml
 create mode 100644 drivers/clk/qcom/gcc-sm6115.c
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm6115.h

base-commit: e71e3a48a7e89fa71fb70bf4602367528864d2ff --
2.32.0

#1 lore raw

PATCH v2 1/2 dt-bindings: clk: qcom: gcc-sm6115: Document SM6115 GCC

Add device tree bindings for global clock controller on SM6115 and SM4250 SoCs (pin and software compatible).

---
 .../bindings/clock/qcom,gcc-sm6115.yaml       |  72 +++++++
 include/dt-bindings/clock/qcom,gcc-sm6115.h   | 201 ++++++++++++++++++
 2 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sm6115.yaml
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm6115.h
Documentation/devicetree/bindings/clock/qcom,gcc-sm6115.yaml new file +72 -0
new file mode 100644
index 000000000000..26050da844d5
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,gcc-sm6115.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Global Clock & Reset Controller Binding for SM6115 and SM4250
+
+maintainers:
+  - Iskren Chernev <[email protected]>
+
+description: |
+  Qualcomm global clock control module which supports the clocks, resets and
+  power domains on SM4250/6115.
+
+  See also:
+  - dt-bindings/clock/qcom,gcc-sm6115.h
+
+properties:
+  compatible:
+    const: qcom,gcc-sm6115
+
+  clocks:
+    items:
+      - description: Board XO source
+      - description: Sleep clock source
+
+  clock-names:
+    items:
+      - const: bi_tcxo
+      - const: sleep_clk
+
+  '#clock-cells':
+    const: 1
+
+  '#reset-cells':
+    const: 1
+
+  '#power-domain-cells':
+    const: 1
+
+  reg:
+    maxItems: 1
+
+  protected-clocks:
+    description:
+      Protected clock specifier list as per common clock binding.
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+  - reg
+  - '#clock-cells'
+  - '#reset-cells'
+  - '#power-domain-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,rpmcc.h>
+    clock-controller@1400000 {
+        compatible = "qcom,gcc-sm6115";
+        reg = <0x01400000 0x1f0000>;
+        #clock-cells = <1>;
+        #reset-cells = <1>;
+        #power-domain-cells = <1>;
+        clock-names = "bi_tcxo", "sleep_clk";
+        clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>, <&sleep_clk>;
+    };
+...
include/dt-bindings/clock/qcom,gcc-sm6115.h new file +201 -0

201 lines not on this page · raw message

Signature · 1 line
2.32.0
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: clk: qcom: gcc-sm6115: Document SM6115 GCC

Quoted 11 lines · Iskren Chernev

Add device tree bindings for global clock controller on SM6115 and SM4250 SoCs (pin and software compatible).

---
 .../bindings/clock/qcom,gcc-sm6115.yaml       |  72 +++++++
 include/dt-bindings/clock/qcom,gcc-sm6115.h   | 201 ++++++++++++++++++
 2 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sm6115.yaml
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm6115.h
#3 lore raw

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

In reply to Iskren Chernev

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

Based on CAF implementation. GDSCs ported from downstream DT.

---
 drivers/clk/qcom/Kconfig      |    7 +
 drivers/clk/qcom/Makefile     |    1 +
 drivers/clk/qcom/gcc-sm6115.c | 3623 +++++++++++++++++++++++++++++++++
 3 files changed, 3631 insertions(+)
 create mode 100644 drivers/clk/qcom/gcc-sm6115.c
drivers/clk/qcom/Kconfig +7 -0
index c84b2c896a27..de35191412c5 100644
@@ -499,6 +499,13 @@ config SM_DISPCC_8250
 	  Say Y if you want to support display devices and functionality such as
 	  splash screen.
 
+config SM_GCC_6115
+	tristate "SM6115 and SM4250 Global Clock Controller"
+	help
+	  Support for the global clock controller on SM6115 and SM4250 devices.
+	  Say Y if you want to use peripheral devices such as UART, SPI,
+	  i2C, USB, UFS, SDDC, PCIe, etc.
+
 config SM_GCC_8150
 	tristate "SM8150 Global Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index 9495bf6a18d0..c42ea466cb7a 100644
@@ -75,6 +75,7 @@ obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o
 obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o
 obj-$(CONFIG_SDX_GCC_55) += gcc-sdx55.o
 obj-$(CONFIG_SM_DISPCC_8250) += dispcc-sm8250.o
+obj-$(CONFIG_SM_GCC_6115) += gcc-sm6115.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-sm6115.c new file +3623 -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.32.0

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

maintainer
#4 lore raw

Re: [PATCH v2 2/2] clk: qcom: Add Global Clock controller (GCC) driver for SM6115

Quoting Iskren Chernev (2021-06-27 11:55:38)

Quoted 7 lines
drivers/clk/qcom/gcc-sm6115.c new file +1 -0
new file mode 100644
index 000000000000..e3c830b33dec
@@ -0,0 +1,3623 @@
+// SPDX-License-Identifier: GPL-2.0-only

drivers/clk/qcom/gcc-sm6115.c line 11

Quoted 10 lines
drivers/clk/qcom/gcc-sm6115.c new file +10 -0
+/*
+ * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>

Should be clk-provider.h in this list as well.

Quoted 33 lines
drivers/clk/qcom/gcc-sm6115.c new file +33 -0
+
+#include <dt-bindings/clock/qcom,gcc-sm6115.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 "common.h"
+#include "gdsc.h"
+#include "reset.h"
+
+enum {
+       P_BI_TCXO,
+       P_CORE_BI_PLL_TEST_SE,
+       P_GPLL0_OUT_AUX2,
+       P_GPLL0_OUT_EARLY,
+       P_GPLL10_OUT_MAIN,
+       P_GPLL11_OUT_AUX,
+       P_GPLL11_OUT_AUX2,
+       P_GPLL11_OUT_MAIN,
+       P_GPLL3_OUT_EARLY,
+       P_GPLL3_OUT_MAIN,
+       P_GPLL4_OUT_MAIN,
+       P_GPLL6_OUT_EARLY,
+       P_GPLL6_OUT_MAIN,
+       P_GPLL7_OUT_MAIN,
+       P_GPLL8_OUT_EARLY,
+       P_GPLL8_OUT_MAIN,
+       P_GPLL9_OUT_EARLY,
+       P_GPLL9_OUT_MAIN,
+       P_SLEEP_CLK,

drivers/clk/qcom/gcc-sm6115.c line 54

Quoted 10 lines
drivers/clk/qcom/gcc-sm6115.c new file +10 -0
+};
+
+static const struct parent_map gcc_parent_map_0[] = {
+       { P_BI_TCXO, 0 },
+       { P_GPLL0_OUT_EARLY, 1 },
+       { P_GPLL0_OUT_AUX2, 2 },
+       { P_CORE_BI_PLL_TEST_SE, 7 },
+};
+
+static const char * const gcc_parent_names_0[] = {

Please use struct clk_parent_data instead of these arrays of strings.

drivers/clk/qcom/gcc-sm6115.c line 59

Quoted 5 lines
drivers/clk/qcom/gcc-sm6115.c new file +5 -0
+       "bi_tcxo",
+       "gpll0",
+       "gpll0_out_aux2",
+       "core_bi_pll_test_se",
+};

And add newlines between structs.

Quoted 7 lines
drivers/clk/qcom/gcc-sm6115.c new file +7 -0
+static const char * const gcc_parent_names_0_ao[] = {
+       "bi_tcxo_ao",
+       "gpll0",
+       "gpll0_out_aux2",
+       "core_bi_pll_test_se",
+};
+