linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] drm/imagination: add AM62P/AM67A/J722S support
@ 2025-07-16 13:47 Michael Walle
  2025-07-16 13:47 ` [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible Michael Walle
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael Walle @ 2025-07-16 13:47 UTC (permalink / raw)
  To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
	Michael Walle

The AM62P and AM67A/J722S feature the same BXS-4 GPU as the J721S2.
In theory, one have to just add the DT node. But it turns out, that
the clock handling is not working. If I understood Nishan Menon
correct, it is working on the J721S2 because there, the clock is
shared, while on the AM62P the GPU has its own PLL.
In the latter case, the '#assigned-clocks' property of the GPU node
doesn't work properly. Linux will try to set the clock frequency
before probing the GPU. The clock handling firmware on the SoC won't
allow that if there is no user for it. To work around that
limitation, set the clock again in the .probe() of the GPU driver
after turning the device on.

This was tested on an AM67A.

Michael Walle (3):
  dt-bindings: gpu: img: Add AM62P SoC specific compatible
  drm/imagination: fix clock control on the J722S
  arm64: dts: ti: add GPU node

 .../devicetree/bindings/gpu/img,powervr-rogue.yaml  |  1 +
 .../boot/dts/ti/k3-am62p-j722s-common-main.dtsi     | 13 +++++++++++++
 drivers/gpu/drm/imagination/pvr_device.c            |  9 +++++++++
 3 files changed, 23 insertions(+)

-- 
2.39.5



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible
  2025-07-16 13:47 [RFC PATCH 0/3] drm/imagination: add AM62P/AM67A/J722S support Michael Walle
@ 2025-07-16 13:47 ` Michael Walle
  2025-07-16 16:17   ` Andrew Davis
  2025-07-16 13:47 ` [RFC PATCH 2/3] drm/imagination: fix clock control on the J722S Michael Walle
  2025-07-16 13:47 ` [RFC PATCH 3/3] arm64: dts: ti: add GPU node Michael Walle
  2 siblings, 1 reply; 7+ messages in thread
From: Michael Walle @ 2025-07-16 13:47 UTC (permalink / raw)
  To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
	Michael Walle

The AM62P and the J722S features the same BXS-4 GPU as the J721S2. Add a
new SoC specific compatible.

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
 Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
index 4450e2e73b3c..bad3e412a168 100644
--- a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
+++ b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
@@ -23,6 +23,7 @@ properties:
           - const: img,img-rogue
       - items:
           - enum:
+              - ti,am62p-gpu
               - ti,j721s2-gpu
           - const: img,img-bxs-4-64
           - const: img,img-rogue
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH 2/3] drm/imagination: fix clock control on the J722S
  2025-07-16 13:47 [RFC PATCH 0/3] drm/imagination: add AM62P/AM67A/J722S support Michael Walle
  2025-07-16 13:47 ` [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible Michael Walle
@ 2025-07-16 13:47 ` Michael Walle
  2025-08-13 18:19   ` Krzysztof Kozlowski
  2025-07-16 13:47 ` [RFC PATCH 3/3] arm64: dts: ti: add GPU node Michael Walle
  2 siblings, 1 reply; 7+ messages in thread
From: Michael Walle @ 2025-07-16 13:47 UTC (permalink / raw)
  To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
	Michael Walle

The J722S won't let you set the clock frequency if there is no device
using it. Thus, the assigned-clocks property won't work per se.

As a workaround, set the clock again during the probing of the driver.

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
 drivers/gpu/drm/imagination/pvr_device.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c
index 8b9ba4983c4c..e7a7cc1bdf93 100644
--- a/drivers/gpu/drm/imagination/pvr_device.c
+++ b/drivers/gpu/drm/imagination/pvr_device.c
@@ -16,6 +16,7 @@
 
 #include <linux/bitfield.h>
 #include <linux/clk.h>
+#include <linux/clk/clk-conf.h>
 #include <linux/compiler_attributes.h>
 #include <linux/compiler_types.h>
 #include <linux/dma-mapping.h>
@@ -641,6 +642,14 @@ pvr_device_init(struct pvr_device *pvr_dev)
 	if (err)
 		return err;
 
+	/* Set any 'assigned-clocks' properties again. This is a workaround for
+	 * the clock handling on k3 platforms. There, one cannot set the clock
+	 * frequency until there is at least one (enabled) user if it.
+	 */
+	err = of_clk_set_defaults(drm_dev->dev->of_node, true);
+	if (err)
+		return err;
+
 	/* Map the control registers into memory. */
 	err = pvr_device_reg_init(pvr_dev);
 	if (err)
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH 3/3] arm64: dts: ti: add GPU node
  2025-07-16 13:47 [RFC PATCH 0/3] drm/imagination: add AM62P/AM67A/J722S support Michael Walle
  2025-07-16 13:47 ` [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible Michael Walle
  2025-07-16 13:47 ` [RFC PATCH 2/3] drm/imagination: fix clock control on the J722S Michael Walle
@ 2025-07-16 13:47 ` Michael Walle
  2 siblings, 0 replies; 7+ messages in thread
From: Michael Walle @ 2025-07-16 13:47 UTC (permalink / raw)
  To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
	Michael Walle

The J722S features a BXS-4 GPU. Add the node for it.

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
 .../boot/dts/ti/k3-am62p-j722s-common-main.dtsi     | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi
index 17c0949ac1d7..8f3d39d8004b 100644
--- a/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi
@@ -1229,6 +1229,19 @@ dsi0: dsi@30500000 {
 		status = "disabled";
 	};
 
+	gpu: gpu@fd80000 {
+		compatible = "ti,am62p-gpu", "img,img-bxs-4-64", "img,img-rogue";
+		reg = <0x00 0x0fd80000 0x00 0x80000>;
+		clocks = <&k3_clks 237 3>;
+		clock-names = "core";
+		assigned-clocks = <&k3_clks 237 3>;
+		assigned-clock-rates = <800000000>;
+		interrupts = <GIC_SPI 241 IRQ_TYPE_LEVEL_HIGH>;
+		power-domains = <&k3_pds 237 TI_SCI_PD_EXCLUSIVE>,
+				<&k3_pds 242 TI_SCI_PD_EXCLUSIVE>;
+		power-domain-names = "a", "b";
+	};
+
 	vpu: video-codec@30210000 {
 		compatible = "ti,j721s2-wave521c", "cnm,wave521c";
 		reg = <0x00 0x30210000 0x00 0x10000>;
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible
  2025-07-16 13:47 ` [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible Michael Walle
@ 2025-07-16 16:17   ` Andrew Davis
  2025-07-17  6:56     ` Michael Walle
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Davis @ 2025-07-16 16:17 UTC (permalink / raw)
  To: Michael Walle, Frank Binns, Matt Coster, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel

On 7/16/25 8:47 AM, Michael Walle wrote:
> The AM62P and the J722S features the same BXS-4 GPU as the J721S2. Add a
> new SoC specific compatible.
> 

If the GPU is the same, and the integration is the same, do you really need
a new compatible?

> Signed-off-by: Michael Walle <mwalle@kernel.org>
> ---
>   Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
> index 4450e2e73b3c..bad3e412a168 100644
> --- a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
> +++ b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
> @@ -23,6 +23,7 @@ properties:
>             - const: img,img-rogue
>         - items:
>             - enum:
> +              - ti,am62p-gpu

There is a check below based on SoC compat:

>  - if:
>      properties:
>        compatible:
>          contains:
>            enum:
>              - ti,am62-gpu
>              - ti,j721s2-gpu
>    then:
>      properties:
>        clocks:
>          maxItems: 1

If you do add a new SoC specific compatible does this check need updating?

Andrew

>                 - ti,j721s2-gpu
>             - const: img,img-bxs-4-64
>             - const: img,img-rogue


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible
  2025-07-16 16:17   ` Andrew Davis
@ 2025-07-17  6:56     ` Michael Walle
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Walle @ 2025-07-17  6:56 UTC (permalink / raw)
  To: Andrew Davis, Frank Binns, Matt Coster, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1700 bytes --]

Hi Andrew,

On Wed Jul 16, 2025 at 6:17 PM CEST, Andrew Davis wrote:
> On 7/16/25 8:47 AM, Michael Walle wrote:
> > The AM62P and the J722S features the same BXS-4 GPU as the J721S2. Add a
> > new SoC specific compatible.
> > 
>
> If the GPU is the same, and the integration is the same, do you really need
> a new compatible?

AFAIK it's good practise to have one to have a base for future SoC
specific quirks. For example, there are differences how that IP was
integrated, i.e. the am62p doesn't have DMA coherency (for this
peripheral), the clock is dedicated and there might be more.

>
> > Signed-off-by: Michael Walle <mwalle@kernel.org>
> > ---
> >   Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
> > index 4450e2e73b3c..bad3e412a168 100644
> > --- a/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
> > +++ b/Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml
> > @@ -23,6 +23,7 @@ properties:
> >             - const: img,img-rogue
> >         - items:
> >             - enum:
> > +              - ti,am62p-gpu
>
> There is a check below based on SoC compat:
>
> >  - if:
> >      properties:
> >        compatible:
> >          contains:
> >            enum:
> >              - ti,am62-gpu
> >              - ti,j721s2-gpu
> >    then:
> >      properties:
> >        clocks:
> >          maxItems: 1
>
> If you do add a new SoC specific compatible does this check need updating?

Thanks! Yes probably.

-michael

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 2/3] drm/imagination: fix clock control on the J722S
  2025-07-16 13:47 ` [RFC PATCH 2/3] drm/imagination: fix clock control on the J722S Michael Walle
@ 2025-08-13 18:19   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-13 18:19 UTC (permalink / raw)
  To: Michael Walle, Frank Binns, Matt Coster, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Nishanth Menon,
	Vignesh Raghavendra, Tero Kristo
  Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
	Stephan Gerhold, Abel Vesa, Bjorn Andersson, Konrad Dybcio,
	Stephen Boyd

On 16/07/2025 15:47, Michael Walle wrote:
> The J722S won't let you set the clock frequency if there is no device
> using it. Thus, the assigned-clocks property won't work per se.
> 
> As a workaround, set the clock again during the probing of the driver.
> 
> Signed-off-by: Michael Walle <mwalle@kernel.org>
> ---
>  drivers/gpu/drm/imagination/pvr_device.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c
> index 8b9ba4983c4c..e7a7cc1bdf93 100644
> --- a/drivers/gpu/drm/imagination/pvr_device.c
> +++ b/drivers/gpu/drm/imagination/pvr_device.c
> @@ -16,6 +16,7 @@
>  
>  #include <linux/bitfield.h>
>  #include <linux/clk.h>
> +#include <linux/clk/clk-conf.h>
>  #include <linux/compiler_attributes.h>
>  #include <linux/compiler_types.h>
>  #include <linux/dma-mapping.h>
> @@ -641,6 +642,14 @@ pvr_device_init(struct pvr_device *pvr_dev)
>  	if (err)
>  		return err;
>  
> +	/* Set any 'assigned-clocks' properties again. This is a workaround for
> +	 * the clock handling on k3 platforms. There, one cannot set the clock
> +	 * frequency until there is at least one (enabled) user if it.
> +	 */
> +	err = of_clk_set_defaults(drm_dev->dev->of_node, true);
> +	if (err)
> +		return err;

+Cc Abel, Bjorn, Konrad, Stephan G. and Stephen B.,

Interesting stuff. This touches a bit similar problems we have (and had)
for Qualcomm Display PHYs, where assigned-clock-parents were called too
early - before the block (PHY) is being enabled.

The workaround we implemented so far was - last patch hook in:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=80dd5911cbfdc2f6ae904341d41a7a8bd8cc546c

I know Stephan G. is working on something better, so probably he will Cc
you once this is ready.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-13 19:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 13:47 [RFC PATCH 0/3] drm/imagination: add AM62P/AM67A/J722S support Michael Walle
2025-07-16 13:47 ` [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible Michael Walle
2025-07-16 16:17   ` Andrew Davis
2025-07-17  6:56     ` Michael Walle
2025-07-16 13:47 ` [RFC PATCH 2/3] drm/imagination: fix clock control on the J722S Michael Walle
2025-08-13 18:19   ` Krzysztof Kozlowski
2025-07-16 13:47 ` [RFC PATCH 3/3] arm64: dts: ti: add GPU node Michael Walle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).