aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/nvmem
diff options
context:
space:
mode:
authorPeng Fan <[email protected]>2020-01-09 10:40:15 +0000
committerGreg Kroah-Hartman <[email protected]>2020-01-10 13:52:12 +0100
commit8c4d35aff54042aa80efaabdb7b754b3d74a71d5 (patch)
tree67c610f821c391f298762e090888a9145f28c02f /drivers/nvmem
parentnvmem: imx: scu: fix write SIP (diff)
downloadwireguard-linux-8c4d35aff54042aa80efaabdb7b754b3d74a71d5.tar.xz
wireguard-linux-8c4d35aff54042aa80efaabdb7b754b3d74a71d5.zip
nvmem: imx: scu: correct the fuse word index
i.MX8 fuse word row index represented as one 4-bytes word. Exp: - MAC0 address layout in fuse: offset 708: MAC[3] MAC[2] MAC[1] MAC[0] offset 709: XX xx MAC[5] MAC[4] The original code takes row index * 4 as the offset, this not exactly match i.MX8 fuse map documentation. So update code the reflect the truth. Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Fugang Duan <[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]>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r--drivers/nvmem/imx-ocotp-scu.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c
index 455675dd8efe..399e1eb8b4c1 100644
--- a/drivers/nvmem/imx-ocotp-scu.c
+++ b/drivers/nvmem/imx-ocotp-scu.c
@@ -138,8 +138,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))
@@ -168,7 +168,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);
mutex_unlock(&scu_ocotp_mutex);
@@ -188,10 +188,10 @@ static int imx_scu_ocotp_write(void *context, unsigned int offset,
int ret;
/* allow only writing one complete OTP word at a time */
- if ((bytes != 4) || (offset % 4))
+ if (bytes != 4)
return -EINVAL;
- index = offset >> 2;
+ index = offset;
if (in_hole(context, index))
return -EINVAL;
OSZAR »