From patchwork Mon Apr 9 11:16:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "sxauwsk@163.com" X-Patchwork-Id: 10334825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8CFCE6053B for ; Wed, 11 Apr 2018 03:47:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 859F8285EF for ; Wed, 11 Apr 2018 03:47:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 783CF2862C; Wed, 11 Apr 2018 03:47:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, DATE_IN_PAST_24_48, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A599285EF for ; Wed, 11 Apr 2018 03:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752245AbeDKDro (ORCPT ); Tue, 10 Apr 2018 23:47:44 -0400 Received: from m12-18.163.com ([220.181.12.18]:46859 "EHLO m12-18.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752234AbeDKDrn (ORCPT ); Tue, 10 Apr 2018 23:47:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=FRZXncidUNRWeOgbeu v7vpJ8CsHqHN0DfZ/N7ZEKuWY=; b=ll/zRHAmjNsQdJEbFC/ToxzYa2Ebx1rZqr ySkEADyJdKZGxJPdvFGIe/IT4IXMsbg4u40fOEGb+eiuj9NulYXSUQ+TGU00m15Y lOYKODudutsCW/5BeIeuZGvrjYUdZehzHed7QpTgGAaFiUfhPftvvoPi+HiHseuW hdkPnVEaY= Received: from localhost.localdomain (unknown [113.140.17.238]) by smtp14 (Coremail) with SMTP id EsCowACXsdBEhc1atNCREg--.17491S3; Wed, 11 Apr 2018 11:47:26 +0800 (CST) From: sxauwsk To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, sxauwsk@163.com, guojian , wangshikai Subject: [PATCH] spi: cadence: Add usleep_range() for cdns_spi_fill_tx_fifo() Date: Mon, 9 Apr 2018 19:16:50 +0800 Message-Id: <1523272610-49116-1-git-send-email-sxauwsk@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: EsCowACXsdBEhc1atNCREg--.17491S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrtw1rtF1kuw1UZF13Zw47Arb_yoWfAFbEvF 1UAws7Gay5JF9FyFy29rsrZryjva1Fqr1kuF1qqas8JwsrZan2vrn5Zr1DKw17Zw4UuFnx Zr1vga4DArsxKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRRJ3ktUUUUU== X-Originating-IP: [113.140.17.238] X-CM-SenderInfo: 5v0d34lvn6il2tof0z/xtbBZA8lJlQG-7C1lAAAsU Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of xspi work in busy condition, may send bytes failed. Add one bytes delay Signed-off-by: sxauwsk Signed-off-by: guojian Signed-off-by: wangshikai --- drivers/spi/spi-cadence.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index 5c9516a..66ae055 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -313,6 +313,12 @@ 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, + * caused communication failure so add one byte delay + */ + usleep_range(10, 20); + if (xspi->txbuf) cdns_spi_write(xspi, CDNS_SPI_TXD, *xspi->txbuf++); else