From: Chia Hsing Yin <peteryin.openbmc@gmail.com>
To: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: patrick@stwcx.xyz, Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>,
Joel Stanley <joel@jms.id.au>,
linux-watchdog@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/1] drivers: watchdog: revise watchdog bootstatus
Date: Fri, 26 Apr 2024 22:45:32 +0800 [thread overview]
Message-ID: <CAPSyxFTa6k3FzUmDoZ6HMpAfwZGK_yPrQKGSvSdtj_JqsnMVrA@mail.gmail.com> (raw)
In-Reply-To: <5ed8bfd6ce559a7d00ec89f1bd7ae1aea90e3ae7.camel@codeconstruct.com.au>
I can include reset condition in struct maybe like this
static const struct aspeed_wdt_config ast2600_config = {
.ext_pulse_width_mask = 0xfffff,
.irq_shift = 0,
.irq_mask = GENMASK(31, 10),
.compatible = "aspeed,ast2600-scu",
.reset_event = AST2600_SYSTEM_RESET_EVENT,
.watchdog_reset_flag = AST2600_WATCHDOG_RESET_FLAG,
.extern_reset_flag = EXTERN_RESET_FLAG,
.reset_flag_clear = AST2600_RESET_FLAG_CLEAR,
};
in probe( ) we just call
scu_base = syscon_regmap_lookup_by_compatible(wdt->cfg->compatible);
if (IS_ERR(scu_base))
return PTR_ERR(scu_base);
ret = regmap_read(scu_base, wdt->cfg->reset_event, &status);
if (ret)
return ret;
if ((status & POWERON_RESET_FLAG) == 0 &&
status & wdt->cfg->watchdog_reset_flag)
wdt->wdd.bootstatus = (status & wdt->cfg->extern_reset_flag) ?
WDIOF_EXTERN1 : WDIOF_CARDRESET;
status = wdt->cfg->watchdog_reset_flag | POWERON_RESET_FLAG |
wdt->cfg->extern_reset_flag;
ret = regmap_write(scu_base, wdt->cfg->reset_event, status);
Does this meet your expectations?
On Fri, Apr 26, 2024 at 8:42 AM Andrew Jeffery
<andrew@codeconstruct.com.au> wrote:
>
> On Thu, 2024-04-25 at 17:07 +0800, Peter Yin wrote:
> > Regarding the AST2600 specification, the WDTn Timeout Status Register
> > (WDT10) has bit 1 reserved. Bit 1 of the status register indicates
> > on ast2500 if the boot was from the second boot source.
> > It does not indicate that the most recent reset was triggered by
> > the watchdog. The code should just be changed to set WDIOF_CARDRESET
> > if bit 0 of the status register is set. However, this bit can be clear when
> > watchdog register 0x0c bit1(Reset System after timeout) is enabled.
> > Thereforce include SCU register to veriy WDIOF_EXTERN1 and WDIOF_CARDRESET
> > in ast2600 SCU74 or ast2400/ast2500 SCU3C.
> >
> > Signed-off-by: Peter Yin <peteryin.openbmc@gmail.com>
> > ---
> > drivers/watchdog/aspeed_wdt.c | 109 ++++++++++++++++++++++++++++++++--
> > 1 file changed, 103 insertions(+), 6 deletions(-)
>
> After this patch the probe() implementation is ~250loc with a whole
> bunch of conditional behaviours based on the SoC version. Maybe it's
> time to break it up into version-specific functions that are called
> from the probe() implementation?
>
> Andrew
next prev parent reply other threads:[~2024-04-26 14:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 9:07 [PATCH v7 0/1] drivers: watchdog: revise watchdog bootstatus Peter Yin
2024-04-25 9:07 ` [PATCH v7 1/1] " Peter Yin
2024-04-26 0:41 ` Andrew Jeffery
2024-04-26 14:45 ` Chia Hsing Yin [this message]
2024-04-26 16:23 ` Guenter Roeck
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=CAPSyxFTa6k3FzUmDoZ6HMpAfwZGK_yPrQKGSvSdtj_JqsnMVrA@mail.gmail.com \
--to=peteryin.openbmc@gmail.com \
--cc=andrew@codeconstruct.com.au \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=patrick@stwcx.xyz \
--cc=wim@linux-watchdog.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;
as well as URLs for NNTP newsgroup(s).