Patchwork usb-ehci: Clear the portstatus powner bit on device disconnect

login
register
mail settings
Submitter Hans de Goede
Date Jan. 13, 2012, 1:28 p.m.
Message ID <1326461336-5699-1-git-send-email-hdegoede@redhat.com>
Download mbox | patch
Permalink /patch/135836/
State New
Headers show

Comments

Hans de Goede - Jan. 13, 2012, 1:28 p.m.
According to the EHCI spec port ownerhsip should revert to the EHCI controller
on device disconnect. This fixes the problem of a port getting stuck on USB 1
when using redirection and plugging in a USB 2 device after a USB 1 device
has been redirected.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/usb-ehci.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Gerd Hoffmann - Jan. 23, 2012, 2:51 p.m.
On 01/13/12 14:28, Hans de Goede wrote:
> According to the EHCI spec port ownerhsip should revert to the EHCI controller
> on device disconnect. This fixes the problem of a port getting stuck on USB 1
> when using redirection and plugging in a USB 2 device after a USB 1 device
> has been redirected.

Patch added to usb patch queue.

thanks,
  Gerd
Andreas Färber - Jan. 23, 2012, 4:12 p.m.
Am 23.01.2012 15:51, schrieb Gerd Hoffmann:
> On 01/13/12 14:28, Hans de Goede wrote:
>> According to the EHCI spec port ownerhsip should revert to the EHCI controller

ownership

>> on device disconnect. This fixes the problem of a port getting stuck on USB 1
>> when using redirection and plugging in a USB 2 device after a USB 1 device
>> has been redirected.
> 
> Patch added to usb patch queue.

Andreas
Gerd Hoffmann - Jan. 23, 2012, 4:31 p.m.
On 01/23/12 17:12, Andreas Färber wrote:
> Am 23.01.2012 15:51, schrieb Gerd Hoffmann:
>> On 01/13/12 14:28, Hans de Goede wrote:
>>> According to the EHCI spec port ownerhsip should revert to the EHCI controller
> 
> ownership

Fixed.

thanks,
  Gerd

Patch

diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index a946e1d..69bcc4b 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -764,6 +764,11 @@  static void ehci_detach(USBPort *port)
         USBPort *companion = s->companion_ports[port->index];
         companion->ops->detach(companion);
         companion->dev = NULL;
+        /*
+         * EHCI spec 4.2.2: "When a disconnect occurs... On the event,
+         * the port ownership is returned immediately to the EHCI controller."
+         */
+        *portsc &= ~PORTSC_POWNER;
         return;
     }