Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 395
Irr Avatar asked Dec 15 '22 13:12

Irr


2 Answers

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.

like image 139
a.saurabh Avatar answered Dec 17 '22 03:12

a.saurabh


I'll answer with a example:

label:node {
  #address-cell = <1>;
  #size-cells = <0>;
}

&label {
  proporties = <2>;
};

Means:

label:node {
  #address-cell = <1>;
  #size-cells = <0>;
  proporties = <2>;
}
like image 27
A Clemotte Avatar answered Dec 17 '22 02:12

A Clemotte