mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] nvmem: stm32: add warning when upper OTPs are updated
@ 2022-10-14 15:04 Patrick Delaunay
  2022-10-14 15:04 ` [PATCH 2/2] nvmem: stm32: add nvmem type attribute Patrick Delaunay
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Patrick Delaunay @ 2022-10-14 15:04 UTC (permalink / raw)
  To: Srinivas Kandagatla, Maxime Coquelin, Alexandre Torgue
  Cc: Patrick Delaunay, linux-arm-kernel, linux-kernel, linux-stm32

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 <patrick.delaunay@foss.st.com>
---

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

diff --git a/drivers/nvmem/stm32-romem.c b/drivers/nvmem/stm32-romem.c
index 354be526897f..e3c3c333b5d1 100644
--- a/drivers/nvmem/stm32-romem.c
+++ b/drivers/nvmem/stm32-romem.c
@@ -133,6 +133,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;
 }
 
-- 
2.25.1


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

end of thread, other threads:[~2022-10-17 10:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14 15:04 [PATCH 1/2] nvmem: stm32: add warning when upper OTPs are updated Patrick Delaunay
2022-10-14 15:04 ` [PATCH 2/2] nvmem: stm32: add nvmem type attribute Patrick Delaunay
2022-10-14 15:44 ` [PATCH 1/2] nvmem: stm32: add warning when upper OTPs are updated Patrick DELAUNAY
2022-10-17 10:36 ` kernel test robot

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®