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

2009-11-12 Thread Kevin Hilman
"Gadiyar, Anand"  writes:

> Kevin Hilman 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.
>> >
>> > Signed-off-by: Tero Kristo 
>> 
>> This one needs a refresh against current PM branch.
>> 
>> > ---
>> >  arch/arm/mach-omap2/pm34xx.c  |6 ++
>> >  arch/arm/mach-omap2/usb-musb.c|   14 --
>> >  arch/arm/plat-omap/include/mach/usb.h |3 +++
>> 
>> mach/usb.h moved to plat/usb.h
>> 
>> >  3 files changed, 17 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
>> > index 5eb7321..070a0a2 100644
>> > --- a/arch/arm/mach-omap2/pm34xx.c
>> > +++ b/arch/arm/mach-omap2/pm34xx.c
>> > @@ -39,6 +39,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();
>> 
>> NAK.  This belongs in the MUSB driver, not in the idle path.
>> 
>
> Kevin,
>
> When we exit off-mode, the autoidle will get enabled, and needs
> an explicit disable. If the MUSB driver is not loaded, there will
> be no one to do this.
>

OK, thanks for the clarification.  The changelog should be updated to
describe this problem in more detail.

Kevin

>
>> Kevin
>> 
>> >}
>> >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 8dde0b7..f4b86c0 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/mach/usb.h 
>> > b/arch/arm/plat-omap/include/mach/usb.h
>> > index a4068a4..310ee17 100644
>> > --- a/arch/arm/plat-omap/include/mach/usb.h
>> > +++ b/arch/arm/plat-omap/include/mach/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);
--
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 11/11] OMAP3: PM: Disable OTG autoidle when waking up from off-mode

2009-11-12 Thread Tero.Kristo
 

>-Original Message-
>From: ext Gadiyar, Anand [mailto:gadi...@ti.com] 
>Sent: 12 November, 2009 08:25
>To: Kevin Hilman; Kristo Tero (Nokia-D/Tampere)
>Cc: linux-omap@vger.kernel.org
>Subject: RE: [PATCH 11/11] OMAP3: PM: Disable OTG autoidle 
>when waking up from off-mode
>
>Kevin Hilman 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.
>> >
>> > Signed-off-by: Tero Kristo 
>> 
>> This one needs a refresh against current PM branch.
>> 
>> > ---
>> >  arch/arm/mach-omap2/pm34xx.c  |6 ++
>> >  arch/arm/mach-omap2/usb-musb.c|   14 --
>> >  arch/arm/plat-omap/include/mach/usb.h |3 +++
>> 
>> mach/usb.h moved to plat/usb.h
>> 
>> >  3 files changed, 17 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/arch/arm/mach-omap2/pm34xx.c 
>b/arch/arm/mach-omap2/pm34xx.c
>> > index 5eb7321..070a0a2 100644
>> > --- a/arch/arm/mach-omap2/pm34xx.c
>> > +++ b/arch/arm/mach-omap2/pm34xx.c
>> > @@ -39,6 +39,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();
>> 
>> NAK.  This belongs in the MUSB driver, not in the idle path.
>> 
>
>Kevin,
>
>When we exit off-mode, the autoidle will get enabled, and needs
>an explicit disable. If the MUSB driver is not loaded, there will
>be no one to do this.

Also, even if the driver is loaded, it doesn't disable this bit each sleep 
cycle.

>
>- Anand
>
>> Kevin
>> 
>> >}
>> >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 8dde0b7..f4b86c0 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/mach/usb.h 
>b/arch/arm/plat-omap/include/mach/usb.h
>> > index a4068a4..310ee17 100644
>> > --- a/arch/arm/plat-omap/include/mach/usb.h
>> > +++ b/arch/arm/plat-omap/include/mach/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);
>--
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 11/11] OMAP3: PM: Disable OTG autoidle when waking up from off-mode

2009-11-11 Thread Gadiyar, Anand


> > > @@ -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();
> > 
> > NAK.  This belongs in the MUSB driver, not in the idle path.
> > 
> 
> Kevin,
> 
> When we exit off-mode, the autoidle will get enabled, and needs
> an explicit disable. If the MUSB driver is not loaded, there will
> be no one to do this.
> 
> - Anand
> 
> > Kevin
> > 
> > >   }
> > >   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 8dde0b7..f4b86c0 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())

Just realized, this probably should read cpu_is_omap3430().

cpu_is_omap34xx is true for 3630 as well, and this chip doesn't need
this workaround.

(Won't hurt much to have this like this for now - until we switch to
the CHIP_HAS_ERRATA way)

- 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 11/11] OMAP3: PM: Disable OTG autoidle when waking up from off-mode

2009-11-11 Thread Gadiyar, Anand
Kevin Hilman 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.
> >
> > Signed-off-by: Tero Kristo 
> 
> This one needs a refresh against current PM branch.
> 
> > ---
> >  arch/arm/mach-omap2/pm34xx.c  |6 ++
> >  arch/arm/mach-omap2/usb-musb.c|   14 --
> >  arch/arm/plat-omap/include/mach/usb.h |3 +++
> 
> mach/usb.h moved to plat/usb.h
> 
> >  3 files changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> > index 5eb7321..070a0a2 100644
> > --- a/arch/arm/mach-omap2/pm34xx.c
> > +++ b/arch/arm/mach-omap2/pm34xx.c
> > @@ -39,6 +39,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();
> 
> NAK.  This belongs in the MUSB driver, not in the idle path.
> 

Kevin,

When we exit off-mode, the autoidle will get enabled, and needs
an explicit disable. If the MUSB driver is not loaded, there will
be no one to do this.

- Anand

> Kevin
> 
> > }
> > 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 8dde0b7..f4b86c0 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/mach/usb.h 
> > b/arch/arm/plat-omap/include/mach/usb.h
> > index a4068a4..310ee17 100644
> > --- a/arch/arm/plat-omap/include/mach/usb.h
> > +++ b/arch/arm/plat-omap/include/mach/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);
--
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 11/11] OMAP3: PM: Disable OTG autoidle when waking up from off-mode

2009-11-11 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.
>
> Signed-off-by: Tero Kristo 

This one needs a refresh against current PM branch.

> ---
>  arch/arm/mach-omap2/pm34xx.c  |6 ++
>  arch/arm/mach-omap2/usb-musb.c|   14 --
>  arch/arm/plat-omap/include/mach/usb.h |3 +++

mach/usb.h moved to plat/usb.h

>  3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 5eb7321..070a0a2 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -39,6 +39,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();

NAK.  This belongs in the MUSB driver, not in the idle path.

Kevin

>   }
>   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 8dde0b7..f4b86c0 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/mach/usb.h 
> b/arch/arm/plat-omap/include/mach/usb.h
> index a4068a4..310ee17 100644
> --- a/arch/arm/plat-omap/include/mach/usb.h
> +++ b/arch/arm/plat-omap/include/mach/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