* [PATCH 1/3] pm: at91: pm_suspend: add the WFI instruction support for ARMv7
2015-02-12 2:50 [PATCH 0/3] AT91 pm fixes for 3.21 Wenyou Yang
@ 2015-02-12 2:51 ` Wenyou Yang
2015-02-17 10:22 ` Alexandre Belloni
2015-02-12 2:52 ` [PATCH 2/3] pm: at91: pm_suspend: MOR register KEY was missing Wenyou Yang
2015-02-12 2:52 ` [PATCH 3/3] pm: at91: flush data cache and clean, invalidate and disable the L2 cache Wenyou Yang
2 siblings, 1 reply; 7+ messages in thread
From: Wenyou Yang @ 2015-02-12 2:51 UTC (permalink / raw)
To: linux-arm-kernel
Add the WFI instruction to make the cpu to the idle state.
In the meanwhile, disable the processor's clock.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
arch/arm/mach-at91/pm_suspend.S | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S
index bebe3de..1c7256a 100644
--- a/arch/arm/mach-at91/pm_suspend.S
+++ b/arch/arm/mach-at91/pm_suspend.S
@@ -51,6 +51,24 @@ tmp2 .req r5
beq 1b
.endm
+/*
+ * Put the processor to enter the idle state
+ */
+ .macro at91_cpu_idle
+
+#if defined(CONFIG_CPU_V7)
+ mov tmp1, #AT91_PMC_PCK
+ str tmp1, [pmc, #AT91_PMC_SCDR]
+
+ dsb
+
+ wfi @ Wait For Interrupt
+#else
+ mcr p15, 0, tmp1, c7, c0, 4
+#endif
+
+ .endm
+
.text
/*
@@ -120,7 +138,7 @@ skip_disable_main_clock:
ldr pmc, .pmc_base
/* Wait for interrupt */
- mcr p15, 0, tmp1, c7, c0, 4
+ at91_cpu_idle
ldr r0, .pm_mode
tst r0, #AT91_PM_SLOW_CLOCK
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/3] pm: at91: pm_suspend: add the WFI instruction support for ARMv7
2015-02-12 2:51 ` [PATCH 1/3] pm: at91: pm_suspend: add the WFI instruction support for ARMv7 Wenyou Yang
@ 2015-02-17 10:22 ` Alexandre Belloni
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2015-02-17 10:22 UTC (permalink / raw)
To: linux-arm-kernel
On 12/02/2015 at 10:51:26 +0800, Wenyou Yang wrote :
> Add the WFI instruction to make the cpu to the idle state.
> In the meanwhile, disable the processor's clock.
>
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> arch/arm/mach-at91/pm_suspend.S | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S
> index bebe3de..1c7256a 100644
> --- a/arch/arm/mach-at91/pm_suspend.S
> +++ b/arch/arm/mach-at91/pm_suspend.S
> @@ -51,6 +51,24 @@ tmp2 .req r5
> beq 1b
> .endm
>
> +/*
> + * Put the processor to enter the idle state
> + */
> + .macro at91_cpu_idle
> +
> +#if defined(CONFIG_CPU_V7)
> + mov tmp1, #AT91_PMC_PCK
> + str tmp1, [pmc, #AT91_PMC_SCDR]
> +
> + dsb
> +
> + wfi @ Wait For Interrupt
> +#else
> + mcr p15, 0, tmp1, c7, c0, 4
> +#endif
> +
> + .endm
> +
> .text
>
> /*
> @@ -120,7 +138,7 @@ skip_disable_main_clock:
> ldr pmc, .pmc_base
>
> /* Wait for interrupt */
> - mcr p15, 0, tmp1, c7, c0, 4
> + at91_cpu_idle
>
> ldr r0, .pm_mode
> tst r0, #AT91_PM_SLOW_CLOCK
> --
> 1.7.9.5
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] pm: at91: pm_suspend: MOR register KEY was missing
2015-02-12 2:50 [PATCH 0/3] AT91 pm fixes for 3.21 Wenyou Yang
2015-02-12 2:51 ` [PATCH 1/3] pm: at91: pm_suspend: add the WFI instruction support for ARMv7 Wenyou Yang
@ 2015-02-12 2:52 ` Wenyou Yang
2015-02-17 10:24 ` Alexandre Belloni
2015-02-12 2:52 ` [PATCH 3/3] pm: at91: flush data cache and clean, invalidate and disable the L2 cache Wenyou Yang
2 siblings, 1 reply; 7+ messages in thread
From: Wenyou Yang @ 2015-02-12 2:52 UTC (permalink / raw)
To: linux-arm-kernel
From: Patrice Vilchez <patrice.vilchez@atmel.com>
Because writing the MOR register requires the PASSWD(0x37),
if missed, the write operation will be aborted.
Signed-off-by: Patrice Vilchez <patrice.vilchez@atmel.com>
---
arch/arm/mach-at91/pm_suspend.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S
index 1c7256a..5347ad4 100644
--- a/arch/arm/mach-at91/pm_suspend.S
+++ b/arch/arm/mach-at91/pm_suspend.S
@@ -132,6 +132,7 @@ ENTRY(at91_pm_suspend_in_sram)
/* Turn off the main oscillator */
ldr tmp1, [pmc, #AT91_CKGR_MOR]
bic tmp1, tmp1, #AT91_PMC_MOSCEN
+ orr tmp1, tmp1, #AT91_PMC_KEY
str tmp1, [pmc, #AT91_CKGR_MOR]
skip_disable_main_clock:
@@ -149,6 +150,7 @@ skip_disable_main_clock:
/* Turn on the main oscillator */
ldr tmp1, [pmc, #AT91_CKGR_MOR]
orr tmp1, tmp1, #AT91_PMC_MOSCEN
+ orr tmp1, tmp1, #AT91_PMC_KEY
str tmp1, [pmc, #AT91_CKGR_MOR]
wait_moscrdy
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] pm: at91: pm_suspend: MOR register KEY was missing
2015-02-12 2:52 ` [PATCH 2/3] pm: at91: pm_suspend: MOR register KEY was missing Wenyou Yang
@ 2015-02-17 10:24 ` Alexandre Belloni
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2015-02-17 10:24 UTC (permalink / raw)
To: linux-arm-kernel
On 12/02/2015 at 10:52:13 +0800, Wenyou Yang wrote :
> From: Patrice Vilchez <patrice.vilchez@atmel.com>
>
> Because writing the MOR register requires the PASSWD(0x37),
> if missed, the write operation will be aborted.
>
> Signed-off-by: Patrice Vilchez <patrice.vilchez@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> arch/arm/mach-at91/pm_suspend.S | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S
> index 1c7256a..5347ad4 100644
> --- a/arch/arm/mach-at91/pm_suspend.S
> +++ b/arch/arm/mach-at91/pm_suspend.S
> @@ -132,6 +132,7 @@ ENTRY(at91_pm_suspend_in_sram)
> /* Turn off the main oscillator */
> ldr tmp1, [pmc, #AT91_CKGR_MOR]
> bic tmp1, tmp1, #AT91_PMC_MOSCEN
> + orr tmp1, tmp1, #AT91_PMC_KEY
> str tmp1, [pmc, #AT91_CKGR_MOR]
>
> skip_disable_main_clock:
> @@ -149,6 +150,7 @@ skip_disable_main_clock:
> /* Turn on the main oscillator */
> ldr tmp1, [pmc, #AT91_CKGR_MOR]
> orr tmp1, tmp1, #AT91_PMC_MOSCEN
> + orr tmp1, tmp1, #AT91_PMC_KEY
> str tmp1, [pmc, #AT91_CKGR_MOR]
>
> wait_moscrdy
> --
> 1.7.9.5
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] pm: at91: flush data cache and clean, invalidate and disable the L2 cache
2015-02-12 2:50 [PATCH 0/3] AT91 pm fixes for 3.21 Wenyou Yang
2015-02-12 2:51 ` [PATCH 1/3] pm: at91: pm_suspend: add the WFI instruction support for ARMv7 Wenyou Yang
2015-02-12 2:52 ` [PATCH 2/3] pm: at91: pm_suspend: MOR register KEY was missing Wenyou Yang
@ 2015-02-12 2:52 ` Wenyou Yang
2015-02-17 10:25 ` Alexandre Belloni
2 siblings, 1 reply; 7+ messages in thread
From: Wenyou Yang @ 2015-02-12 2:52 UTC (permalink / raw)
To: linux-arm-kernel
Flush data cache, and clean, invalidate and disable the L2 cache before going to suspend.
Restore the L2 cache configuration and re-enable the L2 cache after waking up.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
arch/arm/mach-at91/pm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 9075b41..2574bad 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -30,6 +30,7 @@
#include <asm/mach/time.h>
#include <asm/mach/irq.h>
#include <asm/fncpy.h>
+#include <asm/cacheflush.h>
#include <mach/cpu.h>
#include <mach/hardware.h>
@@ -145,8 +146,13 @@ static void at91_pm_suspend(suspend_state_t state)
pm_data |= (state == PM_SUSPEND_MEM) ?
AT91_PM_MODE(AT91_PM_SLOW_CLOCK) : 0;
+ flush_cache_all();
+ outer_disable();
+
at91_suspend_sram_fn(at91_pmc_base, at91_ramc_base[0],
at91_ramc_base[1], pm_data);
+
+ outer_resume();
}
static int at91_pm_enter(suspend_state_t state)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] pm: at91: flush data cache and clean, invalidate and disable the L2 cache
2015-02-12 2:52 ` [PATCH 3/3] pm: at91: flush data cache and clean, invalidate and disable the L2 cache Wenyou Yang
@ 2015-02-17 10:25 ` Alexandre Belloni
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2015-02-17 10:25 UTC (permalink / raw)
To: linux-arm-kernel
On 12/02/2015 at 10:52:58 +0800, Wenyou Yang wrote :
> Flush data cache, and clean, invalidate and disable the L2 cache before going to suspend.
> Restore the L2 cache configuration and re-enable the L2 cache after waking up.
>
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> arch/arm/mach-at91/pm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index 9075b41..2574bad 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -30,6 +30,7 @@
> #include <asm/mach/time.h>
> #include <asm/mach/irq.h>
> #include <asm/fncpy.h>
> +#include <asm/cacheflush.h>
>
> #include <mach/cpu.h>
> #include <mach/hardware.h>
> @@ -145,8 +146,13 @@ static void at91_pm_suspend(suspend_state_t state)
> pm_data |= (state == PM_SUSPEND_MEM) ?
> AT91_PM_MODE(AT91_PM_SLOW_CLOCK) : 0;
>
> + flush_cache_all();
> + outer_disable();
> +
> at91_suspend_sram_fn(at91_pmc_base, at91_ramc_base[0],
> at91_ramc_base[1], pm_data);
> +
> + outer_resume();
> }
>
> static int at91_pm_enter(suspend_state_t state)
> --
> 1.7.9.5
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread