From: Siva Durga Prasad Paladugu Date: Fri, 20 Jan 2017 09:44:59 +0000 (+0530) Subject: spi: spi_flash: Store and use spi flags received X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ced6fb611a8704d638a2f8c7e7dd6a5c82b087a7;p=thirdparty%2Fu-boot.git spi: spi_flash: Store and use spi flags received Store and use spi flags as it will be cleared after write enable command and it need to be available for following write command. Signed-off-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 23bda15a89b..eee7a7fa4eb 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -376,6 +376,9 @@ int spi_flash_write_common(struct spi_flash *flash, const u8 *cmd, struct spi_slave *spi = flash->spi; unsigned long timeout = SPI_FLASH_PROG_TIMEOUT; int ret; +#ifdef CONFIG_SPI_GENERIC + u32 flags = 0; +#endif if (buf == NULL) timeout = SPI_FLASH_PAGE_ERASE_TIMEOUT; @@ -386,12 +389,20 @@ int spi_flash_write_common(struct spi_flash *flash, const u8 *cmd, return ret; } +#ifdef CONFIG_SPI_GENERIC + if (flash->dual_flash == SF_DUAL_PARALLEL_FLASH) + flags = flash->spi->flags; +#endif ret = spi_flash_cmd_write_enable(flash); if (ret < 0) { debug("SF: enabling write failed\n"); return ret; } +#ifdef CONFIG_SPI_GENERIC + if (flash->dual_flash == SF_DUAL_PARALLEL_FLASH) + flash->spi->flags = flags; +#endif ret = spi_flash_cmd_write(spi, cmd, cmd_len, buf, buf_len); if (ret < 0) { debug("SF: write cmd failed\n");