Skip to contentSkip to conversation

nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len

PATCH Superseded Stefan Ghetu 3 participants 4 messages Nov 25

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len

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")
---
 drivers/nvmem/imx-ocotp-scu.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/nvmem/imx-ocotp-scu.c +7 -0
index 20312fba22d23..80f78bcf3841e 100644
@@ -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[] = {
Signature · 1 line
2.53.0
#1 lore raw
Quoted 5 lines · 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

Quoted 8 lines

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.

Quoted 30 lines
---
 drivers/nvmem/imx-ocotp-scu.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/nvmem/imx-ocotp-scu.c +7 -0
index 20312fba22d23..80f78bcf3841e 100644
@@ -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 lore raw

PATCH v2 1/1 nvmem: imx-ocotp-scu: assign nvmem_cell_info::raw_len

In reply to 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")

---
Changes in v2:
- Add Cc: [email protected], as requested by Srinivas Kandagatla.

v1: https://lore.kernel.org/all/[email protected]/

 drivers/nvmem/imx-ocotp-scu.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/nvmem/imx-ocotp-scu.c +7 -0
index 20312fba22d23..80f78bcf3841e 100644
@@ -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[] = {
Signature · 1 line
2.43.0
Reviewed-by on v2 1/1
#3 lore raw
Quoted 9 lines · 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.

Quoted 6 lines

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

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.