From 90ee1cbacb7794eb4db0cfa0e8b6d0bb2ed45bf6 Mon Sep 17 00:00:00 2001
From: Xianzhong <xianzhong.li@nxp.com>
Date: Fri, 22 Feb 2019 16:50:19 +0800
Subject: [PATCH] MGS-4568 [#imx-1336] fix GPU suspend stuck issue

the data is invalid in first read for dma registers,
add second read to get the correct register data.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
---
 .../gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c   | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c
index 3722dbcb63ef0d..7778da4999dfdc 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c
+++ b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c
@@ -11727,6 +11727,11 @@ gckHARDWARE_QueryIdle(
                                          0x00664,
                                          &address));
 
+        gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
+                                         Hardware->core,
+                                         0x00664,
+                                         &address));
+
         /* Test if address is inside the last WAIT/LINK sequence. */
         if ((address < Hardware->lastWaitLink) ||
             (address >= (gctUINT64)Hardware->lastWaitLink + 16))
@@ -11735,6 +11740,11 @@ gckHARDWARE_QueryIdle(
             break;
         }
 
+        gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
+                                         Hardware->core,
+                                         0x00668,
+                                         &dmaLow));
+
         gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os,
                                          Hardware->core,
                                          0x00668,
-- 
GitLab