aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-04-03 18:46:22 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-05-16 17:33:57 -0400
commitccf77cc4af5b048e20cfd9327fcc286cb69c34cc (patch)
tree0a19a6948fe8bbf2128010a655e170ffebc9d8b8 /drivers/spi
parentff9f4771b5f017ee0f57629488b6cd7a6ef3d19b (diff)
[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 <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/spi')
-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)
187 if (!spi->max_speed_hz) 187 if (!spi->max_speed_hz)
188 return -EINVAL; 188 return -EINVAL;
189 189
190 bitbang = spi_master_get_devdata(spi->master);
191
192 /* REVISIT: some systems will want to support devices using lsb-first
193 * bit encodings on the wire. In pure software that would be trivial,
194 * just bitbang_txrx_le_cphaX() routines shifting the other way, and
195 * some hardware controllers also have this support.
196 */
197 if ((spi->mode & SPI_LSB_FIRST) != 0)
198 return -EINVAL;
199
190 if (!cs) { 200 if (!cs) {
191 cs = kzalloc(sizeof *cs, SLAB_KERNEL); 201 cs = kzalloc(sizeof *cs, SLAB_KERNEL);
192 if (!cs) 202 if (!cs)
193 return -ENOMEM; 203 return -ENOMEM;
194 spi->controller_state = cs; 204 spi->controller_state = cs;
195 } 205 }
196 bitbang = spi_master_get_devdata(spi->master);
197 206
198 if (!spi->bits_per_word) 207 if (!spi->bits_per_word)
199 spi->bits_per_word = 8; 208 spi->bits_per_word = 8;