From 0f14f285bd9794449618d8676be57d6f3b537af8 Mon Sep 17 00:00:00 2001 From: Jagan Date: Wed, 6 Jun 2012 11:35:41 +0530 Subject: [PATCH] Xilinx: ARM: SPI: fix spansion erase for single and dual devices The spansion_erase only worked for >64KiB sector size as the erase command was forgotten when the x2 support was previously added. The address width is now used as the other commands were doing such that it works. Signed-off-by: Jagan --- drivers/mtd/spi/spansion.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c index b4cdc901638..c9e10df96b4 100755 --- a/drivers/mtd/spi/spansion.c +++ b/drivers/mtd/spi/spansion.c @@ -344,7 +344,10 @@ int spansion_erase(struct spi_flash *flash, u32 offset, size_t len) ret = 0; for (actual = 0; actual < len; actual += sector_size) { - cmd[1] = (offset + actual) >> 16; + unsigned page_addr; + + page_addr = (offset + actual) / spsn->params->page_size; + span_addr2cmd(spsn, page_addr, 0, cmd); ret = spi_flash_cmd(flash->spi, CMD_S25FLXX_WREN, NULL, 0); if (ret < 0) { -- 2.47.3