On Sat, 8 May 2010 10:00:59 +0800 "Du, Alek" <alek.du@xxxxxxxxx> wrote: > >On Fri, 7 May 2010, Du, Alek wrote: > > > >> Alan, > >> > >> As I tested, with the second patch, after entering phy low power mode, the > >port cannot detect any USB devices that plugged in. > > > >Ooh, that's not good. It almost violates the EHCI spec (see the last > >line on p.60 in table 4.4). > Alan, The following patch (based on your previous two patches) works for me, could you help to review and test on your machine? Basically, this will only affect those "has_hostpc" HCDs. Thanks, Alek diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 004379b..a2d2fbe 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -116,6 +116,17 @@ static void ehci_set_wakeup_flags(struct ehci_hcd *ehci) u32 __iomem *reg = &ehci->regs->port_status[port]; u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; u32 t2 = t1 & ~PORT_WAKE_BITS; + u32 __iomem *hostpc_reg; + u32 temp; + + /* clear phy low power mode first*/ + if (ehci->has_hostpc) { + hostpc_reg = (u32 __iomem *)((u8 *)ehci->regs + + HOSTPC0 + 4 * (port & 0xff)); + temp = ehci_readl(ehci, hostpc_reg); + ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); + mdelay(5); + } /* only enable appropriate wake bits, otherwise the * hardware can not go phy low power mode. If a race @@ -131,6 +142,16 @@ static void ehci_set_wakeup_flags(struct ehci_hcd *ehci) port + 1, t1, t2); } ehci_writel(ehci, t2, reg); + + /* enable phy low power mode again */ + if (ehci->has_hostpc) { + temp = ehci_readl(ehci, hostpc_reg); + ehci_writel(ehci, temp | HOSTPC_PHCD, hostpc_reg); + temp = ehci_readl(ehci, hostpc_reg); + ehci_dbg(ehci, "Port%d phy low pwr mode %s\n", + port, (temp & HOSTPC_PHCD) ? + "succeeded" : "failed"); + } } } @@ -217,6 +238,14 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) u32 __iomem *hostpc_reg; u32 t3; + if (t1 & PORT_CONNECT) { + t2 |= PORT_WKOC_E | PORT_WKDISC_E; + t2 &= ~PORT_WKCONN_E; + } else { + t2 |= PORT_WKOC_E | PORT_WKCONN_E; + t2 &= ~PORT_WKDISC_E; + } + ehci_writel(ehci, t2, reg); hostpc_reg = (u32 __iomem *)((u8 *)ehci->regs + HOSTPC0 + 4 * (port & 0xff)); spin_unlock_irq(&ehci->lock); _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm