thunderbolt: Disable CLx state for AMD Yellow Carp and Pink Sardine
Subsystems (2)
PATCH v2 1/1 thunderbolt: Disable CLx state for AMD Yellow Carp and Pink Sardine
From: Sanjay R Mehta <[email protected]>
AMD Yellow Carp and Pink Sardine don't support CLx state, hence disabling it.
--- drivers/thunderbolt/nhi.h | 6 ++++++ drivers/thunderbolt/quirks.c | 6 ++++++ drivers/thunderbolt/tb.h | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-)
drivers/thunderbolt/nhi.h +6 -0
@@ -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
drivers/thunderbolt/quirks.c +6 -0
@@ -63,4 +63,10 @@ void tb_check_quirks(struct tb_switch *sw) q->hook (sw); } + +/* +* CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms. +*/ +if (tb_switch_is_yellow_carp (sw->tb->nhi) ||tb_switch_is_pink_sardine (sw->tb->nhi)) + sw->quirks |=QUIRK_NO_CLX ; }
drivers/thunderbolt/tb.h +32 -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
@@ -905,6 +910,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
@@ -997,6 +1026,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 +1286,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
Quoted 35 lines · Sanjay R Mehta
From: Sanjay R Mehta <[email protected]>
AMD Yellow Carp and Pink Sardine don't support CLx state, hence disabling it.
Signed-off-by Sanjay R Mehta <[email protected]>Signed-off-by Basavaraj Natikar <[email protected]>--- drivers/thunderbolt/nhi.h | 6 ++++++ drivers/thunderbolt/quirks.c | 6 ++++++ drivers/thunderbolt/tb.h | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-)drivers/thunderbolt/nhi.h +6
-0@@ -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 drivers/thunderbolt/quirks.c +0
-0
drivers/thunderbolt/quirks.c void tb_check_quirks(struct tb_switch *sw) · line 71
Quoted 9 lines
drivers/thunderbolt/quirks.c +6
-0@@ -63,4 +63,10 @@ void tb_check_quirks(struct tb_switch *sw) q->hook (sw); } + +/* +* CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms. +*/ +if (tb_switch_is_yellow_carp (sw->tb->nhi) ||tb_switch_is_pink_sardine (sw->tb->nhi)) + sw->quirks |=QUIRK_NO_CLX ;
Any particular reason not to use the 'q->hook' approach like the rest of the quirks do?
Quoted 69 lines
drivers/thunderbolt/quirks.c +0
-0}drivers/thunderbolt/tb.h +32
-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 @@ -905,6 +910,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 @@ -997,6 +1026,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 +1286,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
Quoted 39 lines · Mario
Quoted 38 lines · Sanjay R Mehta
From: Sanjay R Mehta <[email protected]>
AMD Yellow Carp and Pink Sardine don't support CLx state, hence disabling it.
Signed-off-by Sanjay R Mehta <[email protected]>Signed-off-by Basavaraj Natikar <[email protected]>---
drivers/thunderbolt/nhi.h | 6 ++++++drivers/thunderbolt/quirks.c| 6 ++++++ drivers/thunderbolt/tb.h | 35 ++++++++++++++++++++++++++++++++---3 files changed, 44 insertions(+), 3 deletions(-)drivers/thunderbolt/nhi.h +0
-0@@ -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 */
drivers/thunderbolt/nhi.h +5
-0+#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#endifdrivers/thunderbolt/quirks.c +3
-0@@ -63,4 +63,10 @@ void tb_check_quirks(struct tb_switch *sw) q->hook(sw); } + + /* +* CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine
Quoted 9 lines
Quoted 5 lines
platforms.
+ */
+ if (tb_switch_is_yellow_carp(sw->tb->nhi)||tb_switch_is_pink_sardine(sw->tb->nhi))
+sw->quirks|=QUIRK_NO_CLX;Any particular reason not to use the '
q->hook' approach like the rest of the quirks do?
Sure will make this change.
Quoted 69 lines
Quoted 68 lines
}
drivers/thunderbolt/tb.h +0
-0@@ -23,6 +23,11 @@ #define NVM_MAX_SIZE SZ_512K #define NVM_DATA_DWORDS 16+/* Keep link controller awake during update */
drivers/thunderbolt/tb.h +4
-0+#define QUIRK_FORCE_POWER_LINK_CONTROLLER BIT(0) +/* Disable CLx if not supported */ +#define QUIRK_NO_CLX BIT(1) +/**
* structtb_nvm- Structure holding NVM information
* @dev: Owner of the NVMdrivers/thunderbolt/tb.h +23
-0@@ -905,6 +910,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
drivers/thunderbolt/tb.h +0
-0@@ -997,6 +1026,9 @@ static inline bool tb_switch_is_clx_enabled(conststruct tb_switch *sw, */ static inline bool
tb_switch_is_clx_supported(const struct tb_switch *sw)
{
+ if (sw->quirks&QUIRK_NO_CLX)
+ return false;
+
returntb_switch_is_usb4(sw)||tb_switch_is_titan_ridge(sw); }
@@ -1254,9 +1286,6 @@ structusb4_port*usb4_port_device_add(structtb_port*port);
voidusb4_port_device_remove(struct usb4_port *usb4);
intusb4_port_device_resume(struct usb4_port *usb4);
-/* Keep link controller awake during update */drivers/thunderbolt/tb.h +0
-2-#define QUIRK_FORCE_POWER_LINK_CONTROLLER BIT(0) -void
tb_check_quirks(struct tb_switch *sw);
#ifdefCONFIG_ACPI
Quoted 35 lines · Sanjay R Mehta
From: Sanjay R Mehta <[email protected]>
AMD Yellow Carp and Pink Sardine don't support CLx state, hence disabling it.
Signed-off-by Sanjay R Mehta <[email protected]>Signed-off-by Basavaraj Natikar <[email protected]>--- drivers/thunderbolt/nhi.h | 6 ++++++ drivers/thunderbolt/quirks.c | 6 ++++++ drivers/thunderbolt/tb.h | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-)drivers/thunderbolt/nhi.h +6
-0@@ -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 drivers/thunderbolt/quirks.c +0
-0
drivers/thunderbolt/quirks.c void tb_check_quirks(struct tb_switch *sw) · line 70
Quoted 8 lines
drivers/thunderbolt/quirks.c +5
-0@@ -63,4 +63,10 @@ void tb_check_quirks(struct tb_switch *sw) q->hook (sw); } + +/* +* CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms. +*/ +if (tb_switch_is_yellow_carp (sw->tb->nhi) ||tb_switch_is_pink_sardine (sw->tb->nhi))
Instead of these, please add them to the tb_quirks[] array.
Quoted 71 lines
drivers/thunderbolt/quirks.c +1
-0+ sw->quirks |=QUIRK_NO_CLX ; }drivers/thunderbolt/tb.h +32
-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 @@ -905,6 +910,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 @@ -997,6 +1026,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 +1286,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
Quoted 37 lines · Mika Westerberg
Quoted 36 lines · Sanjay R Mehta
From: Sanjay R Mehta <[email protected]>
AMD Yellow Carp and Pink Sardine don't support CLx state, hence disabling it.
Signed-off-by Sanjay R Mehta <[email protected]>Signed-off-by Basavaraj Natikar <[email protected]>--- drivers/thunderbolt/nhi.h | 6 ++++++ drivers/thunderbolt/quirks.c | 6 ++++++ drivers/thunderbolt/tb.h | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-)drivers/thunderbolt/nhi.h +6
-0@@ -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 drivers/thunderbolt/quirks.c +0
-0@@ -63,4 +63,10 @@ void tb_check_quirks(struct tb_switch *sw)
Quoted 10 lines
drivers/thunderbolt/quirks.c void tb_check_quirks(struct tb_switch *sw) · line 70
Quoted 7 lines
drivers/thunderbolt/quirks.c +5
-0q->hook (sw); } + +/* +* CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms. +*/ +if (tb_switch_is_yellow_carp (sw->tb->nhi) ||tb_switch_is_pink_sardine (sw->tb->nhi))Instead of these, please add them to the tb_quirks[] array.
Sure will make this change.
Quoted 71 lines
Quoted 71 lines
drivers/thunderbolt/quirks.c +1
-0+ sw->quirks |=QUIRK_NO_CLX ; }drivers/thunderbolt/tb.h +32
-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 @@ -905,6 +910,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 @@ -997,6 +1026,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 +1286,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