Skip to contentSkip to conversation

usb: host: xhci: wait CNR when doing xhci resume

PATCH In review Rick Tseng 2 participants 2 messages Sep 18, 2019 – Sep 23, 2019

Subsystems (2)
lore
Share & tools
lore

Rick Tseng

author
#0 lore raw

PATCH v3 1/1 usb: host: xhci: wait CNR when doing xhci resume

NVIDIA 3.1 xHCI card would lose power when moving power state into D3Cold. Thus we need to wait CNR bit to clear when xhci resmue as xhci init.

---
 drivers/usb/host/xhci.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/usb/host/xhci.c +11 -0
index 03d1e55..aee1fc5 100644
@@ -1108,6 +1108,17 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 		hibernated = true;
 
 	if (!hibernated) {
+		/* Some xHC would lose power during suspend, so wait for
+		 * controller ready from resume as 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;
+		}
 		/* step 1: restore register */
 		xhci_restore_registers(xhci);
 		/* step 2: initialize command ring buffer */
Signature · 1 line
2.1.4
#1 lore raw
Quoted 4 lines · Rick Tseng

NVIDIA 3.1 xHCI card would lose power when moving power state into D3Cold. Thus we need to wait CNR bit to clear when xhci resmue as xhci init.

Thanks, added to queue.
Did minor changes to commit message and comment

-Mathias