summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-09-11 20:26:21 -0700
committerVadim Bendebury <vbendeb@chromium.org>2011-09-12 10:53:04 -0700
commit9f73d3dd20e1eac2e27d56992d94dc3d4bdbb883 (patch)
tree58a4f059c8c381e39be5712023592c5a6fd26e4d /drivers
parent229b9ac840b06c99aedde5182d5c6ef6a28b7f21 (diff)
Use smaller erase units in Macronix SPI flash driver.
This change reduces the erase unit size to 4K from 64K, which allows for more efficient use of the Macronix SPI flash. BUG=chromium-os:20105 TEST=manual . this change was tested combined with other modification, the ability to read and save the 16KB environment in a Macronix SPI flash was demonstrated. Change-Id: Icb723673079d755ffd9d89ac8d1286592722aa52 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/7533 Reviewed-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/spi/macronix.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index 186aea2981..ca0003ebc7 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -179,7 +179,7 @@ static int macronix_write(struct spi_flash *flash,
static int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)
{
- return spi_flash_cmd_erase(flash, CMD_MX25XX_BE, offset, len);
+ return spi_flash_cmd_erase(flash, CMD_MX25XX_SE, offset, len);
}
struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
@@ -217,9 +217,9 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
#else
mcx->flash.read = spi_flash_cmd_read_fast;
#endif
- mcx->flash.sector_size = params->page_size * params->pages_per_sector
- * params->sectors_per_block;
- mcx->flash.size = mcx->flash.sector_size * params->nr_blocks;
+ mcx->flash.sector_size = params->page_size * params->pages_per_sector;
+ mcx->flash.size = mcx->flash.sector_size * params->sectors_per_block *
+ params->nr_blocks;
return &mcx->flash;
}