Re: [PATCH 0/7] of: overlay: Add support for export-symbols node feature
From: Herve Codina
Date: Tue Dec 10 2024 - 03:16:14 EST
Hi Rob,
On Mon, 9 Dec 2024 14:11:09 -0600
Rob Herring <robh@xxxxxxxxxx> wrote:
...
> >
> > Our overlay using the nexus node can contains:
> > node {
> > foo-gpio = <&connector 0 GPIO_ACTIVE_HIGH>;
> > };
>
> Couldn't we make something like this work:
>
> connector: __overlay__ {
>
> node {
> foo-gpio = <&connector 0 GPIO_ACTIVE_HIGH>;
> };
> };
>
> We already have to process all the phandles in the overlay. So this
> just changes handling of 'connector' from being a local phandle which
> we just renumber to an unresolved phandle which we have to lookup and
> replace the phandle uses with.
>
I have tried what you suggested but I've got some issues with dtc.
If a label is not used as a phandle in a dts, dtc doesn't create the phandle
property in the pointed node (except if we use '-@' option but I don't want
to add all symbols in my dtb just for one or two connector symbols).
The way to make sure that the phandle property will be created in the base
DT node by dtc is to reference the label as a phandle in the base DT.
The export-symbols node references this label as a phandle in the base DT
and so, with that, dtc creates the phandle property.
Also, using 'connector: __overlay__' allows to have only one label from
the base DT to be referenced by the overlay.
I don't know if use cases exist where more than one label need to be
referenced but this 'one label' constraint is not present with the
export-symbols node.
The use case where more than one label would be needed is the need for a
phandle from the overlay that couldn't be translated by the connector nexus
node. Maybe pinctrl because it uses of_find_node_by_phandle().
Last point, having export-symbols node makes some nodes explicitly
candidates for an overlay and defines the label to be used on the base DT
node side. This specific label can be described in the node binding as well
as the nexus node properties.
With 'connector: __overlay__', the overlay can be applied on any nodes, at
least from the needed label point of view without any restrictions.
With all of that, I discarded the 'connector: __overlay__' description.
Best regards,
Hervé