linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter De Schrijver <pdeschrijver@nvidia.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	Janos Laube <janos.dev@gmail.com>,
	"Paulius Zaleckas" <paulius.zaleckas@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Hans Ulli Kroll <ulli.kroll@googlemail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"Joel Stanley" <joel@jms.id.au>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>
Subject: Re: [PATCH] clk: gemini: Fix reset regression
Date: Wed, 19 Jul 2017 11:00:33 +0300	[thread overview]
Message-ID: <20170719080033.GD1002@tbergstrom-lnx.Nvidia.com> (raw)
In-Reply-To: <CACRpkda3ZW4rQTwg8Y63uzzupCZAtTP6jv1ppsTXHuDDy0y8og@mail.gmail.com>

On Tue, Jul 18, 2017 at 11:49:44AM +0200, Linus Walleij wrote:
> On Wed, Jul 12, 2017 at 5:51 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> 
> > From fab3a9a697e9797ba1c24874d7c43c09dd812e77 Mon Sep 17 00:00:00 2001
> > From: Philipp Zabel <p.zabel@pengutronix.de>
> > Date: Wed, 12 Jul 2017 17:29:28 +0200
> > Subject: [PATCH] reset: make (de)assert report succeess for self-deasserting
> >  reset drivers
> >
> > By now there are drivers using shared reset controls and (de)assert
> > calls on platforms with self-deasserting reset lines and thus reset
> > drivers that do not implement .assert() and .deassert().
> > As long as the initial state of the reset line is deasserted, there
> > is no reason for a reset_control_assert call to return an error for
> > shared reset controls, or for a reset_control_deassert call to return
> > an error for either shared or exclusive reset controls: after a call
> > to reset_control_deassert the reset line is guaranteed to be deasserted,
> > and after a call to reset_control_assert it is valid for the reset
> > line to stay deasserted for shared reset controls.
> >
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> 
> This patch makes all kind of sense, and I follow your
> reasoning.
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> In the back of my head I was thinking that the deassert/assert
> pair matches a certain SoC driver design pattern I have seen
> around:
> 
> When a driver use an IP block it enables the clock and takes
> the block out of reset.
> 
> When it stops using it, it asserts reset and disables the clock.
> 
> This is not entirely self-evident, for example why is reset asserted
> across say insmod/rmmod/insmod. Just disabling the clock would
> be OK, I guess, in most cases. It is just one of those "dances"
> that developers do, as if to clear the desk or something.
> 
> But I guess there must be cases where doing things in another way
> creates problems or power leaks.
> 
> I would surely like to understand, from a silicon perspective, why
> drivers are so often written like this. I could think of things like
> little automata and gates inside the silicon that need to be reset
> to minimize off-power consumption but I have no clue if it is
> really so.

At least doing it this way guarantees the hardware is in its initial state
before the driver starts doing anything with it. Otherwise you would have
to ensure the hw init sequence in the driver works for any hw state. That
seems more complicated to me than just making sure it works correctly when
the hw is in its initial stat, especially when there are DMA engines involved.

Peter.

      reply	other threads:[~2017-07-19  8:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 12:26 [PATCH] clk: gemini: Fix reset regression Linus Walleij
2017-07-12 15:51 ` Philipp Zabel
2017-07-12 23:08   ` Stephen Boyd
2017-07-18  9:49   ` Linus Walleij
2017-07-19  8:00     ` Peter De Schrijver [this message]

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=20170719080033.GD1002@tbergstrom-lnx.Nvidia.com \
    --to=pdeschrijver@nvidia.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=janos.dev@gmail.com \
    --cc=joel@jms.id.au \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=paulius.zaleckas@gmail.com \
    --cc=sboyd@codeaurora.org \
    --cc=ulli.kroll@googlemail.com \
    /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).