Re: [RFC] Adding export-symbols to specification

Herve Codina <[email protected]>
Newsgroups org.kernel.vger.devicetree-spec
Organization Bootlin
Message-ID <[email protected]>
On Tue, 4 Feb 2025 22:54:52 +0530
Ayush Singh <[email protected]> wrote:

> > You have perfectly summarized the export-symbols goal and the benefit of
> > this new feature.
> >
> > I am waiting for feedback from other people. I hope we will move forward
> > on this topic and unblock several users (me included) stuck on this real
> > issue.
> >
> > Thanks a lot!
> >
> > Best regards,
> > Hervé  
> 
> While working on a Patch series to the specification itself, I realized 
> that I was missing some edge cases, so wanted to discuss those:
> 
> # Scope
> 
> Should export-symbols only be used to resolve the properties in parent, 
> or should all other children (and their decedents) use the 
> `export-symbols` for resolving phandles and path references?
> 
> For example, should the following work:
> 
> 
> parent {
> 
>      sibling {
> 
>          led = <&gpio 0 GPIO_ACTIVE_HIGH>
> 
>      };
> 
> 
>      export-symbols {
> 
>          gpio = <&my_gpio1>;
> 
>      };
> 
> };
> 
> 
> This would also mean that bottoms up lookup needs to take place for all 
> `export-symbols` that might be present in path to root, before using top 
> level `__symbols__` or `/aliases`.

I restricted the use of export-symbols node when an overlay is applied at a node
which contains an export-symbols sub-node.

In your example, If you apply an overlay at parent node, your export-symbols
is used but if you apply an overlay at sibling node, your export-symbols is
not used.

Of course if your overlay applied at parent node looks like the following:

  __overlay__ {
    sibling {
       prop = <&gpio>;
    };
  };

&gpio will be resolved using your export-symbols. __overlay__ is applied
at parent -> visible in the overlay.

If the base device-tree looks like this:
	parent {
		sibling {
 
			export-symbols {
				gpio = <&my_gpio1>;
			};
		};
	};

The same overlay applied at parent will failed.
Indeed, no export-symbols is available at parent node and so the
gpio symbols used by the overlay will not be resolved even
if an export-symbols exists in the sibling node.
To see this export-symbols from the overlay, the overlay has to be applied
at sibling node and not parent node.

> 
> 
> # Export symbols phandles
> 
> Can export symbols reference each other? For example is the following valid:
> 
> 
> parent {
> 
>      export-symbols {
> 
>          shadow_gpio = <&my_gpio1>;
> 
>          gpio = <&shadow_gpio>;
> 
>      };
> 
> };

For sure, not planned.

Also, maybe I missed something but I am not sure you can have a
phandle referencing a property.

In your example, shadow_gpio is a property, even if we add a label
to this property i.e.
  label_shadow_gpio: shadow_gpio = <&my_gpio1>;

How can we set:
  gpio = <&label_shadow_gpio>;


Best regards,
Hervé
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.