summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2020-08-18 17:10:00 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2020-09-03 12:06:40 +0300
commitedfbd68bb51e3747c91dbafb5ed0e45cba202c21 (patch)
tree07707065da2e676cae1c24546e78683aa02c4d7b /drivers/thunderbolt
parent49f2a7f4cdaccb21ad964f6d8645ea3a0ec79293 (diff)
downloadlinux-edfbd68bb51e3747c91dbafb5ed0e45cba202c21.tar.xz
thunderbolt: Do not program NFC buffers for USB4 router protocol adapters
USB4 spec says that NFC buffers field is not used for protocol adapters, only for lane adapters so make tb_port_add_nfc_credits() skip non-lane adapters in order to follow the spec. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r--drivers/thunderbolt/switch.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 99effd6be3c1..7ffb3b00b54f 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -601,6 +601,13 @@ int tb_port_add_nfc_credits(struct tb_port *port, int credits)
if (credits == 0 || port->sw->is_unplugged)
return 0;
+ /*
+ * USB4 restricts programming NFC buffers to lane adapters only
+ * so skip other ports.
+ */
+ if (tb_switch_is_usb4(port->sw) && !tb_port_is_null(port))
+ return 0;
+
nfc_credits = port->config.nfc_credits & ADP_CS_4_NFC_BUFFERS_MASK;
nfc_credits += credits;