[U-Boot] [PATCH 4/4] Exynos: Flush memory region before starting SHA DMA operation

Akshay Saraswat akshay.s at samsung.com
Wed Feb 27 16:24:42 CET 2013


SHA256 commands weren't giving desired output since the data we set
in the memory addresses through mw.l commands was not getting updated
in actual memory. Adding this patch resolves the issue.

TEST=sha256 0x40008000 0x2B 0x40009000
Used mm and md to write a standard string to memory location
0x40008000 and ran the above command to verify the output.

Signed-off-by: Ajay Kumar <ajaykumar.rs at samsung.com>
Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
---
 arch/arm/cpu/armv7/exynos/ace_sha.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/cpu/armv7/exynos/ace_sha.c b/arch/arm/cpu/armv7/exynos/ace_sha.c
index 2715a03..9ac34be 100644
--- a/arch/arm/cpu/armv7/exynos/ace_sha.c
+++ b/arch/arm/cpu/armv7/exynos/ace_sha.c
@@ -51,6 +51,11 @@ int ace_sha_hash_digest(
 	struct exynos_ace_sfr *ace_sha_reg =
 		(struct exynos_ace_sfr *) samsung_get_base_ace_sfr();
 
+	/* Flush input and output memory buffers berore starting DMA */
+	flush_dcache_range((unsigned long) pout, (unsigned long)(pout + 0x20));
+	flush_dcache_range((unsigned long) pbuf,
+					(unsigned long)(pbuf + buf_len));
+
 	if (buf_len == 0) {
 		/* ACE H/W cannot compute hash value for empty string */
 		if (hash_type == ACE_SHA_TYPE_SHA1)
-- 
1.8.0



More information about the U-Boot mailing list