mb/google/rex: Set AUX orientation at SoC to follow cable for anx7452

This configures the SoC to flip the orientation of the AUX pins to
follow the orientation of the cable when using the anx7452 retimer. This
is necessary when there is no external retimer/mux or the retimer/mux
does not implement the flip. The anx7452 retimer does not appear to
support this feature, so let the SoC do the flip.

BUG=b:267589042,b:281006910
TEST=verified DP-ALT mode works on rex using both cable orientations

Change-Id: Ibb9f442d2afd81fb5dde4bca97c15457837f9f4a
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75827
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Tarun Tuli <taruntuli@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
diff --git a/src/mainboard/google/rex/variants/rex0/variant.c b/src/mainboard/google/rex/variants/rex0/variant.c
index b259636..032eef9 100644
--- a/src/mainboard/google/rex/variants/rex0/variant.c
+++ b/src/mainboard/google/rex/variants/rex0/variant.c
@@ -6,6 +6,10 @@
 #include <sar.h>
 #include <variant/gpio.h>
 
+#define TCP2_AUX_SHIFT		4
+#define TCP_AUX_MASK		0x03
+#define TCP_AUX_FOLLOW_CC1	0x01
+
 const char *get_wifi_sar_cbfs_filename(void)
 {
 	return "wifi_sar_0.hex";
@@ -26,4 +30,14 @@
 {
 	config->cnvi_bt_audio_offload = fw_config_probe(FW_CONFIG(AUDIO,
 							MAX98360_ALC5682I_I2S));
+
+	if (fw_config_probe(FW_CONFIG(DB_USB, USB4_ANX7452)) ||
+	    fw_config_probe(FW_CONFIG(DB_USB, USB4_ANX7452_V2))) {
+		/*
+		 * Configure TCP2 for
+		 * "SBU orientation not handled by external retimer"
+		 */
+		config->tcss_aux_ori &= ~(TCP_AUX_MASK << TCP2_AUX_SHIFT);
+		config->tcss_aux_ori |= TCP_AUX_FOLLOW_CC1 << TCP2_AUX_SHIFT;
+	}
 }