Re: [PATCH] external references for device tree overlays

From: Stefani Seibold
Date: Thu Jun 08 2017 - 02:51:23 EST


On Wed, 2017-06-07 at 17:19 -0500, Rob Herring wrote:
> On Wed, Jun 7, 2017 at 3:11 AM, Pantelis Antoniou
> <pantelis.antoniou@xxxxxxxxxxxx> wrote:
> > Hi Stefani,
> >
> > On Tue, 2017-06-06 at 21:17 +0200, Stefani Seibold wrote:
> > > Hi Pantelis,
> > >
> > > thanks for the suggestion. This feature is not very well
> > > documented. I
> > > tried this on my rasp1 running 4.12.0-rc3 and it doesn't work. My
> > > source is:
> > >
> > > // rapsi example
> > > /dts-v1/;
> > > /plugin/;
> > >
> > > / {
> > > ÂÂÂÂcompatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
> > >
> > > ÂÂÂÂfragment@0 {
> > > ÂÂÂÂÂÂÂÂtarget-path = "/soc/i2s@7e203000";
> > > ÂÂÂÂÂÂÂÂ__overlay__ {
> > > ÂÂÂÂÂÂÂÂÂÂÂÂ#address-cells = <0x00000001>;
> > > ÂÂÂÂÂÂÂÂÂÂÂÂ#size-cells = <0x00000001>;
> > > ÂÂÂÂÂÂÂÂÂÂÂÂtest = "test";
> > > ÂÂÂÂÂÂÂÂÂÂÂÂtimer = <&{/soc/timer@7e0030000}>;
> > > ÂÂÂÂÂÂÂÂ};
> > > ÂÂÂÂ};
> > > };
> > >
> > >
> > > The resulting overlay is (decompiled with fdtdump):
> > >
> > > /dts-v1/;
> > > // magic:ÂÂÂÂÂÂÂÂÂÂÂÂÂ0xd00dfeed
> > > // totalsize:ÂÂÂÂÂÂÂÂÂ0x19a (410)
> > > // off_dt_struct:ÂÂÂÂÂ0x38
> > > // off_dt_strings:ÂÂÂÂ0x148
> > > // off_mem_rsvmap:ÂÂÂÂ0x28
> > > // version:ÂÂÂÂÂÂÂÂÂÂÂ17
> > > // last_comp_version: 16
> > > // boot_cpuid_phys:ÂÂÂ0x0
> > > // size_dt_strings:ÂÂÂ0x52
> > > // size_dt_struct:ÂÂÂÂ0x110
> > >
> > > / {
> > > ÂÂÂÂcompatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
> > > ÂÂÂÂfragment@0 {
> > > ÂÂÂÂÂÂÂÂtarget-path = "/soc/i2s@7e203000";
> > > ÂÂÂÂÂÂÂÂ__overlay__ {
> > > ÂÂÂÂÂÂÂÂÂÂÂÂ#address-cells = <0x00000001>;
> > > ÂÂÂÂÂÂÂÂÂÂÂÂ#size-cells = <0x00000001>;
> > > ÂÂÂÂÂÂÂÂÂÂÂÂtest = "test";
> > > ÂÂÂÂÂÂÂÂÂÂÂÂtimer = <0xdeadbeef>;
> > > ÂÂÂÂÂÂÂÂ};
> > > ÂÂÂÂ};
> > > ÂÂÂÂ__fixups__ {
> > > ÂÂÂÂÂÂÂÂ/soc/timer@7e0030000 = "/fragment@0/__overlay__:timer:0";
> > > ÂÂÂÂ};
> > > };
> > >
> > > But this will not apply:
> > >
> > > OF: resolver: overlay phandle fixup failed: -22
> > > create_overlay: Failed to resolve tree
> > >
> > >
> >
> > Yes, it will not work as it is; my point is that you don't need the
> > magic __*__ node.
> >
> > You will need to modify the overlay application code to live insert
> > a
> > phandle (if it doesn't exist) when it encounters a /path fixup.
>
> phandles only exist if something in the base tree refers to that
> node.
> Adding them when they don't exist should definitely be something we
> support for overlays. But don't call that a broken DT. That would be
> a
> separate issue.
>

Believe me it is broken. Due a NDA i am not able to give you more
details about the vendor. But there forgot do provide an device node
which must refer to the attached network and interrupt controller.

- Stefani