Netdev Archive on lore.kernel.org
 help / color / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu)" 
	<fixed-term.Konstantin.Buecheler@escrypt.com>,
	Patrick Menschel <menschel.p@posteo.de>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: Dan Murphy <dmurphy@ti.com>
Subject: Re: AW: can: tcan4x5x: spi bits_per_word issue on Raspberry PI
Date: Fri, 16 Aug 2019 10:37:46 +0200
Message-ID: <175f7e89-5b4b-dd54-20a3-d6a5a04c6e9c@pengutronix.de> (raw)
In-Reply-To: <47108d803086402c83d1073f3e3a62bb@escrypt.com>

[-- Attachment #1.1: Type: text/plain, Size: 1583 bytes --]

On 8/16/19 10:26 AM, FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu)
wrote:
>>> Have you changed the bits_per_word to 8? Then you read just a stream
>>> of bytes. If you tread them as an u32 they are in host order.
> 
> @Marc
> Yes, I changed bits_per_word to 8. Since the PI does not support any values apart from 
> 8 and 9 this seems to be the only way.

ok

>> from my experience with SPIDEV on RPI, the driver uses a char array for I/O.
>> As the RPI code is build little endian, logically little endian comes out of SPI. You
>> basically have to invert the bit and byte order by hand for a big endian slave.
> 
> @Patrick, Marc
> You both are right. This seems to be the problem. The SPI driver uses char arrays
> and the tcan driver treats them as u32. 

No, the tcan configures the spi device or rather the host driver that
the word len should be 32 bit. If you change the value to 8 you break
the assumptions in the driver.

> I will try to change the byte order by hand to get it running for my project. But in the long 
> run, this does not seem to be a proper solution... 

Indeed, that's the wrong approach. I don't have any HW here to test, but
I'll prepare a patch. BTW: the driver is broken in several ways, when it
comes to the regmap configuration.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 15:01 FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu)
2019-08-15  8:34 ` Marc Kleine-Budde
     [not found]   ` <e6577cc2-89fc-9428-b73e-47f41eff2949@posteo.de>
2019-08-16  8:26     ` AW: " FIXED-TERM Buecheler Konstantin (ETAS-SEC/ECT-Mu)
2019-08-16  8:37       ` Marc Kleine-Budde [this message]

Reply instructions:

You may reply publically 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=175f7e89-5b4b-dd54-20a3-d6a5a04c6e9c@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=dmurphy@ti.com \
    --cc=fixed-term.Konstantin.Buecheler@escrypt.com \
    --cc=linux-can@vger.kernel.org \
    --cc=menschel.p@posteo.de \
    --cc=netdev@vger.kernel.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

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org netdev@archiver.kernel.org
	public-inbox-index netdev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox