summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/mgag200/mgag200_mm.c
AgeCommit message (Collapse)AuthorFilesLines
2022-06-07drm/mgag200: Implement new init logicThomas Zimmermann1-71/+0
Rework mgag200_regs_init() and mgag200_mm_init() into device preinit and init functions. The preinit function, mgag200_device_preinit(), requests and maps a device's I/O and video memory. The init function, mgag200_device_init() initializes the state of struct mga_device. Splitting the initialization between the two functions is necessary to perform per-model operations between the two calls, such as reading the unique revision ID on G200SEs. 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-6-tzimmermann@suse.de
2022-06-07drm/mgag200: Call mgag200_device_probe_vram() from per-model initThomas Zimmermann1-46/+1
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
2021-09-23drm/mgag200: Use managed interfaces for framebuffer write combiningThomas Zimmermann1-28/+7
Replace arch_phys_wc_add() and arch_io_reserve_memtype_wc() with the rsp managed functions. Allows for removing the cleanup code for memory management Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210916181601.9146-5-tzimmermann@suse.de
2021-01-06drm/mgag200: Remove references to struct drm_device.pdevThomas Zimmermann1-4/+6
Using struct drm_device.pdev is deprecated. Convert mgag200 to struct drm_device.dev. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20201201103542.2182-13-tzimmermann@suse.de
2020-08-03drm/mgag200: Clear <page> field during MM initThomas Zimmermann1-0/+2
The modesetting code initialized the memory-related register CRTCEXT4. Move this code to MM initialization. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-7-tzimmermann@suse.de
2020-08-03drm/mgag200: Set MISC memory flags in mm init codeThomas Zimmermann1-0/+6
The modesetting code initialized several memory-related flags in the MISC register. Move this code to MM initialization. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200730102844.10995-6-tzimmermann@suse.de
2020-06-11drm/mgag200: Embed instance of struct drm_device in struct mga_deviceThomas Zimmermann1-1/+1
Following current best practice, the instance of struct drm_device is now embedded in struct mga_device. The respective field has been renamed from 'dev' to 'base' to reflect the relationship. Conversion from DRM device is done via upcast. Using dev_private is no longer possible. The patch also open-codes drm_dev_alloc() and DRM device initialization is now performed by a call to drm_device_init(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-14-tzimmermann@suse.de
2020-06-11drm/mgag200: Switch to managed MMThomas Zimmermann1-13/+15
The memory-management code now cleans up automatically as part of device destruction. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-8-tzimmermann@suse.de
2020-06-11drm/mgag200: Merge VRAM setup into MM initializationThomas Zimmermann1-0/+52
The VRAM setup in mgag200_drv.c is part of memory management and should be done in the same place. Merge the code into the memory management's init function. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-7-tzimmermann@suse.de
2020-06-11drm/mgag200: Lookup VRAM PCI BAR start and length only onceThomas Zimmermann1-8/+9
The MM setup code on mgag200 reads PCI BAR 0's start and length several times. Reusing these values makes the code more readable. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-6-tzimmermann@suse.de
2020-06-11drm/mgag200: Rename mgag200_ttm.c to mgag200_mm.cThomas Zimmermann1-0/+72
The mgag200 driver does not use TTM any longer. Rename the related file to mgag200_mm.c (as in 'memory management'). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-5-tzimmermann@suse.de