Skip to content

Commit

Permalink
spi: spi-davinci: Add support for SPI_CS_WORD
Browse files Browse the repository at this point in the history
This adds support for the SPI_CS_WORD flag to the TI DaVinci SPI
driver. This mode can be used as long as we are using the hardware
chip select and not a GPIO chip select.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
David Lechner authored and Mark Brown committed Sep 17, 2018
1 parent 9263696 commit a3762b1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/spi/spi-davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value)
!(spi->mode & SPI_CS_HIGH));
} else {
if (value == BITBANG_CS_ACTIVE) {
spidat1 |= SPIDAT1_CSHOLD_MASK;
if (!(spi->mode & SPI_CS_WORD))
spidat1 |= SPIDAT1_CSHOLD_MASK;
spidat1 &= ~(0x1 << chip_sel);
}
}
Expand Down Expand Up @@ -438,8 +439,12 @@ static int davinci_spi_setup(struct spi_device *spi)
return retval;
}

if (internal_cs)
if (internal_cs) {
set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select);
} else if (spi->mode & SPI_CS_WORD) {
dev_err(&spi->dev, "SPI_CS_WORD can't be use with GPIO CS\n");
return -EINVAL;
}
}

if (spi->mode & SPI_READY)
Expand Down Expand Up @@ -974,7 +979,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
dspi->prescaler_limit = pdata->prescaler_limit;
dspi->version = pdata->version;

dspi->bitbang.flags = SPI_NO_CS | SPI_LSB_FIRST | SPI_LOOP;
dspi->bitbang.flags = SPI_NO_CS | SPI_LSB_FIRST | SPI_LOOP | SPI_CS_WORD;
if (dspi->version == SPI_VERSION_2)
dspi->bitbang.flags |= SPI_READY;

Expand Down

0 comments on commit a3762b1

Please sign in to comment.