From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A354C352AA for ; Tue, 1 Oct 2019 10:14:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3BCD32133F for ; Tue, 1 Oct 2019 10:14:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rcfqyqM9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SCWeuwoj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BCD32133F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uES+m/usMlCx0sVLumtcZd8QWDjY820nYzDe/MqfvNQ=; b=rcfqyqM9OCO21BAoy/JlsaVJt 8eS6B3q0LqrD1LhG0VzGpbDhj2Tdh3r/f6Tbemh9ftH0JuWHsEaLSVTFLis/eHqkY2mL91lZpUmj/ iCx2Go1Alogot5wxu2f+yZVuiW1X9Jrvp+3qkSrTVhkKk6g5NBtZYZMuUNMlmhMDQey9ubiKQ/x+S p34oTgTPGai4/hk+kQZNd9g12qz2rZKKQGa25pq58zrxAD8xusIPm/ocgmlZh/b9nsRs/H8pulQYg IxvdbGDccHf36QJj5MOyU6HWFa/Ou/oxgj/sq8fczOByhkGzX2Ge9V4mcOiMQ2WpJJnk9+eNm3zNv DUqmVgwbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFFBJ-0007zy-4G; Tue, 01 Oct 2019 10:14:57 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFFBF-0007zd-Uf for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2019 10:14:55 +0000 Received: by mail-wr1-x441.google.com with SMTP id r3so14775876wrj.6 for ; Tue, 01 Oct 2019 03:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=TqnRymZHVB3nETq43Yyx3kDj0Su1WqRmQVreGP9eeAM=; b=SCWeuwojpC5yiuVk+b45PdbihMNriak/36ZsCE0jmeSduzCjq/s51e80vXGAJkh3DO qOHqQtqPLCXcoR4SCjvUPn8599enHuL8DaInPPRnMJAbE2OX+R0at2cRImMnVa8lvkz6 jJLXpTtZ+/tu1Jrrb9ZyWKHK4a5AWtizXLSU8Lo7W8GJOifGv04j8JitEpzXburg3asJ H8BysylFgjcP+/1rpYynNTj+oSnqnD5KCDSpcibbNkz+BvguDi/xyTPScY0gm2itHv4+ Z/d/4nB2wk4CLERLmyyDDWuXNXMBDhYOSOJug9IVfhrxKJoEn+AqHdio2hy9ClO0BK1b p40w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TqnRymZHVB3nETq43Yyx3kDj0Su1WqRmQVreGP9eeAM=; b=Ch/ne8d+an7JVWANg9bbn4GYzXBP2bQc03aWrLCG4o/xmOV5Wu38RUn8q98Rq4oAd8 Cqt/S8A44qD/RW2vAZ0u7bChjTk+kRcN/vglYfylAkCtRlYRkhQWVUFRmKSU4s5asAYm pZltj9bbv92SKfkRoaHNxMbc3qSmq+cz7zQ3baHsoza/g/kqI0spaydy6mMqTsLKKQpt NOXqMJnygmqDFWqsVoBbXKrfKAzPAuuqrutwTKvuu09iyji5tFrv4LsNXmpXPQmmtl07 YjWSSE5IyppUnsOLYL6589KNGZnkmInr/OA9Telua59c1272ztQIP02MqiLumGqbH06P 4v9A== X-Gm-Message-State: APjAAAWHDVsG1/rPPa+822KcWQ+IqRWwFFRHyBFE53AayXJpmtIZ5SDJ N7W+2IMlULT/wEbjq0ed2xuUpg== X-Google-Smtp-Source: APXvYqzF+PTKz9urDrKppbUD/aENMJ4pxtaMLYaIAnlz/3ezqaTV4JEnelkNmPMCMeGl5wJhux3KWw== X-Received: by 2002:a05:6000:162e:: with SMTP id v14mr17736905wrb.112.1569924892368; Tue, 01 Oct 2019 03:14:52 -0700 (PDT) Received: from [192.168.86.34] (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.googlemail.com with ESMTPSA id t13sm33081133wra.70.2019.10.01.03.14.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Oct 2019 03:14:51 -0700 (PDT) Subject: Re: [PATCH V2 1/2] nvmem: imx: scu: support hole region check To: Peng Fan , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" References: <1569550913-10176-1-git-send-email-peng.fan@nxp.com> From: Srinivas Kandagatla Message-ID: <48bc66d5-684a-cfdb-67dd-722dbf80edbf@linaro.org> Date: Tue, 1 Oct 2019 11:14:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1569550913-10176-1-git-send-email-peng.fan@nxp.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191001_031454_019824_223DAA43 X-CRM114-Status: GOOD ( 23.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aisheng Dong , "linux-kernel@vger.kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux-arm-kernel@lists.infradead.org" Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 27/09/2019 03:23, Peng Fan wrote: > From: Peng Fan > > Introduce HOLE/ECC_REGION flag and in_hole helper to ease the check > of hole region. The ECC_REGION is also introduced here which is > preparing for programming support. ECC_REGION could only be programmed > once, so need take care. > > Signed-off-by: Peng Fan > --- > > V2: > Rebased on latest linux-next > > drivers/nvmem/imx-ocotp-scu.c | 47 ++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 42 insertions(+), 5 deletions(-) thanks, applied both. --srini > > diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c > index 61a17f943f47..030e27ba4dfb 100644 > --- a/drivers/nvmem/imx-ocotp-scu.c > +++ b/drivers/nvmem/imx-ocotp-scu.c > @@ -19,9 +19,20 @@ enum ocotp_devtype { > IMX8QM, > }; > > +#define ECC_REGION BIT(0) > +#define HOLE_REGION BIT(1) > + > +struct ocotp_region { > + u32 start; > + u32 end; > + u32 flag; > +}; > + > struct ocotp_devtype_data { > int devtype; > int nregs; > + u32 num_region; > + struct ocotp_region region[]; > }; > > struct ocotp_priv { > @@ -38,13 +49,41 @@ struct imx_sc_msg_misc_fuse_read { > static struct ocotp_devtype_data imx8qxp_data = { > .devtype = IMX8QXP, > .nregs = 800, > + .num_region = 3, > + .region = { > + {0x10, 0x10f, ECC_REGION}, > + {0x110, 0x21F, HOLE_REGION}, > + {0x220, 0x31F, ECC_REGION}, > + }, > }; > > static struct ocotp_devtype_data imx8qm_data = { > .devtype = IMX8QM, > .nregs = 800, > + .num_region = 2, > + .region = { > + {0x10, 0x10f, ECC_REGION}, > + {0x1a0, 0x1ff, ECC_REGION}, > + }, > }; > > +static bool in_hole(void *context, u32 index) > +{ > + struct ocotp_priv *priv = context; > + const struct ocotp_devtype_data *data = priv->data; > + int i; > + > + for (i = 0; i < data->num_region; i++) { > + if (data->region[i].flag & HOLE_REGION) { > + if ((index >= data->region[i].start) && > + (index <= data->region[i].end)) > + return true; > + } > + } > + > + return false; > +} > + > static int imx_sc_misc_otp_fuse_read(struct imx_sc_ipc *ipc, u32 word, > u32 *val) > { > @@ -91,11 +130,9 @@ static int imx_scu_ocotp_read(void *context, unsigned int offset, > buf = p; > > for (i = index; i < (index + count); i++) { > - if (priv->data->devtype == IMX8QXP) { > - if ((i > 271) && (i < 544)) { > - *buf++ = 0; > - continue; > - } > + if (in_hole(context, i)) { > + *buf++ = 0; > + continue; > } > > ret = imx_sc_misc_otp_fuse_read(priv->nvmem_ipc, i, buf); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel