SDM670 Global Clocks
cover SDM670 Global Clocks
This patch series adds global clocks essential for features of the Qualcomm Snapdragon 670 (hopefully) cleanly into the SDM845 driver without doing runtime fixups like in Google's bonito kernel (see patch 3).
This series (mostly patch 2) affects kernels made for Snapdragon 845 and might need some further testing on SDM845 devices. I do not have a Snapdragon 845-based device so someone else will have to double check if it is necessary.
.../devicetree/bindings/clock/qcom,gcc-sdm845.yaml | 24 +- drivers/clk/qcom/Kconfig | 4 +- drivers/clk/qcom/gcc-sdm845.c | 405 ++++++++++++++++++++- include/dt-bindings/clock/qcom,gcc-sdm845.h | 2 + 4 files changed, 426 insertions(+), 9 deletions(-)
PS: This is my first contribution to the kernel so I apologize if I do something wrong.
PATCH 1/3 dt-bindings: clock: gcc-sdm845: add sdm670 global clocks
The Snapdragon 670 clocks will be added into the sdm845 gcc driver. Most of the new clocks, GDSCs, and resets already have reserved IDs but there are some resources that don't. Add the new clock and extra BCR from Snapdragon 670 and document the differences between the SoC parent clocks.
--- .../bindings/clock/qcom,gcc-sdm845.yaml | 24 +++++++++++++++---- include/dt-bindings/clock/qcom,gcc-sdm845.h | 2 ++ 2 files changed, 21 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml +19 -5
@@ -19,23 +19,21 @@ description: | properties: compatible: - const: qcom,gcc-sdm845 + enum: + - qcom,gcc-sdm670 + - qcom,gcc-sdm845 clocks: items: - description: Board XO source - description: Board active XO source - description: Sleep clock source - - description: PCIE 0 Pipe clock source - - description: PCIE 1 Pipe clock source clock-names: items: - const: bi_tcxo - const: bi_tcxo_ao - const: sleep_clk - - const: pcie_0_pipe_clk - - const: pcie_1_pipe_clk '#clock-cells': const: 1
@@ -63,6 +61,22 @@ required: - '#reset-cells' - '#power-domain-cells' +if: + properties: + compatible: + contains: + const: qcom,gcc-sdm845 +then: + properties: + clocks: + items: + - description: PCIE 0 Pipe clock source + - description: PCIE 1 Pipe clock source + clock-names: + items: + - const: pcie_0_pipe_clk + - const: pcie_1_pipe_clk + additionalProperties: false examples:
include/dt-bindings/clock/qcom,gcc-sdm845.h +2 -0
@@ -199,6 +199,7 @@#define GCC_QSPI_CNOC_PERIPH_AHB_CLK 189#define GCC_LPASS_Q6_AXI_CLK 190#define GCC_LPASS_SWAY_CLK 191 +#define GPLL6 192/* GCC Resets */ #define GCC_MMSS_BCR 0
@@ -227,6 +228,7 @@#define GCC_USB_PHY_CFG_AHB2PHY_BCR 23#define GCC_PCIE_0_PHY_BCR 24#define GCC_PCIE_1_PHY_BCR 25 +#define GCC_SDCC1_BCR 26/* GCC GDSCRs */ #define PCIE_0_GDSC 0
Signature · 1 line
2.37.3
Rob Herring
maintainerRe: [PATCH 1/3] dt-bindings: clock: gcc-sdm845: add sdm670 global clocks
Quoted 21 lines · Richard Acayan
The Snapdragon 670 clocks will be added into the sdm845 gcc driver. Most of the new clocks, GDSCs, and resets already have reserved IDs but there are some resources that don't. Add the new clock and extra BCR from Snapdragon 670 and document the differences between the SoC parent clocks.
Signed-off-by Richard Acayan <[email protected]>--- .../bindings/clock/qcom,gcc-sdm845.yaml | 24 +++++++++++++++---- include/dt-bindings/clock/qcom,gcc-sdm845.h | 2 ++ 2 files changed, 21 insertions(+), 5 deletions(-)Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml +1
-1@@ -19,23 +19,21 @@ description: | properties: compatible: - const: qcom,gcc-sdm845 + enum:
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml description: | · line 30
Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml +2
-2+ - qcom,gcc-sdm670 + - qcom,gcc-sdm845 clocks: items: - description: Board XO source - description: Board active XO source - description: Sleep clock source - - description: PCIE 0 Pipe clock source - - description: PCIE 1 Pipe clock source
You just changed the clocks from 5 to 3. Please test your changes:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.example.dtb: clock-controller@100000: clocks: [[4294967295, 0], [4294967295, 1], [4294967295], [4294967295], [4294967295]] is too long
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.example.dtb: clock-controller@100000: clock-names: ['bi_tcxo', 'bi_tcxo_ao', 'sleep_clk', 'pcie_0_pipe_clk', 'pcie_1_pipe_clk'] is too long
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.example.dtb: clock-controller@100000: clocks: [[4294967295, 0], [4294967295, 1], [4294967295], [4294967295], [4294967295]] is too long
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.example.dtb: clock-controller@100000: clock-names:0: 'pcie_0_pipe_clk' was expected
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.example.dtb: clock-controller@100000: clock-names:1: 'pcie_1_pipe_clk' was expected
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.example.dtb: clock-controller@100000: clock-names: ['bi_tcxo', 'bi_tcxo_ao', 'sleep_clk', 'pcie_0_pipe_clk', 'pcie_1_pipe_clk'] is too long
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml
What you want here I think is 'minItems: 3' and then restrict the clocks to 3 or 5 in the if/then schema.
Rob
Re: [PATCH 1/3] dt-bindings: clock: gcc-sdm845: add sdm670 global clocks
Quoted 1 line
You just changed the clocks from 5 to 3. Please test your changes:
Right. I'll make sure to set up CI locally before my next series.
Quoted 2 lines
What you want here I think is 'minItems: 3' and then restrict the clocks to 3 or 5 in the if/then schema.
Yes, thanks for directing me. I found what I needed in Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml.
PATCH 2/3 clk: qcom: gcc-sdm845: use device tree match data
In reply to Richard AcayanThis driver will support more than one SoC's set of clocks, and set of GDSCs. This behavior would be unclean with hard-coded static variables. Support it by grabbing clocks, GDSCs, and BCRs in the match data.
--- drivers/clk/qcom/gcc-sdm845.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/qcom/gcc-sdm845.c +4 -2
@@ -3574,7 +3574,7 @@ static const struct qcom_cc_desc gcc_sdm845_desc = { };static const struct of_device_id gcc_sdm845_match_table[] = { - { .compatible ="qcom,gcc-sdm845" }, + { .compatible ="qcom,gcc-sdm845" , .data = &gcc_sdm845_desc }, { } };MODULE_DEVICE_TABLE (of, gcc_sdm845_match_table);
@@ -3600,6 +3600,7 @@ static const struct clk_rcg_dfs_data gcc_dfs_clocks[] = {static int gcc_sdm845_probe (struct platform_device *pdev) { +const struct qcom_cc_desc *gcc_desc;struct regmap *regmap;int ret;
@@ -3616,7 +3617,8 @@ static int gcc_sdm845_probe(struct platform_device *pdev)if (ret)return ret; -return qcom_cc_really_probe (pdev, &gcc_sdm845_desc, regmap); + gcc_desc =of_device_get_match_data (&pdev->dev); +return qcom_cc_really_probe (pdev, gcc_desc, regmap); }static struct platform_driver gcc_sdm845_driver = {
Signature · 1 line
2.37.3
PATCH 3/3 clk: qcom: gcc-sdm845: add sdm670 global clock data
In reply to Richard AcayanThe Snapdragon 670 adds and removes some clocks, adds new frequencies, and adds a new GPLL (Global Phase-Locked Loop) in reference to SDM845, while also removing some GDSCs. Despite these differences, there are many similarities with SDM670. Add data for SDM670 in the driver for SDM845 to reuse the most of the clock data.
Advantages and disadvantages of this approach:
+ maintenance applies to both sdm670 and sdm845 by default
+ less duplicate code (clocks) means smaller distro/pre-built kernels with all drivers enabled
- clocks for both SoC's must be compiled if the user wants clocks for one specific SoC (both or none)
- additional testing needed for sdm845 devices
--- drivers/clk/qcom/Kconfig | 4 +- drivers/clk/qcom/gcc-sdm845.c | 399 ++++++++++++++++++++++++++++++++++ 2 files changed, 401 insertions(+), 2 deletions(-)
drivers/clk/qcom/Kconfig +2 -2
@@ -545,10 +545,10 @@ config QCS_Q6SSTOP_404 controller to reset the Q6SSTOP subsystem. config SDM_GCC_845 - tristate "SDM845 Global Clock Controller" + tristate "SDM845/SDM670 Global Clock Controller" select QCOM_GDSC help - Support for the global clock controller on SDM845 devices. + Support for the global clock controller on SDM845 and SDM670 devices. Say Y if you want to use peripheral devices such as UART, SPI, i2C, USB, UFS, SDDC, PCIe, etc.
drivers/clk/qcom/gcc-sdm845.c +399 -0
483 lines not on this page · raw message
Signature · 1 line
2.37.3
kernel test robot
build botRe: [PATCH 3/3] clk: qcom: gcc-sdm845: add sdm670 global clock data
Thank you for the patch! Perhaps something to improve:
Hi Richard,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on clk/clk-next]
[also build test WARNING on linus/master v6.0-rc4]
[cannot apply to next-20220906]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Richard-Acayan/SDM670-Global-Clocks/20220907-105158 base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next config: riscv-randconfig-r031-20220906 (https://download.01.org/0day-ci/archive/20220907/[email protected]/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project c55b41d5199d2394dd6cdb8f52180d8b81d809d4)
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/intel-lab-lkp/linux/commit/bfed597346daad9f2f2a30c553c855fbefc1fe7e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Richard-Acayan/SDM670-Global-Clocks/20220907-105158
git checkout bfed597346daad9f2f2a30c553c855fbefc1fe7e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/clk/qcom/ net/mptcp/
If you fix the issue, kindly add following tag where applicable
All warnings (new ones prefixed by >>):
In file included from drivers/clk/qcom/gcc-sdm845.c:14:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/clk/qcom/gcc-sdm845.c:14:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/clk/qcom/gcc-sdm845.c:14:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:1134:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
drivers/clk/qcom/gcc-sdm845.c:3619:29: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
[GCC_SDCC1_ICE_CORE_CLK] = &gcc_sdcc1_ice_core_clk_src.clkr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/clk/qcom/gcc-sdm845.c:3618:29: note: previous initialization is here
[GCC_SDCC1_ICE_CORE_CLK] = &gcc_sdcc1_ice_core_clk.clkr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/clk/qcom/gcc-sdm845.c:268:30: warning: unused variable 'ftbl_gcc_sdm670_cpuss_rbcpr_clk_src' [-Wunused-const-variable]
static const struct freq_tbl ftbl_gcc_sdm670_cpuss_rbcpr_clk_src[] = {
^9 warnings generated.
vim +/ftbl_gcc_sdm670_cpuss_rbcpr_clk_src +268 drivers/clk/qcom/gcc-sdm845.c
267
> 268 static const struct freq_tbl ftbl_gcc_sdm670_cpuss_rbcpr_clk_src[] = { 269 F(19200000, P_BI_TCXO, 1, 0, 0),
270 F(50000000, P_GPLL0_OUT_MAIN, 12, 0, 0),
271 { }
272 };
273
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp