[U-Boot] [RFC PATCH] spl: Flush spl image after loading

York Sun york.sun at nxp.com
Fri Feb 3 22:25:44 UTC 2017


Flush spl image after loading into memory in case d-cache is enabled.

Signed-off-by: York Sun <york.sun at nxp.com>
---
Not sure if anyone noticed that SPL loads image but it doesn't flush the cache.
As far as MMU/cache stays the same, we don't notice it. Shall we flush it?

This patch is only tested on limited platforms.

 common/spl/spl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index f7df834..a3b9d9f 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -320,8 +320,11 @@ static int boot_from_devices(struct spl_image_info *spl_image,
 		else
 			puts("SPL: Unsupported Boot Device!\n");
 #endif
-		if (loader && !spl_load_image(spl_image, loader))
+		if (loader && !spl_load_image(spl_image, loader)) {
+			flush_dcache_range(spl_image->load_addr,
+					   spl_image->load_addr + spl_image->size);
 			return 0;
+		}
 	}
 
 	return -ENODEV;
-- 
2.7.4



More information about the U-Boot mailing list