[U-Boot] [PATCH v3] sf: Update bank configuration
Jagannadha Sutradharudu Teki
jagannadha.sutradharudu-teki at xilinx.com
Mon Jan 20 18:04:56 CET 2014
Updated bank configuration code to more readable.
Signed-off-by: Jagannadha Sutradharudu Teki <jaganna at xilinx.com>
---
Changes for v3:
- remove bank_curr = 0 for non bank case
Changes for v2:
- none
drivers/mtd/spi/sf_probe.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index a5f3046..53995e4 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -217,21 +217,22 @@ static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi,
/* Configure the BAR - discover bank cmds and read current bank */
#ifdef CONFIG_SPI_FLASH_BAR
- u8 curr_bank = 0;
if (flash->size > SPI_FLASH_16MB_BOUN) {
- flash->bank_read_cmd = (idcode[0] == 0x01) ?
- CMD_BANKADDR_BRRD : CMD_EXTNADDR_RDEAR;
- flash->bank_write_cmd = (idcode[0] == 0x01) ?
- CMD_BANKADDR_BRWR : CMD_EXTNADDR_WREAR;
+ switch (idcode[0]) {
+ case SPI_FLASH_CFI_MFR_SPANSION:
+ flash->bank_read_cmd = CMD_BANKADDR_BRRD;
+ flash->bank_write_cmd = CMD_BANKADDR_BRWR;
+ break;
+ default:
+ flash->bank_read_cmd = CMD_EXTNADDR_RDEAR;
+ flash->bank_write_cmd = CMD_EXTNADDR_WREAR;
+ }
if (spi_flash_read_common(flash, &flash->bank_read_cmd, 1,
- &curr_bank, 1)) {
- debug("SF: fail to read bank addr register\n");
+ &flash->bank_curr, 1)) {
+ debug("SF: Fail to read bank addr register\n");
return NULL;
}
- flash->bank_curr = curr_bank;
- } else {
- flash->bank_curr = curr_bank;
}
#endif
--
1.8.3
More information about the U-Boot
mailing list