From: khilman@linaro.org (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 01/18] ARM: OMAP4+: PM: Consolidate MPU subsystem PM code for re-use
Date: Wed, 03 Apr 2013 12:44:47 -0700 [thread overview]
Message-ID: <87a9pfxuts.fsf@linaro.org> (raw)
In-Reply-To: <1364205910-32392-2-git-send-email-santosh.shilimkar@ti.com> (Santosh Shilimkar's message of "Mon, 25 Mar 2013 15:34:53 +0530")
Hi Santosh,
Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
> OMAP5 and future OMAP based SOCs has backward compatible MPUSS
> IP block with OMAP4. It's programming model is mostly similar.
> Hence consolidate the OMAP MPUSS code so that it can be re-used
> on OMAP5 and future SOCs.
>
> No functional change.
>
> Acked-by: Nishanth Menon <nm@ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> ---
> arch/arm/mach-omap2/omap-mpuss-lowpower.c | 65 ++++++++++++++++++++++++-----
> 1 file changed, 54 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
> index d650f91..d9e4843 100644
> --- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
> +++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
> @@ -71,10 +71,46 @@ struct omap4_cpu_pm_info {
> void (*secondary_startup)(void);
> };
>
> +/**
> + * struct cpu_pm_ops - CPU pm operations
> + * @finish_suspend: CPU suspend finisher function pointer
> + * @resume: CPU resume function pointer
> + * @scu_prepare: CPU Snoop Control program function pointer
> + *
> + * Structure holds functions pointer for CPU low power operations like
> + * suspend, resume and scu programming.
> + */
> +struct cpu_pm_ops {
> + int (*finish_suspend)(unsigned long cpu_state);
> + void (*resume)(void);
> + void (*scu_prepare)(unsigned int cpu_id, unsigned int cpu_state);
> +};
> +
> +extern int omap4_finish_suspend(unsigned long cpu_state);
> +extern void omap4_cpu_resume(void);
checkpatch should've yelled at you for adding externs to .c files.
Also, aren't these already defined in common.h anyways?
Otherwise, patch looks fine.
Kevin
> static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
> static struct powerdomain *mpuss_pd;
> static void __iomem *sar_base;
>
> +static int default_finish_suspend(unsigned long cpu_state)
> +{
> + omap_do_wfi();
> + return 0;
> +}
> +
> +static void dummy_cpu_resume(void)
> +{}
> +
> +static void dummy_scu_prepare(unsigned int cpu_id, unsigned int cpu_state)
> +{}
> +
> +struct cpu_pm_ops omap_pm_ops = {
> + .finish_suspend = default_finish_suspend,
> + .resume = dummy_cpu_resume,
> + .scu_prepare = dummy_scu_prepare,
> +};
> +
> /*
> * Program the wakeup routine address for the CPU0 and CPU1
> * used for OFF or DORMANT wakeup.
> @@ -172,11 +208,12 @@ static void save_l2x0_context(void)
> {
> u32 val;
> void __iomem *l2x0_base = omap4_get_l2cache_base();
> -
> - val = __raw_readl(l2x0_base + L2X0_AUX_CTRL);
> - __raw_writel(val, sar_base + L2X0_AUXCTRL_OFFSET);
> - val = __raw_readl(l2x0_base + L2X0_PREFETCH_CTRL);
> - __raw_writel(val, sar_base + L2X0_PREFETCH_CTRL_OFFSET);
> + if (l2x0_base) {
> + val = __raw_readl(l2x0_base + L2X0_AUX_CTRL);
> + __raw_writel(val, sar_base + L2X0_AUXCTRL_OFFSET);
> + val = __raw_readl(l2x0_base + L2X0_PREFETCH_CTRL);
> + __raw_writel(val, sar_base + L2X0_PREFETCH_CTRL_OFFSET);
> + }
> }
> #else
> static void save_l2x0_context(void)
> @@ -239,17 +276,17 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
>
> cpu_clear_prev_logic_pwrst(cpu);
> pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
> - set_cpu_wakeup_addr(cpu, virt_to_phys(omap4_cpu_resume));
> - scu_pwrst_prepare(cpu, power_state);
> + set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.resume));
> + omap_pm_ops.scu_prepare(cpu, power_state);
> l2x0_pwrst_prepare(cpu, save_state);
>
> /*
> * Call low level function with targeted low power state.
> */
> if (save_state)
> - cpu_suspend(save_state, omap4_finish_suspend);
> + cpu_suspend(save_state, omap_pm_ops.finish_suspend);
> else
> - omap4_finish_suspend(save_state);
> + omap_pm_ops.finish_suspend(save_state);
>
> /*
> * Restore the CPUx power state to ON otherwise CPUx
> @@ -285,14 +322,14 @@ int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
> pwrdm_clear_all_prev_pwrst(pm_info->pwrdm);
> pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
> set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup));
> - scu_pwrst_prepare(cpu, power_state);
> + omap_pm_ops.scu_prepare(cpu, power_state);
>
> /*
> * CPU never retuns back if targeted power state is OFF mode.
> * CPU ONLINE follows normal CPU ONLINE ptah via
> * omap_secondary_startup().
> */
> - omap4_finish_suspend(cpu_state);
> + omap_pm_ops.finish_suspend(cpu_state);
>
> pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON);
> return 0;
> @@ -369,6 +406,12 @@ int __init omap4_mpuss_init(void)
>
> save_l2x0_context();
>
> + if (cpu_is_omap44xx()) {
> + omap_pm_ops.finish_suspend = omap4_finish_suspend;
> + omap_pm_ops.resume = omap4_cpu_resume;
> + omap_pm_ops.scu_prepare = scu_pwrst_prepare;
> + }
> +
> return 0;
> }
next prev parent reply other threads:[~2013-04-03 19:44 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 10:04 [PATCH v2 00/18] ARM: OMAP5: PM: Add MPUSS suspend and CPUidle support Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 01/18] ARM: OMAP4+: PM: Consolidate MPU subsystem PM code for re-use Santosh Shilimkar
2013-04-03 19:44 ` Kevin Hilman [this message]
2013-04-04 11:32 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 02/18] ARM: OMAP5: PM: Update CPU context register offset Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 03/18] ARM: OMAP4+: PM: Consolidate and use OMAP4 PM code for OMAP5 Santosh Shilimkar
2013-04-03 20:20 ` Kevin Hilman
2013-04-04 11:51 ` Santosh Shilimkar
2013-04-04 11:55 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 04/18] ARM: OMAP5: PM: Set MPUSS-EMIF clock-domain static dependency Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 05/18] ARM: OMAP5: PM: Enables ES2 PM mode by default Santosh Shilimkar
2013-04-03 20:25 ` Kevin Hilman
2013-04-04 12:02 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 06/18] ARM: OMAP5: PM: Enable Mercury retention mode on CPUx powerdomains Santosh Shilimkar
2013-04-03 20:31 ` Kevin Hilman
2013-04-04 12:08 ` Santosh Shilimkar
2013-03-25 10:04 ` [PATCH v2 07/18] ARM: OMAP5: Add init_late() hook to enable pm initialization Santosh Shilimkar
2013-04-03 20:33 ` Kevin Hilman
2013-04-04 12:28 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 08/18] ARM: OMAP5: PM: Add CPU power off in hotplug path Santosh Shilimkar
2013-04-03 20:49 ` Kevin Hilman
2013-04-04 13:23 ` Santosh Shilimkar
2013-04-04 17:31 ` Kevin Hilman
2013-04-05 9:04 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 09/18] ARM: OMAP4+: PM: Restore CPU power state to ON with clockdomain force wakeup method Santosh Shilimkar
2013-04-03 20:54 ` Kevin Hilman
2013-04-04 13:37 ` Santosh Shilimkar
2013-04-04 17:42 ` Kevin Hilman
2013-04-05 9:07 ` Santosh Shilimkar
2013-04-05 11:58 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 10/18] ARM: OMAP5: PM: Add MPU Open Switch Retention support Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 11/18] ARM: OMAP5: PM: Add L2 memory power down support Santosh Shilimkar
2013-04-03 20:58 ` Kevin Hilman
2013-04-04 13:46 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 12/18] ARM: OMAP4: CPUidle: Avoid double idle driver registration Santosh Shilimkar
2013-04-03 21:03 ` Kevin Hilman
2013-04-04 13:47 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 13/18] ARM: OMAP: CPUidle: Unregister drivere on device registration failure Santosh Shilimkar
2013-04-03 21:03 ` Kevin Hilman
2013-04-04 13:48 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 14/18] ARM: OMAP4: CPUidle: Make C-state description field more precise Santosh Shilimkar
2013-04-03 21:05 ` Kevin Hilman
2013-04-04 13:48 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 15/18] ARM: OMAP4+: CPUidle: Consolidate idle driver for OMAP5 support Santosh Shilimkar
2013-04-03 21:10 ` Kevin Hilman
2013-04-04 14:04 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 16/18] ARM: OMAP4+: CPUidle: Deprecate use of omap4_mpuss_read_prev_context_state() Santosh Shilimkar
2013-04-03 21:37 ` Kevin Hilman
2013-04-04 13:59 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 17/18] ARM: OMAP4+: CPUidle: Add OMAP5 idle driver support Santosh Shilimkar
2013-04-03 21:25 ` Kevin Hilman
2013-04-04 14:16 ` Santosh Shilimkar
2013-04-04 17:55 ` Kevin Hilman
2013-04-05 9:41 ` Santosh Shilimkar
2013-03-25 10:05 ` [PATCH v2 18/18] ARM: OMAP5: PM: handle device instance for warm reset Santosh Shilimkar
2013-03-25 11:46 ` [PATCH v2 00/18] ARM: OMAP5: PM: Add MPUSS suspend and CPUidle support Lokesh Vutla
2013-03-25 12:10 ` Santosh Shilimkar
2013-03-25 12:27 ` Sourav Poddar
2013-03-25 12:47 ` Rajendra Nayak
2013-03-25 13:00 ` Sourav Poddar
2013-04-03 22:52 ` Kevin Hilman
2013-04-04 14:34 ` Santosh Shilimkar
2013-04-04 16:49 ` Santosh Shilimkar
2013-04-04 17:57 ` Kevin Hilman
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=87a9pfxuts.fsf@linaro.org \
--to=khilman@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).