summaryrefslogtreecommitdiffstats
path: root/rbutil/mkimxboot/dualboot
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-01-28 19:13:24 +0000
committerAmaury Pouly <amaury.pouly@gmail.com>2013-01-28 19:15:38 +0000
commitaad4308f0376fbb69880d5c035be498ee0bb1965 (patch)
tree5f4f0887746d5612d589b0856826affa885b2924 /rbutil/mkimxboot/dualboot
parent189148e70128d037f7bd541f2c1f21aa783000d9 (diff)
downloadrockbox-aad4308f0376fbb69880d5c035be498ee0bb1965.tar.gz
rockbox-aad4308f0376fbb69880d5c035be498ee0bb1965.zip
zenxfi2: rework dualboot
The previous dualboot scheme had a major flow: it needed to hold menu to boot OF but the X-Fi2 boot in recovery mode with menu! It was possible but very trick to enter the OF with USB plugged. This code provides a new scheme: - no USB plugged: boot to OF when menu is pressed - USB plugged: boot to OF when power is pressed Change-Id: Ia6e76d3ada1f67137b727daa050cf6c77afbbfb9
Diffstat (limited to 'rbutil/mkimxboot/dualboot')
-rw-r--r--rbutil/mkimxboot/dualboot/dualboot.S28
1 files changed, 28 insertions, 0 deletions
diff --git a/rbutil/mkimxboot/dualboot/dualboot.S b/rbutil/mkimxboot/dualboot/dualboot.S
index ed91012199..0508f7e16a 100644
--- a/rbutil/mkimxboot/dualboot/dualboot.S
+++ b/rbutil/mkimxboot/dualboot/dualboot.S
@@ -66,11 +66,39 @@ power_down:
str r1, [r0]
b power_down
#elif defined(CREATIVE_ZENXFI2)
+ /* We are lacking buttons on the Zen X-Fi2 because on USB, the select button
+ * enters recovery mode ! So we can only use power but power is used to power up
+ * on normal boots and then select is free ! Thus use a non-uniform scheme:
+ * - normal boot:
+ * - no key: Rockbox
+ * - select: OF
+ * - USB boot:
+ * - no key: Rockbox
+ * - power: OF
+ */
+ /* if the power source was 5v (ie usb), check for power (pswitch) */
+ ldr r2, =0x800440c0 @ HW_POWER_STS
+ ldr r2, [r2]
+ mov r2, r2, lsl#2
+ mov r2, r2, lsr#26 @ extract PWRUP_SOURCE
+ tst r2, #0x20 @ bit 5: five volts
+ beq boot_normal
+ /* check pswitch*/
+ ldr r2, =0x800440c0 @ HW_POWER_STS
+ ldr r2, [r2]
+ mov r2, r2, lsl#10
+ mov r2, r2, lsr#30 @ extract PSWITCH
+ cmp r2, #1
+ moveq r0, #0 @ 1 => boot OF
+ b do_boot
+boot_normal:
/* If select key is hold, return so that the OF can boot */
ldr r2, =0x80018600 @ HW_PINCTRL_DIN0
ldr r2, [r2]
tst r2, #0x4000 @ bit 14, active low
moveq r0, #0 @ return 0, continue boot
+ /* r0 must contain the 0 to boot OF and 1 to boot RB */
+do_boot:
bxeq lr
str r0, [r1]
mov r0, #1