public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* MCP251x SPI CAN controller on Cavium ThunderX
@ 2017-11-13 21:17 Tim Harvey
  2017-11-14 12:02 ` Mark Brown
  2017-11-15 16:02 ` David Daney
  0 siblings, 2 replies; 14+ messages in thread
From: Tim Harvey @ 2017-11-13 21:17 UTC (permalink / raw)
  To: Mark Brown, Jan Glauber, linux-spi
  Cc: linux-kernel@vger.kernel.org, Wolfgang Grandegger,
	Marc Kleine-Budde

Mark/Jan,

I have been unsuccessful getting a MCP251x SPI based CAN controller
working on a CN80xx using Linux mainline.

When a register is read from the mcp251x driver the
octeon_spi_do_transfer() gets a spi_message with a single spi_xfer of
len=3, a tx_buf, and an rx_buf which I believe is supposed to shift
out 3 bytes out MOSI and shift in 3 bytes from MISO where the last
byte shifted in would be the response.

The cavium CN80xx MPI_TX register has fields for 'Number of bytes to
transmit' (TXNUM) and 'Total number of bytes to shift (transmit and
receive)' (TOTNUM) and these are both getting set to 3 by
octeon_spi_do_transfer() but I find that this causes unexpected data
in the shifted in response unless I make TOTNUM = TXNUM + 1.

I should also note that Cavium has a software suite called the 'BDK'
which provides a CLI to SPI transfers which allows you to set the
TXNUM and TOTNUM fields uniquely and if I send a 2-byte command
(TXNUM=2) to read a register (READ command followed by the register)
and a 1 byte read (thus TOTNUM=3) then I get the response from the
mcp251x I expect.

Is there something I'm misunderstanding about the Linux SPI API and
perhaps is there a bug in the cavium SPI controller driver or do I
perhaps have it configured wrong with respect to CPHA and/or CPOL?

Thanks,

Tim

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-11-16 16:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-13 21:17 MCP251x SPI CAN controller on Cavium ThunderX Tim Harvey
2017-11-14 12:02 ` Mark Brown
2017-11-15 10:54   ` Marc Kleine-Budde
2017-11-15 12:07     ` Jan Glauber
2017-11-15 12:40       ` Marc Kleine-Budde
2017-11-15 13:31         ` Marc Kleine-Budde
2017-11-15 14:24           ` Jan Glauber
2017-11-15 15:39       ` Mark Brown
2017-11-15 16:02 ` David Daney
2017-11-15 18:23   ` Tim Harvey
2017-11-15 23:18     ` Tim Harvey
2017-11-16 12:12       ` Marc Kleine-Budde
2017-11-16 16:13         ` Tim Harvey
2017-11-16 12:41       ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox