[PATCH] drm/ast: Fixed system may hang in booting

Y.C. Chen yc_chen at aspeedtech.com
Wed Nov 30 07:13:01 UTC 2016


From: "Y.C. Chen" <yc_chen at aspeedtech.com>

There is another thread still access standard VGA I/O while loading drm driver.
Disable standard VGA access to avoid this issue.

Signed-off-by: Y.C. Chen <yc_chen at aspeedtech.com>
---
 drivers/gpu/drm/ast/ast_main.c | 6 ++++++
 drivers/gpu/drm/ast/ast_post.c | 6 +-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 904beaa..05ea3e3 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -124,6 +124,9 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
 	} else
 		*need_post = false;
 
+        /* disable standard VGA decode */
+	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
+
 	/* Check if we support wide screen */
 	switch (ast->chip) {
 	case AST1180:
@@ -480,6 +483,9 @@ int ast_driver_unload(struct drm_device *dev)
 {
 	struct ast_private *ast = dev->dev_private;
 
+        /* enable standard VGA decode */
+	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
+
 	kfree(ast->dp501_fw_addr);
 	ast_mode_fini(dev);
 	ast_fbdev_fini(dev);
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index 810c51d..a71abd2 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -58,11 +58,7 @@ bool ast_is_vga_enabled(struct drm_device *dev)
 		/* TODO 1180 */
 	} else {
 		ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT);
-		if (ch) {
-			ast_open_key(ast);
-			ch = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff);
-			return ch & 0x04;
-		}
+                return ch & 0x01;
 	}
 	return 0;
 }
-- 
1.8.3.1



More information about the dri-devel mailing list