thermal: imx_scu_thermal: prevent boot hang with zero pdata
[oweals/u-boot.git] / lib / fdtdec.c
index 460f0d250b4d6414d920fdfdb18a943a8a025118..1f2b763acc312a27490a11ecc3a2dd42e3dfced3 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)
 {
@@ -1483,8 +1474,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;
@@ -1537,7 +1534,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)