From: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
To: Ezequiel Garcia
<ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org,
Maen Suleiman <maen-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Sebastian Hesselbarth
<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 05/10] watchdog: orion: Add a memory resource for RSTOUT register
Date: Tue, 16 Jul 2013 16:04:15 +0200 [thread overview]
Message-ID: <20130716140415.GB19448@lunn.ch> (raw)
In-Reply-To: <1373931163-12670-6-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
On Mon, Jul 15, 2013 at 08:32:38PM -0300, Ezequiel Garcia wrote:
> Instead of accessing the RSTOUT register directly, this commit
> adds a platform memory resource to map this register into the driver.
Hi Ezequiel
Have you looked at:
arch/arm/mach-mvebu/system-controller.c
It is also using this register. Are we going to have a similar problem
as the TIMER_CTRL register, which you refactered in an earlier patch?
"marvell,orion-system-controller" is not actually used yet, but once
kirkwood moves into mach-mvebu, it will start using it.
Andrew
>
> Note that by adding a required 2nd-cell for the reg property,
> this change breaks the device-tree binding compatibility.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
> arch/arm/mach-kirkwood/include/mach/bridge-regs.h | 1 +
> arch/arm/mach-orion5x/include/mach/bridge-regs.h | 1 +
> arch/arm/plat-orion/common.c | 10 ++++++----
> drivers/watchdog/orion_wdt.c | 18 ++++++++++--------
> 4 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
> index c3f361d..dead75a 100644
> --- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
> +++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
> @@ -21,6 +21,7 @@
> #define CPU_RESET 0x00000002
>
> #define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108)
> +#define RSTOUT_PHYS_BASE (BRIDGE_PHYS_BASE + 0x0108)
> #define WDT_RESET_OUT_EN 0x00000002
> #define SOFT_RESET_OUT_EN 0x00000004
>
> diff --git a/arch/arm/mach-orion5x/include/mach/bridge-regs.h b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
> index aa35de3..ccd91c9 100644
> --- a/arch/arm/mach-orion5x/include/mach/bridge-regs.h
> +++ b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
> @@ -18,6 +18,7 @@
> #define CPU_CTRL (ORION5X_BRIDGE_VIRT_BASE + 0x104)
>
> #define RSTOUTn_MASK (ORION5X_BRIDGE_VIRT_BASE + 0x108)
> +#define RSTOUT_PHYS_BASE (ORION5X_BRIDGE_PHYS_BASE + 0x108)
> #define WDT_RESET_OUT_EN 0x0002
>
> #define CPU_SOFT_RESET (ORION5X_BRIDGE_VIRT_BASE + 0x10c)
> diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
> index 77fac6c..37924f8 100644
> --- a/arch/arm/plat-orion/common.c
> +++ b/arch/arm/plat-orion/common.c
> @@ -594,14 +594,16 @@ void __init orion_spi_1_init(unsigned long mapbase)
> /*****************************************************************************
> * Watchdog
> ****************************************************************************/
> -static struct resource orion_wdt_resource =
> - DEFINE_RES_MEM(WDT_PHYS_BASE, 0x04);
> +static struct resource orion_wdt_resource[] = {
> + DEFINE_RES_MEM(WDT_PHYS_BASE, 0x04),
> + DEFINE_RES_MEM(RSTOUT_PHYS_BASE, 0x04)
> +};
>
> static struct platform_device orion_wdt_device = {
> .name = "orion_wdt",
> .id = -1,
> - .num_resources = 1,
> - .resource = &orion_wdt_resource,
> + .num_resources = ARRAY_SIZE(orion_wdt_resource),
> + .resource = orion_wdt_resource,
> };
>
> void __init orion_wdt_init(void)
> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> index 01bcf53..3c9b3d2 100644
> --- a/drivers/watchdog/orion_wdt.c
> +++ b/drivers/watchdog/orion_wdt.c
> @@ -43,6 +43,7 @@ static unsigned int wdt_max_duration; /* (seconds) */
> static struct clk *clk;
> static unsigned int wdt_tclk;
> static void __iomem *wdt_reg;
> +static void __iomem *rstout_reg;
> static DEFINE_SPINLOCK(wdt_lock);
>
> static int orion_wdt_ping(struct watchdog_device *wdt_dev)
> @@ -74,9 +75,7 @@ static int orion_wdt_start(struct watchdog_device *wdt_dev)
> orion_timer_ctrl_clrset(0, WDT_EN);
>
> /* Enable reset on watchdog */
> - reg = readl(RSTOUTn_MASK);
> - reg |= WDT_RESET_OUT_EN;
> - writel(reg, RSTOUTn_MASK);
> + writel(readl(rstout_reg) | WDT_RESET_OUT_EN, rstout_reg);
>
> spin_unlock(&wdt_lock);
> return 0;
> @@ -84,14 +83,10 @@ static int orion_wdt_start(struct watchdog_device *wdt_dev)
>
> static int orion_wdt_stop(struct watchdog_device *wdt_dev)
> {
> - u32 reg;
> -
> spin_lock(&wdt_lock);
>
> /* Disable reset on watchdog */
> - reg = readl(RSTOUTn_MASK);
> - reg &= ~WDT_RESET_OUT_EN;
> - writel(reg, RSTOUTn_MASK);
> + writel(readl(rstout_reg) & ~WDT_RESET_OUT_EN, rstout_reg);
>
> /* Disable watchdog timer */
> orion_timer_ctrl_clrset(WDT_EN, 0);
> @@ -158,6 +153,13 @@ static int orion_wdt_probe(struct platform_device *pdev)
> if (!wdt_reg)
> return -ENOMEM;
>
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> + if (!res)
> + return -ENODEV;
> + rstout_reg = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> + if (!rstout_reg)
> + return -ENOMEM;
> +
> wdt_max_duration = WDT_MAX_CYCLE_COUNT / wdt_tclk;
>
> orion_wdt.timeout = wdt_max_duration;
> --
> 1.8.1.5
>
next prev parent reply other threads:[~2013-07-16 14:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-15 23:32 [PATCH 00/10] Orion Watchdog fixes Ezequiel Garcia
[not found] ` <1373931163-12670-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-07-15 23:32 ` [PATCH 01/10] clocksource: orion: Add thread-safe API header Ezequiel Garcia
2013-07-15 23:32 ` [PATCH 02/10] watchdog: orion: Use thread-safe clocksource API Ezequiel Garcia
2013-07-15 23:32 ` [PATCH 03/10] watchdog: orion: Rename device-tree binding documentation Ezequiel Garcia
2013-07-15 23:32 ` [PATCH 04/10] watchdog: orion: Use the proper watchdog register Ezequiel Garcia
2013-07-15 23:32 ` [PATCH 05/10] watchdog: orion: Add a memory resource for RSTOUT register Ezequiel Garcia
[not found] ` <1373931163-12670-6-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-07-16 14:04 ` Andrew Lunn [this message]
[not found] ` <20130716140415.GB19448-g2DYL2Zd6BY@public.gmane.org>
2013-07-16 14:18 ` Ezequiel Garcia
2013-07-15 23:32 ` [PATCH 06/10] watchdog: orion: Update device-tree binding documentation Ezequiel Garcia
[not found] ` <1373931163-12670-7-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2013-07-16 13:24 ` Jason Cooper
2013-07-15 23:32 ` [PATCH 07/10] watchdog: orion: Remove unneeded BRIDGE_CAUSE clear Ezequiel Garcia
2013-07-15 23:32 ` [PATCH 08/10] watchdog: orion: Remove mach-specific unneeded header Ezequiel Garcia
2013-07-15 23:32 ` [PATCH 09/10] watchdog: orion: Use BIT() Ezequiel Garcia
2013-07-15 23:32 ` [PATCH 10/10] ARM: kirkwood: Fix the device-tree watchdog's node reg property Ezequiel Garcia
2013-07-16 6:59 ` [PATCH 00/10] Orion Watchdog fixes Andrew Lunn
[not found] ` <20130716065952.GA25043-g2DYL2Zd6BY@public.gmane.org>
2013-07-16 7:20 ` Thomas Petazzoni
2013-07-16 7:31 ` Andrew Lunn
[not found] ` <20130716073101.GB25043-g2DYL2Zd6BY@public.gmane.org>
2013-07-16 7:48 ` Sebastian Hesselbarth
[not found] ` <13fe673f255.2784.107cef0f820c2f5d7b7f41463071c310-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-07-16 12:17 ` Ezequiel Garcia
2013-07-16 12:14 ` Ezequiel Garcia
2013-07-16 13:44 ` Jason Cooper
[not found] ` <20130716134422.GE12062-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2013-07-16 14:04 ` Ezequiel Garcia
2013-07-16 14:29 ` Jason Cooper
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=20130716140415.GB19448@lunn.ch \
--to=andrew-g2dyl2zd6by@public.gmane.org \
--cc=alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=maen-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.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).