Skip to contentSkip to conversation

SDM630/660 Multimedia and GPU clock controllers

PATCH In review [email protected] 5 participants 21 messages Sep 26, 2020 – Jan 9, 2021

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

cover SDM630/660 Multimedia and GPU clock controllers

From: AngeloGioacchino Del Regno <[email protected]>

This patch series brings up the MultiMedia Clock Controller (MMCC) and the GPU Clock Controller (GPUCC) on the SDM660 series of SoCs, including SDM630, SDM636, SDM660 and SDA variants, where applicable.

This series depends on "Qualcomm clock fixes and preparation for SDM660", which is required for the drivers to work correctly and to even compile (due to the gfx3d rcg2 changes).

This patch series has been tested against the following devices:
- Sony Xperia XA2 Ultra (SDM630 Nile Discovery)
- Sony Xperia 10 (SDM630 Ganges Kirin)
- Sony Xperia 10 Plus (SDM636 Ganges Mermaid)

AngeloGioacchino Del Regno (4):
dt-bindings: clock: Add support for the SDM630 and SDM660 mmcc
clk: qcom: mmcc-sdm660: Add MDP clock source CXC to MDSS GDSC
clk: qcom: Add SDM660 GPU Clock Controller (GPUCC) driver
dt-bindings: clock: Add QCOM SDM630 and SDM660 graphics clock bindings

Martin Botka (1):
clk: qcom: Add SDM660 Multimedia Clock Controller (MMCC) driver

 .../devicetree/bindings/clock/qcom,mmcc.yaml  |    2 +
 .../bindings/clock/qcom,sdm660-gpucc.yaml     |   75 +
 drivers/clk/qcom/Kconfig                      |   18 +
 drivers/clk/qcom/Makefile                     |    2 +
 drivers/clk/qcom/gpucc-sdm660.c               |  349 ++
 drivers/clk/qcom/mmcc-sdm660.c                | 2857 +++++++++++++++++
 include/dt-bindings/clock/qcom,gpucc-sdm660.h |   28 +
 include/dt-bindings/clock/qcom,mmcc-sdm660.h  |  162 +
 8 files changed, 3493 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml
 create mode 100644 drivers/clk/qcom/gpucc-sdm660.c
 create mode 100644 drivers/clk/qcom/mmcc-sdm660.c
 create mode 100644 include/dt-bindings/clock/qcom,gpucc-sdm660.h
 create mode 100644 include/dt-bindings/clock/qcom,mmcc-sdm660.h
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/5 clk: qcom: Add SDM660 Multimedia Clock Controller (MMCC) driver

From: Martin Botka <[email protected]>

Add a driver for the multimedia clock controller found on SDM660 based devices. This should allow most multimedia device drivers to probe and control their clocks.

---
 drivers/clk/qcom/Kconfig                     |    9 +
 drivers/clk/qcom/Makefile                    |    1 +
 drivers/clk/qcom/mmcc-sdm660.c               | 2855 ++++++++++++++++++
 include/dt-bindings/clock/qcom,mmcc-sdm660.h |  162 +
 4 files changed, 3027 insertions(+)
 create mode 100644 drivers/clk/qcom/mmcc-sdm660.c
 create mode 100644 include/dt-bindings/clock/qcom,mmcc-sdm660.h
drivers/clk/qcom/Kconfig +9 -0
index 058327310c25..a12d37a4d729 100644
@@ -357,6 +357,15 @@ config SDM_GCC_660
 	  Say Y if you want to use peripheral devices such as UART, SPI,
 	  i2C, USB, UFS, SDDC, PCIe, etc.
 
+config SDM_MMCC_660
+	tristate "SDM660 Multimedia Clock Controller"
+	select SDM_GCC_660
+	select QCOM_GDSC
+	help
+	  Support for the multimedia clock controller on SDM660 devices.
+	  Say Y if you want to support multimedia devices such as display,
+	  graphics, video encode/decode, camera, etc.
+
 config QCS_TURING_404
 	tristate "QCS404 Turing Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index 9677e769e7e9..ada4f1bbe203 100644
@@ -60,6 +60,7 @@ obj-$(CONFIG_SC_VIDEOCC_7180) += videocc-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
+obj-$(CONFIG_SDM_MMCC_660) += mmcc-sdm660.o
 obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o
 obj-$(CONFIG_SDM_GPUCC_845) += gpucc-sdm845.o
 obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o
drivers/clk/qcom/mmcc-sdm660.c new file +2855 -0

2,855 lines not on this page · raw message

include/dt-bindings/clock/qcom,mmcc-sdm660.h new file +162 -0

123 lines not on this page · raw message

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

Signature · 1 line
2.28.0

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

#3 lore raw

Re: [PATCH 1/5] clk: qcom: Add SDM660 Multimedia Clock Controller (MMCC) driver

In reply to [email protected]
Thank you for the patch! Perhaps something to improve:

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on clk/clk-next]
[also build test WARNING on robh/for-next linux/master linus/master v5.9-rc7 next-20200930] [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/kholk11-gmail-com/SDM630-660-Multimedia-and-GPU-clock-controllers/20200926-210437
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: x86_64-randconfig-r031-20200930 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project bcd05599d0e53977a963799d6ee4f6e0bc21331b)

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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/a359b384264f2d3ea316c115a15cf9366eb7d53f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review kholk11-gmail-com/SDM630-660-Multimedia-and-GPU-clock-controllers/20200926-210437 git checkout a359b384264f2d3ea316c115a15cf9366eb7d53f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

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

All warnings (new ones prefixed by >>):

>> drivers/clk/qcom/mmcc-sdm660.c:428:32: warning: unused variable 'mmcc_xo_mmpll0_mmpll4_mmpll7_mmpll10_gpll0_mmpll6_map' [-Wunused-const-variable]
   static const struct parent_map mmcc_xo_mmpll0_mmpll4_mmpll7_mmpll10_gpll0_mmpll6_map[] = {
                                  ^

1 warning generated.

vim +/mmcc_xo_mmpll0_mmpll4_mmpll7_mmpll10_gpll0_mmpll6_map +428 drivers/clk/qcom/mmcc-sdm660.c

427

 > 428	static const struct parent_map mmcc_xo_mmpll0_mmpll4_mmpll7_mmpll10_gpll0_mmpll6_map[] = {

429 { P_XO, 0 },
430 { P_MMPLL0, 1 },
431 { P_MMPLL4, 2 },
432 { P_MMPLL7, 3 },
433 { P_MMPLL10, 4 },
434 { P_GPLL0, 5 },
435 { P_MMPLL6, 6 },
436 };
437

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

#4 lore raw

Re: [PATCH 1/5] clk: qcom: Add SDM660 Multimedia Clock Controller (MMCC) driver

Yes, The unused parent map should be removed and resent.

#5 lore raw

Re: [PATCH 1/5] clk: qcom: Add SDM660 Multimedia Clock Controller (MMCC) driver

Actually, correction. This parent is used by cpp_clk_src.

#6 lore raw

Re: [PATCH 1/5] clk: qcom: Add SDM660 Multimedia Clock Controller (MMCC) driver

In reply to [email protected]
Quoted 1 line · On Sat 26 Sep 08:03 CDT 2020, [email protected] wrote:
drivers/clk/qcom/mmcc-sdm660.c +0 -0

[..]

drivers/clk/qcom/mmcc-sdm660.c line 2806

Quoted 4 lines
drivers/clk/qcom/mmcc-sdm660.c +4 -0
+static int mmcc_660_probe(struct platform_device *pdev)
+{
+	struct regmap *regmap;
+	bool is_sdm630 = 0;

This shouldn't be 0, but there's no need for initializing it either, as the first reference is an assignment. On the other hand, you could without loss of clarity just move the of_device_is_compatible() into the if statement directly.

Quoted 39 lines
drivers/clk/qcom/mmcc-sdm660.c +39 -0
+
+	regmap = qcom_cc_map(pdev, &mmcc_660_desc);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
+
+	is_sdm630 = of_device_is_compatible(pdev->dev.of_node,
+					    "qcom,mmcc-sdm630");
+
+	clk_alpha_pll_configure(&mmpll3, regmap, &mmpll3_config);
+	clk_alpha_pll_configure(&mmpll4, regmap, &mmpll4_config);
+	clk_alpha_pll_configure(&mmpll5, regmap, &mmpll5_config);
+	clk_alpha_pll_configure(&mmpll7, regmap, &mmpll7_config);
+	clk_alpha_pll_configure(&mmpll8, regmap, &mmpll8_config);
+	clk_alpha_pll_configure(&mmpll10, regmap, &mmpll10_config);
+
+	if (is_sdm630) {
+		mmcc_660_desc.clks[BYTE1_CLK_SRC] = 0;
+		mmcc_660_desc.clks[MDSS_BYTE1_CLK] = 0;
+		mmcc_660_desc.clks[MDSS_BYTE1_INTF_DIV_CLK] = 0;
+		mmcc_660_desc.clks[MDSS_BYTE1_INTF_CLK] = 0;
+		mmcc_660_desc.clks[ESC1_CLK_SRC] = 0;
+		mmcc_660_desc.clks[MDSS_ESC1_CLK] = 0;
+		mmcc_660_desc.clks[PCLK1_CLK_SRC] = 0;
+		mmcc_660_desc.clks[MDSS_PCLK1_CLK] = 0;
+	}
+
+	return qcom_cc_really_probe(pdev, &mmcc_660_desc, regmap);
+}
+
+static struct platform_driver mmcc_660_driver = {
+	.probe		= mmcc_660_probe,
+	.driver		= {
+		.name	= "mmcc-sdm660",
+		.of_match_table = mmcc_660_match_table,
+	},
+};
+
+static int __init mmcc_660_init(void)
+{

drivers/clk/qcom/mmcc-sdm660.c line 2855

Quoted 10 lines
drivers/clk/qcom/mmcc-sdm660.c +10 -0
+	return platform_driver_register(&mmcc_660_driver);
+}
+core_initcall_sync(mmcc_660_init);
+
+static void __exit mmcc_660_exit(void)
+{
+	platform_driver_unregister(&mmcc_660_driver);
+}
+module_exit(mmcc_660_exit);
+

The driver is tristate (which is correct), but for that you need a MODULE_LICENSE at least.

include/dt-bindings/clock/qcom,mmcc-sdm660.h

Quoted 1 line
include/dt-bindings/clock/qcom,mmcc-sdm660.h +0 -0

Please move this to the dt-binding patch, and reorder the two.

include/dt-bindings/clock/qcom,mmcc-sdm660.h line 1

Quoted 6 lines

new file mode 100644
index 000000000000..f9dbc21cb5c7

include/dt-bindings/clock/qcom,mmcc-sdm660.h new file +1 -0
@@ -0,0 +1,162 @@
+/* SPDX-License-Identifier: GPL-2.0 */

And please make this "GPL-2.0-only OR BSD-2-Clause".

Regards,
Bjorn

#7 lore raw

PATCH 2/5 dt-bindings: clock: Add support for the SDM630 and SDM660 mmcc

In reply to [email protected]

From: AngeloGioacchino Del Regno <[email protected]>

Document the multimedia clock controller found on SDM630/660.

---
 Documentation/devicetree/bindings/clock/qcom,mmcc.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/clock/qcom,mmcc.yaml +2 -0
index af32dee14fc6..8b0b1c56f354 100644
@@ -24,6 +24,8 @@ properties:
       - qcom,mmcc-msm8974
       - qcom,mmcc-msm8996
       - qcom,mmcc-msm8998
+      - qcom,mmcc-sdm630
+      - qcom,mmcc-sdm660
 
   clocks:
     items:
Signature · 1 line
2.28.0
#8 lore raw

PATCH 3/5 clk: qcom: mmcc-sdm660: Add MDP clock source CXC to MDSS GDSC

In reply to [email protected]

From: AngeloGioacchino Del Regno <[email protected]>

It is required for optimal performance and to avoid MDP stalls to retain mem/periph on GDSC enablement: to achieve this, let's add the required CXC to the MDSS GDSC.

---
 drivers/clk/qcom/mmcc-sdm660.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/qcom/mmcc-sdm660.c +2 -0
index 234aca7c873b..7b1384cf8506 100644
@@ -2572,6 +2572,8 @@ static struct gdsc mdss_gdsc = {
 	.pd = {
 		.name = "mdss",
 	},
+	.cxcs = (unsigned int []){ 0x2040 },
+	.cxc_count = 1,
 	.pwrsts = PWRSTS_OFF_ON,
 };
 
Signature · 1 line
2.28.0
#9 lore raw

Re: [PATCH 3/5] clk: qcom: mmcc-sdm660: Add MDP clock source CXC to MDSS GDSC

Quoted 6 lines · On Sat 26 Sep 08:03 CDT 2020, [email protected] wrote:

From: AngeloGioacchino Del Regno <[email protected]>

It is required for optimal performance and to avoid MDP stalls to retain mem/periph on GDSC enablement: to achieve this, let's add the required CXC to the MDSS GDSC.

Can you please explain how you came to this conclusion, I don't see the reference to the MDP_CLK_SRC in the downstream kernel.

Thanks,
Bjorn

Quoted 21 lines
---
 drivers/clk/qcom/mmcc-sdm660.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/qcom/mmcc-sdm660.c +2 -0
index 234aca7c873b..7b1384cf8506 100644
@@ -2572,6 +2572,8 @@ static struct gdsc mdss_gdsc = {
 	.pd = {
 		.name = "mdss",
 	},
+	.cxcs = (unsigned int []){ 0x2040 },
+	.cxc_count = 1,
 	.pwrsts = PWRSTS_OFF_ON,
 };
 
Signature · 1 line
2.28.0
#10 lore raw

Re: [PATCH 3/5] clk: qcom: mmcc-sdm660: Add MDP clock source CXC to MDSS GDSC

Il giorno sab 5 dic 2020 alle ore 06:08 Bjorn Andersson <[email protected]> ha scritto:

Quoted 10 lines · On Sat 26 Sep 08:03 CDT 2020, [email protected] wrote:
Quoted 7 lines

From: AngeloGioacchino Del Regno <[email protected]>

It is required for optimal performance and to avoid MDP stalls to retain mem/periph on GDSC enablement: to achieve this, let's add the required CXC to the MDSS GDSC.

Quoted 6 lines

Can you please explain how you came to this conclusion, I don't see the reference to the MDP_CLK_SRC in the downstream kernel.

Thanks,
Bjorn

Hey!
I am sure I don't have to go too deep with such an explanation. You know, downstream is seriously tangled, perhaps that's why you couldn't find how.

By the way, as you can see, here in sdm660-mdss.dtsi we have the MDP_CLK_SRC clock:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/sdm660-mdss.dtsi?h=LA.UM.8.2.r2-03400-sdm660.0#n121

Since downstream uses to set the mem/periph retain in a different way, here you find
some references to what you're looking for:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/drivers/video/fbdev/msm/mdss_mdp.c?h=LA.UM.8.2.r2-03400-sdm660.0#n1555

...of course, also from my own tests, failing to set these flags will stall the MDP as
soon as we hit a resume from MDP idle power collapse.

P.S.: Sorry for the late reply!
--Angelo

Quoted 21 lines
Quoted 21 lines
---
 drivers/clk/qcom/mmcc-sdm660.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/qcom/mmcc-sdm660.c +2 -1
index 234aca7c873b..7b1384cf8506 100644
@@ -2572,6 +2572,8 @@ static struct gdsc mdss_gdsc = {
      .pd = {
              .name = "mdss",
      },
+     .cxcs = (unsigned int []){ 0x2040 },
+     .cxc_count = 1,
      .pwrsts = PWRSTS_OFF_ON,
 };
 
--

2.28.0

#11 lore raw

PATCH 4/5 clk: qcom: Add SDM660 GPU Clock Controller (GPUCC) driver

In reply to [email protected]

From: AngeloGioacchino Del Regno <[email protected]>

The GPUCC manages the clocks for the Adreno GPU found on the SDM630, SDM636, SDM660 SoCs.

---
 drivers/clk/qcom/Kconfig                      |   9 +
 drivers/clk/qcom/Makefile                     |   1 +
 drivers/clk/qcom/gpucc-sdm660.c               | 349 ++++++++++++++++++
 include/dt-bindings/clock/qcom,gpucc-sdm660.h |  28 ++
 4 files changed, 387 insertions(+)
 create mode 100644 drivers/clk/qcom/gpucc-sdm660.c
 create mode 100644 include/dt-bindings/clock/qcom,gpucc-sdm660.h
drivers/clk/qcom/Kconfig +9 -0
index a12d37a4d729..377fba33d041 100644
@@ -366,6 +366,15 @@ config SDM_MMCC_660
 	  Say Y if you want to support multimedia devices such as display,
 	  graphics, video encode/decode, camera, etc.
 
+config SDM_GPUCC_660
+	tristate "SDM660 Graphics Clock Controller"
+	select SDM_GCC_660
+	select QCOM_GDSC
+	help
+	  Support for the graphics clock controller on SDM630/636/660 devices.
+	  Say Y if you want to support graphics controller devices and
+	  functionality such as 3D graphics
+
 config QCS_TURING_404
 	tristate "QCS404 Turing Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index ada4f1bbe203..6a6906a62f96 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_SDM_CAMCC_845) += camcc-sdm845.o
 obj-$(CONFIG_SDM_DISPCC_845) += dispcc-sdm845.o
 obj-$(CONFIG_SDM_GCC_660) += gcc-sdm660.o
 obj-$(CONFIG_SDM_MMCC_660) += mmcc-sdm660.o
+obj-$(CONFIG_SDM_GPUCC_660) += gpucc-sdm660.o
 obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o
 obj-$(CONFIG_SDM_GPUCC_845) += gpucc-sdm845.o
 obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o
drivers/clk/qcom/gpucc-sdm660.c new file +349 -0

349 lines not on this page · raw message

include/dt-bindings/clock/qcom,gpucc-sdm660.h new file +28 -0
new file mode 100644
index 000000000000..680eaabd838d
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020, AngeloGioacchino Del Regno <[email protected]>
+ */
+
+#ifndef _DT_BINDINGS_CLK_SDM_GPUCC_660_H
+#define _DT_BINDINGS_CLK_SDM_GPUCC_660_H
+
+#define GPUCC_CXO_CLK			0
+#define GPU_PLL0_PLL			1
+#define GPU_PLL1_PLL			2
+#define GFX3D_CLK_SRC			3
+#define RBCPR_CLK_SRC			4
+#define RBBMTIMER_CLK_SRC		5
+#define GPUCC_RBCPR_CLK			6
+#define GPUCC_GFX3D_CLK			7
+#define GPUCC_RBBMTIMER_CLK		8
+
+#define GPU_CX_GDSC			0
+#define GPU_GX_GDSC			1
+
+#define GPU_CX_BCR			0
+#define GPU_GX_BCR			1
+#define RBCPR_BCR			2
+#define SPDM_BCR			3
+
+#endif
Signature · 1 line
2.28.0
#13 lore raw

Re: [PATCH 4/5] clk: qcom: Add SDM660 GPU Clock Controller (GPUCC) driver

In reply to [email protected]
Thank you for the patch! Yet something to improve:

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on clk/clk-next]
[also build test ERROR on robh/for-next linux/master linus/master v5.9-rc7 next-20200930] [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/kholk11-gmail-com/SDM630-660-Multimedia-and-GPU-clock-controllers/20200926-210437
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

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
# https://github.com/0day-ci/linux/commit/0551514b1ab723837163a8c4cd84d22831e38019
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review kholk11-gmail-com/SDM630-660-Multimedia-and-GPU-clock-controllers/20200926-210437 git checkout 0551514b1ab723837163a8c4cd84d22831e38019
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

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

All errors (new ones prefixed by >>):

>> drivers/clk/qcom/gpucc-sdm660.c:106:15: error: variable 'gfx3d_clk_src' has initializer but incomplete type
     106 | static struct clk_rcg2_gfx3d gfx3d_clk_src = {
         |               ^~~~~~~~~~~~~~
>> drivers/clk/qcom/gpucc-sdm660.c:107:3: error: 'struct clk_rcg2_gfx3d' has no member named 'div'
     107 |  .div = 2,
         |   ^~~
   drivers/clk/qcom/gpucc-sdm660.c:107:9: warning: excess elements in struct initializer
     107 |  .div = 2,
         |         ^
   drivers/clk/qcom/gpucc-sdm660.c:107:9: note: (near initialization for 'gfx3d_clk_src')
>> drivers/clk/qcom/gpucc-sdm660.c:108:3: error: 'struct clk_rcg2_gfx3d' has no member named 'rcg'
     108 |  .rcg = {
         |   ^~~
>> drivers/clk/qcom/gpucc-sdm660.c:108:9: error: extra brace group at end of initializer
     108 |  .rcg = {
         |         ^
   drivers/clk/qcom/gpucc-sdm660.c:108:9: note: (near initialization for 'gfx3d_clk_src')
   drivers/clk/qcom/gpucc-sdm660.c:108:9: warning: excess elements in struct initializer
   drivers/clk/qcom/gpucc-sdm660.c:108:9: note: (near initialization for 'gfx3d_clk_src')
>> drivers/clk/qcom/gpucc-sdm660.c:121:3: error: 'struct clk_rcg2_gfx3d' has no member named 'hws'
     121 |  .hws = (struct clk_hw*[]){
         |   ^~~
   drivers/clk/qcom/gpucc-sdm660.c:121:9: warning: excess elements in struct initializer
     121 |  .hws = (struct clk_hw*[]){
         |         ^
   drivers/clk/qcom/gpucc-sdm660.c:121:9: note: (near initialization for 'gfx3d_clk_src')
>> drivers/clk/qcom/gpucc-sdm660.c:139:25: error: invalid use of undefined type 'struct clk_rcg2_gfx3d'
     139 |     .hw = &gfx3d_clk_src.rcg.clkr.hw,
         |                         ^
   drivers/clk/qcom/gpucc-sdm660.c:257:45: error: 'NO_RET_PERIPH' undeclared here (not in a function)
     257 |  .flags = CLAMP_IO | SW_RESET | AON_RESET | NO_RET_PERIPH,
         |                                             ^~~~~~~~~~~~~
   drivers/clk/qcom/gpucc-sdm660.c:277:34: error: invalid use of undefined type 'struct clk_rcg2_gfx3d'
     277 |  [GFX3D_CLK_SRC] = &gfx3d_clk_src.rcg.clkr,
         |                                  ^
>> drivers/clk/qcom/gpucc-sdm660.c:106:30: error: storage size of 'gfx3d_clk_src' isn't known
     106 | static struct clk_rcg2_gfx3d gfx3d_clk_src = {
         |                              ^~~~~~~~~~~~~

vim +/gfx3d_clk_src +106 drivers/clk/qcom/gpucc-sdm660.c

105

 > 106	static struct clk_rcg2_gfx3d gfx3d_clk_src = {
 > 107		.div = 2,
 > 108		.rcg = {
   109			.cmd_rcgr = 0x1070,
   110			.mnd_width = 0,
   111			.hid_width = 5,
   112			.parent_map = gpucc_parent_map_1,
   113			.clkr.hw.init = &(struct clk_init_data){
   114				.name = "gfx3d_clk_src",
   115				.parent_data = gpucc_parent_data_1,
   116				.num_parents = 4,
   117				.ops = &clk_gfx3d_ops,
   118				.flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
   119			},
   120		},
 > 121		.hws = (struct clk_hw*[]){
   122			&gpucc_cxo_clk.clkr.hw,
   123			&gpu_pll0_pll_out_main.clkr.hw,
   124			&gpu_pll1_pll_out_main.clkr.hw,
   125		}
   126	};
   127	
   128	static struct clk_branch gpucc_gfx3d_clk = {
   129		.halt_reg = 0x1098,
   130		.halt_check = BRANCH_HALT,
   131		.hwcg_reg = 0x1098,
   132		.hwcg_bit = 1,
   133		.clkr = {
   134			.enable_reg = 0x1098,
   135			.enable_mask = BIT(0),
   136			.hw.init = &(struct clk_init_data){
   137				.name = "gpucc_gfx3d_clk",
   138				.parent_data = &(const struct clk_parent_data){
 > 139					.hw = &gfx3d_clk_src.rcg.clkr.hw,

140 },
141 .num_parents = 1,
142 .ops = &clk_branch2_ops,
143 .flags = CLK_SET_RATE_PARENT,
144 },
145 },
146 };
147

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

#14 lore raw

Re: [PATCH 4/5] clk: qcom: Add SDM660 GPU Clock Controller (GPUCC) driver

The kernel test robot is wrong: this commit builds fine by merging in the required patch series (464958) named "Qualcomm clock fixes and preparation for SDM660"
https://lore.kernel.org/patchwork/project/lkml/list/?series=464958

In that series there is a commit that generalizes the MSM8996-only gfx3d clock ops and introduces the definition of clk_rcg2_gfx3d.

Il giorno mer 30 set 2020 alle ore 22:46 kernel test robot <[email protected]> ha scritto:

Quoted 118 lines

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on clk/clk-next]
[also build test ERROR on robh/for-next linux/master linus/master v5.9-rc7 next-20200930] [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/kholk11-gmail-com/SDM630-660-Multimedia-and-GPU-clock-controllers/20200926-210437
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

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
# https://github.com/0day-ci/linux/commit/0551514b1ab723837163a8c4cd84d22831e38019
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review kholk11-gmail-com/SDM630-660-Multimedia-and-GPU-clock-controllers/20200926-210437 git checkout 0551514b1ab723837163a8c4cd84d22831e38019
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

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

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:106:15: error: variable 'gfx3d_clk_src' has initializer but incomplete type

     106 | static struct clk_rcg2_gfx3d gfx3d_clk_src = {
         |               ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:107:3: error: 'struct clk_rcg2_gfx3d' has no member named 'div'

     107 |  .div = 2,
         |   ^~~
   drivers/clk/qcom/gpucc-sdm660.c:107:9: warning: excess elements in struct initializer
     107 |  .div = 2,
         |         ^

drivers/clk/qcom/gpucc-sdm660.c:107:9: note: (near initialization for 'gfx3d_clk_src')

Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:108:3: error: 'struct clk_rcg2_gfx3d' has no member named 'rcg'

     108 |  .rcg = {
         |   ^~~
Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:108:9: error: extra brace group at end of initializer

     108 |  .rcg = {
         |         ^

drivers/clk/qcom/gpucc-sdm660.c:108:9: note: (near initialization for 'gfx3d_clk_src') drivers/clk/qcom/gpucc-sdm660.c:108:9: warning: excess elements in struct initializer drivers/clk/qcom/gpucc-sdm660.c:108:9: note: (near initialization for 'gfx3d_clk_src')

Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:121:3: error: 'struct clk_rcg2_gfx3d' has no member named 'hws'

     121 |  .hws = (struct clk_hw*[]){
         |   ^~~
   drivers/clk/qcom/gpucc-sdm660.c:121:9: warning: excess elements in struct initializer
     121 |  .hws = (struct clk_hw*[]){
         |         ^

drivers/clk/qcom/gpucc-sdm660.c:121:9: note: (near initialization for 'gfx3d_clk_src')

Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:139:25: error: invalid use of undefined type 'struct clk_rcg2_gfx3d'

     139 |     .hw = &gfx3d_clk_src.rcg.clkr.hw,
         |                         ^
   drivers/clk/qcom/gpucc-sdm660.c:257:45: error: 'NO_RET_PERIPH' undeclared here (not in a function)
     257 |  .flags = CLAMP_IO | SW_RESET | AON_RESET | NO_RET_PERIPH,
         |                                             ^~~~~~~~~~~~~
   drivers/clk/qcom/gpucc-sdm660.c:277:34: error: invalid use of undefined type 'struct clk_rcg2_gfx3d'
     277 |  [GFX3D_CLK_SRC] = &gfx3d_clk_src.rcg.clkr,
         |                                  ^
Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:106:30: error: storage size of 'gfx3d_clk_src' isn't known

     106 | static struct clk_rcg2_gfx3d gfx3d_clk_src = {
         |                              ^~~~~~~~~~~~~

vim +/gfx3d_clk_src +106 drivers/clk/qcom/gpucc-sdm660.c

   105
Quoted 3 lines

106 static struct clk_rcg2_gfx3d gfx3d_clk_src = {
107 .div = 2,
108 .rcg = {

   109                  .cmd_rcgr = 0x1070,
   110                  .mnd_width = 0,
   111                  .hid_width = 5,
   112                  .parent_map = gpucc_parent_map_1,
   113                  .clkr.hw.init = &(struct clk_init_data){
   114                          .name = "gfx3d_clk_src",
   115                          .parent_data = gpucc_parent_data_1,
   116                          .num_parents = 4,
   117                          .ops = &clk_gfx3d_ops,
   118                          .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,

119 },
120 },

Quoted 1 line

121 .hws = (struct clk_hw*[]){

   122                  &gpucc_cxo_clk.clkr.hw,
   123                  &gpu_pll0_pll_out_main.clkr.hw,
   124                  &gpu_pll1_pll_out_main.clkr.hw,
   125          }
   126  };
   127
   128  static struct clk_branch gpucc_gfx3d_clk = {
   129          .halt_reg = 0x1098,
   130          .halt_check = BRANCH_HALT,
   131          .hwcg_reg = 0x1098,
   132          .hwcg_bit = 1,
   133          .clkr = {
   134                  .enable_reg = 0x1098,
   135                  .enable_mask = BIT(0),
   136                  .hw.init = &(struct clk_init_data){
   137                          .name = "gpucc_gfx3d_clk",
   138                          .parent_data = &(const struct clk_parent_data){
Quoted 1 line

139 .hw = &gfx3d_clk_src.rcg.clkr.hw,

   140                          },
   141                          .num_parents = 1,
   142                          .ops = &clk_branch2_ops,
   143                          .flags = CLK_SET_RATE_PARENT,
   144                  },
   145          },
   146  };
   147

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

#15 lore raw

Re: [PATCH 4/5] clk: qcom: Add SDM660 GPU Clock Controller (GPUCC) driver

Quoted 1 line · AngeloGioacchino Del Regno

The kernel test robot is wrong: this commit builds fine by

Thanks for the info and sorry for the wrong report. Currently it is hard to detect the base in this case automatically, if possible, we recommend to use --base option when git format patch, this provides extra hint to us when looking for the base.

Quoted 128 lines

merging in the required patch series (464958) named "Qualcomm clock fixes and preparation for SDM660"
https://lore.kernel.org/patchwork/project/lkml/list/?series=464958

In that series there is a commit that generalizes the MSM8996-only gfx3d clock ops and introduces the definition of clk_rcg2_gfx3d.

Il giorno mer 30 set 2020 alle ore 22:46 kernel test robot <[email protected]> ha scritto:

Quoted 118 lines

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on clk/clk-next]
[also build test ERROR on robh/for-next linux/master linus/master v5.9-rc7 next-20200930] [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/kholk11-gmail-com/SDM630-660-Multimedia-and-GPU-clock-controllers/20200926-210437
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

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
# https://github.com/0day-ci/linux/commit/0551514b1ab723837163a8c4cd84d22831e38019
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review kholk11-gmail-com/SDM630-660-Multimedia-and-GPU-clock-controllers/20200926-210437 git checkout 0551514b1ab723837163a8c4cd84d22831e38019
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

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

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:106:15: error: variable 'gfx3d_clk_src' has initializer but incomplete type

     106 | static struct clk_rcg2_gfx3d gfx3d_clk_src = {
         |               ^~~~~~~~~~~~~~
Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:107:3: error: 'struct clk_rcg2_gfx3d' has no member named 'div'

     107 |  .div = 2,
         |   ^~~
   drivers/clk/qcom/gpucc-sdm660.c:107:9: warning: excess elements in struct initializer
     107 |  .div = 2,
         |         ^

drivers/clk/qcom/gpucc-sdm660.c:107:9: note: (near initialization for 'gfx3d_clk_src')

Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:108:3: error: 'struct clk_rcg2_gfx3d' has no member named 'rcg'

     108 |  .rcg = {
         |   ^~~
Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:108:9: error: extra brace group at end of initializer

     108 |  .rcg = {
         |         ^

drivers/clk/qcom/gpucc-sdm660.c:108:9: note: (near initialization for 'gfx3d_clk_src') drivers/clk/qcom/gpucc-sdm660.c:108:9: warning: excess elements in struct initializer drivers/clk/qcom/gpucc-sdm660.c:108:9: note: (near initialization for 'gfx3d_clk_src')

Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:121:3: error: 'struct clk_rcg2_gfx3d' has no member named 'hws'

     121 |  .hws = (struct clk_hw*[]){
         |   ^~~
   drivers/clk/qcom/gpucc-sdm660.c:121:9: warning: excess elements in struct initializer
     121 |  .hws = (struct clk_hw*[]){
         |         ^

drivers/clk/qcom/gpucc-sdm660.c:121:9: note: (near initialization for 'gfx3d_clk_src')

Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:139:25: error: invalid use of undefined type 'struct clk_rcg2_gfx3d'

     139 |     .hw = &gfx3d_clk_src.rcg.clkr.hw,
         |                         ^
   drivers/clk/qcom/gpucc-sdm660.c:257:45: error: 'NO_RET_PERIPH' undeclared here (not in a function)
     257 |  .flags = CLAMP_IO | SW_RESET | AON_RESET | NO_RET_PERIPH,
         |                                             ^~~~~~~~~~~~~
   drivers/clk/qcom/gpucc-sdm660.c:277:34: error: invalid use of undefined type 'struct clk_rcg2_gfx3d'
     277 |  [GFX3D_CLK_SRC] = &gfx3d_clk_src.rcg.clkr,
         |                                  ^
Quoted 1 line
Quoted 1 line

drivers/clk/qcom/gpucc-sdm660.c:106:30: error: storage size of 'gfx3d_clk_src' isn't known

     106 | static struct clk_rcg2_gfx3d gfx3d_clk_src = {
         |                              ^~~~~~~~~~~~~

vim +/gfx3d_clk_src +106 drivers/clk/qcom/gpucc-sdm660.c

   105
Quoted 3 lines

106 static struct clk_rcg2_gfx3d gfx3d_clk_src = {
107 .div = 2,
108 .rcg = {

   109                  .cmd_rcgr = 0x1070,
   110                  .mnd_width = 0,
   111                  .hid_width = 5,
   112                  .parent_map = gpucc_parent_map_1,
   113                  .clkr.hw.init = &(struct clk_init_data){
   114                          .name = "gfx3d_clk_src",
   115                          .parent_data = gpucc_parent_data_1,
   116                          .num_parents = 4,
   117                          .ops = &clk_gfx3d_ops,
   118                          .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,

119 },
120 },

Quoted 1 line

121 .hws = (struct clk_hw*[]){

   122                  &gpucc_cxo_clk.clkr.hw,
   123                  &gpu_pll0_pll_out_main.clkr.hw,
   124                  &gpu_pll1_pll_out_main.clkr.hw,
   125          }
   126  };
   127
   128  static struct clk_branch gpucc_gfx3d_clk = {
   129          .halt_reg = 0x1098,
   130          .halt_check = BRANCH_HALT,
   131          .hwcg_reg = 0x1098,
   132          .hwcg_bit = 1,
   133          .clkr = {
   134                  .enable_reg = 0x1098,
   135                  .enable_mask = BIT(0),
   136                  .hw.init = &(struct clk_init_data){
   137                          .name = "gpucc_gfx3d_clk",
   138                          .parent_data = &(const struct clk_parent_data){
Quoted 1 line

139 .hw = &gfx3d_clk_src.rcg.clkr.hw,

   140                          },
   141                          .num_parents = 1,
   142                          .ops = &clk_branch2_ops,
   143                          .flags = CLK_SET_RATE_PARENT,
   144                  },
   145          },
   146  };
   147

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

Reviewed-by on v1 4/5
#16 lore raw

Re: [PATCH 4/5] clk: qcom: Add SDM660 GPU Clock Controller (GPUCC) driver

In reply to [email protected]
Quoted 392 lines · On Sat 26 Sep 08:03 CDT 2020, [email protected] wrote:

From: AngeloGioacchino Del Regno <[email protected]>

The GPUCC manages the clocks for the Adreno GPU found on the SDM630, SDM636, SDM660 SoCs.

---
 drivers/clk/qcom/Kconfig                      |   9 +
 drivers/clk/qcom/Makefile                     |   1 +
 drivers/clk/qcom/gpucc-sdm660.c               | 349 ++++++++++++++++++
 include/dt-bindings/clock/qcom,gpucc-sdm660.h |  28 ++
 4 files changed, 387 insertions(+)
 create mode 100644 drivers/clk/qcom/gpucc-sdm660.c
 create mode 100644 include/dt-bindings/clock/qcom,gpucc-sdm660.h
drivers/clk/qcom/Kconfig +9 -0
index a12d37a4d729..377fba33d041 100644
@@ -366,6 +366,15 @@ config SDM_MMCC_660
 	  Say Y if you want to support multimedia devices such as display,
 	  graphics, video encode/decode, camera, etc.
 
+config SDM_GPUCC_660
+	tristate "SDM660 Graphics Clock Controller"
+	select SDM_GCC_660
+	select QCOM_GDSC
+	help
+	  Support for the graphics clock controller on SDM630/636/660 devices.
+	  Say Y if you want to support graphics controller devices and
+	  functionality such as 3D graphics
+
 config QCS_TURING_404
 	tristate "QCS404 Turing Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index ada4f1bbe203..6a6906a62f96 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_SDM_CAMCC_845) += camcc-sdm845.o
 obj-$(CONFIG_SDM_DISPCC_845) += dispcc-sdm845.o
 obj-$(CONFIG_SDM_GCC_660) += gcc-sdm660.o
 obj-$(CONFIG_SDM_MMCC_660) += mmcc-sdm660.o
+obj-$(CONFIG_SDM_GPUCC_660) += gpucc-sdm660.o
 obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o
 obj-$(CONFIG_SDM_GPUCC_845) += gpucc-sdm845.o
 obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o
drivers/clk/qcom/gpucc-sdm660.c new file +339 -0
new file mode 100644
index 000000000000..447a34aaa21f
@@ -0,0 +1,349 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020, AngeloGioacchino Del Regno <[email protected]>
+ */
+
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/reset-controller.h>
+#include <dt-bindings/clock/qcom,gpucc-sdm660.h>
+
+#include "clk-alpha-pll.h"
+#include "common.h"
+#include "clk-regmap.h"
+#include "clk-pll.h"
+#include "clk-rcg.h"
+#include "clk-branch.h"
+#include "gdsc.h"
+#include "reset.h"
+
+enum {
+	P_GPU_XO,
+	P_CORE_BI_PLL_TEST_SE,
+	P_GPLL0_OUT_MAIN,
+	P_GPLL0_OUT_MAIN_DIV,
+	P_GPU_PLL0_PLL_OUT_MAIN,
+	P_GPU_PLL1_PLL_OUT_MAIN,
+};
+
+static struct clk_branch gpucc_cxo_clk = {
+	.halt_reg = 0x1020,
+	.clkr = {
+		.enable_reg = 0x1020,
+		.enable_mask = BIT(0),
+		.hw.init = &(struct clk_init_data){
+			.name = "gpucc_cxo_clk",
+			.parent_data = &(const struct clk_parent_data){
+				.fw_name = "xo",
+				.name = "xo"
+			},
+			.num_parents = 1,
+			.ops = &clk_branch2_ops,
+			.flags = CLK_IS_CRITICAL,
+		},
+	},
+};
+
+static struct pll_vco gpu_vco[] = {
+	{ 1000000000, 2000000000, 0 },
+	{ 500000000,  1000000000, 2 },
+	{ 250000000,   500000000, 3 },
+};
+
+static struct clk_alpha_pll gpu_pll0_pll_out_main = {
+	.offset = 0x0,
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.vco_table = gpu_vco,
+	.num_vco = ARRAY_SIZE(gpu_vco),
+	.clkr.hw.init = &(struct clk_init_data){
+		.name = "gpu_pll0_pll_out_main",
+		.parent_data =  &(const struct clk_parent_data){
+			.hw = &gpucc_cxo_clk.clkr.hw,
+		},
+		.num_parents = 1,
+		.ops = &clk_alpha_pll_ops,
+	},
+};
+
+static struct clk_alpha_pll gpu_pll1_pll_out_main = {
+	.offset = 0x40,
+	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
+	.vco_table = gpu_vco,
+	.num_vco = ARRAY_SIZE(gpu_vco),
+	.clkr.hw.init = &(struct clk_init_data){
+		.name = "gpu_pll1_pll_out_main",
+		.parent_data = &(const struct clk_parent_data){
+			.hw = &gpucc_cxo_clk.clkr.hw,
+		},
+		.num_parents = 1,
+		.ops = &clk_alpha_pll_ops,
+	},
+};
+
+static const struct parent_map gpucc_parent_map_1[] = {
+	{ P_GPU_XO, 0 },
+	{ P_GPU_PLL0_PLL_OUT_MAIN, 1 },
+	{ P_GPU_PLL1_PLL_OUT_MAIN, 3 },
+	{ P_GPLL0_OUT_MAIN, 5 },
+};
+
+static const struct clk_parent_data gpucc_parent_data_1[] = {
+	{ .hw = &gpucc_cxo_clk.clkr.hw },
+	{ .hw = &gpu_pll0_pll_out_main.clkr.hw },
+	{ .hw = &gpu_pll1_pll_out_main.clkr.hw },
+	{ .fw_name = "gcc_gpu_gpll0_clk", .name = "gcc_gpu_gpll0_clk" },
+};
+
+static struct clk_rcg2_gfx3d gfx3d_clk_src = {
+	.div = 2,
+	.rcg = {
+		.cmd_rcgr = 0x1070,
+		.mnd_width = 0,
+		.hid_width = 5,
+		.parent_map = gpucc_parent_map_1,
+		.clkr.hw.init = &(struct clk_init_data){
+			.name = "gfx3d_clk_src",
+			.parent_data = gpucc_parent_data_1,
+			.num_parents = 4,
+			.ops = &clk_gfx3d_ops,
+			.flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
+		},
+	},
+	.hws = (struct clk_hw*[]){
+		&gpucc_cxo_clk.clkr.hw,
+		&gpu_pll0_pll_out_main.clkr.hw,
+		&gpu_pll1_pll_out_main.clkr.hw,
+	}
+};
+
+static struct clk_branch gpucc_gfx3d_clk = {
+	.halt_reg = 0x1098,
+	.halt_check = BRANCH_HALT,
+	.hwcg_reg = 0x1098,
+	.hwcg_bit = 1,
+	.clkr = {
+		.enable_reg = 0x1098,
+		.enable_mask = BIT(0),
+		.hw.init = &(struct clk_init_data){
+			.name = "gpucc_gfx3d_clk",
+			.parent_data = &(const struct clk_parent_data){
+				.hw = &gfx3d_clk_src.rcg.clkr.hw,
+			},
+			.num_parents = 1,
+			.ops = &clk_branch2_ops,
+			.flags = CLK_SET_RATE_PARENT,
+		},
+	},
+};
+
+static const struct parent_map gpucc_parent_map_0[] = {
+	{ P_GPU_XO, 0 },
+	{ P_GPLL0_OUT_MAIN, 5 },
+	{ P_GPLL0_OUT_MAIN_DIV, 6 },
+};
+
+static const struct clk_parent_data gpucc_parent_data_0[] = {
+	{ .hw = &gpucc_cxo_clk.clkr.hw },
+	{ .fw_name = "gcc_gpu_gpll0_clk", .name = "gcc_gpu_gpll0_clk" },
+	{ .fw_name = "gcc_gpu_gpll0_div_clk", .name = "gcc_gpu_gpll0_div_clk" },
+};
+
+static const struct freq_tbl ftbl_rbbmtimer_clk_src[] = {
+	F(19200000, P_GPU_XO, 1, 0, 0),
+	{ }
+};
+
+static struct clk_rcg2 rbbmtimer_clk_src = {
+	.cmd_rcgr = 0x10b0,
+	.mnd_width = 0,
+	.hid_width = 5,
+	.parent_map = gpucc_parent_map_0,
+	.freq_tbl = ftbl_rbbmtimer_clk_src,
+	.clkr.hw.init = &(struct clk_init_data){
+		.name = "rbbmtimer_clk_src",
+		.parent_data = gpucc_parent_data_0,
+		.num_parents = 3,
+		.ops = &clk_rcg2_ops,
+	},
+};
+
+static const struct freq_tbl ftbl_rbcpr_clk_src[] = {
+	F(19200000, P_GPU_XO, 1, 0, 0),
+	F(50000000, P_GPLL0_OUT_MAIN_DIV, 6, 0, 0),
+	{ }
+};
+
+static struct clk_rcg2 rbcpr_clk_src = {
+	.cmd_rcgr = 0x1030,
+	.mnd_width = 0,
+	.hid_width = 5,
+	.parent_map = gpucc_parent_map_0,
+	.freq_tbl = ftbl_rbcpr_clk_src,
+	.clkr.hw.init = &(struct clk_init_data){
+		.name = "rbcpr_clk_src",
+		.parent_data = gpucc_parent_data_0,
+		.num_parents = 3,
+		.ops = &clk_rcg2_ops,
+	},
+};
+
+static struct clk_branch gpucc_rbbmtimer_clk = {
+	.halt_reg = 0x10d0,
+	.halt_check = BRANCH_HALT,
+	.clkr = {
+		.enable_reg = 0x10d0,
+		.enable_mask = BIT(0),
+		.hw.init = &(struct clk_init_data){
+			.name = "gpucc_rbbmtimer_clk",
+			.parent_names = (const char *[]){
+				"rbbmtimer_clk_src",
+			},
+			.num_parents = 1,
+			.flags = CLK_SET_RATE_PARENT,
+			.ops = &clk_branch2_ops,
+		},
+	},
+};
+
+static struct clk_branch gpucc_rbcpr_clk = {
+	.halt_reg = 0x1054,
+	.halt_check = BRANCH_HALT,
+	.clkr = {
+		.enable_reg = 0x1054,
+		.enable_mask = BIT(0),
+		.hw.init = &(struct clk_init_data){
+			.name = "gpucc_rbcpr_clk",
+			.parent_names = (const char *[]){
+				"rbcpr_clk_src",
+			},
+			.num_parents = 1,
+			.flags = CLK_SET_RATE_PARENT,
+			.ops = &clk_branch2_ops,
+		},
+	},
+};
+
+static struct gdsc gpu_cx_gdsc = {
+	.gdscr = 0x1004,
+	.gds_hw_ctrl = 0x1008,
+	.pd = {
+		.name = "gpu_cx",
+	},
+	.pwrsts = PWRSTS_OFF_ON,
+	.flags = VOTABLE,
+};
+
+static struct gdsc gpu_gx_gdsc = {
+	.gdscr = 0x1094,
+	.clamp_io_ctrl = 0x130,
+	.resets = (unsigned int []){ GPU_GX_BCR },
+	.reset_count = 1,
+	.cxcs = (unsigned int []){ 0x1098 },
+	.cxc_count = 1,
+	.pd = {
+		.name = "gpu_gx",
+	},
+	.parent = &gpu_cx_gdsc.pd,
+	.pwrsts = PWRSTS_OFF | PWRSTS_ON | PWRSTS_RET,
+	.flags = CLAMP_IO | SW_RESET | AON_RESET | NO_RET_PERIPH,
+	//.supply = "vdd-gx";
+};
+
+static struct gdsc *gpucc_sdm660_gdscs[] = {
+	[GPU_CX_GDSC] = &gpu_cx_gdsc,
+	[GPU_GX_GDSC] = &gpu_gx_gdsc,
+};
+
+static const struct qcom_reset_map gpucc_sdm660_resets[] = {
+	[GPU_CX_BCR] = { 0x1000 },
+	[RBCPR_BCR] = { 0x1050 },
+	[GPU_GX_BCR] = { 0x1090 },
+	[SPDM_BCR] = { 0x10E0 },
+};
+
+static struct clk_regmap *gpucc_sdm660_clocks[] = {
+	[GPUCC_CXO_CLK] = &gpucc_cxo_clk.clkr,
+	[GPU_PLL0_PLL] = &gpu_pll0_pll_out_main.clkr,
+	[GPU_PLL1_PLL] = &gpu_pll1_pll_out_main.clkr,
+	[GFX3D_CLK_SRC] = &gfx3d_clk_src.rcg.clkr,
+	[RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr,
+	[RBBMTIMER_CLK_SRC] = &rbbmtimer_clk_src.clkr,
+	[GPUCC_RBCPR_CLK] = &gpucc_rbcpr_clk.clkr,
+	[GPUCC_GFX3D_CLK] = &gpucc_gfx3d_clk.clkr,
+	[GPUCC_RBBMTIMER_CLK] = &gpucc_rbbmtimer_clk.clkr,
+};
+
+static const struct regmap_config gpucc_660_regmap_config = {
+	.reg_bits	= 32,
+	.reg_stride	= 4,
+	.val_bits	= 32,
+	.max_register	= 0x9034,
+	.fast_io	= true,
+};
+
+static const struct qcom_cc_desc gpucc_sdm660_desc = {
+	.config = &gpucc_660_regmap_config,
+	.clks = gpucc_sdm660_clocks,
+	.num_clks = ARRAY_SIZE(gpucc_sdm660_clocks),
+	.resets = gpucc_sdm660_resets,
+	.num_resets = ARRAY_SIZE(gpucc_sdm660_resets),
+	.gdscs = gpucc_sdm660_gdscs,
+	.num_gdscs = ARRAY_SIZE(gpucc_sdm660_gdscs),
+};
+
+static const struct of_device_id gpucc_sdm660_match_table[] = {
+	{ .compatible = "qcom,gpucc-sdm660" },
+	{ .compatible = "qcom,gpucc-sdm630" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, gpucc_sdm660_match_table);
+
+static int gpucc_sdm660_probe(struct platform_device *pdev)
+{
+	struct regmap *regmap;
+	struct alpha_pll_config gpu_pll_config = {
+		.config_ctl_val = 0x4001055b,
+		.alpha = 0xaaaaab00,
+		.alpha_en_mask = BIT(24),
+		.vco_val = 0x2 << 20,
+		.vco_mask = 0x3 << 20,
+		.main_output_mask = 0x1,
+	};
+
+	regmap = qcom_cc_map(pdev, &gpucc_sdm660_desc);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
+
+	/* 800MHz configuration for GPU PLL0 */
+	gpu_pll_config.l = 0x29;
+	gpu_pll_config.alpha_hi = 0xaa;
+	clk_alpha_pll_configure(&gpu_pll0_pll_out_main, regmap, &gpu_pll_config);
+
+	/* 740MHz configuration for GPU PLL1 */
+	gpu_pll_config.l = 0x26;
+	gpu_pll_config.alpha_hi = 0x8a;
+	clk_alpha_pll_configure(&gpu_pll1_pll_out_main, regmap, &gpu_pll_config);
+
+	return qcom_cc_really_probe(pdev, &gpucc_sdm660_desc, regmap);
+}
+
+static struct platform_driver gpucc_sdm660_driver = {

drivers/clk/qcom/gpucc-sdm660.c line 349

Quoted 10 lines
drivers/clk/qcom/gpucc-sdm660.c new file +10 -0
+	.probe		= gpucc_sdm660_probe,
+	.driver		= {
+		.name	= "gpucc-sdm660",
+		.of_match_table = gpucc_sdm660_match_table,
+	},
+};
+module_platform_driver(gpucc_sdm660_driver);
+
+MODULE_DESCRIPTION("QCOM GPUCC SDM660/630 Driver");
+MODULE_LICENSE("GPL v2");

I think this part looks good. So for this part you have my:

include/dt-bindings/clock/qcom,gpucc-sdm660.h line 1

Quoted 7 lines
include/dt-bindings/clock/qcom,gpucc-sdm660.h new file +1 -0
new file mode 100644
index 000000000000..680eaabd838d
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */

But please move this to the binding, reorder them and please update the license to "GPL-2.0-only OR BSD-2-Clause".

Regards,
Bjorn

Quoted 30 lines
include/dt-bindings/clock/qcom,gpucc-sdm660.h new file +27 -0
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020, AngeloGioacchino Del Regno <[email protected]>
+ */
+
+#ifndef _DT_BINDINGS_CLK_SDM_GPUCC_660_H
+#define _DT_BINDINGS_CLK_SDM_GPUCC_660_H
+
+#define GPUCC_CXO_CLK			0
+#define GPU_PLL0_PLL			1
+#define GPU_PLL1_PLL			2
+#define GFX3D_CLK_SRC			3
+#define RBCPR_CLK_SRC			4
+#define RBBMTIMER_CLK_SRC		5
+#define GPUCC_RBCPR_CLK			6
+#define GPUCC_GFX3D_CLK			7
+#define GPUCC_RBBMTIMER_CLK		8
+
+#define GPU_CX_GDSC			0
+#define GPU_GX_GDSC			1
+
+#define GPU_CX_BCR			0
+#define GPU_GX_BCR			1
+#define RBCPR_BCR			2
+#define SPDM_BCR			3
+
+#endif
Signature · 1 line
2.28.0
#17 lore raw

PATCH 5/5 dt-bindings: clock: Add QCOM SDM630 and SDM660 graphics clock bindings

In reply to [email protected]

From: AngeloGioacchino Del Regno <[email protected]>

Add device tree bindings for graphics clock controller for Qualcomm Technology Inc's SDM630 and SDM660 SoCs.

---
 .../bindings/clock/qcom,sdm660-gpucc.yaml     | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml
Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml new file +75 -0
new file mode 100644
index 000000000000..dbb14b274d5b
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,sdm660-gpucc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Graphics Clock & Reset Controller Binding for SDM630 and SDM660
+
+maintainers:
+  - Taniya Das <[email protected]>
+
+description: |
+  Qualcomm graphics clock control module which supports the clocks, resets and
+  power domains on SDM630 and SDM660.
+
+  See also dt-bindings/clock/qcom,gpucc-sdm660.h.
+
+properties:
+  compatible:
+    enum:
+      - qcom,sdm630-gpucc
+      - qcom,sdm660-gpucc
+
+  clocks:
+    items:
+      - description: Board XO source
+      - description: GPLL0 main gpu branch
+      - description: GPLL0 divider gpu branch
+
+  clock-names:
+    items:
+      - const: xo
+      - const: gcc_gpu_gpll0_clk
+      - const: gcc_gpu_gpll0_div_clk
+
+  '#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,gcc-sdm660.h>
+    #include <dt-bindings/clock/qcom,rpmcc.h>
+
+    clock-controller@5065000 {
+      compatible = "qcom,sdm660-gpucc";
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+      #power-domain-cells = <1>;
+      reg = <0x05065000 0x9038>;
+      clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>,
+               <&gcc GCC_GPU_GPLL0_CLK>,
+               <&gcc GCC_GPU_GPLL0_DIV_CLK>;
+      clock-names = "xo", "gpll0";
+    };
+...
Signature · 1 line
2.28.0
#19 lore raw

Re: [PATCH 5/5] dt-bindings: clock: Add QCOM SDM630 and SDM660 graphics clock bindings

In reply to [email protected]
Quoted 78 lines · On Sat 26 Sep 08:03 CDT 2020, [email protected] wrote:

From: AngeloGioacchino Del Regno <[email protected]>

Add device tree bindings for graphics clock controller for Qualcomm Technology Inc's SDM630 and SDM660 SoCs.

---
 .../bindings/clock/qcom,sdm660-gpucc.yaml     | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml
Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml new file +63 -0
new file mode 100644
index 000000000000..dbb14b274d5b
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,sdm660-gpucc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Graphics Clock & Reset Controller Binding for SDM630 and SDM660
+
+maintainers:
+  - Taniya Das <[email protected]>
+
+description: |
+  Qualcomm graphics clock control module which supports the clocks, resets and
+  power domains on SDM630 and SDM660.
+
+  See also dt-bindings/clock/qcom,gpucc-sdm660.h.
+
+properties:
+  compatible:
+    enum:
+      - qcom,sdm630-gpucc
+      - qcom,sdm660-gpucc
+
+  clocks:
+    items:
+      - description: Board XO source
+      - description: GPLL0 main gpu branch
+      - description: GPLL0 divider gpu branch
+
+  clock-names:
+    items:
+      - const: xo
+      - const: gcc_gpu_gpll0_clk
+      - const: gcc_gpu_gpll0_div_clk
+
+  '#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,gcc-sdm660.h>
+    #include <dt-bindings/clock/qcom,rpmcc.h>
+

Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml line 73

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml new file +10 -0
+    clock-controller@5065000 {
+      compatible = "qcom,sdm660-gpucc";
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+      #power-domain-cells = <1>;
+      reg = <0x05065000 0x9038>;
+      clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>,
+               <&gcc GCC_GPU_GPLL0_CLK>,
+               <&gcc GCC_GPU_GPLL0_DIV_CLK>;
+      clock-names = "xo", "gpll0";

You need 3 clock-names, and they need to match what the binding defines.

Other than that I think it looks good.

Regards,
Bjorn

Quoted 5 lines
Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml new file +2 -0
+    };
+...
Signature · 1 line
2.28.0
#20 lore raw
In reply to [email protected]

Il giorno sab 26 set 2020 alle ore 15:03 <[email protected]> ha scritto:

Quoted 40 lines

From: AngeloGioacchino Del Regno <[email protected]>

This patch series brings up the MultiMedia Clock Controller (MMCC) and the GPU Clock Controller (GPUCC) on the SDM660 series of SoCs, including SDM630, SDM636, SDM660 and SDA variants, where applicable.

This series depends on "Qualcomm clock fixes and preparation for SDM660", which is required for the drivers to work correctly and to even compile (due to the gfx3d rcg2 changes).

This patch series has been tested against the following devices:
- Sony Xperia XA2 Ultra (SDM630 Nile Discovery)
- Sony Xperia 10 (SDM630 Ganges Kirin)
- Sony Xperia 10 Plus (SDM636 Ganges Mermaid)

AngeloGioacchino Del Regno (4):
dt-bindings: clock: Add support for the SDM630 and SDM660 mmcc
clk: qcom: mmcc-sdm660: Add MDP clock source CXC to MDSS GDSC
clk: qcom: Add SDM660 GPU Clock Controller (GPUCC) driver
dt-bindings: clock: Add QCOM SDM630 and SDM660 graphics clock bindings

Martin Botka (1):
clk: qcom: Add SDM660 Multimedia Clock Controller (MMCC) driver

 .../devicetree/bindings/clock/qcom,mmcc.yaml  |    2 +
 .../bindings/clock/qcom,sdm660-gpucc.yaml     |   75 +
 drivers/clk/qcom/Kconfig                      |   18 +
 drivers/clk/qcom/Makefile                     |    2 +
 drivers/clk/qcom/gpucc-sdm660.c               |  349 ++
 drivers/clk/qcom/mmcc-sdm660.c                | 2857 +++++++++++++++++
 include/dt-bindings/clock/qcom,gpucc-sdm660.h |   28 +
 include/dt-bindings/clock/qcom,mmcc-sdm660.h  |  162 +
 8 files changed, 3493 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,sdm660-gpucc.yaml
 create mode 100644 drivers/clk/qcom/gpucc-sdm660.c
 create mode 100644 drivers/clk/qcom/mmcc-sdm660.c
 create mode 100644 include/dt-bindings/clock/qcom,gpucc-sdm660.h
 create mode 100644 include/dt-bindings/clock/qcom,mmcc-sdm660.h
Quoted 3 lines

--
2.28.0

Hello!
Is this patch series getting lost and forgotten?
Can this please get some attention before it gets buried forever?

Thanks,
Angelo