Devicetree
 help / color / mirror / Atom feed
* dec behavior question
@ 2011-10-24 14:01 Kumar Gala
       [not found] ` <9942C069-D8EC-4133-B436-1DC5F62C502E-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Kumar Gala @ 2011-10-24 14:01 UTC (permalink / raw)
  To: David Gibson; +Cc: devicetree-discuss

If I have something like:

---------------------------------------
spi.dtsi:

&spi0 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "fsl,mpc8536-espi";
        reg = <0x7000 0x1000>;
        interrupts = <59 0x2 0 0>;
};
---------------------------------------

foo.dts:

spi0: spi@f00bar {
	compatible = "FOOBAR";
};

/include/ "spi.dtsi"

---------------------------------------

What do you expect the resulting dtb to look like w/regards to the compatible node?

- k

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: dec behavior question
       [not found] ` <9942C069-D8EC-4133-B436-1DC5F62C502E-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
@ 2011-10-24 23:15   ` David Gibson
       [not found]     ` <20111024231529.GE4191-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: David Gibson @ 2011-10-24 23:15 UTC (permalink / raw)
  To: Kumar Gala; +Cc: devicetree-discuss

On Mon, Oct 24, 2011 at 09:01:49AM -0500, Kumar Gala wrote:
> If I have something like:
> 
> ---------------------------------------
> spi.dtsi:
> 
> &spi0 {
>         #address-cells = <1>;
>         #size-cells = <0>;
>         compatible = "fsl,mpc8536-espi";
>         reg = <0x7000 0x1000>;
>         interrupts = <59 0x2 0 0>;
> };
> ---------------------------------------
> 
> foo.dts:
> 
> spi0: spi@f00bar {
> 	compatible = "FOOBAR";
> };
> 
> /include/ "spi.dtsi"
> 
> ---------------------------------------
> 
> What do you expect the resulting dtb to look like w/regards to the
> compatible node?

It's always last tree wins.  So it will end up with compatible =
"FOOBAR".

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: dec behavior question
       [not found]     ` <20111024231529.GE4191-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
@ 2011-10-25 12:18       ` Yoder Stuart-B08248
       [not found]         ` <9F6FE96B71CF29479FF1CDC8046E1503253081-TcFNo7jSaXM0vywKSws3iq4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
  2011-10-25 13:23       ` Kumar Gala
  1 sibling, 1 reply; 8+ messages in thread
From: Yoder Stuart-B08248 @ 2011-10-25 12:18 UTC (permalink / raw)
  To: David Gibson, Kumar Gala; +Cc: devicetree-discuss



> -----Original Message-----
> From: devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org] On Behalf Of
> David Gibson
> Sent: Monday, October 24, 2011 6:15 PM
> To: Kumar Gala
> Cc: devicetree-discuss
> Subject: Re: dec behavior question
> 
> On Mon, Oct 24, 2011 at 09:01:49AM -0500, Kumar Gala wrote:
> > If I have something like:
> >
> > ---------------------------------------
> > spi.dtsi:
> >
> > &spi0 {
> >         #address-cells = <1>;
> >         #size-cells = <0>;
> >         compatible = "fsl,mpc8536-espi";
> >         reg = <0x7000 0x1000>;
> >         interrupts = <59 0x2 0 0>;
> > };
> > ---------------------------------------
> >
> > foo.dts:
> >
> > spi0: spi@f00bar {
> > 	compatible = "FOOBAR";
> > };
> >
> > /include/ "spi.dtsi"
> >
> > ---------------------------------------
> >
> > What do you expect the resulting dtb to look like w/regards to the
> > compatible node?
> 
> It's always last tree wins.  So it will end up with compatible = "FOOBAR".

If last wins, then it would be the included file
(compatible = "fsl,mpc8536-espi"), no?

Stuart

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: dec behavior question
       [not found]     ` <20111024231529.GE4191-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
  2011-10-25 12:18       ` Yoder Stuart-B08248
@ 2011-10-25 13:23       ` Kumar Gala
  1 sibling, 0 replies; 8+ messages in thread
From: Kumar Gala @ 2011-10-25 13:23 UTC (permalink / raw)
  To: David Gibson; +Cc: devicetree-discuss


On Oct 24, 2011, at 6:15 PM, David Gibson wrote:

> On Mon, Oct 24, 2011 at 09:01:49AM -0500, Kumar Gala wrote:
>> If I have something like:
>> 
>> ---------------------------------------
>> spi.dtsi:
>> 
>> &spi0 {
>>        #address-cells = <1>;
>>        #size-cells = <0>;
>>        compatible = "fsl,mpc8536-espi";
>>        reg = <0x7000 0x1000>;
>>        interrupts = <59 0x2 0 0>;
>> };
>> ---------------------------------------
>> 
>> foo.dts:
>> 
>> spi0: spi@f00bar {
>> 	compatible = "FOOBAR";
>> };
>> 
>> /include/ "spi.dtsi"
>> 
>> ---------------------------------------
>> 
>> What do you expect the resulting dtb to look like w/regards to the
>> compatible node?
> 
> It's always last tree wins.  So it will end up with compatible =
> "FOOBAR".

Than I think we have a bug in current dtc.

- k

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: dec behavior question
       [not found]         ` <9F6FE96B71CF29479FF1CDC8046E1503253081-TcFNo7jSaXM0vywKSws3iq4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
@ 2011-10-25 13:41           ` Kumar Gala
       [not found]             ` <0F565319-C054-4B46-8548-7BF4227BD237-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Kumar Gala @ 2011-10-25 13:41 UTC (permalink / raw)
  To: Yoder Stuart-B08248; +Cc: devicetree-discuss


On Oct 25, 2011, at 7:18 AM, Yoder Stuart-B08248 wrote:

> 
> 
>> -----Original Message-----
>> From: devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
>> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org] On Behalf Of
>> David Gibson
>> Sent: Monday, October 24, 2011 6:15 PM
>> To: Kumar Gala
>> Cc: devicetree-discuss
>> Subject: Re: dec behavior question
>> 
>> On Mon, Oct 24, 2011 at 09:01:49AM -0500, Kumar Gala wrote:
>>> If I have something like:
>>> 
>>> ---------------------------------------
>>> spi.dtsi:
>>> 
>>> &spi0 {
>>>        #address-cells = <1>;
>>>        #size-cells = <0>;
>>>        compatible = "fsl,mpc8536-espi";
>>>        reg = <0x7000 0x1000>;
>>>        interrupts = <59 0x2 0 0>;
>>> };
>>> ---------------------------------------
>>> 
>>> foo.dts:
>>> 
>>> spi0: spi@f00bar {
>>> 	compatible = "FOOBAR";
>>> };
>>> 
>>> /include/ "spi.dtsi"
>>> 
>>> ---------------------------------------
>>> 
>>> What do you expect the resulting dtb to look like w/regards to the
>>> compatible node?
>> 
>> It's always last tree wins.  So it will end up with compatible = "FOOBAR".
> 
> If last wins, then it would be the included file
> (compatible = "fsl,mpc8536-espi"), no?
> 
> Stuart

I don't believe so because the include of spi.dtsi doesn't actually instantiate a node.  This is a little different than use of 'include' for merging of nodes.

- k

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: dec behavior question
       [not found]             ` <0F565319-C054-4B46-8548-7BF4227BD237-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
@ 2011-10-25 23:36               ` David Gibson
       [not found]                 ` <20111025233643.GA5760-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: David Gibson @ 2011-10-25 23:36 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Yoder Stuart-B08248, devicetree-discuss

On Tue, Oct 25, 2011 at 08:41:55AM -0500, Kumar Gala wrote:
> 
> On Oct 25, 2011, at 7:18 AM, Yoder Stuart-B08248 wrote:
> 
> > 
> > 
> >> -----Original Message-----
> >> From: devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> >> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org] On Behalf Of
> >> David Gibson
> >> Sent: Monday, October 24, 2011 6:15 PM
> >> To: Kumar Gala
> >> Cc: devicetree-discuss
> >> Subject: Re: dec behavior question
> >> 
> >> On Mon, Oct 24, 2011 at 09:01:49AM -0500, Kumar Gala wrote:
> >>> If I have something like:
> >>> 
> >>> ---------------------------------------
> >>> spi.dtsi:
> >>> 
> >>> &spi0 {
> >>>        #address-cells = <1>;
> >>>        #size-cells = <0>;
> >>>        compatible = "fsl,mpc8536-espi";
> >>>        reg = <0x7000 0x1000>;
> >>>        interrupts = <59 0x2 0 0>;
> >>> };
> >>> ---------------------------------------
> >>> 
> >>> foo.dts:
> >>> 
> >>> spi0: spi@f00bar {
> >>> 	compatible = "FOOBAR";
> >>> };
> >>> 
> >>> /include/ "spi.dtsi"
> >>> 
> >>> ---------------------------------------
> >>> 
> >>> What do you expect the resulting dtb to look like w/regards to the
> >>> compatible node?
> >> 
> >> It's always last tree wins.  So it will end up with compatible = "FOOBAR".
> > 
> > If last wins, then it would be the included file
> > (compatible = "fsl,mpc8536-espi"), no?

Uh, yes, sorry.  I misread and assumed the /include/ came first.

> I don't believe so because the include of spi.dtsi doesn't actually
> instantiate a node.  This is a little different than use of
> 'include' for merging of nodes.

No, it really isn't.  /include/ is just a textual include.  If a node
is defined multiple times, properties in the last definition always
win.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: dec behavior question
       [not found]                 ` <20111025233643.GA5760-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
@ 2011-10-26  3:10                   ` Kumar Gala
       [not found]                     ` <DC6E364B-6427-4D7D-9605-BB5BCF890053-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Kumar Gala @ 2011-10-26  3:10 UTC (permalink / raw)
  To: David Gibson; +Cc: Yoder Stuart-B08248, devicetree-discuss


On Oct 25, 2011, at 6:36 PM, David Gibson wrote:

> On Tue, Oct 25, 2011 at 08:41:55AM -0500, Kumar Gala wrote:
>> 
>> On Oct 25, 2011, at 7:18 AM, Yoder Stuart-B08248 wrote:
>> 
>>> 
>>> 
>>>> -----Original Message-----
>>>> From: devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
>>>> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org] On Behalf Of
>>>> David Gibson
>>>> Sent: Monday, October 24, 2011 6:15 PM
>>>> To: Kumar Gala
>>>> Cc: devicetree-discuss
>>>> Subject: Re: dec behavior question
>>>> 
>>>> On Mon, Oct 24, 2011 at 09:01:49AM -0500, Kumar Gala wrote:
>>>>> If I have something like:
>>>>> 
>>>>> ---------------------------------------
>>>>> spi.dtsi:
>>>>> 
>>>>> &spi0 {
>>>>>       #address-cells = <1>;
>>>>>       #size-cells = <0>;
>>>>>       compatible = "fsl,mpc8536-espi";
>>>>>       reg = <0x7000 0x1000>;
>>>>>       interrupts = <59 0x2 0 0>;
>>>>> };
>>>>> ---------------------------------------
>>>>> 
>>>>> foo.dts:
>>>>> 
>>>>> spi0: spi@f00bar {
>>>>> 	compatible = "FOOBAR";
>>>>> };
>>>>> 
>>>>> /include/ "spi.dtsi"
>>>>> 
>>>>> ---------------------------------------
>>>>> 
>>>>> What do you expect the resulting dtb to look like w/regards to the
>>>>> compatible node?
>>>> 
>>>> It's always last tree wins.  So it will end up with compatible = "FOOBAR".
>>> 
>>> If last wins, then it would be the included file
>>> (compatible = "fsl,mpc8536-espi"), no?
> 
> Uh, yes, sorry.  I misread and assumed the /include/ came first.
> 
>> I don't believe so because the include of spi.dtsi doesn't actually
>> instantiate a node.  This is a little different than use of
>> 'include' for merging of nodes.
> 
> No, it really isn't.  /include/ is just a textual include.  If a node
> is defined multiple times, properties in the last definition always
> win.

So than is there a way to do this?

It seems that node references have to come after their use.  Not exactly sure why that would be the case.

---- the following is invalid ----

/dts-v1/;

&spi0 {
       compatible = "fsl,mpc8536-espi";
};

/{
        spi0: spi@0 {
              compatible = "kumar";
        };
};

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: dec behavior question
       [not found]                     ` <DC6E364B-6427-4D7D-9605-BB5BCF890053-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
@ 2011-10-26  4:00                       ` David Gibson
  0 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2011-10-26  4:00 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Yoder Stuart-B08248, devicetree-discuss

On Tue, Oct 25, 2011 at 10:10:03PM -0500, Kumar Gala wrote:
> 
> On Oct 25, 2011, at 6:36 PM, David Gibson wrote:
> 
> > On Tue, Oct 25, 2011 at 08:41:55AM -0500, Kumar Gala wrote:
> >> 
> >> On Oct 25, 2011, at 7:18 AM, Yoder Stuart-B08248 wrote:
> >> 
> >>> 
> >>> 
> >>>> -----Original Message-----
> >>>> From: devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> >>>> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org] On Behalf Of
> >>>> David Gibson
> >>>> Sent: Monday, October 24, 2011 6:15 PM
> >>>> To: Kumar Gala
> >>>> Cc: devicetree-discuss
> >>>> Subject: Re: dec behavior question
> >>>> 
> >>>> On Mon, Oct 24, 2011 at 09:01:49AM -0500, Kumar Gala wrote:
> >>>>> If I have something like:
> >>>>> 
> >>>>> ---------------------------------------
> >>>>> spi.dtsi:
> >>>>> 
> >>>>> &spi0 {
> >>>>>       #address-cells = <1>;
> >>>>>       #size-cells = <0>;
> >>>>>       compatible = "fsl,mpc8536-espi";
> >>>>>       reg = <0x7000 0x1000>;
> >>>>>       interrupts = <59 0x2 0 0>;
> >>>>> };
> >>>>> ---------------------------------------
> >>>>> 
> >>>>> foo.dts:
> >>>>> 
> >>>>> spi0: spi@f00bar {
> >>>>> 	compatible = "FOOBAR";
> >>>>> };
> >>>>> 
> >>>>> /include/ "spi.dtsi"
> >>>>> 
> >>>>> ---------------------------------------
> >>>>> 
> >>>>> What do you expect the resulting dtb to look like w/regards to the
> >>>>> compatible node?
> >>>> 
> >>>> It's always last tree wins.  So it will end up with compatible = "FOOBAR".
> >>> 
> >>> If last wins, then it would be the included file
> >>> (compatible = "fsl,mpc8536-espi"), no?
> > 
> > Uh, yes, sorry.  I misread and assumed the /include/ came first.
> > 
> >> I don't believe so because the include of spi.dtsi doesn't actually
> >> instantiate a node.  This is a little different than use of
> >> 'include' for merging of nodes.
> > 
> > No, it really isn't.  /include/ is just a textual include.  If a node
> > is defined multiple times, properties in the last definition always
> > win.
> 
> So than is there a way to do this?

No way to do what?  I don't see what it is you want that isn't what
you're getting.

> It seems that node references have to come after their use.  Not
> exactly sure why that would be the case.
> 
> ---- the following is invalid ----
> 
> /dts-v1/;
> 
> &spi0 {
>        compatible = "fsl,mpc8536-espi";
> };
> 
> /{
>         spi0: spi@0 {
>               compatible = "kumar";
>         };
> };

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-10-26  4:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 14:01 dec behavior question Kumar Gala
     [not found] ` <9942C069-D8EC-4133-B436-1DC5F62C502E-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2011-10-24 23:15   ` David Gibson
     [not found]     ` <20111024231529.GE4191-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-10-25 12:18       ` Yoder Stuart-B08248
     [not found]         ` <9F6FE96B71CF29479FF1CDC8046E1503253081-TcFNo7jSaXM0vywKSws3iq4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
2011-10-25 13:41           ` Kumar Gala
     [not found]             ` <0F565319-C054-4B46-8548-7BF4227BD237-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2011-10-25 23:36               ` David Gibson
     [not found]                 ` <20111025233643.GA5760-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2011-10-26  3:10                   ` Kumar Gala
     [not found]                     ` <DC6E364B-6427-4D7D-9605-BB5BCF890053-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2011-10-26  4:00                       ` David Gibson
2011-10-25 13:23       ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox