diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-06-07 19:50:12 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2011-06-14 12:56:50 +0200 |
commit | 9bba1eb180cb9b08ee1a53c19c52ee57253ac8c2 (patch) | |
tree | 8a86cde56b2e4d40bd8dda9bdd2a1e06774e3dc9 /hw/usb-ohci.c | |
parent | 4b0315d7edcbcfcbb07f7935c6e879b3f49fb99e (diff) |
hw/usb-ohci.c: Implement remote wakeup
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 <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-ohci.c')
-rw-r--r-- | 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 ab774347f3..832dcd688a 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, }; |