Thread (6 messages) 6 messages, 2 authors, 2023-02-15
STALE1231d
Revisions (2)
  1. v1 current
  2. v1 [diff vs current]

[PATCH 2/2] nvmem: brcm_nvram: use bcm47xx buffered data

From: Willem-Jan de Hoog <hidden>
Date: 2023-02-06 10:06:33
Also in: lkml
Subsystem: nvmem framework, the rest · Maintainers: Srinivas Kandagatla, Linus Torvalds

The bcm47xx module has a copy of the NVRAM data in ram. When available, use
this one instead of reading from io memory since it causes mtd/ubi to fail.

[ arinc.unal: Improved patch subject and log ]

Signed-off-by: Willem-Jan de Hoog <redacted>
Signed-off-by: Arınç ÜNAL <redacted>
---
 drivers/nvmem/brcm_nvram.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/drivers/nvmem/brcm_nvram.c b/drivers/nvmem/brcm_nvram.c
index 34130449f2d2..f74bcb1c948e 100644
--- a/drivers/nvmem/brcm_nvram.c
+++ b/drivers/nvmem/brcm_nvram.c
@@ -33,6 +33,12 @@ struct brcm_nvram_header {
 static int brcm_nvram_read(void *context, unsigned int offset, void *val,
 			   size_t bytes)
 {
+#ifdef CONFIG_BCM47XX_NVRAM
+
+	return bcm47xx_nvram_read(offset, val, bytes);
+
+#else
+
 	struct brcm_nvram *priv = context;
 	u8 *dst = val;
 
@@ -40,6 +46,8 @@ static int brcm_nvram_read(void *context, unsigned int offset, void *val,
 		*dst++ = readb(priv->base + offset++);
 
 	return 0;
+
+#endif
 }
 
 static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data,
-- 
2.37.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help