aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJagan Teki <jteki@openedev.com>2015-09-30 02:01:23 +0530
committerJagan Teki <jteki@openedev.com>2015-12-11 22:12:24 +0530
commit6f9d670d8e9a77553b00c293fd1a8f913a9d7be3 (patch)
treefdfcd6c6f58a0757d2c821687141ca7adc074893
parentcb37518516420c581877a209a7841f2a5fe6382d (diff)
downloadu-boot-6f9d670d8e9a77553b00c293fd1a8f913a9d7be3.zip
u-boot-6f9d670d8e9a77553b00c293fd1a8f913a9d7be3.tar.gz
u-boot-6f9d670d8e9a77553b00c293fd1a8f913a9d7be3.tar.bz2
sf: Flash power up read-only based on idcode0
Using macro's for flash power up read-only access code leads wrong behaviour hence use idcode0 for runtime detection, hence the flash which require this functionality gets detected at runtime. Tested-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
-rw-r--r--drivers/mtd/spi/sf_internal.h1
-rw-r--r--drivers/mtd/spi/sf_ops.c7
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 8f586ee..b8692c6 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -66,6 +66,7 @@ enum spi_nor_option_flags {
#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2
#define SPI_FLASH_CFI_MFR_SST 0xbf
#define SPI_FLASH_CFI_MFR_WINBOND 0xef
+#define SPI_FLASH_CFI_MFR_ATMEL 0x1f
/* Erase commands */
#define CMD_ERASE_4K 0x20
diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index 853759e..e5514ab 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -941,11 +941,10 @@ int spi_flash_scan(struct spi_slave *spi, struct spi_flash *flash)
}
/* Flash powers up read-only, so clear BP# bits */
-#if defined(CONFIG_SPI_FLASH_ATMEL) || \
- defined(CONFIG_SPI_FLASH_MACRONIX) || \
- defined(CONFIG_SPI_FLASH_SST)
+ if (idcode[0] == SPI_FLASH_CFI_MFR_ATMEL ||
+ idcode[0] == SPI_FLASH_CFI_MFR_MACRONIX ||
+ idcode[0] == SPI_FLASH_CFI_MFR_SST)
write_sr(flash, 0);
-#endif
/* Assign spi data */
flash->spi = spi;