]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spi: zynq: Add enum qualifier for qspi connections topology
authorJagannadha Sutradharudu Teki <jagannadha.sutradharudu-teki@xilinx.com>
Fri, 8 Mar 2013 18:43:47 +0000 (00:13 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 11 Mar 2013 07:45:14 +0000 (08:45 +0100)
QSPI connections topology single, dual parallel are defined
as enum qualifier to make use on respective area on the code.

Also added MIO count macros for single and dual qspi XQSPIPS_MIO_*

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
drivers/spi/zynq_qspips.c

index 4dc71173740a9ff2a60aa36761637f09eed17a1d..d7c632273d6493ca99146ef1f370cbe81ce8e224 100644 (file)
 #define XQSPIPS_QUEUE_STOPPED          0
 #define XQSPIPS_QUEUE_RUNNING          1
 
+/* QSPI MIO's count for different connection topologies */
+#define XQSPIPS_MIO_SINGLE             6
+#define XQSPIPS_MIO_DUAL_PARALLEL      6
+
+/* QSPI connections topology */
+enum xqspips_con_topology {
+       MODE_SINGLE = 0,
+       MODE_DUAL_PARALLEL = 1,
+};
+
 /* Definitions of the flash commands - Flash opcodes in ascending order */
 #define        XQSPIPS_FLASH_OPCODE_WRSR       0x01    /* Write status register */
 #define        XQSPIPS_FLASH_OPCODE_PP         0x02    /* Page program */
@@ -205,7 +215,7 @@ static void xqspips_init_hw(void __iomem *regs_base, unsigned int is_dual)
        config_reg |= 0x8000FCC1;
        xqspips_write(regs_base + XQSPIPS_CONFIG_OFFSET, config_reg);
 
-       if (is_dual == 1)
+       if (is_dual == MODE_DUAL_PARALLEL)
                /* Enable two memories on seperate buses */
                xqspips_write(regs_base + XQSPIPS_LINEAR_CFG_OFFSET,
                        (XQSPIPS_LCFG_TWO_MEM_MASK |
@@ -592,7 +602,7 @@ static int xqspips_start_transfer(struct spi_device *qspi,
                 * In case of dual memories, convert 25 bit address to 24 bit
                 * address before transmitting to the 2 memories
                 */
-               if ((xqspi->is_dual == 1) &&
+               if ((xqspi->is_dual == MODE_DUAL_PARALLEL) &&
                    ((instruction == XQSPIPS_FLASH_OPCODE_PP) ||
                    (instruction == XQSPIPS_FLASH_OPCODE_SE) ||
                    (instruction == XQSPIPS_FLASH_OPCODE_BE_32K) ||
@@ -772,10 +782,11 @@ static int xqspips_check_is_dual_flash(void __iomem *regs_base)
                }
        }
 
-       if ((lower_mio == 6) && (upper_mio == 6))
-               is_dual = 1;
-       else if (lower_mio == 6)
-               is_dual = 0;
+       if ((lower_mio == XQSPIPS_MIO_SINGLE) &&
+                       (upper_mio == XQSPIPS_MIO_DUAL_PARALLEL))
+               is_dual = MODE_DUAL_PARALLEL;
+       else if (lower_mio == XQSPIPS_MIO_SINGLE)
+               is_dual = MODE_SINGLE;
 
        return is_dual;
 }