linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Turquette <mturquette@baylibre.com>
To: Lee Jones <lee.jones@linaro.org>,
Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	sboyd@codeaurora.org, maxime.ripard@free-electrons.com,
	s.hauer@pengutronix.de, geert@linux-m68k.org
Subject: Re: [PATCH RFC RFT 3/3] clk: introduce CLK_ENABLE_HAND_OFF flag
Date: Tue, 11 Aug 2015 10:09:04 -0700	[thread overview]
Message-ID: <20150811170904.2416.43354@quantum> (raw)
In-Reply-To: <20150811084329.GA13374@x1>

Quoting Lee Jones (2015-08-11 01:43:29)
> On Mon, 10 Aug 2015, Michael Turquette wrote:
> > Quoting Lee Jones (2015-08-10 07:48:11)
> > > On Fri, 07 Aug 2015, Michael Turquette wrote:
> > This series is solving the following problems:
> > =

> > 1) enabling specified clocks at boot
> > 2) preventing those clocks from being gated by clk_disable_unused
> =

> The original patch-set did this just fine.

There is a very real difference between the implementations.

The original patch made it easy to call clk_prepare_enable on a clock
from some place other than a Linux device driver (e.g. DT).

The hand-off semantic establishes an expectation that a driver will come
along and claim ownership of the clk using standard Linux apis; we're
just preserving the enabled state of the clock until that time.

I had a chat with Stephen Boyd about this yesterday and we discussed
taking it even further: do not explicitly enable the clock, but instead
simply refrain from disabling a clock that is both ON and has this flag
set.

It sounds like that would that work for ST, yes? Are you interested in
using a flag (or a DT property) to enable an otherwise-gated clock, or
simply insuring that bootloader-enabled and reset-enabled clocks are not
spuriously turned off?

> > If you mean to say, "this patch doesn't let me toss this data in
> > Devicetree, a data orifice that is used by only a fraction of Linux
> > kernel users" then you would be right.
> =

> A fraction of Linux kernel users, yes, but the majority (all?) of
> the Clock Framework users do use DT.

At last count we had 5 architectures using ccf, I haven't counted in a
while. x86 definitely does not use Devicetree. I have no clue if MIPS
does. PowerPC and ARM-ish both do.

> > diff --git a/drivers/clk/qcom/gcc-apq8084.c b/drivers/clk/qcom/gcc-apq8=
084.c
> > index 3563019..d2f5e5a 100644
> > --- a/drivers/clk/qcom/gcc-apq8084.c
> > +++ b/drivers/clk/qcom/gcc-apq8084.c
> > @@ -1450,23 +1450,23 @@ static struct clk_branch gcc_blsp1_qup1_spi_app=
s_clk =3D {
> >  static struct clk_branch gcc_blsp1_qup2_i2c_apps_clk =3D {
> >         .halt_reg =3D 0x06c8,
> >         .clkr =3D {
> >                 .enable_reg =3D 0x06c8,
> >                 .enable_mask =3D BIT(0),
> >                 .hw.init =3D &(struct clk_init_data){
> >                         .name =3D "gcc_blsp1_qup2_i2c_apps_clk",
> >                         .parent_names =3D (const char *[]){
> >                                 "blsp1_qup2_i2c_apps_clk_src",
> >                         },
> >                         .num_parents =3D 1,
> > -                       .flags =3D CLK_SET_RATE_PARENT,
> > +                       .flags =3D CLK_SET_RATE_PARENT | CLK_ENABLE_HAN=
D_OFF,
> >                         .ops =3D &clk_branch2_ops,
> >                 },
> >         },
> >  };
> =

> Fair enough.  Obviously for anyone using Device Tree, this solution
> makes it pretty difficult to partake.

QCOM is using Devicetree. I've covered how to make a clock-controller
style binding before using QCOM's driver & binding as examples. Take a
look here if you have some spare time:

http://lkml.kernel.org/r/<20150416192014.19585.9663@quantum>

> > > What happens during disable() and unprepare()?
> > =

> > The reference counts go to zero. As I stated in my cover letter, I'll
> > need to see evidence of a real use case where the "leave the clock on on
> > when I call clk_disable, clk_unprepare and clk_put" behavior is
> > warranted.
> =

> I can't say for sure (get-out clause), but I doubt we'd need that, as
> this would only be required if a knowledgeable consumer existed
> i.e. one which actually wanted to the disable critical clock.  On ST's
> platforms I don't think there is a use-case for these clocks to ever
> be gated, as the platform would be unrecoverable and require a reboot.

That's great. I suspected that behavior was not necessary at all.

Let's zero in on the technical concerns here:

1) ST's flexgen binding should not get screwed over. So we'll need a DT
wrapper around the flag

2) I would love feedback on whether you expect the flag/property to
enable a disabled clock or if you merely want to keep an already-enabled
clock from being disabled

Thanks,
Mike

> =

> -- =

> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org =E2=94=82 Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  parent reply	other threads:[~2015-08-11 17:09 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 19:09 [PATCH RFC RFT 0/3] clk: detect per-user enable imbalances and implement hand-off Michael Turquette
2015-08-07 19:09 ` [PATCH RFC RFT 1/3] clk: per-user clk prepare & enable ref counts Michael Turquette
2015-08-10 13:47   ` Maxime Coquelin
2015-08-10 19:31     ` Michael Turquette
2015-08-07 19:09 ` [PATCH RFC RFT 2/3] clk: clk_put WARNs if user has not disabled clk Michael Turquette
2015-09-30 15:38   ` Geert Uytterhoeven
2015-10-20 12:40     ` Michael Turquette
2015-10-20 12:52       ` Russell King - ARM Linux
2015-10-21  9:50       ` Geert Uytterhoeven
2015-10-21 10:59         ` Russell King - ARM Linux
2015-10-21 15:50           ` Michael Turquette
2015-10-21 16:46             ` Geert Uytterhoeven
2015-10-22  9:57               ` Michael Turquette
2015-08-07 19:09 ` [PATCH RFC RFT 3/3] clk: introduce CLK_ENABLE_HAND_OFF flag Michael Turquette
2015-08-10 14:48   ` Lee Jones
2015-08-10 18:55     ` Michael Turquette
2015-08-11  8:43       ` Lee Jones
2015-08-11 10:02         ` Maxime Coquelin
2015-08-11 10:11           ` Geert Uytterhoeven
2015-08-11 11:36             ` Maxime Coquelin
2015-08-11 11:41               ` Maxime Coquelin
2015-08-11 11:49                 ` Geert Uytterhoeven
2015-08-11 12:03                   ` Maxime Coquelin
2015-08-11 12:34                     ` Geert Uytterhoeven
2015-08-11 12:03                   ` Lee Jones
2015-08-11 17:09             ` Michael Turquette
2015-08-11 18:17               ` Lee Jones
2015-08-12  7:27                 ` Geert Uytterhoeven
2015-08-12  7:51                   ` Lee Jones
2015-08-11 17:09           ` Michael Turquette
2015-08-11 18:20             ` Lee Jones
2015-08-11 17:09         ` Michael Turquette [this message]
2015-08-11 18:33           ` Lee Jones
2015-08-11 18:58             ` Michael Turquette
2015-08-18 15:52               ` Maxime Ripard
2015-08-18 16:33                 ` Michael Turquette
2015-08-20 15:11                   ` Maxime Ripard
2015-08-18 15:58   ` Maxime Ripard
2015-08-18 16:39     ` Michael Turquette
2015-08-20 15:39       ` Maxime Ripard
2015-08-10 15:36 ` [PATCH RFC RFT 0/3] clk: detect per-user enable imbalances and implement hand-off Lee Jones
2015-08-10 19:28   ` Michael Turquette
2015-08-11  9:11     ` Lee Jones
2015-08-11  9:20 ` Geert Uytterhoeven
2015-08-11 16:41   ` Michael Turquette
2015-08-11 17:42     ` Geert Uytterhoeven
2015-08-18 15:45 ` Maxime Ripard
2015-08-18 16:43   ` Michael Turquette
2015-08-20 15:15     ` Maxime Ripard
2015-08-25 21:50       ` Michael Turquette
2015-08-26  6:54         ` Lee Jones
2015-08-26  8:42           ` Maxime Coquelin
2015-08-26  9:09             ` Lee Jones
2015-08-26  9:37               ` Maxime Coquelin
2015-08-26 20:41                 ` Lee Jones
2015-08-29  3:49           ` Maxime Ripard
2015-08-29  3:55         ` Maxime Ripard
2015-09-30 12:36           ` Michael Turquette
2015-10-01 19:56             ` Maxime Ripard
2015-11-24  9:48 ` Heiko Stübner
2015-12-05  0:46   ` Michael Turquette
2016-02-11 21:33     ` Michael Turquette

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=20150811170904.2416.43354@quantum \
    --to=mturquette@baylibre.com \
    --cc=geert@linux-m68k.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@codeaurora.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).