Re: [PATCH] can: mcp251x: fix support for half duplex SPI host controllers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30.03.2021 14:06:03, Tim Harvey wrote:
> On Tue, Mar 30, 2021 at 3:02 AM Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote:
> >
> > Some SPI host controllers do not support full-duplex SPI transfers.
> >
> > The function mcp251x_spi_trans() does a full duplex transfer. It is
> > used in several places in the driver, where a TX half duplex transfer
> > is sufficient.
> >
> > To fix support for half duplex SPI host controllers, this patch
> > introduces a new function mcp251x_spi_write() and changes all callers
> > that do a TX half duplex transfer to use mcp251x_spi_write().

> So was the issue being resolved here that there was another SPI host
> controller that wasn't advertising that it was half duplex only

I don't know which SPI host controller Gerhard uses, but I assume it has
half duplex set, as the driver probe fails with:

| [  112.226164] mcp251x spi0.1: spi transfer failed: ret = -22

The -22 is returned by the SPI framework if you have a half duplex
controller and a transfer with both TX and RX buffer set. This is the
case in the mcp251x_spi_trans() function.

> or was something else wrong with e0e25001d088 ("can: mcp251x: add
> support for half duplex controllers")?

Your patch only converted the SPI read path to use half duplex
transfers. My patch also converts the SPI write path.

If your half duplex controller works without that patch, the controller
driver doesn't advertise correctly that it is half duplex only. If the
hardware is indeed half duplex only, better send a patch that sets the
half duplex flag. If the hardware support full duplex, but the driver
somehow doesn't implement it correctly, so that it implements half
duplex only you should at least drop a note on the SPI mailing list.

Can you test this patch and give me a Tested-by?

regards,
Marc

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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux