From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5149A182D7; Tue, 27 May 2025 17:17:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748366229; cv=none; b=Uik6I/gNma7d0OiA9wSa2HoIrqpIxj1yIyvBpejz4kAz0Nd+Z0Us2ikJbcFFlf8b3jG4Qb1NPgKtS6SGVGEfDm2c9C0Hpz1neXLtjscceKhBsV0e+1wGwaILKr28w2uwQYpylhzycmwxl0f+oshiYfX/wK/EfocYiQD3b2PkWPU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748366229; c=relaxed/simple; bh=jHC/f4uaG9M3WxwW8EOHmDUrM3ovuVLHyhUqEWHM9ME=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fp4ymCLI2bMTYc9CrbnXTTLWzGLk7MumlwPyWoAj4zadGYEpgUV36wO29CG/CkqPiVg/m7KJXi2ZlKEypVAsjlymeNegHlTRMZq0/VTywZolq/UunsdQVBp9PMNGWIYEncg2vOvBKFfvpmefL4tXMv/tBaV0TSX7DfTsxUdEo7c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pGAiECzW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pGAiECzW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 755A5C4CEE9; Tue, 27 May 2025 17:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748366228; bh=jHC/f4uaG9M3WxwW8EOHmDUrM3ovuVLHyhUqEWHM9ME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pGAiECzWWXU1y+ODYDNrWLpLkyFJJDi6YGhQw4vC7JVzXQCetL+qJpc7WLfh4MM/1 cfSUOfZblPFmYooHpyNbfLZEiKeMjnmNSjoKrPO6qcz5XT44F8FI6xtWbtHjFASXC2 LgMWS35AXHkmE5G1hkGh87D3q4+Bi6rvBKuINPp0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Larisa Grigore , James Clark , Mark Brown , Sasha Levin Subject: [PATCH 6.12 612/626] spi: spi-fsl-dspi: Reset SR flags before sending a new message Date: Tue, 27 May 2025 18:28:25 +0200 Message-ID: <20250527162509.868014044@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527162445.028718347@linuxfoundation.org> References: <20250527162445.028718347@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Larisa Grigore [ Upstream commit 7aba292eb15389073c7f3bd7847e3862dfdf604d ] If, in a previous transfer, the controller sends more data than expected by the DSPI target, SR.RFDF (RX FIFO is not empty) will remain asserted. When flushing the FIFOs at the beginning of a new transfer (writing 1 into MCR.CLR_TXF and MCR.CLR_RXF), SR.RFDF should also be cleared. Otherwise, when running in target mode with DMA, if SR.RFDF remains asserted, the DMA callback will be fired before the controller sends any data. Take this opportunity to reset all Status Register fields. Fixes: 5ce3cc567471 ("spi: spi-fsl-dspi: Provide support for DSPI slave mode operation (Vybryd vf610)") Signed-off-by: Larisa Grigore Signed-off-by: James Clark Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-3-bea884630cfb@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-fsl-dspi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 0466a94ea6b5c..7c43df252328d 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -975,6 +975,8 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); + regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); + spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer, dspi->progress, !dspi->irq); -- 2.39.5