Skip to contentSkip to conversation

Add Global Clock controller (GCC) driver for SC7180

PATCH Superseded Taniya Das 3 participants 9 messages Aug 7, 2019 – Aug 19, 2019

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Taniya Das

author
#0 lore raw

cover Add Global Clock controller (GCC) driver for SC7180

Add driver support for Global Clock controller for SC7180 and also update device tree bindings for the various clocks supported in the clock controller.

Taniya Das (2):
clk: qcom: Add DT bindings for SC7180 gcc clock controller
clk: qcom: Add Global Clock controller (GCC) driver for SC7180

 .../devicetree/bindings/clock/qcom,gcc.txt    |    1 +
 drivers/clk/qcom/Kconfig                      |    9 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/gcc-sc7180.c                 | 2496 +++++++++++++++++
 include/dt-bindings/clock/qcom,gcc-sc7180.h   |  155 +
 5 files changed, 2662 insertions(+)
 create mode 100644 drivers/clk/qcom/gcc-sc7180.c
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sc7180.h

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

author
#1 lore raw

PATCH 1/2 clk: qcom: Add DT bindings for SC7180 gcc clock controller

Add compatible string and the include file for gcc clock controller for SC7180.

---
 .../devicetree/bindings/clock/qcom,gcc.txt    |   1 +
 include/dt-bindings/clock/qcom,gcc-sc7180.h   | 155 ++++++++++++++++++
 2 files changed, 156 insertions(+)
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sc7180.h
Documentation/devicetree/bindings/clock/qcom,gcc.txt +1 -0
index 8661c3cd3ccf..18d95467cb36 100644
@@ -23,6 +23,7 @@ Required properties :
 			"qcom,gcc-sdm630"
 			"qcom,gcc-sdm660"
 			"qcom,gcc-sdm845"
+			"qcom,gcc-sc7180"
 
 - reg : shall contain base register location and length
 - #clock-cells : shall contain 1
include/dt-bindings/clock/qcom,gcc-sc7180.h new file +155 -0

155 lines not on this page · raw message

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

maintainer
#2 lore raw

Re: [PATCH v1 1/2] clk: qcom: Add DT bindings for SC7180 gcc clock controller

Quoting Taniya Das (2019-08-07 11:13:00)

Documentation/devicetree/bindings/clock/qcom,gcc.txt Required properties : · line 29

Quoted 12 lines
Documentation/devicetree/bindings/clock/qcom,gcc.txt +1 -0
index 8661c3cd3ccf..18d95467cb36 100644
@@ -23,6 +23,7 @@ Required properties :
                        "qcom,gcc-sdm630"
                        "qcom,gcc-sdm660"
                        "qcom,gcc-sdm845"
+                       "qcom,gcc-sc7180"
 
 - reg : shall contain base register location and length
 - #clock-cells : shall contain 1

Can you please list the clk inputs that you're expecting now? Similar to what Vinod did for the other most recent GCC driver. We should probably convert this binding to YAML.

author
#3 lore raw

Re: [PATCH v1 1/2] clk: qcom: Add DT bindings for SC7180 gcc clock controller

Quoted 11 lines · Stephen Boyd

Quoting Taniya Das (2019-08-07 11:13:00)

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,gcc.txt +1 -0
index 8661c3cd3ccf..18d95467cb36 100644
@@ -23,6 +23,7 @@ Required properties :
                         "qcom,gcc-sdm630"
                         "qcom,gcc-sdm660"
                         "qcom,gcc-sdm845"
+                       "qcom,gcc-sc7180"
 
Quoted 7 lines

Documentation/devicetree/bindings/clock/qcom,gcc.txt Required properties : · line 29

Quoted 2 lines
Documentation/devicetree/bindings/clock/qcom,gcc.txt +0 -0
  - reg : shall contain base register location and length
  - #clock-cells : shall contain 1

Can you please list the clk inputs that you're expecting now? Similar to what Vinod did for the other most recent GCC driver. We should probably convert this binding to YAML.

Thanks Stephen for review, will send the YAML binding in the next patch series along with the clock inputs updated.

Signature · 4 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation.

--
#4 lore raw

Re: [PATCH v1 1/2] clk: qcom: Add DT bindings for SC7180 gcc clock controller

In reply to Taniya Das
Quoted 15 lines · Taniya Das

Add compatible string and the include file for gcc clock controller for SC7180.

---
 .../devicetree/bindings/clock/qcom,gcc.txt    |   1 +
 include/dt-bindings/clock/qcom,gcc-sc7180.h   | 155 ++++++++++++++++++
 2 files changed, 156 insertions(+)
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sc7180.h
Documentation/devicetree/bindings/clock/qcom,gcc.txt +0 -0
index 8661c3cd3ccf..18d95467cb36 100644

Documentation/devicetree/bindings/clock/qcom,gcc.txt Required properties : · line 26

Quoted 4 lines
Documentation/devicetree/bindings/clock/qcom,gcc.txt +1 -0
@@ -23,6 +23,7 @@ Required properties :
 			"qcom,gcc-sdm630"
 			"qcom,gcc-sdm660"
 			"qcom,gcc-sdm845"
+			"qcom,gcc-sc7180"

I don't see parent clocks listed here please add them as well

Signature · 1 line
~Vinod
author
#5 lore raw

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

In reply to Taniya Das

Add support for the global clock controller found on SC7180 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-sc7180.c | 2496 +++++++++++++++++++++++++++++++++
 3 files changed, 2506 insertions(+)
 create mode 100644 drivers/clk/qcom/gcc-sc7180.c
drivers/clk/qcom/Kconfig +9 -0
index e1ff83cc361e..9e634cf27464 100644
@@ -323,4 +323,13 @@ config KRAITCC
 	  Support for the Krait CPU clocks on Qualcomm devices.
 	  Say Y if you want to support CPU frequency scaling.
 
+config SC_GCC_7180
+	tristate "SC7180 Global Clock Controller"
+	select QCOM_GDSC
+	depends on COMMON_CLK_QCOM
+	help
+	  Support for the global clock controller on SC7180 devices.
+	  Say Y if you want to use peripheral devices such as UART, SPI,
+	  I2C, USB, UFS, SDCC, etc.
+
 endif
drivers/clk/qcom/Makefile +1 -0
index f0768fb1f037..c6fa93e41d74 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_QCOM_CLK_RPMH) += clk-rpmh.o
 obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o
 obj-$(CONFIG_QCS_GCC_404) += gcc-qcs404.o
 obj-$(CONFIG_QCS_TURING_404) += turingcc-qcs404.o
+obj-$(CONFIG_SC_GCC_7180) += gcc-sc7180.o
 obj-$(CONFIG_SDM_CAMCC_845) += camcc-sdm845.o
 obj-$(CONFIG_SDM_DISPCC_845) += dispcc-sdm845.o
 obj-$(CONFIG_SDM_GCC_660) += gcc-sdm660.o
drivers/clk/qcom/gcc-sc7180.c new file +2496 -0

2,496 lines not on this page · raw message

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.

maintainer
#6 lore raw

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

Quoting Taniya Das (2019-08-07 11:13:01)

Quoted 5 lines

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

Overall looks pretty good to me. Some minor nitpicks below.

drivers/clk/qcom/Kconfig config KRAITCC · line 326

Quoted 9 lines
drivers/clk/qcom/Kconfig +1 -0
index e1ff83cc361e..9e634cf27464 100644
@@ -323,4 +323,13 @@ config KRAITCC
          Support for the Krait CPU clocks on Qualcomm devices.
          Say Y if you want to support CPU frequency scaling.
 
+config SC_GCC_7180

Can this be sorted alphabetically in this file? It's getting out of hand when they all get added to the end.

Quoted 49 lines
drivers/clk/qcom/Kconfig +8 -0
+       tristate "SC7180 Global Clock Controller"
+       select QCOM_GDSC
+       depends on COMMON_CLK_QCOM
+       help
+         Support for the global clock controller on SC7180 devices.
+         Say Y if you want to use peripheral devices such as UART, SPI,
+         I2C, USB, UFS, SDCC, etc.
+
 endif
drivers/clk/qcom/gcc-sc7180.c new file +34 -0
new file mode 100644
index 000000000000..004b76e69402
@@ -0,0 +1,2496 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ */
+
+#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 <dt-bindings/clock/qcom,gcc-sc7180.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "common.h"
+#include "gdsc.h"
+#include "reset.h"
+
+#define GCC_MMSS_MISC          0x09ffc
+#define GCC_NPU_MISC           0x4d110
+#define GCC_GPU_MISC           0x71028
+
+enum {
+       P_BI_TCXO,
+       P_CORE_BI_PLL_TEST_SE,
+       P_GPLL0_OUT_EVEN,
+       P_GPLL0_OUT_MAIN,
+       P_GPLL1_OUT_MAIN,
+       P_GPLL4_OUT_MAIN,
+       P_GPLL6_OUT_MAIN,

drivers/clk/qcom/gcc-sc7180.c line 44

Quoted 10 lines
drivers/clk/qcom/gcc-sc7180.c new file +10 -0
+       P_GPLL7_OUT_MAIN,
+       P_SLEEP_CLK,
+};
+
+static struct clk_alpha_pll gpll0;
+static struct clk_alpha_pll gpll1;
+static struct clk_alpha_pll gpll4;
+static struct clk_alpha_pll gpll6;
+static struct clk_alpha_pll gpll7;
+static struct clk_alpha_pll_postdiv gpll0_out_even;

Can't we create these PLLs before the parent maps? I don't see why we need to forward declare the structs.

Quoted 11 lines
drivers/clk/qcom/gcc-sc7180.c new file +11 -0
+
+static const struct parent_map gcc_parent_map_0[] = {
+       { P_BI_TCXO, 0 },
+       { P_GPLL0_OUT_MAIN, 1 },
+       { P_GPLL0_OUT_EVEN, 6 },
+       { P_CORE_BI_PLL_TEST_SE, 7 },
+};
+
+static const struct clk_parent_data gcc_parent_data_0[] = {
+       { .fw_name = "bi_tcxo", .name = "bi_tcxo" },
+       { .hw = &gpll0.clkr.hw },

[...]

drivers/clk/qcom/gcc-sc7180.c line 892

Quoted 11 lines
drivers/clk/qcom/gcc-sc7180.c new file +11 -0
+static struct clk_branch gcc_camera_ahb_clk = {
+       .halt_reg = 0xb008,
+       .halt_check = BRANCH_HALT,
+       .hwcg_reg = 0xb008,
+       .hwcg_bit = 1,
+       .clkr = {
+               .enable_reg = 0xb008,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_camera_ahb_clk",
+                       .flags = CLK_IS_CRITICAL,

Please add a comment for CLK_IS_CRITICAL usage explaining why clks must be kept on forever.

Quoted 12 lines
drivers/clk/qcom/gcc-sc7180.c new file +12 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_camera_hf_axi_clk = {
+       .halt_reg = 0xb020,
+       .halt_check = BRANCH_HALT,
+       .clkr = {
+               .enable_reg = 0xb020,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){

[...]

Quoted 7 lines
drivers/clk/qcom/gcc-sc7180.c new file +7 -0
+
+static const struct qcom_reset_map gcc_sc7180_resets[] = {
+       [GCC_QUSB2PHY_PRIM_BCR] = { 0x26000 },
+       [GCC_QUSB2PHY_SEC_BCR] = { 0x26004 },
+       [GCC_UFS_PHY_BCR] = { 0x77000 },
+       [GCC_USB30_PRIM_BCR] = { 0xf000 },
+       [GCC_USB3_PHY_PRIM_BCR] = { 0x50000 },

drivers/clk/qcom/gcc-sc7180.c line 2407

Quoted 10 lines
drivers/clk/qcom/gcc-sc7180.c new file +10 -0
+       [GCC_USB3PHY_PHY_PRIM_BCR] = { 0x50004 },
+       [GCC_USB3_PHY_SEC_BCR] = { 0x5000c },
+       [GCC_USB3_DP_PHY_PRIM_BCR] = { 0x50008 },
+       [GCC_USB3PHY_PHY_SEC_BCR] = { 0x50010 },
+       [GCC_USB3_DP_PHY_SEC_BCR] = { 0x50014 },
+       [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0x6a000 },
+};
+
+static struct clk_rcg_dfs_data gcc_dfs_clocks[] = {
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s0_clk),

I was happy if you wanted to include the _src changing patch from earlier. Can you throw it into this series?

Quoted 37 lines
drivers/clk/qcom/gcc-sc7180.c new file +37 -0
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s1_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s2_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s3_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s4_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s5_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s0_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s1_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s2_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s3_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s4_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s5_clk),
+};
+
+static const struct regmap_config gcc_sc7180_regmap_config = {
+       .reg_bits = 32,
+       .reg_stride = 4,
+       .val_bits = 32,
+       .max_register = 0x18208c,
+       .fast_io = true,
+};
+
+static const struct qcom_cc_desc gcc_sc7180_desc = {
+       .config = &gcc_sc7180_regmap_config,
+       .clk_hws = gcc_sc7180_hws,
+       .num_clk_hws = ARRAY_SIZE(gcc_sc7180_hws),
+       .clks = gcc_sc7180_clocks,
+       .num_clks = ARRAY_SIZE(gcc_sc7180_clocks),
+       .resets = gcc_sc7180_resets,
+       .num_resets = ARRAY_SIZE(gcc_sc7180_resets),
+       .gdscs = gcc_sc7180_gdscs,
+       .num_gdscs = ARRAY_SIZE(gcc_sc7180_gdscs),
+};
+
+static const struct of_device_id gcc_sc7180_match_table[] = {
+       { .compatible = "qcom,gcc-sc7180" },
+       { }
+};

drivers/clk/qcom/gcc-sc7180.c line 2454

Quoted 10 lines
drivers/clk/qcom/gcc-sc7180.c new file +10 -0
+MODULE_DEVICE_TABLE(of, gcc_sc7180_match_table);
+
+static int gcc_sc7180_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       int ret;
+
+       regmap = qcom_cc_map(pdev, &gcc_sc7180_desc);
+       if (IS_ERR(regmap)) {
+               pr_err("Failed to map the gcc registers\n");

I don't think we need this error message. Please remove it.

drivers/clk/qcom/gcc-sc7180.c line 2466

Quoted 12 lines
drivers/clk/qcom/gcc-sc7180.c new file +12 -0
+               return PTR_ERR(regmap);
+       }
+
+       /*
+        * Disable the GPLL0 active input to MM blocks, NPU
+        * and GPU via MISC registers.
+        */
+       regmap_update_bits(regmap, GCC_MMSS_MISC, 0x3, 0x3);
+       regmap_update_bits(regmap, GCC_NPU_MISC, 0x3, 0x3);
+       regmap_update_bits(regmap, GCC_GPU_MISC, 0x3, 0x3);
+
+       /* DFS clock registration */

This comment is pretty useless, please remove it.

Quoted 7 lines
drivers/clk/qcom/gcc-sc7180.c new file +7 -0
+       ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks,
+                                       ARRAY_SIZE(gcc_dfs_clocks));
+       if (ret)
+               return ret;
+
+       return qcom_cc_really_probe(pdev, &gcc_sc7180_desc, regmap);
+}
author
#7 lore raw

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

Hello Stephen,

Quoted 17 lines · Stephen Boyd

Quoting Taniya Das (2019-08-07 11:13:01)

Quoted 5 lines

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

Overall looks pretty good to me. Some minor nitpicks below.

Quoted 8 lines
drivers/clk/qcom/Kconfig +0 -0
index e1ff83cc361e..9e634cf27464 100644
@@ -323,4 +323,13 @@ config KRAITCC
           Support for the Krait CPU clocks on Qualcomm devices.
           Say Y if you want to support CPU frequency scaling.
 
Quoted 5 lines

drivers/clk/qcom/Kconfig config KRAITCC · line 326

Quoted 1 line
drivers/clk/qcom/Kconfig +1 -0
+config SC_GCC_7180

Can this be sorted alphabetically in this file? It's getting out of hand when they all get added to the end.

Next patch would add them in sorted order.

Quoted 54 lines
Quoted 54 lines
drivers/clk/qcom/Kconfig +8 -0
+       tristate "SC7180 Global Clock Controller"
+       select QCOM_GDSC
+       depends on COMMON_CLK_QCOM
+       help
+         Support for the global clock controller on SC7180 devices.
+         Say Y if you want to use peripheral devices such as UART, SPI,
+         I2C, USB, UFS, SDCC, etc.
+
  endif
drivers/clk/qcom/gcc-sc7180.c new file +39 -0
new file mode 100644
index 000000000000..004b76e69402
@@ -0,0 +1,2496 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ */
+
+#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 <dt-bindings/clock/qcom,gcc-sc7180.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "common.h"
+#include "gdsc.h"
+#include "reset.h"
+
+#define GCC_MMSS_MISC          0x09ffc
+#define GCC_NPU_MISC           0x4d110
+#define GCC_GPU_MISC           0x71028
+
+enum {
+       P_BI_TCXO,
+       P_CORE_BI_PLL_TEST_SE,
+       P_GPLL0_OUT_EVEN,
+       P_GPLL0_OUT_MAIN,
+       P_GPLL1_OUT_MAIN,
+       P_GPLL4_OUT_MAIN,
+       P_GPLL6_OUT_MAIN,
+       P_GPLL7_OUT_MAIN,
+       P_SLEEP_CLK,
+};
+
+static struct clk_alpha_pll gpll0;
Quoted 9 lines

drivers/clk/qcom/gcc-sc7180.c line 44

Quoted 5 lines
drivers/clk/qcom/gcc-sc7180.c new file +5 -0
+static struct clk_alpha_pll gpll1;
+static struct clk_alpha_pll gpll4;
+static struct clk_alpha_pll gpll6;
+static struct clk_alpha_pll gpll7;
+static struct clk_alpha_pll_postdiv gpll0_out_even;

Can't we create these PLLs before the parent maps? I don't see why we need to forward declare the structs.

Would define the PLLs earlier.

Quoted 24 lines
Quoted 11 lines
drivers/clk/qcom/gcc-sc7180.c new file +11 -0
+
+static const struct parent_map gcc_parent_map_0[] = {
+       { P_BI_TCXO, 0 },
+       { P_GPLL0_OUT_MAIN, 1 },
+       { P_GPLL0_OUT_EVEN, 6 },
+       { P_CORE_BI_PLL_TEST_SE, 7 },
+};
+
+static const struct clk_parent_data gcc_parent_data_0[] = {
+       { .fw_name = "bi_tcxo", .name = "bi_tcxo" },
+       { .hw = &gpll0.clkr.hw },

[...]

drivers/clk/qcom/gcc-sc7180.c line 892

Quoted 11 lines
drivers/clk/qcom/gcc-sc7180.c new file +11 -0
+static struct clk_branch gcc_camera_ahb_clk = {
+       .halt_reg = 0xb008,
+       .halt_check = BRANCH_HALT,
+       .hwcg_reg = 0xb008,
+       .hwcg_bit = 1,
+       .clkr = {
+               .enable_reg = 0xb008,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_camera_ahb_clk",
+                       .flags = CLK_IS_CRITICAL,
Quoted 3 lines

Please add a comment for CLK_IS_CRITICAL usage explaining why clks must be kept on forever.

Would add the comments for the CRITICAL clocks.

Quoted 25 lines
Quoted 12 lines
drivers/clk/qcom/gcc-sc7180.c new file +12 -0
+                       .ops = &clk_branch2_ops,
+               },
+       },
+};
+
+static struct clk_branch gcc_camera_hf_axi_clk = {
+       .halt_reg = 0xb020,
+       .halt_check = BRANCH_HALT,
+       .clkr = {
+               .enable_reg = 0xb020,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){

[...]

Quoted 12 lines
drivers/clk/qcom/gcc-sc7180.c new file +12 -0
+
+static const struct qcom_reset_map gcc_sc7180_resets[] = {
+       [GCC_QUSB2PHY_PRIM_BCR] = { 0x26000 },
+       [GCC_QUSB2PHY_SEC_BCR] = { 0x26004 },
+       [GCC_UFS_PHY_BCR] = { 0x77000 },
+       [GCC_USB30_PRIM_BCR] = { 0xf000 },
+       [GCC_USB3_PHY_PRIM_BCR] = { 0x50000 },
+       [GCC_USB3PHY_PHY_PRIM_BCR] = { 0x50004 },
+       [GCC_USB3_PHY_SEC_BCR] = { 0x5000c },
+       [GCC_USB3_DP_PHY_PRIM_BCR] = { 0x50008 },
+       [GCC_USB3PHY_PHY_SEC_BCR] = { 0x50010 },
+       [GCC_USB3_DP_PHY_SEC_BCR] = { 0x50014 },
Quoted 9 lines

drivers/clk/qcom/gcc-sc7180.c line 2407

Quoted 5 lines
drivers/clk/qcom/gcc-sc7180.c new file +5 -0
+       [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0x6a000 },
+};
+
+static struct clk_rcg_dfs_data gcc_dfs_clocks[] = {
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s0_clk),

I was happy if you wanted to include the _src changing patch from earlier. Can you throw it into this series?

Next patch series I would include the patch.

Quoted 41 lines
Quoted 41 lines
drivers/clk/qcom/gcc-sc7180.c new file +41 -0
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s1_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s2_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s3_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s4_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap0_s5_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s0_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s1_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s2_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s3_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s4_clk),
+       DEFINE_RCG_DFS(gcc_qupv3_wrap1_s5_clk),
+};
+
+static const struct regmap_config gcc_sc7180_regmap_config = {
+       .reg_bits = 32,
+       .reg_stride = 4,
+       .val_bits = 32,
+       .max_register = 0x18208c,
+       .fast_io = true,
+};
+
+static const struct qcom_cc_desc gcc_sc7180_desc = {
+       .config = &gcc_sc7180_regmap_config,
+       .clk_hws = gcc_sc7180_hws,
+       .num_clk_hws = ARRAY_SIZE(gcc_sc7180_hws),
+       .clks = gcc_sc7180_clocks,
+       .num_clks = ARRAY_SIZE(gcc_sc7180_clocks),
+       .resets = gcc_sc7180_resets,
+       .num_resets = ARRAY_SIZE(gcc_sc7180_resets),
+       .gdscs = gcc_sc7180_gdscs,
+       .num_gdscs = ARRAY_SIZE(gcc_sc7180_gdscs),
+};
+
+static const struct of_device_id gcc_sc7180_match_table[] = {
+       { .compatible = "qcom,gcc-sc7180" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, gcc_sc7180_match_table);
+
+static int gcc_sc7180_probe(struct platform_device *pdev)
+{
Quoted 9 lines

drivers/clk/qcom/gcc-sc7180.c line 2454

Quoted 6 lines
drivers/clk/qcom/gcc-sc7180.c new file +6 -0
+       struct regmap *regmap;
+       int ret;
+
+       regmap = qcom_cc_map(pdev, &gcc_sc7180_desc);
+       if (IS_ERR(regmap)) {
+               pr_err("Failed to map the gcc registers\n");

I don't think we need this error message. Please remove it.

Yes, would remove this.

Quoted 6 lines
Quoted 6 lines
drivers/clk/qcom/gcc-sc7180.c new file +6 -0
+               return PTR_ERR(regmap);
+       }
+
+       /*
+        * Disable the GPLL0 active input to MM blocks, NPU
+        * and GPU via MISC registers.
Quoted 8 lines

drivers/clk/qcom/gcc-sc7180.c line 2466

Quoted 6 lines
drivers/clk/qcom/gcc-sc7180.c new file +6 -0
+        */
+       regmap_update_bits(regmap, GCC_MMSS_MISC, 0x3, 0x3);
+       regmap_update_bits(regmap, GCC_NPU_MISC, 0x3, 0x3);
+       regmap_update_bits(regmap, GCC_GPU_MISC, 0x3, 0x3);
+
+       /* DFS clock registration */

This comment is pretty useless, please remove it.

Done, would remove it.

Quoted 8 lines
Quoted 8 lines
drivers/clk/qcom/gcc-sc7180.c new file +7 -0
+       ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks,
+                                       ARRAY_SIZE(gcc_dfs_clocks));
+       if (ret)
+               return ret;
+
+       return qcom_cc_really_probe(pdev, &gcc_sc7180_desc, regmap);
+}
Signature · 4 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation.

--
#8 lore raw

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

In reply to Taniya Das

drivers/clk/qcom/gcc-sc7180.c line 44

Quoted 6 lines · Taniya Das
drivers/clk/qcom/gcc-sc7180.c new file +6 -0
+static struct clk_alpha_pll gpll0;
+static struct clk_alpha_pll gpll1;
+static struct clk_alpha_pll gpll4;
+static struct clk_alpha_pll gpll6;
+static struct clk_alpha_pll gpll7;
+static struct clk_alpha_pll_postdiv gpll0_out_even;

I am not sure we need these, reordering code and getting rid of them should be easy enough (i did that for sm8150)

drivers/clk/qcom/gcc-sc7180.c line 57

Quoted 12 lines
drivers/clk/qcom/gcc-sc7180.c new file +12 -0
+static const struct parent_map gcc_parent_map_0[] = {
+	{ P_BI_TCXO, 0 },
+	{ P_GPLL0_OUT_MAIN, 1 },
+	{ P_GPLL0_OUT_EVEN, 6 },
+	{ P_CORE_BI_PLL_TEST_SE, 7 },
+};
+
+static const struct clk_parent_data gcc_parent_data_0[] = {
+	{ .fw_name = "bi_tcxo", .name = "bi_tcxo" },
+	{ .hw = &gpll0.clkr.hw },
+	{ .hw = &gpll0_out_even.clkr.hw },
+	{ .fw_name = "core_bi_pll_test_se", .name = "core_bi_pll_test_se" },

This is legacy test, so we would want only fw_name being there

drivers/clk/qcom/gcc-sc7180.c line 892

Quoted 11 lines
drivers/clk/qcom/gcc-sc7180.c new file +11 -0
+static struct clk_branch gcc_camera_ahb_clk = {
+	.halt_reg = 0xb008,
+	.halt_check = BRANCH_HALT,
+	.hwcg_reg = 0xb008,
+	.hwcg_bit = 1,
+	.clkr = {
+		.enable_reg = 0xb008,
+		.enable_mask = BIT(0),
+		.hw.init = &(struct clk_init_data){
+			.name = "gcc_camera_ahb_clk",
+			.flags = CLK_IS_CRITICAL,

It would help to explain why this clk is critical

drivers/clk/qcom/gcc-sc7180.c line 1092

Quoted 2 lines
drivers/clk/qcom/gcc-sc7180.c new file +2 -0
+static struct clk_branch gcc_disp_gpll0_div_clk_src = {
+	.halt_check = BRANCH_HALT_DELAY,

And why this needs a delay

Signature · 1 line
~Vinod