aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay <[email protected]>2022-11-18 06:39:21 +0000
committerGreg Kroah-Hartman <[email protected]>2022-11-23 19:44:52 +0100
commitd61784e6410f3df2028e6eb91b06ffed37a660e0 (patch)
tree1a60cf6a880600ea70d982d2026e23c909259dff
parentfbfc4ca465a1f8d81bf2d67d95bf7fc67c3cf0c2 (diff)
nvmem: stm32: add warning when upper OTPs are updated
As the upper OTPs are ECC protected, they support only one 32 bits word programming. For a second modification of this word, these ECC become invalid and this OTP will be no more accessible, the shadowed value is invalid. This patch adds a warning to indicate an upper OTP update, because this operation is dangerous as OTP is not locked by the driver after the first update to avoid a second update. Signed-off-by: Patrick Delaunay <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/nvmem/stm32-romem.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/nvmem/stm32-romem.c b/drivers/nvmem/stm32-romem.c
index d93baee01d7b..bb8aa72ba2f9 100644
--- a/drivers/nvmem/stm32-romem.c
+++ b/drivers/nvmem/stm32-romem.c
@@ -132,6 +132,9 @@ static int stm32_bsec_write(void *context, unsigned int offset, void *buf,
}
}
+ if (offset + bytes >= priv->lower * 4)
+ dev_warn(dev, "Update of upper OTPs with ECC protection (word programming, only once)\n");
+
return 0;
}