summaryrefslogtreecommitdiff
path: root/drivers/bootcount
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2018-02-22 12:30:41 +0100
committerStefano Babic <sbabic@denx.de>2018-07-23 09:55:20 +0200
commit1947c2d2a08fb07330d15fc30416969afbe61bbc (patch)
tree7f0b74ce98fe5f461208e0a1d314d14d8cab8304 /drivers/bootcount
parent474ecd2c84d97314b8145fbe3a57887f41b2edb3 (diff)
bootcount: flush after storing the bootcounter
If the bootcounter address is in a cached memory, a flush of dcache must occur after updateing the bootcounter. Issue found on i.MX6 where bootcounter is put into the internal (cached) IRAM. Signed-off-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers/bootcount')
-rw-r--r--drivers/bootcount/bootcount.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/bootcount/bootcount.c b/drivers/bootcount/bootcount.c
index e00d81c934..a3162c97ed 100644
--- a/drivers/bootcount/bootcount.c
+++ b/drivers/bootcount/bootcount.c
@@ -18,6 +18,9 @@ __weak void bootcount_store(ulong a)
raw_bootcount_store(reg, a);
raw_bootcount_store(reg + 4, BOOTCOUNT_MAGIC);
#endif /* defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD */
+ flush_dcache_range(CONFIG_SYS_BOOTCOUNT_ADDR,
+ CONFIG_SYS_BOOTCOUNT_ADDR +
+ CONFIG_SYS_CACHELINE_SIZE);
}
__weak ulong bootcount_load(void)