summaryrefslogtreecommitdiff
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
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
-rw-r--r--rbutil/mkimxboot/dualboot.c11
-rw-r--r--rbutil/mkimxboot/dualboot.h2
-rw-r--r--rbutil/mkimxboot/dualboot/dualboot.S28
3 files changed, 36 insertions, 5 deletions
diff --git a/rbutil/mkimxboot/dualboot.c b/rbutil/mkimxboot/dualboot.c
index 29e18eddf7..20876d77b0 100644
--- a/rbutil/mkimxboot/dualboot.c
+++ b/rbutil/mkimxboot/dualboot.c
@@ -14,10 +14,13 @@ unsigned char dualboot_fuzeplus[152] = {
14 0x10, 0x86, 0x01, 0x80, 0xc0, 0x40, 0x04, 0x80, 0x70, 0x64, 0x08, 0x00, 0x80, 0x1a, 0x06, 0x00, 14 0x10, 0x86, 0x01, 0x80, 0xc0, 0x40, 0x04, 0x80, 0x70, 0x64, 0x08, 0x00, 0x80, 0x1a, 0x06, 0x00,
15 0x00, 0x41, 0x04, 0x80, 0x01, 0x00, 0x77, 0x3e 15 0x00, 0x41, 0x04, 0x80, 0x01, 0x00, 0x77, 0x3e
16}; 16};
17unsigned char dualboot_zenxfi2[36] = { 17unsigned char dualboot_zenxfi2[92] = {
18 0x18, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x01, 0x09, 0x12, 0xe3, 0x00, 0x00, 0xa0, 0x03, 18 0x4c, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x02, 0x21, 0xa0, 0xe1, 0x22, 0x2d, 0xa0, 0xe1,
19 0x1e, 0xff, 0x2f, 0x01, 0x00, 0x00, 0x81, 0xe5, 0x01, 0x00, 0xa0, 0xe3, 0x1e, 0xff, 0x2f, 0xe1, 19 0x20, 0x00, 0x12, 0xe3, 0x06, 0x00, 0x00, 0x0a, 0x34, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5,
20 0x00, 0x86, 0x01, 0x80 20 0x02, 0x25, 0xa0, 0xe1, 0x22, 0x2f, 0xa0, 0xe1, 0x01, 0x00, 0x52, 0xe3, 0x00, 0x00, 0xa0, 0x03,
21 0x03, 0x00, 0x00, 0xea, 0x1c, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x01, 0x09, 0x12, 0xe3,
22 0x00, 0x00, 0xa0, 0x03, 0x1e, 0xff, 0x2f, 0x01, 0x00, 0x00, 0x81, 0xe5, 0x01, 0x00, 0xa0, 0xe3,
23 0x1e, 0xff, 0x2f, 0xe1, 0xc0, 0x40, 0x04, 0x80, 0x00, 0x86, 0x01, 0x80
21}; 24};
22unsigned char dualboot_zenxfi3[36] = { 25unsigned char dualboot_zenxfi3[36] = {
23 0x18, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x80, 0x00, 0x12, 0xe3, 0x00, 0x00, 0xa0, 0x03, 26 0x18, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x80, 0x00, 0x12, 0xe3, 0x00, 0x00, 0xa0, 0x03,
diff --git a/rbutil/mkimxboot/dualboot.h b/rbutil/mkimxboot/dualboot.h
index 272e257996..eff50cc6c5 100644
--- a/rbutil/mkimxboot/dualboot.h
+++ b/rbutil/mkimxboot/dualboot.h
@@ -1,5 +1,5 @@
1/* Generated by bin2c */ 1/* Generated by bin2c */
2 2
3extern unsigned char dualboot_fuzeplus[152]; 3extern unsigned char dualboot_fuzeplus[152];
4extern unsigned char dualboot_zenxfi2[36]; 4extern unsigned char dualboot_zenxfi2[92];
5extern unsigned char dualboot_zenxfi3[36]; 5extern unsigned char dualboot_zenxfi3[36];
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:
66 str r1, [r0] 66 str r1, [r0]
67 b power_down 67 b power_down
68#elif defined(CREATIVE_ZENXFI2) 68#elif defined(CREATIVE_ZENXFI2)
69 /* We are lacking buttons on the Zen X-Fi2 because on USB, the select button
70 * enters recovery mode ! So we can only use power but power is used to power up
71 * on normal boots and then select is free ! Thus use a non-uniform scheme:
72 * - normal boot:
73 * - no key: Rockbox
74 * - select: OF
75 * - USB boot:
76 * - no key: Rockbox
77 * - power: OF
78 */
79 /* if the power source was 5v (ie usb), check for power (pswitch) */
80 ldr r2, =0x800440c0 @ HW_POWER_STS
81 ldr r2, [r2]
82 mov r2, r2, lsl#2
83 mov r2, r2, lsr#26 @ extract PWRUP_SOURCE
84 tst r2, #0x20 @ bit 5: five volts
85 beq boot_normal
86 /* check pswitch*/
87 ldr r2, =0x800440c0 @ HW_POWER_STS
88 ldr r2, [r2]
89 mov r2, r2, lsl#10
90 mov r2, r2, lsr#30 @ extract PSWITCH
91 cmp r2, #1
92 moveq r0, #0 @ 1 => boot OF
93 b do_boot
94boot_normal:
69 /* If select key is hold, return so that the OF can boot */ 95 /* If select key is hold, return so that the OF can boot */
70 ldr r2, =0x80018600 @ HW_PINCTRL_DIN0 96 ldr r2, =0x80018600 @ HW_PINCTRL_DIN0
71 ldr r2, [r2] 97 ldr r2, [r2]
72 tst r2, #0x4000 @ bit 14, active low 98 tst r2, #0x4000 @ bit 14, active low
73 moveq r0, #0 @ return 0, continue boot 99 moveq r0, #0 @ return 0, continue boot
100 /* r0 must contain the 0 to boot OF and 1 to boot RB */
101do_boot:
74 bxeq lr 102 bxeq lr
75 str r0, [r1] 103 str r0, [r1]
76 mov r0, #1 104 mov r0, #1