@@ -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;
}
@@ -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 */
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 <jaganna@xilinx.com> --- 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(+)