]> Git Repo - J-u-boot.git/blobdiff - drivers/bootcount/bootcount_ram.c
command: Remove the cmd_tbl_t typedef
[J-u-boot.git] / drivers / bootcount / bootcount_ram.c
index 5bdabcd562090bcee93e05abcef48c971144177d..078c84d5ecab7f5ab9784651d89a6e0aa7798eef 100644 (file)
@@ -1,11 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2010
  * Heiko Schocher, DENX Software Engineering, [email protected].
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <cpu_func.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -29,12 +30,16 @@ void bootcount_store(ulong a)
                size += gd->bd->bi_dram[i].size;
        save_addr = (ulong *)(size - BOOTCOUNT_ADDR);
        writel(a, save_addr);
-       writel(BOOTCOUNT_MAGIC, &save_addr[1]);
+       writel(CONFIG_SYS_BOOTCOUNT_MAGIC, &save_addr[1]);
 
        for (i = 0; i < REPEAT_PATTERN; i++)
                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] &
+                            ~(ARCH_DMA_MINALIGN - 1)) + ARCH_DMA_MINALIGN));
 }
 
 ulong bootcount_load(void)
This page took 0.025951 seconds and 4 git commands to generate.