diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi_bitbang.c | 11 |
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; |