Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe190ed0 authored by Joel Stanley's avatar Joel Stanley Committed by Greg Kroah-Hartman
Browse files

xhci: Do not halt the host until both HCD have disconnected their devices.



We can't halt the host controller immediately when first HCD is removed as
it will cause problems if we have devices attached to the second (primary)
HCD, like a keyboard.

We've been carrying this in our Linux-as-a-bootloader environment for a
little while now. The machines all have the same TI TUSB73x0 part,
and when we kexec the devices don't come back until a system power cycle.

[minor adjustments, code comments and remove HALT check  -Mathias]
Signed-off-by: default avatarJoel Stanley <joel@jms.id.au>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b7f769ae
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -692,20 +692,20 @@ void xhci_stop(struct usb_hcd *hcd)

	mutex_lock(&xhci->mutex);

	if (!(xhci->xhc_state & XHCI_STATE_HALTED)) {
		spin_lock_irq(&xhci->lock);
	/* Only halt host and free memory after both hcds are removed */
	if (!usb_hcd_is_primary_hcd(hcd)) {
		/* usb core will free this hcd shortly, unset pointer */
		xhci->shared_hcd = NULL;
		mutex_unlock(&xhci->mutex);
		return;
	}

	spin_lock_irq(&xhci->lock);
	xhci->xhc_state |= XHCI_STATE_HALTED;
	xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
	xhci_halt(xhci);
	xhci_reset(xhci);
	spin_unlock_irq(&xhci->lock);
	}

	if (!usb_hcd_is_primary_hcd(hcd)) {
		mutex_unlock(&xhci->mutex);
		return;
	}

	xhci_cleanup_msix(xhci);