summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJagannadha Sutradharudu Teki <jaganna@xilinx.com>2014-01-11 16:57:07 +0530
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>2014-01-12 21:38:33 +0530
commitab92224f4550f9677be32dd903e99acf1475dbf7 (patch)
tree27e39b844c672ae35d411986c184bf7fc76942b7
parent2ba863fae628bb5fe2ec4b803f639c1edb55ea33 (diff)
downloadu-boot-imx-ab92224f4550f9677be32dd903e99acf1475dbf7.zip
u-boot-imx-ab92224f4550f9677be32dd903e99acf1475dbf7.tar.gz
u-boot-imx-ab92224f4550f9677be32dd903e99acf1475dbf7.tar.bz2
sf: ops: Unify read_ops bank configuration
Unified the bar code from read_ops into a spi_flash_bar() Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
-rw-r--r--drivers/mtd/spi/sf_ops.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index bc4a822..7ae9582 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -127,7 +127,7 @@ static int spi_flash_bank(struct spi_flash *flash, u32 offset)
return ret;
}
- return 0;
+ return bank_sel;
}
#endif
@@ -321,8 +321,9 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
size_t len, void *data)
{
- u8 *cmd, cmdsz, bank_sel = 0;
+ u8 *cmd, cmdsz;
u32 remain_len, read_len;
+ int bank_sel = 0;
int ret = -1;
/* Handle memory-mapped SPI */
@@ -346,13 +347,9 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
cmd[0] = flash->read_cmd;
while (len) {
#ifdef CONFIG_SPI_FLASH_BAR
- bank_sel = offset / SPI_FLASH_16MB_BOUN;
-
- ret = spi_flash_cmd_bankaddr_write(flash, bank_sel);
- if (ret) {
- debug("SF: fail to set bank%d\n", bank_sel);
+ bank_sel = spi_flash_bank(flash, offset);
+ if (bank_sel < 0)
return ret;
- }
#endif
remain_len = (SPI_FLASH_16MB_BOUN * (bank_sel + 1)) - offset;
if (len < remain_len)