From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup
Date: Tue, 14 Jun 2011 13:05:51 +0200 [thread overview]
Message-ID: <1308049552-5744-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1308049552-5744-1-git-send-email-kraxel@redhat.com>
From: Peter Maydell <peter.maydell@linaro.org>
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>
---
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
next prev parent reply other threads:[~2011-06-14 11:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 11:05 [Qemu-devel] [PULL] usb patch queue Gerd Hoffmann
2011-06-14 11:05 ` [Qemu-devel] [PATCH 32/34] hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register Gerd Hoffmann
2011-06-14 11:05 ` Gerd Hoffmann [this message]
2011-06-15 15:03 ` [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup Peter Maydell
2011-06-14 11:05 ` [Qemu-devel] [PATCH 34/34] usb-uhci: fix expire time initialization Gerd Hoffmann
2011-06-15 14:17 ` [Qemu-devel] [PULL] usb patch queue Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308049552-5744-3-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).