{"id":815063,"url":"http://patchwork.ozlabs.org/api/1.2/patches/815063/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1505758708-29213-4-git-send-email-philipp.tomsich@theobroma-systems.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/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":"<1505758708-29213-4-git-send-email-philipp.tomsich@theobroma-systems.com>","list_archive_url":null,"date":"2017-09-18T18:18:26","name":"[U-Boot,v2,3/5] rockchip: back-to-bootrom: rk3188: chain from SPL via TPL to the BROM","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"355a418f729e1b738788b39e7b848df256e67efc","submitter":{"id":53488,"url":"http://patchwork.ozlabs.org/api/1.2/people/53488/?format=json","name":"Philipp Tomsich","email":"philipp.tomsich@theobroma-systems.com"},"delegate":{"id":69486,"url":"http://patchwork.ozlabs.org/api/1.2/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/1505758708-29213-4-git-send-email-philipp.tomsich@theobroma-systems.com/mbox/","series":[{"id":3697,"url":"http://patchwork.ozlabs.org/api/1.2/series/3697/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=3697","date":"2017-09-18T18:18:23","name":"rockchip: back-to-bootrom: replace assembly-implementation with C-code","version":2,"mbox":"http://patchwork.ozlabs.org/series/3697/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815063/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815063/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 3xwvRn3pbQz9s7B\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 04:19:49 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 36340C21D70; Mon, 18 Sep 2017 18:18:58 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 094A0C21D57;\n\tMon, 18 Sep 2017 18:18:41 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid EF45BC21CA5; Mon, 18 Sep 2017 18:18:38 +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 5C5CEC21C2B\n\tfor <u-boot@lists.denx.de>; Mon, 18 Sep 2017 18:18:38 +0000 (UTC)","from [86.59.122.178] (port=34776 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 1du0ct-00053h-II; Mon, 18 Sep 2017 20:18:35 +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":"Mon, 18 Sep 2017 20:18:26 +0200","Message-Id":"<1505758708-29213-4-git-send-email-philipp.tomsich@theobroma-systems.com>","X-Mailer":"git-send-email 2.1.4","In-Reply-To":"<1505758708-29213-1-git-send-email-philipp.tomsich@theobroma-systems.com>","References":"<1505758708-29213-1-git-send-email-philipp.tomsich@theobroma-systems.com>","Cc":"Klaus Goger <klaus.goger@theobroma-systems.com>,\n\tAndy Yan <andy.yan@rock-chips.com>","Subject":"[U-Boot] [PATCH v2 3/5] rockchip: back-to-bootrom: rk3188: chain\n\tfrom SPL via TPL to the BROM","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":"The RK3188 implementation previously passed the address of the stack\nframe created during save_boot_params via pmu->os_reg[2]. This was not\nstrictly necessary, as the save_boot_params() function was called\ntwice (first: for TPL, saving the context for the BROM; next: for SPL,\nsaving the context for the TPL) and a back-to-bootrom from the SPL\nwould thus return to TPL.\n\nTo simplify things, we now assume that the state of the TPL is not\ncorrupted during SPL (the binaries are non-overlapping) and that the\nSPL can safely return to TPL using the back-to-bootrom mechanism.\nConsequently, the TPL should expect the SPL to return control and then\nfurther return to the actual bootrom by performing another\nback-to-bootrom transition.\n\nSigned-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>\n---\n\nChanges in v2:\n- [added in v2] chain back_to_bootrom calls for SPL, first returning\n  to the TPL (using the same mechanism) and the to the BROM from the\n  TPL\n\n arch/arm/mach-rockchip/rk3188-board-spl.c | 10 ----------\n arch/arm/mach-rockchip/rk3188-board-tpl.c | 17 ++++++++++-------\n 2 files changed, 10 insertions(+), 17 deletions(-)","diff":"diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c\nindex d3866bf..05d4ae6 100644\n--- a/arch/arm/mach-rockchip/rk3188-board-spl.c\n+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c\n@@ -101,7 +101,6 @@ static int setup_arm_clock(void)\n void board_init_f(ulong dummy)\n {\n \tstruct udevice *pinctrl, *dev;\n-\tstruct rk3188_pmu *pmu;\n \tint ret;\n \n \t/* Example code showing how to enable the debug UART on RK3188 */\n@@ -145,15 +144,6 @@ void board_init_f(ulong dummy)\n \t\treturn;\n \t}\n \n-\t/*\n-\t * Recover the bootrom's stackpointer.\n-\t * For whatever reason needs to run after rockchip_get_clk.\n-\t */\n-\tpmu = syscon_get_first_range(ROCKCHIP_SYSCON_PMU);\n-\tif (IS_ERR(pmu))\n-\t\terror(\"pmu syscon returned %ld\\n\", PTR_ERR(pmu));\n-\tSAVE_SP_ADDR = readl(&pmu->sys_reg[2]);\n-\n \tret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);\n \tif (ret) {\n \t\tdebug(\"Pinctrl init failed: %d\\n\", ret);\ndiff --git a/arch/arm/mach-rockchip/rk3188-board-tpl.c b/arch/arm/mach-rockchip/rk3188-board-tpl.c\nindex b458ef6..c714278 100644\n--- a/arch/arm/mach-rockchip/rk3188-board-tpl.c\n+++ b/arch/arm/mach-rockchip/rk3188-board-tpl.c\n@@ -21,15 +21,16 @@ static int rk3188_num_entries __attribute__ ((section(\".data\")));\n \n static void jump_to_spl(void)\n {\n-\ttypedef void __noreturn (*image_entry_noargs_t)(void);\n+\ttypedef void (*image_entry_noargs_t)(void);\n \n-\tstruct rk3188_pmu * const pmu = (void *)PMU_BASE;\n \timage_entry_noargs_t tpl_entry =\n \t\t(image_entry_noargs_t)(unsigned long)SPL_ENTRY;\n \n-\t/* Store the SAVE_SP_ADDR in a location shared with SPL. */\n-\twritel(SAVE_SP_ADDR, &pmu->sys_reg[2]);\n \ttpl_entry();\n+\t/*\n+\t * If the SPL stage triggers a 'return to bootrom', it will\n+\t * return to here.\n+\t */\n }\n \n void board_init_f(ulong dummy)\n@@ -77,10 +78,12 @@ void board_init_f(ulong dummy)\n \t\tback_to_bootrom();\n \t} else {\n \t\t/*\n-\t\t * TPL part of the loader should now wait for us\n-\t\t * at offset 0xC00 in the sram. Should never return\n-\t\t * from there.\n+\t\t * SPL part of the loader should now wait for us at\n+\t\t * offset 0xC00 in the sram. If the SPL returns to us,\n+\t\t * we should in turn return to the BROM (i.e. chain\n+\t\t * through).\n \t\t */\n \t\tjump_to_spl();\n+\t\tback_to_bootrom();\n \t}\n }\n","prefixes":["U-Boot","v2","3/5"]}