summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rbutil/mkimxboot/dualboot.c13
-rw-r--r--rbutil/mkimxboot/dualboot.h2
-rw-r--r--rbutil/mkimxboot/dualboot/dualboot.S26
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 @@
#include "dualboot.h"
-unsigned char dualboot_fuzeplus[36] = {
- 0x18, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x01, 0x01, 0x12, 0xe3, 0x00, 0x00, 0xa0, 0x03,
- 0x1e, 0xff, 0x2f, 0x01, 0x00, 0x00, 0x81, 0xe5, 0x01, 0x00, 0xa0, 0xe3, 0x1e, 0xff, 0x2f, 0xe1,
- 0x10, 0x86, 0x01, 0x80
+unsigned char dualboot_fuzeplus[128] = {
+ 0x70, 0x40, 0x2d, 0xe9, 0x5c, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x01, 0x01, 0x12, 0xe3,
+ 0x00, 0x00, 0xa0, 0x03, 0x1e, 0xff, 0x2f, 0x01, 0x4c, 0x20, 0x9f, 0xe5, 0x00, 0x40, 0xa0, 0xe3,
+ 0x48, 0x30, 0x9f, 0xe5, 0x00, 0x30, 0x93, 0xe5, 0x03, 0x35, 0xa0, 0xe1, 0x23, 0x3f, 0xa0, 0xe1,
+ 0x01, 0x00, 0x53, 0xe3, 0x03, 0x40, 0x84, 0x00, 0x01, 0x20, 0x52, 0xe2, 0xf7, 0xff, 0xff, 0x1a,
+ 0x2c, 0x20, 0x9f, 0xe5, 0x02, 0x00, 0x54, 0xe1, 0x02, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x81, 0xe5,
+ 0x01, 0x00, 0xa0, 0xe3, 0x70, 0x80, 0xbd, 0xe8, 0x18, 0x00, 0x9f, 0xe5, 0x18, 0x10, 0x9f, 0xe5,
+ 0x00, 0x10, 0x80, 0xe5, 0xfb, 0xff, 0xff, 0xea, 0x10, 0x86, 0x01, 0x80, 0x70, 0x64, 0x08, 0x00,
+ 0xc0, 0x40, 0x04, 0x80, 0x80, 0x1a, 0x06, 0x00, 0x00, 0x41, 0x04, 0x80, 0x01, 0x00, 0x77, 0x3e
};
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 @@
/* Generated by bin2c */
-extern unsigned char dualboot_fuzeplus[36];
+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 @@
.global start
@ int start(uint32_t arg, uint32_t *result_id)
start:
+ stmfd sp!, {r4-r6,lr}
#if defined(SANSA_FUZEPLUS)
/* If volume down key is hold, return so that the OF can boot */
ldr r2, =0x80018610 @ HW_PINCTRL_DIN1
@@ -30,10 +31,31 @@ start:
tst r2, #0x40000000 @ bit 30, active low
moveq r0, #0 @ return 0, continue boot
bxeq lr
- /* otherwise jump to section given as argument */
+ /* otherwise monitor the power button for a short time */
+ ldr r2, =550000 @ loop count
+ ldr r4, =0 @ number of times PSWITCH was 1
+pswitch_monitor_loop:
+ ldr r3, =0x800440c0 @ HW_POWER_STS
+ ldr r3, [r3]
+ mov r3, r3, lsl#10
+ mov r3, r3, lsr#30 @ extract PSWITCH
+ cmp r3, #1
+ addeq r4, r3 @ add one if PSWITCH=1 (means power hold)
+ subs r2, #1
+ bne pswitch_monitor_loop
+ /* power down if power wasn't hold long enough */
+ ldr r2, =400000
+ cmp r4, r2
+ bcc power_down
+ /* jump to section given as argument */
str r0, [r1]
mov r0, #1
- bx lr
+ ldmfd sp!, {r4-r6,pc}
+power_down:
+ ldr r0, =0x80044100 @ HW_POWER_RESET
+ ldr r1, =0x3E770001 @ unlock key + power down
+ str r1, [r0]
+ b power_down
#else
#error No target defined !
#endif