Message ID | 055a433c8d6137cbf73c4248f7d37faf7ebd1215.1506820067.git.engkhalil86@gmail.com |
---|---|
State | Superseded |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
Series | Clear error flags & initialization of Spansion | expand |
On Sun, Oct 1, 2017 at 6:50 AM, Ahmed Samir Khalil <engkhalil86@gmail.com> wrote: > A function to clear status register-1 after error > flag(s) being triggered. > > Signed-off-by: Ahmed S. Khalil <engkhalil86@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); This is wrong, we should have clear status value to clear the status, and why we need this operation? doesn't mentioned on commit message? and all these 5 patches does same job better to squash as one resend. thanks!
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
A function to clear status register-1 after error flag(s) being triggered. Signed-off-by: Ahmed S. Khalil <engkhalil86@gmail.com> --- drivers/mtd/spi/spi_flash.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)