Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: Andy Duan <fugang.duan@nxp.com>
To: Peng Fan <peng.fan@nxp.com>,
	"srinivas.kandagatla@linaro.org" <srinivas.kandagatla@linaro.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>
Cc: Aisheng Dong <aisheng.dong@nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH] nvmem: imx: scu: correct the fuse word index
Date: Thu, 5 Dec 2019 01:27:19 +0000
Message-ID: <VI1PR0402MB3600684CB1E283E73925FE66FF5C0@VI1PR0402MB3600.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <1575438591-12409-1-git-send-email-peng.fan@nxp.com>

From: Peng Fan <peng.fan@nxp.com> Sent: Wednesday, December 4, 2019 1:52 PM
> From: Peng Fan <peng.fan@nxp.com>
> 
> 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 <peng.fan@nxp.com>

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
> ---
>  drivers/nvmem/imx-ocotp-scu.c | 10 +++++-----
>  1 file 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;
> --
> 2.16.4


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

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04  5:52 Peng Fan
2019-12-05  1:27 ` Andy Duan [this message]

Reply instructions:

You may reply publically 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=VI1PR0402MB3600684CB1E283E73925FE66FF5C0@VI1PR0402MB3600.eurprd04.prod.outlook.com \
    --to=fugang.duan@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git