Re: [PATCH v3 0/2] Add capability to append to property
Ayush Singh <[email protected]>
| Newsgroups | org.kernel.vger.devicetree-compiler |
|---|---|
| Message-ID | <[email protected]> |
On 10/12/24 21:04, Andreas Gnau wrote:
> On 2024-11-11 10:54, Ayush Singh wrote:
>> Allow appending values to a property instead of overriding the previous
>> values of property.
>>
>> Currently, we have /delete-node/ and /delete-property/, but lack
>> /append-property/. Hence we end up having to repeat all existing values
>> when appending to a property (e.g. see [1] appending to clocks from
>> [2]).
>>
>> This functionality is also important for creating a device tree based
>> implementation to support different types of addon-boards such as
>> mikroBUS, Grove [3], etc.
>>
>> In practice, it looks as follows:
>>
>> ```
>> dts-v1/;
>>
>> / {
>> str-prop = "0";
>> };
>>
>> / {
>> /append-property/ str-prop = "1";
>> };
>> ```
>
> If we add /append-property/, why not add /prepend-property/ as well?
> This is not only "nice for consistency", but it would also enable
> solving a problem where SoC compatible strings from dtsi [1] need to be
> repeated in board dts [2], because one cannot prepend to an existing
> property.
>
> ```
> dts-v1/;
> / {
> compatible = "soc-vendor,soc1234";
> };
>
> / {
> /prepend-property/ compatible = "board-vendor,board-xyz";
> };
> ```
>
> What do you think?
>
> [1] https://elixir.bootlin.com/linux/v6.12.4/source/arch/arm64/boot/dts/
> renesas/r8a77951.dtsi#L18
> [2] https://elixir.bootlin.com/linux/v6.12.4/source/arch/arm64/boot/dts/
> renesas/r8a77951-salvator-xs.dts#L14
Well, it does seem useful. I can implement it after append-property
support is merged.
Ayush Singh