Enable returning back to BootROM from spear SPL
cover Enable returning back to BootROM from spear SPL
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(-)
Signature · 1 line
2.19.1
PATCH 1/12 spl: Fix typo in kernel doc
Fix a tiny typo in boot_from_devices() kernel doc.
--- common/spl/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl.c +1 -1
@@ -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
Signature · 1 line
2.19.1
PATCH 1/12 spl: Fix typo in kernel doc
Quoted 3 lines · Miquel Raynal
Fix a tiny typo in
boot_from_devices()kernel doc.Signed-off-by Miquel Raynal <[email protected]>
Thanks,
Stefan
PATCH 1/12 spl: Fix typo in kernel doc
In reply to Miquel RaynalQuoted 4 lines · Miquel Raynal
Fix a tiny typo in
boot_from_devices()kernel doc.Signed-off-by Miquel Raynal <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 2/12 arm: spear: Drop useless board_init_r call
In reply to Miquel RaynalIt 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.
--- arch/arm/cpu/arm926ejs/spear/spl.c | 2 -- 1 file changed, 2 deletions(-)
arch/arm/cpu/arm926ejs/spear/spl.c +0 -2
@@ -251,6 +251,4 @@ void board_init_f(ulong dummy)puts ("Configure DDR\n" );mpmc_init ();spear_late_init (); - -board_init_r (NULL ,0 ); }
Signature · 1 line
2.19.1
PATCH 2/12 arm: spear: Drop useless board_init_r call
Quoted 6 lines · Miquel Raynal
It is clearly stated that
board_init_fshould *not* callboard_init_r. Indeed,board_init_fshould return. The code will continue througharch/arm/lib/crt0.Swhich will do more setup before callingboard_init_r.Signed-off-by Miquel Raynal <[email protected]>
Thanks,
Stefan
PATCH 2/12 arm: spear: Drop useless board_init_r call
In reply to Miquel RaynalQuoted 7 lines · Miquel Raynal
It is clearly stated that
board_init_fshould *not* callboard_init_r. Indeed,board_init_fshould return. The code will continue througharch/arm/lib/crt0.Swhich will do more setup before callingboard_init_r.Signed-off-by Miquel Raynal <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 3/12 arm: spear: Call the SPL 'SPL', not 'Xloader'
In reply to Miquel RaynalRename Xloader as SPL in comments.
--- arch/arm/cpu/arm926ejs/spear/start.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/spear/start.S +2 -2
@@ -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. */
Signature · 1 line
2.19.1
PATCH 3/12 arm: spear: Call the SPL 'SPL', not 'Xloader'
Quoted 3 lines · Miquel Raynal
Rename Xloader as SPL in comments.
Signed-off-by Miquel Raynal <[email protected]>
Thanks,
Stefan
PATCH 3/12 arm: spear: Call the SPL 'SPL', not 'Xloader'
In reply to Miquel RaynalQuoted 4 lines · Miquel Raynal
Rename Xloader as SPL in comments.
Signed-off-by Miquel Raynal <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 4/12 arm: spear: Drop false comment
In reply to Miquel RaynalSPL 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.
--- arch/arm/cpu/arm926ejs/spear/start.S | 5 ----- 1 file changed, 5 deletions(-)
arch/arm/cpu/arm926ejs/spear/start.S +0 -5
@@ -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} /*
Signature · 1 line
2.19.1
PATCH 4/12 arm: spear: Drop false comment
Quoted 4 lines · Miquel Raynal
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 <[email protected]>
Thanks,
Stefan
PATCH 4/12 arm: spear: Drop false comment
In reply to Miquel RaynalQuoted 5 lines · Miquel Raynal
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 <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 5/12 arm: spear: Fix the main comment in start.S
In reply to Miquel RaynalThis 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.
--- arch/arm/cpu/arm926ejs/spear/start.S | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm/cpu/arm926ejs/spear/start.S +3 -4
@@ -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). * ************************************************************************* */
Signature · 1 line
2.19.1
PATCH 5/12 arm: spear: Fix the main comment in start.S
Quoted 5 lines · Miquel Raynal
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 <[email protected]>
Thanks,
Stefan
PATCH 5/12 arm: spear: Fix the main comment in start.S
In reply to Miquel RaynalQuoted 6 lines · Miquel Raynal
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 <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 6/12 arm: spear: Purely cosmetic changes in start.S
In reply to Miquel RaynalBefore cleaning a bit further the spear/start.S file, apply a few cosmetic changes: capital letters, comment indentation and small rewriting.
--- arch/arm/cpu/arm926ejs/spear/start.S | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
arch/arm/cpu/arm926ejs/spear/start.S +8 -9
@@ -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 */
Signature · 1 line
2.19.1
PATCH 6/12 arm: spear: Purely cosmetic changes in start.S
Quoted 5 lines · Miquel Raynal
Before cleaning a bit further the
spear/start.Sfile, apply a few cosmetic changes: capital letters, comment indentation and small rewriting.Signed-off-by Miquel Raynal <[email protected]>
Thanks,
Stefan
PATCH 6/12 arm: spear: Purely cosmetic changes in start.S
In reply to Miquel RaynalQuoted 6 lines · Miquel Raynal
Before cleaning a bit further the
spear/start.Sfile, apply a few cosmetic changes: capital letters, comment indentation and small rewriting.Signed-off-by Miquel Raynal <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 7/12 arm: spear: Use PUSH/POP mnemonics when relevant
In reply to Miquel RaynalQuoting 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.
--- arch/arm/cpu/arm926ejs/spear/start.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/arm926ejs/spear/start.S +4 -4
@@ -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}
Signature · 1 line
2.19.1
PATCH 7/12 arm: spear: Use PUSH/POP mnemonics when relevant
Quoted 11 lines · Miquel Raynal
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 <[email protected]>
Thanks,
Stefan
PATCH 7/12 arm: spear: Use PUSH/POP mnemonics when relevant
In reply to Miquel RaynalQuoted 7 lines · Miquel Raynal
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.
Quoted 5 lines
Let's follow this recommandation to ease the reading and substitute LDMIA/STMDB operations with PUSH/POP mnemonics.
Signed-off-by Miquel Raynal <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 8/12 arm: spear: Reference the link register with LR instead of R14
In reply to Miquel RaynalThe 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.
--- arch/arm/cpu/arm926ejs/spear/start.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/arm926ejs/spear/start.S +1 -1
@@ -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}
Signature · 1 line
2.19.1
PATCH 8/12 arm: spear: Reference the link register with LR instead of R14
Quoted 5 lines · Miquel Raynal
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 <[email protected]>
Thanks,
Stefan
PATCH 8/12 arm: spear: Reference the link register with LR instead of R14
In reply to Miquel RaynalQuoted 6 lines · Miquel Raynal
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 <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 9/12 arm: spear: Simplify start.S organization
In reply to Miquel RaynalThere 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.
--- arch/arm/cpu/arm926ejs/spear/start.S | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
arch/arm/cpu/arm926ejs/spear/start.S +2 -15
@@ -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}
Signature · 1 line
2.19.1
PATCH 9/12 arm: spear: Simplify start.S organization
Quoted 5 lines · Miquel Raynal
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 <[email protected]>
Thanks,
Stefan
PATCH 9/12 arm: spear: Simplify start.S organization
In reply to Miquel RaynalQuoted 6 lines · Miquel Raynal
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 <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 10/12 arm: spear: Support returning to BootROM
In reply to Miquel RaynalImplement 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.
--- arch/arm/cpu/arm926ejs/spear/spl.c | 35 ++++++++++++++++++++++++++-- arch/arm/cpu/arm926ejs/spear/start.S | 7 +++++- 2 files changed, 39 insertions(+), 3 deletions(-)
arch/arm/cpu/arm926ejs/spear/spl.c +33 -2
@@ -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 + ); +}
arch/arm/cpu/arm926ejs/spear/start.S +6 -1
@@ -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}
Signature · 1 line
2.19.1
PATCH 10/12 arm: spear: Support returning to BootROM
Quoted 7 lines · Miquel Raynal
Implement the weak
board_return_to_bootrom()function so that when enabling thespl_bootrom.cdriver, 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 <[email protected]>
Thanks,
Stefan
PATCH 10/12 arm: spear: Support returning to BootROM
In reply to Miquel RaynalQuoted 8 lines · Miquel Raynal
Implement the weak
board_return_to_bootrom()function so that when enabling thespl_bootrom.cdriver, 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 <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 11/12 arm: spear: Do not link the _main branch
In reply to Miquel RaynalThe _main call is not supposed to return at all: don't link the branch.
--- arch/arm/cpu/arm926ejs/spear/start.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/cpu/arm926ejs/spear/start.S +2 -1
@@ -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}
Signature · 1 line
2.19.1
PATCH 11/12 arm: spear: Do not link the _main branch
Quoted 4 lines · Miquel Raynal
The
_maincall is not supposed to return at all: don't link the branch.Signed-off-by Miquel Raynal <[email protected]>
Thanks,
Stefan
PATCH 11/12 arm: spear: Do not link the _main branch
In reply to Miquel RaynalQuoted 5 lines · Miquel Raynal
The
_maincall is not supposed to return at all: don't link the branch.Signed-off-by Miquel Raynal <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
PATCH 12/12 arm: spear: Return to BootROM if failing to boot from the main device
In reply to Miquel RaynalOverload 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.
--- arch/arm/cpu/arm926ejs/spear/spl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/cpu/arm926ejs/spear/spl.c +12 -0
@@ -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 ;
Signature · 1 line
2.19.1
PATCH 12/12 arm: spear: Return to BootROM if failing to boot from the main device
Quoted 6 lines · Miquel Raynal
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 <[email protected]>
Thanks,
Stefan
PATCH 12/12 arm: spear: Return to BootROM if failing to boot from the main device
In reply to Miquel RaynalQuoted 7 lines · Miquel Raynal
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 <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>
cover Enable returning back to BootROM from spear SPL
In reply to Miquel RaynalQuoted 12 lines · Miquel Raynal
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.
Quoted 7 lines
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
cover Enable returning back to BootROM from spear SPL
Hi Stefan,
Stefan Roese <[email protected]> wrote on Tue, 7 May 2019 14:50:02 +0200:
Quoted 19 lines · Miquel Raynal
Quoted 18 lines
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.
Quoted 7 lines
Quoted 1 line
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