]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
arm: Allow lr to be saved by board code
authorSimon Glass <sjg@chromium.org>
Sat, 7 Feb 2015 17:47:28 +0000 (10:47 -0700)
committerHans de Goede <hdegoede@redhat.com>
Mon, 16 Feb 2015 19:14:54 +0000 (20:14 +0100)
The link register value can be required on some boards (e.g. FEL mode on
sunxi) so use a branch instruction to jump to save_boot_params() instead
of a branch link.

This requires a branch back to save_boot_params_ret so adjust the users
to deal with this. For exynos just drop the function since it doesn't
do anything.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/cpu/armv7/exynos/spl_boot.c
arch/arm/cpu/armv7/omap-common/lowlevel_init.S
arch/arm/cpu/armv7/omap3/lowlevel_init.S
arch/arm/cpu/armv7/start.S
arch/arm/include/asm/system.h
board/nokia/rx51/lowlevel_init.S

index bc237c969fc9eba89e50fe36eb4164bf283c9a07..c7f943eb6a93bc55519744d16647f870f64d5f89 100644 (file)
@@ -309,4 +309,3 @@ void board_init_r(gd_t *id, ulong dest_addr)
        while (1)
                ;
 }
-void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) {}
index 86c0e4217478f9d06b00723d7280c6629e465059..e19c7aececddeb30c785c2162b6e0c5579854d82 100644 (file)
@@ -19,7 +19,7 @@
 ENTRY(save_boot_params)
        ldr     r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
        str     r0, [r1]
-       bx      lr
+       b       save_boot_params_ret
 ENDPROC(save_boot_params)
 
 ENTRY(set_pl310_ctrl_reg)
index 78577b1d1c75bc0632be5725fea1be4b2d0f8cad..80cb2639f60cc9ca8f3cb5eb338671e252dcb03e 100644 (file)
@@ -23,7 +23,7 @@ ENTRY(save_boot_params)
        ldr     r5, [r0, #0x4]
        and     r5, r5, #0xff
        str     r5, [r4]
-       bx      lr
+       b       save_boot_params_ret
 ENDPROC(save_boot_params)
 #endif
 
index 70048c10aee6736117e078931b75c4b6ba7756a5..9b49ece2d650e199a1ed3415ed2ae47794f20fab 100644 (file)
  *************************************************************************/
 
        .globl  reset
+       .globl  save_boot_params_ret
 
 reset:
-       bl      save_boot_params
+       /* Allow the board to save important registers */
+       b       save_boot_params
+save_boot_params_ret:
        /*
         * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode,
         * except if in HYP mode already
@@ -96,7 +99,7 @@ ENDPROC(c_runtime_cpu_setup)
  *
  *************************************************************************/
 ENTRY(save_boot_params)
-       bx      lr                      @ back to my caller
+       b       save_boot_params_ret            @ back to my caller
 ENDPROC(save_boot_params)
        .weak   save_boot_params
 
index 89f22946895301b09a183ead75503ae4dff0f1b2..7820486df00e50405c31d079c497ecdb6a562ed0 100644 (file)
@@ -142,6 +142,21 @@ void flush_l3_cache(void);
 
 #ifndef __ASSEMBLY__
 
+/**
+ * save_boot_params() - Save boot parameters before starting reset sequence
+ *
+ * If you provide this function it will be called immediately U-Boot starts,
+ * both for SPL and U-Boot proper.
+ *
+ * All registers are unchanged from U-Boot entry. No registers need be
+ * preserved.
+ *
+ * This is not a normal C function. There is no stack. Return by branching to
+ * save_boot_params_ret.
+ *
+ * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3);
+ */
+
 #define isb() __asm__ __volatile__ ("" : : : "memory")
 
 #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
index e25290966c5d85668f4d147a748d6f6b14bb84df..9d4ea1b3f90e68d2670b914bd2f4e82180970f9a 100644 (file)
@@ -37,7 +37,8 @@ ih_magic:             /* IH_MAGIC in big endian from include/image.h */
 
 .global save_boot_params
 save_boot_params:
-
+       /* Get return address */
+       ldr     lr, =save_boot_params_ret
 
 /* Copy valid attached kernel to address KERNEL_ADDRESS */