mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-03 04:51:31 +00:00
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>
This commit is contained in:
parent
2ba863fae6
commit
ab92224f45
1 changed files with 5 additions and 8 deletions
|
@ -127,7 +127,7 @@ static int spi_flash_bank(struct spi_flash *flash, u32 offset)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return bank_sel;
|
||||||
}
|
}
|
||||||
#endif
|
#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,
|
int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
|
||||||
size_t len, void *data)
|
size_t len, void *data)
|
||||||
{
|
{
|
||||||
u8 *cmd, cmdsz, bank_sel = 0;
|
u8 *cmd, cmdsz;
|
||||||
u32 remain_len, read_len;
|
u32 remain_len, read_len;
|
||||||
|
int bank_sel = 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
/* Handle memory-mapped SPI */
|
/* 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;
|
cmd[0] = flash->read_cmd;
|
||||||
while (len) {
|
while (len) {
|
||||||
#ifdef CONFIG_SPI_FLASH_BAR
|
#ifdef CONFIG_SPI_FLASH_BAR
|
||||||
bank_sel = offset / SPI_FLASH_16MB_BOUN;
|
bank_sel = spi_flash_bank(flash, offset);
|
||||||
|
if (bank_sel < 0)
|
||||||
ret = spi_flash_cmd_bankaddr_write(flash, bank_sel);
|
|
||||||
if (ret) {
|
|
||||||
debug("SF: fail to set bank%d\n", bank_sel);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
remain_len = (SPI_FLASH_16MB_BOUN * (bank_sel + 1)) - offset;
|
remain_len = (SPI_FLASH_16MB_BOUN * (bank_sel + 1)) - offset;
|
||||||
if (len < remain_len)
|
if (len < remain_len)
|
||||||
|
|
Loading…
Add table
Reference in a new issue