{"id":812926,"url":"http://patchwork.ozlabs.org/api/patches/812926/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1505230666-14290-5-git-send-email-philipp.tomsich@theobroma-systems.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505230666-14290-5-git-send-email-philipp.tomsich@theobroma-systems.com>","list_archive_url":null,"date":"2017-09-12T15:37:40","name":"[U-Boot,RESEND,04/10] rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0ba0365bf5d71abe4c64ab87fb5febb266d1876e","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/people/53488/?format=json","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"delegate":{"id":69486,"url":"http://patchwork.ozlabs.org/api/users/69486/?format=json","username":"ptomsich","first_name":"Philipp","last_name":"Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1505230666-14290-5-git-send-email-philipp.tomsich@theobroma-systems.com/mbox/","series":[{"id":2729,"url":"http://patchwork.ozlabs.org/api/series/2729/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=2729","date":"2017-09-12T15:37:37","name":"rockchip: puma-rk3399: support 'same-as-spl' for boot-order and always power-up eMMC/SPI","version":1,"mbox":"http://patchwork.ozlabs.org/series/2729/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812926/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812926/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xs8DY0Rv5z9s0Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 01:42:04 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid AFDE7C222B2; Tue, 12 Sep 2017 15:38:51 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id CF7CFC220BE;\n\tTue, 12 Sep 2017 15:37:58 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 9A3DFC221A4; Tue, 12 Sep 2017 15:37:54 +0000 (UTC)","from mail.theobroma-systems.com (vegas.theobroma-systems.com\n\t[144.76.126.164])\n\tby lists.denx.de (Postfix) with ESMTPS id 5379FC2206D\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 15:37:54 +0000 (UTC)","from [86.59.122.178] (port=59704 helo=android.lan)\n\tby mail.theobroma-systems.com with esmtpsa\n\t(TLS1.2:RSA_AES_128_CBC_SHA256:128)\n\t(Exim 4.80) (envelope-from <philipp.tomsich@theobroma-systems.com>)\n\tid 1drnG5-0007is-2n; Tue, 12 Sep 2017 17:37:53 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=none autolearn=unavailable\n\tautolearn_force=no version=3.4.0","From":"Philipp Tomsich <philipp.tomsich@theobroma-systems.com>","To":"u-boot@lists.denx.de","Date":"Tue, 12 Sep 2017 17:37:40 +0200","Message-Id":"<1505230666-14290-5-git-send-email-philipp.tomsich@theobroma-systems.com>","X-Mailer":"git-send-email 2.1.4","In-Reply-To":"<1505230666-14290-1-git-send-email-philipp.tomsich@theobroma-systems.com>","References":"<1505230666-14290-1-git-send-email-philipp.tomsich@theobroma-systems.com>","Cc":"Albert Aribaud <albert.u.boot@aribaud.net>,\n\tKlaus Goger <klaus.goger@theobroma-systems.com>","Subject":"[U-Boot] [RESEND PATCH 04/10] rockchip: spl: support a\n\t'same-as-spl'-specifier in the spl-boot-order","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"It is often desirable to configure the spl-boot-order (i.e. the order\nthat SPL probes devices to find the FIT image containing a full U-Boot)\nsuch that it contains 'the same device the SPL stage was booted from'\nearly on.  To support this, we introduce the 'same-as-spl' specifier\nfor the spl-boot-order property.\n\nThis commit adds:\n - documentation for the new board_spl_was_booted_from() function that\n   individual SoCs/boards should provide, if they can determine where\n   the SPL was booted from\n - implements the new board_spl_was_booted_from() stub function\n - adds support for handling the 'same-as-spl' specifier and calling\n   into the per-SoC/per-board support code.\n\nThis also updates the documentation for the 'u-boot,spl-boot-order'\nproperty.\n\nSigned-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n---\n\n arch/arm/mach-rockchip/spl-boot-order.c | 29 ++++++++++++++++++++++++++++-\n doc/device-tree-bindings/chosen.txt     | 12 +++++++++++-\n 2 files changed, 39 insertions(+), 2 deletions(-)","diff":"diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c\nindex 0bb9a73..843998d 100644\n--- a/arch/arm/mach-rockchip/spl-boot-order.c\n+++ b/arch/arm/mach-rockchip/spl-boot-order.c\n@@ -76,6 +76,24 @@ static int spl_node_to_boot_device(int node)\n \treturn -1;\n }\n \n+/**\n+ * board_spl_was_booted_from() - retrieves the of-path the SPL was loaded from\n+ *\n+ * To support a 'same-as-spl' specification in the search-order for the next\n+ * stage, we need a SoC- or board-specific way to handshake with what 'came\n+ * before us' (either a BROM or TPL stage) and map the info retrieved onto\n+ * a OF path.\n+ *\n+ * Returns\n+ *   NULL, on failure or if the device could not be identified\n+ *   a of_path (a string), on success\n+ */\n+__weak const char *board_spl_was_booted_from(void)\n+{\n+\tdebug(\"%s: no support for 'same-as-spl' for this board\\n\", __func__);\n+\treturn NULL;\n+}\n+\n void board_boot_order(u32 *spl_boot_list)\n {\n \tconst void *blob = gd->fdt_blob;\n@@ -97,8 +115,17 @@ void board_boot_order(u32 *spl_boot_list)\n \t     (conf = fdt_stringlist_get(blob, chosen_node,\n \t\t\t\t\t\"u-boot,spl-boot-order\", elem, NULL));\n \t     elem++) {\n+\t\tconst char *alias;\n+\n+\t\t/* Handle the case of 'same device the SPL was loaded from' */\n+\t\tif (strncmp(conf, \"same-as-spl\", 11) == 0) {\n+\t\t\tconf = board_spl_was_booted_from();\n+\t\t\tif (!conf)\n+\t\t\t\tcontinue;\n+\t\t}\n+\n \t\t/* First check if the list element is an alias */\n-\t\tconst char *alias = fdt_get_alias(blob, conf);\n+\t\talias = fdt_get_alias(blob, conf);\n \t\tif (alias)\n \t\t\tconf = alias;\n \ndiff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt\nindex 5625d21..c96b8f7 100644\n--- a/doc/device-tree-bindings/chosen.txt\n+++ b/doc/device-tree-bindings/chosen.txt\n@@ -56,10 +56,20 @@ Each list element of the property should specify a device to be probed\n in the order they are listed: references (i.e. implicit paths), a full\n path or an alias is expected for each entry.\n \n+A special specifier \"same-as-spl\" can be used at any position in the\n+boot-order to direct U-Boot to insert the device the SPL was booted\n+from there.  Whether this is indeed inserted or silently ignored (if\n+it is not supported on any given SoC/board or if the boot-device is\n+not available to continue booting from) is implementation-defined.\n+Note that if \"same-as-spl\" expands to an actual node for a given\n+board, the corresponding node may appear multiple times in the\n+boot-order (as there currently exists no mechanism to suppress\n+duplicates from the list).\n+\n Example\n -------\n / {\n \tchosen {\n-\t\tu-boot,spl-boot-order = &sdmmc, \"/sdhci@fe330000\";\n+\t\tu-boot,spl-boot-order = \"same-as-spl\", &sdmmc, \"/sdhci@fe330000\";\n \t};\n };\n","prefixes":["U-Boot","RESEND","04/10"]}