mtd: spi-nor: Fix the disabling of write protection at init
authorTudor Ambarus <tudor.ambarus@microchip.com>
Wed, 31 Jul 2019 08:46:16 +0000 (08:46 +0000)
committerRichard Weinberger <richard@nod.at>
Tue, 13 Aug 2019 12:34:42 +0000 (14:34 +0200)
commit834de5c1aa768eb3d233d6544ea7153826c4b206
treef3910fe2e377e8b5371d0fdf63c8c32196d50ff4
parentd45331b00ddb179e291766617259261c112db872
mtd: spi-nor: Fix the disabling of write protection at init

spi_nor_spansion_clear_sr_bp() depends on spansion_quad_enable().
While spansion_quad_enable() is selected as default when
initializing the flash parameters, the nor->quad_enable() method
can be overwritten later on when parsing BFPT.

Select the write protection disable mechanism at spi_nor_init() time,
when the nor->quad_enable() method is already known.

Fixes: 191f5c2ed4b6faba ("mtd: spi-nor: use 16-bit WRR command when QE is set on spansion flashes")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/spi-nor/spi-nor.c