summaryrefslogtreecommitdiff
path: root/include/fdtdec.h
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2018-12-07 14:50:52 +0100
committerHeiko Schocher <hs@denx.de>2018-12-10 07:21:21 +0100
commitf1d2bc9034053e7d8ad0e77b9a0399f451bb5b80 (patch)
tree94c06154f238caf9b027ee3a6d15063c8e76b144 /include/fdtdec.h
parent78eee5e90d8965f79ba674fe77da781beb072c5b (diff)
downloadu-boot-f1d2bc9034053e7d8ad0e77b9a0399f451bb5b80.tar.gz
lib: fdtdec: Add function re-setup the fdt more effeciently
In some cases it may be useful to be able to change the fdt we have been using and use another one instead. For example, the TI platforms uses an EEPROM to store board information and, based on the type of board, different dtbs are used by the SPL. When DM_I2C is used, a first dtb must be used before the I2C is initialized and only then the final dtb can be selected. To speed up the process and reduce memory usage, introduce a new function fdtdec_setup_best_match() that re-use the DTBs loaded in memory by fdtdec_setup() to select the best match. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'include/fdtdec.h')
-rw-r--r--include/fdtdec.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h
index b15da00fb2..f1bcbf837f 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -951,6 +951,27 @@ int fdtdec_setup_memory_banksize(void);
*/
int fdtdec_setup(void);
+#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
+/**
+ * fdtdec_resetup() - Set up the device tree again
+ *
+ * The main difference with fdtdec_setup() is that it returns if the fdt has
+ * changed because a better match has been found.
+ * This is typically used for boards that rely on a DM driver to detect the
+ * board type. This function sould be called by the board code after the stuff
+ * needed by board_fit_config_name_match() to operate porperly is available.
+ * If this functions signals that a rescan is necessary, the board code must
+ * unbind all the drivers using dm_uninit() and then rescan the DT with
+ * dm_init_and_scan().
+ *
+ * @param rescan Returns a flag indicating that fdt has changed and rescanning
+ * the fdt is required
+ *
+ * @return 0 if OK, -ve on error
+ */
+int fdtdec_resetup(int *rescan);
+#endif
+
/**
* Board-specific FDT initialization. Returns the address to a device tree blob.
* Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined