From: Mario Limonciello <mario.limonciello@amd.com>
To: <mika.westerberg@linux.intel.com>,
Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
"Yehezkel Bernat" <YehezkelShB@gmail.com>
Cc: <Sanju.Mehta@amd.com>,
Mario Limonciello <mario.limonciello@amd.com>,
<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v4 1/3] thunderbolt: Adjust how NVM reading works
Date: Thu, 23 Feb 2023 15:07:41 -0600 [thread overview]
Message-ID: <20230223210743.9819-2-mario.limonciello@amd.com> (raw)
In-Reply-To: <20230223210743.9819-1-mario.limonciello@amd.com>
Some TBT3 devices have a hard time reliably responding to bit banging
requests correctly when connected to AMD USB4 hosts running Linux.
These problems are not reported in any other CM supported on AMD platforms,
and comparing the Windows and Pre-OS implementations the Linux CM is the
only one that utilizes bit banging to access the DROM.
Other CM implementations access the DROM directly from the NVM instead of
bit banging.
Adjust the flow to use this method to fetch the NVM when the downstream
device has an LC that can be used to fetch the UUID later. The bit banging
method will only be used if this has failed or no LC is present.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v3->v4:
* Don't run code for USB4 devices
v2->v3:
* Split out refactor
v1->v2:
* Update commit message to indicate which CMs are tested
* Adjust flow to only fetch DROM from NVM on TBT3 and bit bang on TBT1/2
---
drivers/thunderbolt/eeprom.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c
index c90d22f56d4e..8c9e553e2fca 100644
--- a/drivers/thunderbolt/eeprom.c
+++ b/drivers/thunderbolt/eeprom.c
@@ -640,6 +640,11 @@ int tb_drom_read(struct tb_switch *sw)
return 0;
}
+ /* We can use LC to get UUID later */
+ if (sw->cap_lc && !tb_switch_is_usb4(sw) &&
+ tb_drom_copy_nvm(sw, &size) == 0)
+ goto parse;
+
res = tb_drom_read_n(sw, 14, (u8 *) &size, 2);
if (res)
return res;
--
2.34.1
next prev parent reply other threads:[~2023-02-23 21:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 21:07 [PATCH v4 0/3] Fix problems fetching TBT3 DROM from AMD USB4 routers Mario Limonciello
2023-02-23 21:07 ` Mario Limonciello [this message]
2023-02-23 21:07 ` [PATCH v4 2/3] thunderbolt: use `tb_eeprom_get_drom_offset` to discover DROM offset Mario Limonciello
2023-02-23 21:07 ` [PATCH v4 3/3] thunderbolt: Refactor DROM reading Mario Limonciello
2023-03-06 9:57 ` [PATCH v4 0/3] Fix problems fetching TBT3 DROM from AMD USB4 routers Mika Westerberg
2023-03-06 15:14 ` Limonciello, Mario
2023-03-07 8:18 ` 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=20230223210743.9819-2-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Sanju.Mehta@amd.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--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®