aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2010-12-02 05:27:35 -0500
committerFelipe Balbi <balbi@ti.com>2010-12-10 03:21:26 -0500
commit496351413a227a6c0ea1a704d3d4c775d413fd08 (patch)
treee688488db9439ba5de6706260f0db4da612cc9d7 /drivers
parentfa56df915d101770a495569473b4c13b1904087b (diff)
usb: musb: drop musb_platform_save/restore_context
... that can be easily folded into the musb_platform_suspend/resume calls. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/musb/am35x.c15
-rw-r--r--drivers/usb/musb/blackfin.c15
-rw-r--r--drivers/usb/musb/musb_core.c4
-rw-r--r--drivers/usb/musb/musb_core.h14
-rw-r--r--drivers/usb/musb/omap2430.c20
5 files changed, 30 insertions, 38 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index e4e571bf9ba7..eacf1e09b495 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -462,19 +462,19 @@ static int am35x_musb_exit(struct musb *musb)
462 return 0; 462 return 0;
463} 463}
464 464
465#ifdef CONFIG_PM 465static int am35x_musb_suspend(struct musb *musb)
466void musb_platform_save_context(struct musb *musb,
467 struct musb_context_registers *musb_context)
468{ 466{
469 phy_off(); 467 phy_off();
468
469 return 0;
470} 470}
471 471
472void musb_platform_restore_context(struct musb *musb, 472static int am35x_musb_resume(struct musb *musb)
473 struct musb_context_registers *musb_context)
474{ 473{
475 phy_on(); 474 phy_on();
475
476 return 0;
476} 477}
477#endif
478 478
479/* AM35x supports only 32bit read operation */ 479/* AM35x supports only 32bit read operation */
480void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) 480void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
@@ -516,6 +516,9 @@ static const struct musb_platform_ops am35x_ops = {
516 .set_mode = am35x_musb_set_mode, 516 .set_mode = am35x_musb_set_mode,
517 .try_idle = am35x_musb_try_idle, 517 .try_idle = am35x_musb_try_idle,
518 518
519 .suspend = am35x_musb_suspend,
520 .resume = am35x_musb_resume,
521
519 .set_vbus = am35x_musb_set_vbus, 522 .set_vbus = am35x_musb_set_vbus,
520}; 523};
521 524
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 03cb001c0e19..8c9c5fc3a6ca 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -406,9 +406,7 @@ static int bfin_musb_init(struct musb *musb)
406 return 0; 406 return 0;
407} 407}
408 408
409#ifdef CONFIG_PM 409static int bfin_musb_suspend(struct musb *musb)
410void musb_platform_save_context(struct musb *musb,
411 struct musb_context_registers *musb_context)
412{ 410{
413 if (is_host_active(musb)) 411 if (is_host_active(musb))
414 /* 412 /*
@@ -418,14 +416,16 @@ void musb_platform_save_context(struct musb *musb,
418 * wakeup event. 416 * wakeup event.
419 */ 417 */
420 gpio_set_value(musb->config->gpio_vrsel, 0); 418 gpio_set_value(musb->config->gpio_vrsel, 0);
419
420 return 0;
421} 421}
422 422
423void musb_platform_restore_context(struct musb *musb, 423static int bfin_musb_resume(struct musb *musb)
424 struct musb_context_registers *musb_context)
425{ 424{
426 bfin_musb_reg_init(musb); 425 bfin_musb_reg_init(musb);
426
427 return 0;
427} 428}
428#endif
429 429
430static int bfin_musb_exit(struct musb *musb) 430static int bfin_musb_exit(struct musb *musb)
431{ 431{
@@ -446,6 +446,9 @@ static const struct musb_platform_ops bfin_ops = {
446 .set_mode = bfin_musb_set_mode, 446 .set_mode = bfin_musb_set_mode,
447 .try_idle = bfin_musb_try_idle, 447 .try_idle = bfin_musb_try_idle,
448 448
449 .suspend = bfin_musb_suspend,
450 .resume = bfin_musb_resume,
451
449 .vbus_status = bfin_musb_vbus_status, 452 .vbus_status = bfin_musb_vbus_status,
450 .set_vbus = bfin_musb_set_vbus, 453 .set_vbus = bfin_musb_set_vbus,
451}; 454};
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 6078eece74c7..4e048e3c3629 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2307,7 +2307,7 @@ void musb_save_context(struct musb *musb)
2307 } 2307 }
2308 } 2308 }
2309 2309
2310 musb_platform_save_context(musb, &musb->context); 2310 musb_platform_suspend(musb);
2311} 2311}
2312 2312
2313void musb_restore_context(struct musb *musb) 2313void musb_restore_context(struct musb *musb)
@@ -2317,7 +2317,7 @@ void musb_restore_context(struct musb *musb)
2317 void __iomem *ep_target_regs; 2317 void __iomem *ep_target_regs;
2318 void __iomem *epio; 2318 void __iomem *epio;
2319 2319
2320 musb_platform_restore_context(musb, &musb->context); 2320 musb_platform_resume(musb);
2321 2321
2322 if (is_host_enabled(musb)) { 2322 if (is_host_enabled(musb)) {
2323 musb_writew(musb_base, MUSB_FRAME, musb->context.frame); 2323 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 1e538675ab86..f8efd543c5f2 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 *);
603 603
604extern void musb_hnp_stop(struct musb *musb); 604extern void musb_hnp_stop(struct musb *musb);
605 605
606#ifdef CONFIG_PM
607#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
608 defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_BLACKFIN)
609extern void musb_platform_save_context(struct musb *musb,
610 struct musb_context_registers *musb_context);
611extern void musb_platform_restore_context(struct musb *musb,
612 struct musb_context_registers *musb_context);
613#else
614#define musb_platform_save_context(m, x) do {} while (0)
615#define musb_platform_restore_context(m, x) do {} while (0)
616#endif
617
618#endif
619
620static inline void musb_platform_set_vbus(struct musb *musb, int is_on) 606static inline void musb_platform_set_vbus(struct musb *musb, int is_on)
621{ 607{
622 if (musb->ops->set_vbus) 608 if (musb->ops->set_vbus)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index fa3154b03044..2659667a1994 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -258,21 +258,17 @@ static int omap2430_musb_init(struct musb *musb)
258 return 0; 258 return 0;
259} 259}
260 260
261#ifdef CONFIG_PM 261static void omap2430_save_context(struct musb *musb)
262void musb_platform_save_context(struct musb *musb,
263 struct musb_context_registers *musb_context)
264{ 262{
265 musb_context->otg_sysconfig = musb_readl(musb->mregs, OTG_SYSCONFIG); 263 musb->context.otg_sysconfig = musb_readl(musb->mregs, OTG_SYSCONFIG);
266 musb_context->otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY); 264 musb->context.otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY);
267} 265}
268 266
269void musb_platform_restore_context(struct musb *musb, 267static void omap2430_restore_context(struct musb *musb)
270 struct musb_context_registers *musb_context)
271{ 268{
272 musb_writel(musb->mregs, OTG_SYSCONFIG, musb_context->otg_sysconfig); 269 musb_writel(musb->mregs, OTG_SYSCONFIG, musb->context.otg_sysconfig);
273 musb_writel(musb->mregs, OTG_FORCESTDBY, musb_context->otg_forcestandby); 270 musb_writel(musb->mregs, OTG_FORCESTDBY, musb->context.otg_forcestandby);
274} 271}
275#endif
276 272
277static int omap2430_musb_suspend(struct musb *musb) 273static int omap2430_musb_suspend(struct musb *musb)
278{ 274{
@@ -287,6 +283,8 @@ static int omap2430_musb_suspend(struct musb *musb)
287 l |= ENABLEWAKEUP; /* enable wakeup */ 283 l |= ENABLEWAKEUP; /* enable wakeup */
288 musb_writel(musb->mregs, OTG_SYSCONFIG, l); 284 musb_writel(musb->mregs, OTG_SYSCONFIG, l);
289 285
286 omap2430_save_context(musb);
287
290 otg_set_suspend(musb->xceiv, 1); 288 otg_set_suspend(musb->xceiv, 1);
291 289
292 return 0; 290 return 0;
@@ -298,6 +296,8 @@ static int omap2430_musb_resume(struct musb *musb)
298 296
299 otg_set_suspend(musb->xceiv, 0); 297 otg_set_suspend(musb->xceiv, 0);
300 298
299 omap2430_restore_context(musb);
300
301 l = musb_readl(musb->mregs, OTG_SYSCONFIG); 301 l = musb_readl(musb->mregs, OTG_SYSCONFIG);
302 l &= ~ENABLEWAKEUP; /* disable wakeup */ 302 l &= ~ENABLEWAKEUP; /* disable wakeup */
303 musb_writel(musb->mregs, OTG_SYSCONFIG, l); 303 musb_writel(musb->mregs, OTG_SYSCONFIG, l);