diff options
Diffstat (limited to 'rbutil/mkimxboot')
-rw-r--r-- | rbutil/mkimxboot/dualboot.c | 13 | ||||
-rw-r--r-- | rbutil/mkimxboot/dualboot.h | 2 | ||||
-rw-r--r-- | rbutil/mkimxboot/dualboot/dualboot.S | 26 |
3 files changed, 34 insertions, 7 deletions
diff --git a/rbutil/mkimxboot/dualboot.c b/rbutil/mkimxboot/dualboot.c index 95bee11cf8..3e7f169cbf 100644 --- a/rbutil/mkimxboot/dualboot.c +++ b/rbutil/mkimxboot/dualboot.c | |||
@@ -2,8 +2,13 @@ | |||
2 | 2 | ||
3 | #include "dualboot.h" | 3 | #include "dualboot.h" |
4 | 4 | ||
5 | unsigned char dualboot_fuzeplus[36] = { | 5 | unsigned char dualboot_fuzeplus[128] = { |
6 | 0x18, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x01, 0x01, 0x12, 0xe3, 0x00, 0x00, 0xa0, 0x03, | 6 | 0x70, 0x40, 0x2d, 0xe9, 0x5c, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x01, 0x01, 0x12, 0xe3, |
7 | 0x1e, 0xff, 0x2f, 0x01, 0x00, 0x00, 0x81, 0xe5, 0x01, 0x00, 0xa0, 0xe3, 0x1e, 0xff, 0x2f, 0xe1, | 7 | 0x00, 0x00, 0xa0, 0x03, 0x1e, 0xff, 0x2f, 0x01, 0x4c, 0x20, 0x9f, 0xe5, 0x00, 0x40, 0xa0, 0xe3, |
8 | 0x10, 0x86, 0x01, 0x80 | 8 | 0x48, 0x30, 0x9f, 0xe5, 0x00, 0x30, 0x93, 0xe5, 0x03, 0x35, 0xa0, 0xe1, 0x23, 0x3f, 0xa0, 0xe1, |
9 | 0x01, 0x00, 0x53, 0xe3, 0x03, 0x40, 0x84, 0x00, 0x01, 0x20, 0x52, 0xe2, 0xf7, 0xff, 0xff, 0x1a, | ||
10 | 0x2c, 0x20, 0x9f, 0xe5, 0x02, 0x00, 0x54, 0xe1, 0x02, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x81, 0xe5, | ||
11 | 0x01, 0x00, 0xa0, 0xe3, 0x70, 0x80, 0xbd, 0xe8, 0x18, 0x00, 0x9f, 0xe5, 0x18, 0x10, 0x9f, 0xe5, | ||
12 | 0x00, 0x10, 0x80, 0xe5, 0xfb, 0xff, 0xff, 0xea, 0x10, 0x86, 0x01, 0x80, 0x70, 0x64, 0x08, 0x00, | ||
13 | 0xc0, 0x40, 0x04, 0x80, 0x80, 0x1a, 0x06, 0x00, 0x00, 0x41, 0x04, 0x80, 0x01, 0x00, 0x77, 0x3e | ||
9 | }; | 14 | }; |
diff --git a/rbutil/mkimxboot/dualboot.h b/rbutil/mkimxboot/dualboot.h index e14f3582a8..b5ccd7c33e 100644 --- a/rbutil/mkimxboot/dualboot.h +++ b/rbutil/mkimxboot/dualboot.h | |||
@@ -1,3 +1,3 @@ | |||
1 | /* Generated by bin2c */ | 1 | /* Generated by bin2c */ |
2 | 2 | ||
3 | extern unsigned char dualboot_fuzeplus[36]; | 3 | extern unsigned char dualboot_fuzeplus[128]; |
diff --git a/rbutil/mkimxboot/dualboot/dualboot.S b/rbutil/mkimxboot/dualboot/dualboot.S index 8302829a81..1b9edb015f 100644 --- a/rbutil/mkimxboot/dualboot/dualboot.S +++ b/rbutil/mkimxboot/dualboot/dualboot.S | |||
@@ -23,6 +23,7 @@ | |||
23 | .global start | 23 | .global start |
24 | @ int start(uint32_t arg, uint32_t *result_id) | 24 | @ int start(uint32_t arg, uint32_t *result_id) |
25 | start: | 25 | start: |
26 | stmfd sp!, {r4-r6,lr} | ||
26 | #if defined(SANSA_FUZEPLUS) | 27 | #if defined(SANSA_FUZEPLUS) |
27 | /* If volume down key is hold, return so that the OF can boot */ | 28 | /* If volume down key is hold, return so that the OF can boot */ |
28 | ldr r2, =0x80018610 @ HW_PINCTRL_DIN1 | 29 | ldr r2, =0x80018610 @ HW_PINCTRL_DIN1 |
@@ -30,10 +31,31 @@ start: | |||
30 | tst r2, #0x40000000 @ bit 30, active low | 31 | tst r2, #0x40000000 @ bit 30, active low |
31 | moveq r0, #0 @ return 0, continue boot | 32 | moveq r0, #0 @ return 0, continue boot |
32 | bxeq lr | 33 | bxeq lr |
33 | /* otherwise jump to section given as argument */ | 34 | /* otherwise monitor the power button for a short time */ |
35 | ldr r2, =550000 @ loop count | ||
36 | ldr r4, =0 @ number of times PSWITCH was 1 | ||
37 | pswitch_monitor_loop: | ||
38 | ldr r3, =0x800440c0 @ HW_POWER_STS | ||
39 | ldr r3, [r3] | ||
40 | mov r3, r3, lsl#10 | ||
41 | mov r3, r3, lsr#30 @ extract PSWITCH | ||
42 | cmp r3, #1 | ||
43 | addeq r4, r3 @ add one if PSWITCH=1 (means power hold) | ||
44 | subs r2, #1 | ||
45 | bne pswitch_monitor_loop | ||
46 | /* power down if power wasn't hold long enough */ | ||
47 | ldr r2, =400000 | ||
48 | cmp r4, r2 | ||
49 | bcc power_down | ||
50 | /* jump to section given as argument */ | ||
34 | str r0, [r1] | 51 | str r0, [r1] |
35 | mov r0, #1 | 52 | mov r0, #1 |
36 | bx lr | 53 | ldmfd sp!, {r4-r6,pc} |
54 | power_down: | ||
55 | ldr r0, =0x80044100 @ HW_POWER_RESET | ||
56 | ldr r1, =0x3E770001 @ unlock key + power down | ||
57 | str r1, [r0] | ||
58 | b power_down | ||
37 | #else | 59 | #else |
38 | #error No target defined ! | 60 | #error No target defined ! |
39 | #endif | 61 | #endif |