summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel O'Connor <darius@dons.net.au>2020-09-18 00:00:28 +0930
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-11-10 16:43:54 -0800
commit0e0fd56d9f3f9e4a9d4dfde18f01c5578113559c (patch)
treebceb49283793fd04f68936c9dcd443486b5ef13e
parent773f703d92714edb80458693bf9bf42fc0b77db4 (diff)
Do not hang if P2A is disabled, using sensible defaults instead.
Based on Linux DRM https://patchwork.kernel.org/patch/9578793/
-rw-r--r--src/ast_vgatool.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/ast_vgatool.c b/src/ast_vgatool.c
index 063775b..a22eb6d 100644
--- a/src/ast_vgatool.c
+++ b/src/ast_vgatool.c
@@ -432,11 +432,27 @@ ASTGetDRAMInfo(ScrnInfoPtr pScrn)
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF004) = 0x1e6e0000;
*(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1;
- *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000) = 0xFC600309;
- do {
- ;
- } while (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10000) != 0x01);
+ /* Based on the Linux DRM driver we might not be able to access this
+ * If we can't just use some sane defaults.
+ *
+ * See drm/drivers/gpu/drm/ast/ast_main.c line 295.
+ */
+ *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000) = 0xFC600309;
+ for (ulData = 10000; ulData > 0; ulData--)
+ if (*(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10000) == 0x01)
+ break;
+
+ if (ulData == 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Unable to read DRAM information, using defaults\n");
+ pAST->ulDRAMBusWidth = 16;
+ pAST->jDRAMType = DRAMTYPE_1Gx16;
+ if (pAST->jChipType == AST2500)
+ pAST->ulMCLK = 800;
+ else
+ pAST->ulMCLK = 396;
+ return;
+ }
ulData = *(volatile ULONG *) (pAST->MMIOVirtualAddr + 0x10004);
/* Get BusWidth */