Skip to contentSkip to conversation

nvmem: u-boot-env: find Device Tree nodes for NVMEM cells

PATCH In review Rafał Miłecki 2 participants 2 messages Sep 15, 2022 – Sep 16, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: u-boot-env: find Device Tree nodes for NVMEM cells

From: Rafał Miłecki <[email protected]>

DT binding allows specifying NVMEM cells as NVMEM device (provider) subnodes. Looks for such subnodes when building NVMEM cells.

This allows NVMEM consumers to use U-Boot environment variables.

---
 drivers/nvmem/u-boot-env.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvmem/u-boot-env.c +1 -0
index 9b9abfb8f187..d17a164ae705 100644
@@ -92,6 +92,7 @@ static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf,
 			return -ENOMEM;
 		priv->cells[idx].offset = data_offset + value - data;
 		priv->cells[idx].bytes = strlen(value);
+		priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name);
 	}
 
 	if (WARN_ON(idx != priv->ncells))
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

DT binding allows specifying NVMEM cells as NVMEM device (provider) subnodes. Looks for such subnodes when building NVMEM cells.

This allows NVMEM consumers to use U-Boot environment variables.

Applied thanks,

--srini

Quoted 16 lines
---
  drivers/nvmem/u-boot-env.c | 1 +
  1 file changed, 1 insertion(+)
drivers/nvmem/u-boot-env.c +1 -0
index 9b9abfb8f187..d17a164ae705 100644
@@ -92,6 +92,7 @@ static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf,
  			return -ENOMEM;
  		priv->cells[idx].offset = data_offset + value - data;
  		priv->cells[idx].bytes = strlen(value);
+		priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name);
  	}
 
  	if (WARN_ON(idx != priv->ncells))