mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler
@ 2021-08-03 16:59 Ahmad Fatoum
  2021-08-03 16:59 ` [PATCH 2/2] ARM: i.MX8MM: add reboot to serial download mode Ahmad Fatoum
  2021-08-09 18:18 ` [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2021-08-03 16:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

With fsl,ext-reset-output and WDOG_B muxed correctly, the i.MX watchdog
will toggle an external signal to effect a PMIC reset.

That's good for normal use, but when exchanging information with the
BootROM over GPRs, a warm reset is required. This is needed e.g. to
set the reboot mode. Support this by defining a second, lower
priority, reset that will never toggle external lines.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/watchdog/imxwd.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index 26c62b7bcb31..a109f6fee712 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -39,6 +39,7 @@ struct imx_wd {
 	struct device_d *dev;
 	const struct imx_wd_ops *ops;
 	struct restart_handler restart;
+	struct restart_handler restart_warm;
 	bool ext_reset;
 	bool bigendian;
 };
@@ -183,6 +184,14 @@ static void __noreturn imxwd_force_soc_reset(struct restart_handler *rst)
 	hang();
 }
 
+static void __noreturn imxwd_force_soc_reset_internal(struct restart_handler *rst)
+{
+	struct imx_wd *priv = container_of(rst, struct imx_wd, restart_warm);
+
+	priv->ext_reset = false;
+	imxwd_force_soc_reset(&priv->restart);
+}
+
 static void imx_watchdog_detect_reset_source(struct imx_wd *priv)
 {
 	u16 val = imxwd_read(priv, IMX21_WDOG_WSTR);
@@ -284,9 +293,16 @@ static int imx_wd_probe(struct device_d *dev)
 
 	priv->restart.name = "imxwd";
 	priv->restart.restart = imxwd_force_soc_reset;
+	priv->restart.priority = RESTART_DEFAULT_PRIORITY;
 
 	restart_handler_register(&priv->restart);
 
+	priv->restart_warm.name = "imxwd-warm";
+	priv->restart_warm.restart = imxwd_force_soc_reset_internal;
+	priv->restart_warm.priority = RESTART_DEFAULT_PRIORITY - 10;
+
+	restart_handler_register(&priv->restart_warm);
+
 	return 0;
 
 error_unregister:
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ARM: i.MX8MM: add reboot to serial download mode
  2021-08-03 16:59 [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler Ahmad Fatoum
@ 2021-08-03 16:59 ` Ahmad Fatoum
  2021-08-05 15:32   ` Ahmad Fatoum
  2021-08-09 18:18 ` [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2021-08-03 16:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, David Jander

The i.MX8MM reference manual follows long established tradition in not
documenting BootROM magic reboot codes. For older i.MX variants, the
values can be seen in the bmode tables of Freescale's U-Boot patches.

There are no such patches for the i.MX8M, but testing shows that

	mw 0x30390094 0x10 ; mw 0x30390098 0x40000000

is one of the configurations that trigger serial download on next warm
reset on an i.MX8MM. Describe this in the device tree, so

	gpr.reboot_mode.next=serial reset -r imxwd-warm

does the right thing for that SoC.

This all might work for other i.MX8M variants as well, but the dtsi
can be genericized later on when tested.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Cc: David Jander <david@protonic.nl>
Cc: Lucas Stach <l.stach@pengutronix.de>
---
 Documentation/boards/imx.rst   | 29 +++++++++++++++++++++++++++++
 arch/arm/dts/imx8mm-evk.dts    |  1 +
 arch/arm/dts/imx8mm-prt8mm.dts |  1 +
 arch/arm/dts/imx8mm.dtsi       | 18 ++++++++++++++++++
 4 files changed, 49 insertions(+)
 create mode 100644 arch/arm/dts/imx8mm.dtsi

diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst
index 887b45c70881..4ce9d9808cc1 100644
--- a/Documentation/boards/imx.rst
+++ b/Documentation/boards/imx.rst
@@ -83,6 +83,35 @@ The images can also always be started as second stage on the target:
 
   barebox@Board Name:/ bootm /mnt/tftp/barebox-freescale-imx51-babbage.img
 
+BootROM Reboot mode codes (bmode)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+For select SoCs, barebox supports communicating an alternative boot medium
+that BootROM should select after a warm reset::
+
+  barebox@FSL i.MX8MM EVK board:/ devinfo gpr.reboot_mode
+  Driver: syscon-reboot-mode
+  Bus: platform
+  Parent: 30390000.reset-controller@30390000.of
+  Parameters:
+    next: normal (type: enum) (values: "normal", "serial")
+    prev: normal (type: enum) (values: "normal", "serial")
+  Device node: /soc@0/bus@30000000/reset-controller@30390000/reboot-mode
+  reboot-mode {
+          compatible = "barebox,syscon-reboot-mode";
+          offset = <0x94 0x98>;
+          mask = <0xffffffff 0x40000000>;
+          mode-normal = <0x0 0x0>;
+          mode-serial = <0x10 0x40000000>;
+  };
+
+  barebox@FSL i.MX8MM EVK board:/ gpr.reboot_mode.next=serial reset -r imxwd-warm
+
+This will cause barebox to fall into serial download mode on an i.MX8MM.
+
+Different SoCs may have more possible reboot modes available.
+See the section on :ref:`Reboot modes<reboot_mode>` for more information.
+
 High Assurance Boot
 ^^^^^^^^^^^^^^^^^^^
 
diff --git a/arch/arm/dts/imx8mm-evk.dts b/arch/arm/dts/imx8mm-evk.dts
index 1e8619ccf584..304f150307a3 100644
--- a/arch/arm/dts/imx8mm-evk.dts
+++ b/arch/arm/dts/imx8mm-evk.dts
@@ -7,6 +7,7 @@
 /dts-v1/;
 
 #include <arm64/freescale/imx8mm-evk.dts>
+#include "imx8mm.dtsi"
 
 / {
 	chosen {
diff --git a/arch/arm/dts/imx8mm-prt8mm.dts b/arch/arm/dts/imx8mm-prt8mm.dts
index bdcdd0806243..abd758f2856e 100644
--- a/arch/arm/dts/imx8mm-prt8mm.dts
+++ b/arch/arm/dts/imx8mm-prt8mm.dts
@@ -7,6 +7,7 @@
 /dts-v1/;
 
 #include <arm64/freescale/imx8mm.dtsi>
+#include "imx8mm.dtsi"
 
 / {
 	model = "Protonic PRT8MM";
diff --git a/arch/arm/dts/imx8mm.dtsi b/arch/arm/dts/imx8mm.dtsi
new file mode 100644
index 000000000000..78bbacb2b1b2
--- /dev/null
+++ b/arch/arm/dts/imx8mm.dtsi
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/ {
+	aliases {
+		gpr.reboot_mode = &reboot_mode_gpr;
+	};
+};
+
+&src {
+	compatible = "fsl,imx8mm-src", "fsl,imx8mq-src", "syscon", "simple-mfd";
+
+	reboot_mode_gpr: reboot-mode {
+		compatible = "barebox,syscon-reboot-mode";
+		offset = <0x94>, <0x98>; /* SRC_GPR{9,10} */
+		mask = <0xffffffff>, <0x40000000>;
+		mode-normal = <0>, <0>;
+		mode-serial = <0x00000010>, <0x40000000>;
+	};
+};
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] ARM: i.MX8MM: add reboot to serial download mode
  2021-08-03 16:59 ` [PATCH 2/2] ARM: i.MX8MM: add reboot to serial download mode Ahmad Fatoum
@ 2021-08-05 15:32   ` Ahmad Fatoum
  2021-08-09 10:40     ` Ahmad Fatoum
  0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2021-08-05 15:32 UTC (permalink / raw)
  To: barebox, Uwe Kleine-Koenig; +Cc: David Jander

Hello Uwe,

On 03.08.21 18:59, Ahmad Fatoum wrote:
> The i.MX8MM reference manual follows long established tradition in not
> documenting BootROM magic reboot codes. For older i.MX variants, the
> values can be seen in the bmode tables of Freescale's U-Boot patches.
> 
> There are no such patches for the i.MX8M, but testing shows that
> 
> 	mw 0x30390094 0x10 ; mw 0x30390098 0x40000000
> 
> is one of the configurations that trigger serial download on next warm
> reset on an i.MX8MM. Describe this in the device tree, so
> 
> 	gpr.reboot_mode.next=serial reset -r imxwd-warm
> 
> does the right thing for that SoC.

As you are currently doing i.MX8MP serial boot work, could you apply this
series, boot barebox containing it (and the i.MX watchdog driver)
from eMMC and try out:

	mw 0x30390094 0x10 ; mw 0x30390098 0x40000000
	reset -r imxwd-warm

If the 8MP is similar enough to the 8MM in this respect, the BootROM
should fall into serial download mode despite being strapped for
eMMC.

Thanks!
Ahmad


> 
> This all might work for other i.MX8M variants as well, but the dtsi
> can be genericized later on when tested.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> Cc: David Jander <david@protonic.nl>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> ---
>  Documentation/boards/imx.rst   | 29 +++++++++++++++++++++++++++++
>  arch/arm/dts/imx8mm-evk.dts    |  1 +
>  arch/arm/dts/imx8mm-prt8mm.dts |  1 +
>  arch/arm/dts/imx8mm.dtsi       | 18 ++++++++++++++++++
>  4 files changed, 49 insertions(+)
>  create mode 100644 arch/arm/dts/imx8mm.dtsi
> 
> diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst
> index 887b45c70881..4ce9d9808cc1 100644
> --- a/Documentation/boards/imx.rst
> +++ b/Documentation/boards/imx.rst
> @@ -83,6 +83,35 @@ The images can also always be started as second stage on the target:
>  
>    barebox@Board Name:/ bootm /mnt/tftp/barebox-freescale-imx51-babbage.img
>  
> +BootROM Reboot mode codes (bmode)
> +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +
> +For select SoCs, barebox supports communicating an alternative boot medium
> +that BootROM should select after a warm reset::
> +
> +  barebox@FSL i.MX8MM EVK board:/ devinfo gpr.reboot_mode
> +  Driver: syscon-reboot-mode
> +  Bus: platform
> +  Parent: 30390000.reset-controller@30390000.of
> +  Parameters:
> +    next: normal (type: enum) (values: "normal", "serial")
> +    prev: normal (type: enum) (values: "normal", "serial")
> +  Device node: /soc@0/bus@30000000/reset-controller@30390000/reboot-mode
> +  reboot-mode {
> +          compatible = "barebox,syscon-reboot-mode";
> +          offset = <0x94 0x98>;
> +          mask = <0xffffffff 0x40000000>;
> +          mode-normal = <0x0 0x0>;
> +          mode-serial = <0x10 0x40000000>;
> +  };
> +
> +  barebox@FSL i.MX8MM EVK board:/ gpr.reboot_mode.next=serial reset -r imxwd-warm
> +
> +This will cause barebox to fall into serial download mode on an i.MX8MM.
> +
> +Different SoCs may have more possible reboot modes available.
> +See the section on :ref:`Reboot modes<reboot_mode>` for more information.
> +
>  High Assurance Boot
>  ^^^^^^^^^^^^^^^^^^^
>  
> diff --git a/arch/arm/dts/imx8mm-evk.dts b/arch/arm/dts/imx8mm-evk.dts
> index 1e8619ccf584..304f150307a3 100644
> --- a/arch/arm/dts/imx8mm-evk.dts
> +++ b/arch/arm/dts/imx8mm-evk.dts
> @@ -7,6 +7,7 @@
>  /dts-v1/;
>  
>  #include <arm64/freescale/imx8mm-evk.dts>
> +#include "imx8mm.dtsi"
>  
>  / {
>  	chosen {
> diff --git a/arch/arm/dts/imx8mm-prt8mm.dts b/arch/arm/dts/imx8mm-prt8mm.dts
> index bdcdd0806243..abd758f2856e 100644
> --- a/arch/arm/dts/imx8mm-prt8mm.dts
> +++ b/arch/arm/dts/imx8mm-prt8mm.dts
> @@ -7,6 +7,7 @@
>  /dts-v1/;
>  
>  #include <arm64/freescale/imx8mm.dtsi>
> +#include "imx8mm.dtsi"
>  
>  / {
>  	model = "Protonic PRT8MM";
> diff --git a/arch/arm/dts/imx8mm.dtsi b/arch/arm/dts/imx8mm.dtsi
> new file mode 100644
> index 000000000000..78bbacb2b1b2
> --- /dev/null
> +++ b/arch/arm/dts/imx8mm.dtsi
> @@ -0,0 +1,18 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/ {
> +	aliases {
> +		gpr.reboot_mode = &reboot_mode_gpr;
> +	};
> +};
> +
> +&src {
> +	compatible = "fsl,imx8mm-src", "fsl,imx8mq-src", "syscon", "simple-mfd";
> +
> +	reboot_mode_gpr: reboot-mode {
> +		compatible = "barebox,syscon-reboot-mode";
> +		offset = <0x94>, <0x98>; /* SRC_GPR{9,10} */
> +		mask = <0xffffffff>, <0x40000000>;
> +		mode-normal = <0>, <0>;
> +		mode-serial = <0x00000010>, <0x40000000>;
> +	};
> +};
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] ARM: i.MX8MM: add reboot to serial download mode
  2021-08-05 15:32   ` Ahmad Fatoum
@ 2021-08-09 10:40     ` Ahmad Fatoum
  0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2021-08-09 10:40 UTC (permalink / raw)
  To: barebox, Uwe Kleine-Koenig

On 05.08.21 17:32, Ahmad Fatoum wrote:
> On 03.08.21 18:59, Ahmad Fatoum wrote:
>> The i.MX8MM reference manual follows long established tradition in not
>> documenting BootROM magic reboot codes. For older i.MX variants, the
>> values can be seen in the bmode tables of Freescale's U-Boot patches.
>>
>> There are no such patches for the i.MX8M, but testing shows that
>>
>> 	mw 0x30390094 0x10 ; mw 0x30390098 0x40000000
>>
>> is one of the configurations that trigger serial download on next warm
>> reset on an i.MX8MM. Describe this in the device tree, so
>>
>> 	gpr.reboot_mode.next=serial reset -r imxwd-warm
>>
>> does the right thing for that SoC.
> 
> As you are currently doing i.MX8MP serial boot work, could you apply this
> series, boot barebox containing it (and the i.MX watchdog driver)
> from eMMC and try out:
> 
> 	mw 0x30390094 0x10 ; mw 0x30390098 0x40000000
> 	reset -r imxwd-warm
> 
> If the 8MP is similar enough to the 8MM in this respect, the BootROM
> should fall into serial download mode despite being strapped for
> eMMC.

FTR: The same sequence doesn't work on a 8MP.

> 
> Thanks!
> Ahmad
> 
> 
>>
>> This all might work for other i.MX8M variants as well, but the dtsi
>> can be genericized later on when tested.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>> Cc: David Jander <david@protonic.nl>
>> Cc: Lucas Stach <l.stach@pengutronix.de>
>> ---
>>  Documentation/boards/imx.rst   | 29 +++++++++++++++++++++++++++++
>>  arch/arm/dts/imx8mm-evk.dts    |  1 +
>>  arch/arm/dts/imx8mm-prt8mm.dts |  1 +
>>  arch/arm/dts/imx8mm.dtsi       | 18 ++++++++++++++++++
>>  4 files changed, 49 insertions(+)
>>  create mode 100644 arch/arm/dts/imx8mm.dtsi
>>
>> diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst
>> index 887b45c70881..4ce9d9808cc1 100644
>> --- a/Documentation/boards/imx.rst
>> +++ b/Documentation/boards/imx.rst
>> @@ -83,6 +83,35 @@ The images can also always be started as second stage on the target:
>>  
>>    barebox@Board Name:/ bootm /mnt/tftp/barebox-freescale-imx51-babbage.img
>>  
>> +BootROM Reboot mode codes (bmode)
>> +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> +
>> +For select SoCs, barebox supports communicating an alternative boot medium
>> +that BootROM should select after a warm reset::
>> +
>> +  barebox@FSL i.MX8MM EVK board:/ devinfo gpr.reboot_mode
>> +  Driver: syscon-reboot-mode
>> +  Bus: platform
>> +  Parent: 30390000.reset-controller@30390000.of
>> +  Parameters:
>> +    next: normal (type: enum) (values: "normal", "serial")
>> +    prev: normal (type: enum) (values: "normal", "serial")
>> +  Device node: /soc@0/bus@30000000/reset-controller@30390000/reboot-mode
>> +  reboot-mode {
>> +          compatible = "barebox,syscon-reboot-mode";
>> +          offset = <0x94 0x98>;
>> +          mask = <0xffffffff 0x40000000>;
>> +          mode-normal = <0x0 0x0>;
>> +          mode-serial = <0x10 0x40000000>;
>> +  };
>> +
>> +  barebox@FSL i.MX8MM EVK board:/ gpr.reboot_mode.next=serial reset -r imxwd-warm
>> +
>> +This will cause barebox to fall into serial download mode on an i.MX8MM.
>> +
>> +Different SoCs may have more possible reboot modes available.
>> +See the section on :ref:`Reboot modes<reboot_mode>` for more information.
>> +
>>  High Assurance Boot
>>  ^^^^^^^^^^^^^^^^^^^
>>  
>> diff --git a/arch/arm/dts/imx8mm-evk.dts b/arch/arm/dts/imx8mm-evk.dts
>> index 1e8619ccf584..304f150307a3 100644
>> --- a/arch/arm/dts/imx8mm-evk.dts
>> +++ b/arch/arm/dts/imx8mm-evk.dts
>> @@ -7,6 +7,7 @@
>>  /dts-v1/;
>>  
>>  #include <arm64/freescale/imx8mm-evk.dts>
>> +#include "imx8mm.dtsi"
>>  
>>  / {
>>  	chosen {
>> diff --git a/arch/arm/dts/imx8mm-prt8mm.dts b/arch/arm/dts/imx8mm-prt8mm.dts
>> index bdcdd0806243..abd758f2856e 100644
>> --- a/arch/arm/dts/imx8mm-prt8mm.dts
>> +++ b/arch/arm/dts/imx8mm-prt8mm.dts
>> @@ -7,6 +7,7 @@
>>  /dts-v1/;
>>  
>>  #include <arm64/freescale/imx8mm.dtsi>
>> +#include "imx8mm.dtsi"
>>  
>>  / {
>>  	model = "Protonic PRT8MM";
>> diff --git a/arch/arm/dts/imx8mm.dtsi b/arch/arm/dts/imx8mm.dtsi
>> new file mode 100644
>> index 000000000000..78bbacb2b1b2
>> --- /dev/null
>> +++ b/arch/arm/dts/imx8mm.dtsi
>> @@ -0,0 +1,18 @@
>> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>> +/ {
>> +	aliases {
>> +		gpr.reboot_mode = &reboot_mode_gpr;
>> +	};
>> +};
>> +
>> +&src {
>> +	compatible = "fsl,imx8mm-src", "fsl,imx8mq-src", "syscon", "simple-mfd";
>> +
>> +	reboot_mode_gpr: reboot-mode {
>> +		compatible = "barebox,syscon-reboot-mode";
>> +		offset = <0x94>, <0x98>; /* SRC_GPR{9,10} */
>> +		mask = <0xffffffff>, <0x40000000>;
>> +		mode-normal = <0>, <0>;
>> +		mode-serial = <0x00000010>, <0x40000000>;
>> +	};
>> +};
>>
> 
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler
  2021-08-03 16:59 [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler Ahmad Fatoum
  2021-08-03 16:59 ` [PATCH 2/2] ARM: i.MX8MM: add reboot to serial download mode Ahmad Fatoum
@ 2021-08-09 18:18 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2021-08-09 18:18 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Aug 03, 2021 at 06:59:36PM +0200, Ahmad Fatoum wrote:
> With fsl,ext-reset-output and WDOG_B muxed correctly, the i.MX watchdog
> will toggle an external signal to effect a PMIC reset.
> 
> That's good for normal use, but when exchanging information with the
> BootROM over GPRs, a warm reset is required. This is needed e.g. to
> set the reboot mode. Support this by defining a second, lower
> priority, reset that will never toggle external lines.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/watchdog/imxwd.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
> index 26c62b7bcb31..a109f6fee712 100644
> --- a/drivers/watchdog/imxwd.c
> +++ b/drivers/watchdog/imxwd.c
> @@ -39,6 +39,7 @@ struct imx_wd {
>  	struct device_d *dev;
>  	const struct imx_wd_ops *ops;
>  	struct restart_handler restart;
> +	struct restart_handler restart_warm;
>  	bool ext_reset;
>  	bool bigendian;
>  };
> @@ -183,6 +184,14 @@ static void __noreturn imxwd_force_soc_reset(struct restart_handler *rst)
>  	hang();
>  }
>  
> +static void __noreturn imxwd_force_soc_reset_internal(struct restart_handler *rst)
> +{
> +	struct imx_wd *priv = container_of(rst, struct imx_wd, restart_warm);
> +
> +	priv->ext_reset = false;
> +	imxwd_force_soc_reset(&priv->restart);
> +}
> +
>  static void imx_watchdog_detect_reset_source(struct imx_wd *priv)
>  {
>  	u16 val = imxwd_read(priv, IMX21_WDOG_WSTR);
> @@ -284,9 +293,16 @@ static int imx_wd_probe(struct device_d *dev)
>  
>  	priv->restart.name = "imxwd";
>  	priv->restart.restart = imxwd_force_soc_reset;
> +	priv->restart.priority = RESTART_DEFAULT_PRIORITY;
>  
>  	restart_handler_register(&priv->restart);
>  
> +	priv->restart_warm.name = "imxwd-warm";
> +	priv->restart_warm.restart = imxwd_force_soc_reset_internal;
> +	priv->restart_warm.priority = RESTART_DEFAULT_PRIORITY - 10;
> +
> +	restart_handler_register(&priv->restart_warm);
> +
>  	return 0;
>  
>  error_unregister:
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-09 18:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 16:59 [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler Ahmad Fatoum
2021-08-03 16:59 ` [PATCH 2/2] ARM: i.MX8MM: add reboot to serial download mode Ahmad Fatoum
2021-08-05 15:32   ` Ahmad Fatoum
2021-08-09 10:40     ` Ahmad Fatoum
2021-08-09 18:18 ` [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox