44ee7c
From: Gerd Hoffmann <kraxel@redhat.com>
44ee7c
Date: Wed, 21 Oct 2015 09:44:22 +0200
44ee7c
Subject: [PATCH] ehci: clear suspend bit on detach
44ee7c
44ee7c
When a device is detached, clear the suspend bit (PORTSC_SUSPEND)
44ee7c
in the port status register.
44ee7c
44ee7c
The specs are not *that* clear what is supposed to happen in case
44ee7c
a suspended device is unplugged.  But the enable bit (PORTSC_PED)
44ee7c
is cleared, and the specs mention setting suspend with enable being
44ee7c
unset is undefined behavior.  So clearing them both looks reasonable,
44ee7c
and it actually fixes the reported bug.
44ee7c
44ee7c
https://bugzilla.redhat.com/show_bug.cgi?id=1268879
44ee7c
44ee7c
Cc: Hans de Goede <hdegoede@redhat.com>
44ee7c
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
44ee7c
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
44ee7c
Message-id: 1445413462-18004-1-git-send-email-kraxel@redhat.com
44ee7c
(cherry picked from commit cbf82fa01e6fd4ecb234b235b10ffce548154a95)
44ee7c
---
44ee7c
 hw/usb/hcd-ehci.c | 2 +-
44ee7c
 1 file changed, 1 insertion(+), 1 deletion(-)
44ee7c
44ee7c
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
44ee7c
index 2f492d9..d6d7de3 100644
44ee7c
--- a/hw/usb/hcd-ehci.c
44ee7c
+++ b/hw/usb/hcd-ehci.c
44ee7c
@@ -726,7 +726,7 @@ static void ehci_detach(USBPort *port)
44ee7c
     ehci_queues_rip_device(s, port->dev, 0);
44ee7c
     ehci_queues_rip_device(s, port->dev, 1);
44ee7c
 
44ee7c
-    *portsc &= ~(PORTSC_CONNECT|PORTSC_PED);
44ee7c
+    *portsc &= ~(PORTSC_CONNECT|PORTSC_PED|PORTSC_SUSPEND);
44ee7c
     *portsc |= PORTSC_CSC;
44ee7c
 
44ee7c
     ehci_raise_irq(s, USBSTS_PCD);