From: Eduardo Valentin <[email protected]>

This patch fix the OTG autoidle workaround so now
usb gadget modules can be properly loaded.

Besides it also adds a cpu check, because this hardware
but is present only in OMAP34xx chips.

Signed-off-by: Eduardo Valentin <[email protected]>
---
 arch/arm/mach-omap2/pm34xx.c   |    3 ++-
 arch/arm/mach-omap2/usb-musb.c |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index c301261..db75975 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -505,7 +505,8 @@ void omap_sram_idle(void)
                         * Errata 1.164 fix : OTG autoidle can prevent
                         * sleep
                         */
-                       usb_musb_disable_autoidle();
+                       if (cpu_is_omap34xx())
+                               usb_musb_disable_autoidle();
                }
                omap_uart_resume_idle(0);
                omap_uart_resume_idle(1);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index bb3cee4..cbd4e45 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -81,7 +81,14 @@ static void __init usb_musb_pm_init(void)
 
 void usb_musb_disable_autoidle(void)
 {
-       __raw_writel(0, otg_base + OTG_SYSCONFIG);
+       if (otg_clk) {
+               unsigned long reg;
+
+               clk_enable(otg_clk);
+               reg = __raw_readl(otg_base + OTG_SYSCONFIG);
+               __raw_writel(reg & ~1, otg_base + OTG_SYSCONFIG);
+               clk_disable(otg_clk);
+       }
 }
 
 #ifdef CONFIG_USB_MUSB_SOC
-- 
1.6.5.7.g9ecb2

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to