mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len
@ 2026-11-25  7:27 Stefan Ghetu
  2026-11-25  8:23 ` Srinivas Kandagatla
  2026-11-25 12:32 ` [PATCH v2] " Stefan Ghetu
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Ghetu @ 2026-11-25  7:27 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Frank Li, Sascha Hauer, kernel, Fabio Estevam, Peng Fan,
	Christian Eggers, imx, linux-arm-kernel, linux-kernel,
	Stefan Ghetu

Avoid getting error messages at startup like the following on i.MX8QXP,
i.MX8QM and i.MX8DXL, printed once for each MAC address cell:

nvmem imx-scu-ocotp0: cell mac raw len 6 unaligned to nvmem word size 4

The same was already done for imx-ocotp and imx-ocotp-ele by commit
48b5163c9575 ("nvmem: imx: assign nvmem_cell_info::raw_len"), but the
SCU based driver was not covered.

This shouldn't cause any functional change as this alignment would
otherwise be done in nvmem_cell_info_to_nvmem_cell_entry_nodup().

Fixes: 13bcd440f2ff ("nvmem: core: verify cell's raw_len")
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
---
 drivers/nvmem/imx-ocotp-scu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c
index 20312fba22d23..80f78bcf3841e 100644
--- a/drivers/nvmem/imx-ocotp-scu.c
+++ b/drivers/nvmem/imx-ocotp-scu.c
@@ -218,6 +218,12 @@ static int imx_scu_ocotp_write(void *context, unsigned int offset,
 	return res.a0;
 }
 
+static void imx_scu_ocotp_fixup_dt_cell_info(struct nvmem_device *nvmem,
+					     struct nvmem_cell_info *cell)
+{
+	cell->raw_len = round_up(cell->bytes, 4);
+}
+
 static struct nvmem_config imx_scu_ocotp_nvmem_config = {
 	.name = "imx-scu-ocotp",
 	.add_legacy_fixed_of_cells = true,
@@ -227,6 +233,7 @@ static struct nvmem_config imx_scu_ocotp_nvmem_config = {
 	.owner = THIS_MODULE,
 	.reg_read = imx_scu_ocotp_read,
 	.reg_write = imx_scu_ocotp_write,
+	.fixup_dt_cell_info = imx_scu_ocotp_fixup_dt_cell_info,
 };
 
 static const struct of_device_id imx_scu_ocotp_dt_ids[] = {
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len
  2026-11-25  7:27 [PATCH] nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len Stefan Ghetu
@ 2026-11-25  8:23 ` Srinivas Kandagatla
  2026-11-25 12:32 ` [PATCH v2] " Stefan Ghetu
  1 sibling, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2026-11-25  8:23 UTC (permalink / raw)
  To: Stefan Ghetu, Srinivas Kandagatla
  Cc: Frank Li, Sascha Hauer, kernel, Fabio Estevam, Peng Fan,
	Christian Eggers, imx, linux-arm-kernel, linux-kernel



On 11/25/26 7:27 AM, Stefan Ghetu wrote:
> Avoid getting error messages at startup like the following on i.MX8QXP,
> i.MX8QM and i.MX8DXL, printed once for each MAC address cell:
> 
> nvmem imx-scu-ocotp0: cell mac raw len 6 unaligned to nvmem word size 4
> 
> The same was already done for imx-ocotp and imx-ocotp-ele by commit
> 48b5163c9575 ("nvmem: imx: assign nvmem_cell_info::raw_len"), but the
> SCU based driver was not covered.
> 
> This shouldn't cause any functional change as this alignment would
> otherwise be done in nvmem_cell_info_to_nvmem_cell_entry_nodup().
> 
> Fixes: 13bcd440f2ff ("nvmem: core: verify cell's raw_len")

cc Stable is missing.

> Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
> ---
>  drivers/nvmem/imx-ocotp-scu.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c
> index 20312fba22d23..80f78bcf3841e 100644
> --- a/drivers/nvmem/imx-ocotp-scu.c
> +++ b/drivers/nvmem/imx-ocotp-scu.c
> @@ -218,6 +218,12 @@ static int imx_scu_ocotp_write(void *context, unsigned int offset,
>  	return res.a0;
>  }
>  
> +static void imx_scu_ocotp_fixup_dt_cell_info(struct nvmem_device *nvmem,
> +					     struct nvmem_cell_info *cell)
> +{
> +	cell->raw_len = round_up(cell->bytes, 4);
> +}
> +
>  static struct nvmem_config imx_scu_ocotp_nvmem_config = {
>  	.name = "imx-scu-ocotp",
>  	.add_legacy_fixed_of_cells = true,
> @@ -227,6 +233,7 @@ static struct nvmem_config imx_scu_ocotp_nvmem_config = {
>  	.owner = THIS_MODULE,
>  	.reg_read = imx_scu_ocotp_read,
>  	.reg_write = imx_scu_ocotp_write,
> +	.fixup_dt_cell_info = imx_scu_ocotp_fixup_dt_cell_info,
>  };
>  
>  static const struct of_device_id imx_scu_ocotp_dt_ids[] = {


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len
  2026-11-25  7:27 [PATCH] nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len Stefan Ghetu
  2026-11-25  8:23 ` Srinivas Kandagatla
@ 2026-11-25 12:32 ` Stefan Ghetu
  2026-11-25 15:24   ` Daniel Baluta
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Ghetu @ 2026-11-25 12:32 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Frank Li, Sascha Hauer, kernel, Fabio Estevam, Peng Fan,
	Christian Eggers, stable, imx, linux-arm-kernel, linux-kernel,
	Stefan Ghetu

Avoid getting error messages at startup like the following on i.MX8QXP,
i.MX8QM and i.MX8DXL, printed once for each MAC address cell:

nvmem imx-scu-ocotp0: cell mac raw len 6 unaligned to nvmem word size 4

The same was already done for imx-ocotp and imx-ocotp-ele by commit
48b5163c9575 ("nvmem: imx: assign nvmem_cell_info::raw_len"), but the
SCU based driver was not covered.

This shouldn't cause any functional change as this alignment would
otherwise be done in nvmem_cell_info_to_nvmem_cell_entry_nodup().

Fixes: 13bcd440f2ff ("nvmem: core: verify cell's raw_len")
Cc: stable@vger.kernel.org
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
---
Changes in v2:
- Add Cc: stable@vger.kernel.org, as requested by Srinivas Kandagatla.

v1: https://lore.kernel.org/all/20261125072736.769516-1-stefan.ghetu@nxp.com/

 drivers/nvmem/imx-ocotp-scu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c
index 20312fba22d23..80f78bcf3841e 100644
--- a/drivers/nvmem/imx-ocotp-scu.c
+++ b/drivers/nvmem/imx-ocotp-scu.c
@@ -218,6 +218,12 @@ static int imx_scu_ocotp_write(void *context, unsigned int offset,
 	return res.a0;
 }
 
+static void imx_scu_ocotp_fixup_dt_cell_info(struct nvmem_device *nvmem,
+					     struct nvmem_cell_info *cell)
+{
+	cell->raw_len = round_up(cell->bytes, 4);
+}
+
 static struct nvmem_config imx_scu_ocotp_nvmem_config = {
 	.name = "imx-scu-ocotp",
 	.add_legacy_fixed_of_cells = true,
@@ -227,6 +233,7 @@ static struct nvmem_config imx_scu_ocotp_nvmem_config = {
 	.owner = THIS_MODULE,
 	.reg_read = imx_scu_ocotp_read,
 	.reg_write = imx_scu_ocotp_write,
+	.fixup_dt_cell_info = imx_scu_ocotp_fixup_dt_cell_info,
 };
 
 static const struct of_device_id imx_scu_ocotp_dt_ids[] = {
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len
  2026-11-25 12:32 ` [PATCH v2] " Stefan Ghetu
@ 2026-11-25 15:24   ` Daniel Baluta
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Baluta @ 2026-11-25 15:24 UTC (permalink / raw)
  To: Stefan Ghetu, Srinivas Kandagatla
  Cc: Frank Li, Sascha Hauer, kernel, Fabio Estevam, Peng Fan,
	Christian Eggers, stable, imx, linux-arm-kernel, linux-kernel

On 11/25/26 14:32, Stefan Ghetu wrote:
> Avoid getting error messages at startup like the following on i.MX8QXP,
> i.MX8QM and i.MX8DXL, printed once for each MAC address cell:
> 
> nvmem imx-scu-ocotp0: cell mac raw len 6 unaligned to nvmem word size 4
> 
> The same was already done for imx-ocotp and imx-ocotp-ele by commit
> 48b5163c9575 ("nvmem: imx: assign nvmem_cell_info::raw_len"), but the
> SCU based driver was not covered.
> 
> This shouldn't cause any functional change as this alignment would
> otherwise be done in nvmem_cell_info_to_nvmem_cell_entry_nodup().
> 
> Fixes: 13bcd440f2ff ("nvmem: core: verify cell's raw_len")
> Cc: stable@vger.kernel.org
> Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

Please check your git-send email settings. It looks like this emails was sent in reply to version v1
which we don't want. 

A new patch version should be a new email thread.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-25 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25  7:27 [PATCH] nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len Stefan Ghetu
2026-11-25  8:23 ` Srinivas Kandagatla
2026-11-25 12:32 ` [PATCH v2] " Stefan Ghetu
2026-11-25 15:24   ` Daniel Baluta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®