summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/tmu.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2023-05-26 08:22:06 +0200
committerMika Westerberg <mika.westerberg@linux.intel.com>2023-06-09 11:07:22 +0200
commit701e73a823bb887be1aabebf1ffaba068d329550 (patch)
treeaf9e95bc085f71564e29517a5382889026d7eefe /drivers/thunderbolt/tmu.c
parentthunderbolt: Drop useless 'unidirectional' parameter from tb_switch_tmu_is_en... (diff)
downloadlinux-701e73a823bb887be1aabebf1ffaba068d329550.tar.xz
linux-701e73a823bb887be1aabebf1ffaba068d329550.zip
thunderbolt: Rework Titan Ridge TMU objection disable function
Now this is split into two with one having a misleading name (tb_switch_tmu_unidirectional_enable()). Make this easier to read, rename and consolidate the two functions into one with name that explains what it actually does. Use the two constants as well that were added but never used to make it clear which bits are being set. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tmu.c')
-rw-r--r--drivers/thunderbolt/tmu.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/thunderbolt/tmu.c b/drivers/thunderbolt/tmu.c
index 5d508ea8baa5..30f18806abb7 100644
--- a/drivers/thunderbolt/tmu.c
+++ b/drivers/thunderbolt/tmu.c
@@ -503,8 +503,10 @@ out:
return ret;
}
-static int tb_switch_tmu_objection_mask(struct tb_switch *sw)
+/* Only needed for Titan Ridge */
+static int tb_switch_tmu_disable_objections(struct tb_switch *sw)
{
+ struct tb_port *up = tb_upstream_port(sw);
u32 val;
int ret;
@@ -515,17 +517,15 @@ static int tb_switch_tmu_objection_mask(struct tb_switch *sw)
val &= ~TB_TIME_VSEC_3_CS_9_TMU_OBJ_MASK;
- return tb_sw_write(sw, &val, TB_CFG_SWITCH,
- sw->cap_vsec_tmu + TB_TIME_VSEC_3_CS_9, 1);
-}
-
-static int tb_switch_tmu_unidirectional_enable(struct tb_switch *sw)
-{
- struct tb_port *up = tb_upstream_port(sw);
+ ret = tb_sw_write(sw, &val, TB_CFG_SWITCH,
+ sw->cap_vsec_tmu + TB_TIME_VSEC_3_CS_9, 1);
+ if (ret)
+ return ret;
return tb_port_tmu_write(up, TMU_ADP_CS_6,
TMU_ADP_CS_6_DISABLE_TMU_OBJ_MASK,
- TMU_ADP_CS_6_DISABLE_TMU_OBJ_MASK);
+ TMU_ADP_CS_6_DISABLE_TMU_OBJ_CL1 |
+ TMU_ADP_CS_6_DISABLE_TMU_OBJ_CL2);
}
/*
@@ -670,11 +670,7 @@ int tb_switch_tmu_enable(struct tb_switch *sw)
if (!tb_switch_is_clx_enabled(sw, TB_CL1))
return -EOPNOTSUPP;
- ret = tb_switch_tmu_objection_mask(sw);
- if (ret)
- return ret;
-
- ret = tb_switch_tmu_unidirectional_enable(sw);
+ ret = tb_switch_tmu_disable_objections(sw);
if (ret)
return ret;
}