dec behavior question

Kumar Gala galak at kernel.crashing.org
Wed Oct 26 14:10:03 EST 2011


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 at lists.ozlabs.org
>>>> [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com at lists.ozlabs.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 at 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 at 0 {
              compatible = "kumar";
        };
};


More information about the devicetree-discuss mailing list