Subject: [PATCH v3 1/2] ARM: OMAP2+: omap_hwmod: Add api to enable/disable module level wakeup events

From: [email-masked] (Tony Lindgren)
Date: Tue, 24 Apr 2012 09:07:40 -0700

* Govindraj.R <[email-masked]> [120424 07:12]:
> From: "Govindraj.R" <[email-masked]>
> 
> On 24xx/34xx/36xx Module level wakeup events are enabled/disabled using
> PM_WKEN1_CORE/PM_WKEN_PER regs.
> 
> Add api to control the module level wakeup mechanism from info provided from
> hwmod data.
> 
> omap_hwmod_enable/disable_wakeup is used from serial.c which should
> configure PM_WKEN register to enable or disable the module level wakeup.
> 
> Cc: Tero Kristo <[email-masked]>
> Cc: Tony Lindgren <[email-masked]>
> Cc: Paul Walmsley <[email-masked]>
> Cc: Kevin Hilman <[email-masked]>
> Cc: Benoit Cousson <[email-masked]>
> Cc: Rajendra Nayak <[email-masked]>
> Cc: Santosh Shilimkar <[email-masked]>
> Signed-off-by: Govindraj.R <[email-masked]>
> ---
>  arch/arm/mach-omap2/omap_hwmod.c   |   22 ++++++++++++++++++++++
>  arch/arm/mach-omap2/prm2xxx_3xxx.c |   16 ++++++++++++++++
>  arch/arm/mach-omap2/prm2xxx_3xxx.h |    9 +++++++++
>  3 files changed, 47 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
> index 2c27fdb..4f10619 100644
> --- a/arch/arm/mach-omap2/omap_hwmod.c
> +++ b/arch/arm/mach-omap2/omap_hwmod.c
> @@ -382,6 +382,26 @@ static int _set_module_autoidle(struct omap_hwmod *oh, u8 autoidle,
>  }
>  
>  /**
> + * _enable_module_level_wakeup - enable/disable module level wakeup on hwmod.
> + * @oh: struct omap_hwmod *
> + * @set_wake: bool value indicating to set (true) or clear (false) module level
> + *		wakeup enable
> + *
> + * Set or clear the  module level wakeup capability the
> + * hwmod @oh. This function configures th PM_WKEN reg bits if they
> + * are available from hwmod. No return value
> + */
> +static void _enable_module_level_wakeup(struct omap_hwmod *oh, bool set_wake)
> +{
> +	if (cpu_is_omap24xx() || cpu_is_omap34xx())
> +		omap2_prm_enable_prcm_module_wakeup(
> +				oh->prcm.omap2.module_offs,
> +				oh->prcm.omap2.prcm_reg_id,
> +				oh->prcm.omap2.idlest_idle_bit,
> +				set_wake);
> +}

Please don't sprinkle cpu_is_omap tests into code that gets called multiple times.
Initialize things properly during init instead.

Regards,

Tony