rk27xx: boot the OF when it asked for a reboot

Before the original firmware resets itself, e.g. at the end of a
firmware update, it stores a boot mode in an undocumented GPIO1
register that keeps its value over the reset. The NAND bootloader
reads it to decide whether to boot at all, then starts our
bootloader, which chose Rockbox or the OF from the buttons alone, so
an OF that restarted itself came back up as Rockbox.

Rockbox never writes the register and it reads 0 after power-on, so
boot the OF whenever it is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I22a98cafad48f66302a8401c9df847a073675a58
This commit is contained in:
Marcin Bukat 2026-10-07 16:03:44 +02:00
parent c3a62cee96
commit 406a28cc6a
2 changed files with 10 additions and 0 deletions

View file

@ -139,6 +139,14 @@ void main(void)
if (DEV_INFO & (1<<20))
boot = of;
/* The OF asks for a mode before it resets itself, e.g. at the end of
* a firmware update, and the cell survives the reset. Rockbox never
* sets it, so after a cold start it reads 0: anything else is a
* request from the OF, which expects to come back up.
*/
if (GPIO1_BOOTMODE & 0xff)
boot = of;
lcd_clear_display();
ret = storage_init();

View file

@ -429,6 +429,8 @@
#define GPIO_PECON (*(volatile unsigned long *)(APB0_GPIO1 + 0x04))
#define GPIO_PFDR (*(volatile unsigned long *)(APB0_GPIO1 + 0x08))
#define GPIO_PFCON (*(volatile unsigned long *)(APB0_GPIO1 + 0x0C))
/* undocumented, kept over a reset: the OF leaves its boot request here */
#define GPIO1_BOOTMODE (*(volatile unsigned long *)(APB0_GPIO1 + 0x1C))
#define GPIO1_TEST (*(volatile unsigned long *)(APB0_GPIO1 + 0x20))
#define GPIO_IEE (*(volatile unsigned long *)(APB0_GPIO1 + 0x24))