[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB9PR10MB4652529FAC6253C266B172EF80639@DB9PR10MB4652.EURPRD10.PROD.OUTLOOK.COM>
Date: Fri, 26 Nov 2021 13:28:28 +0000
From: Adam Thomson <Adam.Thomson.Opensource@...semi.com>
To: Andrej Picej <andrej.picej@...ik.com>,
Support Opensource <Support.Opensource@...semi.com>,
"wim@...ux-watchdog.org" <wim@...ux-watchdog.org>,
"linux@...ck-us.net" <linux@...ck-us.net>,
"linux-watchdog@...r.kernel.org" <linux-watchdog@...r.kernel.org>
CC: "y.bas@...tec.de" <y.bas@...tec.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] watchdog: da9062: reset board on watchdog timeout
On 24 November 2021 08:33, Andrej Picej wrote:
> From: Stefan Christ <s.christ@...tec.de>
>
> In the default fuse configuration the watchdog poweroffs the system
> instead of resetting it on a watchdog timeout. This patch changes the
> behavior. Now the board is reseted and reboots.
>
> Note: This patch requires that the config register CONFIG_I is
> configured as writable in the da9062 multi function device.
I'm a little concerned about forcing this change in the driver. There may be
platforms which don't want the PMIC to perform a full reset through OTP re-read
and if we hard code this change then that's impacting those platforms. If we
want/need this then I think it should probably be a DT binding for da9061/2
which then indicates the behaviour we want.
NRES_MODE bit also plays a part here as it controls whether or not the nRESET
line state is changed as part of the power-down/up process. I'm assuming for
your setup this bit is 0?
>
> Signed-off-by: Stefan Christ <s.christ@...tec.de>
> Signed-off-by: Andrej Picej <andrej.picej@...ik.com>
> ---
> drivers/watchdog/da9062_wdt.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index f02cbd530538..a04613e68f4a 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -87,6 +87,20 @@ static int da9062_wdt_start(struct watchdog_device *wdd)
> unsigned int selector;
> int ret;
>
> + /*
> + * Use da9062's SHUTDOWN mode instead of POWERDOWN for
> watchdog reset.
> + * On timeout the PMIC should reset the system, not powering it
> + * off.
> + */
> + ret = regmap_update_bits(wdt->hw->regmap,
> + DA9062AA_CONFIG_I,
> + DA9062AA_WATCHDOG_SD_MASK,
> + DA9062AA_WATCHDOG_SD_MASK);
> + if (ret)
> + dev_err(wdt->hw->dev,
> + "failed to set wdt reset mode. Expect poweroff on
> watchdog reset: %d\n",
> + ret);
> +
> selector = da9062_wdt_timeout_to_sel(wdt->wdtdev.timeout);
> ret = da9062_wdt_update_timeout_register(wdt, selector);
> if (ret)
> --
> 2.25.1
Powered by blists - more mailing lists