[U-Boot] [PATCH 0/2] armv7m: cache: cleanup before linux booting

This patchset: - add all data cache flushing & invalidation functions as declared in the common header file. - adds cleanup before linux booting.
Vikas Manocha (2): armv7m: cache: add flush & invalidate all dcache arvm7m: add cleanup before linux booting
arch/arm/cpu/armv7m/cache.c | 15 +++++++++++++++ arch/arm/cpu/armv7m/cpu.c | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+)

Add functionality to flush & invalidate all the dcache using the prototype declared in common header file.
Signed-off-by: Vikas Manocha vikas.manocha@st.com --- arch/arm/cpu/armv7m/cache.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/arch/arm/cpu/armv7m/cache.c b/arch/arm/cpu/armv7m/cache.c index 162cfe3..84f658d 100644 --- a/arch/arm/cpu/armv7m/cache.c +++ b/arch/arm/cpu/armv7m/cache.c @@ -253,6 +253,21 @@ void flush_dcache_range(unsigned long start, unsigned long stop) return; } } +void flush_dcache_all(void) +{ + if (action_dcache_all(FLUSH_SET_WAY)) { + printf("ERR: D-cache not flushed\n"); + return; + } +} + +void invalidate_dcache_all(void) +{ + if (action_dcache_all(INVALIDATE_SET_WAY)) { + printf("ERR: D-cache not invalidated\n"); + return; + } +} #else void dcache_enable(void) {

On Wed, May 03, 2017 at 03:48:25PM -0700, Vikas Manocha wrote:
Add functionality to flush & invalidate all the dcache using the prototype declared in common header file.
Signed-off-by: Vikas Manocha vikas.manocha@st.com
After adding dummy functions for the cache not enabled side (to match other CPU families, ie armv7, and not break stm32f429-discovery builds), applied to u-boot/master, thanks!

Hi,
-----Original Message----- From: Tom Rini [mailto:trini@konsulko.com] Sent: Friday, May 12, 2017 10:18 AM To: Vikas MANOCHA vikas.manocha@st.com Cc: u-boot@lists.denx.de Subject: Re: [U-Boot,1/2] armv7m: cache: add flush & invalidate all dcache
On Wed, May 03, 2017 at 03:48:25PM -0700, Vikas Manocha wrote:
Add functionality to flush & invalidate all the dcache using the prototype declared in common header file.
Signed-off-by: Vikas Manocha vikas.manocha@st.com
After adding dummy functions for the cache not enabled side (to match other CPU families, ie armv7, and not break stm32f429- discovery builds), applied to u-boot/master, thanks!
Thanks Tom.
Cheers, Vikas
-- Tom

Data cache memory needs to be disabled before handing over control to linux kernel. This patch populates the cleanup_before_linux stub.
Signed-off-by: Vikas Manocha vikas.manocha@st.com --- arch/arm/cpu/armv7m/cpu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/arch/arm/cpu/armv7m/cpu.c b/arch/arm/cpu/armv7m/cpu.c index 58cde93..a424bab 100644 --- a/arch/arm/cpu/armv7m/cpu.c +++ b/arch/arm/cpu/armv7m/cpu.c @@ -18,6 +18,25 @@ */ int cleanup_before_linux(void) { + /* + * this function is called just before we call linux + * it prepares the processor for linux + * + * disable interrupt and turn off caches etc ... + */ + disable_interrupts(); + /* + * turn off D-cache + * dcache_disable() in turn flushes the d-cache + * MPU is still enabled & can't be disabled as the u-boot + * code might be running in sdram which by default is not + * executable area. + */ + dcache_disable(); + /* invalidate to make sure no cache line gets dirty between + * dcache flushing and disabling dcache */ + invalidate_dcache_all(); + return 0; }

On Wed, May 03, 2017 at 03:48:26PM -0700, Vikas Manocha wrote:
Data cache memory needs to be disabled before handing over control to linux kernel. This patch populates the cleanup_before_linux stub.
Signed-off-by: Vikas Manocha vikas.manocha@st.com
Applied to u-boot/master, thanks!
participants (3)
-
Tom Rini
-
Vikas MANOCHA
-
Vikas Manocha