mtd: spi-nor: Set all BP bits to one when lock_len == mtd->size
authorTudor Ambarus <tudor.ambarus@microchip.com>
Mon, 23 Mar 2020 05:29:29 +0000 (07:29 +0200)
committerTudor Ambarus <tudor.ambarus@microchip.com>
Tue, 24 Mar 2020 05:44:00 +0000 (07:44 +0200)
commitb0e2d252f9280835a24e007dcd6feaef5a8809cd
tree43a9ca9d38be8c5e7c6f982c1b694e11e0bfb134
parent5bb783cc92f0da8c36c8cc288d586a4ceb6c742a
mtd: spi-nor: Set all BP bits to one when lock_len == mtd->size

When there are more BP settings than needed for defining the protected
areas of the flash memory, most flashes will define the remaining
settings as "protect all", i.e. the equivalent of having all the BP bits
set to one. But there are flashes where the in-between BP values
are undefined (not mentioned), and only the "all bits set" is protecting
the entire memory. One such example is w25q80, where BP[2:0]=0b101 and
0b110 are not defined.

Set all the BP bits to one when lock_len == mtd->size, to treat this
special case.

Suggested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Jungseung Lee <js07.lee@samsung.com>
Reviewed-by: Michael Walle <michael@walle.cc>
drivers/mtd/spi-nor/core.c