From: Felipe Balbi <felipe.balbi@xxxxxxxxx> This patch lets musb tells the transceiver when it can go to low power mode. It saves us around 15mA. We need the extra flag in struct musb because tusb6010 does not play nicely with low power mode so we avoid going into that state with known broken hw. Forward ported from maemo kernel by Kalle Jokiniemi. NOT FOR UPSTREAM! Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxx> Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@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 ++ drivers/usb/musb/tusb6010.c | 2 ++ 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 9d49d1c..c95cdd6 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c @@ -405,6 +405,7 @@ static int bfin_musb_init(struct musb *musb) musb->isr = blackfin_interrupt; musb->double_buffer_not_ok = true; + musb->suspendm = true; return 0; } diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index e6de097..238885c 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c @@ -446,6 +446,8 @@ static int davinci_musb_init(struct musb *musb) musb_readb(tibase, DAVINCI_USB_CTRL_REG)); musb->isr = davinci_musb_interrupt; + musb->suspendm = true; + return 0; fail: diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index c292d5c..bb4f8af 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -935,6 +935,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); @@ -945,13 +946,15 @@ void musb_start(struct musb *musb) musb_writeb(regs, MUSB_TESTMODE, 0); + power = MUSB_POWER_ISOUPDATE | MUSB_POWER_SOFTCONN + | MUSB_POWER_HSENAB; + + /* 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 e6400be..a54383c 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -489,6 +489,9 @@ struct musb { unsigned test_mode:1; unsigned softconnect:1; + /* true if this chip can enable 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 bc8badd..fb0b007 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -297,6 +297,8 @@ static int omap2430_musb_init(struct musb *musb) struct musb_hdrc_platform_data *plat = dev->platform_data; struct omap_musb_board_data *data = plat->board_data; + musb->suspendm = true; + /* We require some kind of external transceiver, hooked * up through ULPI. TWL4030-family PMICs include one, * which needs a driver, drivers aren't always needed. diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 2ba3b07..d4134f5 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -1100,6 +1100,8 @@ static int tusb_musb_init(struct musb *musb) mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); musb->async = mem->start; + musb->suspendm = false; + /* dma address for sync dma */ mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (!mem) { -- 1.7.1 -- 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