From d09fb6bb6b92782ba763219ca19d3125159ec848 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Fri, 28 Oct 2022 19:25:34 +0100 Subject: [PATCH] x1000: Pass CPM scratch register to the bootloader Change-Id: Iaef4606dc6f3cb9904d87ee92db69fb9ef48bcb0 --- firmware/target/mips/ingenic_x1000/spl-x1000.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/firmware/target/mips/ingenic_x1000/spl-x1000.c b/firmware/target/mips/ingenic_x1000/spl-x1000.c index b9ee6cc1c1..08f88f506c 100644 --- a/firmware/target/mips/ingenic_x1000/spl-x1000.c +++ b/firmware/target/mips/ingenic_x1000/spl-x1000.c @@ -317,6 +317,9 @@ void spl_main(void) REG_CPM_PSWC2ST = 0x18; REG_CPM_PSWC3ST = 0x08; + /* Save this, it's needed on some targets */ + uint32_t saved_cpm_scratch = REG_CPM_SCRATCH; + /* set up boot flags */ init_boot_flags(); @@ -361,8 +364,8 @@ void spl_main(void) spl_storage_close(); /* jump to the entry point */ - typedef void(*entry_fn)(void); + typedef void(*entry_fn)(uint32_t); entry_fn fn = (entry_fn)BOOT_EXEC_ADDR; commit_discard_idcache(); - fn(); + fn(saved_cpm_scratch); }