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 <RichardRetanubun@RuggedCom.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index 7ef690d..a1980b1 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -199,10 +199,7 @@
 
 int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
-	struct stmicro_spi_flash *stm = to_stmicro_spi_flash(flash);
-	return spi_flash_cmd_erase(flash, CMD_M25PXX_SE,
-		stm->params->page_size * stm->params->pages_per_sector,
-		offset, len);
+	return spi_flash_cmd_erase(flash, CMD_M25PXX_SE, offset, len);
 }
 
 struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)
@@ -249,12 +246,8 @@
 	stm->flash.write = stmicro_write;
 	stm->flash.erase = stmicro_erase;
 	stm->flash.read = spi_flash_cmd_read_fast;
-	stm->flash.size = params->page_size * params->pages_per_sector
-	    * params->nr_sectors;
-
-	printf("SF: Detected %s with page size %u, total ",
-	       params->name, params->page_size);
-	print_size(stm->flash.size, "\n");
+	stm->flash.sector_size = params->page_size * params->pages_per_sector;
+	stm->flash.size = stm->flash.sector_size * params->nr_sectors;
 
 	return &stm->flash;
 }