As the A64 is designed for use in mobile devices without easy access to
a UART, MMC0, or a FEL button, it would be useful to be able to reboot
to FEL mode, fastboot, etc. via a command from Linux. As reboot(2)
supports passing a command with LINUX_REBOOT_CMD_RESTART2, and we have
battery-backed RAM provided by the RTC (and also the PMIC), we can hook
the Linux side up with just a little bit of glue.
For examples of the bootloader side, see Rockchip boards in U-Boot
(an implementation of this for a similar platform) and p-boot (an
implementation of a similar idea for the A64). An interesting feature of
the p-boot implementation is the ability to choose and chainload the
bootloader from a different storage medium. This allows modifying the
boot order without needing to burn eFuses.
I'm sending this as an RFC to start discussion about allocating these
RTC registers, for this and other purposes. p-boot uses a second
register to store a boot order and some flags. There has also been
discussion of using the registers to store key material and a
tamper-evident boot shim, to make up for deficiencies in the SoC's
secure boot ROM.
I suggest putting the reboot mode at the beginning of the region (to
preserve the most consecutive registers for other uses), or copying
p-boot's layout and using the second register (to respect prior art).
Consecutive values (like the Allwinner and Rockchip implementations)
or arbitrary values (like in patch 2) would work for the reboot mode.
I would suggest magic numbers with higher entropy than those in p-boot.
Any ideas/comments are welcome.
Samuel Holland (2):
rtc: sun6i: Add NVMEM provider
arm64: dts: allwinner: a64: Add reboot mode
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 17 ++++++++
drivers/rtc/rtc-sun6i.c | 42 +++++++++++++++++++
2 files changed, 59 insertions(+)