From 4e6a515899290635bfd7fe3aef8c4d4d9e88fced Mon Sep 17 00:00:00 2001 From: Richard Retanubun Date: Wed, 16 Feb 2011 16:37:22 -0500 Subject: sf: add struct spi_flash.sector_size parameter This patch adds a new member to struct spi_flash (u16 sector_size) and updates the spi flash drivers to start populating it. This parameter can be used by spi flash commands that need to round up units of operation to the flash's sector_size. Having this number in one place also allows duplicated code to be further collapsed into one common location (such as erase parameter and the detected message). Signed-off-by: Richard Retanubun Signed-off-by: Mike Frysinger --- drivers/mtd/spi/sst.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'drivers/mtd/spi/sst.c') diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c index 792d04d..29bb88b 100644 --- a/drivers/mtd/spi/sst.c +++ b/drivers/mtd/spi/sst.c @@ -201,8 +201,7 @@ sst_write(struct spi_flash *flash, u32 offset, size_t len, const void *buf) int sst_erase(struct spi_flash *flash, u32 offset, size_t len) { - return spi_flash_cmd_erase(flash, CMD_SST_SE, SST_SECTOR_SIZE, - offset, len); + return spi_flash_cmd_erase(flash, CMD_SST_SE, offset, len); } static int @@ -256,11 +255,8 @@ spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode) stm->flash.write = sst_write; stm->flash.erase = sst_erase; - stm->flash.size = SST_SECTOR_SIZE * params->nr_sectors; - - printf("SF: Detected %s with page size %u, total ", - params->name, SST_SECTOR_SIZE); - print_size(stm->flash.size, "\n"); + stm->flash.sector_size = SST_SECTOR_SIZE; + stm->flash.size = stm->flash.sector_size * params->nr_sectors; /* Flash powers up read-only, so clear BP# bits */ sst_unlock(&stm->flash); -- cgit v1.1