summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt
diff options
context:
space:
mode:
authorAapo Vienamo <aapo.vienamo@linux.intel.com>2024-07-19 20:37:17 +0200
committerMika Westerberg <mika.westerberg@linux.intel.com>2024-08-22 06:32:06 +0200
commit24edc397047180210ace0da60577b4a3e3d2af39 (patch)
treec82e26269434ab9913ac7d7e418d3a47962b291e /drivers/thunderbolt
parentLinux 6.11-rc4 (diff)
downloadlinux-24edc397047180210ace0da60577b4a3e3d2af39.tar.xz
linux-24edc397047180210ace0da60577b4a3e3d2af39.zip
thunderbolt: Add missing usb4_port_sb_read() to usb4_port_sw_margin()
Synchronize the operation completion by reading back the software margining operation completion metadata into margining->results. Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Co-developed-by: R Kannappan <r.kannappan@intel.com> Signed-off-by: R Kannappan <r.kannappan@intel.com> Co-developed-by: Rene Sapiens <rene.sapiens@intel.com> Signed-off-by: Rene Sapiens <rene.sapiens@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r--drivers/thunderbolt/debugfs.c5
-rw-r--r--drivers/thunderbolt/tb.h2
-rw-r--r--drivers/thunderbolt/usb4.c13
3 files changed, 13 insertions, 7 deletions
diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
index 9ed4bb2e8d05..a0d07887990e 100644
--- a/drivers/thunderbolt/debugfs.c
+++ b/drivers/thunderbolt/debugfs.c
@@ -785,9 +785,8 @@ static int margining_run_write(void *data, u64 val)
margining->time ? "time" : "voltage", dev_name(dev),
margining->lanes);
ret = usb4_port_sw_margin(port, margining->target, margining->index,
- margining->lanes, margining->time,
- margining->right_high,
- USB4_MARGIN_SW_COUNTER_CLEAR);
+ margining->lanes, margining->time, margining->right_high,
+ USB4_MARGIN_SW_COUNTER_CLEAR, &margining->results[0]);
if (ret)
goto out_clx;
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index b47f7873c847..321db4076573 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -1360,7 +1360,7 @@ int usb4_port_hw_margin(struct tb_port *port, enum usb4_sb_target target,
bool timing, bool right_high, u32 *results);
int usb4_port_sw_margin(struct tb_port *port, enum usb4_sb_target target,
u8 index, unsigned int lanes, bool timing,
- bool right_high, u32 counter);
+ bool right_high, u32 counter, u32 *results);
int usb4_port_sw_margin_errors(struct tb_port *port, enum usb4_sb_target target,
u8 index, u32 *errors);
diff --git a/drivers/thunderbolt/usb4.c b/drivers/thunderbolt/usb4.c
index 4d83b65afb5b..5505aa95c2ea 100644
--- a/drivers/thunderbolt/usb4.c
+++ b/drivers/thunderbolt/usb4.c
@@ -1703,6 +1703,7 @@ int usb4_port_hw_margin(struct tb_port *port, enum usb4_sb_target target,
* @timing: Perform timing margining instead of voltage
* @right_high: Use Right/high margin instead of left/low
* @counter: What to do with the error counter
+ * @results: Data word for the operation completion data
*
* Runs software lane margining on USB4 port. Read back the error
* counters by calling usb4_port_sw_margin_errors(). Returns %0 in
@@ -1710,7 +1711,7 @@ int usb4_port_hw_margin(struct tb_port *port, enum usb4_sb_target target,
*/
int usb4_port_sw_margin(struct tb_port *port, enum usb4_sb_target target,
u8 index, unsigned int lanes, bool timing,
- bool right_high, u32 counter)
+ bool right_high, u32 counter, u32 *results)
{
u32 val;
int ret;
@@ -1728,8 +1729,14 @@ int usb4_port_sw_margin(struct tb_port *port, enum usb4_sb_target target,
if (ret)
return ret;
- return usb4_port_sb_op(port, target, index,
- USB4_SB_OPCODE_RUN_SW_LANE_MARGINING, 2500);
+ ret = usb4_port_sb_op(port, target, index,
+ USB4_SB_OPCODE_RUN_SW_LANE_MARGINING, 2500);
+ if (ret)
+ return ret;
+
+ return usb4_port_sb_read(port, target, index, USB4_SB_DATA, results,
+ sizeof(*results));
+
}
/**