2021-09-08 10:06:46

by Joakim Zhang

[permalink] [raw]
Subject: [PATCH 0/6] nvmem: add "cell-type" property to support mac-address

This patch set adds "cell-type" property to parse mac address, take i.MX
as an example, which need reverse byte for mac address.

Joakim Zhang (2):
arm64: dts: imx8mm: add "cell-type" property for mac-address
arm64: dts: imx8m: remove unused "nvmem_macaddr_swap" property for FEC

Srinivas Kandagatla (4):
dt-bindings: nvmem: add cell-type to nvmem cells
nvmem: core: parse nvmem cell-type from device tree
nvmem: core: add nvmem cell post processing callback
nvmem: imx-ocotp: add support for post porcessing.

.../devicetree/bindings/nvmem/nvmem.yaml | 11 +++++++
arch/arm64/boot/dts/freescale/imx8mm.dtsi | 3 +-
arch/arm64/boot/dts/freescale/imx8mn.dtsi | 3 +-
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 10 ++++++-
arch/arm64/boot/dts/freescale/imx8mq.dtsi | 3 +-
drivers/nvmem/core.c | 12 ++++++++
drivers/nvmem/imx-ocotp.c | 30 +++++++++++++++++++
include/dt-bindings/nvmem/nvmem.h | 8 +++++
include/linux/nvmem-provider.h | 5 ++++
9 files changed, 81 insertions(+), 4 deletions(-)
create mode 100644 include/dt-bindings/nvmem/nvmem.h

--
2.17.1


2021-09-08 10:20:32

by Joakim Zhang

[permalink] [raw]
Subject: [PATCH 3/6] nvmem: core: add nvmem cell post processing callback

From: Srinivas Kandagatla <[email protected]>

Some NVMEM providers have certain nvmem cells encoded, which requires
post processing before actually using it.

For example mac-address is stored in either in ascii or delimited or reverse-order.

Having a post-process callback hook to provider drivers would enable them to
do this vendor specific post processing before nvmem consumers see it.

Signed-off-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Joakim Zhang <[email protected]>
---
drivers/nvmem/core.c | 9 +++++++++
include/linux/nvmem-provider.h | 5 +++++
2 files changed, 14 insertions(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 23c08dbaf45e..4f81a3adf081 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -38,6 +38,7 @@ struct nvmem_device {
unsigned int nkeepout;
nvmem_reg_read_t reg_read;
nvmem_reg_write_t reg_write;
+ nvmem_cell_post_process_t cell_post_process;
struct gpio_desc *wp_gpio;
void *priv;
};
@@ -797,6 +798,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
nvmem->type = config->type;
nvmem->reg_read = config->reg_read;
nvmem->reg_write = config->reg_write;
+ nvmem->cell_post_process = config->cell_post_process;
nvmem->keepout = config->keepout;
nvmem->nkeepout = config->nkeepout;
if (config->of_node)
@@ -1404,6 +1406,13 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
if (cell->bit_offset || cell->nbits)
nvmem_shift_read_buffer_in_place(cell, buf);

+ if (nvmem->cell_post_process) {
+ rc = nvmem->cell_post_process(nvmem->priv, cell->type,
+ cell->offset, buf, cell->bytes);
+ if (rc)
+ return rc;
+ }
+
if (len)
*len = cell->bytes;

diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 104505e9028f..d980c79f9605 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -19,6 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *priv, unsigned int offset,
void *val, size_t bytes);
typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
void *val, size_t bytes);
+/* used for vendor specific post processing of cell data */
+typedef int (*nvmem_cell_post_process_t)(void *priv, int type, unsigned int offset,
+ void *buf, size_t bytes);

enum nvmem_type {
NVMEM_TYPE_UNKNOWN = 0,
@@ -62,6 +65,7 @@ struct nvmem_keepout {
* @no_of_node: Device should not use the parent's of_node even if it's !NULL.
* @reg_read: Callback to read data.
* @reg_write: Callback to write data.
+ * @cell_read_callback: Callback for vendor specific post processing of cell data
* @size: Device size.
* @word_size: Minimum read/write access granularity.
* @stride: Minimum read/write access stride.
@@ -92,6 +96,7 @@ struct nvmem_config {
bool no_of_node;
nvmem_reg_read_t reg_read;
nvmem_reg_write_t reg_write;
+ nvmem_cell_post_process_t cell_post_process;
int size;
int word_size;
int stride;
--
2.17.1

2021-09-08 10:20:41

by Joakim Zhang

[permalink] [raw]
Subject: [PATCH 5/6] arm64: dts: imx8mm: add "cell-type" property for mac-address

Add "cell-type" property for mac-address nvmem cell to supporting mac
address reverse byte.

Signed-off-by: Joakim Zhang <[email protected]>
---
arch/arm64/boot/dts/freescale/imx8mm.dtsi | 2 ++
arch/arm64/boot/dts/freescale/imx8mn.dtsi | 2 ++
arch/arm64/boot/dts/freescale/imx8mp.dtsi | 9 +++++++++
arch/arm64/boot/dts/freescale/imx8mq.dtsi | 2 ++
4 files changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
index e7648c3b8390..fb14be932386 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
@@ -7,6 +7,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/nvmem/nvmem.h>
#include <dt-bindings/thermal/thermal.h>

#include "imx8mm-pinfunc.h"
@@ -539,6 +540,7 @@

fec_mac_address: mac-address@90 {
reg = <0x90 6>;
+ cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
};
};

diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
index d4231e061403..0a994e6edc0b 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
@@ -7,6 +7,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/nvmem/nvmem.h>
#include <dt-bindings/thermal/thermal.h>

#include "imx8mn-pinfunc.h"
@@ -544,6 +545,7 @@

fec_mac_address: mac-address@90 {
reg = <0x90 6>;
+ cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
};
};

diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
index 9f7c7f587d38..37188ff07f21 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
@@ -7,6 +7,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/nvmem/nvmem.h>
#include <dt-bindings/thermal/thermal.h>

#include "imx8mp-pinfunc.h"
@@ -358,6 +359,12 @@

eth_mac1: mac-address@90 {
reg = <0x90 6>;
+ cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
+ };
+
+ eth_mac2: mac-address@96 {
+ reg = <0x96 6>;
+ cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
};
};

@@ -836,6 +843,8 @@
<&clk IMX8MP_SYS_PLL2_100M>,
<&clk IMX8MP_SYS_PLL2_125M>;
assigned-clock-rates = <0>, <100000000>, <125000000>;
+ nvmem-cells = <&eth_mac2>;
+ nvmem-cell-names = "mac-address";
intf_mode = <&gpr 0x4>;
status = "disabled";
};
diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
index 91df9c5350ae..1cb211e470ae 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
@@ -10,6 +10,7 @@
#include <dt-bindings/gpio/gpio.h>
#include "dt-bindings/input/input.h"
#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/nvmem/nvmem.h>
#include <dt-bindings/thermal/thermal.h>
#include <dt-bindings/interconnect/imx8mq.h>
#include "imx8mq-pinfunc.h"
@@ -570,6 +571,7 @@

fec_mac_address: mac-address@90 {
reg = <0x90 6>;
+ cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
};
};

--
2.17.1

2021-09-22 10:51:06

by Joakim Zhang

[permalink] [raw]
Subject: RE: [PATCH 0/6] nvmem: add "cell-type" property to support mac-address


Gentle Ping...

Best Regards,
Joakim Zhang

> -----Original Message-----
> From: Joakim Zhang <[email protected]>
> Sent: 2021??9??8?? 18:03
> To: [email protected]; [email protected];
> [email protected]
> Cc: dl-linux-imx <[email protected]>; [email protected];
> [email protected]; [email protected]
> Subject: [PATCH 0/6] nvmem: add "cell-type" property to support mac-address
>
> This patch set adds "cell-type" property to parse mac address, take i.MX as an
> example, which need reverse byte for mac address.
>
> Joakim Zhang (2):
> arm64: dts: imx8mm: add "cell-type" property for mac-address
> arm64: dts: imx8m: remove unused "nvmem_macaddr_swap" property for
> FEC
>
> Srinivas Kandagatla (4):
> dt-bindings: nvmem: add cell-type to nvmem cells
> nvmem: core: parse nvmem cell-type from device tree
> nvmem: core: add nvmem cell post processing callback
> nvmem: imx-ocotp: add support for post porcessing.
>
> .../devicetree/bindings/nvmem/nvmem.yaml | 11 +++++++
> arch/arm64/boot/dts/freescale/imx8mm.dtsi | 3 +-
> arch/arm64/boot/dts/freescale/imx8mn.dtsi | 3 +-
> arch/arm64/boot/dts/freescale/imx8mp.dtsi | 10 ++++++-
> arch/arm64/boot/dts/freescale/imx8mq.dtsi | 3 +-
> drivers/nvmem/core.c | 12 ++++++++
> drivers/nvmem/imx-ocotp.c | 30
> +++++++++++++++++++
> include/dt-bindings/nvmem/nvmem.h | 8 +++++
> include/linux/nvmem-provider.h | 5 ++++
> 9 files changed, 81 insertions(+), 4 deletions(-) create mode 100644
> include/dt-bindings/nvmem/nvmem.h
>
> --
> 2.17.1

2021-09-22 11:38:38

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH 3/6] nvmem: core: add nvmem cell post processing callback

On 08.09.21 12:02, Joakim Zhang wrote:
> From: Srinivas Kandagatla <[email protected]>
>
> Some NVMEM providers have certain nvmem cells encoded, which requires
> post processing before actually using it.
>
> For example mac-address is stored in either in ascii or delimited or reverse-order.
>
> Having a post-process callback hook to provider drivers would enable them to
> do this vendor specific post processing before nvmem consumers see it.
>
> Signed-off-by: Srinivas Kandagatla <[email protected]>
> Signed-off-by: Joakim Zhang <[email protected]>
> ---
> drivers/nvmem/core.c | 9 +++++++++
> include/linux/nvmem-provider.h | 5 +++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 23c08dbaf45e..4f81a3adf081 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -38,6 +38,7 @@ struct nvmem_device {
> unsigned int nkeepout;
> nvmem_reg_read_t reg_read;
> nvmem_reg_write_t reg_write;
> + nvmem_cell_post_process_t cell_post_process;
> struct gpio_desc *wp_gpio;
> void *priv;
> };
> @@ -797,6 +798,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> nvmem->type = config->type;
> nvmem->reg_read = config->reg_read;
> nvmem->reg_write = config->reg_write;
> + nvmem->cell_post_process = config->cell_post_process;
> nvmem->keepout = config->keepout;
> nvmem->nkeepout = config->nkeepout;
> if (config->of_node)
> @@ -1404,6 +1406,13 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
> if (cell->bit_offset || cell->nbits)
> nvmem_shift_read_buffer_in_place(cell, buf);
>
> + if (nvmem->cell_post_process) {
> + rc = nvmem->cell_post_process(nvmem->priv, cell->type,
> + cell->offset, buf, cell->bytes);
> + if (rc)
> + return rc;
> + }
> +
> if (len)
> *len = cell->bytes;
>
> diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
> index 104505e9028f..d980c79f9605 100644
> --- a/include/linux/nvmem-provider.h
> +++ b/include/linux/nvmem-provider.h
> @@ -19,6 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *priv, unsigned int offset,
> void *val, size_t bytes);
> typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
> void *val, size_t bytes);
> +/* used for vendor specific post processing of cell data */
> +typedef int (*nvmem_cell_post_process_t)(void *priv, int type, unsigned int offset,
> + void *buf, size_t bytes);
>
> enum nvmem_type {
> NVMEM_TYPE_UNKNOWN = 0,
> @@ -62,6 +65,7 @@ struct nvmem_keepout {
> * @no_of_node: Device should not use the parent's of_node even if it's !NULL.
> * @reg_read: Callback to read data.
> * @reg_write: Callback to write data.
> + * @cell_read_callback: Callback for vendor specific post processing of cell data

The member below is called cell_post_process

> * @size: Device size.
> * @word_size: Minimum read/write access granularity.
> * @stride: Minimum read/write access stride.
> @@ -92,6 +96,7 @@ struct nvmem_config {
> bool no_of_node;
> nvmem_reg_read_t reg_read;
> nvmem_reg_write_t reg_write;
> + nvmem_cell_post_process_t cell_post_process;
> int size;
> int word_size;
> int stride;
>


--
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 |

2021-09-22 11:41:19

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH 5/6] arm64: dts: imx8mm: add "cell-type" property for mac-address

On 08.09.21 12:02, Joakim Zhang wrote:
> Add "cell-type" property for mac-address nvmem cell to supporting mac
> address reverse byte.

s/imx8mm/imx8m/ in commit message title.
Do you intend to do this for older i.MX as well?

>
> Signed-off-by: Joakim Zhang <[email protected]>
> ---
> arch/arm64/boot/dts/freescale/imx8mm.dtsi | 2 ++
> arch/arm64/boot/dts/freescale/imx8mn.dtsi | 2 ++
> arch/arm64/boot/dts/freescale/imx8mp.dtsi | 9 +++++++++
> arch/arm64/boot/dts/freescale/imx8mq.dtsi | 2 ++
> 4 files changed, 15 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
> index e7648c3b8390..fb14be932386 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
> @@ -7,6 +7,7 @@
> #include <dt-bindings/gpio/gpio.h>
> #include <dt-bindings/input/input.h>
> #include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include <dt-bindings/nvmem/nvmem.h>
> #include <dt-bindings/thermal/thermal.h>
>
> #include "imx8mm-pinfunc.h"
> @@ -539,6 +540,7 @@
>
> fec_mac_address: mac-address@90 {
> reg = <0x90 6>;
> + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> };
> };
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
> index d4231e061403..0a994e6edc0b 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
> @@ -7,6 +7,7 @@
> #include <dt-bindings/gpio/gpio.h>
> #include <dt-bindings/input/input.h>
> #include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include <dt-bindings/nvmem/nvmem.h>
> #include <dt-bindings/thermal/thermal.h>
>
> #include "imx8mn-pinfunc.h"
> @@ -544,6 +545,7 @@
>
> fec_mac_address: mac-address@90 {
> reg = <0x90 6>;
> + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> };
> };
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> index 9f7c7f587d38..37188ff07f21 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> @@ -7,6 +7,7 @@
> #include <dt-bindings/gpio/gpio.h>
> #include <dt-bindings/input/input.h>
> #include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include <dt-bindings/nvmem/nvmem.h>
> #include <dt-bindings/thermal/thermal.h>
>
> #include "imx8mp-pinfunc.h"
> @@ -358,6 +359,12 @@
>
> eth_mac1: mac-address@90 {
> reg = <0x90 6>;
> + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> + };
> +
> + eth_mac2: mac-address@96 {
> + reg = <0x96 6>;
> + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> };
> };
>
> @@ -836,6 +843,8 @@
> <&clk IMX8MP_SYS_PLL2_100M>,
> <&clk IMX8MP_SYS_PLL2_125M>;
> assigned-clock-rates = <0>, <100000000>, <125000000>;
> + nvmem-cells = <&eth_mac2>;
> + nvmem-cell-names = "mac-address";
> intf_mode = <&gpr 0x4>;
> status = "disabled";
> };
> diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
> index 91df9c5350ae..1cb211e470ae 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
> @@ -10,6 +10,7 @@
> #include <dt-bindings/gpio/gpio.h>
> #include "dt-bindings/input/input.h"
> #include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include <dt-bindings/nvmem/nvmem.h>
> #include <dt-bindings/thermal/thermal.h>
> #include <dt-bindings/interconnect/imx8mq.h>
> #include "imx8mq-pinfunc.h"
> @@ -570,6 +571,7 @@
>
> fec_mac_address: mac-address@90 {
> reg = <0x90 6>;
> + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> };
> };
>
>


--
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 |

2021-09-23 02:53:39

by Joakim Zhang

[permalink] [raw]
Subject: RE: [PATCH 3/6] nvmem: core: add nvmem cell post processing callback


Hi Ahmad,

> -----Original Message-----
> From: Ahmad Fatoum <[email protected]>
> Sent: 2021??9??22?? 19:37
> To: Joakim Zhang <[email protected]>;
> [email protected]; [email protected]; [email protected]
> Cc: [email protected]; dl-linux-imx <[email protected]>;
> [email protected]; [email protected]
> Subject: Re: [PATCH 3/6] nvmem: core: add nvmem cell post processing
> callback
>
> On 08.09.21 12:02, Joakim Zhang wrote:
> > From: Srinivas Kandagatla <[email protected]>
> >
> > Some NVMEM providers have certain nvmem cells encoded, which requires
> > post processing before actually using it.
> >
> > For example mac-address is stored in either in ascii or delimited or
> reverse-order.
> >
> > Having a post-process callback hook to provider drivers would enable
> > them to do this vendor specific post processing before nvmem consumers see
> it.
> >
> > Signed-off-by: Srinivas Kandagatla <[email protected]>
> > Signed-off-by: Joakim Zhang <[email protected]>
> > ---
> > drivers/nvmem/core.c | 9 +++++++++
> > include/linux/nvmem-provider.h | 5 +++++
> > 2 files changed, 14 insertions(+)
> >
> > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index
> > 23c08dbaf45e..4f81a3adf081 100644
> > --- a/drivers/nvmem/core.c
> > +++ b/drivers/nvmem/core.c
> > @@ -38,6 +38,7 @@ struct nvmem_device {
> > unsigned int nkeepout;
> > nvmem_reg_read_t reg_read;
> > nvmem_reg_write_t reg_write;
> > + nvmem_cell_post_process_t cell_post_process;
> > struct gpio_desc *wp_gpio;
> > void *priv;
> > };
> > @@ -797,6 +798,7 @@ struct nvmem_device *nvmem_register(const struct
> nvmem_config *config)
> > nvmem->type = config->type;
> > nvmem->reg_read = config->reg_read;
> > nvmem->reg_write = config->reg_write;
> > + nvmem->cell_post_process = config->cell_post_process;
> > nvmem->keepout = config->keepout;
> > nvmem->nkeepout = config->nkeepout;
> > if (config->of_node)
> > @@ -1404,6 +1406,13 @@ static int __nvmem_cell_read(struct
> nvmem_device *nvmem,
> > if (cell->bit_offset || cell->nbits)
> > nvmem_shift_read_buffer_in_place(cell, buf);
> >
> > + if (nvmem->cell_post_process) {
> > + rc = nvmem->cell_post_process(nvmem->priv, cell->type,
> > + cell->offset, buf, cell->bytes);
> > + if (rc)
> > + return rc;
> > + }
> > +
> > if (len)
> > *len = cell->bytes;
> >
> > diff --git a/include/linux/nvmem-provider.h
> > b/include/linux/nvmem-provider.h index 104505e9028f..d980c79f9605
> > 100644
> > --- a/include/linux/nvmem-provider.h
> > +++ b/include/linux/nvmem-provider.h
> > @@ -19,6 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *priv, unsigned
> int offset,
> > void *val, size_t bytes);
> > typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
> > void *val, size_t bytes);
> > +/* used for vendor specific post processing of cell data */ typedef
> > +int (*nvmem_cell_post_process_t)(void *priv, int type, unsigned int offset,
> > + void *buf, size_t bytes);
> >
> > enum nvmem_type {
> > NVMEM_TYPE_UNKNOWN = 0,
> > @@ -62,6 +65,7 @@ struct nvmem_keepout {
> > * @no_of_node: Device should not use the parent's of_node even if
> it's !NULL.
> > * @reg_read: Callback to read data.
> > * @reg_write: Callback to write data.
> > + * @cell_read_callback: Callback for vendor specific post processing
> > + of cell data
>
> The member below is called cell_post_process

Good caught! Will fix it in V2. Thanks.

Best Regards,
Joakim Zhang
> > * @size: Device size.
> > * @word_size: Minimum read/write access granularity.
> > * @stride: Minimum read/write access stride.
> > @@ -92,6 +96,7 @@ struct nvmem_config {
> > bool no_of_node;
> > nvmem_reg_read_t reg_read;
> > nvmem_reg_write_t reg_write;
> > + nvmem_cell_post_process_t cell_post_process;
> > int size;
> > int word_size;
> > int stride;
> >
>
>
> --
> Pengutronix e.K. |
> |
> Steuerwalder Str. 21 |
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pe
> ngutronix.de%2F&amp;data=04%7C01%7Cqiangqing.zhang%40nxp.com%7C85
> 4dcad461914aa4227e08d97dbd56f0%7C686ea1d3bc2b4c6fa92cd99c5c301635
> %7C0%7C0%7C637679074424671648%7CUnknown%7CTWFpbGZsb3d8eyJWIj
> oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C10
> 00&amp;sdata=nYxnuFbFB9PhGfEUPiwg7dJOR2hQHV5NbjfT1NyKWBM%3D&a
> mp;reserved=0 |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0
> |
> Amtsgericht Hildesheim, HRA 2686 | Fax:
> +49-5121-206917-5555 |

2021-09-23 02:54:30

by Joakim Zhang

[permalink] [raw]
Subject: RE: [PATCH 5/6] arm64: dts: imx8mm: add "cell-type" property for mac-address


Hi Ahmad,

> -----Original Message-----
> From: Ahmad Fatoum <[email protected]>
> Sent: 2021??9??22?? 19:40
> To: Joakim Zhang <[email protected]>;
> [email protected]; [email protected]; [email protected]
> Cc: [email protected]; dl-linux-imx <[email protected]>;
> [email protected]; [email protected]
> Subject: Re: [PATCH 5/6] arm64: dts: imx8mm: add "cell-type" property for
> mac-address
>
> On 08.09.21 12:02, Joakim Zhang wrote:
> > Add "cell-type" property for mac-address nvmem cell to supporting mac
> > address reverse byte.
>
> s/imx8mm/imx8m/ in commit message title.

Will fix it in V2.

> Do you intend to do this for older i.MX as well?

No plan now, I just prepare it for i.MX8M serials.

Best Regards,
Joakim Zhang
> >
> > Signed-off-by: Joakim Zhang <[email protected]>
> > ---
> > arch/arm64/boot/dts/freescale/imx8mm.dtsi | 2 ++
> > arch/arm64/boot/dts/freescale/imx8mn.dtsi | 2 ++
> > arch/arm64/boot/dts/freescale/imx8mp.dtsi | 9 +++++++++
> > arch/arm64/boot/dts/freescale/imx8mq.dtsi | 2 ++
> > 4 files changed, 15 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
> > b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
> > index e7648c3b8390..fb14be932386 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
> > +++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
> > @@ -7,6 +7,7 @@
> > #include <dt-bindings/gpio/gpio.h>
> > #include <dt-bindings/input/input.h>
> > #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +#include <dt-bindings/nvmem/nvmem.h>
> > #include <dt-bindings/thermal/thermal.h>
> >
> > #include "imx8mm-pinfunc.h"
> > @@ -539,6 +540,7 @@
> >
> > fec_mac_address: mac-address@90 {
> > reg = <0x90 6>;
> > + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> > };
> > };
> >
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi
> > b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
> > index d4231e061403..0a994e6edc0b 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi
> > +++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi
> > @@ -7,6 +7,7 @@
> > #include <dt-bindings/gpio/gpio.h>
> > #include <dt-bindings/input/input.h>
> > #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +#include <dt-bindings/nvmem/nvmem.h>
> > #include <dt-bindings/thermal/thermal.h>
> >
> > #include "imx8mn-pinfunc.h"
> > @@ -544,6 +545,7 @@
> >
> > fec_mac_address: mac-address@90 {
> > reg = <0x90 6>;
> > + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> > };
> > };
> >
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> > b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> > index 9f7c7f587d38..37188ff07f21 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> > +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi
> > @@ -7,6 +7,7 @@
> > #include <dt-bindings/gpio/gpio.h>
> > #include <dt-bindings/input/input.h>
> > #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +#include <dt-bindings/nvmem/nvmem.h>
> > #include <dt-bindings/thermal/thermal.h>
> >
> > #include "imx8mp-pinfunc.h"
> > @@ -358,6 +359,12 @@
> >
> > eth_mac1: mac-address@90 {
> > reg = <0x90 6>;
> > + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> > + };
> > +
> > + eth_mac2: mac-address@96 {
> > + reg = <0x96 6>;
> > + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> > };
> > };
> >
> > @@ -836,6 +843,8 @@
> > <&clk IMX8MP_SYS_PLL2_100M>,
> > <&clk IMX8MP_SYS_PLL2_125M>;
> > assigned-clock-rates = <0>, <100000000>, <125000000>;
> > + nvmem-cells = <&eth_mac2>;
> > + nvmem-cell-names = "mac-address";
> > intf_mode = <&gpr 0x4>;
> > status = "disabled";
> > };
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
> > b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
> > index 91df9c5350ae..1cb211e470ae 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
> > +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
> > @@ -10,6 +10,7 @@
> > #include <dt-bindings/gpio/gpio.h>
> > #include "dt-bindings/input/input.h"
> > #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +#include <dt-bindings/nvmem/nvmem.h>
> > #include <dt-bindings/thermal/thermal.h> #include
> > <dt-bindings/interconnect/imx8mq.h>
> > #include "imx8mq-pinfunc.h"
> > @@ -570,6 +571,7 @@
> >
> > fec_mac_address: mac-address@90 {
> > reg = <0x90 6>;
> > + cell-type = <NVMEM_CELL_TYPE_MAC_ADDRESS>;
> > };
> > };
> >
> >
>
>
> --
> Pengutronix e.K. |
> |
> Steuerwalder Str. 21 |
> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pe
> ngutronix.de%2F&amp;data=04%7C01%7Cqiangqing.zhang%40nxp.com%7C94
> d6744dc99545da696a08d97dbdb83f%7C686ea1d3bc2b4c6fa92cd99c5c301635
> %7C0%7C0%7C637679076057590614%7CUnknown%7CTWFpbGZsb3d8eyJWIj
> oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C10
> 00&amp;sdata=rb9ZZXEqNxQaq9PORDP5ZVOgqZINFltBG1eMvM9VcBc%3D&a
> mp;reserved=0 |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0
> |
> Amtsgericht Hildesheim, HRA 2686 | Fax:
> +49-5121-206917-5555 |