Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp112573pxb; Fri, 5 Mar 2021 16:12:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1nsj6ukwy5P6sLfH5a+ijUDQnzCd3zrnTD7CVZZAd2fWTey/M6fI+Jy1gK+G1QOlRq6KE X-Received: by 2002:aa7:d987:: with SMTP id u7mr11530292eds.326.1614989570808; Fri, 05 Mar 2021 16:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614989570; cv=none; d=google.com; s=arc-20160816; b=qwYtuiJ/Qdu7DUkUR/eldfBsBIDjfYUS5woUjigUSQyjcKwh1/7DftwN5Bi6KXVBQo gcoaJW6kXNfILWXHtJKRPyM/EFGi0djQBjg3Ymi1iKZBKFH50sAEcYAA13iVLBBl0pXz KhOM77YSh/snq110R/Zq1Fa9edpI9vCsx2rdCiwU8CJWQN+vABMz3JY3N1HDALwXmhzI 6Rf6WQy5B3DVAD6nMes2Lefjf3WvpiD3EJ+sCs6BBoxY+QbTHM6NSrhAEb6+r/aS/XdJ MBAKDnfMv3ibZkTnbtBtCmdoUZ9cBEPiYchVNcApt3mMiGchF/nuBwxgTINsEWKy4C7u MmKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7Uoux/O1JWx+NLbrxspPKrHa/J//QkiAqvm8Eira3vg=; b=pvqGbUmYTwvr3OZXVZ05zLtwyE0PXZis4svowJdEScuBt7GofDgilFqYtIvi9aSMZ7 23AmZCclGHyG+32VhabvU8tJ05xVv2Z3R7boHVn9zEmtP7uJ1a3COMR0vIhkChzjBiP7 L1B1yw7BQiZViNFuQYPIQaWzUEt2pDcdpPsOYpnsb8haeNdgIKFhxihSONkUoX2IGYQ+ HPyUHwmQ1wYPnI9YZPVsQb1IQsHeKxYdicKSkWFrV250o+4KHUUm2hN8j57SYbptkOP2 vNzrowpaPNrfXPO2fOeKEQd/C/rkHtJYGYUM3bBTbVg0w/qihFY9gi6NXs2BnbwMRMgs +d5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=GwWx8WXP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si2306328ejt.487.2021.03.05.16.12.27; Fri, 05 Mar 2021 16:12:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=GwWx8WXP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbhCFAGG (ORCPT + 99 others); Fri, 5 Mar 2021 19:06:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbhCFAFu (ORCPT ); Fri, 5 Mar 2021 19:05:50 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6973EC061761 for ; Fri, 5 Mar 2021 16:05:50 -0800 (PST) Received: from mwalle01.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:fa59:71ff:fe9b:b851]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 144DB22205; Sat, 6 Mar 2021 01:05:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1614989146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=7Uoux/O1JWx+NLbrxspPKrHa/J//QkiAqvm8Eira3vg=; b=GwWx8WXP9kh/IPmsql821t23VrYqfX66wYLwdOyrg+qz7DB2NKGotL2loKOe1wXbDE7xf5 D+GGfapUc3JHlFAvPOQnC92T2T+nkqREhTkYq0DT5Aeps5yizTHtv0hpx9RGCBTHlMu3v/ UYYd5V3cisV7bjHsicgXjaWiGVa6z6k= From: Michael Walle To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Michael Walle Subject: [PATCH v4 0/4] mtd: spi-nor: OTP support Date: Sat, 6 Mar 2021 01:05:31 +0100 Message-Id: <20210306000535.9890-1-michael@walle.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset implements the MTD OTP functions to allow access to the SPI OTP data. Specific support is added for Winbond flash chips. In the past there was already an attempt by Rahul Bedarkar to add this, but there was no response. These patches are slightly based on his work. https://lore.kernel.org/linux-mtd/1489754636-21461-1-git-send-email-rahul.bedarkar@imgtec.com/ Changes since v3: - remapped the OTP regions to a contiguous area starting at 0. The chips/cfi_cmdset_000[12].c remap the regions, too. - with that in place, read/write/lock/erase spanning multiple OTP regions are possible - picked up Tudors review remarks - added new erase support as RFC because MTD API/ABI is still missing. Feel free to review, but don't apply it. Changes since v2: - improved commit messages - add buffer size check in spi_nor_mtd_otp_info(). just to be sure, the buffer is hardcoded to 4k by the mtd subsys - moved all code to otp.c - dropped the patches introduced in v2 Changes since v1: - added methods for Macronix and similar flashes - added patch to cleanup/consolidate code in core.c Michael Walle (4): mtd: spi-nor: add OTP support mtd: spi-nor: implement OTP support for Winbond and similar flashes mtd: spi-nor: winbond: add OTP support to w25q32fw/jw mtd: spi-nor: implement OTP erase for Winbond and similar flashes drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/core.c | 11 +- drivers/mtd/spi-nor/core.h | 64 +++++ drivers/mtd/spi-nor/otp.c | 453 ++++++++++++++++++++++++++++++++++ drivers/mtd/spi-nor/winbond.c | 18 +- include/linux/mtd/spi-nor.h | 9 + 6 files changed, 551 insertions(+), 5 deletions(-) create mode 100644 drivers/mtd/spi-nor/otp.c -- 2.20.1