]> git.sur5r.net Git - u-boot/commitdiff
sf: Add CONFIG_SF_DUAL_FLASH
authorJagannadha Sutradharudu Teki <jaganna@xilinx.com>
Sat, 11 Jan 2014 09:55:04 +0000 (15:25 +0530)
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>
Sun, 12 Jan 2014 16:10:22 +0000 (21:40 +0530)
This config will use for defining greater than single flash support.
currently - DUAL_STACKED and DUAL_PARALLEL.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
README
drivers/mtd/spi/sf.c
drivers/mtd/spi/sf_ops.c
drivers/mtd/spi/sf_probe.c

diff --git a/README b/README
index a0646c36657b3b69b37a9a1816a27fcdb55d8d43..aea82be5b3e6e4ed8a7513081403016a0685ede1 100644 (file)
--- a/README
+++ b/README
@@ -2756,6 +2756,12 @@ CBFS (Coreboot Filesystem) support
                Define this option to use the Bank addr/Extended addr
                support on SPI flashes which has size > 16Mbytes.
 
+               CONFIG_SF_DUAL_FLASH            Dual flash memories
+
+               Define this option to use dual flash support where two flash
+               memories can be connected with a given cs line.
+               currently Xilinx Zynq qspi support these type of connections.
+
 - SystemACE Support:
                CONFIG_SYSTEMACE
 
index c780a81c599076056cb10c1edb2cd582c29576fc..664e86082b19c95e08a68f1443f1efd18f89d5ca 100644 (file)
@@ -18,9 +18,10 @@ static int spi_flash_read_write(struct spi_slave *spi,
        unsigned long flags = SPI_XFER_BEGIN;
        int ret;
 
+#ifdef CONFIG_SF_DUAL_FLASH
        if (spi->flags & SPI_XFER_U_PAGE)
                flags |= SPI_XFER_U_PAGE;
-
+#endif
        if (data_len == 0)
                flags |= SPI_XFER_END;
 
index 843f379ef15bd51d940b2eb9c98f204be8d6ac78..1f1bb3606590319e43110923ca09711a16a5c721 100644 (file)
@@ -131,6 +131,7 @@ static int spi_flash_bank(struct spi_flash *flash, u32 offset)
 }
 #endif
 
+#ifdef CONFIG_SF_DUAL_FLASH
 static void spi_flash_dual_flash(struct spi_flash *flash, u32 *addr)
 {
        switch (flash->dual_flash) {
@@ -150,6 +151,7 @@ static void spi_flash_dual_flash(struct spi_flash *flash, u32 *addr)
                break;
        }
 }
+#endif
 
 int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout)
 {
@@ -167,9 +169,10 @@ int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout)
                check_status = poll_bit;
        }
 
+#ifdef CONFIG_SF_DUAL_FLASH
        if (spi->flags & SPI_XFER_U_PAGE)
                flags |= SPI_XFER_U_PAGE;
-
+#endif
        ret = spi_xfer(spi, 8, &cmd, NULL, flags);
        if (ret) {
                debug("SF: fail to read %s status register\n",
@@ -257,9 +260,10 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
        while (len) {
                erase_addr = offset;
 
+#ifdef CONFIG_SF_DUAL_FLASH
                if (flash->dual_flash > SF_SINGLE_FLASH)
                        spi_flash_dual_flash(flash, &erase_addr);
-
+#endif
 #ifdef CONFIG_SPI_FLASH_BAR
                ret = spi_flash_bank(flash, erase_addr);
                if (ret < 0)
@@ -298,9 +302,10 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,
        for (actual = 0; actual < len; actual += chunk_len) {
                write_addr = offset;
 
+#ifdef CONFIG_SF_DUAL_FLASH
                if (flash->dual_flash > SF_SINGLE_FLASH)
                        spi_flash_dual_flash(flash, &write_addr);
-
+#endif
 #ifdef CONFIG_SPI_FLASH_BAR
                ret = spi_flash_bank(flash, write_addr);
                if (ret < 0)
@@ -383,9 +388,10 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
        while (len) {
                read_addr = offset;
 
+#ifdef CONFIG_SF_DUAL_FLASH
                if (flash->dual_flash > SF_SINGLE_FLASH)
                        spi_flash_dual_flash(flash, &read_addr);
-
+#endif
 #ifdef CONFIG_SPI_FLASH_BAR
                bank_sel = spi_flash_bank(flash, read_addr);
                if (bank_sel < 0)
index 48de7c1986a5eeebd4cb1b34d798bb33c7e78aaa..bc3cf6cc64aaa3bb324e3a360882a78725552696 100644 (file)
@@ -150,8 +150,10 @@ static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi,
        flash->page_size = ((ext_jedec == 0x4d00) ? 512 : 256) << flash->shift;
        flash->sector_size = params->sector_size << flash->shift;
        flash->size = flash->sector_size * params->nr_sectors << flash->shift;
+#ifdef CONFIG_SF_DUAL_FLASH
        if (flash->dual_flash & SF_DUAL_STACKED_FLASH)
                flash->size <<= 1;
+#endif
 
        /* Compute erase sector and command */
        if (params->flags & SECT_4K) {