devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rob Herring <robh@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-renesas-soc@vger.kernel.org,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Linux PM list <linux-pm@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH/RFC v2 01/11] PM / Domains: Add DT bindings for the R-Car System Controller
Date: Thu, 18 Feb 2016 23:14:57 +0200	[thread overview]
Message-ID: <15010857.2cVvcc6676@avalon> (raw)
In-Reply-To: <CAMuHMdXqVL6_P6Lnea6z8jFtR2v4NFnzn=ibZVyauZ8-ODb6dg@mail.gmail.com>

Hi Geert,

On Thursday 18 February 2016 18:18:56 Geert Uytterhoeven wrote:
> On Thu, Feb 18, 2016 at 3:38 PM, Rob Herring <robh@kernel.org> wrote:
> > On Mon, Feb 15, 2016 at 10:16:50PM +0100, Geert Uytterhoeven wrote:
> >> The Renesas R-Car System Controller provides power management for the
> >> CPU cores and various coprocessors, following the generic PM domain
> >> bindings in Documentation/devicetree/bindings/power/power_domain.txt.
> >> 
> >> This supports R-Car Gen1, Gen2, and Gen3.
> >> 
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >> ---
> >> 
> >> Alternatives I considered:
> >>   - Using a single node per power register block, even if it contains
> >>     multiple domains, e.g.:
> >>           pd_ca15_scu: ca15_scu@180 {
> >>                   reg = <0x180 0x20>;
> >>                   #address-cells = <1>;
> >>                   #size-cells = <0>;
> >>                   #power-domain-cells = <0>;
> >>                   renesas,interrupt-bits = <12>;
> >>                   
> >>                   pd_ca15_cpu: ca15_cpu@40 {
> >>                           reg = <0x40 0x20>;
> >>                           #power-domain-cells = <1>;
> >>                           renesas,pm-domain-indices = <0 1>;
> >>                           renesas,pm-domain-names =
> >>                                   "ca15_cpu0", "ca15_cpu1";
> >>                           renesas,interrupt-bits = <0 1>;
> >>                   };
> >>           };
> >>     
> >>     Notes:
> >>       - You cannot just have a property with the number of domains, as
> >>       index 0 is not used on R-Car H1. Hence the need for
> >>       "renesas,pm-domain-indices" and "renesas,interrupt-bits",
> >>       - "#power-domain-cells = <1>" for nodes with multiple domains,
> >>       which allows typos in "power-domains = <&pd_ca15_cpu n>", using
> >>       an invalid value of "n".
> >>   
> >>   - Using a linear description in DT:
> >>       - Needs parent links for subdomains,
> >>       - More complicated to parse (lesson learned from R-Mobile PM
> >>       Domain support).
> >>   
> >>   - Keeping the power register block offset and the bit number as
> >>   separate
> >>     "reg" cells, increasing "#address-cells" from 2 to 3,
> >>   
> >>   - Merging the interrupt bit (which needs only 5 bits) in the other
> >>   "reg"
> >>     cell, decreasing "#address-cells" from 2 to 1.
> > 
> > I think I'd move to not encoding mulitple things into reg. This seems
> > like a bit of abuse of reg. Otherwise, I don't have much to comment on.
> 
> Thanks!
> 
> (quoting the encoding of the reg properties)
> 
> > +== PM Domain Nodes ==
> > +
> > +Each of the PM domain nodes represents a PM domain, as documented by the
> > +generic PM domain bindings in
> > +Documentation/devicetree/bindings/power/power_domain.txt.
> > +
> > +Required properties:
> > +  - #power-domain-cells: Must be 0.
> > +  - reg: This property must contain 2 values:
> > +          - The first value is the number of the interrupt bit
> > representing
> > +            the power area in the various Interrupt Registers (e.g.
> > SYSCISR,
> > +            Interrupt Status Register),
> > +          - The second value encodes the power register block offset
> > (which is
> > +            a multiple of 64), and the number of the bit representing the
> > +            power area in the various Power Control Registers (e.g.
> > PWROFFSR,
> > +            Power Shutoff Status Register). This value is created by
> > ORing
> > +            these two numbers.
> 
> Not encoding multiple things into reg means adding more properties to
> provide that information, iff we want to describe the PM Domain Nodes in
> DT. I considered the reg property a two-dimensional address space.
> 
> Taking the lessons from CCF and the new CPG/MSSR bindings into account
> (which was BTW designed after the SYSC DT bindings), perhaps the PM Domain
> hierarchy should be moved from DT to C, in the driver, too?
> 
> That would mean we have in DT:
>   1) "#power-domain-cells = <1>"
>   2) defines for the various domains, e.g. "#define R8A7791_PD_CA15_SCU     
> 12"
>   3) e.g. "power-domains = <&sysc R8A7791_PD_CA15_SCU>"
>   4) and we can get rid of the fallback compatibility strings again.
> 
> Thoughts?

That simplifies DT and will give more flexibility to handle all the weird 
details in C code, so I like it.

Additionally the amount of per-SoC data related to power domains is pretty 
limited, so we shouldn't have a size issue, even for multi-platform kernels. 
The removal of DT parsing code might even make the kernel smaller. The only 
driver I'm concerned about when it comes to per-SoC data size is the PFC 
driver.

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2016-02-18 21:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 21:16 [PATCH/RFC v2 00/11] ARM/arm64: renesas: Add SYSC PM Domain DT Support Geert Uytterhoeven
2016-02-15 21:16 ` [PATCH/RFC v2 01/11] PM / Domains: Add DT bindings for the R-Car System Controller Geert Uytterhoeven
2016-02-15 23:08   ` Laurent Pinchart
2016-02-15 23:33     ` Laurent Pinchart
2016-02-16  7:15     ` Geert Uytterhoeven
2016-02-18 14:38   ` Rob Herring
2016-02-18 17:18     ` Geert Uytterhoeven
2016-02-18 21:14       ` Laurent Pinchart [this message]
2016-02-23 20:08       ` Rob Herring
2016-02-15 21:16 ` [PATCH/RFC v2 02/11] soc: renesas: Move pm-rcar to drivers/soc/renesas/ Geert Uytterhoeven
2016-02-15 22:12   ` Laurent Pinchart
2016-02-15 21:16 ` [PATCH/RFC v2 03/11] soc: renesas: Improve rcar_sysc_power() debug info Geert Uytterhoeven
2016-02-15 22:11   ` Laurent Pinchart
     [not found] ` <1455571020-18968-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2016-02-15 21:16   ` [PATCH/RFC v2 04/11] soc: renesas: rcar: Add DT support for SYSC PM domains Geert Uytterhoeven
2016-02-15 22:51     ` Laurent Pinchart
2016-02-17 12:45       ` Geert Uytterhoeven
2016-02-26 15:41       ` Geert Uytterhoeven
2016-02-26 16:28         ` Laurent Pinchart
2016-02-15 21:16   ` [PATCH/RFC v2 07/11] ARM: dts: r8a7790: Add " Geert Uytterhoeven
2016-02-15 21:16   ` [PATCH/RFC v2 09/11] ARM: dts: r8a7793: " Geert Uytterhoeven
2016-02-15 21:17   ` [PATCH/RFC v2 11/11] arm64: dts: r8a7795: " Geert Uytterhoeven
2016-02-15 21:16 ` [PATCH/RFC v2 05/11] soc: renesas: rcar: Handle clock domain devices in " Geert Uytterhoeven
2016-02-15 22:08   ` Laurent Pinchart
2016-02-16  7:30     ` Geert Uytterhoeven
2016-02-16  8:02       ` Laurent Pinchart
2016-02-15 21:16 ` [PATCH/RFC v2 06/11] ARM: dts: r8a7779: Add " Geert Uytterhoeven
2016-02-15 21:16 ` [PATCH/RFC v2 08/11] ARM: dts: r8a7791: " Geert Uytterhoeven
2016-02-15 21:16 ` [PATCH/RFC v2 10/11] ARM: dts: r8a7794: " Geert Uytterhoeven
2016-02-27  1:53 ` [PATCH/RFC v2 00/11] ARM/arm64: renesas: Add SYSC PM Domain DT Support Laurent Pinchart
2016-02-28  8:55   ` Geert Uytterhoeven
2016-02-28 15:04     ` Laurent Pinchart
2016-02-28 19:26       ` Laurent Pinchart

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=15010857.2cVvcc6676@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=horms@verge.net.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=robh@kernel.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).