]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
spi: sirf: make GPIO chipselect function work well
authorQipan Li <Qipan.Li@csr.com>
Mon, 14 Apr 2014 06:29:59 +0000 (14:29 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 14 Apr 2014 20:03:34 +0000 (21:03 +0100)
orignal GPIO chipslect is not standard because it don't take care to the
chipselect signal: BITBANG_CS_ACTIVE and BITBANG_CS_INACTIVE.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-sirf.c

index 9b30743d816a10e687b8fd752e66da9b8b3a0ffe..67d8909dcf3946a4d516d607fd83cef417aaabc1 100644 (file)
@@ -470,7 +470,16 @@ static void spi_sirfsoc_chipselect(struct spi_device *spi, int value)
                writel(regval, sspi->base + SIRFSOC_SPI_CTRL);
        } else {
                int gpio = sspi->chipselect[spi->chip_select];
-               gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1);
+               switch (value) {
+               case BITBANG_CS_ACTIVE:
+                       gpio_direction_output(gpio,
+                                       spi->mode & SPI_CS_HIGH ? 1 : 0);
+                       break;
+               case BITBANG_CS_INACTIVE:
+                       gpio_direction_output(gpio,
+                                       spi->mode & SPI_CS_HIGH ? 0 : 1);
+                       break;
+               }
        }
 }