Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3515878ybz; Mon, 4 May 2020 04:38:24 -0700 (PDT) X-Google-Smtp-Source: APiQypLVB4AaqE4ISJMYoddRi1UosnLEGU5ox/P2bLxSftPQ3DWwlDrU+4WuReZqj+otocR2+VH8 X-Received: by 2002:a17:907:2719:: with SMTP id w25mr14563900ejk.107.1588592304444; Mon, 04 May 2020 04:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588592304; cv=none; d=google.com; s=arc-20160816; b=Tx7Au7hYW5wYYbkYltVtR4GHniKnDd5HRaczn/fjtg79+2R2F4O/uYgE2Wf35XKdvy 9OlM2wSwE2CcRDGzTFYxYa0nqmZBh04U0Wt8Foqn61RhiGBUVxng9ZBsV8LJaFH0Rak9 2jvfme8g1NHUiyoxyBuV0NhkvLKPKLsxw1CcStyx+V19G/SudJlpqk+0XiAtWaNtELBB BYc69fJJSCs/VhTBgXAXKQdpLT84bnWJp293r+PMO0YHCp7jdQ/A4U71VSAHCwz6YBlT wZJZsmJA5X/l9NHNhXlYD1BvNYkmQn9YFaxwwaNrSXnCW4xXcZqlqNil050nrVeziJVr ULTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=JFMkcVTcHcD3ECidwUJRNXodc28hl/GVxIAjcHgz+4c=; b=ciXMFLN9k3UNi15Ej++CY6Fs0W6gVUMAtRgmw5TtixVUNq2fhBNTKsOv8W37hwqJqH Fwk3vhtAUbbdtvlJhxzi6TX+6gwWr++Qu3fSCZdKSH2hjYULKlaACE12CpdM9ByZubO6 AwqIV27DchWPeFi7+kMw7icglAuBe9Wnn/Q9jioRAAiaRwgSxjjAKWRP/wseJedAu5Lq oH/P85qDWZQY12GkBhdkAsuPSfJtjGmX3pD/xtP4uv1aqfEEkBya5+A//JjR5ew1+t/t IwpZnT/Ufonh6lVk/dGjU7os+QhkowylK5lYJWnjmFVj3V3UAE09Kb2Rqw6713YADijW RrCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si6354237edh.267.2020.05.04.04.38.00; Mon, 04 May 2020 04:38:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728562AbgEDLgc (ORCPT + 99 others); Mon, 4 May 2020 07:36:32 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:34221 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726445AbgEDLgb (ORCPT ); Mon, 4 May 2020 07:36:31 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jVZOd-000222-Pc; Mon, 04 May 2020 11:36:28 +0000 From: Kai-Heng Feng To: mathias.nyman@intel.com Cc: Kai-Heng Feng , Greg Kroah-Hartman , linux-usb@vger.kernel.org (open list:USB XHCI DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2] xhci: Prevent runtime suspend on Etron EJ168 Date: Mon, 4 May 2020 19:36:22 +0800 Message-Id: <20200504113622.20361-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Etron EJ168 USB 3.0 Host Controller stops working after S3, if it was runtime suspended previously: [ 370.080359] pci 0000:02:00.0: can't change power state from D3cold to D0 (config space inaccessible) [ 370.080477] xhci_hcd 0000:04:00.0: can't change power state from D3cold to D0 (config space inaccessible) [ 370.080532] pcieport 0000:00:1c.0: DPC: containment event, status:0x1f05 source:0x0200 [ 370.080533] pcieport 0000:00:1c.0: DPC: ERR_FATAL detected [ 370.080536] xhci_hcd 0000:04:00.0: can't change power state from D3hot to D0 (config space inaccessible) [ 370.080552] xhci_hcd 0000:04:00.0: AER: can't recover (no error_detected callback) [ 370.080566] usb usb3: root hub lost power or was reset [ 370.080566] usb usb4: root hub lost power or was reset [ 370.080572] xhci_hcd 0000:04:00.0: Host halt failed, -19 [ 370.080574] xhci_hcd 0000:04:00.0: Host not accessible, reset failed. [ 370.080575] xhci_hcd 0000:04:00.0: PCI post-resume error -19! [ 370.080586] xhci_hcd 0000:04:00.0: HC died; cleaning up This can be fixed by not runtime suspend the controller at all. So disable runtime suspend for EJ168 xHCI device. Signed-off-by: Kai-Heng Feng --- v2: - Use a new quirk to avoid changing existing behavior. drivers/usb/host/xhci-pci.c | 4 +++- drivers/usb/host/xhci.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 766b74723e64..1658fa4c3e4e 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -227,6 +227,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |= XHCI_RESET_ON_RESUME; xhci->quirks |= XHCI_TRUST_TX_LENGTH; xhci->quirks |= XHCI_BROKEN_STREAMS; + xhci->quirks |= XHCI_DISABLE_RUNTIME_SUSPEND; } if (pdev->vendor == PCI_VENDOR_ID_RENESAS && pdev->device == 0x0014) { @@ -371,7 +372,8 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) xhci->shared_hcd->can_do_streams = 1; /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */ - pm_runtime_put_noidle(&dev->dev); + if (!(xhci->quirks & XHCI_DISABLE_RUNTIME_SUSPEND)) + pm_runtime_put_noidle(&dev->dev); if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW) pm_runtime_allow(&dev->dev); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 86cfefdd6632..d9c209a10d3f 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1873,6 +1873,7 @@ struct xhci_hcd { #define XHCI_DEFAULT_PM_RUNTIME_ALLOW BIT_ULL(33) #define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34) #define XHCI_SNPS_BROKEN_SUSPEND BIT_ULL(35) +#define XHCI_DISABLE_RUNTIME_SUSPEND BIT_ULL(36) unsigned int num_active_eps; unsigned int limit_active_eps; -- 2.17.1