gma: Always clear hot-plug events before enabling a pipe

For cold plugging, we don't wait for a hot-plug event. But, even if we
are not supposed to wait for a hot-plug event, we have to clear any
pending event. Also, a failed DP training can result in another hot-plug
event.

A stale event would be spuriously interpreted as a disconnect, resul-
ting in an infinite loop of cycling the pipe on and off.

Change-Id: I4c7bbe0ac792553c94e928ba0a5eeb822a857f9c
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/18122
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 616a170..ca27175 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -121,6 +121,9 @@
                pragma Loop_Invariant
                  (Pipe_Cfg.Port in Active_Port_Type);
 
+               -- Clear pending hot-plug events before every try
+               Port_Detect.Clear_Hotplug_Detect (Pipe_Cfg.Port);
+
                Connectors.Pre_On
                  (Pipe        => Pipe,
                   Port_Cfg    => Port_Cfg,