From: Simon Glass Date: Wed, 14 Dec 2016 20:27:48 -0700 Subject: [U-Boot] [PATCH 17/29] blackfin: Call C code to relocate In-Reply-To: <1481772480-29544-1-git-send-email-sjg@chromium.org> References: <1481772480-29544-1-git-send-email-sjg@chromium.org> Message-ID: <1481772480-29544-18-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Rather than jumping directly to the assembler relocation code, call a C function first. This will allow us to add board-specific adjustments. Signed-off-by: Simon Glass --- arch/blackfin/cpu/cpu.c | 7 +++++++ arch/blackfin/cpu/start.S | 6 +++--- arch/blackfin/include/asm/u-boot.h | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/blackfin/cpu/cpu.c b/arch/blackfin/cpu/cpu.c index 0ae5ac6..d46e251 100644 --- a/arch/blackfin/cpu/cpu.c +++ b/arch/blackfin/cpu/cpu.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -360,6 +361,12 @@ void cpu_init_f(ulong bootflag, ulong loaded_from_ldr) global_board_data_init(); } +void relocate_code(ulong sp, gd_t *new_gd, ulong relocaddr) +{ + /* Jump to board_init_r() with a new stack */ + asm_relocate_code(sp, new_gd); +} + int arch_cpu_init(void) { serial_early_puts("Init CPLB tables\n"); diff --git a/arch/blackfin/cpu/start.S b/arch/blackfin/cpu/start.S index 404e710..a5fd76c 100644 --- a/arch/blackfin/cpu/start.S +++ b/arch/blackfin/cpu/start.S @@ -245,12 +245,12 @@ LENTRY(_get_pc) rts; ENDPROC(_get_pc) -ENTRY(_relocate_code) +ENTRY(_asm_relocate_code) /* Fake relocate code. Setup the new stack only */ sp = r0; fp = sp; - r0 = p3; + r0 = r1 r1.h = 0x2000; r1.l = 0x10; jump.l _board_init_r -ENDPROC(_relocate_code) +ENDPROC(_asm_relocate_code) diff --git a/arch/blackfin/include/asm/u-boot.h b/arch/blackfin/include/asm/u-boot.h index 1ada44e..ae035f7 100644 --- a/arch/blackfin/include/asm/u-boot.h +++ b/arch/blackfin/include/asm/u-boot.h @@ -33,4 +33,9 @@ typedef struct bd_info { int arch_misc_init(void); +struct global_data; +void asm_relocate_code(ulong sp, struct global_data *new_gd) + __attribute__ ((noreturn)); + + #endif /* _U_BOOT_H_ */ -- 2.8.0.rc3.226.g39d4020