linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Kundrát" <jan.kundrat-xoNZbkdr4U2lVyrhU4qvOw@public.gmane.org>
To: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Geert Uytterhoeven
	<geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>,
	Chris Packham
	<Chris.Packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>,
	Andy Shevchenko
	<andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Gregory CLEMENT
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Christophe JAILLET
	<christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org>
Subject: [PATCH 2/4] spi: orion: Respect per-transfer bits_per_word settings
Date: Thu, 15 Feb 2018 15:19:11 +0100	[thread overview]
Message-ID: <b983963f1ad0400fdca2f8bf8095d25b62b0ffb0.1518704854.git.jan.kundrat@cesnet.cz> (raw)
In-Reply-To: <bc8bf712358fbb000ea7e2ea9e1aec42b21988e6.1518704854.git.jan.kundrat-xoNZbkdr4U2lVyrhU4qvOw@public.gmane.org>

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-xoNZbkdr4U2lVyrhU4qvOw@public.gmane.org>
---
 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 ca52300baeb1..56e419a7ed78 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -427,7 +427,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 ? xfer->bits_per_word : spi->bits_per_word;
 	count = xfer->len;
 
 	orion_spi = spi_master_get_devdata(spi->master);
-- 
2.14.3


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-02-15 14:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 14:15 [PATCH 1/4] spi: orion: Make the error message greppable Jan Kundrát
     [not found] ` <bc8bf712358fbb000ea7e2ea9e1aec42b21988e6.1518704854.git.jan.kundrat-xoNZbkdr4U2lVyrhU4qvOw@public.gmane.org>
2018-02-10 11:20   ` [PATCH 3/4] spi: orion: Prepare space for per-child options Jan Kundrát
2018-02-10 12:25   ` [PATCH 4/4] spi: orion: Software control for inter-word delays Jan Kundrát
     [not found]     ` <475b63c52b17187089d3f2ecf8ff4b8c45a7e58b.1518704854.git.jan.kundrat-xoNZbkdr4U2lVyrhU4qvOw@public.gmane.org>
2018-02-15 15:19       ` Mark Brown
     [not found]         ` <20180215151907.GD8374-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2018-02-15 15:45           ` Jan Kundrát
     [not found]             ` <c5d27950-0d13-422c-afe9-990b4adad45a-xoNZbkdr4U2lVyrhU4qvOw@public.gmane.org>
2018-02-15 15:49               ` Mark Brown
     [not found]                 ` <20180215154945.GF8374-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2018-02-15 17:18                   ` Trent Piepho
     [not found]                     ` <1518715087.25567.68.camel-cgc2CodaaHDQT0dZR+AlfA@public.gmane.org>
2018-02-15 17:29                       ` Mark Brown
2018-02-15 14:19   ` Jan Kundrát [this message]
     [not found]     ` <b983963f1ad0400fdca2f8bf8095d25b62b0ffb0.1518704854.git.jan.kundrat-xoNZbkdr4U2lVyrhU4qvOw@public.gmane.org>
2018-02-15 17:13       ` [PATCH 2/4] spi: orion: Respect per-transfer bits_per_word settings Trent Piepho
     [not found]     ` <E1emNJK-0004YS-Oj@debutante>
2018-02-15 17:36       ` Applied "spi: orion: Respect per-transfer bits_per_word settings" to the spi tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b983963f1ad0400fdca2f8bf8095d25b62b0ffb0.1518704854.git.jan.kundrat@cesnet.cz \
    --to=jan.kundrat-xonzbkdr4u2lvyrhu4qvow@public.gmane.org \
    --cc=Chris.Packham-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org \
    --cc=andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).