Joel Stanley | b314cb5 | 2017-06-07 14:51:57 +0930 | [diff] [blame] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
Joel Stanley | 1154895 | 2016-03-03 11:41:59 +1030 | [diff] [blame] | 2 | From: Jeremy Kerr <jk@ozlabs.org> |
| 3 | Date: Wed, 2 Mar 2016 11:25:47 +0800 |
Joel Stanley | b314cb5 | 2017-06-07 14:51:57 +0930 | [diff] [blame] | 4 | Subject: [PATCH 02/11] drivers/drm/ast: Switch SCU to VGA output on POST |
Joel Stanley | 1154895 | 2016-03-03 11:41:59 +1030 | [diff] [blame] | 5 | |
| 6 | On AST BMC platforms, the BMC may be using the VGA device for UART |
| 7 | mirroring. In this case, we need to switch the DAC output to |
| 8 | VGA mode. |
| 9 | |
| 10 | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> |
| 11 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
Samuel Mendoza-Jonas | 7d8f5b9 | 2017-10-17 14:16:45 +1100 | [diff] [blame] | 12 | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> |
Joel Stanley | 1154895 | 2016-03-03 11:41:59 +1030 | [diff] [blame] | 13 | --- |
Joel Stanley | 3f6d843 | 2017-07-18 14:58:37 +0930 | [diff] [blame] | 14 | drivers/gpu/drm/ast/ast_post.c | 33 +++++++++++++++++++++++++++++++++ |
| 15 | 1 file changed, 33 insertions(+) |
Joel Stanley | 1154895 | 2016-03-03 11:41:59 +1030 | [diff] [blame] | 16 | |
| 17 | diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c |
Joel Stanley | 3f6d843 | 2017-07-18 14:58:37 +0930 | [diff] [blame] | 18 | index c7c58becb25d..a31158ed5928 100644 |
Joel Stanley | 1154895 | 2016-03-03 11:41:59 +1030 | [diff] [blame] | 19 | --- 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 Stanley | 3f6d843 | 2017-07-18 14:58:37 +0930 | [diff] [blame] | 29 | @@ -381,6 +382,10 @@ void ast_post_gpu(struct drm_device *dev) |
| 30 | else |
| 31 | ast_init_dram_reg(dev); |
Joel Stanley | 1154895 | 2016-03-03 11:41:59 +1030 | [diff] [blame] | 32 | |
Joel Stanley | 3f6d843 | 2017-07-18 14:58:37 +0930 | [diff] [blame] | 33 | + /* HACK: this is to support AMI P8 VGA support */ |
| 34 | + if (ast->chip == AST2400) |
| 35 | + ast_init_output_control(dev); |
Joel Stanley | 1154895 | 2016-03-03 11:41:59 +1030 | [diff] [blame] | 36 | + |
Joel Stanley | 3f6d843 | 2017-07-18 14:58:37 +0930 | [diff] [blame] | 37 | 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 Stanley | 1154895 | 2016-03-03 11:41:59 +1030 | [diff] [blame] | 41 | } 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 | +} |