summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ast
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-11-16 12:59:22 +0300
committerThomas Zimmermann <tzimmermann@suse.de>2023-11-28 18:12:30 +0300
commitb45efcfc94e8043d08344094a305bb4b8030c7df (patch)
treed178a61482f32202b6126b1b7d21a3526ecde8dc /drivers/gpu/drm/ast
parent0ccaa3dde97bd30ae615c66fc20080e920ec9b4e (diff)
downloadlinux-b45efcfc94e8043d08344094a305bb4b8030c7df.tar.xz
drm/ast: Retrieve I/O-memory ranges without ast device
Read the I/O-memory ranges into local variables before setting them in the ast device instanace. We'll later need this to split detecting the device type from the creation of the ast device instance. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231116100240.22975-4-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/ast')
-rw-r--r--drivers/gpu/drm/ast/ast_main.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 70e1871dbaf9..026ef893dd50 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -432,6 +432,8 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
struct ast_device *ast;
bool need_post = false;
int ret = 0;
+ void __iomem *regs;
+ void __iomem *ioregs;
ast = devm_drm_dev_alloc(&pdev->dev, drv, struct ast_device, base);
if (IS_ERR(ast))
@@ -440,8 +442,8 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
pci_set_drvdata(pdev, dev);
- ast->regs = pcim_iomap(pdev, 1, 0);
- if (!ast->regs)
+ regs = pcim_iomap(pdev, 1, 0);
+ if (!regs)
return ERR_PTR(-EIO);
if (pdev->revision >= 0x40) {
@@ -455,7 +457,7 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
return ERR_PTR(-EIO);
if ((len - AST_IO_MM_OFFSET) < AST_IO_MM_LENGTH)
return ERR_PTR(-EIO);
- ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
+ ioregs = regs + AST_IO_MM_OFFSET;
} else if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
/*
* Map I/O registers if we have a PCI BAR for I/O.
@@ -464,8 +466,8 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
if (len < AST_IO_MM_LENGTH)
return -EIO;
- ast->ioregs = pcim_iomap(pdev, 2, 0);
- if (!ast->ioregs)
+ ioregs = pcim_iomap(pdev, 2, 0);
+ if (!ioregs)
return ERR_PTR(-EIO);
} else {
/*
@@ -477,11 +479,14 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
return ERR_PTR(-EIO);
if ((len - AST_IO_MM_OFFSET) < AST_IO_MM_LENGTH)
return ERR_PTR(-EIO);
- ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
+ ioregs = regs + AST_IO_MM_OFFSET;
drm_info(dev, "Platform has no I/O space, using MMIO\n");
}
+ ast->regs = regs;
+ ast->ioregs = ioregs;
+
if (!ast_is_vga_enabled(dev)) {
drm_info(dev, "VGA not enabled on entry, requesting chip POST\n");
need_post = true;