* [U-Boot] Accessing nested device tree nodes via phandle
@ 2016-12-20 15:53 Vlad Zakharov
2017-01-12 5:07 ` Simon Glass
0 siblings, 1 reply; 2+ messages in thread
From: Vlad Zakharov @ 2016-12-20 15:53 UTC (permalink / raw)
To: u-boot
Hi everybody,?
I am working on reorganization of device trees for ARC boards in U-Boot in order to create a common device tree blob for
both Linux and U-Boot.
And I've struggled with a kind of problem and need some help.
On AXS10x motherboard clocks for various peripherals are managed by one hardware block, so clock nodes in Linux device
tree are grouped into one "clocks" node like this:
---------------------------------->8------------------------------------
clocks {
????i2cclk: i2cclk {
????????compatible = "fixed-clock";
????????clock-frequency = <50000000>;
????????#clock-cells = <0>;
????};
?...
?...
?...
? ? uartclk: uartclk {
????????compatible = "fixed-clock";
????????clock-frequency = <33333333>;
????????#clock-cells = <0>;
????}; ?
};
---------------------------------->8------------------------------------
And then some of them a referenced via phandle from other nodes, e.g. &uartclk is referenced from uart node.
When I try to create such hierarchy in U-Boot I find that uart driver is not able to get clock via phandle and
corresponding uart doesn't work.?
As I understand that is because children clocks nodes, i.e. "uartclk" in my case, never got bound as it's parent node
"clocks" never got bound too.
So when I add "compatible" and "u-boot,dm-pre-reloc" properties to "clocks" parent node everything works fine, e.g.:
---------------------------------->8------------------------------------
clocks {
? ? compatible = "simple-bus";
? ? u-boot,dm-pre-reloc;
? ? uartclk: uartclk {
????????compatible = "fixed-clock";
?
???????clock-frequency = <33333333>;
????????#clock-cells = <0>;
????};?
?...
?...
?...
};
---------------------------------->8------------------------------------
Please correct me if I wrongly interpret such behavior.
I wonder if it the only approach to implement Linux-like hierarchy for ARC? Or I am mistaken and in fact can use pure
Linux device tree without adding properties, described above?
Thank you!
--
Best regards,
Vlad Zakharov <vzakhar@synopsys.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [U-Boot] Accessing nested device tree nodes via phandle
2016-12-20 15:53 [U-Boot] Accessing nested device tree nodes via phandle Vlad Zakharov
@ 2017-01-12 5:07 ` Simon Glass
0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2017-01-12 5:07 UTC (permalink / raw)
To: u-boot
Hi Vlad,
On 20 December 2016 at 08:53, Vlad Zakharov
<Vladislav.Zakharov@synopsys.com> wrote:
> Hi everybody,
>
> I am working on reorganization of device trees for ARC boards in U-Boot in order to create a common device tree blob for
> both Linux and U-Boot.
>
> And I've struggled with a kind of problem and need some help.
>
> On AXS10x motherboard clocks for various peripherals are managed by one hardware block, so clock nodes in Linux device
> tree are grouped into one "clocks" node like this:
> ---------------------------------->8------------------------------------
> clocks {
> i2cclk: i2cclk {
> compatible = "fixed-clock";
> clock-frequency = <50000000>;
> #clock-cells = <0>;
> };
> ...
> ...
> ...
> uartclk: uartclk {
> compatible = "fixed-clock";
> clock-frequency = <33333333>;
> #clock-cells = <0>;
> };
> };
> ---------------------------------->8------------------------------------
> And then some of them a referenced via phandle from other nodes, e.g. &uartclk is referenced from uart node.
>
> When I try to create such hierarchy in U-Boot I find that uart driver is not able to get clock via phandle and
> corresponding uart doesn't work.
>
> As I understand that is because children clocks nodes, i.e. "uartclk" in my case, never got bound as it's parent node
> "clocks" never got bound too.
> So when I add "compatible" and "u-boot,dm-pre-reloc" properties to "clocks" parent node everything works fine, e.g.:
> ---------------------------------->8------------------------------------
> clocks {
> compatible = "simple-bus";
> u-boot,dm-pre-reloc;
> uartclk: uartclk {
> compatible = "fixed-clock";
>
> clock-frequency = <33333333>;
> #clock-cells = <0>;
> };
> ...
> ...
> ...
> };
> ---------------------------------->8------------------------------------
>
> Please correct me if I wrongly interpret such behavior.
>
> I wonder if it the only approach to implement Linux-like hierarchy for ARC? Or I am mistaken and in fact can use pure
> Linux device tree without adding properties, described above?
Yes you have it right. I'm not sure what linux is doing here - does it
look for a node called 'clocks'? To my mind, U-Boot is the more
correct.
Regards,
Simon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-12 5:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-20 15:53 [U-Boot] Accessing nested device tree nodes via phandle Vlad Zakharov
2017-01-12 5:07 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox