summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/usb4.c
diff options
context:
space:
mode:
authorR Kannappan <r.kannappan@intel.com>2024-07-19 20:37:20 +0200
committerMika Westerberg <mika.westerberg@linux.intel.com>2024-08-22 06:32:06 +0200
commit10904df3f20cf36e418e78ab73c2fbcecda512b8 (patch)
tree3e36f79b75e9bb891b6bc157856b2bbf893d5dcf /drivers/thunderbolt/usb4.c
parentthunderbolt: Add optional voltage offset range for receiver lane margining (diff)
downloadlinux-10904df3f20cf36e418e78ab73c2fbcecda512b8.tar.xz
linux-10904df3f20cf36e418e78ab73c2fbcecda512b8.zip
thunderbolt: Improve software receiver lane margining
USB4 specification defines the metadata needed to perform software margining, as well as the necessary steps which include waiting for dwell time. - Add dwell_time attribute to set the wait time while performing margining and checking for link errors. - Add error_counter attribute to configure error counter prior to margining test. - Add voltage_time_offset attribute to set the voltage or time offset steps before performing the software margining test. - Perform software margining test for dwell duration, break if there are link errors, stop the clocks and provide results. Below is a minimalistic example how this can be used. Note these values are just examples. The exact values in practice depend on host specific capabilities and the type of measurement to be performed. # cd /sys/kernel/debug/thunderbolt/ROUTER/portX/margining/ # echo software > mode # echo 400 > dwell_time # echo 1 > run As usual the results attribute contains the results of a succesfull run. 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> Co-developed-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Signed-off-by: Aapo Vienamo <aapo.vienamo@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/usb4.c')
-rw-r--r--drivers/thunderbolt/usb4.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/thunderbolt/usb4.c b/drivers/thunderbolt/usb4.c
index a2f81e17ad8d..0a9b4aeb3fa1 100644
--- a/drivers/thunderbolt/usb4.c
+++ b/drivers/thunderbolt/usb4.c
@@ -1723,6 +1723,7 @@ int usb4_port_sw_margin(struct tb_port *port, enum usb4_sb_target target,
if (params->right_high)
val |= USB4_MARGIN_SW_RH;
val |= FIELD_PREP(USB4_MARGIN_SW_COUNTER_MASK, params->error_counter);
+ val |= FIELD_PREP(USB4_MARGIN_SW_VT_MASK, params->voltage_time_offset);
ret = usb4_port_sb_write(port, target, index, USB4_SB_METADATA, &val,
sizeof(val));