From patchwork Thu Apr 25 13:34:24 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: 10917091 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 4F21114C0 for ; Thu, 25 Apr 2019 13:34:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 379981FF87 for ; Thu, 25 Apr 2019 13:34:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 259E12899C; Thu, 25 Apr 2019 13:34:50 +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 AE93422362 for ; Thu, 25 Apr 2019 13:34:49 +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=UE+gNYEoOuaaOT3lCv1YF1eGfd9C/aVoHqpL4iSxszQ=; b=aI3E+HGnP5fSCO dc9bHOhH1M61Y/YsOXxmAFP8gJMVTUwtsJT3dWcFUZaSNbDJ966kNBXljLoVl0/e/ldvM1sdCQWzl Znef32apWGfBozggcySSsAM6SYzFyoYKcJXxXz/8V4JzKTZxKaWsBrsOOk/6kBEWXPvKGOBNWFMS3 LfwzQ7sueFijtMuflJhYmaJZOhXOKCI/GxGVrnHZLlRNnicZEkY62bw4l3/zHnHL1J8p1YDXdvwGe cUui7OgHY7nl2jHd591OwEJ2VQD7re5/TbAp4riu7kPPw5wmdQkw+Ewyh3dW1dINgkytgGfvTXfCZ lMUvnniThklOvzHiB+Nw==; 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 1hJeWS-0006aI-Cj; Thu, 25 Apr 2019 13:34:44 +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 1hJeWJ-0006Rz-9S for linux-arm-kernel@lists.infradead.org; Thu, 25 Apr 2019 13:34:36 +0000 Received: by mail-ed1-x542.google.com with SMTP id k92so19149755edc.12 for ; Thu, 25 Apr 2019 06:34:33 -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=m8sw1rwYxfc4LACpMZCX1Kbzn04GKQLj3+eLoghKtB0=; b=nMFvYAbLHQ3MRasXd2Y63qeVTaaj/4lRrv0DqMPHn8pdVe5QDp9s3vUJDFDf6RHkbB OD0V3sDy4ZkYWwmfsuhcGvZdU+b23W4eh5kcvhRvGEX7Dtf+SqLVAd4jloBvasKVqDTf QBzNst9aN3JfrRzR8WLXAaFCHcicW272se3R2d3gZm6t+XOaJMkldvc/3D9Y3zMbP4pR vcmo953gPk+igpThhM1b89WTKdWMeWNrWXa7BwTnvGg54wZ0qV8oJGeEVUNT6EpKfeTZ 0YiyvufEALW56DRrYnaqvsL30oLCNhPssJfbHFj9J5/5D8Nrl7E6EQ6oDiII4GGLCIRw 392A== 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=m8sw1rwYxfc4LACpMZCX1Kbzn04GKQLj3+eLoghKtB0=; b=mBuMHys2zpGDJXjr8SrIVjeA5XPCzej8Mts5dO2wwASM0wrFRh3+5eFdxlG65NpQE8 6GDdGpLF6mDV9S/+pWL3XGhmFJefROCyzD5PnEXi9T75Iuf2M9lLb+6E8EBsZ4QPFTjk 3YWxNbI+aV+lsT4uxFhdinn1xQBvYKHnC0LNmOP22HX6la1xBK+41XQb45yiGrMyOHi3 uEvXCWz3kMkULcC5vh2FW+1piwYXe2WOGN97hyCfs3YUXjF4LaRnTWWGf/nRoEPs+0W/ SQP9w5MrmTF6VNp9E88BgjCLDZ62phFPbI1HmB9gJyUs2bH97h51ibogy2uqd6+uV+wc 4Udw== X-Gm-Message-State: APjAAAV1GhWocip0uotW27TsVXw/W3Ya3mw78fTQ2d85gAV2LfBkLdPh Xx82pLY2qYlVIhgMrFcosLaRjwrlVrI= X-Google-Smtp-Source: APXvYqxhgJe061uNLC3oPsiFoLPvbr9bz5M/4of+N8DOSHkFyyx0rgAPgPaYH00KS4pWgFWJ4Rk5Fw== X-Received: by 2002:a17:906:3955:: with SMTP id g21mr18904092eje.61.1556199272765; Thu, 25 Apr 2019 06:34:32 -0700 (PDT) Received: from event-horizon.net ([80.111.179.123]) by smtp.gmail.com with ESMTPSA id k20sm4027084edb.9.2019.04.25.06.34.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 06:34:32 -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 v6 2/5] nvmem: imx-ocotp: Ensure WAIT bits are preserved when setting timing Date: Thu, 25 Apr 2019 14:34:24 +0100 Message-Id: <20190425133427.30648-3-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190425133427.30648-1-pure.logic@nexus-software.ie> References: <20190425133427.30648-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-20190425_063435_327337_0C0D2960 X-CRM114-Status: GOOD ( 12.51 ) 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 i.MX6 and i.MX8 both have a bit-field spanning bits 27:22 called the WAIT field. The WAIT field according to the documentation for both parts "specifies time interval between auto read and write access in one time program. It is given in number of ipg_clk periods." This patch ensures that the relevant field is read and written back to the timing register. Fixes: 0642bac7da42 ("nvmem: imx-ocotp: add write support") Signed-off-by: Bryan O'Donoghue Reviewed-by: Leonard Crestez --- drivers/nvmem/imx-ocotp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 6600c4ddeb51..85a7d0da3abb 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -189,7 +189,8 @@ static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) strobe_prog = clk_rate / (1000000000 / 10000) + 2 * (DEF_RELAX + 1) - 1; strobe_read = clk_rate / (1000000000 / 40) + 2 * (DEF_RELAX + 1) - 1; - timing = strobe_prog & 0x00000FFF; + timing = readl(priv->base + IMX_OCOTP_ADDR_TIMING) & 0x0FC00000; + timing |= strobe_prog & 0x00000FFF; timing |= (relax << 12) & 0x0000F000; timing |= (strobe_read << 16) & 0x003F0000;