All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL
@ 2019-05-07 12:18 Miquel Raynal
  2019-05-07 12:18 ` [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc Miquel Raynal
                   ` (12 more replies)
  0 siblings, 13 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: u-boot

Spear machines currently have only the possibility to boot from NOR
while an interesting alternative exist: booting from USB. For this,
the BootROM will enumerate an USB device and wait for a RAM driver
(likely, the SPL). It will load the driver in SRAM and jump to
it. Once the initialization done, the SPL must return back into the
BootROM so that another enumeration occurs allowing the user to upload
the full Bootloader (eg. U-Boot). The BootROM will finally load the
file in RAM and jump into it.

Most of the patches are cleanups and preparation work to ease the
reading of the main assembly file.

The last patch is a fallback on USB Boot if the NOR is empty or
corrupted. Of course if USB boot has not been enabled, nothing will
happen.

Tested on a custom board featuring a SPEAr600.

Hope this change will find users!

Thanks,
Miquèl


Miquel Raynal (12):
  spl: Fix typo in kernel doc
  arm: spear: Drop useless board_init_r call
  arm: spear: Call the SPL 'SPL', not 'Xloader'
  arm: spear: Drop false comment
  arm: spear: Fix the main comment in start.S
  arm: spear: Purely cosmetic changes in start.S
  arm: spear: Use PUSH/POP mnemonics when relevant
  arm: spear: Reference the link register with LR instead of R14
  arm: spear: Simplify start.S organization
  arm: spear: Support returning to BootROM
  arm: spear: Do not link the _main branch
  arm: spear: Return to BootROM if failing to boot from the main device

 arch/arm/cpu/arm926ejs/spear/spl.c   | 47 +++++++++++++++++++++--
 arch/arm/cpu/arm926ejs/spear/start.S | 56 +++++++++++-----------------
 common/spl/spl.c                     |  2 +-
 3 files changed, 66 insertions(+), 39 deletions(-)

-- 
2.19.1

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:40   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call Miquel Raynal
                   ` (11 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: u-boot

Fix a tiny typo in boot_from_devices() kernel doc.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 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
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
  2019-05-07 12:18 ` [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:40   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader' Miquel Raynal
                   ` (10 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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);
 }
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader'
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
  2019-05-07 12:18 ` [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc Miquel Raynal
  2019-05-07 12:18 ` [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:40   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 04/12] arm: spear: Drop false comment Miquel Raynal
                   ` (9 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: u-boot

Rename Xloader as SPL in comments.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 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.
  */
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 04/12] arm: spear: Drop false comment
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (2 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader' Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:41   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S Miquel Raynal
                   ` (8 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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}
 
 /*
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (3 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 04/12] arm: spear: Drop false comment Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:41   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes " Miquel Raynal
                   ` (7 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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).
  *
  *************************************************************************
  */
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes in start.S
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (4 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:41   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant Miquel Raynal
                   ` (6 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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 */
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (5 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes " Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:42   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14 Miquel Raynal
                   ` (5 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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}
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (6 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:42   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization Miquel Raynal
                   ` (4 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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}
 
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (7 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14 Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:42   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM Miquel Raynal
                   ` (3 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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}
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (8 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:44   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch Miquel Raynal
                   ` (2 subsequent siblings)
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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 <asm/arch/spr_syscntl.h>
 #include <linux/mtd/st_smi.h>
 
+/* 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}
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (9 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:44   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:18 ` [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device Miquel Raynal
  2019-05-07 12:50 ` [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Stefan Roese
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: u-boot

The _main call is not supposed to return at all: don't link the
branch.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 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}
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (10 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch Miquel Raynal
@ 2019-05-07 12:18 ` Miquel Raynal
  2019-05-07 12:45   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  2019-05-07 12:50 ` [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Stefan Roese
  12 siblings, 2 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:18 UTC (permalink / raw)
  To: 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 <miquel.raynal@bootlin.com>
---
 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;
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc
  2019-05-07 12:18 ` [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc Miquel Raynal
@ 2019-05-07 12:40   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:40 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> Fix a tiny typo in boot_from_devices() kernel doc.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call
  2019-05-07 12:18 ` [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call Miquel Raynal
@ 2019-05-07 12:40   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:40 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader'
  2019-05-07 12:18 ` [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader' Miquel Raynal
@ 2019-05-07 12:40   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:40 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> Rename Xloader as SPL in comments.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 04/12] arm: spear: Drop false comment
  2019-05-07 12:18 ` [U-Boot] [PATCH 04/12] arm: spear: Drop false comment Miquel Raynal
@ 2019-05-07 12:41   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:41 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S
  2019-05-07 12:18 ` [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S Miquel Raynal
@ 2019-05-07 12:41   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:41 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes in start.S
  2019-05-07 12:18 ` [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes " Miquel Raynal
@ 2019-05-07 12:41   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:41 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant
  2019-05-07 12:18 ` [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant Miquel Raynal
@ 2019-05-07 12:42   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:42 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14
  2019-05-07 12:18 ` [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14 Miquel Raynal
@ 2019-05-07 12:42   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:42 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization
  2019-05-07 12:18 ` [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization Miquel Raynal
@ 2019-05-07 12:42   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:42 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM
  2019-05-07 12:18 ` [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM Miquel Raynal
@ 2019-05-07 12:44   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:44 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch
  2019-05-07 12:18 ` [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch Miquel Raynal
@ 2019-05-07 12:44   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:44 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> The _main call is not supposed to return at all: don't link the
> branch.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device
  2019-05-07 12:18 ` [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device Miquel Raynal
@ 2019-05-07 12:45   ` Stefan Roese
  2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:45 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> 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 <miquel.raynal@bootlin.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL
  2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
                   ` (11 preceding siblings ...)
  2019-05-07 12:18 ` [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device Miquel Raynal
@ 2019-05-07 12:50 ` Stefan Roese
  2019-05-07 12:52   ` Miquel Raynal
  12 siblings, 1 reply; 39+ messages in thread
From: Stefan Roese @ 2019-05-07 12:50 UTC (permalink / raw)
  To: u-boot

On 07.05.19 14:18, Miquel Raynal wrote:
> Spear machines currently have only the possibility to boot from NOR
> while an interesting alternative exist: booting from USB. For this,
> the BootROM will enumerate an USB device and wait for a RAM driver
> (likely, the SPL). It will load the driver in SRAM and jump to
> it. Once the initialization done, the SPL must return back into the
> BootROM so that another enumeration occurs allowing the user to upload
> the full Bootloader (eg. U-Boot). The BootROM will finally load the
> file in RAM and jump into it.
> 
> Most of the patches are cleanups and preparation work to ease the
> reading of the main assembly file.
> 
> The last patch is a fallback on USB Boot if the NOR is empty or
> corrupted. Of course if USB boot has not been enabled, nothing will
> happen.
> 
> Tested on a custom board featuring a SPEAr600.
> 
> Hope this change will find users!

Many thanks for working on this and improving the neglected SPEAr
U-Boot port. It's quite some time since I worked on this platform
and I still do have a x600 board hidden somewhere. Frankly, if
there is no real need I will not dig this board up to update and
test a new U-Boot version on it (sorry).

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL
  2019-05-07 12:50 ` [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Stefan Roese
@ 2019-05-07 12:52   ` Miquel Raynal
  0 siblings, 0 replies; 39+ messages in thread
From: Miquel Raynal @ 2019-05-07 12:52 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

Stefan Roese <sr@denx.de> wrote on Tue, 7 May 2019 14:50:02 +0200:

> On 07.05.19 14:18, Miquel Raynal wrote:
> > Spear machines currently have only the possibility to boot from NOR
> > while an interesting alternative exist: booting from USB. For this,
> > the BootROM will enumerate an USB device and wait for a RAM driver
> > (likely, the SPL). It will load the driver in SRAM and jump to
> > it. Once the initialization done, the SPL must return back into the
> > BootROM so that another enumeration occurs allowing the user to upload
> > the full Bootloader (eg. U-Boot). The BootROM will finally load the
> > file in RAM and jump into it.
> > 
> > Most of the patches are cleanups and preparation work to ease the
> > reading of the main assembly file.
> > 
> > The last patch is a fallback on USB Boot if the NOR is empty or
> > corrupted. Of course if USB boot has not been enabled, nothing will
> > happen.
> > 
> > Tested on a custom board featuring a SPEAr600.
> > 
> > Hope this change will find users!  
> 
> Many thanks for working on this and improving the neglected SPEAr
> U-Boot port. It's quite some time since I worked on this platform
> and I still do have a x600 board hidden somewhere. Frankly, if
> there is no real need I will not dig this board up to update and
> test a new U-Boot version on it (sorry).

Absolutely no problem, thanks for reviewing!

Miquèl

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc
  2019-05-07 12:18 ` [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc Miquel Raynal
  2019-05-07 12:40   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:43PM +0200, Miquel Raynal wrote:

> Fix a tiny typo in boot_from_devices() kernel doc.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/aca629c4/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call
  2019-05-07 12:18 ` [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call Miquel Raynal
  2019-05-07 12:40   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:44PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/300057e3/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader'
  2019-05-07 12:18 ` [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader' Miquel Raynal
  2019-05-07 12:40   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:45PM +0200, Miquel Raynal wrote:

> Rename Xloader as SPL in comments.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/82f2e2e4/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 04/12] arm: spear: Drop false comment
  2019-05-07 12:18 ` [U-Boot] [PATCH 04/12] arm: spear: Drop false comment Miquel Raynal
  2019-05-07 12:41   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:46PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/0fc11e65/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S
  2019-05-07 12:18 ` [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S Miquel Raynal
  2019-05-07 12:41   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:47PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/f7cddcb8/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes in start.S
  2019-05-07 12:18 ` [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes " Miquel Raynal
  2019-05-07 12:41   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:48PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/955ac998/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant
  2019-05-07 12:18 ` [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant Miquel Raynal
  2019-05-07 12:42   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:49PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/de3d9fcf/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14
  2019-05-07 12:18 ` [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14 Miquel Raynal
  2019-05-07 12:42   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:50PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/3ce55055/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization
  2019-05-07 12:18 ` [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization Miquel Raynal
  2019-05-07 12:42   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:51PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/cee97581/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM
  2019-05-07 12:18 ` [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM Miquel Raynal
  2019-05-07 12:44   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:52PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/c12ab0c8/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch
  2019-05-07 12:18 ` [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch Miquel Raynal
  2019-05-07 12:44   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:53PM +0200, Miquel Raynal wrote:

> The _main call is not supposed to return at all: don't link the
> branch.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/fb75e89a/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

* [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device
  2019-05-07 12:18 ` [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device Miquel Raynal
  2019-05-07 12:45   ` Stefan Roese
@ 2019-07-11 22:05   ` Tom Rini
  1 sibling, 0 replies; 39+ messages in thread
From: Tom Rini @ 2019-07-11 22:05 UTC (permalink / raw)
  To: u-boot

On Tue, May 07, 2019 at 02:18:54PM +0200, Miquel Raynal wrote:

> 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 <miquel.raynal@bootlin.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/ad44946d/attachment.sig>

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2019-07-11 22:05 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07 12:18 [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Miquel Raynal
2019-05-07 12:18 ` [U-Boot] [PATCH 01/12] spl: Fix typo in kernel doc Miquel Raynal
2019-05-07 12:40   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 02/12] arm: spear: Drop useless board_init_r call Miquel Raynal
2019-05-07 12:40   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 03/12] arm: spear: Call the SPL 'SPL', not 'Xloader' Miquel Raynal
2019-05-07 12:40   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 04/12] arm: spear: Drop false comment Miquel Raynal
2019-05-07 12:41   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 05/12] arm: spear: Fix the main comment in start.S Miquel Raynal
2019-05-07 12:41   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 06/12] arm: spear: Purely cosmetic changes " Miquel Raynal
2019-05-07 12:41   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 07/12] arm: spear: Use PUSH/POP mnemonics when relevant Miquel Raynal
2019-05-07 12:42   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 08/12] arm: spear: Reference the link register with LR instead of R14 Miquel Raynal
2019-05-07 12:42   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 09/12] arm: spear: Simplify start.S organization Miquel Raynal
2019-05-07 12:42   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 10/12] arm: spear: Support returning to BootROM Miquel Raynal
2019-05-07 12:44   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 11/12] arm: spear: Do not link the _main branch Miquel Raynal
2019-05-07 12:44   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:18 ` [U-Boot] [PATCH 12/12] arm: spear: Return to BootROM if failing to boot from the main device Miquel Raynal
2019-05-07 12:45   ` Stefan Roese
2019-07-11 22:05   ` Tom Rini
2019-05-07 12:50 ` [U-Boot] [PATCH 00/12] Enable returning back to BootROM from spear SPL Stefan Roese
2019-05-07 12:52   ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.