This patch lets musb tells the transceiver when it can go to low power mode. It saves us around 15mA with RX51 and isp1707. We need the extra flag in struct musb because (at least) tusb6010 does not play nicely with low power mode so we avoid going into that state with known broken hw. Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxx> --- drivers/usb/musb/blackfin.c | 1 + drivers/usb/musb/davinci.c | 2 ++ drivers/usb/musb/musb_core.c | 15 +++++++++------ drivers/usb/musb/musb_core.h | 3 +++ drivers/usb/musb/omap2430.c | 2 ++ 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index fe4934d..90a9730 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c @@ -296,6 +296,7 @@ int __init musb_platform_init(struct musb *musb) musb->xceiv->set_power = bfin_set_power; musb->isr = blackfin_interrupt; + musb->suspendm = true; return 0; } diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index e16ff60..015aa28 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c @@ -442,6 +442,8 @@ int __init musb_platform_init(struct musb *musb) musb_readb(tibase, DAVINCI_USB_CTRL_REG)); musb->isr = davinci_interrupt; + musb->suspendm = true; + return 0; fail: diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 66579ec..b998c2d 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -879,6 +879,7 @@ void musb_start(struct musb *musb) { void __iomem *regs = musb->mregs; u8 devctl = musb_readb(regs, MUSB_DEVCTL); + u8 power; DBG(2, "<== devctl %02x\n", devctl); @@ -889,13 +890,15 @@ void musb_start(struct musb *musb) musb_writeb(regs, MUSB_TESTMODE, 0); + power = MUSB_POWER_ISOUPDATE | MUSB_POWER_HSENAB + | MUSB_POWER_SOFTCONN; + + /* ENSUSPEND wedges tusb */ + if (musb->suspendm) + power |= MUSB_POWER_ENSUSPEND; + /* put into basic highspeed mode and start session */ - musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE - | MUSB_POWER_SOFTCONN - | MUSB_POWER_HSENAB - /* ENSUSPEND wedges tusb */ - /* | MUSB_POWER_ENSUSPEND */ - ); + musb_writeb(regs, MUSB_POWER, power); musb->is_active = 0; devctl = musb_readb(regs, MUSB_DEVCTL); diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 4a43a32..3156293 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -436,6 +436,9 @@ struct musb { unsigned test_mode:1; unsigned softconnect:1; + /* true if chip can cope with SUSPENDM */ + unsigned suspendm:1; + u8 address; u8 test_mode_nr; u16 ackpend; /* ep0 */ diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 0b7e7a4..86995d5 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -204,6 +204,8 @@ int __init musb_platform_init(struct musb *musb) { u32 l; + musb->suspendm = true; + #if defined(CONFIG_ARCH_OMAP2430) omap_cfg_reg(AE5_2430_USB0HS_STP); #endif -- 1.6.6.rc0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html