From: Jagannadha Sutradharudu Teki Date: Wed, 15 May 2013 16:20:48 +0000 (+0530) Subject: sf: Use spi_flash_read_common() in write status poll X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbd5104205e9ad9250cbd45420091ef76b6b5fc8;p=thirdparty%2Fu-boot.git sf: Use spi_flash_read_common() in write status poll Instead of using spi_xfer for SPI_XFER_BEGIN and SPI_XFER_END separatley use common read call spi_flash_read_common() which does the same. Signed-off-by: Jagannadha Sutradharudu Teki --- diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 29162b5432e..2c62b54aa92 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -235,36 +235,25 @@ int spi_flash_cmd_read_fast(struct spi_flash *flash, u32 offset, int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout, u8 cmd, u8 poll_bit) { - struct spi_slave *spi = flash->spi; - unsigned long flags = SPI_XFER_BEGIN; unsigned long timebase; int ret; u8 status; - if ((spi->is_dual == 1) && (spi->u_page == 1)) - flags |= SPI_FLASH_U_PAGE; - - ret = spi_xfer(spi, 8, &cmd, NULL, flags); - if (ret) { - debug("SF: Failed to send command %02x: %d\n", cmd, ret); - return ret; - } - timebase = get_timer(0); do { WATCHDOG_RESET(); - ret = spi_xfer(spi, 8, NULL, &status, 0); - if (ret) - return -1; + ret = spi_flash_read_common(flash, &cmd, 1, &status, 1); + if (ret < 0) { + debug("SF: fail to read read status register\n"); + return ret; + } if ((status & poll_bit) == 0) break; } while (get_timer(timebase) < timeout); - spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END); - if ((status & poll_bit) == 0) return 0;