Message ID | 188e1e02cc13e8370f2cbf62105105fb80fefb87.1528133962.git.jan.kundrat@cesnet.cz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On pondělí 4. června 2018 17:00:03 CEST, Jan Kundrát wrote: > It's a bug to look at the device's bits_per_word because each transfer > can override these settings. In fact, e.g., spidev cannot specify > "global" bits_per_word and instead relies on passing that through every > ioctl. > > This code already did the right thing in orion_spi_setup_transfer, but > then failed to access the HW in an appropriate way here in > orion_spi_write_read. > > Tested by 16-bit trnasfers via spidev on an Armada 388 (Solidrun > Clearfog). > > Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz> > --- > drivers/spi/spi-orion.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c > index a12ec0814327..5477e7b70902 100644 > --- a/drivers/spi/spi-orion.c > +++ b/drivers/spi/spi-orion.c > @@ -432,7 +432,7 @@ orion_spi_write_read(struct spi_device > *spi, struct spi_transfer *xfer) > struct orion_spi *orion_spi; > int cs = spi->chip_select; > > - word_len = spi->bits_per_word; > + word_len = xfer->bits_per_word; > count = xfer->len; > > orion_spi = spi_master_get_devdata(spi->master); Can I get a second review of this patch, please? It's a continuation from [1] and it makes it possible to use 16-bit transfers over spidev on spi-orion. With kind regards, Jan [1] https://patchwork.kernel.org/patch/10221395/
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index a12ec0814327..5477e7b70902 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -432,7 +432,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) struct orion_spi *orion_spi; int cs = spi->chip_select; - word_len = spi->bits_per_word; + word_len = xfer->bits_per_word; count = xfer->len; orion_spi = spi_master_get_devdata(spi->master);
It's a bug to look at the device's bits_per_word because each transfer can override these settings. In fact, e.g., spidev cannot specify "global" bits_per_word and instead relies on passing that through every ioctl. This code already did the right thing in orion_spi_setup_transfer, but then failed to access the HW in an appropriate way here in orion_spi_write_read. Tested by 16-bit trnasfers via spidev on an Armada 388 (Solidrun Clearfog). Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz> --- drivers/spi/spi-orion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)