What is the meaning of a phandle when used as device tree node name?

Irr picture Irr · Jun 28, 2015 · Viewed 9.8k times · Source

This code snippet comes from the device tree for the RIoTBoard (/arch/arm/boot/dts/imx6dl-riotboard.dts)

&hdmi {
         ddc-i2c-bus = <&i2c2>;
         status = "okay";
};

I have gone through the device tree documentation both on devicetree.org and in the documentation/devicetree folder of the linux kernel, but I am not able to find any description of the meaning of a phandle when used as node name.

Answer

a.saurabh picture a.saurabh · Jul 27, 2015

You can understand phandle as some kind of pointer for the node which points to the definition of that node which is either kept in the same file or the other file. I can explain phandle concept taking example from the below link for AM33xx SoC clocks file:

http://lxr.free-electrons.com/source/arch/arm/boot/dts/am33xx-clocks.dtsi

Below is the functional clock for watchdog:

wdt1_fck: wdt1_fck {
             #clock-cells = <0>;
             compatible = "ti,mux-clock";
             clocks = <&clk_rc32k_ck>, <&clkdiv32k_ick>;
             reg = <0x0538>;
};

Now wdt1_fck has two parent clocks sources: clk_rc32k_ck and clkdiv32k_ick

These are phandles or you can say pointers to their clock definitions:

clk_rc32k_ck: clk_rc32k_ck {
             #clock-cells = <0>;
             compatible = "fixed-clock";
             clock-frequency = <32000>;
};

clkdiv32k_ick: clkdiv32k_ick {
             #clock-cells = <0>;
             compatible = "ti,gate-clock";
             clocks = <&clkdiv32k_ck>;
             ti,bit-shift = <1>;
             reg = <0x014c>;
};

So basically phandle enables to use the definitions of nodes across the files.