mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] nvmem: add support for fixed-layout binding
@ 2024-07-03 19:09 Ahmad Fatoum
  2024-07-03 19:09 ` [PATCH 2/2] sandbox: use " Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-07-03 19:09 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

At long last, nvmem cells as direct subnodes of the provider has been
deprecated and replaced by a layout binding that allows a NVMEM provider
to do arbitrary processing of cells before exposing them to the
framework.

We'll want to support the layout binding eventually, but for now, let's
just add the trivial modifications necessary to support the
fixed-layout, which is just a compatible = "fixed-layout" node
that contains the individual cells.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/nvmem/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index bf393fc180ab..67276cf3b57b 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -400,6 +400,8 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np,
 		return ERR_PTR(-EINVAL);
 
 	nvmem_np = of_get_parent(cell_np);
+	if (nvmem_np && of_device_is_compatible(nvmem_np, "fixed-layout"))
+		nvmem_np = of_get_parent(nvmem_np);
 	if (!nvmem_np)
 		return ERR_PTR(-EINVAL);
 
-- 
2.39.2




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

* [PATCH 2/2] sandbox: use fixed-layout binding
  2024-07-03 19:09 [PATCH 1/2] nvmem: add support for fixed-layout binding Ahmad Fatoum
@ 2024-07-03 19:09 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2024-07-03 19:09 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Device trees used with barebox are likely to still use the
deprecated nvmem cell binding. To have some coverage of the new binding,
switch sandbox over to it.

No functional change.

Note that the nvmem-cells compatible node seems to be no longer
necessary per binding, but that aspect is not yet supported by barebox.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/sandbox/dts/sandbox.dts | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts
index bb37cfeaf9a2..34071813ffa6 100644
--- a/arch/sandbox/dts/sandbox.dts
+++ b/arch/sandbox/dts/sandbox.dts
@@ -80,15 +80,19 @@ part_nvmem: nvmem@300 {
 				compatible = "nvmem-cells";
 				reg = <0x300 0x100>;
 				label = "nvmem";
-				#address-cells = <1>;
-				#size-cells = <1>;
 
-				reset_source: reset-source@0 {
-					reg = <0x0 0x1>;
-				};
+				nvmem-layout {
+					compatible = "fixed-layout";
+					#address-cells = <1>;
+					#size-cells = <1>;
 
-				reboot_mode: reboot-mode@1 {
-					reg = <0x1 0x4>;
+					reset_source: reset-source@0 {
+						reg = <0x0 0x1>;
+					};
+
+					reboot_mode: reboot-mode@1 {
+						reg = <0x1 0x4>;
+					};
 				};
 			};
 
-- 
2.39.2




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

end of thread, other threads:[~2024-07-03 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-03 19:09 [PATCH 1/2] nvmem: add support for fixed-layout binding Ahmad Fatoum
2024-07-03 19:09 ` [PATCH 2/2] sandbox: use " Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox