gfx gma skylake: Implement some workarounds
Without these workarounds, gfx_test will leave a WHL-U Librem Mini v1 in
a state where entering low-power states results in a hang. With these
workarounds, the system no longer locks up after running gfx_test. Looks
like the hang does not happen when coreboot runs libgfxinit.
Steps to reproduce the hang:
- Boot Linux without loading i915.
- Run gfx_test without the workarounds.
- After gfx_test exits and the machine enters a low-power state,
it will lock up.
If something keeps the CPU from getting into low-power states (e.g.
`cat /dev/zero > /dev/null`), the machine will not lock up. However,
stopping the load task after gfx_test has run will result in a lock-up.
Change-Id: I4cd64cf4c1e702dc05709adc345a976a4e3c1ded
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/46635
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/skylake/hw-gfx-gma-power_and_clocks.adb b/common/skylake/hw-gfx-gma-power_and_clocks.adb
index edbaf00..ec71359 100644
--- a/common/skylake/hw-gfx-gma-power_and_clocks.adb
+++ b/common/skylake/hw-gfx-gma-power_and_clocks.adb
@@ -82,6 +82,8 @@
LCPLL1_CTL_PLL_ENABLE : constant := 1 * 2 ** 31;
LCPLL1_CTL_PLL_LOCK : constant := 1 * 2 ** 30;
+ DISP_FBC_MEMORY_WAKE : constant := 1 * 2 ** 31;
+
----------------------------------------------------------------------------
CDCLK_CTL_CD_FREQ_SELECT_MASK : constant := 3 * 2 ** 26;
@@ -351,6 +353,16 @@
(Register => Registers.LCPLL1_CTL,
Mask => LCPLL1_CTL_PLL_LOCK);
+ -- WaEnableChickenDCPR:skl,bxt,kbl,glk,cfl
+ Registers.Set_Mask
+ (Register => Registers.GEN8_CHICKEN_DCPR_1,
+ Mask => 1 * 2 ** 13);
+
+ -- Display WA #0859 WaFbcWakeMemOn:skl,bxt,kbl,glk,cfl
+ Registers.Set_Mask
+ (Register => Registers.ARB_CTL,
+ Mask => DISP_FBC_MEMORY_WAKE);
+
Get_Cur_CDClk (Config.CDClk);
Get_Max_CDClk (Config.Max_CDClk);
Set_CDClk (Config.Default_CDClk_Freq);