From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
Magnus Damm <damm+renesas@opensource.se>,
Simon Horman <horms+renesas@verge.net.au>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
linux-clk <linux-clk@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Linux-sh list <linux-sh@vger.kernel.org>
Subject: Re: [PATCH v4 1/5] [RFC] clk: shmobile: Add new Renesas CPG/MSSR DT bindings
Date: Tue, 27 Oct 2015 03:34:25 +0200 [thread overview]
Message-ID: <8712490.dkvmK3avmY@avalon> (raw)
In-Reply-To: <CAMuHMdVtiEokxPwTsBXhaxwHszm+Wy5CDfNzpyzAxAdWU_fdUA@mail.gmail.com>
Hi Geert,
On Monday 26 October 2015 20:02:45 Geert Uytterhoeven wrote:
> On Fri, Oct 23, 2015 at 1:10 PM, Laurent Pinchart wrote:
> > On Friday 16 October 2015 14:49:16 Geert Uytterhoeven wrote:
> >> On Renesas ARM SoCs (SH/R-Mobile, R-Car, RZ), the CPG (Clock Pulse
> >> Generator) and MSSR (Module Standby and Software Reset) blocks are
> >> intimately connected, and share the same register block.
> >>
> >> Hence it makes sense to describe these two blocks using a
> >> single device node in DT, instead of using a hierarchical structure with
> >> multiple nodes, using a mix of generic and SoC-specific bindings.
> >>
> >> These new DT bindings are intended to replace the existing DT bindings
> >> for CPG core clocks ("renesas,*-cpg-clocks", "renesas,cpg-div6-clock")
> >> and module clocks ("renesas,*-mstp-clocks"), at least for new SoCs.
> >>
> >> This will make it easier to add module reset support later, which is
> >> currently not implemented, and difficult to achieve using the existing
> >> bindings due to the intertwined register layout.
> >>
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >>
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/clock/renesas,cpg-mssr.txt
> >> @@ -0,0 +1,71 @@
> >> +* Renesas Clock Pulse Generator / Module Standby and Software Reset
> >> +
> >> +On Renesas ARM SoCs (SH/R-Mobile, R-Car, RZ), the CPG (Clock Pulse
> >> Generator)
> >> +and MSSR (Module Standby and Software Reset) blocks are intimately
> >> connected,
> >> +and share the same register block.
> >> +
> >> +They provide the following functionalities:
> >> + - The CPG block generates various core clocks,
> >> + - The MSSR block provides two functions:
> >> + 1. Module Standby, providing a Clock Domain to control the clock
> >> supply
> >> + to individual SoC devices,
> >> + 2. Reset Control, to perform a software reset of individual SoC
> >> devices.
>
> [...]
>
> >> + - #power-domain-cells: Must be 0
> >> + - SoC devices that are part of the CPG/MSSR Clock Domain and can
> >> be
> >> + power-managed through Module Standby should refer to the CPG device
> >> + node in their "power-domains" property, as documented by the
> >> generic PM + Domain bindings in
> >> + Documentation/devicetree/bindings/power/power_domain.txt.
> >> +
> >> +
> >> +Examples
> >> +--------
> >> +
> >> + - CPG device node:
> >> +
> >> + cpg: clock-controller@e6150000 {
> >> + compatible = "renesas,r8a7795-cpg-mssr";
> >> + reg = <0 0xe6150000 0 0x1000>;
> >> + clocks = <&extal_clk>, <&extalr_clk>;
> >> + clock-names = "extal", "extalr";
> >> + #clock-cells = <2>;
> >> + #power-domain-cells = <0>;
> >> + };
> >> +
> >> +
> >
> >> + - CPG/MSSR Clock Domain member device node:
> > Would it make sense to show two examples, one for a device whose driver
> > manages the MSTP clock manually, and another one for a device whose driver
> > delegates that to the power domain ?
> >
> > I hate using the word driver in DT bindings, but unfortunately that's
> > essentially what it boils down to here as the decision to specify the
> > power domain is really based on the driver, not on the hardware.
>
> IMHO it's not the driver, but the on-SoC module and its representation in
> DT. Cfr. commit 797a0626e08ca4af ("ARM: shmobile: r8a7791 dtsi: Add
> CPG/MSTP Clock Domain", which states:
>
> | Add "power-domains" properties to all device nodes for devices that are
> | part of the CPG/MSTP Clock Domain and can be power-managed through an
> | MSTP clock. This applies to most on-SoC devices, which have a
> | one-to-one mapping from SoC device to DT device node. Notable
> | exceptions are the "display" and "sound" nodes, which represent multiple
> | SoC devices, each having their own MSTP clocks.
You're quoting your own documentation to support your point, that's not fair
:-)
We're using power domains to gate clocks. The fact that it's not related to
power supplies can already be borderline, but I can buy the argument that
clocks relate to power consumption here. However, where the power domain
abstraction is really abused is that we're adding all kind of devices to a
single power domain while they're controlled by one clock gate each. That's a
software hack, and we're using DT to tell whether our core code should control
clock gating or not. That's not a hardware description, sorry.
> If a single device block (sharing the same register space), represented in
> DT as a single device node, actually represents multiple modules, there's no
> one-to-one mapping from SoC device to DT device node.
>
> Hence the device node will have multiple module clocks, and the driver will
> have to take care of managing them explicitly.
There can be other reasons why the clocks need to be controlled explicitly by
the driver. At the end of the end it's a per-driver decision whether it wants
to delegate clock management to runtime PM (which will be the default cause)
or handle it itself.
> The register space sharing is an SoC-specific issue.
> The single device node is a DT binding issue.
>
> Perhaps such devices should use subnodes, so each of them can represent a
> module, each with its own module clock.
I'm not sure to see how that would help, as we'd have a single struct device
in that case (associated with the top-level DT node), so runtime PM couldn't
be used to manage clocks independently.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2015-10-27 1:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 12:49 [PATCH/RFC v4 0/5] clk: shmobile: Add new Renesas CPG/MSSR DT bindings Geert Uytterhoeven
2015-10-16 12:49 ` [PATCH v4 1/5] [RFC] " Geert Uytterhoeven
2015-10-20 10:15 ` Michael Turquette
[not found] ` <1444999760-15750-2-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2015-10-20 12:16 ` Geert Uytterhoeven
[not found] ` <CAMuHMdVhBipbf13o0jb3H6qmcewh6CCtq3=Hj-9nvgar+AYdFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-20 16:01 ` Magnus Damm
[not found] ` <CANqRtoS6QpWJY99aD8KyGHgySxqzzBPic-k_a-VcZE6LVFFRow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-23 11:05 ` Laurent Pinchart
2015-10-23 11:09 ` Geert Uytterhoeven
2015-10-23 11:11 ` Laurent Pinchart
2015-10-23 11:10 ` Laurent Pinchart
2015-10-26 19:02 ` Geert Uytterhoeven
2015-10-27 1:34 ` Laurent Pinchart [this message]
2015-10-27 8:14 ` Geert Uytterhoeven
2015-10-30 13:30 ` Laurent Pinchart
2015-10-16 12:49 ` [PATCH v4 2/5] [RFC] clk: shmobile: Add r8a7795 CPG Core Clock Definitions Geert Uytterhoeven
2015-10-20 10:09 ` Geert Uytterhoeven
2015-10-20 16:21 ` Magnus Damm
2015-10-23 11:21 ` Laurent Pinchart
2015-10-23 11:25 ` Geert Uytterhoeven
2015-10-16 12:49 ` [PATCH v4 3/5] [RFC] clk: shmobile: div6: Extract cpg_div6_register() Geert Uytterhoeven
2015-10-23 11:28 ` Laurent Pinchart
2015-10-16 12:49 ` [PATCH v4 4/5] [RFC] clk: shmobile: cpg-mssr: Add new CPG/MSSR driver core Geert Uytterhoeven
2015-10-16 12:49 ` [PATCH v4 5/5] [RFC] clk: shmobile: r8a7795: Add new CPG/MSSR driver Geert Uytterhoeven
2015-10-20 12:24 ` Michael Turquette
2015-10-20 12:31 ` Geert Uytterhoeven
2015-10-20 13:00 ` Michael Turquette
2015-10-20 13:07 ` Geert Uytterhoeven
2015-10-22 12:58 ` Geert Uytterhoeven
2015-10-24 1:10 ` Stephen Boyd
2015-10-24 17:34 ` Geert Uytterhoeven
2015-10-26 2:25 ` Laurent Pinchart
2015-10-26 8:03 ` Geert Uytterhoeven
2015-10-30 13:12 ` Laurent Pinchart
2015-10-29 14:03 ` Geert Uytterhoeven
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=8712490.dkvmK3avmY@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=damm+renesas@opensource.se \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=horms+renesas@verge.net.au \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-clk@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--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).