Skip to contentSkip to conversation

bootcounter_ram: Flush dcache after data is written into SDRAM

PATCH In review Stefan Roese 2 participants 2 messages Apr 6, 2016 – Apr 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootcounter_ram: Flush dcache after data is written into SDRAM

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.

Cc Valentin Longchamp <[email protected]>
---
 drivers/bootcount/bootcount_ram.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/bootcount/bootcount_ram.c +3 -0
index 5bdabcd..e0d2669 100644
@@ -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)
Signature · 1 line
2.8.1
#1 lore raw
Quoted 7 lines · Stefan Roese

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.

Cc Valentin Longchamp <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160411/64a73b85/attachment.sig>