devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Chris Brandt <Chris.Brandt@renesas.com>
Cc: Wim Van Sebroeck <wim@iguana.be>,
	Sebastian Reichel <sre@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Simon Horman <horms@verge.net.au>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	"linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] power: reset: Add Renesas reset driver
Date: Thu, 16 Feb 2017 14:20:15 -0800	[thread overview]
Message-ID: <20170216222014.GA29672@roeck-us.net> (raw)
In-Reply-To: <PS1PR06MB1162A4C12D144C321379E3028A5A0@PS1PR06MB1162.apcprd06.prod.outlook.com>

On Thu, Feb 16, 2017 at 06:40:05PM +0000, Chris Brandt wrote:
> On Thursday, February 16, 2017, Guenter Roeck wrote:
> > On Thu, Feb 16, 2017 at 12:23:18PM -0500, Chris Brandt wrote:
> > > Some Renesas SoCs do not have a reset register and the only way to do a SW
> > > controlled reset is to use the watchdog timer. Additionally, since all the
> > > WDT timeout options are so quick, a system reset is about the only thing
> > > it's good for.
> > >
> > > Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Reviewed-by: Geert
> > > Uytterhoeven <geert+renesas@glider.be>
> > 
> > Wondering - why not use the watchdog driver and the infrastructure provided
> > by the watchdog core (ie the restart callback) instead ?
> 
> That was Geert's first suggestion, but then he said:
> 
> On Friday, February 10, 2017, Geert Uytterhoeven wrote:
> > On Fri, Feb 10, 2017 at 3:59 PM, Chris Brandt <Chris.Brandt@renesas.com>
> > wrote:
> > > On Friday, February 10, 2017, Geert Uytterhoeven wrote:
> > >> >  static const char *const r7s72100_boards_compat_dt[] __initconst = {
> > >> >  "renesas,r7s72100", NULL, @@ -29,4 +58,5 @@
> > >> >  DT_MACHINE_START(R7S72100_DT, "Generic R7S72100
> > >> (Flattened Device Tree)")
> > >> >         .init_early     = shmobile_init_delay, .init_late      =
> > >> >         shmobile_init_late, .dt_compat      =
> > >> >         r7s72100_boards_compat_dt, +       .restart        =
> > >> >         r7s72100_restart, MACHINE_END
> > >>
> > >> Perhaps unsurprisingly, I'd recommend writing a watchdog driver instead.
> > >> drivers/watchdog/renesas_wdt.c (currently supporting R-Car Gen3 only) may
> > >> serve as an example.
> > >
> > > Why do you guys always make things more difficult for me... ;)
> > >
> > > To be clear, you are recommending I make a WDT timer driver (and not use
> > > .restart) and that will reset the system?
> > >
> > > Or, make a WDT driver just so I can steal the base address?
> > 
> > I meant a WDT timer driver. If the watchdog driver provides a .restart
> > callback, it will be used for system reset (hmm, renesas_wdt.c no longer has
> > the .restart callback, as per arm64 "system reset must be implemented using
> > PSCI"-policy).
> 

Hmm, ok. Guess I don't have to understand that you can not use the watchdog
driver because of the above, but implementing exactly the same functionality
in a separate driver is ok.

[ I am sure I am missing something here, so just ignore what I am saying ]

> 
> 
> > > v2: * changed DT bindings from 'wdt-reset' to 'rza-wdt' * changed hard
> > > coded register values to defines * added msleep to while(1) loop
> > 
> > Sure you can sleep here ?
> 
> As per Geert's review:
> 
> On Wednesday, February 15, 2017, Geert Uytterhoeven wrote:
> > > + +       /* Wait for WDT overflow */ +       while (1) +               ;
> > 
> > This burns CPU, and thus power, albeit for a very short time.  Perhaps add
> > an msleep() to the loop body?
> 
> Note that you only have 7.7us before the restart occurs, so probably not much
> sleeping will be going on.
> 
Let me rephrase my question. Is it guaranteed that you _can_ sleep in this
function, or in other words that it is guaranteed that interrupts are enabled ?

Thanks,
Guenter

  reply	other threads:[~2017-02-16 22:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 17:23 [PATCH v2 0/3] power: reset: add reset for renesas r7s72100 Chris Brandt
2017-02-16 17:23 ` [PATCH v2 1/3] power: reset: Add Renesas reset driver Chris Brandt
     [not found]   ` <20170216172320.10897-2-chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-02-16 18:26     ` Guenter Roeck
2017-02-16 18:40       ` Chris Brandt
2017-02-16 22:20         ` Guenter Roeck [this message]
2017-02-17  2:00           ` Chris Brandt
     [not found]             ` <PS1PR06MB11622077DE4673C1879C05278A5D0-l4vAwRX7WilTTnd0MlXEO20DtJ1/0DrXvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-02-17  4:45               ` Guenter Roeck
     [not found]                 ` <55cf087f-aa70-3660-1186-af9b9b20376d-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2017-02-17  8:09                   ` Geert Uytterhoeven
     [not found]                     ` <CAMuHMdUChhntL0Mw2CY7au87WHj11nBi+0Q2mWSi+RcYpHXgAQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-17 10:06                       ` Guenter Roeck
     [not found]                         ` <fb92af5b-6ed8-ef52-d1d1-4615b5026738-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2017-02-17 13:49                           ` Chris Brandt
2017-02-22 13:35                 ` Chris Brandt
2017-02-22 15:28                   ` Guenter Roeck
     [not found]                     ` <20170222152815.GA23780-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2017-02-22 16:04                       ` Chris Brandt
     [not found] ` <20170216172320.10897-1-chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-02-16 17:23   ` [PATCH v2 2/3] watchdog: renesas-wdt: add support for rza Chris Brandt
     [not found]     ` <20170216172320.10897-3-chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-02-17 10:27       ` Geert Uytterhoeven
2017-02-27 16:34     ` Rob Herring
2017-02-16 17:23 ` [PATCH v2 3/3] ARM: dts: r7s72100: Add reset handler Chris Brandt
     [not found]   ` <20170216172320.10897-4-chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-02-17 10:29     ` Geert Uytterhoeven
2017-08-30  8:29       ` Simon Horman
     [not found]         ` <20170830082940.GR10398-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2017-08-30 13:22           ` Chris Brandt
     [not found]             ` <SG2PR06MB1165B8B815327A6768AE681A8A9C0-ESzmfEwOt/xoAsOJh7vwSm0DtJ1/0DrXvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-08-30 15:57               ` Simon Horman

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=20170216222014.GA29672@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Chris.Brandt@renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=horms@verge.net.au \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --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 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).