From: Sanath S <Sanath.S@amd.com>
To: <mario.limonciello@amd.com>, <andreas.noever@gmail.com>,
<michael.jamet@intel.com>, <mika.westerberg@linux.intel.com>,
<YehezkelShB@gmail.com>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: Sanath S <Sanath.S@amd.com>
Subject: [Patch v3 4/4] thunderbolt: Teardown tunnels and reset downstream ports created by boot firmware
Date: Sat, 6 Jan 2024 22:27:23 +0530 [thread overview]
Message-ID: <20240106165723.3377789-5-Sanath.S@amd.com> (raw)
In-Reply-To: <20240106165723.3377789-1-Sanath.S@amd.com>
Boot firmware might have created tunnels of its own. Since we cannot
be sure they are usable for us. Tear them down and reset the ports
to handle it as a new hotplug for USB4 v1 routers.
Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Sanath S <Sanath.S@amd.com>
---
drivers/thunderbolt/tb.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 740bf2ff1fcd..462616e3075c 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -2596,12 +2596,27 @@ static int tb_start(struct tb *tb, bool reset)
tb_switch_tmu_configure(tb->root_switch, TB_SWITCH_TMU_MODE_LOWRES);
/* Enable TMU if it is off */
tb_switch_tmu_enable(tb->root_switch);
- /* Full scan to discover devices added before the driver was loaded. */
- tb_scan_switch(tb->root_switch);
- /* Find out tunnels created by the boot firmware */
- tb_discover_tunnels(tb);
- /* Add DP resources from the DP tunnels created by the boot firmware */
- tb_discover_dp_resources(tb);
+
+ /*
+ * Boot firmware might have created tunnels of its own. Since we cannot
+ * be sure they are usable for us, Tear them down and reset the ports
+ * to handle it as new hotplug for USB4 routers.
+ */
+ if (reset && usb4_switch_version(tb->root_switch) == 1) {
+ ret = tb_switch_reset(tb->root_switch);
+ if (ret) {
+ tb_sw_warn(tb->root_switch, "failed to reset\n");
+ return ret;
+ }
+ } else {
+ /* Full scan to discover devices added before the driver was loaded. */
+ tb_scan_switch(tb->root_switch);
+ /* Find out tunnels created by the boot firmware */
+ tb_discover_tunnels(tb);
+ /* Add DP resources from the DP tunnels created by the boot firmware */
+ tb_discover_dp_resources(tb);
+ }
+
/*
* If the boot firmware did not create USB 3.x tunnels create them
* now for the whole topology.
--
2.34.1
next prev parent reply other threads:[~2024-01-06 16:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-06 16:57 [Patch v3 0/4] Add support for downstream port reset(DPR) Sanath S
2024-01-06 16:57 ` [Patch v3 1/4] thunderbolt: Introduce usb4_port_reset() and tb_lc_reset_port() Sanath S
2024-01-06 16:57 ` [Patch v3 2/4] thunderbolt: Extend tb_switch_reset() to support lane and protocol adapter reset Sanath S
2024-01-06 16:57 ` [Patch v3 3/4] thunderbolt: Store host router reset status in nhi_probe() Sanath S
2024-01-06 16:57 ` Sanath S [this message]
2024-01-10 14:31 ` [Patch v3 0/4] Add support for downstream port reset(DPR) Mika Westerberg
2024-01-10 15:29 ` Sanath S
2024-01-22 11:27 ` 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=20240106165723.3377789-5-Sanath.S@amd.com \
--to=sanath.s@amd.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=michael.jamet@intel.com \
--cc=mika.westerberg@linux.intel.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
all inboxes | Powered by JetHome®