mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler
Date: Mon, 9 Aug 2021 20:18:05 +0200	[thread overview]
Message-ID: <20210809181805.GD11515@pengutronix.de> (raw)
In-Reply-To: <20210803165937.31608-1-a.fatoum@pengutronix.de>

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


      parent reply	other threads:[~2021-08-09 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-05 15:32   ` Ahmad Fatoum
2021-08-09 10:40     ` Ahmad Fatoum
2021-08-09 18:18 ` Sascha Hauer [this message]

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=20210809181805.GD11515@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --subject='Re: [PATCH 1/2] watchdog: imxwd: register explicit warm reset handler' \
    /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

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