[PATCH 00/10] power: reset: add support for syscon reboot modes

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Sep 16 09:50:25 EDT 2020


With this patch set, we have a framework to generically support passing
reboot modes to previous bootloader stages as well as process them.
Stuff you can do with this:

  linux$ reboot recovery
  * fall into barebox menu prompt, unless overridden *

  linux$ reboot emmc
  * sources /env/bmode/emmc if available *

  barebox$ gpr.reboot_mode.next=serial reset
  * fall into imx-usb-loader mode *

To enable this, besides having kernel and bootloader driver support,
you'll need to describe in the device tree where the reboot mode is
to be stored and what reboot modes there are.
This patch set implements it for two SoC families:

stm32mp15x:
  - All now support `reboot loader` and `reboot recovery` from Linux,
    if the syscon exists (The reboot mode itself is fixed up).

i.MX6Q/DL:
  - No OS communication by default, but you can now easily tell the
    BootROM where to boot from after warm reset

One thing missing in this series is support for nvmem-reboot-mode.
I ported the kernel driver[], but didn't come around to test it.

Details inside. Feedback appreciated. :-)

[1]: https://github.com/a3f/barebox/tree/reboot_mode

Ahmad Fatoum (10):
  usbgadget: autostart: support delayed usbgadget.autostart=1
  drivers: add reboot-mode infrastructure
  power: reset: reboot-mode: port syscon-reboot-mode support
  power: reset: reboot-mode: fix up node into boot device tree
  defaultenv: provide defaults for generic reboot modes
  ARM: dts: stm32mp: setup syscon-reboot-mode on TAMP general purpose
    register
  ARM: stm32mp: remove custom reboot mode logic from arch code
  power: reset: reboot-mode: support multi-word magic
  power: reset: syscon-reboot-mode: support multi-word reboot modes
  ARM: dts: i.MX6qdl: define BootROM reboot-mode on top of SRC_GPR{9,10}

 Documentation/user/defaultenv-2.rst           |  18 +-
 Documentation/user/reboot-mode.rst            |  95 ++++++++
 arch/arm/dts/imx6qdl.dtsi                     |  21 ++
 arch/arm/dts/stm32mp151.dtsi                  |  15 ++
 .../mach-stm32mp/include/mach/bootsource.h    |  12 -
 arch/arm/mach-stm32mp/init.c                  |  16 +-
 common/Kconfig                                |   5 +
 common/startup.c                              |  16 ++
 common/usbgadget.c                            |   6 +-
 defaultenv/Makefile                           |   1 +
 .../defaultenv-2-reboot-mode/bmode/bootloader |   3 +
 .../defaultenv-2-reboot-mode/bmode/loader     |   2 +
 .../defaultenv-2-reboot-mode/bmode/recovery   |   2 +
 defaultenv/defaultenv.c                       |   2 +
 drivers/Kconfig                               |   1 +
 drivers/Makefile                              |   1 +
 drivers/power/Kconfig                         |   2 +
 drivers/power/Makefile                        |   2 +
 drivers/power/reset/Kconfig                   |  16 ++
 drivers/power/reset/Makefile                  |   3 +
 drivers/power/reset/reboot-mode.c             | 229 ++++++++++++++++++
 drivers/power/reset/syscon-reboot-mode.c      | 129 ++++++++++
 include/linux/reboot-mode.h                   |  38 +++
 include/of.h                                  |   2 +
 24 files changed, 604 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/user/reboot-mode.rst
 create mode 100644 defaultenv/defaultenv-2-reboot-mode/bmode/bootloader
 create mode 100755 defaultenv/defaultenv-2-reboot-mode/bmode/loader
 create mode 100644 defaultenv/defaultenv-2-reboot-mode/bmode/recovery
 create mode 100644 drivers/power/Kconfig
 create mode 100644 drivers/power/Makefile
 create mode 100644 drivers/power/reset/Kconfig
 create mode 100644 drivers/power/reset/Makefile
 create mode 100644 drivers/power/reset/reboot-mode.c
 create mode 100644 drivers/power/reset/syscon-reboot-mode.c
 create mode 100644 include/linux/reboot-mode.h

-- 
2.28.0




More information about the barebox mailing list