3

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?

1
  • FYI per the Devicetree specification: "The name of include files should end with “.dtsi”.", and not .dts as you have. See devicetree.org/specifications Commented Feb 1, 2018 at 1:29

1 Answer 1

2

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 */
            };
        };
    };
};
Sign up to request clarification or add additional context in comments.

1 Comment

I'm also referencing nodes without labels in included dtsi files (just simple redefinitions). I'm using that syntax to access the node: &{/backlight} { /* foo */ };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.