Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / powerpc / cpu / mpc85xx / fdt.c
index a9ea947305ffab9df1ed3312c38cca0563ce38a4..55f191f202f9a87f413e82618d95844485006a7d 100644 (file)
@@ -1,20 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2007-2011 Freescale Semiconductor, Inc.
  *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
-#include <libfdt.h>
+#include <clock_legacy.h>
+#include <env.h>
+#include <log.h>
+#include <time.h>
+#include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <asm/processor.h>
 #include <linux/ctype.h>
 #include <asm/io.h>
 #include <asm/fsl_fdt.h>
 #include <asm/fsl_portals.h>
+#include <fsl_qbman.h>
 #include <hwconfig.h>
 #ifdef CONFIG_FSL_ESDHC
 #include <fsl_esdhc.h>
@@ -92,7 +96,7 @@ void ft_fixup_cpu(void *blob, u64 memory_limit)
         * Extract hwconfig from environment.
         * Search for tdm entry in hwconfig.
         */
-       ret = getenv_f("hwconfig", buffer, sizeof(buffer));
+       ret = env_get_f("hwconfig", buffer, sizeof(buffer));
        if (ret > 0)
                tdm_hwconfig_enabled = hwconfig_f("tdm", buffer);
 
@@ -580,7 +584,7 @@ static void fdt_fixup_l2_switch(void *blob)
                return;
 
        /* Get MAC address for the l2switch from "l2switchaddr"*/
-       if (!eth_getenv_enetaddr("l2switchaddr", l2swaddr)) {
+       if (!eth_env_get_enetaddr("l2switchaddr", l2swaddr)) {
                printf("Warning: MAC address for l2switch not found\n");
                memset(l2swaddr, 0, sizeof(l2swaddr));
        }
@@ -770,8 +774,15 @@ int ft_verify_fdt(void *fdt)
 
        /* First check the CCSR base address */
        off = fdt_node_offset_by_prop_value(fdt, -1, "device_type", "soc", 4);
-       if (off > 0)
-               addr = fdt_get_base_address(fdt, off);
+       if (off > 0) {
+               int size;
+               u32 naddr;
+               const fdt32_t *prop;
+
+               naddr = fdt_address_cells(fdt, off);
+               prop = fdt_getprop(fdt, off, "ranges", &size);
+               addr = fdt_translate_address(fdt, off, prop + naddr);
+       }
 
        if (!addr) {
                printf("Warning: could not determine base CCSR address in "