]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spi: zynq: Fix to check CS0 and CS1 MIO's
authorJagannadha Sutradharudu Teki <jagannadha.sutradharudu-teki@xilinx.com>
Fri, 8 Mar 2013 18:43:46 +0000 (00:13 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 11 Mar 2013 07:44:57 +0000 (08:44 +0100)
Checking CS0 and CS1 MIO's for single and dual qspi which is
missing on the existing runtime qspi detection code.

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

index 0920e43e5340a753230cf6c97e4a31e0e860e854..4dc71173740a9ff2a60aa36761637f09eed17a1d 100644 (file)
@@ -751,22 +751,30 @@ static int xqspips_check_is_dual_flash(void __iomem *regs_base)
        mio_base = regs_base + 0x700;
 
        /* checking single QSPI MIO's */
-       for (mio_pin_index = 2; mio_pin_index < 7; mio_pin_index++) {
-               val = xqspips_read(mio_base + 4 * mio_pin_index);
-               if ((val & mask) == type)
-                       lower_mio++;
+       val = xqspips_read(mio_base + 4 * 1);
+       if ((val & mask) == type) {
+               lower_mio++;
+               for (mio_pin_index = 2; mio_pin_index < 7; mio_pin_index++) {
+                       val = xqspips_read(mio_base + 4 * mio_pin_index);
+                       if ((val & mask) == type)
+                               lower_mio++;
+               }
        }
 
        /* checking dual QSPI MIO's */
-       for (mio_pin_index = 8; mio_pin_index < 14; mio_pin_index++) {
-               val = xqspips_read(mio_base + 4 * mio_pin_index);
-               if ((val & mask) == type)
-                       upper_mio++;
+       val = xqspips_read(mio_base + 4 * 0);
+       if ((val & mask) == type) {
+               upper_mio++;
+               for (mio_pin_index = 9; mio_pin_index < 14; mio_pin_index++) {
+                       val = xqspips_read(mio_base + 4 * mio_pin_index);
+                       if ((val & mask) == type)
+                               upper_mio++;
+               }
        }
 
-       if ((lower_mio == 5) && (upper_mio == 6))
+       if ((lower_mio == 6) && (upper_mio == 6))
                is_dual = 1;
-       else if (lower_mio == 5)
+       else if (lower_mio == 6)
                is_dual = 0;
 
        return is_dual;