nvmem: brcm_nvram: find Device Tree nodes for NVMEM cells

DT binding for Broadcom's NVRAM supports specifying NVMEM cells as NVMEM
device (provider) subnodes. Look for such subnodes when collecing NVMEM
cells. This allows NVMEM consumers to use NVRAM variables.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220429162701.2222-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Rafał Miłecki 2022-04-29 17:26:47 +01:00 committed by Greg Kroah-Hartman
parent dbc2f62061
commit 207775f7e1
1 changed files with 2 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/nvmem-consumer.h> #include <linux/nvmem-consumer.h>
#include <linux/nvmem-provider.h> #include <linux/nvmem-provider.h>
#include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
@ -72,6 +73,7 @@ static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data,
return -ENOMEM; return -ENOMEM;
priv->cells[idx].offset = value - (char *)data; priv->cells[idx].offset = value - (char *)data;
priv->cells[idx].bytes = strlen(value); priv->cells[idx].bytes = strlen(value);
priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name);
} }
return 0; return 0;