aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ast/ast_main.c
diff options
context:
space:
mode:
authorY.C. Chen <yc_chen@aspeedtech.com>2017-02-16 22:36:46 -0500
committerDave Airlie <airlied@redhat.com>2017-02-27 22:15:14 -0500
commit9f93c8b3c08f8c456aad86fd05caa6a1688320ff (patch)
tree378a92807ab80716aa77066da4da3f13c8b98c33 /drivers/gpu/drm/ast/ast_main.c
parent6475a7cce61967fca4dd793b60acf5a7dc70bc9a (diff)
drm/ast: Base support for AST2500
Add detection and mode setting updates for AST2500 generation chip, code originally from Aspeed and slightly reworked for coding style mostly by Ben. This doesn't contain the BMC DRAM POST code which is in a separate patch. Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/ast/ast_main.c')
-rw-r--r--drivers/gpu/drm/ast/ast_main.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index fd167008be31..8e8c0310245f 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -142,7 +142,10 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
142 ast->chip = AST1100; 142 ast->chip = AST1100;
143 DRM_INFO("AST 1180 detected\n"); 143 DRM_INFO("AST 1180 detected\n");
144 } else { 144 } else {
145 if (dev->pdev->revision >= 0x30) { 145 if (dev->pdev->revision >= 0x40) {
146 ast->chip = AST2500;
147 DRM_INFO("AST 2500 detected\n");
148 } else if (dev->pdev->revision >= 0x30) {
146 ast->chip = AST2400; 149 ast->chip = AST2400;
147 DRM_INFO("AST 2400 detected\n"); 150 DRM_INFO("AST 2400 detected\n");
148 } else if (dev->pdev->revision >= 0x20) { 151 } else if (dev->pdev->revision >= 0x20) {
@@ -196,6 +199,9 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
196 if (ast->chip == AST2400 && 199 if (ast->chip == AST2400 &&
197 (scu_rev & 0x300) == 0x100) /* ast1400 */ 200 (scu_rev & 0x300) == 0x100) /* ast1400 */
198 ast->support_wide_screen = true; 201 ast->support_wide_screen = true;
202 if (ast->chip == AST2500 &&
203 scu_rev == 0x100) /* ast2510 */
204 ast->support_wide_screen = true;
199 } 205 }
200 break; 206 break;
201 } 207 }
@@ -291,7 +297,10 @@ static int ast_get_dram_info(struct drm_device *dev)
291 default: 297 default:
292 ast->dram_bus_width = 16; 298 ast->dram_bus_width = 16;
293 ast->dram_type = AST_DRAM_1Gx16; 299 ast->dram_type = AST_DRAM_1Gx16;
294 ast->mclk = 396; 300 if (ast->chip == AST2500)
301 ast->mclk = 800;
302 else
303 ast->mclk = 396;
295 return 0; 304 return 0;
296 } 305 }
297 306
@@ -300,7 +309,23 @@ static int ast_get_dram_info(struct drm_device *dev)
300 else 309 else
301 ast->dram_bus_width = 32; 310 ast->dram_bus_width = 32;
302 311
303 if (ast->chip == AST2300 || ast->chip == AST2400) { 312 if (ast->chip == AST2500) {
313 switch (mcr_cfg & 0x03) {
314 case 0:
315 ast->dram_type = AST_DRAM_1Gx16;
316 break;
317 default:
318 case 1:
319 ast->dram_type = AST_DRAM_2Gx16;
320 break;
321 case 2:
322 ast->dram_type = AST_DRAM_4Gx16;
323 break;
324 case 3:
325 ast->dram_type = AST_DRAM_8Gx16;
326 break;
327 }
328 } else if (ast->chip == AST2300 || ast->chip == AST2400) {
304 switch (mcr_cfg & 0x03) { 329 switch (mcr_cfg & 0x03) {
305 case 0: 330 case 0:
306 ast->dram_type = AST_DRAM_512Mx16; 331 ast->dram_type = AST_DRAM_512Mx16;
@@ -523,6 +548,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)
523 ast->chip == AST2200 || 548 ast->chip == AST2200 ||
524 ast->chip == AST2300 || 549 ast->chip == AST2300 ||
525 ast->chip == AST2400 || 550 ast->chip == AST2400 ||
551 ast->chip == AST2500 ||
526 ast->chip == AST1180) { 552 ast->chip == AST1180) {
527 dev->mode_config.max_width = 1920; 553 dev->mode_config.max_width = 1920;
528 dev->mode_config.max_height = 2048; 554 dev->mode_config.max_height = 2048;