[U-Boot] [PATCH] spl: fit: handle mmc read to sram case in rockchip SoCs

Kever Yang kever.yang at rock-chips.com
Fri Mar 29 14:09:10 UTC 2019


Rockchip fit image with atf may have firmware for sram,
so the fit driver need to read data from mmc to sram,
but Rockchip mmc controller does not support this data
path, we have to read into ddr first and then copy it
to sram.

Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
---

 common/spl/spl_fit.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index c9bfe0cc8a..5c5b58f69d 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -9,6 +9,7 @@
 #include <fpga.h>
 #include <image.h>
 #include <linux/libfdt.h>
+#include <malloc.h>
 #include <spl.h>
 
 #ifndef CONFIG_SYS_BOOTM_LEN
@@ -215,6 +216,15 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
 			return -ENOENT;
 
 		load_ptr = (load_addr + align_len) & ~align_len;
+#if  defined(CONFIG_ROCKCHIP_RK3399) || defined(CONFIG_ROCKCHIP_RK3368)
+		/*
+		 * Rockchip SOC's mmc controller does not support read data
+		 * from mmc to sram, we have to read to sdram first, and then
+		 * copy to sram.
+		 */
+		if ((load_ptr & 0xffff0000) != CONFIG_SYS_SDRAM_BASE)
+			load_ptr = (ulong)memalign(ARCH_DMA_MINALIGN, len);
+#endif
 		length = len;
 
 		overhead = get_aligned_image_overhead(info, offset);
-- 
2.20.1



More information about the U-Boot mailing list