A function to clear status register-1 after error flag(s) being triggered. Signed-off-by: Ahmed S. Khalil <engkhali...@gmail.com> --- drivers/mtd/spi/spi_flash.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 34f6888..52dcb84 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -110,6 +110,27 @@ static int write_cr(struct spi_flash *flash, u8 wc) return 0; } + +/* + * Clear status register-1 + * + * TODO: Check validity for the other flash vendors. + */ +static int clear_sr(struct spi_flash *flash) +{ + struct spi_slave *spi = flash->spi; + u8 cmd, buf; + int ret; + + cmd = CMD_CLEAR_STATUS; + ret = spi_flash_cmd_write(spi, cmd, 1, buf, 1); + if (ret < 0) { + debug("SF: fail to clear status register\n"); + return ret; + } + + return ret; +} #endif #ifdef CONFIG_SPI_FLASH_BAR -- 2.7.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot