From patchwork Tue Dec 5 16:22:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 844851 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yrn9G1Tzzz9t9v for ; Wed, 6 Dec 2017 03:23:14 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752415AbdLEQW6 (ORCPT ); Tue, 5 Dec 2017 11:22:58 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:43795 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752242AbdLEQW5 (ORCPT ); Tue, 5 Dec 2017 11:22:57 -0500 Received: from 114-32-108-117.hinet-ip.hinet.net ([114.32.108.117] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1eMFzi-0000tc-Eg; Tue, 05 Dec 2017 16:22:55 +0000 From: Kai-Heng Feng To: mathias.nyman@intel.com Cc: bhelgaas@google.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kai-Heng Feng , Joe Lee Subject: [PATCH] xhci: Fix front USB ports on ASUS PRIME B350M-A Date: Wed, 6 Dec 2017 00:22:42 +0800 Message-Id: <20171205162242.4057-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.14.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The board in question has three XHCI HCs: 02:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] USB 3.1 XHCI Controller [1022:43bb] (rev 02) 04:00.0 USB controller [0c03]: ASMedia Technology Inc. Device [1b21:1343] 0a:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] USB3 Host Controller [1022:145c] The front ports are connected to HC [1022:43bb] (02:00.0). After plugging high speed devices into front ports several times, it stops responding to high speed devices. Super speed devices can still get detected though. When I plugged a high speed device, [1b21:1343] (04:00.0) also got woke up: [ 140.834823] xhci_hcd 0000:02:00.0: // Setting command ring address to 0xff73b001 [ 140.838220] xhci_hcd 0000:02:00.0: xhci_resume: starting port polling. [ 140.838226] xhci_hcd 0000:02:00.0: xhci_hub_status_data: stopping port polling. [ 140.838266] xhci_hcd 0000:02:00.0: xhci_suspend: stopping port polling. [ 140.838362] xhci_hcd 0000:02:00.0: // Setting command ring address to 0xff73b001 [ 140.858908] xhci_hcd 0000:04:00.0: // Setting command ring address to 0xfffd9001 [ 140.862745] xhci_hcd 0000:04:00.0: xhci_resume: starting port polling. [ 140.862754] xhci_hcd 0000:04:00.0: xhci_hub_status_data: stopping port polling. [ 140.862760] xhci_hcd 0000:04:00.0: xhci_hub_status_data: stopping port polling. [ 140.862787] xhci_hcd 0000:04:00.0: xhci_suspend: stopping port polling. [ 140.862811] xhci_hcd 0000:04:00.0: // Setting command ring address to 0xfffd9001 Seems like [1022:43bb] is wired to [1b21:1343] internally. Both HCs support D3hot PME, so I tried to disable D3cold on them. Turns out disable D3cold on [1b21:1343] (04:00.0) can workaround the issue for [1022:43bb] (02:00.0). Also, [1022:43bb] (02:00.0) sometimes failed to suspend: [ 549.114587] xhci_hcd 0000:02:00.0: WARN: xHC CMD_RUN timeout [ 549.114608] suspend_common(): xhci_pci_suspend+0x0/0xc0 returns -110 [ 549.114638] xhci_hcd 0000:02:00.0: can't suspend (hcd_pci_runtime_suspend returned -110) [ 549.116744] usb usb3: root hub lost power or was reset [ 549.116746] usb usb4: root hub lost power or was reset Based on previous guesswork, the issue can be workaround by doing PCI reset on [1b21:1343] (04:00.0). Cc: Joe Lee Signed-off-by: Kai-Heng Feng --- drivers/pci/quirks.c | 2 ++ drivers/usb/host/pci-quirks.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 10684b17d0bd..380061dae51d 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1699,6 +1699,8 @@ static void quirk_radeon_pm(struct pci_dev *dev) } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6741, quirk_radeon_pm); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x1343, pci_d3cold_disable); + #ifdef CONFIG_X86_IO_APIC static int dmi_disable_ioapicreroute(const struct dmi_system_id *d) { diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 161536717025..8c4318671e37 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -1176,6 +1176,9 @@ bool usb_xhci_needs_pci_reset(struct pci_dev *pdev) (pdev->device == 0x0014 || pdev->device == 0x0015)) return true; + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && pdev->device == 0x1343) + return true; + return false; } EXPORT_SYMBOL_GPL(usb_xhci_needs_pci_reset);