From 21dda946e7aa86246bf7ca22fb1a1609407c4bb9 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 17 Oct 2022 09:09:54 +0200 Subject: restart: do restart-priority OF parsing in restart_handler_register The restart-priority OF property is parsed for a number of MFDs, but there is no reason really not to parse it for every restart handler that has a device tree node like we already do for watchdogs. Add a new struct restart_handler::of_node field and look into it if populated. With this of_get_restart_priority, is no longer used, so drop it. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20221017071000.1458292-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- Documentation/devicetree/bindings/power/restart.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/restart.rst (limited to 'Documentation') diff --git a/Documentation/devicetree/bindings/power/restart.rst b/Documentation/devicetree/bindings/power/restart.rst new file mode 100644 index 0000000000..8c866f6e0d --- /dev/null +++ b/Documentation/devicetree/bindings/power/restart.rst @@ -0,0 +1,10 @@ +System Restart Controllers +========================== + +In addition to upstream bindings, following properties are understood: + +Optional properties: + +- ``restart-priority`` : Overrides the priority set by the driver. Normally, + the device with the biggest reach should reset the system. + See :ref:`_system_reset` for more information. -- cgit v1.2.1 From 1c33083a1542db3ea596481781170123f0d0510f Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 17 Oct 2022 09:09:55 +0200 Subject: restart: add reset -w for warm bootrom reset We currently support reboot mode communication with BootROMs of the i.MX6Q/DL, i.MX8MM and STM32MP15x. For each of these, the user must take care to use the correct reset as the highest priority reset often clears the non-volatile register mapped by the syscon holding the reboot mode. As we only have one BootROM, we can improve usability by adding a global flag that describes whether a restart handler is suitable for use after a bootrom reboot mode write. Add a flag bit describing this and allow populating it from the device tree as well as from drivers. Existing i.MX/STM32 drivers will be moved onto this in follow-up commits. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20221017071000.1458292-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- Documentation/boards/imx.rst | 2 +- Documentation/devicetree/bindings/power/restart.rst | 5 +++++ Documentation/user/reboot-mode.rst | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst index 4ce9d9808c..6c16923340 100644 --- a/Documentation/boards/imx.rst +++ b/Documentation/boards/imx.rst @@ -105,7 +105,7 @@ that BootROM should select after a warm reset:: mode-serial = <0x10 0x40000000>; }; - barebox@FSL i.MX8MM EVK board:/ gpr.reboot_mode.next=serial reset -r imxwd-warm + barebox@FSL i.MX8MM EVK board:/ gpr.reboot_mode.next=serial reset -w This will cause barebox to fall into serial download mode on an i.MX8MM. diff --git a/Documentation/devicetree/bindings/power/restart.rst b/Documentation/devicetree/bindings/power/restart.rst index 8c866f6e0d..42b87f7e9c 100644 --- a/Documentation/devicetree/bindings/power/restart.rst +++ b/Documentation/devicetree/bindings/power/restart.rst @@ -8,3 +8,8 @@ Optional properties: - ``restart-priority`` : Overrides the priority set by the driver. Normally, the device with the biggest reach should reset the system. See :ref:`_system_reset` for more information. + +- ``barebox,restart-warm-bootrom`` : Restart will not cause loss to non-volatile + registers sampled by the bootrom at startup. This is a necessary precondition + for working :ref:`reboot_mode` communication between barebox and the SoC's + BootROM. diff --git a/Documentation/user/reboot-mode.rst b/Documentation/user/reboot-mode.rst index 83d4136b85..1929a67e0b 100644 --- a/Documentation/user/reboot-mode.rst +++ b/Documentation/user/reboot-mode.rst @@ -47,7 +47,9 @@ Reboot mode providers have priorities. The provider with the highest priority has its parameters aliased as ``$global.system.reboot_mode.prev`` and ``$global.system.reboot_mode.next``. After executing the init scripts, barebox startup will ``source /env/bmode/${global.system.reboot_mode.prev}`` -if available. +if available. Example usage:: + + gpr.reboot_mode=serial reset -w Reset ===== @@ -60,6 +62,9 @@ If such reboot mode storage is used, users must take care to use the correct reset provider. In barebox, multiple reset providers may co-exist. The ``reset`` command allows listing and choosing a specific reboot mode. +For communication with the SoC's BootROM, a warm reset can be triggered +with ``reset -w`` if a suitable reset handler has been registered. + Disambiguation ============== -- cgit v1.2.1 From 594d5d58afcdb717620ca526ab390cef91e8ba21 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 17 Oct 2022 09:09:58 +0200 Subject: Documentations: devicetree: bindings: document watchdog-priority We parse watchdog-priority for every OF-enabled watchdog device, but failed to document it. Remedy this. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20221017071000.1458292-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- Documentation/devicetree/bindings/watchdog/watchdog.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/watchdog.rst (limited to 'Documentation') diff --git a/Documentation/devicetree/bindings/watchdog/watchdog.rst b/Documentation/devicetree/bindings/watchdog/watchdog.rst new file mode 100644 index 0000000000..415a4520f4 --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/watchdog.rst @@ -0,0 +1,10 @@ +Watchdogs +========= + +In addition to the upstream bindings, following properties are understood: + +Optional properties: + +- ``watchdog-priority`` : Overrides the priority set by the driver. Normally, + the watchdog device with the biggest reach should reset the system. + See :ref:`_system_reset` for more information. -- cgit v1.2.1 From 8130fc34366e123dbd459ed085fea280a575c0dc Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 17 Oct 2022 09:10:00 +0200 Subject: ARM: stm32mp: mark iwdg2 with barebox,restart-warm-bootrom All STM32MP1 DTs already include their respective barebox SoC header, so set barebox,restart-warm-bootrom there, so users can portably run: tamp.reboot_mode.next=serial reset -w To get into DFU mode. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20221017071000.1458292-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- Documentation/boards/stm32mp.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst index 4cdd281a9e..813117a04f 100644 --- a/Documentation/boards/stm32mp.rst +++ b/Documentation/boards/stm32mp.rst @@ -164,9 +164,13 @@ normal barebox functionality like creating a DFU-gadget in barebox, Fastboot/USB mass storage ... etc. The FIP image containing barebox can be generated as described in -137::ref:`stm32mp_fip`. Upstream TF-A doesn't support DFU for +:ref:`stm32mp_fip`. Upstream TF-A doesn't support DFU for SSBLs using the legacy stm32image format. +DFU mode can be forced via :ref:`reboot_mode` from a booted system with:: + + tamp.reboot_mode.next=serial reset -w + Boot source selection --------------------- -- cgit v1.2.1