Linux USB
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: "Yehezkel Bernat" <YehezkelShB@gmail.com>,
	"Michael Jamet" <michael.jamet@intel.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Andreas Noever" <andreas.noever@gmail.com>,
	"Werner Sembach" <wse@tuxedocomputers.com>,
	"Konrad J Hambrick" <kjhambrick@gmail.com>,
	"Calvin Walton" <calvin.walton@kepstin.ca>,
	"Marek Šanta" <teslan223@gmail.com>,
	"David Binderman" <dcb314@hotmail.com>,
	"Alex Balcanquall" <alex@alexbal.com>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>
Subject: [PATCH 2/5] thunderbolt: Check that lane 1 is in CL0 before enabling lane bonding
Date: Mon, 11 Sep 2023 13:04:42 +0300	[thread overview]
Message-ID: <20230911100445.3612655-3-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20230911100445.3612655-1-mika.westerberg@linux.intel.com>

Marek reported that when BlackMagic UltraStudio device is connected the
kernel repeatedly tries to enable lane bonding without success making
the device non-functional. It looks like the device does not have lane 1
connected at all so even though it is enabled we should not try to bond
the lanes. For this reason check that lane 1 is in fact CL0 (connected,
active) before attempting to bond the lanes.

Reported-by: Marek Šanta <teslan223@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217737
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/switch.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 43171cc1cc2d..bd5815f8f23b 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -2725,6 +2725,13 @@ int tb_switch_lane_bonding_enable(struct tb_switch *sw)
 	    !tb_port_is_width_supported(down, TB_LINK_WIDTH_DUAL))
 		return 0;
 
+	/*
+	 * Both lanes need to be in CL0. Here we assume lane 0 already be in
+	 * CL0 and check just for lane 1.
+	 */
+	if (tb_wait_for_port(down->dual_link_port, false) <= 0)
+		return -ENOTCONN;
+
 	ret = tb_port_lane_bonding_enable(up);
 	if (ret) {
 		tb_port_warn(up, "failed to enable lane bonding\n");
-- 
2.40.1


  parent reply	other threads:[~2023-09-11 22:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 10:04 [PATCH 0/5] thunderbolt: Couple of fixes and improvements Mika Westerberg
2023-09-11 10:04 ` [PATCH 1/5] thunderbolt: Workaround an IOMMU fault on certain systems with Intel Maple Ridge Mika Westerberg
2023-09-11 10:04 ` Mika Westerberg [this message]
2023-09-11 10:04 ` [PATCH 3/5] thunderbolt: Correct TMU mode initialization from hardware Mika Westerberg
2023-09-11 10:04 ` [PATCH 4/5] thunderbolt: Apply USB 3.x bandwidth quirk only in software connection manager Mika Westerberg
2023-09-11 10:04 ` [PATCH 5/5] thunderbolt: Restart XDomain discovery handshake after failure Mika Westerberg
2023-09-15 10:10 ` [PATCH 0/5] thunderbolt: Couple of fixes and improvements Mika Westerberg
     [not found]   ` <CANBHt+PT9S59C-4S4riUm03fs2RKGwfVKM6i20=YUN5_-FSnWg@mail.gmail.com>
2023-09-15 11:12     ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230911100445.3612655-3-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=alex@alexbal.com \
    --cc=andreas.noever@gmail.com \
    --cc=calvin.walton@kepstin.ca \
    --cc=dcb314@hotmail.com \
    --cc=kjhambrick@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.com \
    --cc=teslan223@gmail.com \
    --cc=wse@tuxedocomputers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox