mtd: spi-nor: implement OTP support for Winbond and similar flashes
authorMichael Walle <michael@walle.cc>
Sun, 21 Mar 2021 23:51:39 +0000 (00:51 +0100)
committerTudor Ambarus <tudor.ambarus@microchip.com>
Fri, 2 Apr 2021 06:32:27 +0000 (09:32 +0300)
commitcad3193fe9d1f0af4d05ed86693f99984409b188
tree6de5f8b06449973d82b32de989764d395c4273ba
parent069089acf88b2216b667c1e5994e08b4d2e1ea12
mtd: spi-nor: implement OTP support for Winbond and similar flashes

Use the new OTP ops to implement OTP access on Winbond flashes. Most
Winbond flashes provides up to four different OTP regions ("Security
Registers").

Winbond devices use a special opcode to read and write to the OTP
regions, just like the RDSFDP opcode. In fact, it seems that the
(undocumented) first OTP area of the newer flashes is the actual SFDP
table.

On a side note, Winbond devices also allow erasing the OTP regions as
long as the area isn't locked down.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20210321235140.8308-3-michael@walle.cc
drivers/mtd/spi-nor/core.c
drivers/mtd/spi-nor/core.h
drivers/mtd/spi-nor/otp.c
include/linux/mtd/spi-nor.h