Here's an attempt at implementing locking support for Macronix
flashes. I've tested that it works on the chip used on our boards, and
reading data sheets for various other Macronix chips suggest they
behave in the same way.
I'm still not entirely sure about the best way to hook up these
functions in spi_nor_scan. Also, I'm ignoring the UI/UX issue of
automatically setting a OTP bit without some "force" or "yes, I'm
sure" opt-in - maybe I'm simply overthinking it and it's not a problem
in practice (at least for our use case at hand, we will use bottom
protect, so we can't really shoot ourselves in the foot).
Rasmus Villemoes (3):
mtd: spi-nor: don't guard stm_*lock* family by preprocessor
conditionals
mtd: spi-nor: add support for locking on Macronix nor flashes
mtd: spi-nor: set SPI_NOR_HAS_LOCK for Macronix mx25l3205d
drivers/mtd/spi/spi-nor-core.c | 268 ++++++++++++++++++++++++++++-----
drivers/mtd/spi/spi-nor-ids.c | 2 +-
include/linux/mtd/spi-nor.h | 3 +
3 files changed, 236 insertions(+), 37 deletions(-)