mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
thunderbolt: Fix sideband register access in usb4_port_sw_margin_errors()
The READ_SW_MARGIN_ERR (RDSW) completion payload is returned in the USB4 sideband data window, but the location differs between standard and extended error counters. Standard error counters are returned in USB4_SB_METADATA and fit within a single dword. Extended error counters require 4 dwords and are returned in USB4_SB_DATA. Add conditional logic to select the appropriate register based on the dwords parameter that corresponds with error counter type. Co-developed-by: Rene Sapiens <rene.sapiens@linux.intel.com> Signed-off-by: Rene Sapiens <rene.sapiens@linux.intel.com> Signed-off-by: Anurag <anurag@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
879519402c
commit
d224aacc8c
|
|
@ -1836,13 +1836,16 @@ int usb4_port_sw_margin_errors(struct tb_port *port, enum usb4_sb_target target,
|
|||
u8 index, u32 *errors, size_t dwords)
|
||||
{
|
||||
int ret;
|
||||
u8 reg;
|
||||
|
||||
ret = usb4_port_sb_op(port, target, index,
|
||||
USB4_SB_OPCODE_READ_SW_MARGIN_ERR, 150);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return usb4_port_sb_read(port, target, index, USB4_SB_METADATA, errors,
|
||||
reg = (dwords > 1) ? USB4_SB_DATA : USB4_SB_METADATA;
|
||||
|
||||
return usb4_port_sb_read(port, target, index, reg, errors,
|
||||
sizeof(*errors) * dwords);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user