diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2022-06-01 13:25:16 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2022-06-07 09:39:51 +0200 |
commit | d45e32c9d98ce7c22a4bafe69cee58165b59533b (patch) | |
tree | 0479e9f3cb16036722eb011b6c73c192530b5a35 /drivers/gpu/drm/mgag200/mgag200_mm.c | |
parent | drm/mgag200: Move PCI-option setup into model-specific code (diff) | |
download | linux-d45e32c9d98ce7c22a4bafe69cee58165b59533b.tar.xz linux-d45e32c9d98ce7c22a4bafe69cee58165b59533b.zip |
drm/mgag200: Call mgag200_device_probe_vram() from per-model init
Call mgag200_device_probe_vram() from each model's initializer. The
G200EW3 uses a special helper with additional instructions.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Tested-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220601112522.5774-5-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/mgag200/mgag200_mm.c')
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_mm.c | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_mm.c b/drivers/gpu/drm/mgag200/mgag200_mm.c index fa996d46feed..fc19c2369641 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mm.c +++ b/drivers/gpu/drm/mgag200/mgag200_mm.c @@ -32,49 +32,6 @@ #include "mgag200_drv.h" -static size_t mgag200_probe_vram(struct mga_device *mdev, void __iomem *mem, - size_t size) -{ - int offset; - int orig; - int test1, test2; - int orig1, orig2; - size_t vram_size; - - /* Probe */ - orig = ioread16(mem); - iowrite16(0, mem); - - vram_size = size; - - if ((mdev->type == G200_EW3) && (vram_size >= 0x1000000)) - vram_size = vram_size - 0x400000; - - for (offset = 0x100000; offset < vram_size; offset += 0x4000) { - orig1 = ioread8(mem + offset); - orig2 = ioread8(mem + offset + 0x100); - - iowrite16(0xaa55, mem + offset); - iowrite16(0xaa55, mem + offset + 0x100); - - test1 = ioread16(mem + offset); - test2 = ioread16(mem); - - iowrite16(orig1, mem + offset); - iowrite16(orig2, mem + offset + 0x100); - - if (test1 != 0xaa55) - break; - - if (test2) - break; - } - - iowrite16(orig, mem); - - return offset - 65536; -} - int mgag200_mm_init(struct mga_device *mdev) { struct drm_device *dev = &mdev->base; @@ -106,11 +63,9 @@ int mgag200_mm_init(struct mga_device *mdev) if (!mdev->vram) return -ENOMEM; - mdev->mc.vram_size = mgag200_probe_vram(mdev, mdev->vram, len); + mdev->mc.vram_size = len; mdev->mc.vram_base = start; mdev->mc.vram_window = len; - mdev->vram_fb_available = mdev->mc.vram_size; - return 0; } |