【问题标题】:Add Property to Linux Device Tree from other FIle从其他文件向 Linux 设备树添加属性
【发布时间】:2019-04-14 16:48:42
【问题描述】:

我有一个工具可以自动为带有自定义外设的嵌入式系统生成设备树。我需要在这个自动生成的文件中引用一个节点并向节点添加属性而不实际更改自动生成的文件,因为每次构建内核/设备树/船载程序等时它都会被覆盖。我不完全是确定如何做到这一点。 在名为 pl.dtsi 的自动生成文件中,设备树节点如下所示

vid_phy_controller_0: vid_phy_controller@80060000 {
        clock-names = "mgtrefclk0_pad_p_in", "mgtrefclk0_pad_n_in", "mgtrefclk1_pad_p_in", "mgtrefclk1_pad_n_in", "gtnorthrefclk1_in", "gtnorthrefclk1_odiv2_in", "vid_phy_tx_axi4s_aclk", "vid_phy_rx_axi4s_aclk", "vid_phy_sb_aclk", "vid_phy_axi4lite_aclk", "drpclk";
        clocks = <&misc_clk_2>, <&misc_clk_2>, <&misc_clk_2>, <&misc_clk_2>, <&misc_clk_2>, <&misc_clk_2>, <&misc_clk_0>, <&misc_clk_0>, <&clk 71>, <&clk 71>, <&clk 71>;
        compatible = "xlnx,vid-phy-controller-2.2", "xlnx,vid-phy-controller-2.1";
        interrupt-names = "irq";
        interrupt-parent = <&gic>;
        interrupts = <0 89 4>;
        reg = <0x0 0x80060000 0x0 0x10000>;
        xlnx,hdmi-fast-switch = <1>;
        xlnx,input-pixels-per-clock = <2>;
        xlnx,nidru = <1>;
        xlnx,nidru-refclk-sel = <3>;
        xlnx,rx-no-of-channels = <3>;
        xlnx,rx-pll-selection = <0>;
        xlnx,rx-protocol = <1>;
        xlnx,rx-refclk-sel = <1>;
        xlnx,transceiver-type = <5>;
        xlnx,transceiver-width = <2>;
        xlnx,tx-buffer-bypass = <1>;
        xlnx,tx-no-of-channels = <3>;
        xlnx,tx-pll-selection = <6>;
        xlnx,tx-protocol = <1>;
        xlnx,tx-refclk-sel = <0>;
        vphy_lane0: vphy_lane@0 {
            #phy-cells = <4>;
        };
        vphy_lane1: vphy_lane@1 {
            #phy-cells = <4>;
        };
        vphy_lane2: vphy_lane@2 {
            #phy-cells = <4>;
        };
        vphy_lane3: vphy_lane@3 {
            #phy-cells = <4>;
        };
    };

我需要添加一个“时钟名称”和我已经拥有 phandle 的相应时钟,基于时钟与列出的其他时钟名称下引用的时钟相同的事实。我只需要知道如何从另一个设备树文件中触摸这个节点。

显然我需要包含对 pl.dtsi 文件的引用

/include/ "pl.dtsi"

但在那之后我如何引用 vid_phy_controller_0 phandle 以及将字符串/时钟引用添加到其属性的语法是什么

【问题讨论】:

    标签: embedded-linux device-tree


    【解决方案1】:

    您可以定义自己的设备树文件,其中包括 pl.dtsi 文件。在您的设备树文件中,您可以添加所需的属性,如下所示。

    &vid_phy_controller_0 {
            clocks = <..>;
            clock-names = <..>;
    };
    

    请注意,要编译您自己的设备树文件,您必须相应地将其添加到 Makefile。

    【讨论】:

      猜你喜欢
      • 2017-11-26
      • 1970-01-01
      • 1970-01-01
      • 2012-04-11
      • 2013-08-30
      • 2019-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多