diff options
author | Qipan Li <Qipan.Li@csr.com> | 2014-04-14 02:29:59 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-04-14 16:03:34 -0400 |
commit | 6ee8a2f7d5e78700b6e64799b5e9976b21cfad79 (patch) | |
tree | 8b0eae032373d5e8369a732f279c0217574049b2 /drivers/spi/spi-sirf.c | |
parent | 625227a4e916fa87f1dd84bde518ef403c3f708a (diff) |
spi: sirf: make GPIO chipselect function work well
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>
Diffstat (limited to 'drivers/spi/spi-sirf.c')
-rw-r--r-- | drivers/spi/spi-sirf.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 9b30743d816a..67d8909dcf39 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -470,7 +470,16 @@ static void spi_sirfsoc_chipselect(struct spi_device *spi, int value) | |||
470 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); | 470 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); |
471 | } else { | 471 | } else { |
472 | int gpio = sspi->chipselect[spi->chip_select]; | 472 | int gpio = sspi->chipselect[spi->chip_select]; |
473 | gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1); | 473 | switch (value) { |
474 | case BITBANG_CS_ACTIVE: | ||
475 | gpio_direction_output(gpio, | ||
476 | spi->mode & SPI_CS_HIGH ? 1 : 0); | ||
477 | break; | ||
478 | case BITBANG_CS_INACTIVE: | ||
479 | gpio_direction_output(gpio, | ||
480 | spi->mode & SPI_CS_HIGH ? 0 : 1); | ||
481 | break; | ||
482 | } | ||
474 | } | 483 | } |
475 | } | 484 | } |
476 | 485 | ||