Merge branch '2019-05-28-master-imports'
[oweals/u-boot.git] / arch / arm / mach-sunxi / dram_helpers.c
index 9a94e1b6795ed7d131d9d7382af4cf676be8fce7..239ab421a8b8bde84274ddcd6915b6f788d71071 100644 (file)
@@ -1,12 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * DRAM init helper functions
  *
  * (C) Copyright 2015 Hans de Goede <hdegoede@redhat.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
+#include <asm/barriers.h>
 #include <asm/io.h>
 #include <asm/arch/dram.h>
 
@@ -30,8 +30,9 @@ bool mctl_mem_matches(u32 offset)
 {
        /* Try to write different values to RAM at two addresses */
        writel(0, CONFIG_SYS_SDRAM_BASE);
-       writel(0xaa55aa55, CONFIG_SYS_SDRAM_BASE + offset);
+       writel(0xaa55aa55, (ulong)CONFIG_SYS_SDRAM_BASE + offset);
+       dsb();
        /* Check if the same value is actually observed when reading back */
        return readl(CONFIG_SYS_SDRAM_BASE) ==
-              readl(CONFIG_SYS_SDRAM_BASE + offset);
+              readl((ulong)CONFIG_SYS_SDRAM_BASE + offset);
 }