From patchwork Fri Apr 19 17:19:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 10909031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4507817EE for ; Fri, 19 Apr 2019 17:20:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39E4B28C2C for ; Fri, 19 Apr 2019 17:20:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B17228C45; Fri, 19 Apr 2019 17:20:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C67D428C2C for ; Fri, 19 Apr 2019 17:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Skxm69WZZXjXkwJ02kEFqH00Mq56Wpq4xeV2+ZAoK4M=; b=aDavSnCeESQ3JN GNdByFJZAygWZcXpe5+dUTR6uy5wLzkshj8KWH8Z/4Ng1Egu2a+YHFnsuhwmAglqOuvUJhbUA2MCc r99hpAneM6OViCDYA6DHeo6HgUEyYHNQPG4sZrCQ7odTFodvkI3uQYkMzGoy6dvLKVgMnuv3vtKbS uT30ebngtpVas2K50Y86OxU4NetK6N8sB8WnWpwX1DJd4zgjyyDr5ycSrULNDMKAcl2RKJR6wALdj XoHabM5OjrptYmrN1kIzQGMwAB/grYya4r4UXIjP0iDKyvNPjp+fxgGKGLy+TiXx3ggTQcVzhjlEn U0eNi5qTiut3uTTDlTDg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hHXBK-0004zj-Ar; Fri, 19 Apr 2019 17:20:10 +0000 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hHXAk-0003rd-SK for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2019 17:19:36 +0000 Received: by mail-ed1-x542.google.com with SMTP id u23so4555605eds.9 for ; Fri, 19 Apr 2019 10:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6ps838Dlj+6qHtOe0XaK3an5MOfwt1ArrpYzao/jeKs=; b=j+f5F8tu9vTA5adaIpXwBk3i8CwQg3VKrzvirjt3nKrXjFBfyyObSMNqnjgrNQkt66 Hcocingcv8uL/WxOsS4+rh/jP3ByeLGn3l9ZLn4ltvMRwYC2ZdLxCUeFD5DSHHvAVpJj J+W977ZSVQRaL5XDJVM4jr72jsf3YWMe3dfV6VL+8nCVQag0bxpPEgH9j9Vvis2dlZVm s/H/Wjp054X/gjdyp64I8vEwRf2aepow/tDbsYa60JATvQB9fSUz98UOECOdN8POJ2pZ YWn8RSV//4hbzEKUqwCxuZoIPE1Gx2vMUcmCbfotzUc4gkKYgbt99a30EwPWA/vTmWl/ uaEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6ps838Dlj+6qHtOe0XaK3an5MOfwt1ArrpYzao/jeKs=; b=NgJrnF869wq077lOg/wYFTJkFQi1exuNu3UFldyT1pACiZQqBsdkOIx7XzjhOQ8eAB 6EkqtX2l+hJ5DfvoWHgmmSyuc5X33hCGqAp9AowNNdS+f8N1hLBBK1IC8aC1cT1Ikrvf BXLIeg+Lf2H5ff4lq+X25o3L44pguhm5p/62619KhoIyEkev1Qsxu/4EeHMTIYVepbeW CjkYAoQouadSTvE1YG6W6EvcK43vb60hBRIDPLO++3wn1+OheFWLZREAaTGS6QFamwhx YqCWTfrkUsYqwIztGdXomlk6cp6lnVr8h22MAPrhFSo8IrmJPnWy8uMfbo/GxibyEx7p lH6g== X-Gm-Message-State: APjAAAVc+qrKJTe5yVch67jT69tbP3+U8F6TKMmuhgg3JmwUvmHqsk7t dbkG63Cu6pcByhZ5kNHQp29gTQ== X-Google-Smtp-Source: APXvYqz76U7SgKKks3P8wJ5/PKSGeYFDtdqdjhuF16NMbB5c2JBAI4vb964jjwSh3xmzbMh7LRrixA== X-Received: by 2002:a17:906:58a:: with SMTP id 10mr2546301ejn.36.1555694373610; Fri, 19 Apr 2019 10:19:33 -0700 (PDT) Received: from event-horizon.net ([80.111.179.123]) by smtp.gmail.com with ESMTPSA id q24sm938514ejr.44.2019.04.19.10.19.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Apr 2019 10:19:33 -0700 (PDT) From: Bryan O'Donoghue To: l.stach@pengutronix.de, peng.fan@nxp.com, shawnguo@kernel.org, srinivas.kandagatla@linaro.org, leonard.crestez@nxp.com Subject: [PATCH v3 3/5] nvmem: imx-ocotp: Ensure the RELAX field is non-zero Date: Fri, 19 Apr 2019 18:19:25 +0100 Message-Id: <20190419171927.24269-4-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190419171927.24269-1-pure.logic@nexus-software.ie> References: <20190419171927.24269-1-pure.logic@nexus-software.ie> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190419_101934_912131_D11612FD X-CRM114-Status: GOOD ( 14.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aisheng.dong@nxp.com, abel.vesa@nxp.com, anson.huang@nxp.com, linux-imx@nxp.com, kernel@pengutronix.de, fabio.estevam@nxp.com, Bryan O'Donoghue , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The RELAX field of the OCOTP block quote "specifies the time to add to all default timing parameters other than the Tpgm and Trd. It is given in number of ipg_clk periods". On the i.MX8MM the calculation for the RELAX value is turning out to be zero which is not a problem for programming OTP values but, does subsequently mess up reloading the OTP shadow registers. This patch ensures the RELAX field is at least one ipg_clk cycle, which seems like a pretty obvious floor to place on a value such as this. Signed-off-by: Bryan O'Donoghue --- drivers/nvmem/imx-ocotp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 85a7d0da3abb..5b625d61e433 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -186,6 +186,8 @@ static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) clk_rate = clk_get_rate(priv->clk); relax = clk_rate / (1000000000 / DEF_RELAX) - 1; + if (!relax) + relax = 1; strobe_prog = clk_rate / (1000000000 / 10000) + 2 * (DEF_RELAX + 1) - 1; strobe_read = clk_rate / (1000000000 / 40) + 2 * (DEF_RELAX + 1) - 1;