Reputation: 583
I have a tool that is automatically generating a device tree for an embedded system with custom peripherals. I need to reference a node in this auto-generated file and add properties to the node without actually changing the auto-generated file since it will be overwritten each time I build the kernel/device-tree/boatloaders, etc. I am not exactly sure how to do this. In the auto-generated file called pl.dtsi the device tree node looks like this
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>;
};
};
I need to add a "clock-name" and corresponding clock for which I already have the phandle, based on the fact that the clock is the same clock this is referenced under other clock-names listed. I just need to know how to touch this node from another device tree file.
Clearly I will need to include a reference to the pl.dtsi file
/include/ "pl.dtsi"
But after that how do I reference the vid_phy_controller_0 phandle and what is the syntax for adding strings/clock references to its properties
Upvotes: 0
Views: 2329
Reputation:
You can define your own device tree file which includes the pl.dtsi file. In your device tree file, you can then add the required properties as below.
&vid_phy_controller_0 {
clocks = <..>;
clock-names = <..>;
};
Note that to compile your own device tree file, you will have to add it to the Makefile accordingly.
Upvotes: 2