summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/tb.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2022-10-07 16:53:58 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2023-06-09 12:07:23 +0300
commit20c2fae9dbe35134e98679181faa611cc69c6c30 (patch)
treeb98ae36496614e3bb8b5782654e3d5a9bcaf19de /drivers/thunderbolt/tb.c
parent7d283f4148f184b200854acdc21308e5bfee9fc1 (diff)
downloadlinux-20c2fae9dbe35134e98679181faa611cc69c6c30.tar.gz
linux-20c2fae9dbe35134e98679181faa611cc69c6c30.tar.bz2
linux-20c2fae9dbe35134e98679181faa611cc69c6c30.zip
thunderbolt: Move TMU configuration to tb_enable_tmu()
There is no need to duplicate the code the enables TMU. Also update the comment to better explain why we do this in the first place. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tb.c')
-rw-r--r--drivers/thunderbolt/tb.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 39ec7094fe17..0630b877136e 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -387,6 +387,16 @@ static int tb_enable_tmu(struct tb_switch *sw)
{
int ret;
+ /*
+ * If CL1 is enabled then we need to configure the TMU accuracy
+ * level to normal. Otherwise we keep the TMU running at the
+ * highest accuracy.
+ */
+ if (tb_switch_is_clx_enabled(sw, TB_CL1))
+ tb_switch_tmu_configure(sw, TB_SWITCH_TMU_RATE_NORMAL, true);
+ else
+ tb_switch_tmu_configure(sw, TB_SWITCH_TMU_RATE_HIFI, false);
+
/* If it is already enabled in correct mode, don't touch it */
if (tb_switch_tmu_is_enabled(sw))
return 0;
@@ -873,16 +883,6 @@ static void tb_scan_port(struct tb_port *port)
tb_switch_clx_name(TB_CL1));
}
- if (tb_switch_is_clx_enabled(sw, TB_CL1))
- /*
- * To support highest CLx state, we set router's TMU to
- * Normal-Uni mode.
- */
- tb_switch_tmu_configure(sw, TB_SWITCH_TMU_RATE_NORMAL, true);
- else
- /* If CLx disabled, configure router's TMU to HiFi-Bidir mode*/
- tb_switch_tmu_configure(sw, TB_SWITCH_TMU_RATE_HIFI, false);
-
if (tb_enable_tmu(sw))
tb_sw_warn(sw, "failed to enable TMU\n");
@@ -2035,16 +2035,6 @@ static void tb_restore_children(struct tb_switch *sw)
tb_sw_warn(sw, "failed to re-enable %s on upstream port\n",
tb_switch_clx_name(TB_CL1));
- if (tb_switch_is_clx_enabled(sw, TB_CL1))
- /*
- * To support highest CLx state, we set router's TMU to
- * Normal-Uni mode.
- */
- tb_switch_tmu_configure(sw, TB_SWITCH_TMU_RATE_NORMAL, true);
- else
- /* If CLx disabled, configure router's TMU to HiFi-Bidir mode*/
- tb_switch_tmu_configure(sw, TB_SWITCH_TMU_RATE_HIFI, false);
-
if (tb_enable_tmu(sw))
tb_sw_warn(sw, "failed to restore TMU configuration\n");