aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/gpu/drm/ast/ast_main.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2023-06-21 14:53:41 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2023-06-27 14:26:32 +0200
commit5b71707dd13cb611bba07ab5f38f92b8f7859d6e (patch)
tree648e5483ba5e0bc5ad95e72c3fa502c76896888e /drivers/gpu/drm/ast/ast_main.c
parentdrm/ast: Set PCI config before accessing I/O registers (diff)
downloadwireguard-linux-5b71707dd13cb611bba07ab5f38f92b8f7859d6e.tar.xz
wireguard-linux-5b71707dd13cb611bba07ab5f38f92b8f7859d6e.zip
drm/ast: Enable and unlock device access early during init
POST and memory management contains code to enable access to the device's memory spaces. This is too late. Consolidate this code at the beginning of the device initialization. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600 Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-8-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/ast/ast_main.c')
-rw-r--r--drivers/gpu/drm/ast/ast_main.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 01f938c2da28..031ff4ed1920 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -52,6 +52,36 @@ out:
return pcibios_err_to_errno(err);
}
+static bool ast_is_vga_enabled(struct drm_device *dev)
+{
+ struct ast_device *ast = to_ast_device(dev);
+ u8 ch;
+
+ ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT);
+
+ return !!(ch & 0x01);
+}
+
+static void ast_enable_vga(struct drm_device *dev)
+{
+ struct ast_device *ast = to_ast_device(dev);
+
+ ast_io_write8(ast, AST_IO_VGA_ENABLE_PORT, 0x01);
+ ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, 0x01);
+}
+
+static void ast_enable_mmio(struct drm_device *dev)
+{
+ struct ast_device *ast = to_ast_device(dev);
+
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
+}
+
+static void ast_open_key(struct ast_device *ast)
+{
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x80, 0xA8);
+}
+
static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev)
{
struct device_node *np = dev->dev->of_node;