summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorAlban Bedel <albeu@free.fr>2015-04-24 16:19:24 +0200
committerMark Brown <broonie@kernel.org>2015-04-27 16:44:57 +0200
commit83f0f398a0a64a6e94dccb5a812c67648cedef29 (patch)
treef3c4e1c217603e174c8b978dacaeefcd27ada7ab /drivers/spi
parentspi: spi-ath79: Use clk_prepare_enable and clk_disable_unprepare (diff)
downloadlinux-83f0f398a0a64a6e94dccb5a812c67648cedef29.tar.xz
linux-83f0f398a0a64a6e94dccb5a812c67648cedef29.zip
spi: spi-ath79: Set the initial state of CS0
The internal chip select CS0 wasn't initialized properly to work with CS HIGH chips. Signed-off-by: Alban Bedel <albeu@free.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-ath79.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index b37bedd059b3..bf1f9b32c597 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -115,6 +115,7 @@ static void ath79_spi_disable(struct ath79_spi *sp)
static int ath79_spi_setup_cs(struct spi_device *spi)
{
+ struct ath79_spi *sp = ath79_spidev_to_sp(spi);
int status;
if (spi->chip_select && !gpio_is_valid(spi->cs_gpio))
@@ -132,6 +133,13 @@ static int ath79_spi_setup_cs(struct spi_device *spi)
status = gpio_request_one(spi->cs_gpio, flags,
dev_name(&spi->dev));
+ } else {
+ if (spi->mode & SPI_CS_HIGH)
+ sp->ioc_base &= ~AR71XX_SPI_IOC_CS0;
+ else
+ sp->ioc_base |= AR71XX_SPI_IOC_CS0;
+
+ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base);
}
return status;