summaryrefslogtreecommitdiff
path: root/firmware/target/mips/ingenic_x1000/system-x1000.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-07-06 21:02:37 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-07-08 16:01:38 +0000
commit0e1a90ea1da0c1737363e9412781f734f39048d4 (patch)
treebef444477385a5eb8e8766ec75391ba48d63c613 /firmware/target/mips/ingenic_x1000/system-x1000.c
parent65aa9ce57067f810d6a8f9417ec7d0a5741b404a (diff)
downloadrockbox-0e1a90ea1da0c1737363e9412781f734f39048d4.tar.gz
rockbox-0e1a90ea1da0c1737363e9412781f734f39048d4.zip
x1000: SPL refactoring
This streamlines the boot code a bit and reduces target specific boilerplate. The clock init hack used by the bootloader has been "standardized" and works for the main Rockbox binary now, so you can boot rockbox.bin over USB without special hacks. Change-Id: I7c1fac37df5a45873583ce6818eaedb9f71a782b
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/system-x1000.c')
-rw-r--r--firmware/target/mips/ingenic_x1000/system-x1000.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_x1000/system-x1000.c b/firmware/target/mips/ingenic_x1000/system-x1000.c
index 779bb2055c..d43c8e67e4 100644
--- a/firmware/target/mips/ingenic_x1000/system-x1000.c
+++ b/firmware/target/mips/ingenic_x1000/system-x1000.c
@@ -27,6 +27,7 @@
27#include "dma-x1000.h" 27#include "dma-x1000.h"
28#include "irq-x1000.h" 28#include "irq-x1000.h"
29#include "clk-x1000.h" 29#include "clk-x1000.h"
30#include "boot-x1000.h"
30#include "x1000/cpm.h" 31#include "x1000/cpm.h"
31#include "x1000/ost.h" 32#include "x1000/ost.h"
32#include "x1000/tcu.h" 33#include "x1000/tcu.h"
@@ -59,6 +60,27 @@ static void system_init_irq(void)
59 write_c0_cause(M_CauseIV); 60 write_c0_cause(M_CauseIV);
60} 61}
61 62
63/* First function called by crt0.S */
64void system_early_init(void)
65{
66#if defined(FIIO_M3K) && !defined(BOOTLOADER)
67 /* HACK for compatibility: CPM scratchpad has undefined contents at
68 * time of reset and old bootloader revisions don't initialize it.
69 * Therefore we can't rely on its contents on the FiiO M3K. This does
70 * kind of break the entire point of boot flags, but right now they
71 * are really only used by the bootloader so it's not a huge issue.
72 * This hack should keep everything working as usual. */
73 if(jz_readf(CPM_MPCR, ON) == 0) {
74 init_boot_flags();
75 set_boot_option(BOOT_OPTION_ROCKBOX);
76 set_boot_flag(BOOT_FLAG_CLK_INIT);
77 }
78#endif
79
80 /* Finish up clock init */
81 clk_init();
82}
83
62/* First thing called from Rockbox main() */ 84/* First thing called from Rockbox main() */
63void system_init(void) 85void system_init(void)
64{ 86{