mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] drm/ast: Fix ARM compatibility
@ 2023-04-21  0:33 Jammy Huang
  2023-04-21  8:08 ` Thomas Zimmermann
  0 siblings, 1 reply; 2+ messages in thread
From: Jammy Huang @ 2023-04-21  0:33 UTC (permalink / raw)
  To: airlied, tzimmermann; +Cc: airlied, daniel, dri-devel, linux-kernel

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

Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 v2 changes:
  - Use MMIO after AST2500 which enable MMIO by default.
 v3 changes:
  - Correct comments
---
 drivers/gpu/drm/ast/ast_main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index f83ce77127cb..a6d0ee4da2b8 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -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 adopted
+	 * 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
-- 
2.25.1


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

* Re: [PATCH v3] drm/ast: Fix ARM compatibility
  2023-04-21  0:33 [PATCH v3] drm/ast: Fix ARM compatibility Jammy Huang
@ 2023-04-21  8:08 ` Thomas Zimmermann
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2023-04-21  8:08 UTC (permalink / raw)
  To: Jammy Huang, airlied; +Cc: dri-devel, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1803 bytes --]

Hi

Am 21.04.23 um 02:33 schrieb Jammy Huang:
> ARM architecture only has 'memory', so all devices are accessed by
> MMIO if possible.

Merged into drm-misc-fixes. Thanks for the patch.

Best regards
Thomas

> 
> Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>   v2 changes:
>    - Use MMIO after AST2500 which enable MMIO by default.
>   v3 changes:
>    - Correct comments
> ---
>   drivers/gpu/drm/ast/ast_main.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index f83ce77127cb..a6d0ee4da2b8 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -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 adopted
> +	 * 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

-- 
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)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

end of thread, other threads:[~2023-04-21  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21  0:33 [PATCH v3] drm/ast: Fix ARM compatibility Jammy Huang
2023-04-21  8:08 ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®