Skip to contentSkip to conversation

clk: qcom: Add clocks for SM8450 SoC

PATCH Applied Vinod Koul 5 participants 16 messages Dec 7, 2021 – Dec 15, 2021

Subsystems (4)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

v2 cover clk: qcom: Add clocks for SM8450 SoC

This series adds the GCC clock support required for SM8450 SoC along with devicetree binding for these clocks.

Please note that the GCC driver patch depends on new alpha LUCID_EVO introduced by Vamsi in [1]. That would be required to be picked before this patch can be applied.

[1]: https://lore.kernel.org/all/a0b04869a20a0afef99dd457ebb6474f50591210.1637302009.git.quic_vamslank@quicinc.com/

Changes in v2:
- Drop rpmhcc patches as they are picked by Bjorn
- Fix the multi line comment and drop noise in probe
- Remove .name in clocks coming from firmware

Vinod Koul (2):
dt-bindings: clock: Add SM8450 GCC clock bindings
clk: qcom: Add clock driver for SM8450

 .../bindings/clock/qcom,gcc-sm8450.yaml       |   85 +
 drivers/clk/qcom/Kconfig                      |    8 +
 drivers/clk/qcom/Makefile                     |    1 +
 drivers/clk/qcom/gcc-sm8450.c                 | 3303 +++++++++++++++++
 include/dt-bindings/clock/qcom,gcc-sm8450.h   |  244 ++
 5 files changed, 3641 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sm8450.yaml
 create mode 100644 drivers/clk/qcom/gcc-sm8450.c
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm8450.h
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH v2 1/2 dt-bindings: clock: Add SM8450 GCC clock bindings

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

---
 .../bindings/clock/qcom,gcc-sm8450.yaml       |  85 ++++++
 include/dt-bindings/clock/qcom,gcc-sm8450.h   | 244 ++++++++++++++++++
 2 files changed, 329 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sm8450.yaml
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm8450.h
Documentation/devicetree/bindings/clock/qcom,gcc-sm8450.yaml new file +85 -0
new file mode 100644
index 000000000000..58d98a766de6
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,gcc-sm8450.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Global Clock & Reset Controller Binding for SM8450
+
+maintainers:
+  - Vinod Koul <[email protected]>
+
+description: |
+  Qualcomm global clock control module which supports the clocks, resets and
+  power domains on SM8450
+
+  See also:
+  - dt-bindings/clock/qcom,gcc-sm8450.h
+
+properties:
+  compatible:
+    const: qcom,gcc-sm8450
+
+  clocks:
+    items:
+      - description: Board XO source
+      - description: Sleep clock source
+      - description: PCIE 0 Pipe clock source (Optional clock)
+      - description: PCIE 1 Pipe clock source (Optional clock)
+      - description: PCIE 1 Phy Auxillary clock source (Optional clock)
+      - description: UFS Phy Rx symbol 0 clock source (Optional clock)
+      - description: UFS Phy Rx symbol 1 clock source (Optional clock)
+      - description: UFS Phy Tx symbol 0 clock source (Optional clock)
+      - description: USB3 Phy wrapper pipe clock source (Optional clock)
+    minItems: 2
+
+  clock-names:
+    items:
+      - const: bi_tcxo
+      - const: sleep_clk
+      - const: pcie_0_pipe_clk # Optional clock
+      - const: pcie_1_pipe_clk # Optional clock
+      - const: pcie_1_phy_aux_clk # Optional clock
+      - const: ufs_phy_rx_symbol_0_clk # Optional clock
+      - const: ufs_phy_rx_symbol_1_clk # Optional clock
+      - const: ufs_phy_tx_symbol_0_clk # Optional clock
+      - const: usb3_phy_wrapper_gcc_usb30_pipe_clk # Optional clock
+    minItems: 2
+
+  '#clock-cells':
+    const: 1
+
+  '#reset-cells':
+    const: 1
+
+  '#power-domain-cells':
+    const: 1
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - '#clock-cells'
+  - '#reset-cells'
+  - '#power-domain-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,rpmh.h>
+    clock-controller@100000 {
+      compatible = "qcom,gcc-sm8450";
+      reg = <0x00100000 0x001f4200>;
+      clocks = <&rpmhcc RPMH_CXO_CLK>, <&sleep_clk>;
+      clock-names = "bi_tcxo", "sleep_clk";
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+      #power-domain-cells = <1>;
+    };
+
+...
include/dt-bindings/clock/qcom,gcc-sm8450.h new file +244 -0

244 lines not on this page · raw message

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

Re: [PATCH v2 1/2] dt-bindings: clock: Add SM8450 GCC clock bindings

In reply to Vinod Koul
Quoted 10 lines · Vinod Koul

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

---
 .../bindings/clock/qcom,gcc-sm8450.yaml       |  85 ++++++
 include/dt-bindings/clock/qcom,gcc-sm8450.h   | 244 ++++++++++++++++++
 2 files changed, 329 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sm8450.yaml
 create mode 100644 include/dt-bindings/clock/qcom,gcc-sm8450.h
#4 lore raw

Re: (subset) [PATCH v2 1/2] dt-bindings: clock: Add SM8450 GCC clock bindings

In reply to Vinod Koul
Quoted 3 lines · Vinod Koul

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

Applied, thanks!

[1/2] dt-bindings: clock: Add SM8450 GCC clock bindings

      commit: 72a0ca203ca7fae34fe61668906fe483b97d9039

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>
author
#5 lore raw

PATCH v2 2/2 clk: qcom: Add clock driver for SM8450

In reply to Vinod Koul

This adds Global Clock controller (GCC) driver for SM8450 SoC including the gcc resets and gdsc.

This patch is based on initial code downstream by Vivek Aknurwar <[email protected]>

---
 drivers/clk/qcom/Kconfig      |    8 +
 drivers/clk/qcom/Makefile     |    1 +
 drivers/clk/qcom/gcc-sm8450.c | 3303 +++++++++++++++++++++++++++++++++
 3 files changed, 3312 insertions(+)
 create mode 100644 drivers/clk/qcom/gcc-sm8450.c
drivers/clk/qcom/Kconfig +8 -0
index 74efc82127e1..3a568e7ad886 100644
@@ -618,6 +618,14 @@ config SM_GCC_8350
 	  Say Y if you want to use peripheral devices such as UART,
 	  SPI, I2C, USB, SD/UFS, PCIe etc.
 
+config SM_GCC_8450
+	tristate "SM8450 Global Clock Controller"
+	select QCOM_GDSC
+	help
+	  Support for the global clock controller on SM8450 devices.
+	  Say Y if you want to use peripheral devices such as UART,
+	  SPI, I2C, USB, SD/UFS, PCIe etc.
+
 config SM_GPUCC_8150
 	tristate "SM8150 Graphics Clock Controller"
 	select SM_GCC_8150
drivers/clk/qcom/Makefile +1 -0
index 1718c34d3551..efb0837ea199 100644
@@ -90,6 +90,7 @@ obj-$(CONFIG_SM_GCC_6350) += gcc-sm6350.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
+obj-$(CONFIG_SM_GCC_8450) += gcc-sm8450.o
 obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o
 obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o
 obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o
drivers/clk/qcom/gcc-sm8450.c new file +3303 -0

2,979 lines not on this page · raw message

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

Signature · 1 line
2.31.1

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

#6 lore raw

Re: [PATCH v2 2/2] clk: qcom: Add clock driver for SM8450

I love your patch! Yet something to improve:

Hi Vinod,

I love your patch! Yet something to improve:

[auto build test ERROR on clk/clk-next]
[also build test ERROR on robh/for-next v5.16-rc4 next-20211208] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vinod-Koul/clk-qcom-Add-clocks-for-SM8450-SoC/20211207-194218
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: riscv-randconfig-c006-20211208 (https://download.01.org/0day-ci/archive/20211208/202112082235.Hpn8OyQQ-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/42c0d6d58aceb3d76e99fd9738235962ab7a8e87
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vinod-Koul/clk-qcom-Add-clocks-for-SM8450-SoC/20211207-194218
git checkout 42c0d6d58aceb3d76e99fd9738235962ab7a8e87
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/clk/qcom/ drivers/iio/proximity/

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> drivers/clk/qcom/gcc-sm8450.c:40:29: error: use of undeclared identifier 'CLK_ALPHA_PLL_TYPE_LUCID_EVO'; did you mean 'CLK_ALPHA_PLL_TYPE_LUCID'?
           .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      CLK_ALPHA_PLL_TYPE_LUCID
   drivers/clk/qcom/clk-alpha-pll.h:17:2: note: 'CLK_ALPHA_PLL_TYPE_LUCID' declared here
           CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION,
           ^
>> drivers/clk/qcom/gcc-sm8450.c:50:12: error: use of undeclared identifier 'clk_alpha_pll_fixed_lucid_evo_ops'; did you mean 'clk_alpha_pll_fixed_lucid_5lpe_ops'?
                           .ops = &clk_alpha_pll_fixed_lucid_evo_ops,
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   clk_alpha_pll_fixed_lucid_5lpe_ops
   drivers/clk/qcom/clk-alpha-pll.h:149:29: note: 'clk_alpha_pll_fixed_lucid_5lpe_ops' declared here
   extern const struct clk_ops clk_alpha_pll_fixed_lucid_5lpe_ops;
                               ^
   drivers/clk/qcom/gcc-sm8450.c:66:29: error: use of undeclared identifier 'CLK_ALPHA_PLL_TYPE_LUCID_EVO'; did you mean 'CLK_ALPHA_PLL_TYPE_LUCID'?
           .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      CLK_ALPHA_PLL_TYPE_LUCID
   drivers/clk/qcom/clk-alpha-pll.h:17:2: note: 'CLK_ALPHA_PLL_TYPE_LUCID' declared here
           CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION,
           ^
>> drivers/clk/qcom/gcc-sm8450.c:73:11: error: use of undeclared identifier 'clk_alpha_pll_postdiv_lucid_evo_ops'
                   .ops = &clk_alpha_pll_postdiv_lucid_evo_ops,
                           ^
   drivers/clk/qcom/gcc-sm8450.c:79:29: error: use of undeclared identifier 'CLK_ALPHA_PLL_TYPE_LUCID_EVO'; did you mean 'CLK_ALPHA_PLL_TYPE_LUCID'?
           .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      CLK_ALPHA_PLL_TYPE_LUCID
   drivers/clk/qcom/clk-alpha-pll.h:17:2: note: 'CLK_ALPHA_PLL_TYPE_LUCID' declared here
           CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION,
           ^
   drivers/clk/qcom/gcc-sm8450.c:89:12: error: use of undeclared identifier 'clk_alpha_pll_fixed_lucid_evo_ops'; did you mean 'clk_alpha_pll_fixed_lucid_5lpe_ops'?
                           .ops = &clk_alpha_pll_fixed_lucid_evo_ops,
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   clk_alpha_pll_fixed_lucid_5lpe_ops
   drivers/clk/qcom/clk-alpha-pll.h:149:29: note: 'clk_alpha_pll_fixed_lucid_5lpe_ops' declared here
   extern const struct clk_ops clk_alpha_pll_fixed_lucid_5lpe_ops;
                               ^
   drivers/clk/qcom/gcc-sm8450.c:96:29: error: use of undeclared identifier 'CLK_ALPHA_PLL_TYPE_LUCID_EVO'; did you mean 'CLK_ALPHA_PLL_TYPE_LUCID'?
           .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      CLK_ALPHA_PLL_TYPE_LUCID
   drivers/clk/qcom/clk-alpha-pll.h:17:2: note: 'CLK_ALPHA_PLL_TYPE_LUCID' declared here
           CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION,
           ^
   drivers/clk/qcom/gcc-sm8450.c:106:12: error: use of undeclared identifier 'clk_alpha_pll_fixed_lucid_evo_ops'; did you mean 'clk_alpha_pll_fixed_lucid_5lpe_ops'?
                           .ops = &clk_alpha_pll_fixed_lucid_evo_ops,
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   clk_alpha_pll_fixed_lucid_5lpe_ops
   drivers/clk/qcom/clk-alpha-pll.h:149:29: note: 'clk_alpha_pll_fixed_lucid_5lpe_ops' declared here
   extern const struct clk_ops clk_alpha_pll_fixed_lucid_5lpe_ops;
                               ^

8 errors generated.

vim +40 drivers/clk/qcom/gcc-sm8450.c

    37	
    38	static struct clk_alpha_pll gcc_gpll0 = {
    39		.offset = 0x0,
  > 40		.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
    41		.clkr = {
    42			.enable_reg = 0x62018,
    43			.enable_mask = BIT(0),
    44			.hw.init = &(struct clk_init_data){
    45				.name = "gcc_gpll0",
    46				.parent_data = &(const struct clk_parent_data){
    47					.fw_name = "bi_tcxo",
    48				},
    49				.num_parents = 1,
  > 50				.ops = &clk_alpha_pll_fixed_lucid_evo_ops,
    51			},
    52		},
    53	};
    54	
    55	static const struct clk_div_table post_div_table_gcc_gpll0_out_even[] = {
    56		{ 0x1, 2 },
    57		{ }
    58	};
    59	
    60	static struct clk_alpha_pll_postdiv gcc_gpll0_out_even = {
    61		.offset = 0x0,
    62		.post_div_shift = 10,
    63		.post_div_table = post_div_table_gcc_gpll0_out_even,
    64		.num_post_div = ARRAY_SIZE(post_div_table_gcc_gpll0_out_even),
    65		.width = 4,
    66		.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
    67		.clkr.hw.init = &(struct clk_init_data){
    68			.name = "gcc_gpll0_out_even",
    69			.parent_data = &(const struct clk_parent_data){
    70				.hw = &gcc_gpll0.clkr.hw,
    71			},
    72			.num_parents = 1,
  > 73			.ops = &clk_alpha_pll_postdiv_lucid_evo_ops,
    74		},
    75	};
    76	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#7 lore raw

Re: [PATCH v2 2/2] clk: qcom: Add clock driver for SM8450

In reply to Vinod Koul

Quoting Vinod Koul (2021-12-07 03:40:03)

Quoted 43 lines
drivers/clk/qcom/gcc-sm8450.c new file +37 -0
new file mode 100644
index 000000000000..82ac419718d7
@@ -0,0 +1,3303 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021, Linaro Limited
+ */
+
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/qcom,gcc-sm8450.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "gdsc.h"
+#include "reset.h"
+
+enum {
+       P_BI_TCXO,
+       P_GCC_GPLL0_OUT_EVEN,
+       P_GCC_GPLL0_OUT_MAIN,
+       P_GCC_GPLL4_OUT_MAIN,
+       P_GCC_GPLL9_OUT_MAIN,
+       P_PCIE_0_PIPE_CLK,
+       P_PCIE_1_PHY_AUX_CLK,
+       P_PCIE_1_PIPE_CLK,
+       P_SLEEP_CLK,
+       P_UFS_PHY_RX_SYMBOL_0_CLK,
+       P_UFS_PHY_RX_SYMBOL_1_CLK,
+       P_UFS_PHY_TX_SYMBOL_0_CLK,
+       P_USB3_PHY_WRAPPER_GCC_USB30_PIPE_CLK,
+};
+

drivers/clk/qcom/gcc-sm8450.c line 47

Quoted 10 lines
drivers/clk/qcom/gcc-sm8450.c new file +10 -0
+static struct clk_alpha_pll gcc_gpll0 = {
+       .offset = 0x0,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
+       .clkr = {
+               .enable_reg = 0x62018,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_gpll0",
+                       .parent_data = &(const struct clk_parent_data){
+                               .fw_name = "bi_tcxo",

Maybe you want to drop these strings and use the dt index directly? That may actually be faster because we don't do as many string comparisons and the code may be smaller if we don't have to store bi_tcxo. I suppose to make it more readable we could have #defines for each DT index like

#define DT_BI_TCXO 0
#define DT_SLEEP_CLK 1

Blaze a new trail!

Quoted 6 lines
drivers/clk/qcom/gcc-sm8450.c new file +6 -0
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_fixed_lucid_evo_ops,
+               },
+       },
+};
#8 lore raw

Re: [PATCH v2 2/2] clk: qcom: Add clock driver for SM8450

Quoted 60 lines · Stephen Boyd

Quoting Vinod Koul (2021-12-07 03:40:03)

Quoted 43 lines
drivers/clk/qcom/gcc-sm8450.c new file +37 -0
new file mode 100644
index 000000000000..82ac419718d7
@@ -0,0 +1,3303 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021, Linaro Limited
+ */
+
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+
+#include <dt-bindings/clock/qcom,gcc-sm8450.h>
+
+#include "clk-alpha-pll.h"
+#include "clk-branch.h"
+#include "clk-rcg.h"
+#include "clk-regmap.h"
+#include "clk-regmap-divider.h"
+#include "clk-regmap-mux.h"
+#include "gdsc.h"
+#include "reset.h"
+
+enum {
+       P_BI_TCXO,
+       P_GCC_GPLL0_OUT_EVEN,
+       P_GCC_GPLL0_OUT_MAIN,
+       P_GCC_GPLL4_OUT_MAIN,
+       P_GCC_GPLL9_OUT_MAIN,
+       P_PCIE_0_PIPE_CLK,
+       P_PCIE_1_PHY_AUX_CLK,
+       P_PCIE_1_PIPE_CLK,
+       P_SLEEP_CLK,
+       P_UFS_PHY_RX_SYMBOL_0_CLK,
+       P_UFS_PHY_RX_SYMBOL_1_CLK,
+       P_UFS_PHY_TX_SYMBOL_0_CLK,
+       P_USB3_PHY_WRAPPER_GCC_USB30_PIPE_CLK,
+};
+

drivers/clk/qcom/gcc-sm8450.c line 47

Quoted 10 lines
drivers/clk/qcom/gcc-sm8450.c new file +10 -0
+static struct clk_alpha_pll gcc_gpll0 = {
+       .offset = 0x0,
+       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID_EVO],
+       .clkr = {
+               .enable_reg = 0x62018,
+               .enable_mask = BIT(0),
+               .hw.init = &(struct clk_init_data){
+                       .name = "gcc_gpll0",
+                       .parent_data = &(const struct clk_parent_data){
+                               .fw_name = "bi_tcxo",

Maybe you want to drop these strings and use the dt index directly? That may actually be faster because we don't do as many string comparisons and the code may be smaller if we don't have to store bi_tcxo. I suppose to make it more readable we could have #defines for each DT index like

Quoted 5 lines

#define DT_BI_TCXO 0
#define DT_SLEEP_CLK 1

Blaze a new trail!

I like the idea, and iiuc it's just a matter of replacing .fw_name with .index?

I am however worried that people will get the order wrong as they are hacking on their dts/drivers, because (at least in my view) the order of clocks & clock-names has been seen as "a dt binding requirement" up until such change. But if we replace the names with indices such enum would have to be kept in sync with the DT binding and there's no way to validate it.

If we do this we should force the driver and dts-writers to rely on the binding document by omitting clock-names from the binding (and hence dts). Otherwise people will (I will) assume that the clock-names are still what matters...

Regards,
Bjorn

Quoted 6 lines
Quoted 6 lines
drivers/clk/qcom/gcc-sm8450.c new file +6 -0
+                       },
+                       .num_parents = 1,
+                       .ops = &clk_alpha_pll_fixed_lucid_evo_ops,
+               },
+       },
+};
maintainer
#9 lore raw

Re: [PATCH v2 2/2] clk: qcom: Add clock driver for SM8450

Quoting Bjorn Andersson (2021-12-11 10:13:17)

Quoted 7 lines · Stephen Boyd
Quoted 6 lines

Maybe you want to drop these strings and use the dt index directly? That may actually be faster because we don't do as many string comparisons and the code may be smaller if we don't have to store bi_tcxo. I suppose to make it more readable we could have #defines for each DT index like

Quoted 8 lines
Quoted 5 lines

#define DT_BI_TCXO 0
#define DT_SLEEP_CLK 1

Blaze a new trail!

I like the idea, and iiuc it's just a matter of replacing .fw_name with .index?

Yes.

Quoted 7 lines

I am however worried that people will get the order wrong as they are hacking on their dts/drivers, because (at least in my view) the order of clocks & clock-names has been seen as "a dt binding requirement" up until such change. But if we replace the names with indices such enum would have to be kept in sync with the DT binding and there's no way to validate it.

That's lame, but I see your point. The order is definitely part of the binding but I'm not sure what we can do about folks deciding to reorder the clocks property. The checker has a blind spot here.

Quoted 6 lines

If we do this we should force the driver and dts-writers to rely on the binding document by omitting clock-names from the binding (and hence dts). Otherwise people will (I will) assume that the clock-names are still what matters...

I guess so. It still leaves everything exposed to the clocks property getting jumbled and then everything falling apart. Sigh.

I'm not sure how much worse this is than today where the clock-names property could be wrong and doesn't match the order of the clocks property. We don't catch that either with the checker, so it's about the same risk from my perspective. Why not take the risk and save on image size?

maintainer
#10 lore raw

Re: [PATCH v2 2/2] clk: qcom: Add clock driver for SM8450

In reply to Vinod Koul

Quoting Vinod Koul (2021-12-07 03:40:03)

Quoted 6 lines
drivers/clk/qcom/gcc-sm8450.c new file +0 -0
new file mode 100644
index 000000000000..82ac419718d7

drivers/clk/qcom/gcc-sm8450.c line 9

Quoted 9 lines
drivers/clk/qcom/gcc-sm8450.c new file +9 -0
@@ -0,0 +1,3303 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021, Linaro Limited
+ */
+
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>

BTW, clk providers need to include clk-provider.h

author
#11 lore raw

Re: [PATCH v2 2/2] clk: qcom: Add clock driver for SM8450

Quoted 10 lines · Stephen Boyd

Quoting Vinod Koul (2021-12-07 03:40:03)

Quoted 9 lines
drivers/clk/qcom/gcc-sm8450.c new file +3 -0
new file mode 100644
index 000000000000..82ac419718d7
@@ -0,0 +1,3303 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
Quoted 8 lines

drivers/clk/qcom/gcc-sm8450.c line 9

Quoted 6 lines
drivers/clk/qcom/gcc-sm8450.c new file +6 -0
+ * Copyright (c) 2021, Linaro Limited
+ */
+
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>

BTW, clk providers need to include clk-provider.h

It is included but indirectly thru clk-alpha-pll.h.. I think this should be fine.

Thanks

Signature · 1 line
~Vinod
maintainer
#12 lore raw

Re: [PATCH v2 2/2] clk: qcom: Add clock driver for SM8450

Quoting Vinod Koul (2021-12-13 21:34:51)

Quoted 20 lines · Stephen Boyd
Quoted 10 lines

Quoting Vinod Koul (2021-12-07 03:40:03)

Quoted 9 lines
drivers/clk/qcom/gcc-sm8450.c new file +3 -0
new file mode 100644
index 000000000000..82ac419718d7
@@ -0,0 +1,3303 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
Quoted 8 lines

drivers/clk/qcom/gcc-sm8450.c line 9

Quoted 6 lines
drivers/clk/qcom/gcc-sm8450.c new file +6 -0
+ * Copyright (c) 2021, Linaro Limited
+ */
+
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>

BTW, clk providers need to include clk-provider.h

Quoted 2 lines

It is included but indirectly thru clk-alpha-pll.h.. I think this should be fine.

No

#13 lore raw

Re: (subset) [PATCH v2 2/2] clk: qcom: Add clock driver for SM8450

In reply to Vinod Koul
Quoted 8 lines · Vinod Koul

This adds Global Clock controller (GCC) driver for SM8450 SoC including the gcc resets and gdsc.

This patch is based on initial code downstream by Vivek Aknurwar <[email protected]>

[...]

Applied, thanks!

[2/2] clk: qcom: Add clock driver for SM8450

      commit: e855145c5325c14b928aff439a0e2bc089e6a513

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>
maintainer
#14 lore raw
In reply to Vinod Koul

Quoting Vinod Koul (2021-12-07 03:40:01)

Quoted 8 lines

This series adds the GCC clock support required for SM8450 SoC along with devicetree binding for these clocks.

Please note that the GCC driver patch depends on new alpha LUCID_EVO introduced by Vamsi in [1]. That would be required to be picked before this patch can be applied.

[1]: https://lore.kernel.org/all/a0b04869a20a0afef99dd457ebb6474f50591210.1637302009.git.quic_vamslank@quicinc.com/

Can you use --base with format-patch please so that kbuild robot doesn't get angry? I think the robot may be able to find the patches and apply them now if you tell it what to base it on.

author
#15 lore raw
Quoted 8 lines · Stephen Boyd

Quoting Vinod Koul (2021-12-07 03:40:01)

Quoted 7 lines

This series adds the GCC clock support required for SM8450 SoC along with devicetree binding for these clocks.

Please note that the GCC driver patch depends on new alpha LUCID_EVO introduced by Vamsi in [1]. That would be required to be picked before this patch can be applied.

Quoted 5 lines
Quoted 1 line

[1]: https://lore.kernel.org/all/a0b04869a20a0afef99dd457ebb6474f50591210.1637302009.git.quic_vamslank@quicinc.com/

Can you use --base with format-patch please so that kbuild robot doesn't get angry? I think the robot may be able to find the patches and apply them now if you tell it what to base it on.

Aha, it would be interesting if bot is able to pick a patch using --base, let me try that for next rev and see if it is happy

Signature · 1 line
~Vinod