Linux SPI subsystem development
 help / color / mirror / Atom feed
* MCP251x SPI CAN controller on Cavium ThunderX
@ 2017-11-13 21:17 Tim Harvey
       [not found] ` <CAJ+vNU3VK=NPKW+119t4MT7w5xs=FS2HWJTqbFb-HSeJhCvwWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Tim Harvey @ 2017-11-13 21:17 UTC (permalink / raw)
  To: Mark Brown, Jan Glauber, linux-spi-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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
--
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

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

end of thread, other threads:[~2017-11-16 16:13 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
     [not found] ` <CAJ+vNU3VK=NPKW+119t4MT7w5xs=FS2HWJTqbFb-HSeJhCvwWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 12:02   ` Mark Brown
2017-11-15 10:54     ` Marc Kleine-Budde
     [not found]       ` <bfa971bb-1217-ed86-d1d8-e353ecc506aa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
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
     [not found]     ` <2771c4a8-ed85-86c1-a08c-5b62d177b107-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2017-11-15 18:23       ` Tim Harvey
     [not found]         ` <CAJ+vNU0rsabjK80zmq_QBhPQqru2A06n8+zgEPvWfHdyb-kbMQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-15 23:18           ` Tim Harvey
     [not found]             ` <CAJ+vNU0qkXafz8FWjM_TCYj56dv31=ZQ306Ab2qSsePGD6E6KQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-16 12:12               ` Marc Kleine-Budde
     [not found]                 ` <cf336886-a64f-9ff1-2a44-984ff64f8433-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
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