public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 01/10] arm: move flush_dcache_all() to just before disable cache
@ 2012-11-30 23:01 Simon Glass
  2012-11-30 23:01 ` [U-Boot] [PATCH v2 02/10] arm: Keep track of the tlb size as well as its location Simon Glass
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Simon Glass @ 2012-11-30 23:01 UTC (permalink / raw)
  To: u-boot

From: Arun Mankuzhi <arun.m@samsung.com>

In Cortex-A15 architecture, when we run cache invalidate
the cache clean operation executes automatically.
So if there are any dirty cache lines before disabling the L2 cache
these will be synchronized with the main memory when
invalidate_dcache_all() runs in the last part of U-boot

The two functions after flush_dcache_all is using the stack. So this
data will be on the cache. After disable when invalidate is called the
data will be flushed from cache to memory. This corrupts the stack in
invalida_dcache_all. So this change is required to avoid the u-boot
hang.

So flush has to be done just before clearing CR_C bit

Signed-off-by: Arun Mankuzhi <arun.m@samsung.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None

 arch/arm/lib/cache-cp15.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
index 939de10..06119c8 100644
--- a/arch/arm/lib/cache-cp15.c
+++ b/arch/arm/lib/cache-cp15.c
@@ -124,8 +124,11 @@ static void cache_disable(uint32_t cache_bit)
 			return;
 		/* if disabling data cache, disable mmu too */
 		cache_bit |= CR_M;
-		flush_dcache_all();
 	}
+	reg = get_cr();
+	cp_delay();
+	if (cache_bit == (CR_C | CR_M))
+		flush_dcache_all();
 	set_cr(reg & ~cache_bit);
 }
 #endif
-- 
1.7.7.3

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

end of thread, other threads:[~2013-01-12 16:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-30 23:01 [U-Boot] [PATCH v2 01/10] arm: move flush_dcache_all() to just before disable cache Simon Glass
2012-11-30 23:01 ` [U-Boot] [PATCH v2 02/10] arm: Keep track of the tlb size as well as its location Simon Glass
2012-11-30 23:01 ` [U-Boot] [PATCH v2 03/10] arm: Move fdt check earlier so that board_early_init_f() can use it Simon Glass
2012-11-30 23:01 ` [U-Boot] [PATCH v2 04/10] arm: Add CONFIG_DELAY_ENVIRONMENT to delay environment loading Simon Glass
2012-12-01  1:24   ` Doug Anderson
2012-11-30 23:01 ` [U-Boot] [PATCH v2 05/10] Document the CONFIG_DISPLAY_BOARDINFO option Simon Glass
2012-11-30 23:01 ` [U-Boot] [PATCH v2 06/10] arm: Add CONFIG_DISPLAY_BOARDINFO_LATE to display board info on LCD Simon Glass
2012-11-30 23:01 ` [U-Boot] [PATCH v2 07/10] Add option to display customised memory information Simon Glass
2012-11-30 23:01 ` [U-Boot] [PATCH v2 08/10] arm: Make interrupts.o and reset.o in libarm also appear in SPL Simon Glass
2012-11-30 23:01 ` [U-Boot] [PATCH v2 09/10] arm: Move bootstage record for board_init_f() to after arch_cpu_init() Simon Glass
2012-11-30 23:01 ` [U-Boot] [PATCH v2 10/10] arm: Tabify code for MMC initialization Simon Glass
2013-01-10 22:27 ` [U-Boot] [PATCH v2 01/10] arm: move flush_dcache_all() to just before disable cache Albert ARIBAUD
2013-01-11  7:59 ` R Sricharan
2013-01-12 16:33   ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox