Few of the flashes(Atmel, Macronix and SST) require to clear BP# bits in flash power ups.
So clear these BP# bits at probe time, so-that the flash is ready for user operations. Signed-off-by: Jagannadha Sutradharudu Teki <jaga...@xilinx.com> --- Changes for v4: - none Changes for v3: - none Changes for v2: - none drivers/mtd/spi/spi_flash_probe.c | 6 ++++++ include/spi_flash.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/drivers/mtd/spi/spi_flash_probe.c b/drivers/mtd/spi/spi_flash_probe.c index da43fda..14c2222 100644 --- a/drivers/mtd/spi/spi_flash_probe.c +++ b/drivers/mtd/spi/spi_flash_probe.c @@ -203,6 +203,12 @@ struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode) flash->sector_size = params->sector_size; flash->size = flash->sector_size * params->nr_sectors; + /* Flash powers up read-only, so clear BP# bits */ + if (((params->jedec >> 16) == SPI_FLASH_CFI_MFR_ATMEL) || + ((params->jedec >> 16) == SPI_FLASH_CFI_MFR_MACRONIX) || + ((params->jedec >> 16) == SPI_FLASH_CFI_MFR_SST)) + spi_flash_cmd_write_status(flash, 0); + return flash; } diff --git a/include/spi_flash.h b/include/spi_flash.h index 4f35c30..8de4e8d 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -17,6 +17,11 @@ #include <linux/types.h> #include <linux/compiler.h> +/* SPI flash CFI Manufacture ID's */ +#define SPI_FLASH_CFI_MFR_ATMEL 0x1f +#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2 +#define SPI_FLASH_CFI_MFR_SST 0xbf + /* SST specific macros */ #ifdef CONFIG_SPI_FLASH_SST # define SST_WP 0x01 /* Supports AAI word program */ -- 1.8.3 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot