From patchwork Thu Apr 19 14:47:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 901285 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40Rhg26tnqz9s1t for ; Fri, 20 Apr 2018 00:47:58 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9FA4CC21FC7; Thu, 19 Apr 2018 14:47:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2D698C21F9B; Thu, 19 Apr 2018 14:47:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C55C8C21F9B; Thu, 19 Apr 2018 14:47:51 +0000 (UTC) Received: from smtprelay.synopsys.com (smtprelay4.synopsys.com [198.182.47.9]) by lists.denx.de (Postfix) with ESMTPS id 4367BC21C38 for ; Thu, 19 Apr 2018 14:47:51 +0000 (UTC) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id A1F6A24E1FD8; Thu, 19 Apr 2018 07:47:49 -0700 (PDT) Received: from paltsev-e7480.internal.synopsys.com (paltsev-e7480.internal.synopsys.com [10.121.3.53]) by mailhost.synopsys.com (Postfix) with ESMTP id 909DA38A6; Thu, 19 Apr 2018 07:47:46 -0700 (PDT) From: Eugeniy Paltsev To: Jagan Teki Date: Thu, 19 Apr 2018 17:47:41 +0300 Message-Id: <20180419144741.17726-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.14.3 Cc: u-boot@lists.denx.de, Alexey Brodkin , Eugeniy Paltsev , uboot-snps-arc@synopsys.com Subject: [U-Boot] [PATCH] DW SPI: invert wait condition in dw_spi_xfer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- drivers/spi/designware_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c index 0e93b62eee..5e2d290ddc 100644 --- a/drivers/spi/designware_spi.c +++ b/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. */ 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)) { ret = -ETIMEDOUT; }