Skip to contentSkip to conversation

drm/ast: Fix ARM compatibility

PATCH Superseded Jammy Huang 2 participants 3 messages Apr 20, 2023

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/ast: Fix ARM compatibility

ARM architecture only has 'memory', so all devices are accessed by MMIO if possible.

---
v2 changes:
- Use MMIO after AST2500 which enable MMIO by default.

---
 drivers/gpu/drm/ast/ast_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/ast/ast_main.c +5 -4
index f83ce77127cb..d384e810fa4d 100644
@@ -425,11 +425,12 @@ struct ast_private *ast_device_create(const struct drm_driver *drv,
 		return ERR_PTR(-EIO);
 
 	/*
-	 * If we don't have IO space at all, use MMIO now and
-	 * assume the chip has MMIO enabled by default (rev 0x20
-	 * and higher).
+	 * After AST2500, MMIO is enabled by default, and it should be adapted
+	 * to be compatible with Arm.
 	 */
-	if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) {
+	if (pdev->revision >= 0x40) {
+		ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
+	} else if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) {
 		drm_info(dev, "platform has no IO space, trying MMIO\n");
 		ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
 	}

base-commit: e62252bc55b6d4eddc6c2bdbf95a448180d6a08d

Signature · 1 line
2.25.1
maintainer Reviewed-by on v2 1/1
#1 lore raw

Hi

Am 20.04.23 um 10:09 schrieb Jammy Huang:

Quoted 16 lines

ARM architecture only has 'memory', so all devices are accessed by MMIO if possible.

---
v2 changes:
- Use MMIO after AST2500 which enable MMIO by default.

---
  drivers/gpu/drm/ast/ast_main.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/ast/ast_main.c +0 -0
index f83ce77127cb..d384e810fa4d 100644

drivers/gpu/drm/ast/ast_main.c struct ast_private *ast_device_create(const struct drm_driver *drv, · line 428

Quoted 7 lines
drivers/gpu/drm/ast/ast_main.c +1 -3
@@ -425,11 +425,12 @@ struct ast_private *ast_device_create(const struct drm_driver *drv,
  		return ERR_PTR(-EIO);
 
  	/*
-	 * If we don't have IO space at all, use MMIO now and
-	 * assume the chip has MMIO enabled by default (rev 0x20
-	 * and higher).
+	 * After AST2500, MMIO is enabled by default, and it should be adapted

By 'adapted', you mean 'adopted'?

Apart from that:

I also ran this patch on an AST2100, which still works as before.

Best regards
Thomas

Quoted 11 lines
drivers/gpu/drm/ast/ast_main.c +4 -1
+	 * to be compatible with Arm.
  	 */
-	if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) {
+	if (pdev->revision >= 0x40) {
+		ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
+	} else if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) {
  		drm_info(dev, "platform has no IO space, trying MMIO\n");
  		ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
  	}

base-commit: e62252bc55b6d4eddc6c2bdbf95a448180d6a08d

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
#2 lore raw

Hi Thomas,

Thanks for help. I will update a new patch per your comments

Quoted 51 lines · Thomas Zimmermann

Hi

Am 20.04.23 um 10:09 schrieb Jammy Huang:

Quoted 23 lines

ARM architecture only has 'memory', so all devices are accessed by MMIO if possible.

---
  v2 changes:
   - Use MMIO after AST2500 which enable MMIO by default.
---
  drivers/gpu/drm/ast/ast_main.c | 9 +++++----

  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/ast/ast_main.c +1 -3
index f83ce77127cb..d384e810fa4d 100644
@@ -425,11 +425,12 @@ struct ast_private *ast_device_create(const 
 struct drm_driver *drv,
           return ERR_PTR(-EIO);
         /*
-     * If we don't have IO space at all, use MMIO now and
-     * assume the chip has MMIO enabled by default (rev 0x20
-     * and higher).
+     * After AST2500, MMIO is enabled by default, and it should be 
Quoted 1 line

adapted

By 'adapted', you mean 'adopted'?

Apart from that:

I also ran this patch on an AST2100, which still works as before.

Best regards
Thomas

Quoted 11 lines

+     * to be compatible with Arm.
       */
-    if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) { +    if (pdev->revision >= 0x40) {
+        ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
+    } else if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) { drm_info(dev, "platform has no IO space, trying MMIO\n"); ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
      }

base-commit: e62252bc55b6d4eddc6c2bdbf95a448180d6a08d

Signature · 2 lines
Best Regards
Jammy