【问题标题】:Referencing Predefined Device Tree Node with No Label in another File引用另一个文件中没有标签的预定义设备树节点
【发布时间】:2018-02-05 07:47:28
【问题描述】:

您好,我有一个看起来像这样的设备树。我需要在包含此设备树的另一个文件中引用 dma@40400000 节点。在此设备树中,dma@40400000 节点没有标签。

设备树1.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>;
        };
    };
};
};

我想重新定义它或可选地重新定义 amba_pl 节点,以便节点 dma@40400000 不会更改但具有标签 axi_dma

设备树2.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>;
            };
        };
    };
};

但是,当我尝试从 device-tree2.dtsi 中的 device-tree1.dtsi 重新定义 amba_pl 时,编译器无法解析设备树。如何从 device-tree1.dtsi 向节点 dma@40400000 添加标签?

更新

浏览了规范后,我想重新提出我的问题。 如何将 phandle 添加到包含在不同 dtsi 文件中的节点或引用没有 phandle 的节点?

【问题讨论】:

  • 根据 Devicetree 规范仅供参考:“包含文件的名称应以 “.dtsi” 结尾。”,而不是 。 dts 就像你一样。见devicetree.org/specifications

标签: linux embedded-linux device-tree


【解决方案1】:

您尝试做的事情是完全可能的(我刚刚测试过,以防万一)。如果你遇到编译器错误,我猜是语法错误。

在继续之前有两个注意事项:1)也许您应该考虑更新您的问题,以显示完整的 dtc 编译器错误。 2) 请记住@sawdust 对两个文件均以 .dtsi 为后缀的评论。

现在,关于您的错误。我只是在猜测,但似乎您正在混合 phandles 是“完整路径”引用。

您粘贴的 dtsi,这是错误的

/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 */
        };
      };
    };
};

正确

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

            /* properties here */

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

【讨论】:

  • 我还在包含的 dtsi 文件中引用没有标签的节点(只是简单的重新定义)。我正在使用该语法访问节点:&amp;{/backlight} { /* foo */ };
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-30
相关资源
最近更新 更多