Skip to contentSkip to conversation

MSM8998 GPUCC Support

PATCH Applied Jeffrey Hugo 3 participants 11 messages May 28, 2019 – Jun 7, 2019

Subsystems (5)

v1 of 5 Applied Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover MSM8998 GPUCC Support

The Adreno GPU on MSM8998 has its own clock controller, which is a dependency for bringing up the GPU. This series gets the gpucc all in place as another step on the road to getting the GPU enabled.

Jeffrey Hugo (3):
dt-bindings: clock: Document gpucc for msm8998
clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver
arm64: dts: qcom: msm8998: Add gpucc node

 .../devicetree/bindings/clock/qcom,gpucc.txt  |   4 +-
 arch/arm64/boot/dts/qcom/msm8998.dtsi         |  15 +
 drivers/clk/qcom/Kconfig                      |   8 +
 drivers/clk/qcom/Makefile                     |   1 +
 drivers/clk/qcom/gpucc-msm8998.c              | 364 ++++++++++++++++++
 .../dt-bindings/clock/qcom,gpucc-msm8998.h    |  29 ++
 6 files changed, 420 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/qcom/gpucc-msm8998.c
 create mode 100644 include/dt-bindings/clock/qcom,gpucc-msm8998.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 dt-bindings: clock: Document gpucc for msm8998

The GPU for msm8998 has its own clock controller. Document it.

---
 .../devicetree/bindings/clock/qcom,gpucc.txt  |  4 ++-
 .../dt-bindings/clock/qcom,gpucc-msm8998.h    | 29 +++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/clock/qcom,gpucc-msm8998.h
Documentation/devicetree/bindings/clock/qcom,gpucc.txt +3 -1
index 4e5215ef1acd..269afe8a757e 100644
@@ -2,13 +2,15 @@ Qualcomm Graphics Clock & Reset Controller Binding
 --------------------------------------------------
 
 Required properties :
-- compatible : shall contain "qcom,sdm845-gpucc"
+- compatible : shall contain "qcom,sdm845-gpucc" or "qcom,msm8998-gpucc"
 - reg : shall contain base register location and length
 - #clock-cells : from common clock binding, shall contain 1
 - #reset-cells : from common reset binding, shall contain 1
 - #power-domain-cells : from generic power domain binding, shall contain 1
 - clocks : shall contain the XO clock
+	   shall contain the gpll0 out main clock (msm8998)
 - clock-names : shall be "xo"
+		shall be "gpll0" (msm8998)
 
 Example:
 	gpucc: clock-controller@5090000 {
include/dt-bindings/clock/qcom,gpucc-msm8998.h new file +29 -0
new file mode 100644
index 000000000000..2623570ee974
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2019, Jeffrey Hugo
+ */
+
+#ifndef _DT_BINDINGS_CLK_MSM_GPUCC_8998_H
+#define _DT_BINDINGS_CLK_MSM_GPUCC_8998_H
+
+#define GPUPLL0						0
+#define GPUPLL0_OUT_EVEN				1
+#define RBCPR_CLK_SRC					2
+#define GFX3D_CLK_SRC					3
+#define RBBMTIMER_CLK_SRC				4
+#define GFX3D_ISENSE_CLK_SRC				5
+#define RBCPR_CLK					6
+#define GFX3D_CLK					7
+#define RBBMTIMER_CLK					8
+#define GFX3D_ISENSE_CLK				9
+#define GPUCC_CXO_CLK					10
+
+#define GPU_CX_BCR					0
+#define RBCPR_BCR					1
+#define GPU_GX_BCR					2
+#define GPU_ISENSE_BCR					3
+
+#define GPU_CX_GDSC					1
+#define GPU_GX_GDSC					2
+
+#endif
Signature · 1 line
2.17.1
maintainer Applied
#2 lore raw

Re: [PATCH 1/3] dt-bindings: clock: Document gpucc for msm8998

Quoting Jeffrey Hugo (2019-05-28 09:47:40)

Quoted 4 lines

The GPU for msm8998 has its own clock controller. Document it.

---

Applied to clk-next

#3 lore raw

PATCH 2/3 clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver

In reply to Jeffrey Hugo

The GPUCC manages the clocks for the Adreno GPU found on MSM8998.

---
 drivers/clk/qcom/Kconfig         |   8 +
 drivers/clk/qcom/Makefile        |   1 +
 drivers/clk/qcom/gpucc-msm8998.c | 364 +++++++++++++++++++++++++++++++
 3 files changed, 373 insertions(+)
 create mode 100644 drivers/clk/qcom/gpucc-msm8998.c
drivers/clk/qcom/Kconfig +8 -0
index e1ff83cc361e..e992682fb9eb 100644
@@ -222,6 +222,14 @@ config MSM_GCC_8998
 	  Say Y if you want to use peripheral devices such as UART, SPI,
 	  i2c, USB, UFS, SD/eMMC, PCIe, etc.
 
+config MSM_GPUCC_8998
+	tristate "MSM8998 Graphics Clock Controller"
+	select MSM_GCC_8998
+	help
+	  Support for the graphics clock controller on MSM8998 devices.
+	  Say Y if you want to support graphics controller devices and
+	  functionality such as 3D graphics.
+
 config QCS_GCC_404
 	tristate "QCS404 Global Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index f0768fb1f037..b8b6ffbdbd62 100644
@@ -33,6 +33,7 @@ obj-$(CONFIG_MSM_GCC_8994) += gcc-msm8994.o
 obj-$(CONFIG_MSM_GCC_8996) += gcc-msm8996.o
 obj-$(CONFIG_MSM_LCC_8960) += lcc-msm8960.o
 obj-$(CONFIG_MSM_GCC_8998) += gcc-msm8998.o
+obj-$(CONFIG_MSM_GPUCC_8998) += gpucc-msm8998.o
 obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o
 obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o
 obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o
drivers/clk/qcom/gpucc-msm8998.c new file +364 -0

364 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH 2/3] clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver

drivers/clk/qcom/gpucc-msm8998.c line 253

Quoted 3 lines · Jeffrey Hugo
drivers/clk/qcom/gpucc-msm8998.c new file +3 -0
+//static struct clk_hw *gpucc_msm8998_hws[] = {
+//	&gpucc_cxo_clk.clkr.hw,
+//};

Did you really intend to keep that commented-out code?

Sorry, can't really comment on the actual code, it's all way over my head.

Regards.

#5 lore raw

Re: [PATCH 2/3] clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver

Quoted 8 lines · Marc Gonzalez

drivers/clk/qcom/gpucc-msm8998.c line 253

Quoted 3 lines · Jeffrey Hugo
drivers/clk/qcom/gpucc-msm8998.c new file +3 -0
+//static struct clk_hw *gpucc_msm8998_hws[] = {
+//   &gpucc_cxo_clk.clkr.hw,
+//};

Did you really intend to keep that commented-out code?

Nope. I clearly didn't scrub these well enough from my work in progress branch. Funny, I'm pretty sure I ran checkpatch over them, and checkpatch used to catch c++ style comments. I wonder if that changed.
Anyways. Will fix.

Quoted 4 lines

Sorry, can't really comment on the actual code, it's all way over my head.

Regards.

maintainer
#6 lore raw

Re: [PATCH 2/3] clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver

In reply to Jeffrey Hugo

Quoting Jeffrey Hugo (2019-05-28 09:48:03)

Quoted 6 lines
drivers/clk/qcom/gpucc-msm8998.c new file +1 -0
new file mode 100644
index 000000000000..e45062e40718
+

drivers/clk/qcom/gpucc-msm8998.c line 337

Quoted 10 lines
drivers/clk/qcom/gpucc-msm8998.c new file +10 -0
+static int gpucc_msm8998_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       struct clk *xo;
+
+       /*
+        * We must have a valid XO to continue until orphan probe defer is
+        * implemented.
+        */
+       xo = clk_get(&pdev->dev, "xo");

Why is this necessary?

drivers/clk/qcom/gpucc-msm8998.c line 346

Quoted 9 lines
drivers/clk/qcom/gpucc-msm8998.c new file +9 -0
+       if (IS_ERR(xo))
+               return PTR_ERR(xo);
+       clk_put(xo);
+
+       regmap = qcom_cc_map(pdev, &gpucc_msm8998_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       /* force periph logic on to acoid perf counter corruption */

avoid?

Quoted 7 lines
drivers/clk/qcom/gpucc-msm8998.c new file +7 -0
+       regmap_write_bits(regmap, gfx3d_clk.clkr.enable_reg, BIT(13), BIT(13));
+       /* tweak droop detector (GPUCC_GPU_DD_WRAP_CTRL) to reduce leakage */
+       regmap_write_bits(regmap, gfx3d_clk.clkr.enable_reg, BIT(0), BIT(0));
+
+       return qcom_cc_really_probe(pdev, &gpucc_msm8998_desc, regmap);
+}
+
#7 lore raw

Re: [PATCH 2/3] clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver

Quoted 12 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-05-28 09:48:03)

Quoted 10 lines
drivers/clk/qcom/gpucc-msm8998.c new file +5 -0
new file mode 100644
index 000000000000..e45062e40718
+
+static int gpucc_msm8998_probe(struct platform_device *pdev)
+{
+       struct regmap *regmap;
+       struct clk *xo;
Quoted 8 lines

drivers/clk/qcom/gpucc-msm8998.c line 337

Quoted 6 lines
drivers/clk/qcom/gpucc-msm8998.c new file +6 -0
+
+       /*
+        * We must have a valid XO to continue until orphan probe defer is
+        * implemented.
+        */
+       xo = clk_get(&pdev->dev, "xo");

Why is this necessary?

As you well know, XO is the root clock for pretty much everything on Qualcomm platforms. We are trying to do things "properly" on 8998. We are planning on having rpmcc manage it (see my other series), and all the other components consume xo from there. Unfortunately we cannot control the probe order, particularly when things are built as modules, so its possible gpucc might be the first thing to probe. Currently, the clock framework will allow that since everything in gpucc will just be an orphan. However that doesn't prevent gpucc consumers from grabbing their clocks, and we've seen that cause issues.

As you've previously explained, you have a ton of work to do to refactor things so that a clock will probe defer if its dependencies are not present. We'd prefer that functionality, but are not really willing to wait for it. Thus, we are implementing the same functionality in the driver until the framework handles it for us, at which point we'll gladly rip this out.

Quoted 12 lines

drivers/clk/qcom/gpucc-msm8998.c line 346

Quoted 10 lines
drivers/clk/qcom/gpucc-msm8998.c new file +9 -0
+       if (IS_ERR(xo))
+               return PTR_ERR(xo);
+       clk_put(xo);
+
+       regmap = qcom_cc_map(pdev, &gpucc_msm8998_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       /* force periph logic on to acoid perf counter corruption */

avoid?

Yes. Do you want a v3 with this fixed?

Quoted 8 lines
Quoted 8 lines
drivers/clk/qcom/gpucc-msm8998.c new file +7 -0
+       regmap_write_bits(regmap, gfx3d_clk.clkr.enable_reg, BIT(13), BIT(13));
+       /* tweak droop detector (GPUCC_GPU_DD_WRAP_CTRL) to reduce leakage */
+       regmap_write_bits(regmap, gfx3d_clk.clkr.enable_reg, BIT(0), BIT(0));
+
+       return qcom_cc_really_probe(pdev, &gpucc_msm8998_desc, regmap);
+}
+
maintainer
#8 lore raw

Re: [PATCH 2/3] clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver

Quoting Jeffrey Hugo (2019-06-07 07:08:46)

Quoted 4 lines

As you well know, XO is the root clock for pretty much everything on Qualcomm platforms. We are trying to do things "properly" on 8998. We are planning on having rpmcc manage it (see my other series), and

I don't have the rpmcc series in my queue. I think it needs a resend?

Quoted 8 lines

all the other components consume xo from there. Unfortunately we cannot control the probe order, particularly when things are built as modules, so its possible gpucc might be the first thing to probe. Currently, the clock framework will allow that since everything in gpucc will just be an orphan. However that doesn't prevent gpucc consumers from grabbing their clocks, and we've seen that cause issues.

Quoted 6 lines

As you've previously explained, you have a ton of work to do to refactor things so that a clock will probe defer if its dependencies are not present. We'd prefer that functionality, but are not really willing to wait for it. Thus, we are implementing the same functionality in the driver until the framework handles it for us, at which point we'll gladly rip this out.

Can you add more to the comment? Right now it doesn't explain the _why_ part that you describe in the first paragraph here. That's what I'm asking to be put here as a comment. Also, GCC is the one exporting the XO clk on this platform so I'm a little lost why we're talking about rpm here.

I guess I'm left to do the ton of work myself and get to have clk providers like this be clk consumers so that probe ordering is correct and clks aren't exposed until the whole parent chain exists. This is taking a step backwards and causes me to be sad.

Quoted 14 lines
Quoted 13 lines

drivers/clk/qcom/gpucc-msm8998.c line 346

Quoted 11 lines
drivers/clk/qcom/gpucc-msm8998.c new file +9 -0
+       if (IS_ERR(xo))
+               return PTR_ERR(xo);
+       clk_put(xo);
+
+       regmap = qcom_cc_map(pdev, &gpucc_msm8998_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       /* force periph logic on to acoid perf counter corruption */

avoid?

Quoted 1 line

Yes. Do you want a v3 with this fixed?

Yes, please resend without the binding patch that I've already applied.

#9 lore raw

Re: [PATCH 2/3] clk: qcom: Add MSM8998 GPU Clock Controller (GPUCC) driver

Quoted 8 lines · Stephen Boyd

Quoting Jeffrey Hugo (2019-06-07 07:08:46)

Quoted 4 lines

As you well know, XO is the root clock for pretty much everything on Qualcomm platforms. We are trying to do things "properly" on 8998. We are planning on having rpmcc manage it (see my other series), and

I don't have the rpmcc series in my queue. I think it needs a resend?

See the "[PATCH v4 0/6] MSM8998 Multimedia Clock Controller" series.

Quoted 16 lines
Quoted 9 lines

all the other components consume xo from there. Unfortunately we cannot control the probe order, particularly when things are built as modules, so its possible gpucc might be the first thing to probe. Currently, the clock framework will allow that since everything in gpucc will just be an orphan. However that doesn't prevent gpucc consumers from grabbing their clocks, and we've seen that cause issues.

Quoted 6 lines

As you've previously explained, you have a ton of work to do to refactor things so that a clock will probe defer if its dependencies are not present. We'd prefer that functionality, but are not really willing to wait for it. Thus, we are implementing the same functionality in the driver until the framework handles it for us, at which point we'll gladly rip this out.

Quoted 5 lines

Can you add more to the comment? Right now it doesn't explain the _why_ part that you describe in the first paragraph here. That's what I'm asking to be put here as a comment. Also, GCC is the one exporting the XO clk on this platform so I'm a little lost why we're talking about rpm here.

Oh, I see, you wanted the comment expanded. Sorry I didn't understand that earlier. Will do.

Quoted 5 lines

I guess I'm left to do the ton of work myself and get to have clk providers like this be clk consumers so that probe ordering is correct and clks aren't exposed until the whole parent chain exists. This is taking a step backwards and causes me to be sad.

I'll take a second look at the list of tasks you outlined, but what I recall was that most of them went over my head, so I wasn't really confident in poking my nose in there.

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines

drivers/clk/qcom/gpucc-msm8998.c line 346

Quoted 12 lines
drivers/clk/qcom/gpucc-msm8998.c new file +9 -0
+       if (IS_ERR(xo))
+               return PTR_ERR(xo);
+       clk_put(xo);
+
+       regmap = qcom_cc_map(pdev, &gpucc_msm8998_desc);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
+
+       /* force periph logic on to acoid perf counter corruption */

avoid?

Quoted 4 lines
Quoted 1 line

Yes. Do you want a v3 with this fixed?

Yes, please resend without the binding patch that I've already applied.

Will do.

#10 lore raw

PATCH 3/3 arm64: dts: qcom: msm8998: Add gpucc node

In reply to Jeffrey Hugo

Add MSM8998 GPU Clock Controller DT node.

---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +15 -0
index 574be78a936e..cf00bfeec6b3 100644
@@ -3,6 +3,7 @@
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/clock/qcom,gcc-msm8998.h>
+#include <dt-bindings/clock/qcom,gpucc-msm8998.h>
 #include <dt-bindings/clock/qcom,rpmcc.h>
 #include <dt-bindings/gpio/gpio.h>
 
@@ -763,6 +764,20 @@
 			reg = <0x1f40000 0x20000>;
 		};
 
+		gpucc: clock-controller@5065000 {
+			compatible = "qcom,gpucc-msm8998";
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			#power-domain-cells = <1>;
+			reg = <0x05065000 0x9000>;
+
+			clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>,
+				 <&gcc GPLL0_OUT_MAIN>;
+			clock-names = "xo",
+				      "gpll0";
+		};
+
+
 		apcs_glb: mailbox@9820000 {
 			compatible = "qcom,msm8998-apcs-hmss-global";
 			reg = <0x17911000 0x1000>;
Signature · 1 line
2.17.1