From: Eugeniy Paltsev Date: Thu, 22 Mar 2018 10:50:44 +0000 (+0300) Subject: DW SPI: fix transmit only mode X-Git-Tag: v2018.05-rc1~7^2~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fc282c7bcb6a622ce1a0cf82c55654dec5bcb0cd;p=u-boot DW SPI: fix transmit only mode In current implementation we get -ETIMEDOUT error when we try to use transmit only mode (SPI_TMOD_TO) This happens because in transmit only mode input FIFO never gets any data which breaks our logic in dw_reader(): we are waiting until RX data will be ready in dw_reader, but this newer happens, so we return with error. Fix that by using SPI_TMOD_TR instead of SPI_TMOD_TO which allows to use RX FIFO. Signed-off-by: Eugeniy Paltsev Reviewed-by: Jagan Teki --- diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c index 5e196b21c9..3296441606 100644 --- a/drivers/spi/designware_spi.c +++ b/drivers/spi/designware_spi.c @@ -361,7 +361,11 @@ static int dw_spi_xfer(struct udevice *dev, unsigned int bitlen, else if (rx) priv->tmode = SPI_TMOD_RO; else - priv->tmode = SPI_TMOD_TO; + /* + * In transmit only mode (SPI_TMOD_TO) input FIFO never gets + * any data which breaks our logic in poll_transfer() above. + */ + priv->tmode = SPI_TMOD_TR; cr0 &= ~SPI_TMOD_MASK; cr0 |= (priv->tmode << SPI_TMOD_OFFSET);