[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup |
Date: |
Tue, 14 Jun 2011 13:05:51 +0200 |
From: Peter Maydell <address@hidden>
Implement the wakeup callback in the OHCI USBPortOps, so that when
a downstream device wakes up it correctly causes the OHCI controller
to come out of suspend.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb-ohci.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index ab77434..832dcd6 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -367,6 +367,22 @@ static void ohci_detach(USBPort *port1)
ohci_set_interrupt(s, OHCI_INTR_RHSC);
}
+static void ohci_wakeup(USBDevice *dev)
+{
+ USBBus *bus = usb_bus_from_device(dev);
+ OHCIState *s = container_of(bus, OHCIState, bus);
+ int portnum = dev->port->index;
+ OHCIPort *port = &s->rhport[portnum];
+ if (port->ctrl & OHCI_PORT_PSS) {
+ DPRINTF("usb-ohci: port %d: wakeup\n", portnum);
+ port->ctrl |= OHCI_PORT_PSSC;
+ port->ctrl &= ~OHCI_PORT_PSS;
+ if ((s->ctl & OHCI_CTL_HCFS) == OHCI_USB_SUSPEND) {
+ ohci_set_interrupt(s, OHCI_INTR_RD);
+ }
+ }
+}
+
/* Reset the controller */
static void ohci_reset(void *opaque)
{
@@ -1675,6 +1691,7 @@ static CPUWriteMemoryFunc * const ohci_writefn[3]={
static USBPortOps ohci_port_ops = {
.attach = ohci_attach,
.detach = ohci_detach,
+ .wakeup = ohci_wakeup,
.complete = ohci_async_complete_packet,
};
--
1.7.1
- [Qemu-devel] [PULL] usb patch queue, Gerd Hoffmann, 2011/06/14
- [Qemu-devel] [PULL] usb patch queue, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 03/13] usb-linux: track inflight iso urb count, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 04/13] ehci: add freq + maxframes properties, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 02/13] usb-linux: make iso urb count contigurable, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 01/13] usb-linux: add get_endp(), Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 06/13] usb-bus: Don't allow attaching a device to a bus with no free ports, Gerd Hoffmann, 2011/06/24
- [Qemu-devel] [PATCH 05/13] ehci: switch to nanoseconds, Gerd Hoffmann, 2011/06/24