From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964807AbbCLQT4 (ORCPT ); Thu, 12 Mar 2015 12:19:56 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:43074 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964775AbbCLQTx (ORCPT ); Thu, 12 Mar 2015 12:19:53 -0400 Date: Thu, 12 Mar 2015 09:19:39 -0700 From: Guenter Roeck To: Alexandre Belloni Cc: Nicolas Ferre , Daniel Lezcano , Boris Brezillon , Jean-Christophe Plagniol-Villard , Wim Van Sebroeck , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-watchdog@vger.kernel.org Subject: Re: [PATCH v5 03/10] watchdog: at91rm9200: use the system timer syscon Message-ID: <20150312161939.GA15121@roeck-us.net> References: <1426162054-9987-1-git-send-email-alexandre.belloni@free-electrons.com> <1426162054-9987-4-git-send-email-alexandre.belloni@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426162054-9987-4-git-send-email-alexandre.belloni@free-electrons.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score= X-CTCH-PVer: 0000001 X-CTCH-Spam: Unknown X-CTCH-VOD: Unknown X-CTCH-Flags: 0 X-CTCH-RefID: str=0001.0A020205.5501BCA8.0104,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-CTCH-Score: 0.001 X-CTCH-ScoreCust: 0.000 X-CTCH-Rules: C_4847, X-CTCH-SenderID: linux@roeck-us.net X-CTCH-SenderID-Flags: 0 X-CTCH-SenderID-TotalMessages: 7 X-CTCH-SenderID-TotalSpam: 0 X-CTCH-SenderID-TotalSuspected: 0 X-CTCH-SenderID-TotalConfirmed: 0 X-CTCH-SenderID-TotalBulk: 0 X-CTCH-SenderID-TotalVirus: 0 X-CTCH-SenderID-TotalRecipients: 0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: mailgid no entry from get_relayhosts_entry X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 12, 2015 at 01:07:27PM +0100, Alexandre Belloni wrote: > Use a syscon regmap to access the system timer registers. > > Also, rename the driver atmel_st_watchdog to stop conflicting with > at91sam9_wdt.c > > Signed-off-by: Alexandre Belloni Reviewed-by: Guenter Roeck > --- > drivers/watchdog/Kconfig | 2 +- > drivers/watchdog/at91rm9200_wdt.c | 29 ++++++++++++++++++++++------- > 2 files changed, 23 insertions(+), 8 deletions(-) > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > index 16f202350997..ce4f3a7f95fd 100644 > --- a/drivers/watchdog/Kconfig > +++ b/drivers/watchdog/Kconfig > @@ -154,7 +154,7 @@ config ARM_SP805_WATCHDOG > > config AT91RM9200_WATCHDOG > tristate "AT91RM9200 watchdog" > - depends on SOC_AT91RM9200 > + depends on SOC_AT91RM9200 && MFD_SYSCON > help > Watchdog timer embedded into AT91RM9200 chips. This will reboot your > system when the timeout is reached. > diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c > index d244112d5b6f..e6fa87d85de3 100644 > --- a/drivers/watchdog/at91rm9200_wdt.c > +++ b/drivers/watchdog/at91rm9200_wdt.c > @@ -17,22 +17,25 @@ > #include > #include > #include > +#include > +#include > #include > #include > #include > #include > +#include > #include > #include > #include > #include > #include > -#include > > #define WDT_DEFAULT_TIME 5 /* seconds */ > #define WDT_MAX_TIME 256 /* seconds */ > > static int wdt_time = WDT_DEFAULT_TIME; > static bool nowayout = WATCHDOG_NOWAYOUT; > +static struct regmap *regmap_st; > > module_param(wdt_time, int, 0); > MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default=" > @@ -55,7 +58,7 @@ static unsigned long at91wdt_busy; > */ > static inline void at91_wdt_stop(void) > { > - at91_st_write(AT91_ST_WDMR, AT91_ST_EXTEN); > + regmap_write(regmap_st, AT91_ST_WDMR, AT91_ST_EXTEN); > } > > /* > @@ -63,9 +66,9 @@ static inline void at91_wdt_stop(void) > */ > static inline void at91_wdt_start(void) > { > - at91_st_write(AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN | > + regmap_write(regmap_st, AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN | > (((65536 * wdt_time) >> 8) & AT91_ST_WDV)); > - at91_st_write(AT91_ST_CR, AT91_ST_WDRST); > + regmap_write(regmap_st, AT91_ST_CR, AT91_ST_WDRST); > } > > /* > @@ -73,7 +76,7 @@ static inline void at91_wdt_start(void) > */ > static inline void at91_wdt_reload(void) > { > - at91_st_write(AT91_ST_CR, AT91_ST_WDRST); > + regmap_write(regmap_st, AT91_ST_CR, AT91_ST_WDRST); > } > > /* ......................................................................... */ > @@ -203,12 +206,24 @@ static struct miscdevice at91wdt_miscdev = { > > static int at91wdt_probe(struct platform_device *pdev) > { > + struct device *dev = &pdev->dev; > + struct device *parent; > int res; > > if (at91wdt_miscdev.parent) > return -EBUSY; > at91wdt_miscdev.parent = &pdev->dev; > > + parent = dev->parent; > + if (!parent) { > + dev_err(dev, "no parent\n"); > + return -ENODEV; > + } > + > + regmap_st = syscon_node_to_regmap(parent->of_node); > + if (!regmap_st) > + return -ENODEV; > + > res = misc_register(&at91wdt_miscdev); > if (res) > return res; > @@ -267,7 +282,7 @@ static struct platform_driver at91wdt_driver = { > .suspend = at91wdt_suspend, > .resume = at91wdt_resume, > .driver = { > - .name = "at91_wdt", > + .name = "atmel_st_watchdog", > .of_match_table = at91_wdt_dt_ids, > }, > }; > @@ -296,4 +311,4 @@ module_exit(at91_wdt_exit); > MODULE_AUTHOR("Andrew Victor"); > MODULE_DESCRIPTION("Watchdog driver for Atmel AT91RM9200"); > MODULE_LICENSE("GPL"); > -MODULE_ALIAS("platform:at91_wdt"); > +MODULE_ALIAS("platform:atmel_st_watchdog"); > -- > 2.1.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html