linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4
@ 2015-03-09  3:53 Wenyou Yang
  2015-03-09  3:53 ` [PATCH v2.0 1/2] pm: at91: pm_suspend: add the WFI instruction support for ARMv7 Wenyou Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Wenyou Yang @ 2015-03-09  3:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

The patch series purpose is to add pm support for sama5d3 and sama5d4.

It is based on the branch, at91-4.0-fixes
git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git
	+ [PATCH] ARM: AT91: pm improvement for 4.1

Change log for v2.0:
 - remove the patch already stacked. 
 - rebase.

Wenyou Yang (2):
  pm: at91: pm_suspend: add the WFI instruction support for ARMv7
  pm: at91: flush data cache and clean, invalidate and disable the L2
    cache

 arch/arm/mach-at91/pm.c         |    6 ++++++
 arch/arm/mach-at91/pm_suspend.S |   20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2.0 1/2] pm: at91: pm_suspend: add the WFI instruction support for ARMv7
  2015-03-09  3:53 [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4 Wenyou Yang
@ 2015-03-09  3:53 ` Wenyou Yang
  2015-03-09  3:54 ` [PATCH v2.0 2/2] pm: at91: flush data cache and clean, invalidate and disable the L2 cache Wenyou Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Wenyou Yang @ 2015-03-09  3:53 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 0c520c3..95c3404 100644
--- a/arch/arm/mach-at91/pm_suspend.S
+++ b/arch/arm/mach-at91/pm_suspend.S
@@ -60,6 +60,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
 
 /*
@@ -137,7 +155,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] 5+ messages in thread

* [PATCH v2.0 2/2] pm: at91: flush data cache and clean, invalidate and disable the L2 cache
  2015-03-09  3:53 [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4 Wenyou Yang
  2015-03-09  3:53 ` [PATCH v2.0 1/2] pm: at91: pm_suspend: add the WFI instruction support for ARMv7 Wenyou Yang
@ 2015-03-09  3:54 ` Wenyou Yang
  2015-03-12 18:59 ` [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4 Sylvain Rochet
  2015-03-13 13:40 ` Nicolas Ferre
  3 siblings, 0 replies; 5+ messages in thread
From: Wenyou Yang @ 2015-03-09  3:54 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 9fb868d..ac947cd 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>
@@ -133,8 +134,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] 5+ messages in thread

* [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4
  2015-03-09  3:53 [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4 Wenyou Yang
  2015-03-09  3:53 ` [PATCH v2.0 1/2] pm: at91: pm_suspend: add the WFI instruction support for ARMv7 Wenyou Yang
  2015-03-09  3:54 ` [PATCH v2.0 2/2] pm: at91: flush data cache and clean, invalidate and disable the L2 cache Wenyou Yang
@ 2015-03-12 18:59 ` Sylvain Rochet
  2015-03-13 13:40 ` Nicolas Ferre
  3 siblings, 0 replies; 5+ messages in thread
From: Sylvain Rochet @ 2015-03-12 18:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Wenyou,

On Mon, Mar 09, 2015 at 11:53:07AM +0800, Wenyou Yang wrote:
> Hi,
> 
> The patch series purpose is to add pm support for sama5d3 and sama5d4.

To the whole series:

Tested-by: Sylvain Rochet <sylvain.rochet@finsecur.com>

Sylvain

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4
  2015-03-09  3:53 [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4 Wenyou Yang
                   ` (2 preceding siblings ...)
  2015-03-12 18:59 ` [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4 Sylvain Rochet
@ 2015-03-13 13:40 ` Nicolas Ferre
  3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2015-03-13 13:40 UTC (permalink / raw)
  To: linux-arm-kernel

Le 09/03/2015 04:53, Wenyou Yang a ?crit :
> Hi,
> 
> The patch series purpose is to add pm support for sama5d3 and sama5d4.
> 
> It is based on the branch, at91-4.0-fixes
> git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git
> 	+ [PATCH] ARM: AT91: pm improvement for 4.1
> 
> Change log for v2.0:
>  - remove the patch already stacked. 
>  - rebase.
> 
> Wenyou Yang (2):
>   pm: at91: pm_suspend: add the WFI instruction support for ARMv7
>   pm: at91: flush data cache and clean, invalidate and disable the L2
>     cache

For the 2 patches:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

And stacked on top of at91-4.1-cleanup: thanks Wenyou!

(also reworked the subjects).

Bye,

> 
>  arch/arm/mach-at91/pm.c         |    6 ++++++
>  arch/arm/mach-at91/pm_suspend.S |   20 +++++++++++++++++++-
>  2 files changed, 25 insertions(+), 1 deletion(-)
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-13 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09  3:53 [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4 Wenyou Yang
2015-03-09  3:53 ` [PATCH v2.0 1/2] pm: at91: pm_suspend: add the WFI instruction support for ARMv7 Wenyou Yang
2015-03-09  3:54 ` [PATCH v2.0 2/2] pm: at91: flush data cache and clean, invalidate and disable the L2 cache Wenyou Yang
2015-03-12 18:59 ` [PATCH v2.0 0/2] ARM: at91: Add pm support for sama5d3 and sama5d4 Sylvain Rochet
2015-03-13 13:40 ` Nicolas Ferre

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).