From: Biju Das <biju.das.jz@bp.renesas.com>
To: Phil Edworthy <phil.edworthy@renesas.com>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
Guenter Roeck <linux@roeck-us.net>
Cc: Phil Edworthy <phil.edworthy@renesas.com>,
"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>
Subject: RE: [PATCH v3 2/2] watchdog: rzg2l_wdt: Add rzv2m support
Date: Mon, 22 Aug 2022 07:19:58 +0000 [thread overview]
Message-ID: <OS0PR01MB59223D1D19D25783050A875F86719@OS0PR01MB5922.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20220620102600.52349-3-phil.edworthy@renesas.com>
Hi Phil,
Thanks for the patch.
> Subject: [PATCH v3 2/2] watchdog: rzg2l_wdt: Add rzv2m support
>
> The WDT on RZ/V2M devices is basically the same as RZ/G2L, but without
> the parity error registers. This means the driver has to reset the
> hardware plus set the minimum timeout in order to do a restart and has a
> single interrupt.
>
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3:
> - Don't call pm_runtime_get_sync() in restart()
> - Use mdelay instead of udelay, avoids DIV64_U64_ROUND_UP
> v2:
> - Replace use of parity error registers in restart
> - Commit msg modified to reflect different contents
> ---
> drivers/watchdog/rzg2l_wdt.c | 39 ++++++++++++++++++++++++++++++------
> 1 file changed, 33 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c
> index 6eea0ee4af49..70cbd9ba01fe 100644
> --- a/drivers/watchdog/rzg2l_wdt.c
> +++ b/drivers/watchdog/rzg2l_wdt.c
> @@ -10,7 +10,7 @@
> #include <linux/io.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> -#include <linux/of.h>
> +#include <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> #include <linux/reset.h>
> @@ -40,6 +40,11 @@ module_param(nowayout, bool, 0);
> MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started
> (default="
> __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>
> +enum rz_wdt_type {
> + I2C_RZG2L,
> + I2C_RZV2M,
> +};
> +
May be I2C_* to WDT_* ??
> struct rzg2l_wdt_priv {
> void __iomem *base;
> struct watchdog_device wdev;
> @@ -48,6 +53,7 @@ struct rzg2l_wdt_priv {
> unsigned long delay;
> struct clk *pclk;
> struct clk *osc_clk;
> + enum rz_wdt_type devtype;
> };
>
> static void rzg2l_wdt_wait_delay(struct rzg2l_wdt_priv *priv) @@ -
> 142,11 +148,29 @@ static int rzg2l_wdt_restart(struct watchdog_device
> *wdev,
> clk_prepare_enable(priv->pclk);
> clk_prepare_enable(priv->osc_clk);
>
> - /* Generate Reset (WDTRSTB) Signal on parity error */
> - rzg2l_wdt_write(priv, 0, PECR);
> + if (priv->devtype == I2C_RZG2L) {
Same here.
> + /* Generate Reset (WDTRSTB) Signal on parity error */
> + rzg2l_wdt_write(priv, 0, PECR);
> +
> + /* Force parity error */
> + rzg2l_wdt_write(priv, PEEN_FORCE, PEEN);
> + } else {
> + /* RZ/V2M doesn't have parity error registers */
> +
> + wdev->timeout = 0;
> +
> + /* Initialize time out */
> + rzg2l_wdt_init_timeout(wdev);
>
> - /* Force parity error */
> - rzg2l_wdt_write(priv, PEEN_FORCE, PEEN);
> + /* Initialize watchdog counter register */
> + rzg2l_wdt_write(priv, 0, WDTTIM);
> +
> + /* Enable watchdog timer*/
> + rzg2l_wdt_write(priv, WDTCNT_WDTEN, WDTCNT);
> +
> + /* Wait 2 consecutive overflow cycles for reset */
> + mdelay(DIV_ROUND_UP(2 * 0xFFFFF * 1000, priv-
> >osc_clk_rate));
> + }
>
> return 0;
> }
> @@ -227,6 +251,8 @@ static int rzg2l_wdt_probe(struct platform_device
> *pdev)
> if (ret)
> return dev_err_probe(dev, ret, "failed to deassert");
>
> + priv->devtype = (enum rz_wdt_type)of_device_get_match_data(dev);
> +
> pm_runtime_enable(&pdev->dev);
>
> priv->wdev.info = &rzg2l_wdt_ident;
> @@ -255,7 +281,8 @@ static int rzg2l_wdt_probe(struct platform_device
> *pdev) }
>
> static const struct of_device_id rzg2l_wdt_ids[] = {
> - { .compatible = "renesas,rzg2l-wdt", },
> + { .compatible = "renesas,rzg2l-wdt", .data = (void *)I2C_RZG2L },
> + { .compatible = "renesas,rzv2m-wdt", .data = (void *)I2C_RZV2M },
Same here.
Cheers,
Biju
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, rzg2l_wdt_ids);
> --
> 2.34.1
next prev parent reply other threads:[~2022-08-22 7:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 10:25 [PATCH v3 0/2] arm64: renesas: Add RZ/V2M watchdog support Phil Edworthy
2022-06-20 10:25 ` [PATCH v3 1/2] dt-bindings: watchdog: renesas,wdt: Add r9a09g011 (RZ/V2M) support Phil Edworthy
2022-06-20 10:26 ` [PATCH v3 2/2] watchdog: rzg2l_wdt: Add rzv2m support Phil Edworthy
2022-06-20 12:24 ` Geert Uytterhoeven
2022-08-22 7:19 ` Biju Das [this message]
2022-08-23 7:31 ` Phil Edworthy
2022-08-09 10:08 ` [PATCH v3 0/2] arm64: renesas: Add RZ/V2M watchdog support Phil Edworthy
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=OS0PR01MB59223D1D19D25783050A875F86719@OS0PR01MB5922.jpnprd01.prod.outlook.com \
--to=biju.das.jz@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=phil.edworthy@renesas.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 NNTP newsgroup(s).