[U-Boot] [PATCH] bootcount: Add dcache flush to bootcount_store()
Stefan Roese
sr at denx.de
Wed Mar 11 09:51:38 CET 2015
Without this dcache_flush the updated bootcounter may not be saved to
its location.
This was detected on an iMX.6 platform using the OCRAM (internal SRAM)
as bootcounter storage area. And issuing "reset" from within U-Boot
cause the bootcounter to stay on its initial value.
Signed-off-by: Stefan Roese <sr at denx.de>
---
drivers/bootcount/bootcount.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bootcount/bootcount.c b/drivers/bootcount/bootcount.c
index e0343f7..b3e79de 100644
--- a/drivers/bootcount/bootcount.c
+++ b/drivers/bootcount/bootcount.c
@@ -57,9 +57,11 @@ __weak void bootcount_store(ulong a)
#if defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD)
raw_bootcount_store(reg, (BOOTCOUNT_MAGIC & 0xffff0000) | a);
+ flush_dcache_range((u32)reg, (u32)reg + 4);
#else
raw_bootcount_store(reg, a);
raw_bootcount_store(reg + 4, BOOTCOUNT_MAGIC);
+ flush_dcache_range((u32)reg, (u32)reg + 8);
#endif
}
--
2.3.2
More information about the U-Boot
mailing list