summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/winbond.c
diff options
context:
space:
mode:
authorRichard Retanubun <RichardRetanubun@ruggedcom.com>2011-02-16 16:37:22 -0500
committerMike Frysinger <vapier@gentoo.org>2011-04-12 02:15:37 -0400
commit4e6a515899290635bfd7fe3aef8c4d4d9e88fced (patch)
treee4e38baaa882e2dab02c7a1ab83a0912029d605b /drivers/mtd/spi/winbond.c
parentcdb6a00fb8f96b9259ed7d77a1eacbfa3777ddac (diff)
downloadu-boot-imx-4e6a515899290635bfd7fe3aef8c4d4d9e88fced.zip
u-boot-imx-4e6a515899290635bfd7fe3aef8c4d4d9e88fced.tar.gz
u-boot-imx-4e6a515899290635bfd7fe3aef8c4d4d9e88fced.tar.bz2
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/winbond.c')
-rw-r--r--drivers/mtd/spi/winbond.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/mtd/spi/winbond.c b/drivers/mtd/spi/winbond.c
index e88802f..72d94ad 100644
--- a/drivers/mtd/spi/winbond.c
+++ b/drivers/mtd/spi/winbond.c
@@ -172,10 +172,7 @@ out:
int winbond_erase(struct spi_flash *flash, u32 offset, size_t len)
{
- struct winbond_spi_flash *stm = to_winbond_spi_flash(flash);
- return spi_flash_cmd_erase(flash, CMD_W25_SE,
- (1 << stm->params->l2_page_size) * stm->params->pages_per_sector,
- offset, len);
+ return spi_flash_cmd_erase(flash, CMD_W25_SE, offset, len);
}
struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
@@ -213,13 +210,11 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
stm->flash.write = winbond_write;
stm->flash.erase = winbond_erase;
stm->flash.read = spi_flash_cmd_read_fast;
+ stm->flash.sector_size = (1 << stm->params->l2_page_size) *
+ stm->params->pages_per_sector;
stm->flash.size = page_size * params->pages_per_sector
* params->sectors_per_block
* params->nr_blocks;
- printf("SF: Detected %s with page size %u, total ",
- params->name, page_size);
- print_size(stm->flash.size, "\n");
-
return &stm->flash;
}