From: David Brownell This lets bitbanging SPI controller drivers declare that they support modes like SPI_CS_HIGH and SPI_3WIRE. Signed-off-by: David Brownell Signed-off-by: Andrew Morton --- drivers/spi/spi_bitbang.c | 12 +++--------- include/linux/spi/spi_bitbang.h | 1 + 2 files changed, 4 insertions(+), 9 deletions(-) diff -puN drivers/spi/spi_bitbang.c~spi-controller-drivers-check-for-unsupported-modes-update drivers/spi/spi_bitbang.c --- a/drivers/spi/spi_bitbang.c~spi-controller-drivers-check-for-unsupported-modes-update +++ a/drivers/spi/spi_bitbang.c @@ -187,16 +187,10 @@ int spi_bitbang_setup(struct spi_device bitbang = spi_master_get_devdata(spi->master); - /* REVISIT: some systems will want to support devices using lsb-first - * bit encodings on the wire. In pure software that would be trivial, - * just bitbang_txrx_le_cphaX() routines shifting the other way, and - * some hardware controllers also have this support. - * - * REVISIT: we should accept SPI_CS_HIGH in some cases; it's - * easy to implement that with GPIOs, but we don't know if the - * underlying chipselect() method support that... + /* Bitbangers can support SPI_CS_HIGH, SPI_3WIRE, and so on; + * add those to master->flags, and provide the other support. */ - if ((spi->mode & ~(SPI_CPOL|SPI_CPHA)) != 0) + if ((spi->mode & ~(SPI_CPOL|SPI_CPHA|bitbang->flags)) != 0) return -EINVAL; if (!cs) { diff -puN include/linux/spi/spi_bitbang.h~spi-controller-drivers-check-for-unsupported-modes-update include/linux/spi/spi_bitbang.h --- a/include/linux/spi/spi_bitbang.h~spi-controller-drivers-check-for-unsupported-modes-update +++ a/include/linux/spi/spi_bitbang.h @@ -26,6 +26,7 @@ struct spi_bitbang { struct list_head queue; u8 busy; u8 use_dma; + u8 flags; /* extra spi->mode support */ struct spi_master *master; _