blob: b8bcb5e45d3186d2a26e794a6fedf7405dc1b1b4 [file] [log] [blame]
Joel Stanleyb314cb52017-06-07 14:51:57 +09301From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
Joel Stanley11548952016-03-03 11:41:59 +10302From: Jeremy Kerr <jk@ozlabs.org>
3Date: Wed, 2 Mar 2016 11:25:47 +0800
Joel Stanleyb314cb52017-06-07 14:51:57 +09304Subject: [PATCH 02/11] drivers/drm/ast: Switch SCU to VGA output on POST
Joel Stanley11548952016-03-03 11:41:59 +10305
6On AST BMC platforms, the BMC may be using the VGA device for UART
7mirroring. In this case, we need to switch the DAC output to
8VGA mode.
9
10Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
11Signed-off-by: Joel Stanley <joel@jms.id.au>
12---
Joel Stanley3f6d8432017-07-18 14:58:37 +093013 drivers/gpu/drm/ast/ast_post.c | 33 +++++++++++++++++++++++++++++++++
14 1 file changed, 33 insertions(+)
Joel Stanley11548952016-03-03 11:41:59 +103015
16diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
Joel Stanley3f6d8432017-07-18 14:58:37 +093017index c7c58becb25d..a31158ed5928 100644
Joel Stanley11548952016-03-03 11:41:59 +103018--- a/drivers/gpu/drm/ast/ast_post.c
19+++ b/drivers/gpu/drm/ast/ast_post.c
20@@ -32,6 +32,7 @@
21 #include "ast_dram_tables.h"
22
23 static void ast_init_dram_2300(struct drm_device *dev);
24+static void ast_init_output_control(struct drm_device *dev);
25
26 void ast_enable_vga(struct drm_device *dev)
27 {
Joel Stanley3f6d8432017-07-18 14:58:37 +093028@@ -381,6 +382,10 @@ void ast_post_gpu(struct drm_device *dev)
29 else
30 ast_init_dram_reg(dev);
Joel Stanley11548952016-03-03 11:41:59 +103031
Joel Stanley3f6d8432017-07-18 14:58:37 +093032+ /* HACK: this is to support AMI P8 VGA support */
33+ if (ast->chip == AST2400)
34+ ast_init_output_control(dev);
Joel Stanley11548952016-03-03 11:41:59 +103035+
Joel Stanley3f6d8432017-07-18 14:58:37 +093036 ast_init_3rdtx(dev);
37 } else {
38 if (ast->tx_chip_type != AST_TX_NONE)
39@@ -1688,3 +1693,31 @@ static void ast_init_dram_2300(struct drm_device *dev)
Joel Stanley11548952016-03-03 11:41:59 +103040 } while ((reg & 0x40) == 0);
41 }
42
43+static void ast_init_output_control(struct drm_device *dev)
44+{
45+ struct ast_private *ast = dev->dev_private;
46+ const uint32_t scu_addr = 0x1e6e2000;
47+ const uint32_t scu_key = 0x1688a8a8;
48+ uint32_t val;
49+
50+ /* unlock write access to SCUs */
51+ val = ast_mindwm(ast, scu_addr);
52+ ast_moutdwm(ast, scu_addr, scu_key);
53+
54+ /* configure SCU2C with the appropriate video output mode */
55+ val = ast_mindwm(ast, scu_addr | 0x2c);
56+
57+ switch (ast->tx_chip_type) {
58+ case AST_TX_SIL164:
59+ case AST_TX_DP501:
60+ /* Enable DVO output */
61+ val &= ~0x40000;
62+ break;
63+ default:
64+ /* VGA only: enable DAC output */
65+ val &= ~0x30000;
66+ break;
67+ }
68+
69+ ast_moutdwm(ast, scu_addr | 0x2c, val);
70+}