]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
NAND: Fix cache and memory inconsistency issue
authorDave Liu <daveliu@freescale.com>
Tue, 2 Dec 2008 03:48:51 +0000 (11:48 +0800)
committerScott Wood <scottwood@freescale.com>
Fri, 23 Jan 2009 16:32:50 +0000 (10:32 -0600)
We load the secondary stage u-boot image from NAND to
system memory by nand_load, but we did not flush d-cache
to memory, nor invalidate i-cache before we jump to RAM.
When the system has cache enabled and the TLB/page attribute
of system memory is cacheable, it will cause issues.

- 83xx family is using the d-cache lock, so all of d-cache
  access is cache-inhibited. so you can't see the issue.
- 85xx family is using d-cache, i-cache enable, partial
  cache lock. you will see the issue.

This patch fixes the cache issue.

Signed-off-by: Dave Liu <daveliu@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
nand_spl/board/freescale/mpc8313erdb/Makefile
nand_spl/nand_boot_fsl_elbc.c

index 3da1b1fffb818abf5a748579bdb07c1cec0376b9..1a8f6ff2c798a5bee6ed5ad32929baf5442083e7 100644 (file)
@@ -34,7 +34,8 @@ AFLAGS        += -DCONFIG_NAND_SPL
 CFLAGS += -DCONFIG_NAND_SPL
 
 SOBJS  = start.o ticks.o
-COBJS  = nand_boot_fsl_elbc.o $(BOARD).o sdram.o ns16550.o nand_init.o time.o
+COBJS  = nand_boot_fsl_elbc.o $(BOARD).o sdram.o ns16550.o nand_init.o \
+         time.o cache.o
 
 SRCS   := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -79,6 +80,9 @@ $(obj)ns16550.c:
 $(obj)nand_init.c:
        ln -sf $(SRCTREE)/cpu/mpc83xx/nand_init.c $(obj)nand_init.c
 
+$(obj)cache.c:
+       ln -sf $(SRCTREE)/lib_ppc/cache.c $(obj)cache.c
+
 $(obj)time.c:
        ln -sf $(SRCTREE)/lib_ppc/time.c $(obj)time.c
 
index 4a961ea7b01fdca8647762aaced8caeacbc08261..0d0c44e1e366d3343b8b5e14bfbe6fbe122f8d20 100644 (file)
@@ -143,6 +143,11 @@ void nand_boot(void)
         * Jump to U-Boot image
         */
        puts("transfering control\n");
+       /*
+        * Clean d-cache and invalidate i-cache, to
+        * make sure that no stale data is executed.
+        */
+       flush_cache(CONFIG_SYS_NAND_U_BOOT_DST, CONFIG_SYS_NAND_U_BOOT_SIZE);
        uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
        uboot();
 }