[PATCH v2 23/30] usb: musb: drop musb_platform_save/restore_context

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

 



... that can be easily folded into the
musb_platform_suspend/resume calls.

Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---
 drivers/usb/musb/am35x.c     |   15 +++++++++------
 drivers/usb/musb/blackfin.c  |   15 +++++++++------
 drivers/usb/musb/musb_core.c |    4 ++--
 drivers/usb/musb/musb_core.h |   14 --------------
 drivers/usb/musb/omap2430.c  |   20 ++++++++++----------
 5 files changed, 30 insertions(+), 38 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index ee0119d..14413a8 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -468,19 +468,19 @@ static int am35x_musb_exit(struct musb *musb)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-void musb_platform_save_context(struct musb *musb,
-	struct musb_context_registers *musb_context)
+static int am35x_musb_suspend(struct musb *musb)
 {
 	phy_off();
+
+	return 0;
 }
 
-void musb_platform_restore_context(struct musb *musb,
-	struct musb_context_registers *musb_context)
+static int am35x_musb_resume(struct musb *musb)
 {
 	phy_on();
+
+	return 0;
 }
-#endif
 
 /* AM35x supports only 32bit read operation */
 void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
@@ -522,6 +522,9 @@ static const struct musb_platform_ops musb_ops = {
 	.set_mode	= am35x_musb_set_mode,
 	.try_idle	= am35x_musb_try_idle,
 
+	.suspend	= am35x_musb_suspend,
+	.resume		= am35x_musb_resume,
+
 	.set_vbus	= am35x_musb_set_vbus,
 };
 
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 2434f20..65f93df 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -408,9 +408,7 @@ static int bfin_musb_init(struct musb *musb, void *board_data)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-void musb_platform_save_context(struct musb *musb,
-			struct musb_context_registers *musb_context)
+static int bfin_musb_suspend(struct musb *musb)
 {
 	if (is_host_active(musb))
 		/*
@@ -420,14 +418,16 @@ void musb_platform_save_context(struct musb *musb,
 		 * wakeup event.
 		 */
 		gpio_set_value(musb->config->gpio_vrsel, 0);
+
+	return 0;
 }
 
-void musb_platform_restore_context(struct musb *musb,
-			struct musb_context_registers *musb_context)
+static int bfin_musb_resume(struct musb *musb)
 {
 	bfin_musb_reg_init(musb);
+
+	return 0;
 }
-#endif
 
 static int bfin_musb_exit(struct musb *musb)
 {
@@ -448,6 +448,9 @@ static const struct musb_platform_ops musb_ops = {
 	.set_mode	= bfin_musb_set_mode,
 	.try_idle	= bfin_musb_try_idle,
 
+	.suspend	= bfin_musb_suspend,
+	.resume		= bfin_musb_resume,
+
 	.vbus_status	= bfin_musb_vbus_status,
 	.set_vbus	= bfin_musb_set_vbus,
 };
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index c423cc5..39865ff 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2308,7 +2308,7 @@ void musb_save_context(struct musb *musb)
 		}
 	}
 
-	musb_platform_save_context(musb, &musb->context);
+	musb_platform_suspend(musb);
 }
 
 void musb_restore_context(struct musb *musb)
@@ -2318,7 +2318,7 @@ void musb_restore_context(struct musb *musb)
 	void __iomem *ep_target_regs;
 	void __iomem *epio;
 
-	musb_platform_restore_context(musb, &musb->context);
+	musb_platform_resume(musb);
 
 	if (is_host_enabled(musb)) {
 		musb_writew(musb_base, MUSB_FRAME, musb->context.frame);
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index b084e50..d7b40ab 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -603,20 +603,6 @@ extern irqreturn_t musb_interrupt(struct musb *);
 
 extern void musb_hnp_stop(struct musb *musb);
 
-#ifdef CONFIG_PM
-#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
-    defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_BLACKFIN)
-extern void musb_platform_save_context(struct musb *musb,
-		struct musb_context_registers *musb_context);
-extern void musb_platform_restore_context(struct musb *musb,
-		struct musb_context_registers *musb_context);
-#else
-#define musb_platform_save_context(m, x)	do {} while (0)
-#define musb_platform_restore_context(m, x)	do {} while (0)
-#endif
-
-#endif
-
 static inline void musb_platform_set_vbus(struct musb *musb, int is_on)
 {
 	if (musb->ops->set_vbus)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 4d52393..854cf0b 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -256,21 +256,17 @@ static int omap2430_musb_init(struct musb *musb, void *board_data)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-void musb_platform_save_context(struct musb *musb,
-		struct musb_context_registers *musb_context)
+static void omap2430_save_context(struct musb *musb)
 {
-	musb_context->otg_sysconfig = musb_readl(musb->mregs, OTG_SYSCONFIG);
-	musb_context->otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY);
+	musb->context.otg_sysconfig = musb_readl(musb->mregs, OTG_SYSCONFIG);
+	musb->context.otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY);
 }
 
-void musb_platform_restore_context(struct musb *musb,
-		struct musb_context_registers *musb_context)
+static void omap2430_restore_context(struct musb *musb)
 {
-	musb_writel(musb->mregs, OTG_SYSCONFIG, musb_context->otg_sysconfig);
-	musb_writel(musb->mregs, OTG_FORCESTDBY, musb_context->otg_forcestandby);
+	musb_writel(musb->mregs, OTG_SYSCONFIG, musb->context.otg_sysconfig);
+	musb_writel(musb->mregs, OTG_FORCESTDBY, musb->context.otg_forcestandby);
 }
-#endif
 
 static int omap2430_musb_suspend(struct musb *musb)
 {
@@ -285,6 +281,8 @@ static int omap2430_musb_suspend(struct musb *musb)
 	l |= ENABLEWAKEUP;	/* enable wakeup */
 	musb_writel(musb->mregs, OTG_SYSCONFIG, l);
 
+	omap2430_save_context(musb);
+
 	otg_set_suspend(musb->xceiv, 1);
 
 	return 0;
@@ -296,6 +294,8 @@ static int omap2430_musb_resume(struct musb *musb)
 
 	otg_set_suspend(musb->xceiv, 0);
 
+	omap2430_restore_context(musb);
+
 	l = musb_readl(musb->mregs, OTG_SYSCONFIG);
 	l &= ~ENABLEWAKEUP;	/* disable wakeup */
 	musb_writel(musb->mregs, OTG_SYSCONFIG, l);
-- 
1.7.3.2.343.g7d43d

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