]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spi: spi_flash: Store and use spi flags received
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Fri, 20 Jan 2017 09:44:59 +0000 (15:14 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 23 Jan 2017 08:48:40 +0000 (09:48 +0100)
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 <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/mtd/spi/spi_flash.c

index 23bda15a89b088fecd608698a5a18a84b65dcd7a..eee7a7fa4eb5c4479befcfaa0d6173f556838cee 100644 (file)
@@ -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");