Query on device tree phandles

victorascroft at gmail.com victorascroft at gmail.com
Thu May 28 09:46:29 EDT 2015


Hello,

On 15-05-28 18:57:07, victorascroft at gmail.com wrote:
> Hello Carlo,
> 
> On 15-05-26 16:26:45, Carlo Caione wrote:
> > On Mon, May 25, 2015 at 11:02 AM,  <victorascroft at gmail.com> wrote:
> > > Hello,
> > >
> > > I have a query related to device tree. If I have three nodes as below
> > >
> > > node1: node1 at addr1 {
> > >        compatible ="name1", "syscon";
> > >        }
> > >
> > > node2: node1 at addr2 {
> > >        compatible ="name2", "syscon";
> > >        }
> > >
> > > node3: node1 at addr3 {
> > >        compatible ="name3", "syscon";
> > >        }
> > >
> > >
> > > At the top soc node, I define phandles as follows
> > >
> > > node-phandle1 = <&node1 0x10>
> > > node-phandle2 = <&node2 0x20>
> > > node-phandle3 = <&node3 0x30>
> > >
> > > How can I read the values of 0x10, 0x20 and 0x30 while using the node-phandlex
> > > property? Is it possible using one of the of_* functions?
> > >
> > > The driver binds to one of the syscon nodes above lets say node3.
> > 
> > http://lxr.free-electrons.com/source/drivers/of/base.c#L1597
> 
> Thanks. This worked out. Is it also possible to read a clock reference for
> enabling a clock?
> 
> node1 : node at addr1 {
>       compatible = "name1";
>       node2-phandle = <&node2>;
>       }
> 
> node2 : node at addr2 {
>       compatible = "name2";
>       clocks = <&clks DEVICE_CLK_PER>;
>       }
> 
> In the driver of node 1 I can get node2 and map it. Would it be possible
> to get the clock reference for enabling the clock. Basically node2 does
> not have the driver and node 1 would require access to node 2 peripheral.

I guess of_clk_get does it.

- Victor



More information about the Kernelnewbies mailing list