From patchwork Fri Apr 19 17:19: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: 10909029 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 5992614DB for ; Fri, 19 Apr 2019 17:19:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EE3828749 for ; Fri, 19 Apr 2019 17:19:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 427E828A3E; Fri, 19 Apr 2019 17:19:57 +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 DCFDF28749 for ; Fri, 19 Apr 2019 17:19:56 +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=oaIgZb+Ek1Z3+4JOdbvHR5AsjEUEzMp/BU8mPEvi82c=; b=JTlnsUd64PEX+9 /KwYgnYj0eEK8aYQ+gb8OSVZIzQd2oa7lavXrabT1RHocIEnJpuCB8UeIOo1uSSgI8M8LxjR3mM7K KmuYy9nzGnkTcOFhQft+Uhe33b5YnECDvSu/HHaQGdiEaTrv5KPgoGqUKYcdfKIoceYYC5ntLfJnk p8VGFwQh9VHvtPxKF2XB8DKa6LFYls5Dx3bsOFsZXyCE0X7LsfabU+8KZEx8YJwsaivu8j1w+5+kB OSOgbFzECEB5FFbnaxq635xa0JMZsZxFtQ8VpN0D82nZNbzgckGIfFSG4WF+oTeYCd9VFqn7nXUr8 bZAZBax+rZaK+fFUJGRw==; 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 1hHXB3-0004HL-Kb; Fri, 19 Apr 2019 17:19:53 +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 1hHXAj-0003rA-TZ for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2019 17:19:35 +0000 Received: by mail-ed1-x542.google.com with SMTP id d1so4852168edd.13 for ; Fri, 19 Apr 2019 10:19: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=jUfcItRpO2hx612krZRy+YsfynN5A1FzQU9vxJ3jr+s=; b=MAZeai5z6NMX/l6c5gnq5yQkPXThhIo1hskSLZm5boGzURihBserrzsb1a83FnNuTl ZeY7NpSi5cQsRXfRgMhj2iRnZ+1Y2+TW7dx6aS6XfWT2r44KS1RV3z/aC1r/Kskr2ZKF 8jwl5QVj0lWOazUZecCu0Jn8VY47w/JsLz75/+y3++hikLSk92ainWIEJNJVAzM3YLW+ BZUANATCQmpgIy+0mfrYKMFI1n2KO1Tdj3nPTLAiz3tobUScQeIFMH+Uw7Xr8w/uDtyW dKPMkt7SH6GL45GFuG0vNvgK6Cn1/J59OWmhdKL8P/+TFMmfwtBMrI3Yc5DIdfyLqQYc ZSlg== 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=jUfcItRpO2hx612krZRy+YsfynN5A1FzQU9vxJ3jr+s=; b=c9Zvnul5n982Gqq06laExSp2yhUKCaZtsG/+Kb0HDuBkx0osEtYZUxhF35l6pyMr3y X0Wsv0k1yAbp/WTPeZZ3RZZXVEuHUeFlSwqY1oJ9AZqbJeyaMaof0MSItzTwIiLweFOu ImuuulrMopVh/3HU2Wo/PktsyA8wuVgmPUNB2Pcx5UkXg/N0aBjzdDZqdm8ysSWLio81 30zaa99QqfQo9xqBKwxK6vB1aFcbWoze+09bO/YTdULIFff0Ju8ST+S/l2TraAo68TC7 /lqMPeVzozMt870GuQFulIVXhk2/kuEHmRKjfnhDWhq2Fo4gLW9g2aqrTqM6zSsIIu73 nQLA== X-Gm-Message-State: APjAAAXGWHMxNoqgMDpd8KKy46pe+xgl+1p+zFf240ESuAStIdbCSSs6 Urrp9GN5nkhXniGFlSGzlMLgvA== X-Google-Smtp-Source: APXvYqz5gU0jfk5ew8JTpoKf/aFC1A7XmdggDM+PecMz6KbpeRqqwqpRXG37ohaceBFDPyhVOCSy3A== X-Received: by 2002:a50:b3a7:: with SMTP id s36mr2509329edd.4.1555694372569; Fri, 19 Apr 2019 10:19:32 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Apr 2019 10:19: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 v3 2/5] nvmem: imx-ocotp: Ensure WAIT bits are preserved when setting timing Date: Fri, 19 Apr 2019 18:19:24 +0100 Message-Id: <20190419171927.24269-3-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_101933_958816_5E77BE29 X-CRM114-Status: GOOD ( 13.20 ) 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;