3b1e76147a8b5d213ef7a0deb8ba75eb18d909c5
[openwrt/staging/dangole.git] /
1 From dbc2f62061c6bfba0aee93161ee3194dcee84bd0 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:46 +0100
4 Subject: [PATCH] nvmem: core: support passing DT node in cell info
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Some hardware may have NVMEM cells described in Device Tree using
10 individual nodes. Let drivers pass such nodes to the NVMEM subsystem so
11 they can be later used by NVMEM consumers.
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-2-srinivas.kandagatla@linaro.org
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17 ---
18 drivers/nvmem/core.c | 1 +
19 include/linux/nvmem-consumer.h | 1 +
20 2 files changed, 2 insertions(+)
21
22 --- a/drivers/nvmem/core.c
23 +++ b/drivers/nvmem/core.c
24 @@ -467,6 +467,7 @@ static int nvmem_cell_info_to_nvmem_cell
25
26 cell->bit_offset = info->bit_offset;
27 cell->nbits = info->nbits;
28 + cell->np = info->np;
29
30 if (cell->nbits)
31 cell->bytes = DIV_ROUND_UP(cell->nbits + cell->bit_offset,
32 --- a/include/linux/nvmem-consumer.h
33 +++ b/include/linux/nvmem-consumer.h
34 @@ -25,6 +25,7 @@ struct nvmem_cell_info {
35 unsigned int bytes;
36 unsigned int bit_offset;
37 unsigned int nbits;
38 + struct device_node *np;
39 };
40
41 /**