[PATCH Internal] thunderbolt: Remove enabling/disabling TMU based on CLx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Sanath S <Sanath.S@xxxxxxx>

Since TMU is enabled by default on Intel SOCs for USB4 before Alpine
Ridge, explicit enabling or disabling of TMU is not required.

However, the current implementation of enabling or disabling TMU based
on CLx state is inadequate as not all SOCs with CLx disabled have TMU
enabled by default, such as AMD Yellow Carp and Pink Sardine.

To address this, a quirk named "QUIRK_TMU_DEFAULT_ENABLED" is
implemented to skip the enabling or disabling of TMU for SOCs where it
is already enabled by default, such as Intel SOCs prior to Alpine Ridge.

Fixes: 7af9da8ce8f9 ("thunderbolt: Add quirk to disable CLx")
Signed-off-by: Sanjay R Mehta <sanju.mehta@xxxxxxx>
Signed-off-by: Sanath S <Sanath.S@xxxxxxx>
---
 drivers/thunderbolt/tb.c  | 4 ++++
 drivers/thunderbolt/tb.h  | 2 ++
 drivers/thunderbolt/tmu.c | 6 ++++++
 3 files changed, 12 insertions(+)

diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index aa6e11589c28..5fa9fbf095d2 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -923,6 +923,10 @@ static void tb_scan_port(struct tb_port *port)
 	tb_switch_lane_bonding_enable(sw);
 	/* Set the link configured */
 	tb_switch_configure_link(sw);
+	/* On Alpine Ridge and earlier Platforms, the TMU mode is enabled by default */
+	if (sw->generation < 4 || tb_switch_is_tiger_lake(sw))
+		sw->quirks |= QUIRK_TMU_DEFAULT_ENABLED;
+
 	/*
 	 * CL0s and CL1 are enabled and supported together.
 	 * Silently ignore CLx enabling in case CLx is not supported.
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 58df106aaa5e..9252d3875c08 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -27,6 +27,8 @@
 #define QUIRK_FORCE_POWER_LINK_CONTROLLER		BIT(0)
 /* Disable CLx if not supported */
 #define QUIRK_NO_CLX					BIT(1)
+/* TMU enabled by default */
+#define QUIRK_TMU_DEFAULT_ENABLED			BIT(2)
 
 /**
  * struct tb_nvm - Structure holding NVM information
diff --git a/drivers/thunderbolt/tmu.c b/drivers/thunderbolt/tmu.c
index c926fb71c43d..8e38ab5aae15 100644
--- a/drivers/thunderbolt/tmu.c
+++ b/drivers/thunderbolt/tmu.c
@@ -387,6 +387,9 @@ int tb_switch_tmu_disable(struct tb_switch *sw)
 	if (sw->tmu.rate == TB_SWITCH_TMU_RATE_OFF)
 		return 0;
 
+	if (sw->quirks & QUIRK_TMU_DEFAULT_ENABLED)
+ 		return 0;
+
 	if (tb_route(sw)) {
 		bool unidirectional = sw->tmu.unidirectional;
 		struct tb_port *down, *up;
@@ -643,6 +646,9 @@ int tb_switch_tmu_enable(struct tb_switch *sw)
 	if (tb_switch_tmu_is_enabled(sw))
 		return 0;
 
+	if (sw->quirks & QUIRK_TMU_DEFAULT_ENABLED)
+ 		return 0;
+
 	if (tb_switch_is_titan_ridge(sw) && unidirectional) {
 		ret = tb_switch_tmu_disable_objections(sw);
 		if (ret)
-- 
2.34.1




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux