From patchwork Tue May 7 12:18:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096311 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzDm6m3Rz9sBp for ; Tue, 7 May 2019 22:19:20 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A66B7C21C4A; Tue, 7 May 2019 12:19:16 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 49174C21E13; Tue, 7 May 2019 12:19:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 65450C21DA2; Tue, 7 May 2019 12:19:01 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id 96B9DC21C50 for ; Tue, 7 May 2019 12:19:00 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 4FE0820009; Tue, 7 May 2019 12:18:58 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:43 +0200 Message-Id: <20190507121854.18575-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Fix a tiny typo in boot_from_devices() kernel doc. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- common/spl/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index 88d4b8a9bf..745da7d431 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -532,7 +532,7 @@ static int spl_load_image(struct spl_image_info *spl_image, } /** - * boot_from_devices() - Try loading an booting U-Boot from a list of devices + * boot_from_devices() - Try loading a booting U-Boot from a list of devices * * @spl_image: Place to put the image details if successful * @spl_boot_list: List of boot devices to try From patchwork Tue May 7 12:18:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096315 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzJ66XcNz9sBV for ; Tue, 7 May 2019 22:22:14 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 944DEC21DCA; Tue, 7 May 2019 12:19:57 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C36C1C21E3A; Tue, 7 May 2019 12:19:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 65E64C21DCA; Tue, 7 May 2019 12:19:04 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id 9B671C21DCA for ; Tue, 7 May 2019 12:19:01 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 869A520010; Tue, 7 May 2019 12:19:00 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:44 +0200 Message-Id: <20190507121854.18575-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" It is clearly stated that board_init_f should *not* call board_init_r. Indeed, board_init_f should return. The code will continue through arch/arm/lib/crt0.S which will do more setup before calling board_init_r. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/spl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/spear/spl.c b/arch/arm/cpu/arm926ejs/spear/spl.c index d2bddb589a..b004cccafd 100644 --- a/arch/arm/cpu/arm926ejs/spear/spl.c +++ b/arch/arm/cpu/arm926ejs/spear/spl.c @@ -251,6 +251,4 @@ void board_init_f(ulong dummy) puts("Configure DDR\n"); mpmc_init(); spear_late_init(); - - board_init_r(NULL, 0); } From patchwork Tue May 7 12:18:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096312 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzFl2d5Kz9sB8 for ; Tue, 7 May 2019 22:20:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EB7D2C21E18; Tue, 7 May 2019 12:19:30 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id CDBC2C21DED; Tue, 7 May 2019 12:19:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 41489C21E3B; Tue, 7 May 2019 12:19:06 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id AF19DC21E2C for ; Tue, 7 May 2019 12:19:02 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 90C6620004; Tue, 7 May 2019 12:19:01 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:45 +0200 Message-Id: <20190507121854.18575-4-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader' X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Rename Xloader as SPL in comments. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/start.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index 1cab4ca6fb..e69deb7926 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -33,14 +33,14 @@ reset: /* - * Xloader has to return back to BootROM in a few cases. + * SPL has to return back to BootROM in a few cases. * eg. Ethernet boot, UART boot, USB boot * Saving registers for returning back */ stmdb sp!, {r0-r12,r14} bl cpu_init_crit /* - * Clearing bss area is not done in Xloader. + * Clearing bss area is not done in SPL. * BSS area lies in the DDR location which is not yet initialized * bss is assumed to be uninitialized. */ From patchwork Tue May 7 12:18:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096318 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzJn3nXTz9sB8 for ; Tue, 7 May 2019 22:22:49 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D84A0C21E53; Tue, 7 May 2019 12:19:43 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 48163C21E13; Tue, 7 May 2019 12:19:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7CF61C21E3E; Tue, 7 May 2019 12:19:08 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id 408FFC21E44 for ; Tue, 7 May 2019 12:19:04 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 9CE1B2000A; Tue, 7 May 2019 12:19:02 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:46 +0200 Message-Id: <20190507121854.18575-5-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 04/12] arm: spear: Drop false comment X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" SPL BSS lies in SRAM and is actually initialized to 0 by the SPL in arch/arm/lib/crt0.S:_main(), which is called by cpu_init_crit. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/start.S | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index e69deb7926..4395985549 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -39,11 +39,6 @@ reset: */ stmdb sp!, {r0-r12,r14} bl cpu_init_crit -/* - * Clearing bss area is not done in SPL. - * BSS area lies in the DDR location which is not yet initialized - * bss is assumed to be uninitialized. - */ ldmia sp!, {r0-r12,pc} /* From patchwork Tue May 7 12:18:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096313 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzGQ6T2Cz9sB8 for ; Tue, 7 May 2019 22:20:46 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7E290C21E1B; Tue, 7 May 2019 12:20:10 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 63C50C21E60; Tue, 7 May 2019 12:19:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 81EA2C21C50; Tue, 7 May 2019 12:19:09 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id CF28DC21DB6 for ; Tue, 7 May 2019 12:19:05 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 3F9AD20017; Tue, 7 May 2019 12:19:04 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:47 +0200 Message-Id: <20190507121854.18575-6-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This comment describes the board state at the moment where we enter the SPL. The description is entirely wrong; re-write it to fit the reality. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/start.S | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index 4395985549..c3bb58c55b 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -21,10 +21,9 @@ * * Startup Code (reset vector) * - * Below are the critical initializations already taken place in BootROM. - * So, these are not taken care in Xloader - * 1. Relocation to RAM - * 2. Initializing stacks + * The BootROM already initialized its own stack in the [0-0xb00] reserved + * range of the SRAM. The SPL (in _main) will update the stack pointer to + * its own SRAM area (right before the gd section). * ************************************************************************* */ From patchwork Tue May 7 12:18:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096314 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzHx4J3qz9sB8 for ; Tue, 7 May 2019 22:22:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 58ACAC21DD7; Tue, 7 May 2019 12:20:23 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C24E5C21E70; Tue, 7 May 2019 12:19:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CFAEDC21E63; Tue, 7 May 2019 12:19:10 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id DEC0DC21DDC for ; Tue, 7 May 2019 12:19:06 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id BDD9420004; Tue, 7 May 2019 12:19:05 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:48 +0200 Message-Id: <20190507121854.18575-7-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes in start.S X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Before cleaning a bit further the spear/start.S file, apply a few cosmetic changes: capital letters, comment indentation and small rewriting. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/start.S | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index c3bb58c55b..566cf668b7 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -31,11 +31,10 @@ .globl reset reset: -/* - * SPL has to return back to BootROM in a few cases. - * eg. Ethernet boot, UART boot, USB boot - * Saving registers for returning back - */ + /* + * SPL has to return back to BootROM in a few cases (eg. Ethernet boot, + * UART boot, USB boot): save registers in BootROM's stack. + */ stmdb sp!, {r0-r12,r14} bl cpu_init_crit ldmia sp!, {r0-r12,pc} @@ -52,14 +51,14 @@ reset: */ cpu_init_crit: /* - * flush v4 I/D caches + * Flush v4 I/D caches */ mov r0, #0 - mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */ - mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */ + mcr p15, 0, r0, c7, c7, 0 /* Flush v3/v4 cache */ + mcr p15, 0, r0, c8, c7, 0 /* Flush v4 TLB */ /* - * enable instruction cache + * Enable instruction cache */ mrc p15, 0, r0, c1, c0, 0 orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */ From patchwork Tue May 7 12:18:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096322 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzMb0NXgz9sB8 for ; Tue, 7 May 2019 22:25:14 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id ACF57C21D74; Tue, 7 May 2019 12:20:48 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 09391C21E34; Tue, 7 May 2019 12:19:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DBFFCC21E47; Tue, 7 May 2019 12:19:11 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id DEC19C21E47 for ; Tue, 7 May 2019 12:19:07 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id CB1F12001C; Tue, 7 May 2019 12:19:06 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:49 +0200 Message-Id: <20190507121854.18575-8-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Quoting ARM "RealView Compilation Tools Assembler Guide v4.0": PUSH and POP are synonyms for STMDB and LDM (or LDMIA), with the base register sp (r13), and the adjusted address written back to the base register. PUSH and POP are the preferred mnemonic in these cases. Let's follow this recommandation to ease the reading and substitute LDMIA/STMDB operations with PUSH/POP mnemonics. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/start.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index 566cf668b7..25895f01ac 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -35,9 +35,9 @@ reset: * SPL has to return back to BootROM in a few cases (eg. Ethernet boot, * UART boot, USB boot): save registers in BootROM's stack. */ - stmdb sp!, {r0-r12,r14} + push {r0-r12,r14} bl cpu_init_crit - ldmia sp!, {r0-r12,pc} + pop {r0-r12,pc} /* ************************************************************************* @@ -67,6 +67,6 @@ cpu_init_crit: /* * Go setup Memory and board specific bits prior to relocation. */ - stmdb sp!, {lr} + push {lr} bl _main /* _main will call board_init_f */ - ldmia sp!, {pc} + pop {pc} From patchwork Tue May 7 12:18:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096319 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzKZ54SQz9sB8 for ; Tue, 7 May 2019 22:23:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 48E90C21E52; Tue, 7 May 2019 12:21:14 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 050D9C21DA2; Tue, 7 May 2019 12:19:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 72EF4C21DAF; Tue, 7 May 2019 12:19:12 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id EA829C21E6C for ; Tue, 7 May 2019 12:19:08 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id CF15720009; Tue, 7 May 2019 12:19:07 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:50 +0200 Message-Id: <20190507121854.18575-9-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The link register is stored in R14. ARM assembly code allows to use the 'lr' name to reference it instead of 'r14' which is not very meaningful. Do the substitution to ease the reading. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/start.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index 25895f01ac..2bc9d5990e 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -35,7 +35,7 @@ reset: * SPL has to return back to BootROM in a few cases (eg. Ethernet boot, * UART boot, USB boot): save registers in BootROM's stack. */ - push {r0-r12,r14} + push {r0-r12,lr} bl cpu_init_crit pop {r0-r12,pc} From patchwork Tue May 7 12:18:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096317 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzJg3C2pz9sB8 for ; Tue, 7 May 2019 22:22:43 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EFEB9C21C8B; Tue, 7 May 2019 12:21:27 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8EDC7C21E76; Tue, 7 May 2019 12:19:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A3B95C21DED; Tue, 7 May 2019 12:19:13 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id 2FFF9C21C4A for ; Tue, 7 May 2019 12:19:10 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 16CF120018; Tue, 7 May 2019 12:19:08 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:51 +0200 Message-Id: <20190507121854.18575-10-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" There is no reason to do the few spear-related initialization, in a different procedure than 'reset'. Spare one branching and get a linear code flow by removing this indirection. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/start.S | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index 2bc9d5990e..5fb2bd12ec 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -36,20 +36,7 @@ reset: * UART boot, USB boot): save registers in BootROM's stack. */ push {r0-r12,lr} - bl cpu_init_crit - pop {r0-r12,pc} -/* - ************************************************************************* - * - * CPU_init_critical registers - * - * setup important registers - * setup memory timing - * - ************************************************************************* - */ -cpu_init_crit: /* * Flush v4 I/D caches */ @@ -67,6 +54,6 @@ cpu_init_crit: /* * Go setup Memory and board specific bits prior to relocation. */ - push {lr} bl _main /* _main will call board_init_f */ - pop {pc} + + pop {r0-r12,pc} From patchwork Tue May 7 12:18:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096321 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzMR0Hmfz9sBV for ; Tue, 7 May 2019 22:25:06 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7D7FAC21E63; Tue, 7 May 2019 12:20:36 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5C7FDC21E36; Tue, 7 May 2019 12:19:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C37FCC21E36; Tue, 7 May 2019 12:19:14 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id 6E77EC21E18 for ; Tue, 7 May 2019 12:19:11 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 17E6C2001E; Tue, 7 May 2019 12:19:09 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:52 +0200 Message-Id: <20190507121854.18575-11-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Implement the weak board_return_to_bootrom() function so that when enabling the spl_bootrom.c driver, one can make use of usbboot on spear platforms. All necessary information to return to the BootROM are stored in the BootROM's stack. The SPL stack pointer is reset so we save the BootROM's stack pointer into the SPL .data section. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/spl.c | 35 ++++++++++++++++++++++++++-- arch/arm/cpu/arm926ejs/spear/start.S | 7 +++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/spear/spl.c b/arch/arm/cpu/arm926ejs/spear/spl.c index b004cccafd..b2cacf2d3e 100644 --- a/arch/arm/cpu/arm926ejs/spear/spl.c +++ b/arch/arm/cpu/arm926ejs/spear/spl.c @@ -16,6 +16,12 @@ #include #include +/* Reserve some space to store the BootROM's stack pointer during SPL operation. + * The BSS cannot be used for this purpose because it will be zeroed after + * having stored the pointer, so force the location to the data section. + */ +u32 bootrom_stash_sp __attribute__((section(".data"))); + static void ddr_clock_init(void) { struct misc_regs *misc_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE; @@ -223,8 +229,9 @@ u32 spl_boot_device(void) { u32 mode = 0; - /* Currently only SNOR is supported as the only */ - if (snor_boot_selected()) { + if (usb_boot_selected()) { + mode = BOOT_DEVICE_BOOTROM; + } else if (snor_boot_selected()) { /* SNOR-SMI initialization */ snor_init(); @@ -252,3 +259,27 @@ void board_init_f(ulong dummy) mpmc_init(); spear_late_init(); } + +/* + * In a few cases (Ethernet, UART or USB boot, we might want to go back into the + * BootROM code right after having initialized a few components like the DRAM). + * The following function is called from SPL common code (board_init_r). + */ +void board_return_to_bootrom(void) +{ + /* + * Retrieve the BootROM's stack pointer and jump back to the start of + * the SPL, where we can easily branch back into the BootROM. Don't do + * it right here because SPL might be compiled in Thumb mode while the + * BootROM expects ARM mode. + */ + asm volatile ("ldr r0, =bootrom_stash_sp;" + "ldr r0, [r0];" + "mov sp, r0;" +#if defined(CONFIG_SPL_SYS_THUMB_BUILD) + "blx back_to_bootrom;" +#else + "bl back_to_bootrom;" +#endif + ); +} diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index 5fb2bd12ec..2cf854eb74 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -29,13 +29,17 @@ */ .globl reset + .globl back_to_bootrom reset: /* * SPL has to return back to BootROM in a few cases (eg. Ethernet boot, - * UART boot, USB boot): save registers in BootROM's stack. + * UART boot, USB boot): save registers in BootROM's stack and then the + * BootROM's stack pointer in the SPL's data section. */ push {r0-r12,lr} + ldr r0, =bootrom_stash_sp + str sp, [r0] /* * Flush v4 I/D caches @@ -56,4 +60,5 @@ reset: */ bl _main /* _main will call board_init_f */ +back_to_bootrom: pop {r0-r12,pc} From patchwork Tue May 7 12:18:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096316 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzJb679nz9sB8 for ; Tue, 7 May 2019 22:22:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7EAAEC21DED; Tue, 7 May 2019 12:21:01 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8F04BC21E2C; Tue, 7 May 2019 12:19:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0FB82C21E7D; Tue, 7 May 2019 12:19:15 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id 4B3C9C21E30 for ; Tue, 7 May 2019 12:19:12 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 236BF20007; Tue, 7 May 2019 12:19:10 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:53 +0200 Message-Id: <20190507121854.18575-12-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The _main call is not supposed to return at all: don't link the branch. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/start.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/cpu/arm926ejs/spear/start.S b/arch/arm/cpu/arm926ejs/spear/start.S index 2cf854eb74..9ac96291b7 100644 --- a/arch/arm/cpu/arm926ejs/spear/start.S +++ b/arch/arm/cpu/arm926ejs/spear/start.S @@ -57,8 +57,9 @@ reset: /* * Go setup Memory and board specific bits prior to relocation. + * This call is not supposed to return. */ - bl _main /* _main will call board_init_f */ + b _main /* _main will call board_init_f */ back_to_bootrom: pop {r0-r12,pc} From patchwork Tue May 7 12:18:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1096320 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44yzLL2qPzz9sB8 for ; Tue, 7 May 2019 22:24:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EDEAEC21CB1; Tue, 7 May 2019 12:21:40 +0000 (UTC) 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 autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 44DA0C21DDC; Tue, 7 May 2019 12:20:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7820EC21E2F; Tue, 7 May 2019 12:19:17 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lists.denx.de (Postfix) with ESMTPS id 6F3F7C21DA6 for ; Tue, 7 May 2019 12:19:14 +0000 (UTC) X-Originating-IP: 90.88.149.145 Received: from localhost.localdomain (aaubervilliers-681-1-29-145.w90-88.abo.wanadoo.fr [90.88.149.145]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 419072001A; Tue, 7 May 2019 12:19:12 +0000 (UTC) From: Miquel Raynal To: Albert Aribaud Date: Tue, 7 May 2019 14:18:54 +0200 Message-Id: <20190507121854.18575-13-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190507121854.18575-1-miquel.raynal@bootlin.com> References: <20190507121854.18575-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Cc: Miquel Raynal , u-boot@lists.denx.de, Stefan Roese , Thomas Petazzoni , Tom Rini Subject: [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Overload the weak function board_boot_order() so that besides choosing the main boot device, we can fallback on USB boot by returning in the BootROM, eg. if the NOR flash is empty while it was the primary boot medium. Signed-off-by: Miquel Raynal Reviewed-by: Stefan Roese --- arch/arm/cpu/arm926ejs/spear/spl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/cpu/arm926ejs/spear/spl.c b/arch/arm/cpu/arm926ejs/spear/spl.c index b2cacf2d3e..fc332fb626 100644 --- a/arch/arm/cpu/arm926ejs/spear/spl.c +++ b/arch/arm/cpu/arm926ejs/spear/spl.c @@ -241,6 +241,18 @@ u32 spl_boot_device(void) return mode; } +void board_boot_order(u32 *spl_boot_list) +{ + spl_boot_list[0] = spl_boot_device(); + + /* + * If the main boot device (eg. NOR) is empty, try to jump back into the + * BootROM for USB boot process. + */ + if (USB_BOOT_SUPPORTED) + spl_boot_list[1] = BOOT_DEVICE_BOOTROM; +} + void board_init_f(ulong dummy) { struct misc_regs *misc_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE;