linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jean.pihet@newoldbits.com (Jean Pihet)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 14/25] OMAP4: PM: Add CPUX OFF mode support
Date: Thu, 8 Sep 2011 21:39:28 +0200	[thread overview]
Message-ID: <CAORVsuUXtiitSTMB0MTJPobppqKymmYFsDpsOqALP8UV7Pm+dQ@mail.gmail.com> (raw)
In-Reply-To: <1315144466-9395-15-git-send-email-santosh.shilimkar@ti.com>

On Sun, Sep 4, 2011 at 3:54 PM, Santosh Shilimkar
<santosh.shilimkar@ti.com> wrote:
> This patch adds the CPU0 and CPU1 off mode support. CPUX close switch
> retention (CSWR) is not supported by hardware design.
>
> The CPUx OFF mode isn't supported on OMAP4430 ES1.0
>
> CPUx sleep code is common for hotplug, suspend and CPUilde.
>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> ---
> ?arch/arm/mach-omap2/Makefile ? ? ? ? ? ? ? ? ? ?| ? ?3 +-
> ?arch/arm/mach-omap2/include/mach/omap-secure.h ?| ? ?8 +
> ?arch/arm/mach-omap2/include/mach/omap4-common.h | ? 25 +++
> ?arch/arm/mach-omap2/omap-mpuss-lowpower.c ? ? ? | ?249 +++++++++++++++++++++++
> ?arch/arm/mach-omap2/omap-smp.c ? ? ? ? ? ? ? ? ?| ? ?6 +
> ?arch/arm/mach-omap2/omap4-sar-layout.h ? ? ? ? ?| ? ?9 +
> ?arch/arm/mach-omap2/pm44xx.c ? ? ? ? ? ? ? ? ? ?| ? ?6 +
> ?arch/arm/mach-omap2/sleep44xx.S ? ? ? ? ? ? ? ? | ?213 +++++++++++++++++++
> ?8 files changed, 518 insertions(+), 1 deletions(-)
> ?create mode 100644 arch/arm/mach-omap2/omap-mpuss-lowpower.c
>
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index b032c21..b4f2eeb 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -63,7 +63,8 @@ obj-$(CONFIG_ARCH_OMAP2) ? ? ? ? ? ? ?+= pm24xx.o
> ?obj-$(CONFIG_ARCH_OMAP2) ? ? ? ? ? ? ? += sleep24xx.o
> ?obj-$(CONFIG_ARCH_OMAP3) ? ? ? ? ? ? ? += pm34xx.o sleep34xx.o \
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cpuidle34xx.o
> -obj-$(CONFIG_ARCH_OMAP4) ? ? ? ? ? ? ? += pm44xx.o sleep44xx.o
> +obj-$(CONFIG_ARCH_OMAP4) ? ? ? ? ? ? ? += pm44xx.o sleep44xx.o \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?omap-mpuss-lowpower.o
> ?obj-$(CONFIG_PM_DEBUG) ? ? ? ? ? ? ? ? += pm-debug.o
> ?obj-$(CONFIG_OMAP_SMARTREFLEX) ? ? ? ? ?+= sr_device.o smartreflex.o
> ?obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) ?+= smartreflex-class3.o
> diff --git a/arch/arm/mach-omap2/include/mach/omap-secure.h b/arch/arm/mach-omap2/include/mach/omap-secure.h
> index e2f95a0..0062d49 100644
> --- a/arch/arm/mach-omap2/include/mach/omap-secure.h
> +++ b/arch/arm/mach-omap2/include/mach/omap-secure.h
> @@ -35,10 +35,18 @@
> ?#define OMAP4_HAL_SAVEALL_INDEX ? ? ? ? ? ? ? ?0x1c
> ?#define OMAP4_HAL_SAVEGIC_INDEX ? ? ? ? ? ? ? ?0x1d
>
> +/* Secure Monitor mode APIs */
> +#define OMAP4_MON_SCU_PWR_INDEX ? ? ? ? ? ? ? ?0x108
> +
> +/* Secure PPA(Primary Protected Application) APIs */
> +#define OMAP4_PPA_CPU_ACTRL_SMP_INDEX ?0x25
> +
> +#ifndef __ASSEMBLER__
> ?extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?u32 arg1, u32 arg2, u32 arg3, u32 arg4);
> ?extern u32 omap_smc2(u32 id, u32 falg, u32 pargs);
> ?extern phys_addr_t omap_secure_ram_mempool_base(void);
> ?extern int omap_secure_ram_reserve_memblock(void);
>
> +#endif /* __ASSEMBLER__ */
> ?#endif /* OMAP_ARCH_OMAP_SECURE_H */
> diff --git a/arch/arm/mach-omap2/include/mach/omap4-common.h b/arch/arm/mach-omap2/include/mach/omap4-common.h
> index 040dcf6..662f37c 100644
> --- a/arch/arm/mach-omap2/include/mach/omap4-common.h
> +++ b/arch/arm/mach-omap2/include/mach/omap4-common.h
> @@ -45,5 +45,30 @@ extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
> ?extern void omap_auxcoreboot_addr(u32 cpu_addr);
> ?extern u32 omap_read_auxcoreboot0(void);
> ?#endif
> +
> +#if defined(CONFIG_SMP) && defined(CONFIG_PM)
> +extern int omap4_mpuss_init(void);
> +extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state);
> +extern int omap4_finish_suspend(unsigned long cpu_state);
> +extern void omap4_cpu_resume(void);
> +#else
> +static inline int omap4_enter_lowpower(unsigned int cpu,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned int power_state)
> +{
> + ? ? ? omap_do_wfi();
> + ? ? ? return 0;
> +}
> +
> +static inline int omap4_mpuss_init(void)
> +{
> + ? ? ? return 0;
> +}
> +
> +static inline int omap4_finish_suspend(unsigned long cpu_state)
> +{}
The int function should return something (0?)
Has the code been test compiled without SMP and/or PM?

> +static inline void omap4_cpu_resume(void)
> +{}
> +#endif
> +
> ?#endif /* __ASSEMBLER__ */
> ?#endif /* OMAP_ARCH_OMAP4_COMMON_H */
> diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
...

> +/**
> + * omap4_enter_lowpower: OMAP4 MPUSS Low Power Entry Function
> + * The purpose of this function is to manage low power programming
> + * of OMAP4 MPUSS subsystem
> + * @cpu : CPU ID
> + * @power_state: Low power state.
> + */
> +int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
> +{
> + ? ? ? unsigned int save_state = 0;
> + ? ? ? unsigned int wakeup_cpu;
> +
> + ? ? ? if (omap_rev() == OMAP4430_REV_ES1_0)
> + ? ? ? ? ? ? ? return -ENXIO;
> +
> + ? ? ? switch (power_state) {
> + ? ? ? case PWRDM_POWER_ON:
> + ? ? ? case PWRDM_POWER_INACTIVE:
> + ? ? ? ? ? ? ? save_state = 0;
> + ? ? ? ? ? ? ? break;
> + ? ? ? case PWRDM_POWER_OFF:
> + ? ? ? ? ? ? ? save_state = 1;
> + ? ? ? ? ? ? ? break;
> + ? ? ? case PWRDM_POWER_RET:
> + ? ? ? default:
> + ? ? ? ? ? ? ? /*
> + ? ? ? ? ? ? ? ?* CPUx CSWR is invalid hardware state. Also CPUx OSWR
> + ? ? ? ? ? ? ? ?* doesn't make much scense, since logic is lost and $L1
> + ? ? ? ? ? ? ? ?* needs to be cleaned because of coherency. This makes
> + ? ? ? ? ? ? ? ?* CPUx OSWR equivalent to CPUX OFF and hence not supported
> + ? ? ? ? ? ? ? ?*/
> + ? ? ? ? ? ? ? WARN_ON(1);
> + ? ? ? ? ? ? ? return -ENXIO;
> + ? ? ? }
> +
> + ? ? ? clear_cpu_prev_pwrst(cpu);
> + ? ? ? set_cpu_next_pwrst(cpu, power_state);
> + ? ? ? set_cpu_wakeup_addr(cpu, virt_to_phys(omap4_cpu_resume));
> + ? ? ? scu_pwrst_prepare(cpu, power_state);
> +
> + ? ? ? /*
> + ? ? ? ?* Call low level function ?with targeted CPU id
> + ? ? ? ?* and its low power state.
> + ? ? ? ?*/
> + ? ? ? cpu_suspend(save_state, omap4_finish_suspend);
There is no CPU id parameter to the call although the above comment says so.

...

> diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S
...

> +/*
> + * =============================
> + * == CPU suspend finisher ==
> + * =============================
> + *
> + * void omap4_finish_suspend(unsigned long cpu_state)
> + *
> + * This function code saves the CPU context and performs the CPU
> + * power down sequence. Calling WFI effectively changes the CPU
> + * power domains states to the desired target power state.
> + *
> + * @cpu_state : contains context save state (r0)
> + * ? ? 0 - No context lost
> + * ? ? 1 - CPUx L1 and logic lost: MPUSS CSWR
> + * ? ? 2 - CPUx L1 and logic lost + GIC lost: MPUSS OSWR
> + * ? ? 3 - CPUx L1 and logic lost + GIC + L2 lost: MPUSS OFF
> + * @return: This function never returns for CPU OFF and DORMANT power states.
> + * Post WFI, CPU transitions to DORMANT or OFF power state and on wake-up
> + * from this follows a full CPU reset path via ROM code to CPU restore code.
Is the ROM code jumping to the physical address of omap4_cpu_resume?
If so please add it in the comment.

...

> +/*
> + * ============================
> + * == CPU resume entry point ==
> + * ============================
> + *
> + * void omap4_cpu_resume(void)
> + *
> + * ROM code jumps to this function while waking up from CPU
> + * OFF or DORMANT state. Physical address of the function is
> + * stored in the SAR RAM while entering to OFF or DORMANT mode.
Which code stores the address in the SAR RAM? Please describe it here.

> + */
> +ENTRY(omap4_cpu_resume)
> + ? ? ? /*
...

Regards,
Jean

  reply	other threads:[~2011-09-08 19:39 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-04 13:54 [PATCH 00/25] OMAP4: PM: suspend, CPU-hotplug and CPUilde support Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 01/25] ARM: mm: Add strongly ordered descriptor support Santosh Shilimkar
2011-09-13 20:23   ` Tony Lindgren
2011-09-14  5:36     ` Shilimkar, Santosh
2011-09-04 13:54 ` [PATCH 02/25] OMAP4: Redefine mandatory barriers for OMAP to include interconnect barriers Santosh Shilimkar
2011-09-13 20:27   ` Tony Lindgren
2011-09-14  5:39     ` Shilimkar, Santosh
2011-09-14 10:24     ` Santosh
2011-09-15 17:17       ` Kevin Hilman
2011-09-15 17:24         ` Shilimkar, Santosh
2011-09-15 17:53           ` Tony Lindgren
2011-09-15 18:22             ` Shilimkar, Santosh
2011-09-15 19:43               ` Tony Lindgren
2011-09-15 20:00                 ` Shilimkar, Santosh
2011-09-16 12:01                   ` Shilimkar, Santosh
2011-09-04 13:54 ` [PATCH 03/25] OMAP4: PM: Use custom omap_do_wfi() for suspend and default idle Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 04/25] OMAP4: Remove un-used do_wfi() macro Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 05/25] OMAP4: Use WARN_ON() instead of BUG_ON() with graceful exit Santosh Shilimkar
2011-09-05 10:11   ` Sergei Shtylyov
2011-09-05 10:42     ` Santosh
2011-09-05 10:47       ` Russell King - ARM Linux
2011-09-05 10:51         ` Santosh
2011-09-08 18:51           ` Jean Pihet
2011-09-04 13:54 ` [PATCH 06/25] OMAP4: Export omap4_get_base*() rather than global address pointers Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 07/25] OMAP4: PM: Add SAR RAM support Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 08/25] OMAP4: PM: Keep static dep between MPUSS-EMIF and MPUSS-L3 and DUCATI-L3 Santosh Shilimkar
2011-09-08 18:06   ` Kevin Hilman
2011-09-09  4:21     ` Santosh
2011-09-04 13:54 ` [PATCH 09/25] OMAP4: PM: Avoid omap4_pm_init() on OMAP4430 ES1.0 Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 10/25] OMAP4: PM: Initialise all the clockdomains to supported states Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 11/25] OMAP: Add Secure HAL and monitor mode API infrastructure Santosh Shilimkar
2011-09-08 18:58   ` Jean Pihet
2011-09-09  4:22     ` Santosh
2011-09-04 13:54 ` [PATCH 12/25] OMAP: Add support to allocate the memory for secure RAM Santosh Shilimkar
2011-09-08 19:19   ` Jean Pihet
2011-09-09  9:43     ` Santosh
2011-09-09 12:54       ` Jean Pihet
2011-09-09 14:09         ` Shilimkar, Santosh
2011-09-04 13:54 ` [PATCH 13/25] OMAP4: PM: Add WakeupGen module as OMAP gic_arch_extn Santosh Shilimkar
2011-09-08 18:27   ` Kevin Hilman
2011-09-09  4:29     ` Santosh
2011-09-09  7:19       ` Thomas Gleixner
2011-09-09  8:07         ` Santosh
2011-09-09  8:18           ` Thomas Gleixner
2011-09-09  9:05             ` Santosh
2011-09-12  7:56               ` Thomas Gleixner
2011-09-12  8:44                 ` Santosh
2011-09-08 19:16   ` Jean Pihet
2011-09-09  4:23     ` Santosh
2011-09-13 20:36   ` Tony Lindgren
2011-09-14  5:34     ` Shilimkar, Santosh
2011-09-14 15:21       ` Tony Lindgren
2011-09-14 16:49         ` Santosh
2011-09-14 17:08           ` Tony Lindgren
2011-09-14 17:13             ` Santosh
2011-09-14 17:18               ` Tony Lindgren
2011-09-14 17:21                 ` Santosh
2011-09-14 17:22                 ` Santosh
2011-09-14 19:04                   ` Tony Lindgren
2011-09-15  2:57                     ` Santosh
2011-09-15  9:36                   ` Cousson, Benoit
2011-09-15 12:02                     ` Shilimkar, Santosh
2011-09-15 13:29                       ` Woodruff, Richard
2011-09-04 13:54 ` [PATCH 14/25] OMAP4: PM: Add CPUX OFF mode support Santosh Shilimkar
2011-09-08 19:39   ` Jean Pihet [this message]
2011-09-09  9:59     ` Santosh
2011-09-09  8:04   ` Shawn Guo
2011-09-09  8:09     ` Santosh
2011-09-09 14:13       ` Shawn Guo
2011-09-09 14:11         ` Shilimkar, Santosh
2011-09-09 15:27           ` Shawn Guo
2011-09-09 16:59             ` Santosh
2011-09-09 18:34               ` Kevin Hilman
2011-09-10  3:39                 ` Shilimkar, Santosh
2011-09-09 23:34               ` Shawn Guo
2011-09-10  3:38                 ` Shilimkar, Santosh
2011-09-10  4:54                   ` Shawn Guo
2011-09-10  5:51                     ` Santosh
2011-09-12 21:06   ` Kevin Hilman
2011-09-13  5:39     ` Santosh
2011-09-13 17:33       ` Kevin Hilman
2011-09-14  5:26         ` Shilimkar, Santosh
2011-09-04 13:54 ` [PATCH 15/25] OMAP4: Remove __INIT from omap_secondary_startup() to re-use it for hotplug Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 16/25] OMAP4: PM: Program CPU1 to hit OFF when off-lined Santosh Shilimkar
2011-09-12 21:12   ` Kevin Hilman
2011-09-13  5:35     ` Santosh
2011-09-04 13:54 ` [PATCH 17/25] OMAP4: PM: CPU1 wakeup workaround from Low power modes Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 18/25] OMAP4: suspend: Add MPUSS power domain RETENTION support Santosh Shilimkar
2011-09-15  0:27   ` Kevin Hilman
2011-09-15  3:19     ` Santosh
2011-09-04 13:54 ` [PATCH 19/25] OMAP4: PM: Add WakeupGen and secure GIC low power support Santosh Shilimkar
2011-09-04 13:54 ` [PATCH 20/25] OMAP4: PM: Add L2X0 cache lowpower support Santosh Shilimkar
2011-09-05 14:01   ` Lorenzo Pieralisi
2011-09-05 14:13     ` Santosh
2011-09-16 17:23   ` Kevin Hilman
2011-09-18  8:46     ` Santosh
2011-09-04 13:54 ` [PATCH 21/25] OMAP4: PM: Add MPUSS power domain OSWR support Santosh Shilimkar
2011-09-12 18:52   ` Kevin Hilman
2011-09-13  5:37     ` Santosh
2011-09-13  7:39       ` Jean Pihet
2011-09-13  8:25         ` Santosh
2011-09-04 13:54 ` [PATCH 22/25] OMAP4: PM: Add power domain statistics support Santosh Shilimkar
2011-09-05 10:08   ` Sergei Shtylyov
2011-09-05 10:43     ` Santosh
2011-09-04 13:54 ` [PATCH 23/25] OMAP4: PM: Add CPUidle support Santosh Shilimkar
2011-09-16 17:45   ` Kevin Hilman
2011-09-18  8:47     ` Santosh
2011-09-04 13:54 ` [PATCH 24/25] OMAP4: cpuidle: Switch to gptimer from twd in deeper C-states Santosh Shilimkar
2011-09-16 17:51   ` Kevin Hilman
2011-09-18  8:48     ` Santosh
2011-09-04 13:54 ` [PATCH 25/25] OMAP3: CPUidle: Make use of CPU PM notifiers Santosh Shilimkar
2011-09-08 17:57   ` Kevin Hilman
2011-09-09  4:20     ` Santosh
2011-09-09  7:17     ` Santosh
2011-09-08 20:15 ` [PATCH 00/25] OMAP4: PM: suspend, CPU-hotplug and CPUilde support Jean Pihet
2011-09-09  4:25   ` Santosh
2011-09-20 11:24 ` Vishwanath Sripathy
2011-09-20 11:37   ` Santosh
2011-09-20 11:57 ` Santosh

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=CAORVsuUXtiitSTMB0MTJPobppqKymmYFsDpsOqALP8UV7Pm+dQ@mail.gmail.com \
    --to=jean.pihet@newoldbits.com \
    --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).