mbox series

[v5,0/3] mtd: spi-nor: OTP support

Message ID 20210321235140.8308-1-michael@walle.cc
Headers show
Series mtd: spi-nor: OTP support | expand

Message

Michael Walle March 21, 2021, 11:51 p.m. UTC
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

Comments

Tudor Ambarus April 2, 2021, 6:38 a.m. UTC | #1
On Mon, 22 Mar 2021 00:51:37 +0100, Michael Walle wrote:
> 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/
> 
> [...]

Update 1/3: use div64_u64(), IS_ALIGNED, params->otp.org.
unsigned int region, drop comment, add rlen local variable in spi_nor_mtd_otp_lock()

Applied to spi-nor/next, thanks!

[1/3] mtd: spi-nor: add OTP support
      https://git.kernel.org/mtd/c/06d4bdf0a329
[2/3] mtd: spi-nor: implement OTP support for Winbond and similar flashes
      https://git.kernel.org/mtd/c/10488a53bdc4
[3/3] mtd: spi-nor: winbond: add OTP support to w25q32fw/jw
      https://git.kernel.org/mtd/c/5909dde2bc53

Best regards,