Re: [PATCH 1/2] mtd: spi-nor: add block protection flags to macronix

Michael Walle
2021-03-08T09:17:31Z

> Macronix flash chips support block protection by using BP bits in the
> read status register. Add the corresponding flag to indicate block
> protection support.
>
> Otherwise, locked blocks are not unlocked when requested.
>
> Signed-off-by: David Bauer <mail@david-bauer.net>
> ---
> drivers/mtd/spi-nor/macronix.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
> index 9203abaac229..2d39dd32a64e 100644
> --- a/drivers/mtd/spi-nor/macronix.c
> +++ b/drivers/mtd/spi-nor/macronix.c
> @@ -94,6 +94,7 @@ static const struct flash_info macronix_parts[] = {
>
> static void macronix_default_init(struct spi_nor *nor)
> {
> + nor->flags |= SNOR_F_HAS_LOCK;

Please do not add global locking support. Add it per flash device.
See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e6204d4620276398ed7317d64c369813a1f96615

-michael

> nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable;
> nor->params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode;
> }