From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabrizio Castro Subject: [RFC v4 12/26] watchdog: renesas_wdt: Add R-Car Gen2 support Date: Wed, 31 Jan 2018 18:24:16 +0000 Message-ID: <1517423070-24236-13-git-send-email-fabrizio.castro@bp.renesas.com> References: <1517423070-24236-1-git-send-email-fabrizio.castro@bp.renesas.com> Return-path: In-Reply-To: <1517423070-24236-1-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org> Sender: linux-watchdog-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Philipp Zabel , Rob Herring , Mark Rutland , Wim Van Sebroeck , Russell King , Catalin Marinas , Will Deacon , Michael Turquette , Stephen Boyd , Simon Horman , Magnus Damm , Geert Uytterhoeven , Wolfram Sang Cc: Guenter Roeck , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Chris Paterson , Biju Das , Fabrizio Castro , Ramesh Shanmugasundaram List-Id: devicetree@vger.kernel.org Due to commits: * "ARM: shmobile: Add watchdog support", * "ARM: shmobile: rcar-gen2: Add watchdog support", and * "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1. This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA. Signed-off-by: Fabrizio Castro Signed-off-by: Ramesh Shanmugasundaram --- v3->4: * in this new version the changes to the driver have been splitted into two commits, this patch takes care of the basic Gen2 support, patch 13/26 takes care of the restart handler. drivers/watchdog/renesas_wdt.c | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index 831ef83..0a1a402 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -203,13 +203,42 @@ static int rwdt_remove(struct platform_device *pdev) return 0; } -/* - * This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP - * to work there, one also needs a RESET (RST) driver which does not exist yet - * due to HW issues. This needs to be solved before adding compatibles here. - */ +#ifdef CONFIG_PM +static int rwdt_suspend(struct device *dev) +{ + struct platform_device *pdev; + struct rwdt_priv *priv; + + pdev = to_platform_device(dev); + priv = platform_get_drvdata(pdev); + if (watchdog_active(&priv->wdev)) { + rwdt_write(priv, priv->cks, RWTCSRA); + } + return 0; +} + +static int rwdt_resume(struct device *dev) +{ + struct platform_device *pdev; + struct rwdt_priv *priv; + + pdev = to_platform_device(dev); + priv = platform_get_drvdata(pdev); + if (watchdog_active(&priv->wdev)) { + rwdt_write(priv, priv->cks | RWTCSRA_TME, RWTCSRA); + } + return 0; +} + +static const struct dev_pm_ops rwdt_pm = { + .suspend = rwdt_suspend, + .resume = rwdt_resume, +}; +#endif + static const struct of_device_id rwdt_ids[] = { { .compatible = "renesas,rcar-gen3-wdt", }, + { .compatible = "renesas,rcar-gen2-wdt", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, rwdt_ids); @@ -218,6 +247,9 @@ static struct platform_driver rwdt_driver = { .driver = { .name = "renesas_wdt", .of_match_table = rwdt_ids, +#ifdef CONFIG_PM + .pm = &rwdt_pm, +#endif }, .probe = rwdt_probe, .remove = rwdt_remove, -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relmlor3.renesas.com ([210.160.252.173]:46522 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751735AbeAaSZ5 (ORCPT ); Wed, 31 Jan 2018 13:25:57 -0500 From: Fabrizio Castro To: Philipp Zabel , Rob Herring , Mark Rutland , Wim Van Sebroeck , Russell King , Catalin Marinas , Will Deacon , Michael Turquette , Stephen Boyd , Simon Horman , Magnus Damm , Geert Uytterhoeven , Wolfram Sang Cc: Guenter Roeck , devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Chris Paterson , Biju Das , Fabrizio Castro , Ramesh Shanmugasundaram Subject: [RFC v4 12/26] watchdog: renesas_wdt: Add R-Car Gen2 support Date: Wed, 31 Jan 2018 18:24:16 +0000 Message-Id: <1517423070-24236-13-git-send-email-fabrizio.castro@bp.renesas.com> In-Reply-To: <1517423070-24236-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1517423070-24236-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-watchdog-owner@vger.kernel.org List-Id: linux-watchdog@vger.kernel.org Due to commits: * "ARM: shmobile: Add watchdog support", * "ARM: shmobile: rcar-gen2: Add watchdog support", and * "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1. This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA. Signed-off-by: Fabrizio Castro Signed-off-by: Ramesh Shanmugasundaram --- v3->4: * in this new version the changes to the driver have been splitted into two commits, this patch takes care of the basic Gen2 support, patch 13/26 takes care of the restart handler. drivers/watchdog/renesas_wdt.c | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index 831ef83..0a1a402 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -203,13 +203,42 @@ static int rwdt_remove(struct platform_device *pdev) return 0; } -/* - * This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP - * to work there, one also needs a RESET (RST) driver which does not exist yet - * due to HW issues. This needs to be solved before adding compatibles here. - */ +#ifdef CONFIG_PM +static int rwdt_suspend(struct device *dev) +{ + struct platform_device *pdev; + struct rwdt_priv *priv; + + pdev = to_platform_device(dev); + priv = platform_get_drvdata(pdev); + if (watchdog_active(&priv->wdev)) { + rwdt_write(priv, priv->cks, RWTCSRA); + } + return 0; +} + +static int rwdt_resume(struct device *dev) +{ + struct platform_device *pdev; + struct rwdt_priv *priv; + + pdev = to_platform_device(dev); + priv = platform_get_drvdata(pdev); + if (watchdog_active(&priv->wdev)) { + rwdt_write(priv, priv->cks | RWTCSRA_TME, RWTCSRA); + } + return 0; +} + +static const struct dev_pm_ops rwdt_pm = { + .suspend = rwdt_suspend, + .resume = rwdt_resume, +}; +#endif + static const struct of_device_id rwdt_ids[] = { { .compatible = "renesas,rcar-gen3-wdt", }, + { .compatible = "renesas,rcar-gen2-wdt", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, rwdt_ids); @@ -218,6 +247,9 @@ static struct platform_driver rwdt_driver = { .driver = { .name = "renesas_wdt", .of_match_table = rwdt_ids, +#ifdef CONFIG_PM + .pm = &rwdt_pm, +#endif }, .probe = rwdt_probe, .remove = rwdt_remove, -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: fabrizio.castro@bp.renesas.com (Fabrizio Castro) Date: Wed, 31 Jan 2018 18:24:16 +0000 Subject: [RFC v4 12/26] watchdog: renesas_wdt: Add R-Car Gen2 support In-Reply-To: <1517423070-24236-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1517423070-24236-1-git-send-email-fabrizio.castro@bp.renesas.com> Message-ID: <1517423070-24236-13-git-send-email-fabrizio.castro@bp.renesas.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Due to commits: * "ARM: shmobile: Add watchdog support", * "ARM: shmobile: rcar-gen2: Add watchdog support", and * "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1. This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA. Signed-off-by: Fabrizio Castro Signed-off-by: Ramesh Shanmugasundaram --- v3->4: * in this new version the changes to the driver have been splitted into two commits, this patch takes care of the basic Gen2 support, patch 13/26 takes care of the restart handler. drivers/watchdog/renesas_wdt.c | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index 831ef83..0a1a402 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -203,13 +203,42 @@ static int rwdt_remove(struct platform_device *pdev) return 0; } -/* - * This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP - * to work there, one also needs a RESET (RST) driver which does not exist yet - * due to HW issues. This needs to be solved before adding compatibles here. - */ +#ifdef CONFIG_PM +static int rwdt_suspend(struct device *dev) +{ + struct platform_device *pdev; + struct rwdt_priv *priv; + + pdev = to_platform_device(dev); + priv = platform_get_drvdata(pdev); + if (watchdog_active(&priv->wdev)) { + rwdt_write(priv, priv->cks, RWTCSRA); + } + return 0; +} + +static int rwdt_resume(struct device *dev) +{ + struct platform_device *pdev; + struct rwdt_priv *priv; + + pdev = to_platform_device(dev); + priv = platform_get_drvdata(pdev); + if (watchdog_active(&priv->wdev)) { + rwdt_write(priv, priv->cks | RWTCSRA_TME, RWTCSRA); + } + return 0; +} + +static const struct dev_pm_ops rwdt_pm = { + .suspend = rwdt_suspend, + .resume = rwdt_resume, +}; +#endif + static const struct of_device_id rwdt_ids[] = { { .compatible = "renesas,rcar-gen3-wdt", }, + { .compatible = "renesas,rcar-gen2-wdt", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, rwdt_ids); @@ -218,6 +247,9 @@ static struct platform_driver rwdt_driver = { .driver = { .name = "renesas_wdt", .of_match_table = rwdt_ids, +#ifdef CONFIG_PM + .pm = &rwdt_pm, +#endif }, .probe = rwdt_probe, .remove = rwdt_remove, -- 2.7.4