[RFC PATCH 2/2] usb: musb: work-around for OMAP 3430 off-mode with broken AUTOIDLE

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

 



Broken AUTOIDLE on OMAP 3430 forces extra manipulation to enable
correctly OFF-mode.

based-on: Heikki Krogerus <ext-heikki.krogerus@xxxxxxxxx>
Signed-off-by: Arnaud Mandy <ext-arnaud.2.mandy@xxxxxxxxx>
---
 drivers/usb/musb/omap2430.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 45c564a..b1843de 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -277,9 +277,22 @@ void musb_platform_restore_context(struct musb *musb,
 void musb_power_off_controller(struct musb *musb)
 {
 	u32 l;
+	unsigned long tmo;
 
 	DBG(3, "allow OFF-mode\n");
 
+	if (cpu_is_omap3430()) {
+		/* Do soft reset. This needs to be done with broken AUTOIDLE */
+		tmo = jiffies + msecs_to_jiffies(300);
+		musb_writel(musb->mregs, OTG_SYSCONFIG, SOFTRST);
+		while (!musb_readl(musb->mregs, OTG_SYSSTATUS)) {
+			if (time_after(jiffies, tmo)) {
+				WARN(1, "musb failed to recover from reset!");
+				break;
+			}
+		}
+	}
+
 	l = musb_readl(musb->mregs, OTG_FORCESTDBY);
 	l |= ENABLEFORCE;	/* enable MSTANDBY */
 	musb_writel(musb->mregs, OTG_FORCESTDBY, l);
@@ -293,6 +306,12 @@ void musb_power_off_controller(struct musb *musb)
 	l &= ~NOIDLE;		/* disable noidle */
 	l |= SMARTIDLE;		/* enable smart idle */
 	musb_writel(musb->mregs, OTG_SYSCONFIG, l);
+
+	if (cpu_is_omap3430()) {
+		/* Now it's safe to get rid of the buggy AUTOIDLE */
+		l &= ~AUTOIDLE;
+		musb_writel(musb->mregs, OTG_SYSCONFIG, l);
+	}
 }
 EXPORT_SYMBOL_GPL(musb_power_off_controller);
 
-- 
1.6.0.4

--
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