Re: [PATCH 4.19 12/81] usb: xhci: wait for CNR controller not ready bit in xhci resume

From: Pavel Machek
Date: Fri Oct 18 2019 - 13:28:50 EST


Hi!

> From: Rick Tseng <rtseng@xxxxxxxxxx>
>
> commit a70bcbc322837eda1ab5994d12db941dc9733a7d upstream.
>
> NVIDIA 3.1 xHCI card would lose power when moving power state into D3Cold.
> Thus we need to wait for CNR bit to clear in xhci resume, just as in
> xhci init.
...

> @@ -1098,6 +1098,18 @@ int xhci_resume(struct xhci_hcd *xhci, b
> hibernated = true;
>
> if (!hibernated) {
> + /*
> + * Some controllers might lose power during suspend, so wait
> + * for controller not ready bit to clear, just as in xHC init.
> + */
> + retval = xhci_handshake(&xhci->op_regs->status,
> + STS_CNR, 0, 10 * 1000 * 1000);
> + if (retval) {
> + xhci_warn(xhci, "Controller not ready at resume %d\n",
> + retval);
> + spin_unlock_irq(&xhci->lock);
> + return retval;
> + }

AFAICT if this error happens, xhci will be unusable. So maybe print
should be at higher level that warning... that's clearly an error.

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature