From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 8/8] ARM: stm32mp: mark iwdg2 with barebox,restart-warm-bootrom
Date: Mon, 17 Oct 2022 09:10:00 +0200 [thread overview]
Message-ID: <20221017071000.1458292-9-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20221017071000.1458292-1-a.fatoum@pengutronix.de>
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 <a.fatoum@pengutronix.de>
---
Documentation/boards/stm32mp.rst | 6 +++++-
arch/arm/dts/stm32mp131.dtsi | 4 ++++
arch/arm/dts/stm32mp151.dtsi | 4 ++++
drivers/clk/clk-stm32mp1.c | 2 +-
drivers/power/reset/stm32-reboot.c | 6 ++++--
include/soc/stm32/reboot.h | 6 ++++--
6 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index 4cdd281a9e14..813117a04f22 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
---------------------
diff --git a/arch/arm/dts/stm32mp131.dtsi b/arch/arm/dts/stm32mp131.dtsi
index 2ecad85f086e..89a7ffcb814f 100644
--- a/arch/arm/dts/stm32mp131.dtsi
+++ b/arch/arm/dts/stm32mp131.dtsi
@@ -12,3 +12,7 @@
reg = <0x5a003000 0x1000>;
};
};
+
+&iwdg2 {
+ barebox,restart-warm-bootrom;
+};
diff --git a/arch/arm/dts/stm32mp151.dtsi b/arch/arm/dts/stm32mp151.dtsi
index ac6536a556a9..d3e924dc0072 100644
--- a/arch/arm/dts/stm32mp151.dtsi
+++ b/arch/arm/dts/stm32mp151.dtsi
@@ -37,6 +37,10 @@
barebox,provide-mac-address = <ðernet0 0x39>;
};
+&iwdg2 {
+ barebox,restart-warm-bootrom;
+};
+
&tamp {
reboot_mode_tamp: reboot-mode {
compatible = "syscon-reboot-mode";
diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c
index c4b03e9f6d74..6753a3689085 100644
--- a/drivers/clk/clk-stm32mp1.c
+++ b/drivers/clk/clk-stm32mp1.c
@@ -2280,7 +2280,7 @@ static int stm32mp1_rcc_init(struct device_d *dev)
if (ret)
return ret;
- stm32mp_system_restart_init(base);
+ stm32mp_system_restart_init(dev);
return 0;
}
diff --git a/drivers/power/reset/stm32-reboot.c b/drivers/power/reset/stm32-reboot.c
index 809531e71396..147b4d9d8164 100644
--- a/drivers/power/reset/stm32-reboot.c
+++ b/drivers/power/reset/stm32-reboot.c
@@ -108,17 +108,19 @@ static void stm32_set_reset_reason(struct stm32_reset *priv,
reset_source_to_string(type), reg);
}
-void stm32mp_system_restart_init(void __iomem *base)
+void stm32mp_system_restart_init(struct device_d *dev)
{
struct stm32_reset *priv;
+ struct device_node *np = dev_of_node(dev);
priv = xzalloc(sizeof(*priv));
- priv->base = base;
+ priv->base = of_iomap(np, 0);
priv->restart.name = "stm32-rcc";
priv->restart.restart = stm32mp_rcc_restart_handler;
priv->restart.priority = 200;
+ priv->restart.of_node = np;
restart_handler_register(&priv->restart);
diff --git a/include/soc/stm32/reboot.h b/include/soc/stm32/reboot.h
index d6c731f59f74..cf0d0286e753 100644
--- a/include/soc/stm32/reboot.h
+++ b/include/soc/stm32/reboot.h
@@ -5,10 +5,12 @@
#include <linux/compiler.h>
+struct device_d;
+
#ifdef CONFIG_RESET_STM32
-void stm32mp_system_restart_init(void __iomem *rcc);
+void stm32mp_system_restart_init(struct device_d *rcc);
#else
-static inline void stm32mp_system_restart_init(void __iomem *rcc)
+static inline void stm32mp_system_restart_init(struct device_d *rcc)
{
}
#endif
--
2.30.2
next prev parent reply other threads:[~2022-10-17 7:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 7:09 [PATCH 0/8] ARM: i.MX7: add serial download reboot mode Ahmad Fatoum
2022-10-17 7:09 ` [PATCH 1/8] restart: make restart.h header self-contained Ahmad Fatoum
2022-10-17 7:09 ` [PATCH 2/8] restart: do restart-priority OF parsing in restart_handler_register Ahmad Fatoum
2022-10-17 7:09 ` [PATCH 3/8] restart: add reset -w for warm bootrom reset Ahmad Fatoum
2022-10-17 7:09 ` [PATCH 4/8] watchdog: imxwd: don't register broken imxwd-warm for i.MX7 Ahmad Fatoum
2022-10-17 7:09 ` [PATCH 5/8] watchdog: imxwd: set imxwd-warm as reboot mode default handler Ahmad Fatoum
2022-10-17 7:09 ` [PATCH 6/8] Documentations: devicetree: bindings: document watchdog-priority Ahmad Fatoum
2022-10-17 7:09 ` [PATCH 7/8] ARM: i.MX7: describe USB serial download boot mode Ahmad Fatoum
2022-10-17 7:10 ` Ahmad Fatoum [this message]
2022-10-18 9:13 ` [PATCH 0/8] ARM: i.MX7: add serial download reboot mode Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221017071000.1458292-9-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox