sf: probe: Add support to clear flash BP# bits
authorJagannadha Sutradharudu Teki <jaganna@xilinx.com>
Thu, 26 Sep 2013 07:46:45 +0000 (13:16 +0530)
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>
Mon, 7 Oct 2013 12:25:44 +0000 (17:55 +0530)
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>
drivers/mtd/spi/spi_flash_probe.c

index 199eab89b01be8d4c427710952d3cac57e2e997c..46591343d29eb6908baffed6bbd9796a487b696a 100644 (file)
@@ -203,6 +203,13 @@ 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 defined(CONFIG_SPI_FLASH_ATMEL) || \
+       defined(CONFIG_SPI_FLASH_MACRONIX) || \
+       defined(CONFIG_SPI_FLASH_SST)
+               spi_flash_cmd_write_status(flash, 0);
+#endif
+
        return flash;
 }