Re: [PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
On 07.03.2018 08:09, Kai Heng Feng wrote: Hi Matthias, Do you have any concern about this patch? Adding patch and sending forward Thanks -Mathias
Re: [PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
On 07.03.2018 08:09, Kai Heng Feng wrote: Hi Matthias, Do you have any concern about this patch? Adding patch and sending forward Thanks -Mathias
Re: [PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
Hi Matthias, Do you have any concern about this patch? Hopefully this can get merged for v4.16… Kai-Heng
Re: [PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
Hi Matthias, Do you have any concern about this patch? Hopefully this can get merged for v4.16… Kai-Heng
Re: [PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
> On 20 Feb 2018, at 4:24 PM, Mathias Nyman> wrote: > > Hi > > On 19.02.2018 21:06, Kai-Heng Feng wrote: >> When a USB device gets plugged on ASUS PRIME B350M-A's front ports, the >> xHC stops working: >> [ 549.114587] xhci_hcd :02:00.0: WARN: xHC CMD_RUN timeout >> [ 549.114608] suspend_common(): xhci_pci_suspend+0x0/0xc0 returns -110 >> [ 549.114638] xhci_hcd :02:00.0: can't suspend (hcd_pci_runtime_suspend >> returned -110) > > Is the xhci runtime suspend something that you expected here? > I mean was the plugged device first enumerated normally, driver bound, > inactive and runtime suspended > first? I guess this is how it behaves, here’s the log after a device gets plugged: [ 7535.716578] xhci_hcd :02:00.0: // Setting command ring address to 0xff86c001 [ 7535.720107] xhci_hcd :02:00.0: xhci_resume: starting port polling. [ 7535.720114] xhci_hcd :02:00.0: xhci_hub_status_data: stopping port polling. [ 7535.720134] xhci_hcd :02:00.0: xhci_suspend: stopping port polling. [ 7535.720190] xhci_hcd :02:00.0: Port Status Change Event for port 8 [ 7535.720194] xhci_hcd :02:00.0: resume root hub [ 7535.720201] xhci_hcd :02:00.0: handle_port_status: starting port polling. [ 7535.721675] xhci_hcd :02:00.0: // Setting command ring address to 0xff86c001 [ 7535.722106] xhci_hcd :02:00.0: // Setting command ring address to 0xff86c001 [ 7535.725538] xhci_hcd :02:00.0: xhci_resume: starting port polling. So the xHC resumes and suspends, then resume again. [ 7535.725543] xhci_hcd :02:00.0: xhci_hub_status_data: stopping port polling. [ 7535.725587] xhci_hcd :02:00.0: get port status, actual port 0 status = 0x2a0 [ 7535.725590] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725606] xhci_hcd :02:00.0: get port status, actual port 1 status = 0x2a0 [ 7535.725608] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725616] xhci_hcd :02:00.0: get port status, actual port 2 status = 0x2a0 [ 7535.725618] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725625] xhci_hcd :02:00.0: get port status, actual port 3 status = 0x202e1 [ 7535.725627] xhci_hcd :02:00.0: Get port status returned 0x10101 [ 7535.725632] xhci_hcd :02:00.0: Port Status Change Event for port 8 [ 7535.725636] xhci_hcd :02:00.0: handle_port_status: starting port polling. [ 7535.725656] xhci_hcd :02:00.0: clear port connect change, actual port 3 status = 0x2e1 [ 7535.725663] xhci_hcd :02:00.0: get port status, actual port 4 status = 0x2a0 [ 7535.725665] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725672] xhci_hcd :02:00.0: get port status, actual port 5 status = 0x2a0 [ 7535.725674] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725680] xhci_hcd :02:00.0: get port status, actual port 6 status = 0x2a0 [ 7535.725682] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725689] xhci_hcd :02:00.0: get port status, actual port 7 status = 0x2a0 [ 7535.725691] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725698] xhci_hcd :02:00.0: get port status, actual port 8 status = 0x2a0 [ 7535.725699] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725706] xhci_hcd :02:00.0: get port status, actual port 9 status = 0x2a0 [ 7535.725708] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.736165] xhci_hcd :04:00.0: // Setting command ring address to 0xfff58001 [ 7535.740033] xhci_hcd :04:00.0: xhci_resume: starting port polling. [ 7535.740040] xhci_hcd :04:00.0: xhci_hub_status_data: stopping port polling. [ 7535.740047] xhci_hcd :04:00.0: xhci_hub_status_data: stopping port polling. [ 7535.740133] xhci_hcd :04:00.0: xhci_suspend: stopping port polling. [ 7535.740161] xhci_hcd :04:00.0: // Setting command ring address to 0xfff58001 This is the “other” xHC that I mentioned in patch v1. It provides USB 3.1 capabilities to front USB port. [ 7535.776003] xhci_hcd :02:00.0: xhci_hub_status_data: stopping port polling. [ 7535.832028] xhci_hcd :02:00.0: get port status, actual port 3 status = 0x2e1 [ 7535.832031] xhci_hcd :02:00.0: Get port status returned 0x101 [ 7535.832051] xhci_hcd :02:00.0: // Ding dong! [ 7535.832150] xhci_hcd :02:00.0: Slot 3 output ctx = 0xff125000 (dma) [ 7535.832153] xhci_hcd :02:00.0: Slot 3 input ctx = 0xff16c000 (dma) [ 7535.832160] xhci_hcd :02:00.0: Set slot id 3 dcbaa entry 0bd2158a to 0xff125000 [ 7535.832189] xhci_hcd :02:00.0: set port reset, actual port 3 status = 0x2e1 [ 7535.835982] xhci_hcd :02:00.0: xhci_hub_status_data: stopping port polling. [ 7535.892049] xhci_hcd :02:00.0: Port Status Change Event for port 8 [ 7535.892056] xhci_hcd :02:00.0: handle_port_status: starting port polling. [ 7535.900058] xhci_hcd :02:00.0: get port status, actual port 3 status =
Re: [PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
> On 20 Feb 2018, at 4:24 PM, Mathias Nyman > wrote: > > Hi > > On 19.02.2018 21:06, Kai-Heng Feng wrote: >> When a USB device gets plugged on ASUS PRIME B350M-A's front ports, the >> xHC stops working: >> [ 549.114587] xhci_hcd :02:00.0: WARN: xHC CMD_RUN timeout >> [ 549.114608] suspend_common(): xhci_pci_suspend+0x0/0xc0 returns -110 >> [ 549.114638] xhci_hcd :02:00.0: can't suspend (hcd_pci_runtime_suspend >> returned -110) > > Is the xhci runtime suspend something that you expected here? > I mean was the plugged device first enumerated normally, driver bound, > inactive and runtime suspended > first? I guess this is how it behaves, here’s the log after a device gets plugged: [ 7535.716578] xhci_hcd :02:00.0: // Setting command ring address to 0xff86c001 [ 7535.720107] xhci_hcd :02:00.0: xhci_resume: starting port polling. [ 7535.720114] xhci_hcd :02:00.0: xhci_hub_status_data: stopping port polling. [ 7535.720134] xhci_hcd :02:00.0: xhci_suspend: stopping port polling. [ 7535.720190] xhci_hcd :02:00.0: Port Status Change Event for port 8 [ 7535.720194] xhci_hcd :02:00.0: resume root hub [ 7535.720201] xhci_hcd :02:00.0: handle_port_status: starting port polling. [ 7535.721675] xhci_hcd :02:00.0: // Setting command ring address to 0xff86c001 [ 7535.722106] xhci_hcd :02:00.0: // Setting command ring address to 0xff86c001 [ 7535.725538] xhci_hcd :02:00.0: xhci_resume: starting port polling. So the xHC resumes and suspends, then resume again. [ 7535.725543] xhci_hcd :02:00.0: xhci_hub_status_data: stopping port polling. [ 7535.725587] xhci_hcd :02:00.0: get port status, actual port 0 status = 0x2a0 [ 7535.725590] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725606] xhci_hcd :02:00.0: get port status, actual port 1 status = 0x2a0 [ 7535.725608] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725616] xhci_hcd :02:00.0: get port status, actual port 2 status = 0x2a0 [ 7535.725618] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725625] xhci_hcd :02:00.0: get port status, actual port 3 status = 0x202e1 [ 7535.725627] xhci_hcd :02:00.0: Get port status returned 0x10101 [ 7535.725632] xhci_hcd :02:00.0: Port Status Change Event for port 8 [ 7535.725636] xhci_hcd :02:00.0: handle_port_status: starting port polling. [ 7535.725656] xhci_hcd :02:00.0: clear port connect change, actual port 3 status = 0x2e1 [ 7535.725663] xhci_hcd :02:00.0: get port status, actual port 4 status = 0x2a0 [ 7535.725665] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725672] xhci_hcd :02:00.0: get port status, actual port 5 status = 0x2a0 [ 7535.725674] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725680] xhci_hcd :02:00.0: get port status, actual port 6 status = 0x2a0 [ 7535.725682] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725689] xhci_hcd :02:00.0: get port status, actual port 7 status = 0x2a0 [ 7535.725691] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725698] xhci_hcd :02:00.0: get port status, actual port 8 status = 0x2a0 [ 7535.725699] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.725706] xhci_hcd :02:00.0: get port status, actual port 9 status = 0x2a0 [ 7535.725708] xhci_hcd :02:00.0: Get port status returned 0x100 [ 7535.736165] xhci_hcd :04:00.0: // Setting command ring address to 0xfff58001 [ 7535.740033] xhci_hcd :04:00.0: xhci_resume: starting port polling. [ 7535.740040] xhci_hcd :04:00.0: xhci_hub_status_data: stopping port polling. [ 7535.740047] xhci_hcd :04:00.0: xhci_hub_status_data: stopping port polling. [ 7535.740133] xhci_hcd :04:00.0: xhci_suspend: stopping port polling. [ 7535.740161] xhci_hcd :04:00.0: // Setting command ring address to 0xfff58001 This is the “other” xHC that I mentioned in patch v1. It provides USB 3.1 capabilities to front USB port. [ 7535.776003] xhci_hcd :02:00.0: xhci_hub_status_data: stopping port polling. [ 7535.832028] xhci_hcd :02:00.0: get port status, actual port 3 status = 0x2e1 [ 7535.832031] xhci_hcd :02:00.0: Get port status returned 0x101 [ 7535.832051] xhci_hcd :02:00.0: // Ding dong! [ 7535.832150] xhci_hcd :02:00.0: Slot 3 output ctx = 0xff125000 (dma) [ 7535.832153] xhci_hcd :02:00.0: Slot 3 input ctx = 0xff16c000 (dma) [ 7535.832160] xhci_hcd :02:00.0: Set slot id 3 dcbaa entry 0bd2158a to 0xff125000 [ 7535.832189] xhci_hcd :02:00.0: set port reset, actual port 3 status = 0x2e1 [ 7535.835982] xhci_hcd :02:00.0: xhci_hub_status_data: stopping port polling. [ 7535.892049] xhci_hcd :02:00.0: Port Status Change Event for port 8 [ 7535.892056] xhci_hcd :02:00.0: handle_port_status: starting port polling. [ 7535.900058] xhci_hcd :02:00.0: get port status, actual port 3 status = 0x200e03 [ 7535.900061] xhci_hcd
Re: [PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
Hi On 19.02.2018 21:06, Kai-Heng Feng wrote: When a USB device gets plugged on ASUS PRIME B350M-A's front ports, the xHC stops working: [ 549.114587] xhci_hcd :02:00.0: WARN: xHC CMD_RUN timeout [ 549.114608] suspend_common(): xhci_pci_suspend+0x0/0xc0 returns -110 [ 549.114638] xhci_hcd :02:00.0: can't suspend (hcd_pci_runtime_suspend returned -110) Is the xhci runtime suspend something that you expected here? I mean was the plugged device first enumerated normally, driver bound, inactive and runtime suspended first? Delay before running xHC command CMD_RUN can workaround the issue. Use a new quirk to make the delay only targets to the affected xHC. Is this some known issue with this chip, or something figured out by trial and error? Signed-off-by: Kai-Heng FengThanks, otherwise workaround seems fine, just curious about the two details above -Mathias
Re: [PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
Hi On 19.02.2018 21:06, Kai-Heng Feng wrote: When a USB device gets plugged on ASUS PRIME B350M-A's front ports, the xHC stops working: [ 549.114587] xhci_hcd :02:00.0: WARN: xHC CMD_RUN timeout [ 549.114608] suspend_common(): xhci_pci_suspend+0x0/0xc0 returns -110 [ 549.114638] xhci_hcd :02:00.0: can't suspend (hcd_pci_runtime_suspend returned -110) Is the xhci runtime suspend something that you expected here? I mean was the plugged device first enumerated normally, driver bound, inactive and runtime suspended first? Delay before running xHC command CMD_RUN can workaround the issue. Use a new quirk to make the delay only targets to the affected xHC. Is this some known issue with this chip, or something figured out by trial and error? Signed-off-by: Kai-Heng Feng Thanks, otherwise workaround seems fine, just curious about the two details above -Mathias
[PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
When a USB device gets plugged on ASUS PRIME B350M-A's front ports, the xHC stops working: [ 549.114587] xhci_hcd :02:00.0: WARN: xHC CMD_RUN timeout [ 549.114608] suspend_common(): xhci_pci_suspend+0x0/0xc0 returns -110 [ 549.114638] xhci_hcd :02:00.0: can't suspend (hcd_pci_runtime_suspend returned -110) Delay before running xHC command CMD_RUN can workaround the issue. Use a new quirk to make the delay only targets to the affected xHC. Signed-off-by: Kai-Heng Feng--- v2: Instead of doing xHC reset and disabling D3cold, a simple delay can workaround the issue. Now both high-speed and super-speed devices work fine with the v2 quirk. drivers/usb/host/xhci-pci.c | 3 +++ drivers/usb/host/xhci.c | 3 +++ drivers/usb/host/xhci.h | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 6c79037876db..9a820b3cae56 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -122,6 +122,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) xhci->quirks |= XHCI_AMD_PLL_FIX; + if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43bb) + xhci->quirks |= XHCI_SUSPEND_DELAY; + if (pdev->vendor == PCI_VENDOR_ID_AMD) xhci->quirks |= XHCI_TRUST_TX_LENGTH; diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 1eeb3396300f..d554bbd694d3 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -878,6 +878,9 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) clear_bit(HCD_FLAG_POLL_RH, >shared_hcd->flags); del_timer_sync(>shared_hcd->rh_timer); + if (xhci->quirks & XHCI_SUSPEND_DELAY) + usleep_range(1000, 1500); + spin_lock_irq(>lock); clear_bit(HCD_FLAG_HW_ACCESSIBLE, >flags); clear_bit(HCD_FLAG_HW_ACCESSIBLE, >shared_hcd->flags); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 96099a245c69..6f1f52f3cb40 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1825,6 +1825,7 @@ struct xhci_hcd { /* Reserved. It was XHCI_U2_DISABLE_WAKE */ #define XHCI_ASMEDIA_MODIFY_FLOWCONTROL(1 << 28) #define XHCI_HW_LPM_DISABLE(1 << 29) +#define XHCI_SUSPEND_DELAY (1 << 30) unsigned intnum_active_eps; unsigned intlimit_active_eps; -- 2.15.1
[PATCH v2] xhci: Fix front USB ports on ASUS PRIME B350M-A
When a USB device gets plugged on ASUS PRIME B350M-A's front ports, the xHC stops working: [ 549.114587] xhci_hcd :02:00.0: WARN: xHC CMD_RUN timeout [ 549.114608] suspend_common(): xhci_pci_suspend+0x0/0xc0 returns -110 [ 549.114638] xhci_hcd :02:00.0: can't suspend (hcd_pci_runtime_suspend returned -110) Delay before running xHC command CMD_RUN can workaround the issue. Use a new quirk to make the delay only targets to the affected xHC. Signed-off-by: Kai-Heng Feng --- v2: Instead of doing xHC reset and disabling D3cold, a simple delay can workaround the issue. Now both high-speed and super-speed devices work fine with the v2 quirk. drivers/usb/host/xhci-pci.c | 3 +++ drivers/usb/host/xhci.c | 3 +++ drivers/usb/host/xhci.h | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 6c79037876db..9a820b3cae56 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -122,6 +122,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) xhci->quirks |= XHCI_AMD_PLL_FIX; + if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x43bb) + xhci->quirks |= XHCI_SUSPEND_DELAY; + if (pdev->vendor == PCI_VENDOR_ID_AMD) xhci->quirks |= XHCI_TRUST_TX_LENGTH; diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 1eeb3396300f..d554bbd694d3 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -878,6 +878,9 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) clear_bit(HCD_FLAG_POLL_RH, >shared_hcd->flags); del_timer_sync(>shared_hcd->rh_timer); + if (xhci->quirks & XHCI_SUSPEND_DELAY) + usleep_range(1000, 1500); + spin_lock_irq(>lock); clear_bit(HCD_FLAG_HW_ACCESSIBLE, >flags); clear_bit(HCD_FLAG_HW_ACCESSIBLE, >shared_hcd->flags); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 96099a245c69..6f1f52f3cb40 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1825,6 +1825,7 @@ struct xhci_hcd { /* Reserved. It was XHCI_U2_DISABLE_WAKE */ #define XHCI_ASMEDIA_MODIFY_FLOWCONTROL(1 << 28) #define XHCI_HW_LPM_DISABLE(1 << 29) +#define XHCI_SUSPEND_DELAY (1 << 30) unsigned intnum_active_eps; unsigned intlimit_active_eps; -- 2.15.1