[PATCH v4 1/2] mtd: spi-nor: Fix whole chip erasing for stacked chips.
Marek Vasut
marek.vasut at gmail.com
Fri Jan 6 15:45:00 PST 2017
On 01/06/2017 06:19 PM, Marcin Krzeminski wrote:
> Currently it is possible to disable chip erase for spi-nor driver.
> Some modern stacked (multi die) flash chips do not support chip
> erase opcode at all but spi-nor framework needs to cope with them too.
> This commit extends existing functionality to allow disable
> chip erase for a single flash chip.
I wonder whether this should really be opt-out flag. Since we'll see
more multi-die chips (and chips with different die sizes), I'd say this
should rather be opt-in flag.
> Signed-off-by: Marcin Krzeminski <mar.krzeminski at gmail.com>
> ---
> drivers/mtd/spi-nor/spi-nor.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index 2a643a1..595de54 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -85,6 +85,7 @@ struct flash_info {
> * Use dedicated 4byte address op codes
> * to support memory size above 128Mib.
> */
> +#define NO_CHIP_ERASE BIT(12) /* Chip does not support chip erase */
> };
>
> #define JEDEC_MFR(info) ((info)->id[0])
> @@ -1621,6 +1622,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> nor->flags |= SNOR_F_USE_FSR;
> if (info->flags & SPI_NOR_HAS_TB)
> nor->flags |= SNOR_F_HAS_SR_TB;
> + if (info->flags & NO_CHIP_ERASE)
> + nor->flags |= SNOR_F_NO_OP_CHIP_ERASE;
>
> #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
> /* prefer "small sector" erase if possible */
>
--
Best regards,
Marek Vasut
More information about the linux-mtd
mailing list