On Thursday 06 July 2006 12:47 pm, Alan Stern wrote: > Greg and David: > > This patch (as738) fixes the root-hub remote-wakeup support in ehci-hcd. > The existing code has two problems. First, when the bus is suspended all > root-hub interrupts are disabled.
A better way of saying that is probably that ehci_halt() is the wrong way to turn off the RUN bit a few lines before that. ... now that I have a machine that can partially resume from STR, I can maybe spend some time chasing some of those issues; the box that can resume partially from "standby" is tied up with other stuff, not available for testing. I still have zero faith in how the Linux ACPI code does its wakeup event processing, since the number of times I've seen it behave sanely can be counted on the fingers of a hand that's been through industrial accidents that cost fingers. > Second, the call to > usb_hcd_resume_root_hub() is in the wrong place -- it is invoked when a > wakeup request arrives on a suspended port rather than when the root hub > itself generates a wakeup request. All hcd_resume_root() does is kick khubd, and it doesn't matter how often that happens since it merges events, and can't even talk to the root hub until that routine finishes. Your change makes it so the controller isn't necessarily going to be running when khubd comes in, and kicks hubd even when there's nothing for it to do. - Dave > Alan Stern > > > > Signed-off-by: Alan Stern <[EMAIL PROTECTED]> > > --- > > It's easy to test that the existing code doesn't work and the patched > driver does. Just unplug all the ports on an EHCI controller, suspend the > root hub interface and the root hub device through sysfs, and then try > plugging in a USB device. Without the patch, nothing happens. With the > patch, the driver wakes up and processes the new connection. > > > Index: usb-2.6/drivers/usb/host/ehci-hub.c > =================================================================== > --- usb-2.6.orig/drivers/usb/host/ehci-hub.c > +++ usb-2.6/drivers/usb/host/ehci-hub.c > @@ -76,6 +76,10 @@ static int ehci_bus_suspend (struct usb_ > ehci_halt (ehci); > hcd->state = HC_STATE_SUSPENDED; > > + /* allow remote wakeup */ > + if (device_may_wakeup(&hcd->self.root_hub->dev)) > + writel (INTR_MASK, &ehci->regs->intr_enable); > + > ehci->next_statechange = jiffies + msecs_to_jiffies(10); > spin_unlock_irq (&ehci->lock); > return 0; > Index: usb-2.6/drivers/usb/host/ehci-hcd.c > =================================================================== > --- usb-2.6.orig/drivers/usb/host/ehci-hcd.c > +++ usb-2.6/drivers/usb/host/ehci-hcd.c > @@ -625,7 +625,7 @@ static irqreturn_t ehci_irq (struct usb_ > /* resume root hub? */ > status = readl (&ehci->regs->command); > if (!(status & CMD_RUN)) > - writel (status | CMD_RUN, &ehci->regs->command); > + usb_hcd_resume_root_hub(hcd); > > while (i--) { > status = readl (&ehci->regs->port_status [i]); > @@ -641,7 +641,6 @@ static irqreturn_t ehci_irq (struct usb_ > */ > ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); > ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); > - usb_hcd_resume_root_hub(hcd); > } > } > > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel