• Jonatas Rech's avatar
    spi: fsl-espi: fix behaviour for full-duplex xfers · 2000058e
    Jonatas Rech authored
    This patch makes possible for protocol drivers to do full-duplex SPI
    transfers properly. Until now this driver could only be used for
    half-duplex transfers, since it always expected an spi_transfer with
    non-null tx_buf to be only used for TX, and those with non-null rx_buf
    to be only used for RX.
    
    The fix consists in correcting the fsl_espi_transfer length by taking
    into consideration duplex spi_transfers, and not just by adding n_tx
    and n_rx.
    
    Furthermore, this correction has exposed an inconsistency in the
    protocol driver <-> controller driver interaction. The spi-fsl-espi
    driver artificially inserts TX bytes when message fragmentation is
    necessary (due to SPCOM_TRANLEN_MAX) instead of informing the
    protocol driver of the hardware limitation. This was tested with the
    m25p80 NOR flash protocol driver. Since fixing this issue may cause
    other client drivers to malfunction, it was left as is.
    Signed-off-by: default avatarJonatas Rech <jonatas.rech@datacom.ind.br>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    2000058e
spi-fsl-espi.c 20.9 KB