public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OMAP3: PM: Force USB to standby if not used
@ 2009-05-14 12:09 Tero Kristo
  2009-05-14 15:55 ` Kevin Hilman
  0 siblings, 1 reply; 3+ messages in thread
From: Tero Kristo @ 2009-05-14 12:09 UTC (permalink / raw)
  To: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

This patch will allow device to enter sleep mode while a USB cable is
connected and USB is either disabled or built as a module from kernel
config.

Applies on top of PM branch.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
 arch/arm/mach-omap2/usb-musb.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 12a9b0a..dd51d2f 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -32,7 +32,9 @@
 #include <mach/usb.h>
 
 #define AUTOIDLE        (1 << 0)
+#define FORCESTDBY	(1 << 0)
 #define OTG_SYSCONFIG	(OMAP34XX_HSUSB_OTG_BASE + 0x404)
+#define OTG_FORCESTDBY	(OMAP34XX_HSUSB_OTG_BASE + 0x414)
 
 static struct resource musb_resources[] = {
 	[0] = { /* start and end set dynamically */
@@ -185,7 +187,11 @@ void __init usb_musb_init(void)
 		return;
 	}
 
-	/* Enable smartidle on MUSB to improve C1 wakeup latency */
-	if (cpu_is_omap34xx())
+#if !defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
+	/* Force MUSB to standby if not used */
+	if (cpu_is_omap34xx()) {
 		omap_writel(AUTOIDLE, OTG_SYSCONFIG);
+		omap_writel(FORCESTDBY, OTG_FORCESTDBY);
+	}
+#endif
 }
-- 
1.5.4.3


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

* Re: [PATCH] OMAP3: PM: Force USB to standby if not used
  2009-05-14 12:09 [PATCH] OMAP3: PM: Force USB to standby if not used Tero Kristo
@ 2009-05-14 15:55 ` Kevin Hilman
  2009-05-15  8:34   ` Tero.Kristo
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Hilman @ 2009-05-14 15:55 UTC (permalink / raw)
  To: Tero Kristo; +Cc: linux-omap

Tero Kristo <tero.kristo@nokia.com> writes:

> From: Tero Kristo <tero.kristo@nokia.com>
>
> This patch will allow device to enter sleep mode while a USB cable is
> connected and USB is either disabled or built as a module from kernel
> config.
>
> Applies on top of PM branch.
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> ---
>  arch/arm/mach-omap2/usb-musb.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
> index 12a9b0a..dd51d2f 100644
> --- a/arch/arm/mach-omap2/usb-musb.c
> +++ b/arch/arm/mach-omap2/usb-musb.c
> @@ -32,7 +32,9 @@
>  #include <mach/usb.h>
>  
>  #define AUTOIDLE        (1 << 0)
> +#define FORCESTDBY	(1 << 0)
>  #define OTG_SYSCONFIG	(OMAP34XX_HSUSB_OTG_BASE + 0x404)
> +#define OTG_FORCESTDBY	(OMAP34XX_HSUSB_OTG_BASE + 0x414)
>  
>  static struct resource musb_resources[] = {
>  	[0] = { /* start and end set dynamically */
> @@ -185,7 +187,11 @@ void __init usb_musb_init(void)
>  		return;
>  	}
>  
> -	/* Enable smartidle on MUSB to improve C1 wakeup latency */
> -	if (cpu_is_omap34xx())
> +#if !defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
> +	/* Force MUSB to standby if not used */
> +	if (cpu_is_omap34xx()) {
>  		omap_writel(AUTOIDLE, OTG_SYSCONFIG);
> +		omap_writel(FORCESTDBY, OTG_FORCESTDBY);
> +	}
> +#endif

Tero,

Is this needed if OTG_SYSCONFIG is set to force-idle?

Yesterday, I pushed a patch changing OTG_SYSCONFIG to force-idle
instead of auto-idle since on ES3.0 3430SDP, having it in auto-idle
was keeping CORE from hitting retention.  IIUC, there's an errata
where force-idle doesn't work properly.

Also, why the #ifdefs?

This code is already conditionally compiled based on
CONFIG_USB_MUSB_SOC (see mach-omap2/Makefile) which is set whether
MUSB is built-in or a module.

#if !defined(CONFIG_USB) then CONFIG_USB_MUSB_SOC will not be defined
either.

Kevin

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

* RE: [PATCH] OMAP3: PM: Force USB to standby if not used
  2009-05-14 15:55 ` Kevin Hilman
@ 2009-05-15  8:34   ` Tero.Kristo
  0 siblings, 0 replies; 3+ messages in thread
From: Tero.Kristo @ 2009-05-15  8:34 UTC (permalink / raw)
  To: khilman; +Cc: linux-omap

 

>-----Original Message-----
>From: ext Kevin Hilman [mailto:khilman@deeprootsystems.com] 
>Sent: 14 May, 2009 18:56
>To: Kristo Tero (Nokia-D/Tampere)
>Cc: linux-omap@vger.kernel.org
>Subject: Re: [PATCH] OMAP3: PM: Force USB to standby if not used
>
>Tero Kristo <tero.kristo@nokia.com> writes:
>
>> From: Tero Kristo <tero.kristo@nokia.com>
>>
>> This patch will allow device to enter sleep mode while a USB 
>cable is 
>> connected and USB is either disabled or built as a module 
>from kernel 
>> config.
>>
>> Applies on top of PM branch.
>>
>> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>> ---
>>  arch/arm/mach-omap2/usb-musb.c |   10 ++++++++--
>>  1 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/usb-musb.c 
>> b/arch/arm/mach-omap2/usb-musb.c index 12a9b0a..dd51d2f 100644
>> --- a/arch/arm/mach-omap2/usb-musb.c
>> +++ b/arch/arm/mach-omap2/usb-musb.c
>> @@ -32,7 +32,9 @@
>>  #include <mach/usb.h>
>>  
>>  #define AUTOIDLE        (1 << 0)
>> +#define FORCESTDBY	(1 << 0)
>>  #define OTG_SYSCONFIG	(OMAP34XX_HSUSB_OTG_BASE + 0x404)
>> +#define OTG_FORCESTDBY	(OMAP34XX_HSUSB_OTG_BASE + 0x414)
>>  
>>  static struct resource musb_resources[] = {
>>  	[0] = { /* start and end set dynamically */ @@ -185,7 
>+187,11 @@ 
>> void __init usb_musb_init(void)
>>  		return;
>>  	}
>>  
>> -	/* Enable smartidle on MUSB to improve C1 wakeup latency */
>> -	if (cpu_is_omap34xx())
>> +#if !defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
>> +	/* Force MUSB to standby if not used */
>> +	if (cpu_is_omap34xx()) {
>>  		omap_writel(AUTOIDLE, OTG_SYSCONFIG);
>> +		omap_writel(FORCESTDBY, OTG_FORCESTDBY);
>> +	}
>> +#endif
>
>Tero,
>
>Is this needed if OTG_SYSCONFIG is set to force-idle?
>
>Yesterday, I pushed a patch changing OTG_SYSCONFIG to 
>force-idle instead of auto-idle since on ES3.0 3430SDP, having 
>it in auto-idle was keeping CORE from hitting retention.  
>IIUC, there's an errata where force-idle doesn't work properly.
>
>Also, why the #ifdefs?
>
>This code is already conditionally compiled based on 
>CONFIG_USB_MUSB_SOC (see mach-omap2/Makefile) which is set 
>whether MUSB is built-in or a module.
>
>#if !defined(CONFIG_USB) then CONFIG_USB_MUSB_SOC will not be 
>defined either.

You are actually right, I missed that change to Makefile. The reason for this patch was to be able to hit retention / off when USB is not enabled, and this was possible with the #ifdef:s earlier. I think you can just ignore this patch.

-Tero

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

end of thread, other threads:[~2009-05-15  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-14 12:09 [PATCH] OMAP3: PM: Force USB to standby if not used Tero Kristo
2009-05-14 15:55 ` Kevin Hilman
2009-05-15  8:34   ` Tero.Kristo

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