[U-Boot] [PATCH 6/6] sf: Update bank configuration
Jagannadha Sutradharudu Teki
jagannadha.sutradharudu-teki at xilinx.com
Sat Jan 18 21:06:33 CET 2014
Updated bank configuration code to more readable.
Signed-off-by: Jagannadha Sutradharudu Teki <jaganna at xilinx.com>
---
drivers/mtd/spi/sf_probe.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 8f92333..06f99da 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -215,21 +215,23 @@ 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;
+ flash->bank_curr = 0;
if (flash->size > SF_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 SF_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