From patchwork Wed Nov 30 07:13:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Y.C. Chen" X-Patchwork-Id: 9453927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1836360235 for ; Wed, 30 Nov 2016 09:43:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA7B928426 for ; Wed, 30 Nov 2016 09:43:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDBDC28428; Wed, 30 Nov 2016 09:43:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 26BF928426 for ; Wed, 30 Nov 2016 09:43:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C01A06E242; Wed, 30 Nov 2016 09:43:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 8994 seconds by postgrey-1.35 at gabe; Wed, 30 Nov 2016 09:43:09 UTC Received: from msr18.hinet.net (msr18.hinet.net [168.95.4.118]) by gabe.freedesktop.org (Postfix) with ESMTP id B6B6F6E242 for ; Wed, 30 Nov 2016 09:43:09 +0000 (UTC) Received: from localhost.localdomain.com (211-20-114-70.HINET-IP.hinet.net [211.20.114.70]) (authenticated bits=0) by msr18.hinet.net (8.14.9/8.14.9) with ESMTP id uAU7DAOI021891; Wed, 30 Nov 2016 15:13:10 +0800 (CST) From: "Y.C. Chen" To: dri-devel@lists.freedesktop.org, airlied@gmail.com Subject: [PATCH] drm/ast: Fixed system may hang in booting Date: Wed, 30 Nov 2016 15:13:01 +0800 Message-Id: <1480489981-15802-1-git-send-email-yc_chen@aspeedtech.com> X-Mailer: git-send-email 1.8.3.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDrMTGxXJZpMhNl63GLsJg1iFziytf37NZnLi+iMmi69c9Zgdmj/vd x5k8ds66y+7Rdfc+ewBzFGtmXlJ+RQJrxpUrq5kLdvJW7O49ztLA+Jmri5GTQ0ggUmL9+Scs IDabgJbE56kzmLoYOThEBMwl3n01AgkzC0hJLDr+nRnEFhawkth48SsjiM0ioCqxdlozWCuv gJvE8qYpYLaEgILElIfvmScwcqxiFMktrtAtzi021DXUy8jMSy3RA+JNjEBvrIhn597BePak 4SFGJg7OQ4wCHIxKPLyp080ihFgTy4orc0Hi3IcYJTmYlER5ZSrtIoT4kvJTKjMSizPii0pz UosPMUpw8CiJ8KpVA+V4iwsSc4sz02FSMhwcShK826qAUoJFqempFWmZOSWpRRDpU4y6HC/u vXvAJMSSl5+XKiXOmwpSKAAyI6M0D64OFtyXGGWlhHnn5gDV8BSkFuVmlqDKv2IUB7pemNcF 5BKezLwSuENeAd3IBHQj+xtrkBtLEhFSAJJ7d+PRAQAA X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Y.C. Chen" 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 --- 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; }