LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Thomas Gleixner <tglx@linutronix.de>,
Samuel Ortiz <sameo@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>,
Wim Van Sebroeck <wim@iguana.be>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v3 3/8] watchdog: at91rm9200: use the regmap from mfd
Date: Mon, 12 Jan 2015 09:28:49 -0800 [thread overview]
Message-ID: <20150112172849.GB19868@roeck-us.net> (raw)
In-Reply-To: <1421077023-30954-4-git-send-email-alexandre.belloni@free-electrons.com>
On Mon, Jan 12, 2015 at 04:36:58PM +0100, Alexandre Belloni wrote:
> The system timer MFD driver is providing a regmap. Use it to access the
> registers.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/Kconfig | 2 +-
> drivers/watchdog/at91rm9200_wdt.c | 25 ++++++++++++-------------
> 2 files changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 08f41add1461..18c73bc159fc 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_ATMEL_ST
> 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..a4ac88e450a2 100644
> --- a/drivers/watchdog/at91rm9200_wdt.c
> +++ b/drivers/watchdog/at91rm9200_wdt.c
> @@ -17,22 +17,24 @@
> #include <linux/init.h>
> #include <linux/io.h>
> #include <linux/kernel.h>
> +#include <linux/mfd/atmel-st.h>
> #include <linux/miscdevice.h>
> #include <linux/module.h>
> #include <linux/moduleparam.h>
> #include <linux/platform_device.h>
> +#include <linux/regmap.h>
> #include <linux/types.h>
> #include <linux/watchdog.h>
> #include <linux/uaccess.h>
> #include <linux/of.h>
> #include <linux/of_device.h>
> -#include <mach/at91_st.h>
>
> #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 +57,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 +65,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 +75,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);
> }
>
> /* ......................................................................... */
> @@ -209,6 +211,10 @@ static int at91wdt_probe(struct platform_device *pdev)
> return -EBUSY;
> at91wdt_miscdev.parent = &pdev->dev;
>
> + regmap_st = dev_get_drvdata(pdev->dev.parent);
> + if (!regmap_st)
> + return -ENODEV;
> +
> res = misc_register(&at91wdt_miscdev);
> if (res)
> return res;
> @@ -254,12 +260,6 @@ static int at91wdt_resume(struct platform_device *pdev)
> #define at91wdt_resume NULL
> #endif
>
> -static const struct of_device_id at91_wdt_dt_ids[] = {
> - { .compatible = "atmel,at91rm9200-wdt" },
> - { /* sentinel */ }
> -};
> -MODULE_DEVICE_TABLE(of, at91_wdt_dt_ids);
> -
> static struct platform_driver at91wdt_driver = {
> .probe = at91wdt_probe,
> .remove = at91wdt_remove,
> @@ -267,8 +267,7 @@ static struct platform_driver at91wdt_driver = {
> .suspend = at91wdt_suspend,
> .resume = at91wdt_resume,
> .driver = {
> - .name = "at91_wdt",
> - .of_match_table = at91_wdt_dt_ids,
> + .name = "atmel_st_watchdog",
> },
> };
>
> --
> 2.1.0
>
next prev parent reply other threads:[~2015-01-12 17:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 15:36 [PATCH v3 0/8] Atmel System Timer cleanups Alexandre Belloni
2015-01-12 15:36 ` [PATCH v3 1/8] ARM: at91/dt: declare atmel,at91rm9200-st as a syscon Alexandre Belloni
2015-01-12 15:36 ` [PATCH v3 2/8] mfd: Add atmel-st driver Alexandre Belloni
2015-01-19 9:42 ` Lee Jones
2015-01-19 22:59 ` Alexandre Belloni
2015-01-20 9:47 ` Lee Jones
2015-01-20 15:05 ` Alexandre Belloni
2015-01-20 15:36 ` Lee Jones
2015-01-20 15:49 ` Nicolas Ferre
2015-01-20 16:45 ` Lee Jones
2015-01-12 15:36 ` [PATCH v3 3/8] watchdog: at91rm9200: use the regmap from mfd Alexandre Belloni
2015-01-12 17:28 ` Guenter Roeck [this message]
2015-01-12 15:36 ` [PATCH v3 4/8] ARM: at91: time: move the system timer driver to drivers/clocksource Alexandre Belloni
2015-01-15 16:17 ` Daniel Lezcano
2015-01-12 15:37 ` [PATCH v3 5/8] ARM: at91: move the restart function to the system timer driver Alexandre Belloni
2015-01-15 16:39 ` Daniel Lezcano
2015-01-15 17:01 ` Alexandre Belloni
2015-01-15 17:13 ` Alexandre Belloni
2015-01-12 15:37 ` [PATCH v3 6/8] clocksource: atmel-st: properly initialize driver Alexandre Belloni
2015-01-15 16:05 ` Daniel Lezcano
2015-01-12 15:37 ` [PATCH v3 7/8] clocksource: atmel-st: use syscon/regmap Alexandre Belloni
2015-01-15 16:40 ` Daniel Lezcano
2015-01-15 17:02 ` Alexandre Belloni
2015-01-12 15:37 ` [PATCH v3 8/8] ARM: at91: remove useless include Alexandre Belloni
2015-01-15 16:29 ` Daniel Lezcano
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=20150112172849.GB19868@roeck-us.net \
--to=linux@roeck-us.net \
--cc=alexandre.belloni@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=daniel.lezcano@linaro.org \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=sameo@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=wim@iguana.be \
--subject='Re: [PATCH v3 3/8] watchdog: at91rm9200: use the regmap from mfd' \
/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
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).