mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
[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>
This commit is contained in:
parent
ff9f4771b5
commit
ccf77cc4af
2 changed files with 15 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue