Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp750040img; Thu, 21 Mar 2019 08:10:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk0PYbiDHuLo8y+yBivpqUZ3jRncHYtQ2dRiB9tUivOvvITzP+MBEkBmLnc+AwsUpvuPHL X-Received: by 2002:a63:6c87:: with SMTP id h129mr3843047pgc.190.1553181051752; Thu, 21 Mar 2019 08:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553181051; cv=none; d=google.com; s=arc-20160816; b=k85NyXpAfYgq+kWJ17dm9o3dUsoCyPCBHVbhMV08mYNNQbkfR5fu7l2QFv57BoOOIj pk6jUvWMX89I7Mx4SPAmR5dr8N3itQZlLRx6bOjt7cwc1loB019hXOnzy5y/+9j224Nr EWUnMfncw50v8JZLaAlFDFMMNz3ftCVu2XESSMeR1AugiFqxMbTpWyw7PsdcY++ZqTV7 GWsPD9CeJquQB+loP5a2WlxTB0TRhsO2b4jNKbFsdBjbMI6IMnvYQ4374BvfJv4+gI3X gfbSL9EYNNhq3MCOTNQZZmEkUk6lbqGVDXLhwXi5kmMOQF1I5spOKBpUo23jzQ48q1zQ DUKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=bP+myiUSXqoDtPnvNwjkzmV3auDQxhhLrB/U0qIc2HE=; b=ak9TvzUCejPoWgKqjPLiUXwvhSGmBjuwzY3O9oJmKDB8m71sqkScVb7QG4W/8n18N0 11O0+UH8Lqlf9nuVGJS9UjCH5l8in8KP2Uh8gKPbjTVbE7tDvUitPu2Tw5Eo/qSXEpQV uZUETlCXOxhUUrXqTImdrKJj058xoQuqRgQc7VNvhrxQeqzSxIJqFRSzN1pmAMern7AK bt9ycxjJD+3b8LtkJ+wnKneVjQy15T1pys/G9elMe1vWFVG0Jeg2ylSy2OMJoxgI8pz2 Ox/YW4bjqNYssghaTsKCsqpQFzs5pveDjDCXDCqg8u9Kjd+bLNAu42i7egZ6b0XsYvns wmJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=OdMDJGDu; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11si4249409pfh.47.2019.03.21.08.10.35; Thu, 21 Mar 2019 08:10:51 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=OdMDJGDu; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728564AbfCUPHy (ORCPT + 99 others); Thu, 21 Mar 2019 11:07:54 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:48640 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728530AbfCUPHq (ORCPT ); Thu, 21 Mar 2019 11:07:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=bP+myiUSXqoDtPnvNwjkzmV3auDQxhhLrB/U0qIc2HE=; b=OdMDJGDu+d53 XfhDhN0o//1Ag8STDprPZafMpmMFQq+X3mGqBqc+hNrKYLlGRjttCnZWyIF1FKG7L3CayL9pFLank 9nAz8LNUNfFS6s8FWxoJvC8iQIMZWxtb/BeliSNLkJe3bATtc6Q4UQO5aLdJSGZFME6J0BaHfplqf 5TKjc=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1h6zIB-0005dz-1u; Thu, 21 Mar 2019 15:07:39 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 9683711288EC; Thu, 21 Mar 2019 15:07:38 +0000 (GMT) From: Mark Brown To: Clark Wang Cc: Mark Brown , "broonie@kernel.org" , "linux-spi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , linux-spi@vger.kernel.org Subject: Applied "spi: lpspi: fix dataloss when SS is inactivated between every words" to the spi tree In-Reply-To: <20190321095720.14438-1-xiaoning.wang@nxp.com> X-Patchwork-Hint: ignore Message-Id: <20190321150738.9683711288EC@debutante.sirena.org.uk> Date: Thu, 21 Mar 2019 15:07:38 +0000 (GMT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: lpspi: fix dataloss when SS is inactivated between every words has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 69c8a9bcb03222ad3b949064ac05de463c7c9aa3 Mon Sep 17 00:00:00 2001 From: Clark Wang Date: Thu, 21 Mar 2019 09:57:12 +0000 Subject: [PATCH] spi: lpspi: fix dataloss when SS is inactivated between every words If we don't use CONT to keep SS activated or use DMA mode without cs-gpio, SS will be inactivated between every words. The word here means the data sent once which length can be set as 1/2/4 bytes. In the isr function, we read the FSR_RXCOUNT just behind the fsl_lpspi_read_rx_fifo. This causes the value of FSR_RXCOUNT cannot reflect whether there is still data not sent timely. So do this judgement by FSR_TXCOUNT. Signed-off-by: Clark Wang Signed-off-by: Mark Brown --- drivers/spi/spi-fsl-lpspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 391863914043..9e117c4635d8 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -62,7 +62,7 @@ #define CFGR1_PCSPOL BIT(8) #define CFGR1_NOSTALL BIT(3) #define CFGR1_MASTER BIT(0) -#define FSR_RXCOUNT (BIT(16)|BIT(17)|BIT(18)) +#define FSR_TXCOUNT (0xFF) #define RSR_RXEMPTY BIT(1) #define TCR_CPOL BIT(31) #define TCR_CPHA BIT(30) @@ -452,7 +452,7 @@ static irqreturn_t fsl_lpspi_isr(int irq, void *dev_id) } if (temp_SR & SR_MBF || - readl(fsl_lpspi->base + IMX7ULP_FSR) & FSR_RXCOUNT) { + readl(fsl_lpspi->base + IMX7ULP_FSR) & FSR_TXCOUNT) { writel(SR_FCF, fsl_lpspi->base + IMX7ULP_SR); fsl_lpspi_intctrl(fsl_lpspi, IER_FCIE); return IRQ_HANDLED; -- 2.20.1