]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: spi-nor: Fix SST flash erase issue
authorT Karthik Reddy <t.karthik.reddy@xilinx.com>
Tue, 9 Nov 2021 12:19:59 +0000 (05:19 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 15 Nov 2021 13:38:40 +0000 (14:38 +0100)
SST flashes has multi size erase blocks like 8K, 32K and 64K bytes. We
cannot perform a 64KB sector erase on all the blocks, So use 4k sector
erase command to perform an erase operation.
We could enable SPI_FLASH_USE_4K_SECTORS config to use 4K sector erase.
But it will impact erase operation time on all large memory flashes.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
drivers/mtd/spi/spi-nor-core.c

index 592a0f2255e52702aec5ed6fef0d10b11b972330..b62e708f39fff680bced93df80fb838d20f38ec9 100644 (file)
@@ -2655,6 +2655,12 @@ static int spi_nor_select_erase(struct spi_nor *nor,
                nor->erase_opcode = SPINOR_OP_SE;
                mtd->erasesize = info->sector_size << nor->shift;
        }
+
+       if ((JEDEC_MFR(info) == SNOR_MFR_SST) && info->flags & SECT_4K) {
+               nor->erase_opcode = SPINOR_OP_BE_4K;
+               mtd->erasesize = 4096 << nor->shift;
+       }
+
        return 0;
 }