@@ -516,12 +516,6 @@ void omap_sram_idle(void)
omap3_prcm_restore_context();
omap3_sram_restore_context();
omap2_sms_restore_context();
- /*
- * Errata 1.164 fix : OTG autoidle can prevent
- * sleep
- */
- if (cpu_is_omap3430())
- usb_musb_disable_autoidle();
}
omap_uart_resume_idle(0);
omap_uart_resume_idle(1);
@@ -1242,6 +1236,9 @@ static int __init omap3_pm_init(void)
pm_dbg_regset_init(2);
omap3_save_scratchpad_contents();
+
+ /* Errata 1.164 fix : OTG autoidle can prevent sleep */
+ usb_musb_pm_init();
err1:
return ret;
err2:
@@ -44,12 +44,12 @@ static struct platform_device dummy_pdev = {
},
};
-static void __iomem *otg_base;
-static struct clk *otg_clk;
-
-static void __init usb_musb_pm_init(void)
+void __init usb_musb_pm_init(void)
{
- struct device *dev = &dummy_pdev.dev;
+ struct device *dev = &dummy_pdev.dev;
+ void __iomem *otg_base;
+ struct clk *otg_clk;
+ unsigned long r;
if (!cpu_is_omap34xx())
return;
@@ -81,6 +81,10 @@ static void __init usb_musb_pm_init(void)
__raw_readl(otg_base + OTG_SYSSTATUS)))
cpu_relax();
+ r = __raw_readl(otg_base + OTG_SYSCONFIG);
+ r &= ~(1 << 0);
+ __raw_writel(r, otg_base + OTG_SYSCONFIG);
+
clk_disable(otg_clk);
out1:
@@ -90,18 +94,6 @@ out0:
iounmap(otg_base);
}
-void usb_musb_disable_autoidle(void)
-{
- 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
static struct resource musb_resources[] = {
@@ -181,13 +173,10 @@ void __init usb_musb_init(struct omap_musb_board_data *board_data)
if (platform_device_register(&musb_device) < 0)
printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
-
- usb_musb_pm_init();
}
#else
void __init usb_musb_init(struct omap_musb_board_data *board_data)
{
- usb_musb_pm_init();
}
#endif /* CONFIG_USB_MUSB_SOC */
@@ -56,7 +56,7 @@ extern void usb_musb_init(struct omap_musb_board_data *board_data);
extern void usb_ehci_init(const struct ehci_hcd_omap_platform_data *pdata);
/* This is needed for OMAP3 errata 1.164: enabled autoidle can prevent sleep */
-extern void usb_musb_disable_autoidle(void);
+extern void usb_musb_pm_init(void);
#endif