a9eacd9419cb2c68c6a99694267249e88999c39e
[openwrt/staging/dangole.git] /
1 From 207775f7e17b8fd0426a2ac4a5b81e4e1d71849e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Fri, 29 Apr 2022 17:26:47 +0100
4 Subject: [PATCH] nvmem: brcm_nvram: find Device Tree nodes for NVMEM cells
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 DT binding for Broadcom's NVRAM supports specifying NVMEM cells as NVMEM
10 device (provider) subnodes. Look for such subnodes when collecing NVMEM
11 cells. This allows NVMEM consumers to use NVRAM variables.
12
13 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
14 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
15 Link: https://lore.kernel.org/r/20220429162701.2222-3-srinivas.kandagatla@linaro.org
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17 ---
18 drivers/nvmem/brcm_nvram.c | 2 ++
19 1 file changed, 2 insertions(+)
20
21 --- a/drivers/nvmem/brcm_nvram.c
22 +++ b/drivers/nvmem/brcm_nvram.c
23 @@ -8,6 +8,7 @@
24 #include <linux/module.h>
25 #include <linux/nvmem-consumer.h>
26 #include <linux/nvmem-provider.h>
27 +#include <linux/of.h>
28 #include <linux/platform_device.h>
29 #include <linux/slab.h>
30
31 @@ -72,6 +73,7 @@ static int brcm_nvram_add_cells(struct b
32 return -ENOMEM;
33 priv->cells[idx].offset = value - (char *)data;
34 priv->cells[idx].bytes = strlen(value);
35 + priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name);
36 }
37
38 return 0;