devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add capability to append to property
@ 2024-08-29 20:03 Ayush Singh
  2024-08-29 20:03 ` [PATCH v2 1/2] dtc: Add /append-property/ Ayush Singh
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Ayush Singh @ 2024-08-29 20:03 UTC (permalink / raw)
  To: d-gole, lorforlinux, jkridner, robertcnelson, nenad.marinkovic,
	Andrew Davis, Geert Uytterhoeven, Robert Nelson
  Cc: devicetree-compiler, Ayush Singh, Simon Glass

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";
};
```

Open items
- Better tests: I only started the work today, so well, I still don't
  have a good picture of how to properly write tests.

- Appending to non-existent property: Currently am just adding a new
  property if not found. Not sure if this is the desired behaviour.

- Incompatible values: Not sure how to handle when trying to append
  incompatible values.

[3] https://lore.kernel.org/linux-arm-kernel/20240702164403.29067-1-afd@ti.com/
[2] https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dts#L39
[1] https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/renesas/r8a77951.dtsi#L3334

Signed-off-by: Ayush Singh <ayush@beagleboard.org>

---
Changes in v2:
- Add comment for append struct member.
- Small code improvements
- Improve test
- Link to v1: https://lore.kernel.org/r/20240827-append-v1-0-d7a126ef1be3@beagleboard.org

---
Ayush Singh (2):
      dtc: Add /append-property/
      tests: Add test for append-property

 dtc-lexer.l           |  7 +++++++
 dtc-parser.y          |  6 ++++++
 dtc.h                 |  5 +++++
 livetree.c            | 29 ++++++++++++++++++++++++-----
 tests/append_prop.dts | 21 +++++++++++++++++++++
 tests/run_tests.sh    |  7 +++++++
 6 files changed, 70 insertions(+), 5 deletions(-)
---
base-commit: 99031e3a4a6e479466ae795790b44727434ca27d
change-id: 20240827-append-f614fe3261f9

Best regards,
-- 
Ayush Singh <ayush@beagleboard.org>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-10-10  6:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 20:03 [PATCH v2 0/2] Add capability to append to property Ayush Singh
2024-08-29 20:03 ` [PATCH v2 1/2] dtc: Add /append-property/ Ayush Singh
2024-08-29 20:03 ` [PATCH v2 2/2] tests: Add test for append-property Ayush Singh
2024-08-30  1:06   ` Simon Glass
2024-08-30  3:28     ` CVS
2024-08-30  8:07       ` Ayush Singh
2024-08-30  8:01     ` Ayush Singh
2024-09-12 11:06       ` CVS
2024-09-17 17:23         ` Ayush Singh
2024-08-30  8:09 ` [PATCH v2 0/2] Add capability to append to property Geert Uytterhoeven
2024-08-30 15:43   ` Andrew Davis
2024-09-12  3:59     ` David Gibson
2024-10-10  6:31       ` Ayush Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).