[NOT FOR MERGING/PATCH 2/2] usb: musb: put transceiver in low power when in idle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch lets musb tells the transceiver when it can go to low
power mode. It saves us around 15mA with RX51 and isp1707.

Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxx>
---

 drivers/usb/musb/blackfin.c  |    2 ++
 drivers/usb/musb/davinci.c   |    3 +++
 drivers/usb/musb/musb_core.c |   15 +++++++++------
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index fe4934d..477016b 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -253,6 +253,8 @@ int __init musb_platform_init(struct musb *musb)
 	if (!musb->xceiv)
 		return -ENODEV;
 
+	musb->xceiv->can_suspendm = true;
+
 	if (ANOMALY_05000346) {
 		bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
 		SSYNC();
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 6691381..0e47d60 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -387,6 +387,8 @@ int __init musb_platform_init(struct musb *musb)
 	if (!musb->xceiv)
 		return -ENODEV;
 
+	musb->xceiv->can_suspendm = true;
+
 	musb->mregs += DAVINCI_BASE_OFFSET;
 
 	clk_enable(musb->clock);
@@ -442,6 +444,7 @@ int __init musb_platform_init(struct musb *musb)
 		musb_readb(tibase, DAVINCI_USB_CTRL_REG));
 
 	musb->isr = davinci_interrupt;
+
 	return 0;
 
 fail:
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index bd70f1b..4a1c628 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -868,6 +868,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);
 
@@ -878,13 +879,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->xceiv->can_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);
-- 
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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux