From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWRRc-0007Gz-3o for qemu-devel@nongnu.org; Tue, 14 Jun 2011 07:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWRRW-0003ul-28 for qemu-devel@nongnu.org; Tue, 14 Jun 2011 07:06:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWRRV-0003ua-KO for qemu-devel@nongnu.org; Tue, 14 Jun 2011 07:05:57 -0400 From: Gerd Hoffmann Date: Tue, 14 Jun 2011 13:05:51 +0200 Message-Id: <1308049552-5744-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1308049552-5744-1-git-send-email-kraxel@redhat.com> References: <1308049552-5744-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Gerd Hoffmann From: Peter Maydell 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 Signed-off-by: Gerd Hoffmann --- 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