gpt4 book ai didi

linux - 在另一个文件中引用没有标签的预定义设备树节点

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:36:22 28 4
gpt4 key购买 nike

你好,我有一个看起来像这样的设备树。我需要在包含此设备树的另一个文件中引用 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 的节点?

最佳答案

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

继续之前的两个注意事项: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 */
};
};
};
};

关于linux - 在另一个文件中引用没有标签的预定义设备树节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48552963/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com