All of lore.kernel.org
 help / color / mirror / Atom feed
From: fugang.duan@nxp.com
To: srinivas.kandagatla@linaro.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de
Cc: gregkh@linuxfoundation.org, kernel@pengutronix.de,
	festevam@gmail.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, fugang.duan@nxp.com
Subject: [PATCH nvmem 1/1] nvmem: imx: correct the fuse word index
Date: Thu,  4 Jul 2019 22:20:15 +0800	[thread overview]
Message-ID: <20190704142015.10701-1-fugang.duan@nxp.com> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: fugang.duan@nxp.com
To: srinivas.kandagatla@linaro.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de
Cc: fugang.duan@nxp.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de,
	festevam@gmail.com, linux-arm-kernel@lists.infradead.org
Subject: [PATCH nvmem 1/1] nvmem: imx: correct the fuse word index
Date: Thu,  4 Jul 2019 22:20:15 +0800	[thread overview]
Message-ID: <20190704142015.10701-1-fugang.duan@nxp.com> (raw)

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2019-07-04 14:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 14:20 fugang.duan [this message]
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 15:45   ` Lothar Waßmann
2019-07-04 16:07   ` [EXT] " Andy Duan
2019-07-04 16:07     ` Andy Duan
2019-07-05  2:46     ` Andy Duan
2019-07-05  2:46       ` Andy Duan
2019-07-05  7:12       ` Lothar Waßmann
2019-07-05  7:12         ` Lothar Waßmann
2019-07-05  7:32         ` Andy Duan
2019-07-05  7:32           ` Andy Duan
2019-07-10  2:29           ` Andy Duan
2019-07-10  2:29             ` Andy Duan
2019-07-15  5:35 ` Andy Duan
2019-07-15  5:35   ` Andy Duan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190704142015.10701-1-fugang.duan@nxp.com \
    --to=fugang.duan@nxp.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.