]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
driver: net: fsl-mc: Memset MC reserve ram memory before usage
authorPrabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Mon, 27 Aug 2018 07:28:52 +0000 (12:58 +0530)
committerYork Sun <york.sun@nxp.com>
Thu, 27 Sep 2018 15:55:21 +0000 (08:55 -0700)
Memory reserved for Management Complex needs to be cleaned before any
usage.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
[York S: revised commit message]
Reviewed-by: York Sun <york.sun@nxp.com>
drivers/net/fsl-mc/mc.c

index cb2fbe9e2f1d3572da087a9b3580606d5b368ce0..d9a897dc868c528944699bc2231d9e2f83aade0d 100644 (file)
@@ -2,6 +2,7 @@
 /*
  * Copyright 2014 Freescale Semiconductor, Inc.
  * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
  */
 #include <common.h>
 #include <errno.h>
@@ -29,6 +30,7 @@
 #define MC_BOOT_ENV_VAR                "mcinitcmd"
 
 DECLARE_GLOBAL_DATA_PTR;
+static int mc_memset_resv_ram;
 static int mc_boot_status = -1;
 static int mc_dpl_applied = -1;
 #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
@@ -844,6 +846,11 @@ u64 mc_get_dram_addr(void)
 {
        size_t mc_ram_size = mc_get_dram_block_size();
 
+       if (!mc_memset_resv_ram || (get_mc_boot_status() < 0)) {
+               mc_memset_resv_ram = 1;
+               memset((void *)gd->arch.resv_ram, 0, mc_ram_size);
+       }
+
        return (gd->arch.resv_ram + mc_ram_size - 1) &
                MC_RAM_BASE_ADDR_ALIGNMENT_MASK;
 }