Skip to contentSkip to conversation

drm/imagination: add AM62P/AM67A/J722S support

RFC PATCH In review Michael Walle 3 participants 7 messages Jul 16, 2025 – Aug 13, 2025

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

cover drm/imagination: add AM62P/AM67A/J722S support

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(+)
Signature · 1 line
2.39.5
#1 lore raw

RFC PATCH 1/3 dt-bindings: gpu: img: Add AM62P SoC specific compatible

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

---
 Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +1 -0
index 4450e2e73b3c..bad3e412a168 100644
@@ -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
Signature · 1 line
2.39.5
#2 lore raw

Re: [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible

Quoted 3 lines · Michael Walle

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?

Quoted 10 lines
---
  Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 1 +
  1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +0 -0
index 4450e2e73b3c..bad3e412a168 100644

Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml properties: · line 26

Quoted 4 lines
Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +1 -0
@@ -23,6 +23,7 @@ properties:
            - const: img,img-rogue
        - items:
            - enum:
+              - ti,am62p-gpu

There is a check below based on SoC compat:

Quoted 11 lines
Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +0 -0
 - 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

Quoted 3 lines

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

#3 lore raw

Re: [RFC PATCH 1/3] dt-bindings: gpu: img: Add AM62P SoC specific compatible

Hi Andrew,

Quoted 7 lines · Andrew Davis
Quoted 3 lines · Michael Walle

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.

Quoted 30 lines
Quoted 11 lines
---
  Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml | 1 +
  1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +0 -0
index 4450e2e73b3c..bad3e412a168 100644

Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml properties: · line 26

Quoted 4 lines
Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +1 -0
@@ -23,6 +23,7 @@ properties:
            - const: img,img-rogue
        - items:
            - enum:
+              - ti,am62p-gpu

There is a check below based on SoC compat:

Quoted 11 lines
Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml +0 -0
 - if:
     properties:
       compatible:

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

Quoted 1 line

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

Thanks! Yes probably.

-michael

#4 lore raw

RFC PATCH 2/3 drm/imagination: fix clock control on the J722S

In reply to 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.

---
 drivers/gpu/drm/imagination/pvr_device.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/imagination/pvr_device.c +9 -0
index 8b9ba4983c4c..e7a7cc1bdf93 100644
@@ -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)
Signature · 1 line
2.39.5
#5 lore raw

Re: [RFC PATCH 2/3] drm/imagination: fix clock control on the J722S

Quoted 23 lines · 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.

---
 drivers/gpu/drm/imagination/pvr_device.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/imagination/pvr_device.c +1 -0
index 8b9ba4983c4c..e7a7cc1bdf93 100644
@@ -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>

drivers/gpu/drm/imagination/pvr_device.c pvr_device_init(struct pvr_device *pvr_dev) · line 651

Quoted 10 lines
drivers/gpu/drm/imagination/pvr_device.c +7 -0
@@ -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

#6 lore raw

RFC PATCH 3/3 arm64: dts: ti: add GPU node

In reply to Michael Walle

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

---
 .../boot/dts/ti/k3-am62p-j722s-common-main.dtsi     | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/ti/k3-am62p-j722s-common-main.dtsi +13 -0
index 17c0949ac1d7..8f3d39d8004b 100644
@@ -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>;
Signature · 1 line
2.39.5