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/eon.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'drivers/mtd/spi/eon.c') diff --git a/drivers/mtd/spi/eon.c b/drivers/mtd/spi/eon.c index 01caed5..a3640f4 100644 --- a/drivers/mtd/spi/eon.c +++ b/drivers/mtd/spi/eon.c @@ -121,11 +121,7 @@ static int eon_write(struct spi_flash *flash, int eon_erase(struct spi_flash *flash, u32 offset, size_t len) { - struct eon_spi_flash *eon = to_eon_spi_flash(flash); - return spi_flash_cmd_erase(flash, CMD_EN25Q128_BE, - eon->params->page_size * eon->params->pages_per_sector * - eon->params->sectors_per_block; - offset, len); + return spi_flash_cmd_erase(flash, CMD_EN25Q128_BE, offset, len); } struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode) @@ -158,11 +154,10 @@ struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode) eon->flash.write = eon_write; eon->flash.erase = eon_erase; eon->flash.read = spi_flash_cmd_read_fast; + eon->flash.sector_size = params->page_size * params->pages_per_sector + * params->sectors_per_block; eon->flash.size = params->page_size * params->pages_per_sector * params->nr_sectors; - debug("SF: Detected %s with page size %u, total %u bytes\n", - params->name, params->page_size, eon->flash.size); - return &eon->flash; } -- cgit v1.1