Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2319254ybi; Thu, 4 Jul 2019 08:47:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvG8GNiDssgxmvNyD9fFeUiKJgcrdANqbJfe4B/z8dTFk3ARlRGSKth3SLiZHa9IcLYX5L X-Received: by 2002:a17:90a:8c0c:: with SMTP id a12mr222701pjo.67.1562255223962; Thu, 04 Jul 2019 08:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562255223; cv=none; d=google.com; s=arc-20160816; b=j7L9ioFBo5y2/aNKlAUU4piYf0p7kXdp469T+sSjRBHh1J04g6UGZTVGz9kgU9OoPl BG7M6lS2surDIoXTLte+yZl7/hHfrliCsi/vAjekvyp/i6qLl5UYP8Z7VW17jG7LYJ6e vx2iQ0lluUtBydFNxV/ffDDm0hAf7Bu+nljqNe0vDVJXbt/jUsOqn7pTug/CBTqG5W+X YgFAbVIxS8l8exrUTDX089w8O0FdPfseyWO2fxQTH827BhgSZ357iyMWxK1Ct1fh2Re2 TWcqpgTzYFDqA5CTj6RXo7IfPebPXZjIYDqnnFm3CHIFk/HlkjBwbH5v+aO5NF0JTdkJ SuuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=X7rE4dxHbT4quD7F/U5tocJZ4y4gS+ZSLDa87RRW/tY=; b=HHkD3Al5bbefNSNAwx3bGOUSY5J3023UEkn6Ggq+fiETm91iNWTnvDhKCuUXHttWbF anF9ROA8m3oZyvKsA7ol8gOn3sXPCylyjLpRwKHNP93S7F+2Sya4f7R74nzxqzlLZW8W bqHLfhUURA+swAphg7d870PKvebLF7eRYSi06BFOzCVJiAmpt+E6IVBFAWShQxkMPYwv wdAFOh0TbM0W0uhqzfbQrChqHSypAudMGN6RmacLC7iIWu0cGCffMzhPvWM28b/jV4S8 iB5W18qTP+I9HaRHrHZ5oDqhkm3oMTg+e5t1knaEGNLcsDFRmGECtC6+B92f6FM8oNPo YBIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e65si5600156pgc.454.2019.07.04.08.46.49; Thu, 04 Jul 2019 08:47:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727822AbfGDPpv convert rfc822-to-8bit (ORCPT + 99 others); Thu, 4 Jul 2019 11:45:51 -0400 Received: from mailout02.agenturserver.de ([185.15.192.33]:48860 "EHLO mailout02.agenturserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727066AbfGDPpv (ORCPT ); Thu, 4 Jul 2019 11:45:51 -0400 Received: from mail02.agenturserver.de (mail02.internal [172.16.51.35]) by mailout02.agenturserver.de (Postfix) with ESMTP id 7F5401209BB; Thu, 4 Jul 2019 17:45:47 +0200 (CEST) Received: from localhost (ac02.internal [172.16.51.82]) by mail02.agenturserver.de (Postfix) with ESMTP id 7323380670; Thu, 4 Jul 2019 17:45:47 +0200 (CEST) X-Spam-Level: Received: from mail.agenturserver.de ([172.16.51.35]) by localhost (ac02.mittwald.de [172.16.51.82]) (amavisd-new, port 10026) with ESMTP id Ky2jPVPPeh4V; Thu, 4 Jul 2019 17:45:47 +0200 (CEST) Received: from karo-electronics.de (unknown [89.1.81.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lw@karo-electronics.de) by mail.agenturserver.de (Postfix) with ESMTPSA; Thu, 4 Jul 2019 17:45:46 +0200 (CEST) Date: Thu, 4 Jul 2019 17:45:43 +0200 From: Lothar =?UTF-8?B?V2HDn21hbm4=?= To: fugang.duan@nxp.com Cc: srinivas.kandagatla@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH nvmem 1/1] nvmem: imx: correct the fuse word index Message-ID: <20190704174543.194a0158@karo-electronics.de> In-Reply-To: <20190704142015.10701-1-fugang.duan@nxp.com> References: <20190704142015.10701-1-fugang.duan@nxp.com> Organization: Ka-Ro electronics GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, 4 Jul 2019 22:20:15 +0800 fugang.duan@nxp.com wrote: > From: Fugang Duan > > 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 > --- > 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); > With these changes you could use the 'val' pointer directly as the destination for ocotp_read() without need for an intermediate buffer. Lothar Waßmann