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
This commit is contained in:
Amaury Pouly 2013-01-28 19:13:24 +00:00
parent 189148e701
commit aad4308f03
3 changed files with 36 additions and 5 deletions

View file

@ -14,10 +14,13 @@ unsigned char dualboot_fuzeplus[152] = {
0x10, 0x86, 0x01, 0x80, 0xc0, 0x40, 0x04, 0x80, 0x70, 0x64, 0x08, 0x00, 0x80, 0x1a, 0x06, 0x00,
0x00, 0x41, 0x04, 0x80, 0x01, 0x00, 0x77, 0x3e
};
unsigned char dualboot_zenxfi2[36] = {
0x18, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x01, 0x09, 0x12, 0xe3, 0x00, 0x00, 0xa0, 0x03,
0x1e, 0xff, 0x2f, 0x01, 0x00, 0x00, 0x81, 0xe5, 0x01, 0x00, 0xa0, 0xe3, 0x1e, 0xff, 0x2f, 0xe1,
0x00, 0x86, 0x01, 0x80
unsigned char dualboot_zenxfi2[92] = {
0x4c, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x02, 0x21, 0xa0, 0xe1, 0x22, 0x2d, 0xa0, 0xe1,
0x20, 0x00, 0x12, 0xe3, 0x06, 0x00, 0x00, 0x0a, 0x34, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5,
0x02, 0x25, 0xa0, 0xe1, 0x22, 0x2f, 0xa0, 0xe1, 0x01, 0x00, 0x52, 0xe3, 0x00, 0x00, 0xa0, 0x03,
0x03, 0x00, 0x00, 0xea, 0x1c, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x01, 0x09, 0x12, 0xe3,
0x00, 0x00, 0xa0, 0x03, 0x1e, 0xff, 0x2f, 0x01, 0x00, 0x00, 0x81, 0xe5, 0x01, 0x00, 0xa0, 0xe3,
0x1e, 0xff, 0x2f, 0xe1, 0xc0, 0x40, 0x04, 0x80, 0x00, 0x86, 0x01, 0x80
};
unsigned char dualboot_zenxfi3[36] = {
0x18, 0x20, 0x9f, 0xe5, 0x00, 0x20, 0x92, 0xe5, 0x80, 0x00, 0x12, 0xe3, 0x00, 0x00, 0xa0, 0x03,

View file

@ -1,5 +1,5 @@
/* Generated by bin2c */
extern unsigned char dualboot_fuzeplus[152];
extern unsigned char dualboot_zenxfi2[36];
extern unsigned char dualboot_zenxfi2[92];
extern unsigned char dualboot_zenxfi3[36];

View file

@ -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