From patchwork Mon Apr 22 15:04:58 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: 10911165 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 2ED10922 for ; Mon, 22 Apr 2019 15:05:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D4C128553 for ; Mon, 22 Apr 2019 15:05:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10AAB28595; Mon, 22 Apr 2019 15:05:52 +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 A781B28553 for ; Mon, 22 Apr 2019 15:05:51 +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=hUaEZrOHOFIHQsiw+qyJyfSG3XcjI9A0eK7wG2zgyKk=; b=kHa2E3g0hAZkAt wZ6brd1Kyyw85+X4aQwlxXFdaRQA+eMVrTBPQ55/HnCFSAR0n0BuYzVt1A8awWaOfRhsVJPhteMbX YG3JmL5/edQsBJbPN4I+6qZbelS1pkAdpvlSnEPKSV3eRUqPwaqKOfymXuML9IPl/ljsTJ9VEw3r+ nDeJnnoSX2rAC/0FuAJfZ/qtBdWGT7Khnbuhb8Z6p9bRT8JR+yM8Y3a6a03yhSGZXK7l3vDk5iQ7V djO/B/syAcJKPWYisVSr4Ev/8pByTNBVqbXwGHwELaLDPayig9Vaw8X5rmMu/knCGcuhbALJbGH7+ hWgQj2IXwGsCw4E1Vixg==; 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 1hIaVv-0006LJ-2M; Mon, 22 Apr 2019 15:05:47 +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 1hIaVQ-0005ei-5W for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2019 15:05:19 +0000 Received: by mail-ed1-x543.google.com with SMTP id d46so9683969eda.7 for ; Mon, 22 Apr 2019 08:05:15 -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=yMRMU3C9G5dM2/ldW1kMLVqyuGCZjHBly2X1SHfQcLM=; b=MrcffvQQ5iNdzPx7T55iNQKZ8+kR/806loswS5gPAYd+SwRoIzV/M6ry9PjN3skOyx TcGwTw75Wd/FrH8Uta7m8QsuG3t9MIB6aSAAZmFW9IQKbmqbOgraDQuJzNroOUCxsqY/ 5LiZ8fqs/K6qjpNHa3nxFtWuFxpQYpdWc3oaiMZGVAajsVxKi0k+pmlyydpMaL0xuJzm ZQrgvoWfdIaVL8Ng6zlaMq/5uOy8XE2ybVEfYEUOKAcH6Kmrk6YWMsJjzzuPxt3aEbqL dlrtjEeId5EFhQiC2XudOJDblhm8tqXNnpLtqDGT428mz9IJSmcO5RwdpbUUbLycuChM WXZQ== 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=yMRMU3C9G5dM2/ldW1kMLVqyuGCZjHBly2X1SHfQcLM=; b=H6pdJTJFlPZnt9ckVpHz5QxILuuJ3q/ZgntWbxbZ9JNqsWtvq1/AROMVGrYgEWLxK1 Jm9hqQQXjjyUoLVgRXlX9Zm6ZkxY4t6+3P4R+AgZ3HvsFW8jxd5YM4tCouoPFcRkmeWj lbYOgWiYNQWsr0GLwtm7qT93v0M7HKsLnIxxCOZlu6VanRfFbJ024qOPHIm55lh+W16y B1jeokkstmE9r2WiW9JPC7uiU5pEpqaaWTRTzfyG8sO+IfgDLNqPFQ6c77BbbF6sfPvD 0FWXqNsjlz9SREC07YzXtpMOxefL9SvhUnLXupCByhz7e8VDR4xtuXhn+1mJq6CeTJir k0QQ== X-Gm-Message-State: APjAAAX6hFbvwnNaqBvWDlMeBf9aE2GCXIPt8TEQEWyvCDTRw7BJuTlR 70RrNNxxkn5WqphYlLnD5am7qQ== X-Google-Smtp-Source: APXvYqyqtUUej2oN04Qxk7gAD9fUTA1hp/fWl8B3tz1dC+lzzpFv7SyWqhXbi2ok4/NhelKm9chz5A== X-Received: by 2002:a17:906:54d1:: with SMTP id c17mr9883750ejp.223.1555945514545; Mon, 22 Apr 2019 08:05:14 -0700 (PDT) Received: from event-horizon.net ([80.111.179.123]) by smtp.gmail.com with ESMTPSA id f27sm3712688edb.77.2019.04.22.08.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Apr 2019 08:05:13 -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 v4 3/5] nvmem: imx-ocotp: Ensure the RELAX field is non-zero Date: Mon, 22 Apr 2019 16:04:58 +0100 Message-Id: <20190422150500.11082-4-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190422150500.11082-1-pure.logic@nexus-software.ie> References: <20190422150500.11082-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-20190422_080516_445547_964F367C X-CRM114-Status: GOOD ( 15.22 ) 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 drops the -1 component of the RELAX field calculation. Since RELAX specifies a number of cycles to do nothing, adding one extra cycle is safe. The DEF_RELAX components of the timing calculation are unaffected. Fixes: 0642bac7da42 ("nvmem: imx-ocotp: add write support") Signed-off-by: Bryan O'Donoghue Suggested-by: Leonard Crestez --- drivers/nvmem/imx-ocotp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 85a7d0da3abb..2fa45d1d17eb 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -185,7 +185,7 @@ 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; + relax = clk_rate / (1000000000 / DEF_RELAX); strobe_prog = clk_rate / (1000000000 / 10000) + 2 * (DEF_RELAX + 1) - 1; strobe_read = clk_rate / (1000000000 / 40) + 2 * (DEF_RELAX + 1) - 1;