blob: 492d2024019601bdc8c361e7ed54743d3e63bfeb [file] [log] [blame] [edit]
From a8fbb62a66d62451e2078610f60203a4b290b82e Mon Sep 17 00:00:00 2001
From: Jeremy Kerr <jk@ozlabs.org>
Date: Wed, 2 Mar 2016 11:25:47 +0800
Subject: [PATCH 02/10] drivers/drm/ast: Switch SCU to VGA output on POST
On AST BMC platforms, the BMC may be using the VGA device for UART
mirroring. In this case, we need to switch the DAC output to
VGA mode.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
drivers/gpu/drm/ast/ast_post.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index c7c58be..a31158e 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -32,6 +32,7 @@
#include "ast_dram_tables.h"
static void ast_init_dram_2300(struct drm_device *dev);
+static void ast_init_output_control(struct drm_device *dev);
void ast_enable_vga(struct drm_device *dev)
{
@@ -381,6 +382,10 @@ void ast_post_gpu(struct drm_device *dev)
else
ast_init_dram_reg(dev);
+ /* HACK: this is to support AMI P8 VGA support */
+ if (ast->chip == AST2400)
+ ast_init_output_control(dev);
+
ast_init_3rdtx(dev);
} else {
if (ast->tx_chip_type != AST_TX_NONE)
@@ -1688,3 +1693,31 @@ static void ast_init_dram_2300(struct drm_device *dev)
} while ((reg & 0x40) == 0);
}
+static void ast_init_output_control(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ const uint32_t scu_addr = 0x1e6e2000;
+ const uint32_t scu_key = 0x1688a8a8;
+ uint32_t val;
+
+ /* unlock write access to SCUs */
+ val = ast_mindwm(ast, scu_addr);
+ ast_moutdwm(ast, scu_addr, scu_key);
+
+ /* configure SCU2C with the appropriate video output mode */
+ val = ast_mindwm(ast, scu_addr | 0x2c);
+
+ switch (ast->tx_chip_type) {
+ case AST_TX_SIL164:
+ case AST_TX_DP501:
+ /* Enable DVO output */
+ val &= ~0x40000;
+ break;
+ default:
+ /* VGA only: enable DAC output */
+ val &= ~0x30000;
+ break;
+ }
+
+ ast_moutdwm(ast, scu_addr | 0x2c, val);
+}
--
1.9.4