Received: by 10.192.165.156 with SMTP id m28csp334459imm; Mon, 16 Apr 2018 00:28:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx49CMxjelIojCPOf+QV6yiGT7OVhfTEskH9TnBPdaPw7NG0HsiY/XFtKR+lAjMA3fxUue3RE X-Received: by 10.99.63.1 with SMTP id m1mr11264152pga.196.1523863700448; Mon, 16 Apr 2018 00:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523863700; cv=none; d=google.com; s=arc-20160816; b=wOXK4M1ndA2ntDmSgpH0CAG8A0r8LKUw9uJEnELOLRi4n/d76yrSWsPNoi6DWySL04 p7E0Yi3PSwH32rUyPpimWzJVoxDfin2L3H3F8OblQLnubTsHnRruZS66sYtxst8nzLFs gMDN1ML/ixfmEv6CBmzsdcRlmgBjMRUbADFx6YXr9Mv+9UZcpUcSjaA4DtCyLt6g80hG LEIcn+eLSQfa/XoZQHBWdI4f+b19AxCyjX4QQfySjXtSCKZ9DT5ILMgrYTdDH2mxKFdv JGkNh9RcC6oQb3lGi6qVeDA2m8vLkYGka1NM0fAZYBBQLq2E2hTphu/bfpQ5CeJM5Mzr 7g6A== 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=fdKdDPGWFZeD2wMAu37agLER2rI/rVUF4Ab7wHIgPJk=; b=NQbGv2qARJWr4Mfci9xMVjOq9BYwQ3gi0+h5ig2CTMPW7a31Dyla6H+I03XJd64cyU iYuHofnZhlz1N6rXtzKT3Rtk+wGbkQaCMqBb1W4v3Xcgo44cWEOkeAHxf0eAqyaUmvOS cgVRyjlkJOqNMc7COkI28D/d5fYQxAf6jdW6i5wl3lbRBx6st4vR+6M/TSw3t6aksJ6U 7LQaPPVEI+LZXf4PGYsGP+lQIFFP0OT7I9RAOFXHVrd/YA32mxK1yxgkw86mqwlZRzRn yilKpRNnVWz4NNPnIHH0h//fafaPs9qSBOglUzBs1JicKdQ8QbY+gICNTYViVYApEnv4 Mkkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=AL22h24d; 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 75si10357560pfx.61.2018.04.16.00.28.06; Mon, 16 Apr 2018 00:28:20 -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=AL22h24d; 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 S1753524AbeDPGrp (ORCPT + 99 others); Mon, 16 Apr 2018 02:47:45 -0400 Received: from m12-18.163.com ([220.181.12.18]:44408 "EHLO m12-18.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751199AbeDPGrn (ORCPT ); Mon, 16 Apr 2018 02: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=fdKdDPGWFZeD2wMAu3 7agLER2rI/rVUF4Ab7wHIgPJk=; b=AL22h24dhAFcS1KSarqMxSAj9qygKt5XvX 9CKrr4m+qvE/XcnGDRKzz8/ab2WA22H7rFGHoPjhzuY0XpZEe5Glz9+aJ0UNn5/7 a1hJMQJ8dlQxDN1ZVOCSFBjlWORwCzTqC6PqSVhD+Kj6cvXJ9A4uKq8KwYXiUhlj /TTg3Esiw= Received: from localhost.localdomain (unknown [113.140.17.238]) by smtp14 (Coremail) with SMTP id EsCowAAn5EXvRtRaPtkLFg--.12687S3; Mon, 16 Apr 2018 14:47:12 +0800 (CST) From: sxauwsk To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, wangshikai@inno-instrument.cn, sxauwsk , guojian Subject: [PATCH] [PATCH v1] spi: cadence: Add usleep_range() for cdns_spi_fill_tx_fifo() Date: Mon, 16 Apr 2018 14:46:40 +0800 Message-Id: <1523861200-34130-1-git-send-email-sxauwsk@163.com> X-Mailer: git-send-email 1.7.9.5 X-CM-TRANSID: EsCowAAn5EXvRtRaPtkLFg--.12687S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrKF43Xw1DZw4DtryUAFWfAFb_yoWkKrbEvF 18Aw1DGw45KF9rA3W29FsxAFWv9an5Cr1kuFWqqa9xJw47Z3Z2vr95Zr1DuwsxCa1UWF9x ZrnYkayUArnxKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRRJ3ktUUUUU== X-Originating-IP: [113.140.17.238] X-CM-SenderInfo: 5v0d34lvn6il2tof0z/1tbiQBAqJlSIVnL2AAAAsS 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 Signed-off-by: guojian Signed-off-by: wangshikai --- drivers/spi/spi-cadence.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index 66ae055..9694042 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -315,9 +315,11 @@ static void cdns_spi_fill_tx_fifo(struct cdns_spi *xspi) (xspi->tx_bytes > 0)) { /* When xspi in busy condition, bytes may send failed, - * caused communication failure so add one byte delay + * then spi control did't work thoroughly, add one byte delay */ - usleep_range(10, 20); + if (cdns_spi_read(xspi, CDNS_SPI_ISR_OFFSET) & + CDNS_SPI_IXR_TXFULL_MASK) + usleep_range(10, 20); if (xspi->txbuf) cdns_spi_write(xspi, CDNS_SPI_TXD, *xspi->txbuf++); -- 1.7.9.5