Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3049316pxf; Sun, 21 Mar 2021 17:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn4Q//kU7jSG7+Wv70y0iNXkZJuRR1ixkERHjUFP0TkLUn74+/DbJzaiawYTlSkci+bmM7 X-Received: by 2002:a17:906:ecb8:: with SMTP id qh24mr274415ejb.162.1616371364628; Sun, 21 Mar 2021 17:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616371364; cv=none; d=google.com; s=arc-20160816; b=Oo1YlmAfHRAdhmQk24a1eXDqcc/MZdW3sUQz9IQXzAbEqVjVjKW4Ne89icnrTKohnL GeaBBy703HaN7KuJ7dcJwCj/PI+PrzBnf7OJLi769X9PhtW8S6DRazdV7HmJ0TD/SDF4 o7rYTIV7ZQGqSG52hQwIir9g/FgI2gwwkqjhmJ44+G6ggu/JMP7DtBkm+yBWp5+mcuIM /Xd7QTe2c8Jlj/ix2mwKuKnrPq2U5SFVJKzPFogbL7QUSRmJMpi5qlXwKkk5l4uN9LYw orPLXUe2V1FRTu45g86IcVLYJ7dnxG2dmvB4KLEwm0EAyhOgPzEsX050HDTqT9cHbzYy tPEw== 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=bRI73FnBBYgYB1kw6tkuk7W1q2a0kQd5Ln970HaJOPc=; b=lmhcOkSQ1x5HtCSfgmfjUdnkZhekuFso0nngv0lBnmTtBn0690sXIifS1BzAZ2PVEr 02B3/LfFOkjXyiEbJrrNsISswpdKA1AfeW/XDu5A9o/piwc6zHFTQS52T/L7sZepeixP 8TouHtcGo9mj9VPrjnTyR2Cw3iy0dC+36WWMWSeMz4+YdQp/Qhxya0OwZ3OQKFWn6rrg pLTmZ9ZOObJAkKoumZPG2j3SPiFcvvGhr2OSR/jyW2z18oma6zuM/DkhI5hd/1ncelT/ WEXNZuKyTPpHnM7TFb46nAnEBYs3udOZFS4SQRT6WIws4P2UBuKKkAP9djKsF9P1NnOx ReKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=VoCbSpQe; 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 a9si9656208edr.332.2021.03.21.17.02.22; Sun, 21 Mar 2021 17:02:44 -0700 (PDT) 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=VoCbSpQe; 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 S230240AbhCUXwH (ORCPT + 99 others); Sun, 21 Mar 2021 19:52:07 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:60965 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbhCUXvt (ORCPT ); Sun, 21 Mar 2021 19:51:49 -0400 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 C831622172; Mon, 22 Mar 2021 00:51:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1616370707; 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=bRI73FnBBYgYB1kw6tkuk7W1q2a0kQd5Ln970HaJOPc=; b=VoCbSpQebezGTTgzOcvVGeXw/QDLm5MaA0Yc9h6+/594PnEwSwoKA9WTgvXYohwkt8FPxd mfD10HfaJBWJUdNw4jHatg/8cfS2MuIEVhacgJM4pWQElSzLtAqDWI6KiEQWQ2lqazSIhd CM3x92dqeR36hOILYP4GTeopg4zkL3M= From: Michael Walle To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Pratyush Yadav , Michael Walle Subject: [PATCH v5 0/3] mtd: spi-nor: OTP support Date: Mon, 22 Mar 2021 00:51:37 +0100 Message-Id: <20210321235140.8308-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 v4: - s/u_char/u8/ - dropped extra whitespace - moved nor->params->otp.org assignment - moved spi_nor_otp_init() after spi_nor_init() - keep fixups as last property in struct spi_nor_flash_parameter - dropped spi_nor_otp_ops() - use i instead of region - move otp.o to the list of core objects 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 (3): 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 drivers/mtd/spi-nor/Makefile | 2 +- drivers/mtd/spi-nor/core.c | 7 +- drivers/mtd/spi-nor/core.h | 60 ++++++ drivers/mtd/spi-nor/otp.c | 384 ++++++++++++++++++++++++++++++++++ drivers/mtd/spi-nor/winbond.c | 17 +- include/linux/mtd/spi-nor.h | 8 + 6 files changed, 474 insertions(+), 4 deletions(-) create mode 100644 drivers/mtd/spi-nor/otp.c -- 2.20.1