Commit 7cbb16b2 authored by Gregory CLEMENT's avatar Gregory CLEMENT Committed by Mark Brown

spi: atmel: Fix CS high support

Until a few years ago, this driver was only used with CS GPIO. The
only exception is CS0 on AT91RM9200 which has to use internal CS. A
limitation of the internal CS is that they don't support CS High.

So by using the CS GPIO the CS high configuration was available except
for the particular case CS0 on RM9200.

When the support for the internal chip-select was added, the check of
the CS high support was not updated. Due to this the driver accepts
this configuration for all the SPI controller v2 (used by all SoCs
excepting the AT91RM9200) whereas the hardware doesn't support it for
infernal CS.

This patch fixes the test to match the hardware capabilities.

Fixes: 48203034 ("spi: atmel: add support for the internal chip-select of the spi controller")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20191017141846.7523-3-gregory.clement@bootlin.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4d8672d1
...@@ -1176,10 +1176,8 @@ static int atmel_spi_setup(struct spi_device *spi) ...@@ -1176,10 +1176,8 @@ static int atmel_spi_setup(struct spi_device *spi)
as = spi_master_get_devdata(spi->master); as = spi_master_get_devdata(spi->master);
/* see notes above re chipselect */ /* see notes above re chipselect */
if (!atmel_spi_is_v2(as) if (!as->use_cs_gpios && (spi->mode & SPI_CS_HIGH)) {
&& spi->chip_select == 0 dev_warn(&spi->dev, "setup: non GPIO CS can't be active-high\n");
&& (spi->mode & SPI_CS_HIGH)) {
dev_dbg(&spi->dev, "setup: can't be active-high\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment