@@ -305,11 +305,26 @@ int __init musb_platform_init(struct musb *musb)
int musb_platform_suspend(struct musb *musb)
{
+ if (!musb->clock)
+ return 0;
+
+ if (musb->set_clock)
+ musb->set_clock(musb->clock, 0);
+ else
+ clk_disable(musb->clock);
+
return 0;
}
int musb_platform_resume(struct musb *musb)
{
+ if (!musb->clock)
+ return 0;
+
+ if (musb->set_clock)
+ musb->set_clock(musb->clock, 1);
+ else
+ clk_enable(musb->clock);
return 0;
}
@@ -499,3 +499,27 @@ int musb_platform_exit(struct musb *musb)
return 0;
}
+
+int musb_platform_suspend(struct musb *musb)
+{
+ if (!musb->clock)
+ return 0;
+
+ if (musb->set_clock)
+ musb->set_clock(musb->clock, 0);
+ else
+ clk_disable(musb->clock);
+ return 0;
+}
+
+int musb_platform_resume(struct musb *musb)
+{
+ if (!musb->clock)
+ return 0;
+
+ if (musb->set_clock)
+ musb->set_clock(musb->clock, 1);
+ else
+ clk_enable(musb->clock);
+ return 0;
+}
@@ -2186,13 +2186,9 @@ static int musb_suspend(struct platform_device *pdev, pm_message_t message)
* they will even be wakeup-enabled.
*/
}
-
- if (musb->set_clock)
- musb->set_clock(musb->clock, 0);
- else
- clk_disable(musb->clock);
spin_unlock_irqrestore(&musb->lock, flags);
- return 0;
+
+ return musb_platform_suspend(musb);
}
static int musb_resume_early(struct platform_device *pdev)
@@ -2202,16 +2198,11 @@ static int musb_resume_early(struct platform_device *pdev)
if (!musb->clock)
return 0;
- if (musb->set_clock)
- musb->set_clock(musb->clock, 1);
- else
- clk_enable(musb->clock);
-
/* for static cmos like DaVinci, register values were preserved
* unless for some reason the whole soc powered down or the USB
* module got reset through the PSC (vs just being disabled).
*/
- return 0;
+ return musb_platform_resume(musb);
}
#else
@@ -188,8 +188,6 @@ static void omap_set_vbus(struct musb *musb, int is_on)
musb_readb(musb->mregs, MUSB_DEVCTL));
}
-static int musb_platform_resume(struct musb *musb);
-
int musb_platform_set_mode(struct musb *musb, u8 musb_mode)
{
u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -281,7 +279,7 @@ int musb_platform_suspend(struct musb *musb)
return 0;
}
-static int musb_platform_resume(struct musb *musb)
+int musb_platform_resume(struct musb *musb)
{
u32 l;
@@ -1169,3 +1169,27 @@ int musb_platform_exit(struct musb *musb)
usb_nop_xceiv_unregister();
return 0;
}
+
+int musb_platform_suspend(struct musb *musb)
+{
+ if (!musb->clock)
+ return 0;
+
+ if (musb->set_clock)
+ musb->set_clock(musb->clock, 0);
+ else
+ clk_disable(musb->clock);
+ return 0;
+}
+
+int musb_platform_resume(struct musb *musb)
+{
+ if (!musb->clock)
+ return 0;
+
+ if (musb->set_clock)
+ musb->set_clock(musb->clock, 1);
+ else
+ clk_enable(musb->clock);
+ return 0;
+}
@@ -105,4 +105,9 @@ extern int tusb6010_platform_retime(unsigned is_refclk);
#endif /* OMAP2 */
+/* All MUSB platforms should export their suspend/resume functions */
+struct musb;
+extern int musb_platform_suspend(struct musb *musb);
+extern int musb_platform_resume(struct musb *musb);
+
#endif /* __LINUX_USB_MUSB_H */
This patch allows each MUSB platform (Davinci/TUSB/OMAP/Blackfin) to have their own musb_platform_suspend/musb_platform_resume hooks Each platform has its own power handling requirements and hence distribute the suspend/resume functionality per platform No new functionality is added for other platforms (blackfin/davinci/tusb) In future these platforms can optimize their suspend/resume routines for power. Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> Cc: Ajay Kumar Gupta <ajay.gupta@ti.com> --- drivers/usb/musb/blackfin.c | 15 +++++++++++++++ drivers/usb/musb/davinci.c | 24 ++++++++++++++++++++++++ drivers/usb/musb/musb_core.c | 15 +++------------ drivers/usb/musb/omap2430.c | 4 +--- drivers/usb/musb/tusb6010.c | 24 ++++++++++++++++++++++++ include/linux/usb/musb.h | 5 +++++ 6 files changed, 72 insertions(+), 15 deletions(-)