Merge git://git.denx.de/u-boot-sunxi
[oweals/u-boot.git] / drivers / net / fsl-mc / mc.c
index cb2fbe9e2f1d3572da087a9b3580606d5b368ce0..b245fbc681e94a7181bdbac96e3e053ecd7e95bb 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
@@ -361,8 +363,7 @@ static int mc_fixup_mac_addrs(void *blob, enum mc_fixup_type type)
 
        for (i = WRIOP1_DPMAC1; i < NUM_WRIOP_PORTS; i++) {
                /* port not enabled */
-               if ((wriop_is_enabled_dpmac(i) != 1) ||
-                   (wriop_get_phy_address(i) == -1))
+               if (wriop_is_enabled_dpmac(i) != 1)
                        continue;
 
                snprintf(ethname, ETH_NAME_LEN, "DPMAC%d@%s", i,
@@ -844,6 +845,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;
 }
@@ -879,8 +885,7 @@ int fsl_mc_ldpaa_init(bd_t *bis)
        int i;
 
        for (i = WRIOP1_DPMAC1; i < NUM_WRIOP_PORTS; i++)
-               if ((wriop_is_enabled_dpmac(i) == 1) &&
-                   (wriop_get_phy_address(i) != -1))
+               if (wriop_is_enabled_dpmac(i) == 1)
                        ldpaa_eth_init(i, wriop_get_enet_if(i));
        return 0;
 }