From patchwork Fri Apr 19 10:03:26 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: 10908751 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 EC90717E0 for ; Fri, 19 Apr 2019 10:04:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D987328D60 for ; Fri, 19 Apr 2019 10:04:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBED828D65; Fri, 19 Apr 2019 10:04:35 +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 7F3BF28D60 for ; Fri, 19 Apr 2019 10:04:35 +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=2EgNHKU1qwtSYNkpb0uwUeo3McgTqyLeomj08CZwl/c=; b=Ho6ptaRcvyyPlk qMN12ZFpdHVkTVRewiGLRbHbbBBa18kvd3bAjRSqR5ISUlFlCdfm+jDA873g4Ar0L19bWqdlM/qpF zfDFOTaldySJUuYUhXeYpjgGQXb9hLiFFQAZldu49BJvxetnQ1URfKhqulVAKQuLWOGznjU6if89f MkFuyrjtiNUNlO0BSmIOqwmk1k9Gg57XBgVppFPHpMBQrvW4nI6KbS8EgPJSJIjCf+iX+rm3WY+MB q7GRQ+BS6tq51zO2o1mrhEQJxKdArdVlyAnB/4rZxHjcUkXOnPsQeTq6VomvUFEbY147vbgnxo/Eq MYjyAfoKTCpnEvzVEf4w==; 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 1hHQNl-0000dL-KU; Fri, 19 Apr 2019 10:04:33 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hHQMs-0007vQ-3v for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2019 10:03:41 +0000 Received: by mail-ed1-x543.google.com with SMTP id g6so4051933edc.8 for ; Fri, 19 Apr 2019 03:03:38 -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=sLZX32upRunX2OKroEkYmtK5TWRafmOA71FpDJNzJ7I=; b=pB3Q9SMn5ImOTjG8FGb5OY5H2odnh+ttr4vJIqPHpAHHyhIoReKhykE9qq/YOJw5Zs pPjXFxwxh5DI3dBCceRMTOM3ZbZpdh9pNaLoZgXiRHeo2Vszh7urlPtPYhhbKbnepL4D xnCoQ+/q+EB+wqcsJbeqdTZkChabPAJOkkR5GNNmjFPkfukrDWM7nMzil3A2sIxf+CCq r6z76YJZ3huqDI9+lz1yT66X3jaSLMvzZGVKVSoYNvwGMKPV/eTpjYRwrr+6jGnZJvq0 Q8EXS9mi+99D3pJE9a96Ict5U8p8faJlGC9Y0aiK6gk2wk1bhl2RdnUwE+uQlZE0DsNE YVng== 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=sLZX32upRunX2OKroEkYmtK5TWRafmOA71FpDJNzJ7I=; b=fFiK+/J+ho3An3+70yNEEuyL0iyDr3zhmM6P0VmsUU14hNbdirsUUukqGAhMdsphyO qJ/z4clzvH5SAJaoCflRZsykiGVD0VmXSj71PTVm/FqQH5m0scMb6JBZ6FdHzGdC/6mN 0C+uZ8Raa9sUlrr7W/fx8ef1OKm4bGNN1kOtOcosmsiaG4A7FGSf66X26QU1C9E7juXF 4m83WhfPGgciX6gwauwehihPZuWp0v9Yctk5sSRPgzrYki8vKMJoV5+5E9XK2GI5YZMi a+LzKVDDAob1cHkQ1DzU1YomuD3TggY3wFt7nBhpAOA5osOWCwuynw0pjiPmKc+KValC x10w== X-Gm-Message-State: APjAAAXaFHJ1QrqQDKmZyabFPyH7fTvaqtV9x9NggaKJ0k7puuQ/dj5P QvEcwY/k51v5/b5xycci34nMEw== X-Google-Smtp-Source: APXvYqy7ZaQWEzlgNw1KJPnTEof/Cs8pvkIhIW5lVRm6dJFqND2jAZ4VpcuhHV6apS1LZ/Z5iJLi/w== X-Received: by 2002:a05:6402:169a:: with SMTP id a26mr1956639edv.26.1555668216855; Fri, 19 Apr 2019 03:03:36 -0700 (PDT) Received: from event-horizon.net ([80.111.179.123]) by smtp.gmail.com with ESMTPSA id b11sm1254512edm.5.2019.04.19.03.03.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Apr 2019 03:03:36 -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 5/6] nvmem: imx-ocotp: Ensure the RELAX field is non-zero Date: Fri, 19 Apr 2019 11:03:26 +0100 Message-Id: <20190419100327.31483-6-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190419100327.31483-1-pure.logic@nexus-software.ie> References: <20190419100327.31483-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_030338_625288_A3C569E3 X-CRM114-Status: GOOD ( 13.79 ) 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 840d939f792b..458586295518 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -191,6 +191,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;