Re: [PATCH] spi: spi-bcm2835.c: Fix 3-wire mode

From: Stefan Wahren
Date: Fri Jun 28 2019 - 11:24:18 EST


Hi Nuno,

Am 28.06.19 um 14:30 schrieb Nuno SÃ:
> As stated in
> https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md,
> one of rx or tx buffer's must be null. However, if DMA is enabled, the
> driver sets the SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX on the
> controller flags. Hence, the spi core will provide dummy buffers even if
> one of the buffers was set to null by the device driver. Thus, the
> communication with the 3-wire device fails.
>
> This patch uses the prepare_message callback to look for the device mode
> and sets/clears the SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX on a
> per spi message basis. It also assumes that DMA is not supported on
> half-duplex devices.
>
> Signed-off-by: Nuno SÃ <nuno.sa@xxxxxxxxxx>

i never tested the 3-wire mode. Could you please describe your test setup?

@Martin, @Lukas Are you fine with this patch?