
Add SECT_4K_PMC for erase 4KiB block on PMC chips.
Cc: Simon Glass sjg@chromium.org Cc: Bin Meng bmeng.cn@gmail.com Cc: Michal Simek michal.simek@xilinx.com Cc: Siva Durga Prasad Paladugu sivadur@xilinx.com Tested-by: Mugunthan V N mugunthanvnm@ti.com Tested-by: Jagan Teki jteki@openedev.com Signed-off-by: Jagan Teki jteki@openedev.com --- drivers/mtd/spi/sf_internal.h | 1 + drivers/mtd/spi/spi_flash.c | 3 +++ 2 files changed, 4 insertions(+)
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index 8eaadd7..75513b0 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -67,6 +67,7 @@ enum spi_nor_option_flags {
/* Erase commands */ #define CMD_ERASE_4K 0x20 +#define CMD_ERASE_4K_PMC 0xd7 #define CMD_ERASE_32K 0x52 #define CMD_ERASE_CHIP 0xc7 #define CMD_ERASE_64K 0xd8 diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 63c53c2..c3113bc 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -1382,6 +1382,9 @@ int spi_flash_scan(struct spi_flash *flash) if (info->flags & SECT_4K) { flash->erase_cmd = CMD_ERASE_4K; flash->erase_size = 4096 << flash->shift; + } else if (info->flags & SECT_4K_PMC) { + flash->erase_cmd = CMD_ERASE_4K_PMC; + flash->erase_size = 4096; } else { flash->erase_cmd = CMD_ERASE_64K; flash->erase_size = flash->sector_size;