bootcounter_ram: Flush dcache after data is written into SDRAM
authorStefan Roese <sr@denx.de>
Wed, 6 Apr 2016 09:02:22 +0000 (11:02 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 12 Apr 2016 00:48:25 +0000 (20:48 -0400)
This patch adds a call to flush_dcache_range() to bootcount_store() to
make sure, that the bootcounter data (including the patterns) is
written to memory. Without this, platforms with dcache enabled may not
have the bootcounter updated upon reset.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Valentin Longchamp <valentin.longchamp@keymile.com>
drivers/bootcount/bootcount_ram.c

index 5bdabcd562090bcee93e05abcef48c971144177d..e0d2669b71df61daf4a65cf49efa5dfd9db10720 100644 (file)
@@ -35,6 +35,9 @@ void bootcount_store(ulong a)
                writel(patterns[i % NBR_OF_PATTERNS],
                        &save_addr[i + OFFS_PATTERN]);
 
+       /* Make sure the data is written to RAM */
+       flush_dcache_range((ulong)&save_addr[0],
+                          (ulong)&save_addr[REPEAT_PATTERN + OFFS_PATTERN]);
 }
 
 ulong bootcount_load(void)