spi: davinci: fix SPI_NO_CS functionality
authorGrygorii Strashko <grygorii.strashko@ti.com>
Thu, 21 Aug 2014 15:25:05 +0000 (18:25 +0300)
committerMark Brown <broonie@linaro.org>
Thu, 21 Aug 2014 18:08:56 +0000 (13:08 -0500)
The driver should not touch CS lines if SPI_NO_CS flag is set.
This patch fixes it as this functionality was broken accidentally
by
commit a88e34ea213e1b ("spi: davinci: add support to configure gpio cs through dt").

Fixes: a88e34ea213e1b ("spi: davinci: add support to configure gpio cs through dt")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-davinci.c

index 276a3884fb3c1d43c928b0b975b8d7aa67f6be58..48f1d26e6ad9868f9ac8c8e11fb0953e90f707da 100644 (file)
@@ -417,16 +417,16 @@ static int davinci_spi_setup(struct spi_device *spi)
                                                  flags, dev_name(&spi->dev));
                        internal_cs = false;
                }
-       }
 
-       if (retval) {
-               dev_err(&spi->dev, "GPIO %d setup failed (%d)\n",
-                       spi->cs_gpio, retval);
-               return retval;
-       }
+               if (retval) {
+                       dev_err(&spi->dev, "GPIO %d setup failed (%d)\n",
+                               spi->cs_gpio, retval);
+                       return retval;
+               }
 
-       if (internal_cs)
-               set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select);
+               if (internal_cs)
+                       set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select);
+       }
 
        if (spi->mode & SPI_READY)
                set_io_bits(dspi->base + SPIPC0, SPIPC0_SPIENA_MASK);