Przeglądaj źródła

spi: dw: invert wait condition in dw_spi_xfer

While switching to readl_poll_timeout macros from custom code
the waiting condition was accidently inverted, so it was pure
luck that this code works at least in some conditions.

Fix that by inverting exit condition for readl_poll_timeout.

Fixes: c6b4f031d9 ("DW SPI: fix tx data loss on FIFO flush")

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Eugeniy Paltsev 7 lat temu
rodzic
commit
9b14ac5cc2
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      drivers/spi/designware_spi.c

+ 1 - 1
drivers/spi/designware_spi.c

@@ -425,7 +425,7 @@ static int dw_spi_xfer(struct udevice *dev, unsigned int bitlen,
 	 * in the beginning of new transfer.
 	 * in the beginning of new transfer.
 	 */
 	 */
 	if (readl_poll_timeout(priv->regs + DW_SPI_SR, val,
 	if (readl_poll_timeout(priv->regs + DW_SPI_SR, val,
-			       !(val & SR_TF_EMPT) || (val & SR_BUSY),
+			       (val & SR_TF_EMPT) && !(val & SR_BUSY),
 			       RX_TIMEOUT * 1000)) {
 			       RX_TIMEOUT * 1000)) {
 		ret = -ETIMEDOUT;
 		ret = -ETIMEDOUT;
 	}
 	}