From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
John Bonesio <bones-RkXMcIGFT/TR7s880joybQ@public.gmane.org>
Subject: Re: Proposal: new device-tree syntax and semantics for extending information from included dts files
Date: Wed, 13 Oct 2010 19:40:36 -0600 [thread overview]
Message-ID: <20101014014036.GE15286@angua.secretlab.ca> (raw)
In-Reply-To: <20101014003833.GB4456@yookeroo>
On Thu, Oct 14, 2010 at 11:38:33AM +1100, David Gibson wrote:
> On Wed, Oct 13, 2010 at 05:17:47PM -0600, Grant Likely wrote:
> > On Tue, Oct 12, 2010 at 02:56:01PM -0700, John Bonesio wrote:
> > > Objective:
> > > The primary problem is that the same information gets repeated in
> > > various dts file that describe variations on the same base SOC. The
> > > information becomes redundant and when changes to the device tree
> > > syntax is made, extra work is necessary to update the same
> > > information in multiple files.
> >
> > Thanks John. Some comments below, but a reasonable proposal. Next
> > you need to post the proposal to the devicetree-discuss list and cc:
> > David Gibson, Jon Loeliger and me.
> >
> > ... actually, this discussion is important enough that I don't want to
> > send this reply without David and Jon seeing it; otherwise we just end
> > up repeating the same rationals over again. I'm going to cc the
> > list right now.
>
> Excellent :)
:-D
>
> > > A solution needs to allow:
> > > a) nodes to be updated
> > > b) nodes to be overridden
> > > c) nodes to be removed
> > > d) properties to be overridden
> > > e) properties to be removed
> > >
> > > Overview:
> > > The main thrust of this proposal is to suggest an overlay system
> > > where existing device tree nodes can be modified by dts statements
> > > later on in the "file". The "file" is defined as a file in memory
> > > after all /include/ statements have been processed.
>
> Um, I know what you mean, but the wording is incorrect on a
> technicality - parsing and include processing are done at the same
> time, so the full include-expanded "file" never exists as a whole in
> memory, only conceptually.
>
> > > Much of the functionality described in this proposal is already
> > > present in a test version of the device tree compiler (dtc). This
> > > proposal describes
> >
> > s/test/unreleased/
>
> Do you mean you have a test branch of your own, or do you mean the
> partial overlay functionality that's already upstream?
We're talking about the already upstreamed bits.
> > > Proposal:
> > >
> > > 1) Add a new keyword constant for property values, <Undefined>.
> >
> > Personally, I'd prefer all lowercase: <undefined>. There may be some
> > dickering over the exact keyword name, but I think the concept is
> > sound.
>
> It should be /undefined/ to match existing keywords. Or possibly
> /delete/ or /remove-property/ or some such. As Grant says there is
> some dickering to be done there.
ah, of course. I missed that. <...> already has a meaning in dts
syntax, so that should definitely be avoided. /.../ it is.
> > > B) /replace/
> >
> > /replace-node/ perhaps?
>
> There is no need for this. It's equivalent to a /remove/ then an
> /extend/, which is barely more verbose.
Need to flush this out. What would this look like then? This?
&some-node {
node-to-remove /remove/;
node-to-replace /remove/;
node-to-replace { prop = "blah"; };
};
I don't like this one because it implies ordering between the first
and second 'node-to-replace' definitions, and to this point the syntax
has not imposed any order assumptions.
Perhaps this:
&some-node {
node-to-remove /remove/;
node-to-replace /remove/ { prop = "blah"; };
};
Here the keyword essentially becomes a flag to drop the previous
definition of the node with the option to also provide a replacement
defintion. I like this better, and the (lack of) ordering assumptions
are preserved.
How then would it look when compared with removing properties?
&some-node {
property-to-remove = /remove/;
property-to-replace = "new value";
property-to-replace-with-empty-prop;
node-to-remove /remove/;
node-to-replace /remove/ { prop = "blah"; };
};
In this form, the only syntactic difference between removing
properties and removing nodes is that removing properties has an '='
token between them. I think that this has the potential to be
confusing to users, and probably a common source of defects. That is
part of why I like the idea of different keywords when dealing with
nodes and properties. What about this?
&some-node {
property-to-remove /remove-prop/;
property-to-replace = "new value";
property-to-replace-with-empty-prop;
node-to-remove /remove-node/;
node-to-replace /remove-node/ { prop = "blah"; };
};
Or perhaps with the keyword preceding:
&some-node {
/remove-prop/ property-to-remove;
property-to-replace = "new value";
property-to-replace-with-empty-prop;
/remove-node/ node-to-remove;
/remove-node/ node-to-replace { prop = "blah"; };
};
And the following construct would be forbidden:
/remove-prop/ property-to-remove = "new value;
Also, /remove-node/ feels awkward when working with replacing a node.
Would /clear-node/ or /trim-node/ be better? '/replace-node/'
wouldn't be very because it doesn't make sense in the removal case,
and /delete-node/ has the same problem as /remove-node/.
/undefine-node/ as you suggested has possibilities too. Anyone have
other suggestions for intuitive keyword names?
> > I also wonder if it would be better to have the directives before the
> > node name. ie:
> > /extend/ node1 { ... };
> > /replace/ node1 { ... };
> > /remove/ node1;
>
> Maybe, yes, although I think the first two should go away anyway.
>
> Actually, how about:
> node1 /undefine/;
>
> Using the same /undefine/ keyword as for removing individual
> properties (but without the =).
See discussion above. :-)
>
> [snip]
> > > 4) Allow full paths to be used to override nodes.
> > >
> > > This suggest that labels aren't required. Most people will
> > > want to use labels, but for the device tree syntax to be
> > > orthogonal, full paths should still be allowed.
> > >
> > > Example:
> > > Here is the serial example again. Not inlined with paths:
> > >
> > > / {
> > > soc: soc5200@f0000000 {
> > > #address-cells = <1>;
> > > #size-cells = <1>;
> > > compatible = "fsl,mpc5200b-immr";
> > > ...
> > >
> > > psc4: serial@2600 { // PSC4
> > > compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> > > reg = <0x2600 0x100>;
> > > interrupts = <2 11 0>;
> > > };
> > >
> > > psc5: serial@2800 { // PSC5
> > > compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> > > reg = <0x2800 0x100>;
> > > interrupts = <2 12 0>;
> > > };
> > > };
> > >
> > > /soc5200@f0000000/serial@2600 /remove/ { }; // PSC4
> > > /soc5200@f0000000/serial@2800 /remove/ { }; // PSC5
> >
> > I've thought about this too, and I'd like to implement it, but there
> > are some nasty gotchas here because /.../ is already used as the
> > keyword delimiter. There would need to be a way to ensure the grammer
> > is unambiguous about which are keywords and which are node names.
>
> Yeah. But I think there's an obvious way to fix it. We already have
> a full-path reference syntax we can use for inserting phandles. So I
> think we should make the syntax here:
>
> &{/full/path/to/node} {
> property-to-override = "something";
> };
True. That would work. And I like the reuse of existing syntax
elements.
>
> Or of course you can already do
>
> / {
> full {
> path {
> to {
> node {
> etc.
Right.
> > On that line, it might also be possible to specify a node by both
> > label and path:
>
> Well, this is sort of already possible:
>
> &soc {
> serial@2600 {
> current-speed = <115200>;
> };
> };
>
> Directly allowing a label+relative path could be useful enough to
> reduce verbosity, but it will require careful thinking about the
> syntax.
Yes, (as discussed previously) this is just syntactic sugar. The
syntax already supports the functionality, but it would be nice to be
less verbose.
g.
next prev parent reply other threads:[~2010-10-14 1:40 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1286920561.4535.1315.camel@riker>
2010-10-13 23:17 ` Proposal: new device-tree syntax and semantics for extending information from included dts files Grant Likely
[not found] ` <20101013231747.GD15286-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-10-13 23:41 ` Proposal: new device-tree syntax and semantics for extendinginformation " Stephen Neuendorffer
[not found] ` <d223e561-ed6e-44c2-8a99-8959e85ae022-+Ck8Kgl/v0/nHLUNXTEFU7jjLBE8jN/0@public.gmane.org>
2010-10-14 0:45 ` David Gibson
2010-10-14 1:46 ` Grant Likely
[not found] ` <20101014014657.GF15286-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-10-14 3:31 ` David Gibson
2010-10-14 16:38 ` Stephen Neuendorffer
[not found] ` <21eeaef0-fc78-47c9-b1c5-bfefaa55fb85-RaUQJvECHis6W+Ha+8ZLibjjLBE8jN/0@public.gmane.org>
2010-10-15 15:18 ` Grant Likely
[not found] ` <20101015151840.GB32705-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-10-15 16:10 ` Stephen Neuendorffer
[not found] ` <b04d95cc-c35b-4597-8fbe-f7c48f23ef92-+Ck8Kgl/v09DUMyIFHz4objjLBE8jN/0@public.gmane.org>
2010-10-15 19:32 ` Grant Likely
[not found] ` <AANLkTinPWv94Xoz+mDxiE=KujQYAyQj9PsPWHEORypJ3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-15 19:48 ` Stephen Neuendorffer
[not found] ` <eba820f8-3e4f-4d57-9024-39cc562a99eb-+Ck8Kgl/v0/0H8R8xLlBI7jjLBE8jN/0@public.gmane.org>
2010-10-15 19:56 ` Grant Likely
[not found] ` <AANLkTikWfMXEbdwFY6FNoMwuD6fC74Kohtr3QRJqSrM0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-15 19:59 ` Stephen Neuendorffer
[not found] ` <ed27a45d-3607-41e3-831f-1d7e3dd44379-RaUQJvECHis6W+Ha+8ZLibjjLBE8jN/0@public.gmane.org>
2010-10-15 20:11 ` Grant Likely
[not found] ` <AANLkTikzyDFiQZzPmeos6pf_DS33RvkfER+Mz0jceSJy-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-15 20:20 ` Stephen Neuendorffer
[not found] ` <4da0557a-d204-4e38-8a82-b0996a9a5af1-RaUQJvECHitCYczPSvLbDrjjLBE8jN/0@public.gmane.org>
2010-10-15 23:58 ` Grant Likely
[not found] ` <AANLkTinzf3vhs_OUUeiVYOFbOPLFHA+dei810H2gyDGS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-16 7:10 ` David Gibson
2010-10-15 20:35 ` John Bonesio
2010-10-15 21:25 ` John Bonesio
2010-10-15 23:51 ` Grant Likely
2010-10-16 7:05 ` David Gibson
2010-10-14 0:38 ` Proposal: new device-tree syntax and semantics for extending information " David Gibson
2010-10-14 1:40 ` Grant Likely [this message]
[not found] ` <20101014014036.GE15286-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-10-14 1:49 ` Grant Likely
2010-10-14 3:08 ` John Bonesio
2010-10-14 3:37 ` Grant Likely
2010-10-14 4:00 ` David Gibson
2010-10-14 3:48 ` David Gibson
2010-10-14 4:54 ` Grant Likely
[not found] ` <20101014045413.GK15286-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-10-16 7:02 ` David Gibson
2010-10-16 18:57 ` Grant Likely
[not found] ` <AANLkTi=QaV5KvhFzyci2yykmsV9+Zz71vmoRrrFDGvK--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-16 19:50 ` John Bonesio
2010-10-17 6:17 ` Grant Likely
2010-10-19 2:48 ` David Gibson
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=20101014014036.GE15286@angua.secretlab.ca \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=bones-RkXMcIGFT/TR7s880joybQ@public.gmane.org \
--cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.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