Message ID | 1517423070-24236-13-git-send-email-fabrizio.castro@bp.renesas.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On 01/31/2018 10:24 AM, Fabrizio Castro wrote: > 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 <fabrizio.castro@bp.renesas.com> > Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com> > --- > 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); > + } Unnecessary { } > + 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); > + } Same here. FWIW, checkpatch does complain about that. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
SGVsbG8gR3VlbnRlciwNCg0KdGhhbmsgeW91IGZvciB5b3VyIGZlZWRiYWNrLg0KDQo+IC0tLS0t T3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IGRldmljZXRyZWUtb3duZXJAdmdlci5rZXJu ZWwub3JnIFttYWlsdG86ZGV2aWNldHJlZS1vd25lckB2Z2VyLmtlcm5lbC5vcmddIE9uIEJlaGFs ZiBPZiBHdWVudGVyIFJvZWNrDQo+IFNlbnQ6IDAyIEZlYnJ1YXJ5IDIwMTggMDI6NTYNCj4gVG86 IEZhYnJpemlvIENhc3RybyA8ZmFicml6aW8uY2FzdHJvQGJwLnJlbmVzYXMuY29tPjsgUGhpbGlw cCBaYWJlbCA8cC56YWJlbEBwZW5ndXRyb25peC5kZT47IFJvYiBIZXJyaW5nIDxyb2JoK2R0QGtl cm5lbC5vcmc+Ow0KPiBNYXJrIFJ1dGxhbmQgPG1hcmsucnV0bGFuZEBhcm0uY29tPjsgV2ltIFZh biBTZWJyb2VjayA8d2ltQGlndWFuYS5iZT47IFJ1c3NlbGwgS2luZyA8bGludXhAYXJtbGludXgu b3JnLnVrPjsgQ2F0YWxpbg0KPiBNYXJpbmFzIDxjYXRhbGluLm1hcmluYXNAYXJtLmNvbT47IFdp bGwgRGVhY29uIDx3aWxsLmRlYWNvbkBhcm0uY29tPjsgTWljaGFlbCBUdXJxdWV0dGUgPG10dXJx dWV0dGVAYmF5bGlicmUuY29tPjsNCj4gU3RlcGhlbiBCb3lkIDxzYm95ZEBjb2RlYXVyb3JhLm9y Zz47IFNpb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4gR3VlbnRlcg0KPiAtLQ0KPiBUbyB1bnN1 YnNjcmliZSBmcm9tIHRoaXMgbGlzdDogc2VuZCB0aGUgbGluZSAidW5zdWJzY3JpYmUgZGV2aWNl dHJlZSIgaW4NCj4gdGhlIGJvZHkgb2YgYSBtZXNzYWdlIHRvIG1ham9yZG9tb0B2Z2VyLmtlcm5l bC5vcmcNCj4gTW9yZSBtYWpvcmRvbW8gaW5mbyBhdCAgaHR0cDovL3ZnZXIua2VybmVsLm9yZy9t YWpvcmRvbW8taW5mby5odG1sDQoNCg0KDQpSZW5lc2FzIEVsZWN0cm9uaWNzIEV1cm9wZSBMdGQs IER1a2VzIE1lYWRvdywgTWlsbGJvYXJkIFJvYWQsIEJvdXJuZSBFbmQsIEJ1Y2tpbmdoYW1zaGly ZSwgU0w4IDVGSCwgVUsuIFJlZ2lzdGVyZWQgaW4gRW5nbGFuZCAmIFdhbGVzIHVuZGVyIFJlZ2lz dGVyZWQgTm8uIDA0NTg2NzA5Lg0K -- To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> +#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); struct rwdt_priv *priv = dev_get_drvdata(dev); ? > + 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); ditto > + 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, > +}; Use SIMPLE_DEV_PM_OPS macro (see stmp3xxx_rtc_wdt.c for an example) for more compact code and... > +#ifdef CONFIG_PM > + .pm = &rwdt_pm, > +#endif ... removing this ifdeffery?
Hello Wolfram, thank you for your feedback! > Subject: Re: [RFC v4 12/26] watchdog: renesas_wdt: Add R-Car Gen2 support > > > > +#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); > > struct rwdt_priv *priv = dev_get_drvdata(dev); > > ? will change > > > > +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); > > ditto will change > > > +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, > > +}; > > Use SIMPLE_DEV_PM_OPS macro (see stmp3xxx_rtc_wdt.c for an example) for > more compact code and... > > > +#ifdef CONFIG_PM > > +.pm = &rwdt_pm, > > +#endif > > ... removing this ifdeffery? will take out the ifdeffery Thanks, Fabrizio Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709. -- To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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,