home | list info | list archive | date index | thread index

[OCLUG-Tech] puzzled by something regarding labels in device tree source files

  • Subject: [OCLUG-Tech] puzzled by something regarding labels in device tree source files
  • From: "Robert P. J. Day" <rpjday [ at ] crashcourse [ dot ] ca>
  • Date: Tue, 01 Mar 2016 07:56:14 -0500
  a minor curiosity about labels in DTS files ... as an example, let's pick
on some powerpc 8544-related files under arch/powerpc/boot/dts/fsl, and show
some snippets:

mpc8544ds.dts:
=============

/include/ "mpc8544si-pre.dtsi"        <---- irrelevant

/ {
        model = "MPC8544DS";
        compatible = "MPC8544DS", "MPC85xxDS";

        memory {
                device_type = "memory";
                reg = <0 0 0 0>;        // Filled by U-Boot
        };

        board_lbc: lbc: localbus@e0005000 {
                reg = <0 0xe0005000 0 0x1000>;

                ranges = <0x0 0x0 0x0 0xff800000 0x800000>;
        };
        ... big snip ...
/*
 * mpc8544ds.dtsi must be last to ensure board_pci3 overrides pci3 settings
 * for interrupt-map & interrupt-map-mask
 */

/include/ "mpc8544si-post.dtsi"
/include/ "mpc8544ds.dtsi"
/* end of file */

  so i can see that that "localbus" line above defines, not one, but two
labels for that node, correct? not sure why, until i keep reading files:

mpc8544si-post.dtsi:
====================

&lbc {
        #address-cells = <2>;
        #size-cells = <1>;
        compatible = "fsl,mpc8544-lbc", "fsl,pq3-localbus", "simple-bus";
        interrupts = <19 2 0 0>;
};
... snip rest of file ...

  so that included file uses the label "lbc" to extend the node for
localbus, which is perfectly fine, and then we get to the last included
file:

mpc8544ds.dtsi:
==============

&board_lbc {
        nor@0,0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "cfi-flash";
                reg = <0x0 0x0 0x800000>;
                bank-width = <2>;
                device-width = <1>;
                ... lots more snip ...

  is there some technical reason that these files were written so that one
included file used the "lbc" label and the other used the "board_lbc" label
to refer to what appears to be the same localbus node?

  i'm sure it works, but is there some reason to define more than one label
for a node for later manipulation?

rday