If the system is in a dual parallel configuration, it's necessary to
halve the erase size since the erase command operates on two flashes
simultaneously. When dealing with a dual-stacked configuration,
determine whether the erase offset refers to the top or bottom flash,
and subsequently, adjust the flag for the relevant flash.
Consequently, the argument for the spi_nor_erase_sector function has
been modified from addr to offset.

Signed-off-by: Tejas Bhumkar <tejas.arvind.bhum...@amd.com>
---
 drivers/mtd/spi/spi-nor-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index b9326d2b47..e0398a7a29 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -1095,7 +1095,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct 
erase_info *instr)
                        }
                }
 #ifdef CONFIG_SPI_FLASH_BAR
-               ret = write_bar(nor, addr);
+               ret = write_bar(nor, offset);
                if (ret < 0)
                        goto erase_err;
 #endif
@@ -1107,7 +1107,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct 
erase_info *instr)
                    !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
                        ret = spi_nor_erase_chip(nor);
                } else {
-                       ret = spi_nor_erase_sector(nor, addr);
+                       ret = spi_nor_erase_sector(nor, offset);
                }
                if (ret < 0)
                        goto erase_err;
-- 
2.27.0

Reply via email to