Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing Predefined Device Tree Node with No Label in another File

Hello I have a device tree that looks like this. I need to reference the dma@40400000 node in another file where this device tree is included. In this device tree the dma@40400000 node does not have a label.

device-tree1.dtsi

/dts-v1/;
/ {
    amba_pl {
    #address-cells = <0x1>;
    #size-cells = <0x1>;
    compatible = "simple-bus";
    ranges;

    dma@40400000 {
        #dma-cells = <0x1>;
        clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
        clocks = <0x1 0xf 0x1 0xf 0x1 0xf 0x1 0xf>;
        compatible = "xlnx,axi-dma-1.00.a";
        interrupt-parent = <0x4>;
        interrupts = <0x0 0x1d 0x4 0x0 0x1e 0x4>;
        reg = <0x40400000 0x10000>;
        xlnx,addrwidth = <0x20>;

        dma-channel@40400000 {
            compatible = "xlnx,axi-dma-mm2s-channel";
            dma-channels = <0x1>;
            interrupts = <0x0 0x1d 0x4>;
            xlnx,datawidth = <0x20>;
            xlnx,device-id = <0x0>;
        };

        dma-channel@40400030 {
            compatible = "xlnx,axi-dma-s2mm-channel";
            dma-channels = <0x1>;
            interrupts = <0x0 0x1e 0x4>;
            xlnx,datawidth = <0x20>;
            xlnx,device-id = <0x0>;
        };
    };
};
};

I would like to redefine it or optionally the amba_pl node such that the node dma@40400000 is not changed but has a label axi_dma

device-tree2.dtsi

/include/ "device-tree1.dtsi"
/ {
&amba_pl {  
        axi_dma: dma@40400000 {
            #dma-cells = <0x1>;
            clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
            clocks = <0x1 0xf 0x1 0xf 0x1 0xf 0x1 0xf>;
            compatible = "xlnx,axi-dma-1.00.a";
            interrupt-parent = <0x4>;
            interrupts = <0x0 0x1d 0x4 0x0 0x1e 0x4>;
            reg = <0x40400000 0x10000>;
            xlnx,addrwidth = <0x20>;

            dma-channel@40400000 {
                compatible = "xlnx,axi-dma-mm2s-channel";
                dma-channels = <0x1>;
                interrupts = <0x0 0x1d 0x4>;
                xlnx,datawidth = <0x20>;
                xlnx,device-id = <0x0>;
            };

            dma-channel@40400030 {
                compatible = "xlnx,axi-dma-s2mm-channel";
                dma-channels = <0x1>;
                interrupts = <0x0 0x1e 0x4>;
                xlnx,datawidth = <0x20>;
                xlnx,device-id = <0x0>;
            };
        };
    };
};

However when I try to redefine amba_pl from device-tree1.dtsi in device-tree2.dtsi, the compiler fails to parse the device tree. How can I add a label to the node dma@40400000 from device-tree1.dtsi?

UPDATE

Having looked through the spec, I want to reword my question. How can I add a phandle to a node that is included from a different dtsi file or reference the node without a phandle?

like image 698
John Frye Avatar asked Dec 06 '25 16:12

John Frye


1 Answers

What you are trying to do is perfectly possible (I just tested it, just in case). If you are having a compiler error, my guess is that there is a syntax error.

Two notes before continuing: 1) perhaps you should consider update your question showing the full dtc compiler error. 2) keep in mind @sawdust comment about both files being .dtsi suffixed.

Now, about your error. I'm only guessing but it seems your are mixing phandles are "full path" references.

Your pasted dtsi, which is wrong

/include/ "device-tree1.dtsi"
/ {
    &amba_pl { /* wrong, amba_pl is not a phandle, can't use & */
        axi_dma: dma@40400000 {
        /* properties here */

        dma-channel@40400000 {
          /* blah */
        };
      };
    };
};

Correct

/include/ "device-tree1.dtsi"
/ {
    amba_pl {
        axi_dma: dma@40400000 {

            /* properties here */

            dma-channel@40400000 {
                /* blah */
            };
        };
    };
};
like image 122
Ezequiel Garcia Avatar answered Dec 09 '25 15:12

Ezequiel Garcia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!