Received: by 10.192.165.156 with SMTP id m28csp688370imm; Tue, 17 Apr 2018 18:18:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx49IMx07DYuwy7JAQmEK1ink5Q6roGNMn9mFynLxdAjeKQ1i2CmtXbBOCPvG6/XWksXac5Kt X-Received: by 10.99.109.134 with SMTP id i128mr63491pgc.59.1524014318766; Tue, 17 Apr 2018 18:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524014318; cv=none; d=google.com; s=arc-20160816; b=Sh3joHTEUoNStQ69dAIVRpxuN21qS5LojBonFz8CwssoaY5JoSmYf9d4CRgO6q4Q3t 4ZJFtXUgMY+Gluj1AGO2vPt4rc3fIntSGUCQuY8JgfF24N04+56Y+ZTQBltZQNWB2Xk2 GZXo3PFAwQVzgnW9quNgwCRIxfmwfe1s2hlX4rvIuiTs/7lKgx+6uzLjBX+ta/0vULyi AsEGkR2eqsfqY0F3P38sm8elD1P1aA7TxMGOGOU5KIhI1EFCoUQOeupxOryc+3X78HHt Q+i2ZgDtP3tShHtrGOlzimqctjceMinm2HPs/2f+qLdnJZAYjAfX3Jg1Cnjhlgj7R5Ul BiNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=HlRv8ghV/jRJzSqtDzfpnRJQtyaoEvTBnoO5Y4lG2cY=; b=T7MYNdU+eEThbCIlq2pYCMMobK/ailL6Dxs8qEFzHoSS4R7Qa/K/+V+giG3GfNvMUs av8UTrZdFwSURIOYzFSw86ZzXEp9+hP9CIqy/NIXfx8EAi+NmAUAoDZQqCojRvk47meW 5U6zAd+5NgCAE/xKWcavjis97/WQC0rY4N2r7e4ww5AEQN+zocu9jlVeqr5b9KiuPFs5 /24lqCqllmlYSs/e97anhJcQtU1RyXW6hed1Gxr4+2M+I1X8VEPGFREgXYOUVEc+yy80 rXVUotOT257GhTqdFYW6/4BHF9UXyzUqY+b/PkotIZCpDaTwr8+ayiaetvZNX5qhXEBk OofA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Mk2r6o6V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e63si70972pfb.156.2018.04.17.18.18.24; Tue, 17 Apr 2018 18:18:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Mk2r6o6V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753147AbeDRBRS (ORCPT + 99 others); Tue, 17 Apr 2018 21:17:18 -0400 Received: from m12-13.163.com ([220.181.12.13]:56319 "EHLO m12-13.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751248AbeDRBRQ (ORCPT ); Tue, 17 Apr 2018 21:17:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=HlRv8ghV/jRJzSqtDz fpnRJQtyaoEvTBnoO5Y4lG2cY=; b=Mk2r6o6VzAOH7WJLUEFDT/b6xVM7gNEfR3 GvRSH0oGcUR7HRK9ZCScMo59qk3bmSJAh3KSJXi0HmIv3qzRvYITiWihB6fIQyTN pBwlcpMSWdUdwm+HFb+9wexZfeScKHveRGQkadZyuUoDIjD4pE2cQTrgfmo8mKcd lO3wlu/Lk= Received: from localhost.localdomain (unknown [113.140.17.238]) by smtp9 (Coremail) with SMTP id DcCowAC3_feWnNZaRTViBQ--.15953S3; Wed, 18 Apr 2018 09:17:11 +0800 (CST) From: sxauwsk To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, sxauwsk Subject: [PATCH] spi: cadence: Add usleep_range() for cdns_spi_fill_tx_fifo() Date: Tue, 17 Apr 2018 04:01:27 +0800 Message-Id: <1523908887-48616-1-git-send-email-sxauwsk@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: DcCowAC3_feWnNZaRTViBQ--.15953S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrKF43Xw1DZw4DtryUZFy3twb_yoWDArXEvF 18Cr4kGay5CF9Fy3W29rsrAFWjvF4kGr1v9ayqq39xGrsrAFn2v34rZr1q9w17Aw4UuFn3 urn5Wa4xZr13KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRiTmh3UUUUU== X-Originating-IP: [113.140.17.238] X-CM-SenderInfo: 5v0d34lvn6il2tof0z/xtbBZxcsJletpeD5aQAAsV Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of xspi work in busy condition, may send bytes failed. once something wrong, spi controller did't work any more My test found this situation appear in both of read/write process. so when TX FIFO is full, add one byte delay before send data; Signed-off-by: sxauwsk --- drivers/spi/spi-cadence.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index 5c9516a..4a00163 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -313,6 +313,14 @@ static void cdns_spi_fill_tx_fifo(struct cdns_spi *xspi) while ((trans_cnt < CDNS_SPI_FIFO_DEPTH) && (xspi->tx_bytes > 0)) { + + /* When xspi in busy condition, bytes may send failed, + * then spi control did't work thoroughly, add one byte delay + */ + if (cdns_spi_read(xspi, CDNS_SPI_ISR) & + CDNS_SPI_IXR_TXFULL) + usleep_range(10, 20); + if (xspi->txbuf) cdns_spi_write(xspi, CDNS_SPI_TXD, *xspi->txbuf++); else -- 1.7.9.5