[PATCH v2 REPOST] dtc: Add support for named integer constants

Stephen Warren swarren at nvidia.com
Wed Jan 11 08:54:30 EST 2012


John, David,

What can we do to reach consensus on expanding dtc to handle named
constants, or in general any future direction to extend the syntax with
expressions etc.?

Will either of you be attending Linaro Connect or ELC 2012 in February
by any chance? We could get together and talk this through in person if
you are...

Thanks for any kind of discussion!

Stephen Warren wrote at Thursday, January 05, 2012 2:27 PM:
> Simon Glass wrote at Tuesday, January 03, 2012 5:46 PM:
> > On Mon, Dec 12, 2011 at 12:23 PM, Stephen Warren <swarren at nvidia.com> wrote:
> > > Simon Glass wrote at Monday, December 12, 2011 1:19 PM:
> > >> On Mon, Dec 12, 2011 at 12:04 PM, Stephen Warren <swarren at nvidia.com> wrote:
> > >> > You may define constants as follows:
> > >> >
> > >> > /define/ TWO 2;
> > >> > /define/ FOUR 4;
> > >> > /define/ OTHER FOUR;
> > >> >
> > >> > And properties may use these values as follows:
> > >> >
> > >> > foo = <1 TWO 3 FOUR 5>;
> > >> >
> > >> > Signed-off-by: Stephen Warren <swarren at nvidia.com>
> > >> > ---
> > >> > I posted this back in early September. I'd like to ask again that this
> > >> > feature be merged into dtc; there are many situations where it'd allow
> > >> > .dts files to be simplified.
> > >>
> > >> Yes I agree, it is very useful.
> > >>
> > >> I get conflicts with this - does it need a rebase?
> > >
> > > Yes, I should have mentioned this patch is still based on the same commit
> > > it was 3 months ago, and HEAD has moved forward since. If it's deemed
> > > conceptually acceptable, I'll rebase it to HEAD.
> > >
> > > (For reference, it's based on ed8fee1 "Add missing tests to .gitignore".)
> >
> > I haven't seen any other comments. Is this going in? Constants would be useful.
> 
> I took a quick look at rebasing this on HEAD today. There are some non-
> trivial conflicts with Anton's recent patch to support variable-sized
> elements in arrays. In particular, my patch relied on the cellval token,
> allowing it to reference a symbol or a literal, but Anton's patch has
> removed that token from the grammar.
> 
> So, I'm still willing to rebase my patch, but given the non-trivial nature
> of doing so, I'd like prior confirmation from Jon and David that the syntax
> is acceptable, and so my work won't be in vain.
> 
> For reference, here's the test .dts file from my patch:
> 
> +/dts-v1/;
> +
> +/define/ VAR1 0xdeadbeef;
> +/define/ VAR2 VAR1;
> +
> +/ {
> +	var1 = <VAR1>;
> +	var2 = <VAR2>;
> +};
> +
> +/define/ OTHER 0xdeadbeef;

-- 
nvpublic



More information about the devicetree-discuss mailing list