From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Thu, 22 Feb 2018 12:30:41 +0100 Subject: [U-Boot] [PATCH] bootcount: flush after storing the bootcounter Message-ID: <1519299041-19416-1-git-send-email-sbabic@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- drivers/bootcount/bootcount.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bootcount/bootcount.c b/drivers/bootcount/bootcount.c index d5ce450..48594a6 100644 --- a/drivers/bootcount/bootcount.c +++ b/drivers/bootcount/bootcount.c @@ -59,6 +59,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) -- 2.7.4