blob: e82b3e455ad4708afc4e338d3edeb86c7887a4c2 [file] [log] [blame]
Joel Stanley548b0af2016-08-16 23:09:53 +09301From 8964043403b2b1990f5fa164473b18c4a9b88137 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 Stanley548b0af2016-08-16 23:09:53 +09304Subject: [PATCH 2/9] 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---
13 drivers/gpu/drm/ast/ast_post.c | 32 ++++++++++++++++++++++++++++++++
14 1 file changed, 32 insertions(+)
15
16diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
17index 810c51d92b99..703dba2ba84b 100644
18--- 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 {
28@@ -384,6 +385,9 @@ void ast_post_gpu(struct drm_device *dev)
29 else
30 ast_init_dram_reg(dev);
31
32+ if (ast->chip == AST2400)
33+ ast_init_output_control(dev);
34+
35 ast_init_3rdtx(dev);
36 }
37
38@@ -1655,3 +1659,31 @@ static void ast_init_dram_2300(struct drm_device *dev)
39 } while ((reg & 0x40) == 0);
40 }
41
42+static void ast_init_output_control(struct drm_device *dev)
43+{
44+ struct ast_private *ast = dev->dev_private;
45+ const uint32_t scu_addr = 0x1e6e2000;
46+ const uint32_t scu_key = 0x1688a8a8;
47+ uint32_t val;
48+
49+ /* unlock write access to SCUs */
50+ val = ast_mindwm(ast, scu_addr);
51+ ast_moutdwm(ast, scu_addr, scu_key);
52+
53+ /* configure SCU2C with the appropriate video output mode */
54+ val = ast_mindwm(ast, scu_addr | 0x2c);
55+
56+ switch (ast->tx_chip_type) {
57+ case AST_TX_SIL164:
58+ case AST_TX_DP501:
59+ /* Enable DVO output */
60+ val &= ~0x40000;
61+ break;
62+ default:
63+ /* VGA only: enable DAC output */
64+ val &= ~0x30000;
65+ break;
66+ }
67+
68+ ast_moutdwm(ast, scu_addr | 0x2c, val);
69+}
70--
Joel Stanley12779292016-06-25 23:13:56 +0930712.8.1
Joel Stanley11548952016-03-03 11:41:59 +103072