From: Jagannadha Sutradharudu Teki Date: Thu, 26 Sep 2013 07:46:45 +0000 (+0530) Subject: sf: probe: Add support to clear flash BP# bits X-Git-Tag: v2025.01-rc5-pxa1908~15853^2~33 X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=54024c15668ec5e8c261536e9bbc9d22dd01f3e6;p=u-boot.git sf: probe: Add support to clear flash BP# bits 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 --- diff --git a/drivers/mtd/spi/spi_flash_probe.c b/drivers/mtd/spi/spi_flash_probe.c index 199eab89b0..46591343d2 100644 --- a/drivers/mtd/spi/spi_flash_probe.c +++ b/drivers/mtd/spi/spi_flash_probe.c @@ -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; }