gma broxton: Enable HPD signal inversion
Intel's Apollo Lake uses different hardware for the hotplug-detect
(HPD) input pin. It's not 3.3V tolerant and they changed the design
guide to make the required level shifter also an inverter. To make
the HPD logic reliably detect short and long pulses, the signal needs
to be inverted again, internally, by setting a corresponding bit.
Change-Id: Ia18569d4869d529732fd90d872c2d2c4060c5997
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/538
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/haswell_shared/hw-gfx-gma-port_detect.adb b/common/haswell_shared/hw-gfx-gma-port_detect.adb
index 5765941..3f83820 100644
--- a/common/haswell_shared/hw-gfx-gma-port_detect.adb
+++ b/common/haswell_shared/hw-gfx-gma-port_detect.adb
@@ -27,6 +27,7 @@
HOTPLUG_CTL_DDI_A_HPD_STATUS : constant := 3 * 2 ** 0;
HOTPLUG_CTL_DDI_A_HPD_LONG_DETECT : constant := 1 * 2 ** 1;
+ SHOTPLUG_CTL_HPD_INVERT_MASK : constant := 16#0808_0808#;
SHOTPLUG_CTL_DETECT_MASK : constant := 16#0303_0303#;
type Digital_Port_Value is array (Digital_Port) of Word32;
@@ -42,6 +43,12 @@
DIGI_D => 1 * 2 ** 20,
DIGI_A => 1 * 2 ** 28,
others => 0);
+ SHOTPLUG_CTL_HPD_INVERT : constant Digital_Port_Value :=
+ (DIGI_B => 1 * 2 ** 3,
+ DIGI_C => 1 * 2 ** 11,
+ DIGI_D => 1 * 2 ** 19,
+ DIGI_A => 1 * 2 ** 27,
+ others => 0);
SHOTPLUG_CTL_HPD_STATUS : constant Digital_Port_Value :=
(DIGI_B => 3 * 2 ** 0,
DIGI_C => 3 * 2 ** 8,
@@ -73,6 +80,9 @@
(DIGI_B => DP1,
DIGI_C => DP2,
DIGI_D => DP3);
+
+ Invert_Mask : constant Word32 :=
+ (if Config.Has_Hotplug_Invert then SHOTPLUG_CTL_HPD_INVERT_MASK else 0);
begin
if Config.Has_DDI_E and Config.Has_PCH_DAC then
-- PCH_DAC (_A)
@@ -114,6 +124,7 @@
(Register => Registers.SHOTPLUG_CTL,
Mask_Unset => SHOTPLUG_CTL_DETECT_MASK,
Mask_Set => SHOTPLUG_CTL_HPD_INPUT_ENABLE (DIGI_A) or
+ (SHOTPLUG_CTL_HPD_INVERT (DIGI_A) and Invert_Mask) or
SHOTPLUG_CTL_HPD_STATUS (DIGI_A)); -- clear
end if;
end if;
@@ -139,6 +150,7 @@
(Register => Registers.SHOTPLUG_CTL,
Mask_Unset => SHOTPLUG_CTL_DETECT_MASK,
Mask_Set => SHOTPLUG_CTL_HPD_INPUT_ENABLE (Port) or
+ (SHOTPLUG_CTL_HPD_INVERT (Port) and Invert_Mask) or
SHOTPLUG_CTL_HPD_STATUS (Port)); -- clear status
else
Registers.Unset_Mask
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template
index e495526..0fd40c3 100644
--- a/common/hw-gfx-gma-config.ads.template
+++ b/common/hw-gfx-gma-config.ads.template
@@ -296,6 +296,7 @@
Has_HOTPLUG_CTL : <genbool> := Gen_Haswell;
Has_SHOTPLUG_CTL_A : <hswbool> :=
((Gen_Haswell and then Is_LP) or Skylake_On);
+ Has_Hotplug_Invert : <genbool> := Gen_Broxton;
Has_DDI_PHYs : <genbool> := Gen_Broxton;