[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <897a7917-5ea6-025b-c516-482188759e0a@intel.com>
Date: Wed, 16 Sep 2020 15:30:11 +0300
From: Mathias Nyman <mathias.nyman@...el.com>
To: Nehal Bakulchandra Shah <Nehal-bakulchandra.Shah@....com>,
gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, Sandeep.Singh@....com,
yuanmei@...ovo.com
Subject: Re: [PATCH] xhci: workaround for S3 issue on AMD SNPS 3.0 xHC
On 31.8.2020 9.52, Nehal Bakulchandra Shah wrote:
> From: Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@....com>
>
> On some platform of AMD, S3 fails with HCE and SRE errors.To fix this,
> sparse controller enable bit has to be disabled.
>
> Signed-off-by: Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@....com>
> ---
> drivers/usb/host/xhci-pci.c | 12 ++++++++++++
> drivers/usb/host/xhci.h | 1 +
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index 3feaafebfe58..865a16e6c1ed 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -160,6 +160,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
> (pdev->device == 0x15e0 || pdev->device == 0x15e1))
> xhci->quirks |= XHCI_SNPS_BROKEN_SUSPEND;
>
> + if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x15e5)
> + xhci->quirks |= XHCI_DISABLE_SPARSE;
> +
> if (pdev->vendor == PCI_VENDOR_ID_AMD)
> xhci->quirks |= XHCI_TRUST_TX_LENGTH;
>
> @@ -371,6 +374,15 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
> /* USB 2.0 roothub is stored in the PCI device now. */
> hcd = dev_get_drvdata(&dev->dev);
> xhci = hcd_to_xhci(hcd);
> +
> + if (xhci->quirks & XHCI_DISABLE_SPARSE) {
> + u32 reg;
> +
> + reg = readl(hcd->regs + 0xC12C);
> + reg &= ~BIT(17);
> + writel(reg, hcd->regs + 0xC12C);
> + }
> +
Is disabling the bit once in probe enough?
xHC will be reset after hibernation as well, does this bit need to be cleared after that?
Also consider turning this into a separate function with a proper description,
see xhci_pme_quirk() for example. Avoids cluttering probe.
Actually if this bit only needs to be cleared once then that function could be called from xhci_pci_setup()
-Mathias
Powered by blists - more mailing lists