summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/spi_flash.c
diff options
context:
space:
mode:
authorRichard Retanubun <RichardRetanubun@ruggedcom.com>2011-02-16 21:37:22 (GMT)
committerMike Frysinger <vapier@gentoo.org>2011-04-12 06:15:37 (GMT)
commit4e6a515899290635bfd7fe3aef8c4d4d9e88fced (patch)
treee4e38baaa882e2dab02c7a1ab83a0912029d605b /drivers/mtd/spi/spi_flash.c
parentcdb6a00fb8f96b9259ed7d77a1eacbfa3777ddac (diff)
downloadu-boot-4e6a515899290635bfd7fe3aef8c4d4d9e88fced.tar.xz
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>
Diffstat (limited to 'drivers/mtd/spi/spi_flash.c')
-rw-r--r--drivers/mtd/spi/spi_flash.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 5c261f1..ccb7e31 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -131,12 +131,13 @@ int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout)
}
int spi_flash_cmd_erase(struct spi_flash *flash, u8 erase_cmd,
- u32 erase_size, u32 offset, size_t len)
+ u32 offset, size_t len)
{
- u32 start, end;
+ u32 start, end, erase_size;
int ret;
u8 cmd[4];
+ erase_size = flash->sector_size;
if (offset % erase_size || len % erase_size) {
debug("SF: Erase offset/length not multiple of erase size\n");
return -1;
@@ -296,6 +297,10 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
goto err_manufacturer_probe;
}
+ printf("SF: Detected %s with page size %u, total ",
+ flash->name, flash->sector_size);
+ print_size(flash->size, "\n");
+
spi_release_bus(spi);
return flash;