diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-01-28 19:13:24 +0000 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-01-28 19:15:38 +0000 |
commit | aad4308f0376fbb69880d5c035be498ee0bb1965 (patch) | |
tree | 5f4f0887746d5612d589b0856826affa885b2924 | |
parent | 189148e70128d037f7bd541f2c1f21aa783000d9 (diff) |
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.c | 11 | ||||
-rw-r--r-- | rbutil/mkimxboot/dualboot.h | 2 | ||||
-rw-r--r-- | rbutil/mkimxboot/dualboot/dualboot.S | 28 |
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] = { 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, 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 @@ /* 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]; 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 |