Linux-Watchdog Archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Peter Yin <peteryin.openbmc@gmail.com>,
	patrick@stwcx.xyz, Wim Van Sebroeck <wim@linux-watchdog.org>,
	Joel Stanley <joel@jms.id.au>,
	Andrew Jeffery <andrew@codeconstruct.com.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 v1] drivers: watchdog: ast2600 support bootstatus
Date: Thu, 14 Mar 2024 06:50:27 -0700	[thread overview]
Message-ID: <257fa47f-f1de-49ec-9ebf-c33d4de736e1@roeck-us.net> (raw)
In-Reply-To: <20240314065744.1182701-1-peteryin.openbmc@gmail.com>

On 3/13/24 23:57, Peter Yin wrote:
> Add WDIOF_EXTERN1 bootstatus in ast2600
> 

This does a bit more than that because it replaces
WDIOF_CARDRESET with WDIOF_EXTERN1 for ast2600.

> Signed-off-by: Peter Yin <peteryin.openbmc@gmail.com>
> ---
> Change log:
> 
> v1
>    - Patch 0001 - Add WDIOF_EXTERN1 bootstatus
> ---
>   drivers/watchdog/aspeed_wdt.c | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index b4773a6aaf8c..8adadd394be6 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -81,6 +81,7 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
>   #define   WDT_CLEAR_TIMEOUT_AND_BOOT_CODE_SELECTION	BIT(0)
>   #define WDT_RESET_MASK1		0x1c
>   #define WDT_RESET_MASK2		0x20
> +#define   WDT_EVENT_COUNTER_MASK       (0xFFF << 8)
>   
>   /*
>    * WDT_RESET_WIDTH controls the characteristics of the external pulse (if
> @@ -459,8 +460,17 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
>   	}
>   
>   	status = readl(wdt->base + WDT_TIMEOUT_STATUS);/BOOT_SECON
> -	if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY) {
> -		wdt->wdd.bootstatus = WDIOF_CARDRESET;
> +
> +	if (of_device_is_compatible(np, "aspeed,ast2600-wdt")) {
> +		if (status & WDT_EVENT_COUNTER_MASK) {
> +			/*
> +			 * Reset cause by WatchDog
> +			 */
> +			wdt->wdd.bootstatus |= WDIOF_EXTERN1;
> +		}
> +	} else {
> +		if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY)
> +			wdt->wdd.bootstatus = WDIOF_CARDRESET;
>   
>   		if (of_device_is_compatible(np, "aspeed,ast2400-wdt") ||
>   		    of_device_is_compatible(np, "aspeed,ast2500-wdt"))

This check is now unnecessary since it matches the else case.

Either case, it needs to be explained why WDIOF_CARDRESET ("Card previously
reset the CPU") is replaced by WDIOF_EXTERN1 ("External relay 1") for ast2600,
and why WDT_TIMEOUT_STATUS_BOOT_SECONDARY does not apply for ast2600 but
(status & WDT_EVENT_COUNTER_MASK) does.

Guenter


      reply	other threads:[~2024-03-14 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  6:57 [PATCH v1] drivers: watchdog: ast2600 support bootstatus Peter Yin
2024-03-14 13:50 ` Guenter Roeck [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=257fa47f-f1de-49ec-9ebf-c33d4de736e1@roeck-us.net \
    --to=linux@roeck-us.net \
    --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=patrick@stwcx.xyz \
    --cc=peteryin.openbmc@gmail.com \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).