From patchwork Wed Apr 24 20:26:02 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: 10915713 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 8D17C1390 for ; Wed, 24 Apr 2019 20:26:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B3DA28AC0 for ; Wed, 24 Apr 2019 20:26:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F53F28AD5; Wed, 24 Apr 2019 20:26:29 +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 0F54628AC0 for ; Wed, 24 Apr 2019 20:26:29 +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: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:In-Reply-To:References: List-Owner; bh=WZshn1lnsWah4VTbiTFeN9WtyphLSNk4OsSPpTO1n0U=; b=IfKyaVsYR5EWWR rFWLAym3Ss4OATcLMKnpFfsY/D/uAS1KoGsoATNMJ+dMr2YVplJ9v0KrPFdshyYkRAasF0E4Nckjr 7dAi2gBXph2zt+ZjFQWUxpGogmMfHh5sT9rt7RrqTtDOzyWN0Uw/yBVQLBleZ6qxB/z2ReUKb33FF PAxGWGuWaXav8Egq6NJz4105GJ57MNNSIemP+Unh0JLxPD8T3lG5Clhx1x2OaR5/u8R0vWisfVpn8 Sj6wIj50wtSwtvs0oIb/IZONqxjj1U/d6dviF6qCtT8zCUPV/u7UX+WZs2tsTiaL9u8OEBaqprbEP NSVsXZ+bRlLzNypqleNw==; 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 1hJOTH-0001hi-NC; Wed, 24 Apr 2019 20:26:23 +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 1hJOT7-0001ZV-12 for linux-arm-kernel@lists.infradead.org; Wed, 24 Apr 2019 20:26:15 +0000 Received: by mail-ed1-x543.google.com with SMTP id j20so17109408edq.10 for ; Wed, 24 Apr 2019 13:26:12 -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:mime-version :content-transfer-encoding; bh=JIWK99vBGGbT1cNzMyqYpOByLJEZc7WsdXVzwTa1L4A=; b=nM0lUSXGYynzj0Ha5wtMb6C+aSxG/fbmpGskNVN17x7A/KydVypwIg6WQSR0WDVb+v Gm8j7UXbFYyEcADsfhPliN75Nbl16k+Mw9fFastVwF0IvTYVV2ERNbf/C4G6tZvM72Ny UcDm3JzatdiFyLpc1Yzo8MLKRs+bfe9Vo7KnmlMKugLKc7HXfFjoaBjfMRJ0HNfqS2Qx dqjUgOeELsVU6DgkR4C9KX4MBTtZPPnS7/Z9PVe7WBCCznRbuO2di5obQcpxswxMIgaT Y9c+oMXV7ks9XBQ4pvOiuEYRRXnkgHYiJXw8ZU+6ows18DBs0ioCfe4zfY8c+Dt59nE2 r6Rw== 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:mime-version :content-transfer-encoding; bh=JIWK99vBGGbT1cNzMyqYpOByLJEZc7WsdXVzwTa1L4A=; b=ffJCUsxl7C3JkpMepPu+dH4ofF2M+QPeQ1l83KTxL1XDXYkFKYfevXAfETHLBFQT97 QXlCDRVJH84CpXh//Sfze+xdfY8CkYNVLK4ZKYR0Qg+gv9sfBaLCpV1KuDlUiefRtDZb 6rT8jdZvw/usTyDbRqVwYoMaE12wq8KfAgbM5us0IE6LWmMKjLV0aQHWtaptGuz4GbRD /XCrY76WoAX8ejiA0gWTQMORehlYQIBLwL11fRW2D+AFvheqmLcfkOFJbaSOvhE4DW+p WLEQaDhqcSspAmJLKN6mbe8ooxQRbUXXrWG5kFB44HTuDY34vHntZzsdxPjP9/je6YEw vtsg== X-Gm-Message-State: APjAAAUrtFaZakhzZO6U9kN8SaIcYOlByyX1o4f8Im1M5qbvBd4YM1VA IKWJ+Xobuo7U59QpNiCMeBydcw== X-Google-Smtp-Source: APXvYqwmU+CraCpP/6Rxbip1glJu2IXUSVG7i2gFSsYx+WGFFQSYxQ5dbvUKTzAwvvlh8uWMeTx0nQ== X-Received: by 2002:a17:906:43c2:: with SMTP id j2mr17742895ejn.136.1556137570927; Wed, 24 Apr 2019 13:26:10 -0700 (PDT) Received: from event-horizon.net ([80.111.179.123]) by smtp.gmail.com with ESMTPSA id c26sm3728988eja.86.2019.04.24.13.26.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 13:26:10 -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 v5 0/5] Add i.MX8MM support Date: Wed, 24 Apr 2019 21:26:02 +0100 Message-Id: <20190424202607.23522-1-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190424_132613_253700_C44AFFA8 X-CRM114-Status: GOOD ( 13.18 ) 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 V5: - Adopt u-boot method of calculating timings. On the basis that the OTP registers have a programming time that is not related to the ipg_clk rate specify the various timing inputs to the RELAX, STROBE_READ and STROBE_PROG as-is done in u-boot. The wait time to burn a given OTP fuse is not documented anywhere except in code in u-boot. The ipg_clk then is used to clock the registers in the OCOTP block and to tell the OCOTP block how long to wait for programming to complete and how long to delay before doing an automatic re-read of the registers. Tested on the i.MX8MM-EVK relax = 1 strobe_read 6 strobe_prog 670 V4: - Change the RELAX fix to drop subtraction of -1 for all users - Leonard - Expand register definition from the 60 documented OTP registers to the entire 256 registers putatively in the address space* - Add Reviewed-by as indicated - Leonard - Added Suggested-by where it made sense - Bryan * Dumping the expanded address space shows that there are indeed OTP values present that can be read back from registers that are not formally documented for i.MX8MM eg. Bank 20 0x55000801 0x00014d14 0xd503201f 0x55000801 Bank 21 0x00014d20 0xd503201f 0x00000000 0x00000000 V3: - Fix commit log for the expanding the ADDR field i.MX6 uses seven not four bits, which is why the existing define says 0x7F not 0x0F - bod V2: - Rebased to linux-next/master to align with i.8MQ work - Two patches dropped as a result of rebase - Added patch to expand OCOTP_CTRL_ADDR to 8 bits for all users - Leonard - Makes sure nregs = 60 not 64 for i.MX8MM - Tested imx8mm-evk, imx7s-warp7 V1: This set adds support for the i.MX8MM. When adding support for this processor there are two interesting gotchas to watch for. #1 We current do not preserve the WAIT field for i.MX6 and since we are reusing the i.MX6 set_timing() values, this would also affect i.MX8. On the face of it, it appears to be an inocuous error with no real side effects. #2 Secondly the i.MX8MM will calculate a zero value for the RELAX bit-field when programming up OTP fuses. This is fine for programming the fuses but, it introduces a strange failure state with reloading the shadow registers subsequent to blowing an OTP fuse. The second important patch here then is ensuring the RELAX field is non-zero to avoid the failure state. Bryan O'Donoghue (5): nvmem: imx-ocotp: Elongate OCOTP_CTRL ADDR field to eight bits nvmem: imx-ocotp: Ensure WAIT bits are preserved when setting timing nvmem: imx-ocotp: Change TIMING calculation to u-boot algorithm nvmem: imx-ocotp: Add i.MX8MM support dt-bindings: imx-ocotp: Add i.MX8MM compatible .../devicetree/bindings/nvmem/imx-ocotp.txt | 1 + drivers/nvmem/imx-ocotp.c | 48 ++++++++++++++++--- 2 files changed, 43 insertions(+), 6 deletions(-)