aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-ehci.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2011-09-15 12:10:21 +0200
committerGerd Hoffmann <kraxel@redhat.com>2011-10-13 12:58:51 +0200
commite0b8e72dd95f5fe133c8bb952a464814ca06fe8b (patch)
tree11c2928dee2be883a0021f776238cbe40e4c376b /hw/usb-ehci.c
parent3393bc105d58e1f4a27d9a8e7062da9cef260cc3 (diff)
downloadqemu-e0b8e72dd95f5fe133c8bb952a464814ca06fe8b.zip
qemu-e0b8e72dd95f5fe133c8bb952a464814ca06fe8b.tar.gz
qemu-e0b8e72dd95f5fe133c8bb952a464814ca06fe8b.tar.bz2
usb: fix port reset
commit 891fb2cd4592b6fe76106a69e0ca40efbf82726a removed the implicit detach before (re-)attaching in usb_attach(). Some usb host controllers used that behavior though to do a port reset by a detach+attach sequence. This patch establishes old behavior by adding a new usb_reset() function for port resets and putting it into use, thereby also unifying port reset behavior of all host controllers. The patch also adds asserts to usb_attach() and usb_detach() to make sure the calls are symmetrical. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-ehci.c')
-rw-r--r--hw/usb-ehci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 27376a2..bd374c1 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -880,6 +880,7 @@ static void ehci_reset(void *opaque)
}
if (devs[i] && devs[i]->attached) {
usb_attach(&s->ports[i]);
+ usb_send_msg(devs[i], USB_MSG_RESET);
}
}
ehci_queues_rip_all(s);
@@ -978,8 +979,7 @@ static void handle_port_status_write(EHCIState *s, int port, uint32_t val)
if (!(val & PORTSC_PRESET) &&(*portsc & PORTSC_PRESET)) {
trace_usb_ehci_port_reset(port, 0);
if (dev && dev->attached) {
- usb_attach(&s->ports[port]);
- usb_send_msg(dev, USB_MSG_RESET);
+ usb_reset(&s->ports[port]);
*portsc &= ~PORTSC_CSC;
}