From: Sanjay R Mehta <Sanju.Mehta@amd.com>
To: <mika.westerberg@linux.intel.com>, <andreas.noever@gmail.com>,
<michael.jamet@intel.com>, <YehezkelShB@gmail.com>
Cc: <Basavaraj.Natikar@amd.com>, <linux-usb@vger.kernel.org>,
Sanjay R Mehta <sanju.mehta@amd.com>
Subject: [PATCH] thunderbolt: Disable CLx state for AMD Yellow Carp and Pink Sardine
Date: Fri, 10 Feb 2023 07:32:23 -0600 [thread overview]
Message-ID: <1676035943-115840-1-git-send-email-Sanju.Mehta@amd.com> (raw)
From: Sanjay R Mehta <sanju.mehta@amd.com>
AMD Yellow Carp and Pink Sardine don't support CLx state,
hence disabling it.
Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/thunderbolt/nhi.h | 6 ++++++
drivers/thunderbolt/switch.c | 6 ++++++
drivers/thunderbolt/tb.h | 24 ++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
index b071802..3d8cfaf 100644
--- a/drivers/thunderbolt/nhi.h
+++ b/drivers/thunderbolt/nhi.h
@@ -87,6 +87,12 @@ extern const struct tb_nhi_ops icl_nhi_ops;
#define PCI_DEVICE_ID_INTEL_RPL_NHI0 0xa73e
#define PCI_DEVICE_ID_INTEL_RPL_NHI1 0xa76d
+/* PCI IDs for AMD USB4 controllers */
+#define PCI_DEVICE_ID_AMD_YELLOW_CARP_NHI0 0x162e
+#define PCI_DEVICE_ID_AMD_YELLOW_CARP_NHI1 0x162f
+#define PCI_DEVICE_ID_AMD_PINK_SARDINE_NHI0 0x1668
+#define PCI_DEVICE_ID_AMD_PINK_SARDINE_NHI1 0x1669
+
#define PCI_CLASS_SERIAL_USB_USB4 0x0c0340
#endif
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 363d712..93e4788 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -3574,6 +3574,12 @@ int tb_switch_enable_clx(struct tb_switch *sw, enum tb_clx clx)
if (root_sw->generation < 4 || tb_switch_is_tiger_lake(root_sw))
return 0;
+ /*
+ * Disabling CLx by default on AMD USB4 platforms for Yellow Carp and Pink Sardine.
+ */
+ if (tb_switch_is_yellow_carp(sw->tb->nhi) || tb_switch_is_pink_sardine(sw->tb->nhi))
+ return 0;
+
switch (clx) {
case TB_CL1:
/* CL0s and CL1 are enabled and supported together */
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index f978697..c63a023 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -905,6 +905,30 @@ static inline bool tb_switch_is_tiger_lake(const struct tb_switch *sw)
return false;
}
+static inline bool tb_switch_is_yellow_carp(const struct tb_nhi *nhi)
+{
+ if (nhi->pdev->vendor == PCI_VENDOR_ID_AMD) {
+ switch (nhi->pdev->device) {
+ case PCI_DEVICE_ID_AMD_YELLOW_CARP_NHI0:
+ case PCI_DEVICE_ID_AMD_YELLOW_CARP_NHI1:
+ return true;
+ }
+ }
+ return false;
+}
+
+static inline bool tb_switch_is_pink_sardine(const struct tb_nhi *nhi)
+{
+ if (nhi->pdev->vendor == PCI_VENDOR_ID_AMD) {
+ switch (nhi->pdev->device) {
+ case PCI_DEVICE_ID_AMD_PINK_SARDINE_NHI0:
+ case PCI_DEVICE_ID_AMD_PINK_SARDINE_NHI1:
+ return true;
+ }
+ }
+ return false;
+}
+
/**
* tb_switch_is_usb4() - Is the switch USB4 compliant
* @sw: Switch to check
--
2.7.4
next reply other threads:[~2023-02-10 13:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 13:32 Sanjay R Mehta [this message]
2023-02-10 13:55 ` [PATCH] thunderbolt: Disable CLx state for AMD Yellow Carp and Pink Sardine Mika Westerberg
2023-02-10 14:02 ` Sanjay R Mehta
2023-02-10 14:17 ` Mika Westerberg
2023-02-10 14:46 ` Sanjay R Mehta
2023-02-10 14:56 ` 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=1676035943-115840-1-git-send-email-Sanju.Mehta@amd.com \
--to=sanju.mehta@amd.com \
--cc=Basavaraj.Natikar@amd.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--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