linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nvmem 1/1] nvmem: imx: correct the fuse word index
@ 2019-07-04 14:20 fugang.duan
  2019-07-04 15:45 ` Lothar Waßmann
  2019-07-15  5:35 ` Andy Duan
  0 siblings, 2 replies; 8+ messages in thread
From: fugang.duan @ 2019-07-04 14:20 UTC (permalink / raw)
  To: srinivas.kandagatla, shawnguo, s.hauer
  Cc: gregkh, kernel, festevam, linux-arm-kernel, linux-kernel, fugang.duan

From: Fugang Duan <fugang.duan@nxp.com>

iMX8 fuse word index represent as one 4-bytes word,
it should not be divided by 4.

Exp:
- MAC0 address layout in fuse:
offset 708: MAC[3] MAC[2] MAC[1] MAC[0]
offset 709: XX     xx     MAC[5] MAC[4]

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
---
 drivers/nvmem/imx-ocotp-scu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c
index d9dc482..be2f5f0 100644
--- a/drivers/nvmem/imx-ocotp-scu.c
+++ b/drivers/nvmem/imx-ocotp-scu.c
@@ -71,8 +71,8 @@ static int imx_scu_ocotp_read(void *context, unsigned int offset,
 	void *p;
 	int i, ret;
 
-	index = offset >> 2;
-	num_bytes = round_up((offset % 4) + bytes, 4);
+	index = offset;
+	num_bytes = round_up(bytes, 4);
 	count = num_bytes >> 2;
 
 	if (count > (priv->data->nregs - index))
@@ -100,7 +100,7 @@ static int imx_scu_ocotp_read(void *context, unsigned int offset,
 		buf++;
 	}
 
-	memcpy(val, (u8 *)p + offset % 4, bytes);
+	memcpy(val, (u8 *)p, bytes);
 
 	kfree(p);
 
-- 
2.7.4


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

end of thread, other threads:[~2019-07-15  5:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-04 14:20 [PATCH nvmem 1/1] nvmem: imx: correct the fuse word index fugang.duan
2019-07-04 15:45 ` Lothar Waßmann
2019-07-04 16:07   ` [EXT] " Andy Duan
2019-07-05  2:46     ` Andy Duan
2019-07-05  7:12       ` Lothar Waßmann
2019-07-05  7:32         ` Andy Duan
2019-07-10  2:29           ` Andy Duan
2019-07-15  5:35 ` Andy Duan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).