public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: khilman@ti•com (Kevin Hilman)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH] ARM: OMAP3xxx: clockdomain: fix software supervised wakeup/sleep
Date: Fri, 27 Jul 2012 06:38:53 -0700	[thread overview]
Message-ID: <87y5m5l3wy.fsf@ti.com> (raw)
In-Reply-To: <CACYZBRHmO3a3oBwbFP8GqDQj3xB7nB59TkzxAbFrZ2=h0VX3-g@mail.gmail.com> (Rajendra Nayak's message of "Fri, 27 Jul 2012 13:28:45 +0530")

"Nayak, Rajendra" <rnayak@ti•com> writes:

> Paul,
>
> On Fri, Jul 27, 2012 at 2:34 AM, Paul Walmsley <paul@pwsan•com> wrote:
>>
>> Commit 4da71ae6 ("OMAP: clockdomain: Arch specific funcs for
>> clkdm_clk_enable/disable") called the OMAP2xxx-specific functions for
>> clockdomain wakeup and sleep.  This would probably have broken
>> software-supervised clockdomain wakeup and sleep on OMAP3.
>
> Would something like this be better than duplicating most of
> omap2_clkdm_clk_enable/disable?

Not when using cpu_is* checks at runtime.  Maybe if you setup function
pointers at init time?

Kevin

> ---
>  arch/arm/mach-omap2/clockdomain2xxx_3xxx.c |   25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
> ===================================================================
> --- linux-2.6.orig/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
> 2012-07-27 13:15:49.238134472 +0530
> +++ linux-2.6/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
> 2012-07-27 13:22:01.607380032 +0530
> @@ -162,6 +162,27 @@
>                                                 clkdm->clktrctrl_mask);
>  }
>
> +static void _clkdm_sleep(struct clockdomain *clkdm)
> +{
> +       if (cpu_is_omap24xx())
> +               omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
> +                                       clkdm->pwrdm.ptr->prcm_offs,
> +                                       OMAP2_PM_PWSTCTRL);
> +       else if (cpu_is_omap34xx())
> +               omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
> +                                       clkdm->clktrctrl_mask);
> +}
> +
> +static void _clkdm_wakeup(struct clockdomain *clkdm)
> +{
> +       if (cpu_is_omap24xx())
> +               omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
> +                                       clkdm->pwrdm.ptr->prcm_offs,
> +                                       OMAP2_PM_PWSTCTRL);
> +       else if (cpu_is_omap34xx())
> +               omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
> +                                       clkdm->clktrctrl_mask);
> +}
>
>  static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
>  {
> @@ -180,7 +201,7 @@
>                 _enable_hwsup(clkdm);
>         } else {
>                 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
> -                       omap2_clkdm_wakeup(clkdm);
> +                       _clkdm_wakeup(clkdm);
>         }
>
>         return 0;
> @@ -203,7 +224,7 @@
>                 _enable_hwsup(clkdm);
>         } else {
>                 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
> -                       omap2_clkdm_sleep(clkdm);
> +                       _clkdm_sleep(clkdm);
>         }
>
>>
>> Signed-off-by: Paul Walmsley <paul@pwsan•com>
>> Cc: Rajendra Nayak <rnayak@ti•com>
>> Cc: Jon Hunter <jon-hunter@ti•com>
>> ---
>>  arch/arm/mach-omap2/clockdomain2xxx_3xxx.c |   50 ++++++++++++++++++++++++++--
>>  1 file changed, 48 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
>> index a0d68db..f99e65c 100644
>> --- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
>> +++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
>> @@ -241,6 +241,52 @@ static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
>>                 _clkdm_del_autodeps(clkdm);
>>  }
>>
>> +static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
>> +{
>> +       bool hwsup = false;
>> +
>> +       if (!clkdm->clktrctrl_mask)
>> +               return 0;
>> +
>> +       hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
>> +                               clkdm->clktrctrl_mask);
>> +
>> +       if (hwsup) {
>> +               /* Disable HW transitions when we are changing deps */
>> +               _disable_hwsup(clkdm);
>> +               _clkdm_add_autodeps(clkdm);
>> +               _enable_hwsup(clkdm);
>> +       } else {
>> +               if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
>> +                       omap3_clkdm_wakeup(clkdm);
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>> +static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
>> +{
>> +       bool hwsup = false;
>> +
>> +       if (!clkdm->clktrctrl_mask)
>> +               return 0;
>> +
>> +       hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
>> +                               clkdm->clktrctrl_mask);
>> +
>> +       if (hwsup) {
>> +               /* Disable HW transitions when we are changing deps */
>> +               _disable_hwsup(clkdm);
>> +               _clkdm_del_autodeps(clkdm);
>> +               _enable_hwsup(clkdm);
>> +       } else {
>> +               if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
>> +                       omap3_clkdm_sleep(clkdm);
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>>  struct clkdm_ops omap2_clkdm_operations = {
>>         .clkdm_add_wkdep        = omap2_clkdm_add_wkdep,
>>         .clkdm_del_wkdep        = omap2_clkdm_del_wkdep,
>> @@ -267,6 +313,6 @@ struct clkdm_ops omap3_clkdm_operations = {
>>         .clkdm_wakeup           = omap3_clkdm_wakeup,
>>         .clkdm_allow_idle       = omap3_clkdm_allow_idle,
>>         .clkdm_deny_idle        = omap3_clkdm_deny_idle,
>> -       .clkdm_clk_enable       = omap2_clkdm_clk_enable,
>> -       .clkdm_clk_disable      = omap2_clkdm_clk_disable,
>> +       .clkdm_clk_enable       = omap3xxx_clkdm_clk_enable,
>> +       .clkdm_clk_disable      = omap3xxx_clkdm_clk_disable,
>>  };
>> --
>> 1.7.10.4
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2012-07-27 13:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 21:04 [PATCH] ARM: OMAP3xxx: clockdomain: fix software supervised wakeup/sleep Paul Walmsley
2012-07-27  5:43 ` Rajendra Nayak
2012-07-31  4:41   ` Jon Hunter
2012-07-31  5:41     ` Rajendra Nayak
2012-07-31 18:12       ` Jon Hunter
2012-07-27  7:58 ` Nayak, Rajendra
2012-07-27 13:38   ` Kevin Hilman [this message]
2012-07-30 16:29   ` Paul Walmsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y5m5l3wy.fsf@ti.com \
    --to=khilman@ti$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox