diff mbox series

[2/6] nvmem: core: parse nvmem cell-type from device tree

Message ID 20210908100257.17833-3-qiangqing.zhang@nxp.com
State Superseded
Headers show
Series nvmem: add "cell-type" property to support mac-address | expand

Commit Message

Joakim Zhang Sept. 8, 2021, 10:02 a.m. UTC
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>


get nvmem cell-type from device tree

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>

---
 drivers/nvmem/core.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.17.1

Comments

Ahmad Fatoum Sept. 22, 2021, 11:36 a.m. UTC | #1
On 08.09.21 12:02, Joakim Zhang wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> 

> get nvmem cell-type from device tree

> 

> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>


Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>


> ---

>  drivers/nvmem/core.c | 3 +++

>  1 file changed, 3 insertions(+)

> 

> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c

> index 3d87fadaa160..23c08dbaf45e 100644

> --- a/drivers/nvmem/core.c

> +++ b/drivers/nvmem/core.c

> @@ -52,6 +52,7 @@ struct nvmem_cell {

>  	int			bytes;

>  	int			bit_offset;

>  	int			nbits;

> +	u32			type;

>  	struct device_node	*np;

>  	struct nvmem_device	*nvmem;

>  	struct list_head	node;

> @@ -726,6 +727,8 @@ static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)

>  			return -EINVAL;

>  		}

>  

> +		of_property_read_u32(child, "cell-type", &cell->type);

> +

>  		cell->np = of_node_get(child);

>  		nvmem_cell_add(cell);

>  	}

> 



-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
diff mbox series

Patch

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 3d87fadaa160..23c08dbaf45e 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -52,6 +52,7 @@  struct nvmem_cell {
 	int			bytes;
 	int			bit_offset;
 	int			nbits;
+	u32			type;
 	struct device_node	*np;
 	struct nvmem_device	*nvmem;
 	struct list_head	node;
@@ -726,6 +727,8 @@  static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
 			return -EINVAL;
 		}
 
+		of_property_read_u32(child, "cell-type", &cell->type);
+
 		cell->np = of_node_get(child);
 		nvmem_cell_add(cell);
 	}