public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] USB: MUSB: Be sure that we enable musb->clock
@ 2008-04-03 11:38 Felipe Balbi
  2008-04-03 11:56 ` Felipe Balbi
  0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2008-04-03 11:38 UTC (permalink / raw)
  To: linux-omap; +Cc: tony, Felipe Balbi

If CONFIG_OMAP_RESET_CLOCKS is enabled, musb->clock would
be disabled because nobody was enabling it.

Be sure that omap2430.c enables musb->clock to avoid problems
later.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/usb/musb/omap2430.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 8041dde..99c5782 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -262,15 +262,29 @@ int musb_platform_suspend(struct musb *musb)
 
 int musb_platform_resume(struct musb *musb)
 {
+	unsigned long	flags;
+
+	if (!musb->clock)
+		return 0;
+
+	spin_lock_irqsave(&musb->lock, flags);
+
 	if (musb->xceiv.set_suspend)
 		musb->xceiv.set_suspend(&musb->xceiv, 0);
 
+	if (musb->set_clock)
+		musb->set_clock(musb->clock, 1);
+	else
+		clk_enable(musb->clock);
+
 	OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
 	OTG_SYSCONFIG_REG |= SMARTSTDBY;	/* enable smart standby */
 	OTG_SYSCONFIG_REG &= ~AUTOIDLE;		/* disable auto idle */
 	OTG_SYSCONFIG_REG |= SMARTIDLE;		/* enable smart idle */
 	OTG_SYSCONFIG_REG |= AUTOIDLE;		/* enable auto idle */
 
+	spin_unlock_irqrestore(&musb->lock, flags);
+
 	return 0;
 }
 
-- 
1.5.5.rc2.25.g5fbd


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] USB: MUSB: Be sure that we enable musb->clock
  2008-04-03 11:38 [PATCH 1/1] USB: MUSB: Be sure that we enable musb->clock Felipe Balbi
@ 2008-04-03 11:56 ` Felipe Balbi
  2008-04-03 13:59   ` Felipe Balbi
  0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2008-04-03 11:56 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-omap, tony



On Thu,  3 Apr 2008 14:38:30 +0300, Felipe Balbi <felipe.balbi@nokia.com>
wrote:

The following is better as I'm also disabling the clock on suspend to
conserve power.

>From 5a4151f6fae01b82007c1205ff89daa9328276cb Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@nokia.com>
Date: Thu, 3 Apr 2008 14:35:33 +0300
Subject: [PATCH 1/1] USB: MUSB: Be sure that we enable musb->clock

If CONFIG_OMAP_RESET_CLOCKS is enabled, musb->clock would
be disabled because nobody was enabling it.

Be sure that omap2430.c enables musb->clock to avoid problems
later.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/usb/musb/omap2430.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 8041dde..2a4247c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -246,6 +246,13 @@ int __init musb_platform_init(struct musb *musb)
 
 int musb_platform_suspend(struct musb *musb)
 {
+	unsigned long	flags;
+
+	if (!musb->clock)
+		return 0;
+
+	spin_lock_irqsave(&musb->lock, flags);
+
 	/* in any role */
 	OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
 	OTG_SYSCONFIG_REG &= FORCESTDBY;	/* enable force standby */
@@ -257,20 +264,41 @@ int musb_platform_suspend(struct musb *musb)
 	if (musb->xceiv.set_suspend)
 		musb->xceiv.set_suspend(&musb->xceiv, 1);
 
+	if (musb->set_clock)
+		musb->set_clock(musb->clock, 0);
+	else
+		clk_disable(musb->clock);
+
+	spin_unlock_irqrestore(&musb->lock, flags);
+
 	return 0;
 }
 
 int musb_platform_resume(struct musb *musb)
 {
+	unsigned long	flags;
+
+	if (!musb->clock)
+		return 0;
+
+	spin_lock_irqsave(&musb->lock, flags);
+
 	if (musb->xceiv.set_suspend)
 		musb->xceiv.set_suspend(&musb->xceiv, 0);
 
+	if (musb->set_clock)
+		musb->set_clock(musb->clock, 1);
+	else
+		clk_enable(musb->clock);
+
 	OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
 	OTG_SYSCONFIG_REG |= SMARTSTDBY;	/* enable smart standby */
 	OTG_SYSCONFIG_REG &= ~AUTOIDLE;		/* disable auto idle */
 	OTG_SYSCONFIG_REG |= SMARTIDLE;		/* enable smart idle */
 	OTG_SYSCONFIG_REG |= AUTOIDLE;		/* enable auto idle */
 
+	spin_unlock_irqrestore(&musb->lock, flags);
+
 	return 0;
 }
 
-- 
1.5.5.rc2.25.g5fbd



-- 
Best Regards,

Felipe Balbi
http://felipebalbi.com
me@felipebalbi.com


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] USB: MUSB: Be sure that we enable musb->clock
  2008-04-03 11:56 ` Felipe Balbi
@ 2008-04-03 13:59   ` Felipe Balbi
  2008-04-04  9:33     ` Tony Lindgren
  0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2008-04-03 13:59 UTC (permalink / raw)
  To: ext Felipe Balbi; +Cc: Felipe Balbi, linux-omap, tony

On Thu, Apr 03, 2008 at 06:56:01AM -0500, ext Felipe Balbi wrote:
> 
> 
> On Thu,  3 Apr 2008 14:38:30 +0300, Felipe Balbi <felipe.balbi@nokia.com>
> wrote:
> 
> The following is better as I'm also disabling the clock on suspend to
> conserve power.

The spinlock wasn't needed, stupid brain-fart.
Sorry for that.

Tony, updated patch below:

>From cb08008da5e4a514d7b4784cbaf599ac119376ff Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@nokia.com>
Date: Thu, 3 Apr 2008 14:35:33 +0300
Subject: [PATCH] USB: MUSB: Be sure that we enable musb->clock

If CONFIG_OMAP_RESET_CLOCKS is enabled, musb->clock would
be disabled because nobody was enabling it.

Be sure that omap2430.c enables musb->clock to avoid problems
later.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/usb/musb/omap2430.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 8041dde..c21d93a 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -246,6 +246,9 @@ int __init musb_platform_init(struct musb *musb)
 
 int musb_platform_suspend(struct musb *musb)
 {
+	if (!musb->clock)
+		return 0;
+
 	/* in any role */
 	OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
 	OTG_SYSCONFIG_REG &= FORCESTDBY;	/* enable force standby */
@@ -257,14 +260,27 @@ int musb_platform_suspend(struct musb *musb)
 	if (musb->xceiv.set_suspend)
 		musb->xceiv.set_suspend(&musb->xceiv, 1);
 
+	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->xceiv.set_suspend)
 		musb->xceiv.set_suspend(&musb->xceiv, 0);
 
+	if (musb->set_clock)
+		musb->set_clock(musb->clock, 1);
+	else
+		clk_enable(musb->clock);
+
 	OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
 	OTG_SYSCONFIG_REG |= SMARTSTDBY;	/* enable smart standby */
 	OTG_SYSCONFIG_REG &= ~AUTOIDLE;		/* disable auto idle */
-- 
1.5.5.rc2.25.g5fbd



-- 
	- Balbi

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] USB: MUSB: Be sure that we enable musb->clock
  2008-04-03 13:59   ` Felipe Balbi
@ 2008-04-04  9:33     ` Tony Lindgren
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2008-04-04  9:33 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: ext Felipe Balbi, linux-omap

* Felipe Balbi <felipe.balbi@nokia.com> [080403 17:01]:
> On Thu, Apr 03, 2008 at 06:56:01AM -0500, ext Felipe Balbi wrote:
> > 
> > 
> > On Thu,  3 Apr 2008 14:38:30 +0300, Felipe Balbi <felipe.balbi@nokia.com>
> > wrote:
> > 
> > The following is better as I'm also disabling the clock on suspend to
> > conserve power.
> 
> The spinlock wasn't needed, stupid brain-fart.
> Sorry for that.
> 
> Tony, updated patch below:

Pushing today.

Tony

> From cb08008da5e4a514d7b4784cbaf599ac119376ff Mon Sep 17 00:00:00 2001
> From: Felipe Balbi <felipe.balbi@nokia.com>
> Date: Thu, 3 Apr 2008 14:35:33 +0300
> Subject: [PATCH] USB: MUSB: Be sure that we enable musb->clock
> 
> If CONFIG_OMAP_RESET_CLOCKS is enabled, musb->clock would
> be disabled because nobody was enabling it.
> 
> Be sure that omap2430.c enables musb->clock to avoid problems
> later.
> 
> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
> ---
>  drivers/usb/musb/omap2430.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index 8041dde..c21d93a 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -246,6 +246,9 @@ int __init musb_platform_init(struct musb *musb)
>  
>  int musb_platform_suspend(struct musb *musb)
>  {
> +	if (!musb->clock)
> +		return 0;
> +
>  	/* in any role */
>  	OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
>  	OTG_SYSCONFIG_REG &= FORCESTDBY;	/* enable force standby */
> @@ -257,14 +260,27 @@ int musb_platform_suspend(struct musb *musb)
>  	if (musb->xceiv.set_suspend)
>  		musb->xceiv.set_suspend(&musb->xceiv, 1);
>  
> +	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->xceiv.set_suspend)
>  		musb->xceiv.set_suspend(&musb->xceiv, 0);
>  
> +	if (musb->set_clock)
> +		musb->set_clock(musb->clock, 1);
> +	else
> +		clk_enable(musb->clock);
> +
>  	OTG_FORCESTDBY_REG &= ~ENABLEFORCE; /* disable MSTANDBY */
>  	OTG_SYSCONFIG_REG |= SMARTSTDBY;	/* enable smart standby */
>  	OTG_SYSCONFIG_REG &= ~AUTOIDLE;		/* disable auto idle */
> -- 
> 1.5.5.rc2.25.g5fbd
> 
> 
> 
> -- 
> 	- Balbi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-04  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-03 11:38 [PATCH 1/1] USB: MUSB: Be sure that we enable musb->clock Felipe Balbi
2008-04-03 11:56 ` Felipe Balbi
2008-04-03 13:59   ` Felipe Balbi
2008-04-04  9:33     ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox