thunderbolt: Add quirk to disable CLx
Subsystems (2)
PATCH v3 1/1 thunderbolt: Add quirk to disable CLx
From: Sanjay R Mehta <[email protected]>
Add QUIRK_NO_CLX to disable the CLx state for hardware which doesn't supports it.
AMD Yellow Carp and Pink Sardine don't support CLx state, hence disabling it using QUIRK_NO_CLX.
--- drivers/thunderbolt/quirks.c | 19 +++++++++++++++++-- drivers/thunderbolt/tb.h | 11 ++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-)
drivers/thunderbolt/quirks.c +17 -2
@@ -20,6 +20,11 @@ static void quirk_dp_credit_allocation(struct tb_switch *sw) } } +static void quirk_clx_disable (struct tb_switch *sw) +{ + sw->quirks |=QUIRK_NO_CLX ; +} +struct tb_quirk {u16 hw_vendor_id;u16 hw_device_id;
@@ -37,6 +42,13 @@ static const struct tb_quirk tb_quirks[] = {* DP buffers. */ { 0x8087, 0x0b26, 0x0000, 0x0000, quirk_dp_credit_allocation }, +/* +* CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms. +*/ + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x162e, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x162f, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x1668, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x1669, quirk_clx_disable }, };/**
@@ -47,6 +59,7 @@ static const struct tb_quirk tb_quirks[] = {*/ void tb_check_quirks (struct tb_switch *sw) { +struct tb_nhi *nhi = sw->tb->nhi;int i;for (i =0 ; i <ARRAY_SIZE (tb_quirks); i++) {
@@ -56,9 +69,11 @@ void tb_check_quirks(struct tb_switch *sw)continue ;if (q->hw_device_id && q->hw_device_id != sw->config.device_id)continue ; -if (q->vendor && q->vendor != sw->vendor) +if (q->vendor && (q->vendor != sw->vendor && + q->vendor != nhi->pdev->vendor))continue ; -if (q->device && q->device != sw->device) +if (q->device && (q->device != sw->device && + q->device != nhi->pdev->device))continue ; q->hook (sw);
drivers/thunderbolt/tb.h +8 -3
@@ -23,6 +23,11 @@#define NVM_MAX_SIZE SZ_512K#define NVM_DATA_DWORDS 16 +/* Keep link controller awake during update */ +#define QUIRK_FORCE_POWER_LINK_CONTROLLER BIT(0) +/* Disable CLx if not supported */ +#define QUIRK_NO_CLX BIT(1) +/** * struct tb_nvm - Structure holding NVM information * @dev: Owner of the NVM
@@ -997,6 +1002,9 @@ static inline bool tb_switch_is_clx_enabled(const struct tb_switch *sw,*/ static inline bool tb_switch_is_clx_supported (const struct tb_switch *sw) { +if (sw->quirks &QUIRK_NO_CLX ) +return false; +return tb_switch_is_usb4 (sw) ||tb_switch_is_titan_ridge (sw); }
@@ -1254,9 +1262,6 @@ struct usb4_port *usb4_port_device_add(struct tb_port *port);void usb4_port_device_remove (struct usb4_port *usb4);int usb4_port_device_resume (struct usb4_port *usb4); -/* Keep link controller awake during update */ -#define QUIRK_FORCE_POWER_LINK_CONTROLLER BIT(0) -void tb_check_quirks (struct tb_switch *sw);#ifdef CONFIG_ACPI
Signature · 1 line
2.7.4
Hi,
Quoted 54 lines · Sanjay R Mehta
From: Sanjay R Mehta <[email protected]>
Add
QUIRK_NO_CLXto disable the CLx state for hardware which doesn't supports it.AMD Yellow Carp and Pink Sardine don't support CLx state, hence disabling it using
QUIRK_NO_CLX.Signed-off-by Sanjay R Mehta <[email protected]>Signed-off-by Basavaraj Natikar <[email protected]>--- drivers/thunderbolt/quirks.c | 19 +++++++++++++++++-- drivers/thunderbolt/tb.h | 11 ++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-)drivers/thunderbolt/quirks.c +13
-0@@ -20,6 +20,11 @@ static void quirk_dp_credit_allocation(struct tb_switch *sw) } } +static void quirk_clx_disable (struct tb_switch *sw) +{ + sw->quirks |=QUIRK_NO_CLX ; +} +struct tb_quirk {u16 hw_vendor_id;u16 hw_device_id;@@ -37,6 +42,13 @@ static const struct tb_quirk tb_quirks[] = {* DP buffers. */ { 0x8087, 0x0b26, 0x0000, 0x0000, quirk_dp_credit_allocation }, +/* +* CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms. +*/ + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x162e, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x162f, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x1668, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x1669, quirk_clx_disable }, };/** @@ -47,6 +59,7 @@ static const struct tb_quirk tb_quirks[] = {*/ void tb_check_quirks (struct tb_switch *sw) { +struct tb_nhi *nhi = sw->tb->nhi;int i;for (i =0 ; i <ARRAY_SIZE (tb_quirks); i++) {
drivers/thunderbolt/quirks.c void tb_check_quirks(struct tb_switch *sw) · line 73
Quoted 6 lines
drivers/thunderbolt/quirks.c +2
-1@@ -56,9 +69,11 @@ void tb_check_quirks(struct tb_switch *sw)continue ;if (q->hw_device_id && q->hw_device_id != sw->config.device_id)continue ; -if (q->vendor && q->vendor != sw->vendor) +if (q->vendor && (q->vendor != sw->vendor && + q->vendor != nhi->pdev->vendor))
Can't you use the router ID here not the NHI PCI ID?
drivers/thunderbolt/quirks.c void tb_check_quirks(struct tb_switch *sw) · line 76
Quoted 4 lines
drivers/thunderbolt/quirks.c +2
-1continue ; -if (q->device && q->device != sw->device) +if (q->device && (q->device != sw->device && + q->device != nhi->pdev->device))
Ditto here.
Quoted 55 lines · Mika Westerberg
Hi,
Quoted 52 lines · Sanjay R Mehta
From: Sanjay R Mehta <[email protected]>
Add
QUIRK_NO_CLXto disable the CLx state for hardware which doesn't supports it.AMD Yellow Carp and Pink Sardine don't support CLx state, hence disabling it using
QUIRK_NO_CLX.Signed-off-by Sanjay R Mehta <[email protected]>Signed-off-by Basavaraj Natikar <[email protected]>--- drivers/thunderbolt/quirks.c | 19 +++++++++++++++++-- drivers/thunderbolt/tb.h | 11 ++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-)drivers/thunderbolt/quirks.c +13
-0@@ -20,6 +20,11 @@ static void quirk_dp_credit_allocation(struct tb_switch *sw) } } +static void quirk_clx_disable (struct tb_switch *sw) +{ + sw->quirks |=QUIRK_NO_CLX ; +} +struct tb_quirk {u16 hw_vendor_id;u16 hw_device_id;@@ -37,6 +42,13 @@ static const struct tb_quirk tb_quirks[] = {* DP buffers. */ { 0x8087, 0x0b26, 0x0000, 0x0000, quirk_dp_credit_allocation }, +/* +* CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms. +*/ + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x162e, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x162f, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x1668, quirk_clx_disable }, + { 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x1669, quirk_clx_disable }, };/** @@ -47,6 +59,7 @@ static const struct tb_quirk tb_quirks[] = {*/ void tb_check_quirks (struct tb_switch *sw) { +struct tb_nhi *nhi = sw->tb->nhi;int i;
Quoted 11 lines
drivers/thunderbolt/quirks.c void tb_check_quirks(struct tb_switch *sw) · line 73
Quoted 8 lines
drivers/thunderbolt/quirks.c +2
-1for (i =0 ; i <ARRAY_SIZE (tb_quirks); i++) {@@ -56,9 +69,11 @@ void tb_check_quirks(struct tb_switch *sw)continue ;if (q->hw_device_id && q->hw_device_id != sw->config.device_id)continue ; -if (q->vendor && q->vendor != sw->vendor) +if (q->vendor && (q->vendor != sw->vendor && + q->vendor != nhi->pdev->vendor))Can't you use the router ID here not the NHI PCI ID?
Thanks Mika. I have changed this as per your suggestion as part V5.
pls ignore v4 as it was sent incorrectly.
Quoted 6 lines
drivers/thunderbolt/quirks.c void tb_check_quirks(struct tb_switch *sw) · line 76
Quoted 4 lines
drivers/thunderbolt/quirks.c +2
-1continue ; -if (q->device && q->device != sw->device) +if (q->device && (q->device != sw->device && + q->device != nhi->pdev->device))Ditto here.