]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Fri, 29 Sep 2017 17:27:57 +0000 (19:27 +0200)
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Sat, 30 Sep 2017 22:33:34 +0000 (00:33 +0200)
It is often desirable to configure the spl-boot-order (i.e. the order
that SPL probes devices to find the FIT image containing a full U-Boot)
such that it contains 'the same device the SPL stage was booted from'
early on.  To support this, we introduce the 'same-as-spl' specifier
for the spl-boot-order property.

This commit adds:
 - documentation for the new board_spl_was_booted_from() function that
   individual SoCs/boards should provide, if they can determine where
   the SPL was booted from
 - implements the new board_spl_was_booted_from() stub function
 - adds support for handling the 'same-as-spl' specifier and calling
   into the per-SoC/per-board support code.

This also updates the documentation for the 'u-boot,spl-boot-order'
property.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/mach-rockchip/spl-boot-order.c
doc/device-tree-bindings/chosen.txt

index 0bb9a73a8abcb383054d807c200b2f13cc6f8dfe..843998dfdcb8d256bbb5966761273e40805646c6 100644 (file)
@@ -76,6 +76,24 @@ static int spl_node_to_boot_device(int node)
        return -1;
 }
 
+/**
+ * board_spl_was_booted_from() - retrieves the of-path the SPL was loaded from
+ *
+ * To support a 'same-as-spl' specification in the search-order for the next
+ * stage, we need a SoC- or board-specific way to handshake with what 'came
+ * before us' (either a BROM or TPL stage) and map the info retrieved onto
+ * a OF path.
+ *
+ * Returns
+ *   NULL, on failure or if the device could not be identified
+ *   a of_path (a string), on success
+ */
+__weak const char *board_spl_was_booted_from(void)
+{
+       debug("%s: no support for 'same-as-spl' for this board\n", __func__);
+       return NULL;
+}
+
 void board_boot_order(u32 *spl_boot_list)
 {
        const void *blob = gd->fdt_blob;
@@ -97,8 +115,17 @@ void board_boot_order(u32 *spl_boot_list)
             (conf = fdt_stringlist_get(blob, chosen_node,
                                        "u-boot,spl-boot-order", elem, NULL));
             elem++) {
+               const char *alias;
+
+               /* Handle the case of 'same device the SPL was loaded from' */
+               if (strncmp(conf, "same-as-spl", 11) == 0) {
+                       conf = board_spl_was_booted_from();
+                       if (!conf)
+                               continue;
+               }
+
                /* First check if the list element is an alias */
-               const char *alias = fdt_get_alias(blob, conf);
+               alias = fdt_get_alias(blob, conf);
                if (alias)
                        conf = alias;
 
index 5625d210e8ce3844d545b7ca200408698b37b8ee..c96b8f7109053e21edca880f580c21bbdd325946 100644 (file)
@@ -56,10 +56,20 @@ Each list element of the property should specify a device to be probed
 in the order they are listed: references (i.e. implicit paths), a full
 path or an alias is expected for each entry.
 
+A special specifier "same-as-spl" can be used at any position in the
+boot-order to direct U-Boot to insert the device the SPL was booted
+from there.  Whether this is indeed inserted or silently ignored (if
+it is not supported on any given SoC/board or if the boot-device is
+not available to continue booting from) is implementation-defined.
+Note that if "same-as-spl" expands to an actual node for a given
+board, the corresponding node may appear multiple times in the
+boot-order (as there currently exists no mechanism to suppress
+duplicates from the list).
+
 Example
 -------
 / {
        chosen {
-               u-boot,spl-boot-order = &sdmmc, "/sdhci@fe330000";
+               u-boot,spl-boot-order = "same-as-spl", &sdmmc, "/sdhci@fe330000";
        };
 };