linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Chris Packham <chris.packham@alliedtelesis.co.nz>,
	andrew@lunn.ch, robh+dt@kernel.org, wim@linux-watchdog.org,
	linux@roeck-us.net
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
	Chris Packham <chris.packham@alliedtelesis.co.nz>
Subject: Re: [PATCH 2/2] watchdog: orion_wdt: support pretimeout on Armada-XP
Date: Mon, 14 Feb 2022 16:36:01 +0100	[thread overview]
Message-ID: <87r185jw9q.fsf@BL-laptop> (raw)
In-Reply-To: <20220211003257.2037332-3-chris.packham@alliedtelesis.co.nz>

Chris Packham <chris.packham@alliedtelesis.co.nz> writes:

> Commit e07a4c79ca75 ("watchdog: orion_wdt: use timer1 as a pretimeout")
> added support for a pretimeout on Armada-38x variants. Because the
> Armada-XP variants use armada370_start/armada370_stop (due to missing an
> explicit RSTOUT mask bit for the watchdog). Add the required pretimeout
> support to armada370_start/armada370_stop for Armada-XP.
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>

Thanks,

Gregory

> ---
>  drivers/watchdog/orion_wdt.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> index 127eefc9161d..e25e6bf4647f 100644
> --- a/drivers/watchdog/orion_wdt.c
> +++ b/drivers/watchdog/orion_wdt.c
> @@ -238,8 +238,10 @@ static int armada370_start(struct watchdog_device *wdt_dev)
>  	atomic_io_modify(dev->reg + TIMER_A370_STATUS, WDT_A370_EXPIRED, 0);
>  
>  	/* Enable watchdog timer */
> -	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit,
> -						dev->data->wdt_enable_bit);
> +	reg = dev->data->wdt_enable_bit;
> +	if (dev->wdt.info->options & WDIOF_PRETIMEOUT)
> +		reg |= TIMER1_ENABLE_BIT;
> +	atomic_io_modify(dev->reg + TIMER_CTRL, reg, reg);
>  
>  	/* Enable reset on watchdog */
>  	reg = readl(dev->rstout);
> @@ -312,7 +314,7 @@ static int armada375_stop(struct watchdog_device *wdt_dev)
>  static int armada370_stop(struct watchdog_device *wdt_dev)
>  {
>  	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> -	u32 reg;
> +	u32 reg, mask;
>  
>  	/* Disable reset on watchdog */
>  	reg = readl(dev->rstout);
> @@ -320,7 +322,10 @@ static int armada370_stop(struct watchdog_device *wdt_dev)
>  	writel(reg, dev->rstout);
>  
>  	/* Disable watchdog timer */
> -	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0);
> +	mask = dev->data->wdt_enable_bit;
> +	if (wdt_dev->info->options & WDIOF_PRETIMEOUT)
> +		mask |= TIMER1_ENABLE_BIT;
> +	atomic_io_modify(dev->reg + TIMER_CTRL, mask, 0);
>  
>  	return 0;
>  }
> -- 
> 2.35.1
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

  reply	other threads:[~2022-02-14 15:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11  0:32 [PATCH 0/2] watchdog: Pretimeout support for Armada-XP Chris Packham
2022-02-11  0:32 ` [PATCH 1/2] ARM: dts: armada-xp: add interrupts for watchdog Chris Packham
2022-02-14 15:39   ` Gregory CLEMENT
2022-10-16 22:39     ` Chris Packham
2022-10-17  0:20       ` Guenter Roeck
2022-11-27 23:42       ` Gregory CLEMENT
2022-02-14 15:58   ` Guenter Roeck
2022-02-11  0:32 ` [PATCH 2/2] watchdog: orion_wdt: support pretimeout on Armada-XP Chris Packham
2022-02-14 15:36   ` Gregory CLEMENT [this message]
2022-02-14 15:57   ` 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=87r185jw9q.fsf@BL-laptop \
    --to=gregory.clement@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --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).