Linux 5.13 Adds Support For SPI NOR One-Time Programmable Memory Regions
Linux 5.13 adds the new MTD OTP functions for accessing SPI one-time programmable data. The OTP are memory regions intended to be programmed once and can be used for permanent secure identification, immutable properties, and similar purposes.
In addition to adding the core infrastructure support for OTP to the MTD SPI-NOR code in Linux 5.13, the functionality is wired up for Winbond and similar flash memory chips. The MTD subsystem has already supported OTP areas but not for SPI-NOR flash memory.
While it's "one-time programmable", the code does introduce an ERASE ioctl interface for OTP too. It turns out some flash memory chips support erasing the OTP region multiple times until becoming locked. So if encountering a flash memory chip with an OTP region not yet locked, that interface can be used for erasing it... Which can be useful for development purposes.
Various kernel developers have been working on SPI OTP support for the mainline Linux kernel in recent years while finally the support made its way to Linux 5.13 via the MTD pull last week after being stuck under review the past year.