spi/atmel: let transfers through if not changing bits_per_word

bits_per_word option in spi_transfer are allowed if it does not change
the csr register.

This is necessary for the driver in
drivers/staging/iio/adis16260_core.c, as it uses this option.

Signed-off-by: Matthias Brugger <mensch0815@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

authored by Matthias Brugger and committed by Grant Likely b9d228f9 8e41b527

+13 -1
+13 -1
drivers/spi/atmel_spi.c
··· 654 654 struct spi_transfer *xfer; 655 655 unsigned long flags; 656 656 struct device *controller = spi->master->dev.parent; 657 + u8 bits; 658 + struct atmel_spi_device *asd; 657 659 658 660 as = spi_master_get_devdata(spi->master); 659 661 ··· 674 672 return -EINVAL; 675 673 } 676 674 675 + if (xfer->bits_per_word) { 676 + asd = spi->controller_state; 677 + bits = (asd->csr >> 4) & 0xf; 678 + if (bits != xfer->bits_per_word - 8) { 679 + dev_dbg(&spi->dev, "you can't yet change " 680 + "bit_per_word in transfers\n"); 681 + return -ENOPROTOOPT; 682 + } 683 + } 684 + 677 685 /* FIXME implement these protocol options!! */ 678 - if (xfer->bits_per_word || xfer->speed_hz) { 686 + if (xfer->speed_hz) { 679 687 dev_dbg(&spi->dev, "no protocol options yet\n"); 680 688 return -ENOPROTOOPT; 681 689 }