aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_bitbang.c
diff options
context:
space:
mode:
authorDavid Brownell <[email protected]>2006-04-03 22:46:22 +0000
committerGreg Kroah-Hartman <[email protected]>2006-05-16 21:33:57 +0000
commitccf77cc4af5b048e20cfd9327fcc286cb69c34cc (patch)
tree0a19a6948fe8bbf2128010a655e170ffebc9d8b8 /drivers/spi/spi_bitbang.c
parent[PATCH] SPI: Renamed bitbang_transfer_setup to spi_bitbang_setup_transfer and... (diff)
downloadkernel-ccf77cc4af5b048e20cfd9327fcc286cb69c34cc.tar.gz
kernel-ccf77cc4af5b048e20cfd9327fcc286cb69c34cc.zip
[PATCH] SPI: devices can require LSB-first encodings
Add spi_device hook for LSB-first word encoding, and update all the (in-tree) controller drivers to reject such devices. Eventually, some controller drivers will be updated to support lsb-first encodings on the wire; no current drivers need this. Signed-off-by: David Brownell <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/spi/spi_bitbang.c')
-rw-r--r--drivers/spi/spi_bitbang.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 6c3da64d609a..0f7f5c64391c 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -187,13 +187,22 @@ int spi_bitbang_setup(struct spi_device *spi)
if (!spi->max_speed_hz)
return -EINVAL;
+ 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.
+ */
+ if ((spi->mode & SPI_LSB_FIRST) != 0)
+ return -EINVAL;
+
if (!cs) {
cs = kzalloc(sizeof *cs, SLAB_KERNEL);
if (!cs)
return -ENOMEM;
spi->controller_state = cs;
}
- bitbang = spi_master_get_devdata(spi->master);
if (!spi->bits_per_word)
spi->bits_per_word = 8;