linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Sam Protsenko <semen.protsenko@linaro.org>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH v3 07/12] watchdog: s3c2410: Implement a way to invert mask reg value
Date: Wed, 17 Nov 2021 05:35:51 -0800	[thread overview]
Message-ID: <20211117133551.GG2435591@roeck-us.net> (raw)
In-Reply-To: <20211107202943.8859-8-semen.protsenko@linaro.org>

On Sun, Nov 07, 2021 at 10:29:38PM +0200, Sam Protsenko wrote:
> On new Exynos chips (like Exynos850) the MASK_WDT_RESET_REQUEST register
> is replaced with CLUSTERx_NONCPU_INT_EN, and its mask bit value meaning
> was reversed: for new register the bit value "1" means "Interrupt
> enabled", while for MASK_WDT_RESET_REQUEST register "1" means "Mask the
> interrupt" (i.e. "Interrupt disabled").
> 
> Introduce "mask_reset_inv" boolean field in driver data structure; when
> that field is "true", mask register handling function will invert the
> value before setting it to the register.
> 
> This commit doesn't bring any functional change to existing devices, but
> merely provides an infrastructure for upcoming chips support.
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> Changes in v3:
>   - Added R-b tag by Krzysztof Kozlowski
> 
> Changes in v2:
>   - (none): it's a new patch
> 
>  drivers/watchdog/s3c2410_wdt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 4ac0a30e835e..2a61b6ea5602 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -92,6 +92,7 @@ MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, 0 to
>   * timer reset functionality.
>   * @mask_reset_reg: Offset in pmureg for the register that masks the watchdog
>   * timer reset functionality.
> + * @mask_reset_inv: If set, mask_reset_reg value will have inverted meaning.
>   * @mask_bit: Bit number for the watchdog timer in the disable register and the
>   * mask reset register.
>   * @rst_stat_reg: Offset in pmureg for the register that has the reset status.
> @@ -103,6 +104,7 @@ MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, 0 to
>  struct s3c2410_wdt_variant {
>  	int disable_reg;
>  	int mask_reset_reg;
> +	bool mask_reset_inv;
>  	int mask_bit;
>  	int rst_stat_reg;
>  	int rst_stat_bit;
> @@ -219,7 +221,8 @@ static int s3c2410wdt_disable_wdt_reset(struct s3c2410_wdt *wdt, bool mask)
>  static int s3c2410wdt_mask_wdt_reset(struct s3c2410_wdt *wdt, bool mask)
>  {
>  	const u32 mask_val = BIT(wdt->drv_data->mask_bit);
> -	const u32 val = mask ? mask_val : 0;
> +	const bool val_inv = wdt->drv_data->mask_reset_inv;
> +	const u32 val = (mask ^ val_inv) ? mask_val : 0;
>  	int ret;
>  
>  	ret = regmap_update_bits(wdt->pmureg, wdt->drv_data->mask_reset_reg,
> -- 
> 2.30.2
> 

  reply	other threads:[~2021-11-17 13:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07 20:29 [PATCH v3 00/12] watchdog: s3c2410: Add Exynos850 support Sam Protsenko
2021-11-07 20:29 ` [PATCH v3 01/12] dt-bindings: watchdog: Require samsung,syscon-phandle for Exynos7 Sam Protsenko
2021-11-17 13:33   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 02/12] dt-bindings: watchdog: Document Exynos850 watchdog bindings Sam Protsenko
2021-11-08 13:08   ` Krzysztof Kozlowski
2021-11-12 22:43   ` Rob Herring
2021-11-17 13:34   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 03/12] watchdog: s3c2410: Fail probe if can't find valid timeout Sam Protsenko
2021-11-17 13:34   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 04/12] watchdog: s3c2410: Let kernel kick watchdog Sam Protsenko
2021-11-17 13:34   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 05/12] watchdog: s3c2410: Make reset disable register optional Sam Protsenko
2021-11-17 13:35   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 06/12] watchdog: s3c2410: Extract disable and mask code into separate functions Sam Protsenko
2021-11-17 13:35   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 07/12] watchdog: s3c2410: Implement a way to invert mask reg value Sam Protsenko
2021-11-17 13:35   ` Guenter Roeck [this message]
2021-11-07 20:29 ` [PATCH v3 08/12] watchdog: s3c2410: Add support for WDT counter enable register Sam Protsenko
2021-11-17 13:36   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 09/12] watchdog: s3c2410: Cleanup PMU related code Sam Protsenko
2021-11-17 13:36   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 10/12] watchdog: s3c2410: Support separate source clock Sam Protsenko
2021-11-08 13:24   ` Krzysztof Kozlowski
2021-11-17 13:37   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 11/12] watchdog: s3c2410: Remove superfluous err label Sam Protsenko
2021-11-17 13:37   ` Guenter Roeck
2021-11-07 20:29 ` [PATCH v3 12/12] watchdog: s3c2410: Add Exynos850 support Sam Protsenko
2021-11-08 13:25   ` Krzysztof Kozlowski
2021-11-17 13:37   ` Guenter Roeck
2021-11-20 20:29   ` Guenter Roeck
2021-11-21 16:25     ` Sam Protsenko

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=20211117133551.GG2435591@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=semen.protsenko@linaro.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).