All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: linux@roeck-us.net
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-watchdog@vger.kernel.org, Wim Van Sebroeck <wim@iguana.be>,
	Jason Cooper <jason@lakedaemon.net>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Lior Amsalem <alior@marvell.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH v6 05/19] watchdog: orion: Make sure the watchdog is initially stopped
Date: Mon, 10 Feb 2014 13:54:06 -0300	[thread overview]
Message-ID: <20140210165405.GF15607@localhost> (raw)
In-Reply-To: <20140210104850.48324szjwjihb7cw@67.228.131.205>

On Mon, Feb 10, 2014 at 10:48:50AM -0600, linux@roeck-us.net wrote:
> Quoting Ezequiel Garcia <ezequiel.garcia@free-electrons.com>:
> 
> > On Fri, Feb 07, 2014 at 10:43:14AM -0700, Jason Gunthorpe wrote:
> >> On Fri, Feb 07, 2014 at 07:40:45AM -0300, Ezequiel Garcia wrote:
> >>
> >> > Well, this is related to the discussion about the bootloader not
> >> > reseting the watchdog properly, provoking spurious watchdog triggering.
> >> >
> >> > Jason Gunthorpe explained [1] that we needed a particular sequence:
> >> >
> >> >  1. Disable WDT
> >> >  2. Clear bridge
> >> >  3. Enable WDT
> >> >
> >> > We added the irq handling to satisfy (2), and the watchdog stop for (1).
> >>
> >> The issue here is the driver configures two 'machine kill' elements:
> >> the PANIC IRQ and the RstOut setup.
> >>
> >> Before configuring either of those the driver needs to ensure that any
> >> old watchdog events are cleared out of the HW. We must not get a
> >> spurious event.
> >>
> >> I agree not disabling an already functional and properly configured
> >> counter from the bootloader is desirable.
> >>
> >> So lets break it down a bit..
> >>
> >> 1) The IRQ:
> >>   It looks like the cause bit latches high on watchdog timer
> >>   expiration but has no side effect unless it is unmasked.
> >>
> >>   The new IRQ flow code ensures the bit is cleared during request_irq
> >>   so no old events can trigger the IRQ. Thus it is solved now.
> >>
> >
> > Agreed.
> >
> >> 3) The timer itself:
> >>   The WDT is just a general timer with an optional hookup to the
> >>   rst control. If it is harmlessly counting but not resetting we need
> >>   to stop that before enabling rst out.
> >>
> >
> > Actually, the current flow is to:
> >
> > 1. Disable rst out and then disable the counter, in probe().
> >
> > 2. Enable the counter, and then enable rst out, in start().
> >
> >> So, how about this for psuedo-code in probe:
> >>
> >> if (readl(RSTOUTn) & WDRstOutEn)
> >> {
> >>     /* Watchdog is configured and may be down counting,
> >>        don't touch it */
> >>     request_irq(..);
> >> }
> >> else
> >> {
> >>     /* Watchdog is not configured, fully disable the timer
> >>        and configure for watchdog operation. */
> >>     disable_watchdog();
> >>     request_irq();
> >>     writel(RSTOUTn), .. WDRstOutEn);
> >> }
> >>
> >
> > Sounds good, although it seems to me it's actually simpler:
> >
> >   /* Let's make sure the watchdog is fully stopped, unless
> >    * it's explicitly enabled and running
> >    */
> >   if ( !(wdt_rst_out_en && wdt_timer_enabled) ) {
> >     watchdog_stop();
> >   }
> >
> 
>      if (!wdt_rst_out_en || !wdt_timer_enabled)
>          watchdog_stop();
> 
> seems to be a bit easier to understand.
> 

Yeah, I was actually planning to have a orion_wdt_enabled() function
to get the running and enabled status. Looks cleaner I think.

	if (!orion_wdt_enabled())
		watchdog_stop();

So the idea is OK?

I'll push the new series in a short while. Unfortunately, this change
means I have to rebase almost all the series, because I introduce the
orion watchdog struct :-(
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
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

WARNING: multiple messages have this Message-ID (diff)
From: ezequiel.garcia@free-electrons.com (Ezequiel Garcia)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 05/19] watchdog: orion: Make sure the watchdog is initially stopped
Date: Mon, 10 Feb 2014 13:54:06 -0300	[thread overview]
Message-ID: <20140210165405.GF15607@localhost> (raw)
In-Reply-To: <20140210104850.48324szjwjihb7cw@67.228.131.205>

On Mon, Feb 10, 2014 at 10:48:50AM -0600, linux at roeck-us.net wrote:
> Quoting Ezequiel Garcia <ezequiel.garcia@free-electrons.com>:
> 
> > On Fri, Feb 07, 2014 at 10:43:14AM -0700, Jason Gunthorpe wrote:
> >> On Fri, Feb 07, 2014 at 07:40:45AM -0300, Ezequiel Garcia wrote:
> >>
> >> > Well, this is related to the discussion about the bootloader not
> >> > reseting the watchdog properly, provoking spurious watchdog triggering.
> >> >
> >> > Jason Gunthorpe explained [1] that we needed a particular sequence:
> >> >
> >> >  1. Disable WDT
> >> >  2. Clear bridge
> >> >  3. Enable WDT
> >> >
> >> > We added the irq handling to satisfy (2), and the watchdog stop for (1).
> >>
> >> The issue here is the driver configures two 'machine kill' elements:
> >> the PANIC IRQ and the RstOut setup.
> >>
> >> Before configuring either of those the driver needs to ensure that any
> >> old watchdog events are cleared out of the HW. We must not get a
> >> spurious event.
> >>
> >> I agree not disabling an already functional and properly configured
> >> counter from the bootloader is desirable.
> >>
> >> So lets break it down a bit..
> >>
> >> 1) The IRQ:
> >>   It looks like the cause bit latches high on watchdog timer
> >>   expiration but has no side effect unless it is unmasked.
> >>
> >>   The new IRQ flow code ensures the bit is cleared during request_irq
> >>   so no old events can trigger the IRQ. Thus it is solved now.
> >>
> >
> > Agreed.
> >
> >> 3) The timer itself:
> >>   The WDT is just a general timer with an optional hookup to the
> >>   rst control. If it is harmlessly counting but not resetting we need
> >>   to stop that before enabling rst out.
> >>
> >
> > Actually, the current flow is to:
> >
> > 1. Disable rst out and then disable the counter, in probe().
> >
> > 2. Enable the counter, and then enable rst out, in start().
> >
> >> So, how about this for psuedo-code in probe:
> >>
> >> if (readl(RSTOUTn) & WDRstOutEn)
> >> {
> >>     /* Watchdog is configured and may be down counting,
> >>        don't touch it */
> >>     request_irq(..);
> >> }
> >> else
> >> {
> >>     /* Watchdog is not configured, fully disable the timer
> >>        and configure for watchdog operation. */
> >>     disable_watchdog();
> >>     request_irq();
> >>     writel(RSTOUTn), .. WDRstOutEn);
> >> }
> >>
> >
> > Sounds good, although it seems to me it's actually simpler:
> >
> >   /* Let's make sure the watchdog is fully stopped, unless
> >    * it's explicitly enabled and running
> >    */
> >   if ( !(wdt_rst_out_en && wdt_timer_enabled) ) {
> >     watchdog_stop();
> >   }
> >
> 
>      if (!wdt_rst_out_en || !wdt_timer_enabled)
>          watchdog_stop();
> 
> seems to be a bit easier to understand.
> 

Yeah, I was actually planning to have a orion_wdt_enabled() function
to get the running and enabled status. Looks cleaner I think.

	if (!orion_wdt_enabled())
		watchdog_stop();

So the idea is OK?

I'll push the new series in a short while. Unfortunately, this change
means I have to rebase almost all the series, because I introduce the
orion watchdog struct :-(
-- 
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org
Cc: Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Gregory Clement
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
Subject: Re: [PATCH v6 05/19] watchdog: orion: Make sure the watchdog is initially stopped
Date: Mon, 10 Feb 2014 13:54:06 -0300	[thread overview]
Message-ID: <20140210165405.GF15607@localhost> (raw)
In-Reply-To: <20140210104850.48324szjwjihb7cw-S15kz1ZIOvSoVoj5zvVkGw@public.gmane.org>

On Mon, Feb 10, 2014 at 10:48:50AM -0600, linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org wrote:
> Quoting Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>:
> 
> > On Fri, Feb 07, 2014 at 10:43:14AM -0700, Jason Gunthorpe wrote:
> >> On Fri, Feb 07, 2014 at 07:40:45AM -0300, Ezequiel Garcia wrote:
> >>
> >> > Well, this is related to the discussion about the bootloader not
> >> > reseting the watchdog properly, provoking spurious watchdog triggering.
> >> >
> >> > Jason Gunthorpe explained [1] that we needed a particular sequence:
> >> >
> >> >  1. Disable WDT
> >> >  2. Clear bridge
> >> >  3. Enable WDT
> >> >
> >> > We added the irq handling to satisfy (2), and the watchdog stop for (1).
> >>
> >> The issue here is the driver configures two 'machine kill' elements:
> >> the PANIC IRQ and the RstOut setup.
> >>
> >> Before configuring either of those the driver needs to ensure that any
> >> old watchdog events are cleared out of the HW. We must not get a
> >> spurious event.
> >>
> >> I agree not disabling an already functional and properly configured
> >> counter from the bootloader is desirable.
> >>
> >> So lets break it down a bit..
> >>
> >> 1) The IRQ:
> >>   It looks like the cause bit latches high on watchdog timer
> >>   expiration but has no side effect unless it is unmasked.
> >>
> >>   The new IRQ flow code ensures the bit is cleared during request_irq
> >>   so no old events can trigger the IRQ. Thus it is solved now.
> >>
> >
> > Agreed.
> >
> >> 3) The timer itself:
> >>   The WDT is just a general timer with an optional hookup to the
> >>   rst control. If it is harmlessly counting but not resetting we need
> >>   to stop that before enabling rst out.
> >>
> >
> > Actually, the current flow is to:
> >
> > 1. Disable rst out and then disable the counter, in probe().
> >
> > 2. Enable the counter, and then enable rst out, in start().
> >
> >> So, how about this for psuedo-code in probe:
> >>
> >> if (readl(RSTOUTn) & WDRstOutEn)
> >> {
> >>     /* Watchdog is configured and may be down counting,
> >>        don't touch it */
> >>     request_irq(..);
> >> }
> >> else
> >> {
> >>     /* Watchdog is not configured, fully disable the timer
> >>        and configure for watchdog operation. */
> >>     disable_watchdog();
> >>     request_irq();
> >>     writel(RSTOUTn), .. WDRstOutEn);
> >> }
> >>
> >
> > Sounds good, although it seems to me it's actually simpler:
> >
> >   /* Let's make sure the watchdog is fully stopped, unless
> >    * it's explicitly enabled and running
> >    */
> >   if ( !(wdt_rst_out_en && wdt_timer_enabled) ) {
> >     watchdog_stop();
> >   }
> >
> 
>      if (!wdt_rst_out_en || !wdt_timer_enabled)
>          watchdog_stop();
> 
> seems to be a bit easier to understand.
> 

Yeah, I was actually planning to have a orion_wdt_enabled() function
to get the running and enabled status. Looks cleaner I think.

	if (!orion_wdt_enabled())
		watchdog_stop();

So the idea is OK?

I'll push the new series in a short while. Unfortunately, this change
means I have to rebase almost all the series, because I introduce the
orion watchdog struct :-(
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-02-10 16:54 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 17:20 [PATCH v6 00/19] Armada 370/XP watchdog Ezequiel Garcia
2014-02-06 17:20 ` Ezequiel Garcia
2014-02-06 17:20 ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 01/19] clocksource: orion: Use atomic access for shared registers Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-11  0:06   ` Daniel Lezcano
2014-02-11  0:06     ` Daniel Lezcano
2014-02-11  0:06     ` Daniel Lezcano
2014-02-11  8:30     ` Ezequiel Garcia
2014-02-11  8:30       ` Ezequiel Garcia
2014-02-11  8:30       ` Ezequiel Garcia
2014-02-11  9:11       ` Daniel Lezcano
2014-02-11  9:11         ` Daniel Lezcano
2014-02-11  9:11         ` Daniel Lezcano
2014-02-11  9:47         ` Ezequiel Garcia
2014-02-11  9:47           ` Ezequiel Garcia
2014-02-11  9:47           ` Ezequiel Garcia
2014-02-19 15:01           ` Ezequiel Garcia
2014-02-19 15:01             ` Ezequiel Garcia
2014-02-19 15:01             ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 02/19] watchdog: orion: Add clock error handling Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 03/19] watchdog: orion: Use atomic access for shared registers Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 04/19] watchdog: orion: Remove unused macros Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 05/19] watchdog: orion: Make sure the watchdog is initially stopped Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-07  2:02   ` Guenter Roeck
2014-02-07  2:02     ` Guenter Roeck
2014-02-07  2:02     ` Guenter Roeck
2014-02-07 10:40     ` Ezequiel Garcia
2014-02-07 10:40       ` Ezequiel Garcia
2014-02-07 10:40       ` Ezequiel Garcia
2014-02-07 13:38       ` Guenter Roeck
2014-02-07 13:38         ` Guenter Roeck
2014-02-07 13:38         ` Guenter Roeck
2014-02-07 15:17         ` Ezequiel Garcia
2014-02-07 15:17           ` Ezequiel Garcia
2014-02-07 15:17           ` Ezequiel Garcia
2014-02-07 15:44           ` Jason Cooper
2014-02-07 15:44             ` Jason Cooper
2014-02-07 15:44             ` Jason Cooper
2014-02-07 16:55             ` Guenter Roeck
2014-02-07 16:55               ` Guenter Roeck
2014-02-07 16:55               ` Guenter Roeck
2014-02-07 17:43       ` Jason Gunthorpe
2014-02-07 17:43         ` Jason Gunthorpe
2014-02-07 17:43         ` Jason Gunthorpe
2014-02-10 12:22         ` Ezequiel Garcia
2014-02-10 12:22           ` Ezequiel Garcia
2014-02-10 12:22           ` Ezequiel Garcia
2014-02-10 16:48           ` linux
2014-02-10 16:48             ` linux-0h96xk9xTtrk1uMJSBkQmQ
2014-02-10 16:48             ` linux at roeck-us.net
2014-02-10 16:54             ` Ezequiel Garcia [this message]
2014-02-10 16:54               ` Ezequiel Garcia
2014-02-10 16:54               ` Ezequiel Garcia
2014-02-10 16:57               ` linux
2014-02-10 16:57                 ` linux-0h96xk9xTtrk1uMJSBkQmQ
2014-02-10 16:57                 ` linux at roeck-us.net
2014-02-06 17:20 ` [PATCH v6 06/19] watchdog: orion: Handle the interrupt so it's properly acked Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 07/19] watchdog: orion: Make RSTOUT register a separate resource Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 08/19] watchdog: orion: Remove unneeded BRIDGE_CAUSE clear Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 09/19] watchdog: orion: Introduce an orion_watchdog device structure Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 10/19] watchdog: orion: Introduce per-compatible of_device_id data Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 11/19] watchdog: orion: Add per-compatible clock initialization Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 12/19] watchdog: orion: Add per-compatible watchdog start implementation Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 13/19] watchdog: orion: Add support for Armada 370 and Armada XP SoC Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 14/19] ARM: mvebu: Enable Armada 370/XP watchdog in the devicetree Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 15/19] ARM: kirkwood: Add RSTOUT 'reg' entry to devicetree Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 16/19] ARM: dove: Enable Dove watchdog in the devicetree Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20 ` [PATCH v6 17/19] watchdog: orion: Enable the build on ARCH_MVEBU Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-07  2:07   ` Guenter Roeck
2014-02-07  2:07     ` Guenter Roeck
2014-02-07  2:07     ` Guenter Roeck
2014-02-06 17:20 ` [PATCH v6 18/19] ARM: mvebu: Enable watchdog support in defconfig Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:51   ` Jason Cooper
2014-02-06 17:51     ` Jason Cooper
2014-02-06 17:51     ` Jason Cooper
2014-02-06 19:10     ` Ezequiel Garcia
2014-02-06 19:10       ` Ezequiel Garcia
2014-02-06 19:10       ` Ezequiel Garcia
2014-02-06 19:12       ` Jason Cooper
2014-02-06 19:12         ` Jason Cooper
2014-02-06 19:12         ` Jason Cooper
2014-02-06 17:20 ` [PATCH v6 19/19] ARM: dove: Enable watchdog support in the defconfig Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia
2014-02-06 17:20   ` Ezequiel Garcia

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=20140210165405.GF15607@localhost \
    --to=ezequiel.garcia@free-electrons.com \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=wim@iguana.be \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.