blob: 4d06a464ae753f7e8a02a2720506f40e7e0fbb93 [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>
Samuel Mendoza-Jonas7d8f5b92017-10-17 14:16:45 +110012Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Joel Stanley11548952016-03-03 11:41:59 +103013---
Joel Stanley3f6d8432017-07-18 14:58:37 +093014 drivers/gpu/drm/ast/ast_post.c | 33 +++++++++++++++++++++++++++++++++
15 1 file changed, 33 insertions(+)
Joel Stanley11548952016-03-03 11:41:59 +103016
17diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
Joel Stanley3f6d8432017-07-18 14:58:37 +093018index c7c58becb25d..a31158ed5928 100644
Joel Stanley11548952016-03-03 11:41:59 +103019--- a/drivers/gpu/drm/ast/ast_post.c
20+++ b/drivers/gpu/drm/ast/ast_post.c
21@@ -32,6 +32,7 @@
22 #include "ast_dram_tables.h"
23
24 static void ast_init_dram_2300(struct drm_device *dev);
25+static void ast_init_output_control(struct drm_device *dev);
26
27 void ast_enable_vga(struct drm_device *dev)
28 {
Joel Stanley3f6d8432017-07-18 14:58:37 +093029@@ -381,6 +382,10 @@ void ast_post_gpu(struct drm_device *dev)
30 else
31 ast_init_dram_reg(dev);
Joel Stanley11548952016-03-03 11:41:59 +103032
Joel Stanley3f6d8432017-07-18 14:58:37 +093033+ /* HACK: this is to support AMI P8 VGA support */
34+ if (ast->chip == AST2400)
35+ ast_init_output_control(dev);
Joel Stanley11548952016-03-03 11:41:59 +103036+
Joel Stanley3f6d8432017-07-18 14:58:37 +093037 ast_init_3rdtx(dev);
38 } else {
39 if (ast->tx_chip_type != AST_TX_NONE)
40@@ -1688,3 +1693,31 @@ static void ast_init_dram_2300(struct drm_device *dev)
Joel Stanley11548952016-03-03 11:41:59 +103041 } while ((reg & 0x40) == 0);
42 }
43
44+static void ast_init_output_control(struct drm_device *dev)
45+{
46+ struct ast_private *ast = dev->dev_private;
47+ const uint32_t scu_addr = 0x1e6e2000;
48+ const uint32_t scu_key = 0x1688a8a8;
49+ uint32_t val;
50+
51+ /* unlock write access to SCUs */
52+ val = ast_mindwm(ast, scu_addr);
53+ ast_moutdwm(ast, scu_addr, scu_key);
54+
55+ /* configure SCU2C with the appropriate video output mode */
56+ val = ast_mindwm(ast, scu_addr | 0x2c);
57+
58+ switch (ast->tx_chip_type) {
59+ case AST_TX_SIL164:
60+ case AST_TX_DP501:
61+ /* Enable DVO output */
62+ val &= ~0x40000;
63+ break;
64+ default:
65+ /* VGA only: enable DAC output */
66+ val &= ~0x30000;
67+ break;
68+ }
69+
70+ ast_moutdwm(ast, scu_addr | 0x2c, val);
71+}