diff options
author | Jagannadha Sutradharudu Teki <jaganna@xilinx.com> | 2013-06-19 15:31:23 +0530 |
---|---|---|
committer | Jagannadha Sutradharudu Teki <jaganna@xilinx.com> | 2013-06-23 22:02:49 +0530 |
commit | cf6b11dcda2f13d1c05c2f20e2a1735a833a41fe (patch) | |
tree | 8ce3b5596e77ff5e66ead1bbd175398b07bd146a /drivers/mtd/spi/spi_flash.c | |
parent | c9fcb59d7db74b93df9ee0a830bb9f43888f195c (diff) | |
download | u-boot-imx-cf6b11dcda2f13d1c05c2f20e2a1735a833a41fe.zip u-boot-imx-cf6b11dcda2f13d1c05c2f20e2a1735a833a41fe.tar.gz u-boot-imx-cf6b11dcda2f13d1c05c2f20e2a1735a833a41fe.tar.bz2 |
sf: Discover the bank addr commands
Bank/Extended addr commands are specific to particular
flash vendor so discover them based on the idocode0.
Assign the discovered bank commands to spi_flash members
so-that the bank read/write will use their specific operations.
Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Diffstat (limited to 'drivers/mtd/spi/spi_flash.c')
-rw-r--r-- | drivers/mtd/spi/spi_flash.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 9ddd070..7e19953 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -304,6 +304,27 @@ int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel) return 0; } +int spi_flash_bank_config(struct spi_flash *flash, u8 idcode0) +{ + /* discover bank cmds */ + switch (idcode0) { + case SPI_FLASH_SPANSION_IDCODE0: + flash->bank_read_cmd = CMD_BANKADDR_BRRD; + flash->bank_write_cmd = CMD_BANKADDR_BRWR; + break; + case SPI_FLASH_STMICRO_IDCODE0: + case SPI_FLASH_WINBOND_IDCODE0: + flash->bank_read_cmd = CMD_EXTNADDR_RDEAR; + flash->bank_write_cmd = CMD_EXTNADDR_WREAR; + break; + default: + printf("SF: Unsupported bank commands %02x\n", idcode0); + return -1; + } + + return 0; +} + #ifdef CONFIG_OF_CONTROL int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash) { |