Re: [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode

2009-12-18 Thread Eduardo Valentin
Hello All,

On Thu, Nov 12, 2009 at 04:40:56PM +0100, ext Gadiyar, Anand wrote:
> > Tero Kristo  writes:
> > 
> > > From: Tero Kristo 
> > >
> > > OMAP3 sleep can be prevented in some cases where OTG autoidle is enabled.
> > > This patch force disables autoidle during wakeup from off-mode. See omap
> > > errata 1.164.
> > >
> > > This fix can't be done in driver level, as off-mode entry resets and 
> > > enables
> > > the autoidle bit, and driver does not access the register after each 
> > > off-mode
> > > entry even if it is loaded.
> > >
> > > Signed-off-by: Tero Kristo 
> > 
> > Thanks Tero for the updated changelog.
> > 
> > Applying to PM branch reluctantly and with grumbles.  I sure hope
> > someone in TI is reporting all these ROM code issues to the ROM code
> > team so they get appropriate fixes.
> > 
> > Kevin
> 
> Yes, rest assured we're following these up with the HW teams.
> 
> This particular one should not matter on 3630, we can keep autoidle
> enabled all the time, I think.


I've made a few tests with pm branch + rx51. Currently at:
commit 1f1d16a8164d63459c1a5e155bcb9fc8a15b859e
Merge: 46e0bec 5660cac
Author: Kevin Hilman 
Date:   Wed Dec 16 16:09:47 2009 -0800

manual merge for branch pm-debug

And this patch
"OMAP3: PM: Disable OTG autoidle when waking up from off-mode"

Seams to be not complete at least. It causes:

# modprobe g_zero
[   28.073944] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[   28.080932] usb usb1: New USB device strings: Mfr=3, Product=2, 
SerialNumber=1
[   28.088317] usb usb1: Product: MUSB HDRC host driver
[   28.093414] usb usb1: Manufacturer: Linux 2.6.32-14504-g1f1d16a musb-hcd
[   28.100250] usb usb1: SerialNumber: musb_hdrc
[   28.110565] hub 1-0:1.0: USB hub found
[   28.114715] hub 1-0:1.0: 1 port detected
[   28.119506] Unhandled fault: external abort on non-linefetch (0x1028) at 
0xfa0ab060
[   28.127288] Internal error: : 1028 [#1]
[   28.131164] last sysfs file: /sys/devices/platform/serial8250.2/sleep_timeout
[   28.138366] Modules linked in: g_zero(+)
[   28.142364] CPU: 0Not tainted  (2.6.32-14504-g1f1d16a #10)
[   28.148284] PC is at musb_start+0x18/0xdc
[   28.152343] LR is at musb_hub_control+0x33c/0x454
[   28.157104] pc : []lr : []psr: 80d3
[   28.157135] sp : cf3fbac8  ip : 001c20a8  fp : cf3fbb80
[   28.168731] r10: cf824000  r9 : 8053  r8 : 0001
[   28.174011] r7 : 0008  r6 : cf3fbb80  r5 : fa0ab000  r4 : cf824168
[   28.180603] r3 :   r2 : cf3923c0  r1 : 0001  r0 : cf824168
[   28.187194] Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment 
user
[   28.194580] Control: 10c5387d  Table: 8fea4019  DAC: 0015
[   28.200408] Process modprobe (pid: 405, stack limit = 0xcf3fa2e8)
[   28.206573] Stack: (0xcf3fbac8 to 0xcf3fc000)
[   28.210968] bac0:   2303 cf824168 cf3fbb80 c01bc3ec 
2303 
[   28.219238] bae0: 0008 ce8544c0 0001  cf824000 c01a8280 
cf3fbb80 
[   28.227539] bb00: cf3923c0 c026ef98 842b0152  0001  
c04f1f34 0004
[   28.235809] bb20:  c026ef98 0001 cf3923c0 0006 0007 
cf3fbbf4 
[   28.244079] bb40: 0024 c0071598 cf3923c0 c0071a20 cf3fbbd0 2053 
cf3fbbf4 c00718d0
[   28.252349] bb60: cf3923c0 cf3923f0 c051e63c c00701b8 cf3fbbe0 cf3fbbd0 
c0a6b1b0 c00701b8
[   28.260620] bb80: cf3fbbe0 cf3fbbd0 c0a6b1b0 03e8 ce8544c0 cf3fbbcc 
 03e8
[   28.268890] bba0: ce8544c0 0001  cf3fbc2c cf3a0c00 c01a9d30 
0001 cf3923c0
[   28.277160] bbc0: 0006 0007 0001  0001 dead4ead 
 
[   28.285430] bbe0: c0a6b1b0  c030a3fb  ce8544c0 cf3fbbf4 
cf3fbbf4 c00a7f60
[   28.293731] bc00:   cfeb6340 0008 0023 0001 
0003 c01a9fcc
[   28.302001] bc20: c036e25c 8100 c036e25c c004f0a8  0002 
cfeaf400 0005
[   28.310272] bc40:   0010 cfeaf200 ce852f80 c01a1104 
0008 0001
[   28.318542] bc60:   03e8 cfeaf400 0005 c01a1668 
40408180 cfeaf400
[   28.326812] bc80: cfeaf400 cfeaf220  c01a21cc cf800140 00d0 
cf3a0c00 cf3a0c00
[   28.335083] bca0: ce854540 6053 cf800140 40408180 0004 cfeaf400 
cfeaf220 cf3a0c00
[   28.343353] bcc0: 0010 cfeaf200 ce852f80 c01a4de0 c0312a3e  
cfeb63c0 000f
[   28.351623] bce0: 1388 c0071598 cf3923c0 c026cd88 6053 cf3a0f3c 
c04f1da0 c00718d0
[   28.359924] bd00: cf3a0f64 cf3a0f3c 6053  cf3a0c00 cfeaf220 
cfeaf200 
[   28.368194] bd20: cf3a0c00 c04f1da0 c04f1e84 c04f1d4c cfeaf228 c01ac620 
 cfeaf220
[   28.376464] bd40: c04f1da0  cfeaf000  c04f2004 c0178838 
 c0178968
[   28.384735] bd60: cfeaf220  cfeaf000 c0177e30 cf8b5690 cf8b8c18 
cfeaf220 cfeaf254
[   28.393005] bd80:  c0178a1c cfeaf200 cfeaf220  c0177c80 
cfeaf200 c01768c4
[   28.401275] bda0: cfea

RE: [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode

2009-11-12 Thread Gadiyar, Anand
> Tero Kristo  writes:
> 
> > From: Tero Kristo 
> >
> > OMAP3 sleep can be prevented in some cases where OTG autoidle is enabled.
> > This patch force disables autoidle during wakeup from off-mode. See omap
> > errata 1.164.
> >
> > This fix can't be done in driver level, as off-mode entry resets and enables
> > the autoidle bit, and driver does not access the register after each 
> > off-mode
> > entry even if it is loaded.
> >
> > Signed-off-by: Tero Kristo 
> 
> Thanks Tero for the updated changelog.
> 
> Applying to PM branch reluctantly and with grumbles.  I sure hope
> someone in TI is reporting all these ROM code issues to the ROM code
> team so they get appropriate fixes.
> 
> Kevin

Yes, rest assured we're following these up with the HW teams.

This particular one should not matter on 3630, we can keep autoidle
enabled all the time, I think.

- Anand
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode

2009-11-12 Thread Kevin Hilman
Tero Kristo  writes:

> From: Tero Kristo 
>
> OMAP3 sleep can be prevented in some cases where OTG autoidle is enabled.
> This patch force disables autoidle during wakeup from off-mode. See omap
> errata 1.164.
>
> This fix can't be done in driver level, as off-mode entry resets and enables
> the autoidle bit, and driver does not access the register after each off-mode
> entry even if it is loaded.
>
> Signed-off-by: Tero Kristo 

Thanks Tero for the updated changelog.

Applying to PM branch reluctantly and with grumbles.  I sure hope
someone in TI is reporting all these ROM code issues to the ROM code
team so they get appropriate fixes.

Kevin

> ---
>  arch/arm/mach-omap2/pm34xx.c  |6 ++
>  arch/arm/mach-omap2/usb-musb.c|   14 --
>  arch/arm/plat-omap/include/plat/usb.h |3 +++
>  3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 2f9f4a0..ab7b30f 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -37,6 +37,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  
> @@ -496,6 +497,11 @@ void omap_sram_idle(void)
>   omap3_prcm_restore_context();
>   omap3_sram_restore_context();
>   omap2_sms_restore_context();
> + /*
> +  * Errata 1.164 fix : OTG autoidle can prevent
> +  * sleep
> +  */
> + usb_musb_disable_autoidle();
>   }
>   omap_uart_resume_idle(0);
>   omap_uart_resume_idle(1);
> diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
> index f5364b8..bb3cee4 100644
> --- a/arch/arm/mach-omap2/usb-musb.c
> +++ b/arch/arm/mach-omap2/usb-musb.c
> @@ -44,10 +44,11 @@ static struct platform_device dummy_pdev = {
>   },
>  };
>  
> +static void __iomem *otg_base;
> +static struct clk *otg_clk;
> +
>  static void __init usb_musb_pm_init(void)
>  {
> - void __iomem *otg_base;
> - struct clk *otg_clk;
>   struct device *dev = &dummy_pdev.dev;
>  
>   if (!cpu_is_omap34xx())
> @@ -74,12 +75,13 @@ static void __init usb_musb_pm_init(void)
>   cpu_relax();
>   }
>  
> - if (otg_clk) {
> + if (otg_clk)
>   clk_disable(otg_clk);
> - clk_put(otg_clk);
> - }
> +}
>  
> - iounmap(otg_base);
> +void usb_musb_disable_autoidle(void)
> +{
> + __raw_writel(0, otg_base + OTG_SYSCONFIG);
>  }
>  
>  #ifdef CONFIG_USB_MUSB_SOC
> diff --git a/arch/arm/plat-omap/include/plat/usb.h 
> b/arch/arm/plat-omap/include/plat/usb.h
> index 33a500e..31b13bc 100644
> --- a/arch/arm/plat-omap/include/plat/usb.h
> +++ b/arch/arm/plat-omap/include/plat/usb.h
> @@ -46,6 +46,9 @@ extern void usb_musb_init(void);
>  
>  extern void usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata);
>  
> +/* This is needed for OMAP3 errata 1.164: enabled autoidle can prevent sleep 
> */
> +extern void usb_musb_disable_autoidle(void);
> +
>  #endif
>  
>  void omap_usb_init(struct omap_usb_config *pdata);
> -- 
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode

2009-11-12 Thread Tero Kristo
From: Tero Kristo 

OMAP3 sleep can be prevented in some cases where OTG autoidle is enabled.
This patch force disables autoidle during wakeup from off-mode. See omap
errata 1.164.

This fix can't be done in driver level, as off-mode entry resets and enables
the autoidle bit, and driver does not access the register after each off-mode
entry even if it is loaded.

Signed-off-by: Tero Kristo 
---
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 arch/arm/mach-omap2/usb-musb.c|   14 --
 arch/arm/plat-omap/include/plat/usb.h |3 +++
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 2f9f4a0..ab7b30f 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -496,6 +497,11 @@ void omap_sram_idle(void)
omap3_prcm_restore_context();
omap3_sram_restore_context();
omap2_sms_restore_context();
+   /*
+* Errata 1.164 fix : OTG autoidle can prevent
+* sleep
+*/
+   usb_musb_disable_autoidle();
}
omap_uart_resume_idle(0);
omap_uart_resume_idle(1);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index f5364b8..bb3cee4 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -44,10 +44,11 @@ static struct platform_device dummy_pdev = {
},
 };
 
+static void __iomem *otg_base;
+static struct clk *otg_clk;
+
 static void __init usb_musb_pm_init(void)
 {
-   void __iomem *otg_base;
-   struct clk *otg_clk;
struct device *dev = &dummy_pdev.dev;
 
if (!cpu_is_omap34xx())
@@ -74,12 +75,13 @@ static void __init usb_musb_pm_init(void)
cpu_relax();
}
 
-   if (otg_clk) {
+   if (otg_clk)
clk_disable(otg_clk);
-   clk_put(otg_clk);
-   }
+}
 
-   iounmap(otg_base);
+void usb_musb_disable_autoidle(void)
+{
+   __raw_writel(0, otg_base + OTG_SYSCONFIG);
 }
 
 #ifdef CONFIG_USB_MUSB_SOC
diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 33a500e..31b13bc 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -46,6 +46,9 @@ extern void usb_musb_init(void);
 
 extern void usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata);
 
+/* This is needed for OMAP3 errata 1.164: enabled autoidle can prevent sleep */
+extern void usb_musb_disable_autoidle(void);
+
 #endif
 
 void omap_usb_init(struct omap_usb_config *pdata);
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html