diff options
author | Jagannadha Sutradharudu Teki <jaganna@xilinx.com> | 2013-06-11 21:36:20 +0530 |
---|---|---|
committer | Jagannadha Sutradharudu Teki <jaganna@xilinx.com> | 2013-06-23 22:02:50 +0530 |
commit | f76b1bd08b00bec89cace4da97eab8c8d89a74c2 (patch) | |
tree | 2b882d62c903bddcabd503e582f8290ab47b6c8d /drivers/mtd | |
parent | 1dcd6d03811d4f30052a5e24377b378867211b05 (diff) | |
download | u-boot-imx-f76b1bd08b00bec89cace4da97eab8c8d89a74c2.zip u-boot-imx-f76b1bd08b00bec89cace4da97eab8c8d89a74c2.tar.gz u-boot-imx-f76b1bd08b00bec89cace4da97eab8c8d89a74c2.tar.bz2 |
sf: Use spi_flash_addr() in write call
Use the existing spi_flash_addr() for 3-byte addressing
cmd filling in write call.
Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/spi/spi_flash.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index f05f8f4..0ed2295 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -71,7 +71,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len, int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, size_t len, const void *buf) { - unsigned long page_addr, byte_addr, page_size; + unsigned long byte_addr, page_size; size_t chunk_len, actual; int ret; u8 cmd[4]; @@ -97,16 +97,13 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, return ret; } #endif - page_addr = offset / page_size; byte_addr = offset % page_size; chunk_len = min(len - actual, page_size - byte_addr); if (flash->spi->max_write_size) chunk_len = min(chunk_len, flash->spi->max_write_size); - cmd[1] = page_addr >> 8; - cmd[2] = page_addr; - cmd[3] = byte_addr; + spi_flash_addr(offset, cmd); debug("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %zu\n", buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len); |