dm: core: Select device tree control correctly for SPL
authorSimon Glass <sjg@chromium.org>
Sat, 28 Feb 2015 05:06:41 +0000 (22:06 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 23 Apr 2015 15:05:54 +0000 (09:05 -0600)
Some boards will not use device tree for SPL even with driver model. Add
the logic to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/core/root.c
include/fdtdec.h

index 9b5c6bb10cb13d1648c344970838d967494e26a4..12d046051fdb3af8065adcd18d5bc017d6dc25b9 100644 (file)
@@ -197,13 +197,15 @@ int dm_init_and_scan(bool pre_reloc_only)
                debug("dm_scan_platdata() failed: %d\n", ret);
                return ret;
        }
-#ifdef CONFIG_OF_CONTROL
-       ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
-       if (ret) {
-               debug("dm_scan_fdt() failed: %d\n", ret);
-               return ret;
+
+       if (OF_CONTROL) {
+               ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
+               if (ret) {
+                       debug("dm_scan_fdt() failed: %d\n", ret);
+                       return ret;
+               }
        }
-#endif
+
        ret = dm_scan_other(pre_reloc_only);
        if (ret)
                return ret;
index 0d3e6d9711dd964d14e306cc3ef23f86c46f1184..659047097a1001ca5f007e55b16343ddc214ca78 100644 (file)
@@ -41,6 +41,16 @@ struct fdt_memory {
        fdt_addr_t end;
 };
 
+#ifdef CONFIG_OF_CONTROL
+# if defined(CONFIG_SPL_BUILD) && defined(SPL_DISABLE_OF_CONTROL)
+#  define OF_CONTROL 0
+# else
+#  define OF_CONTROL 1
+# endif
+#else
+# define OF_CONTROL 0
+#endif
+
 /*
  * Information about a resource. start is the first address of the resource
  * and end is the last address (inclusive). The length of the resource will