kconfiglib: Update to the 14.1.0 release
[platform/kernel/u-boot.git] / lib / fdtdec.c
index 9ecfa2a..0dd7ff1 100644 (file)
@@ -9,7 +9,9 @@
 #include <dm.h>
 #include <hang.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
+#include <net.h>
 #include <dm/of_extra.h>
 #include <env.h>
 #include <errno.h>
@@ -810,17 +812,6 @@ int fdtdec_parse_phandle_with_args(const void *blob, int src_node,
        return rc;
 }
 
-int fdtdec_get_child_count(const void *blob, int node)
-{
-       int subnode;
-       int num = 0;
-
-       fdt_for_each_subnode(subnode, blob, node)
-               num++;
-
-       return num;
-}
-
 int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
                          u8 *array, int count)
 {
@@ -1303,15 +1294,18 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
        /* find a matching node and return the phandle to that */
        fdt_for_each_subnode(node, blob, parent) {
                const char *name = fdt_get_name(blob, node, NULL);
-               phys_addr_t addr, size;
+               fdt_addr_t addr;
+               fdt_size_t size;
 
-               addr = fdtdec_get_addr_size(blob, node, "reg", &size);
+               addr = fdtdec_get_addr_size_fixed(blob, node, "reg", 0, na, ns,
+                                                 &size, false);
                if (addr == FDT_ADDR_T_NONE) {
                        debug("failed to read address/size for %s\n", name);
                        continue;
                }
 
-               if (addr == carveout->start && (addr + size) == carveout->end) {
+               if (addr == carveout->start && (addr + size - 1) ==
+                                               carveout->end) {
                        if (phandlep)
                                *phandlep = fdt_get_phandle(blob, node);
                        return 0;
@@ -1482,8 +1476,14 @@ int fdtdec_set_carveout(void *blob, const char *node, const char *prop_name,
        return 0;
 }
 
+__weak int fdtdec_board_setup(const void *fdt_blob)
+{
+       return 0;
+}
+
 int fdtdec_setup(void)
 {
+       int ret;
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 # if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
        void *fdt_blob;
@@ -1536,7 +1536,10 @@ int fdtdec_setup(void)
 # endif
 #endif
 
-       return fdtdec_prepare_fdt();
+       ret = fdtdec_prepare_fdt();
+       if (!ret)
+               ret = fdtdec_board_setup(gd->fdt_blob);
+       return ret;
 }
 
 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)