linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Alain Volmat <alain.volmat@foss.st.com>,
	Amelie Delaunay <amelie.delaunay@foss.st.com>,
	Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
	linux-spi@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 5.10 03/17] spi: stm32h7: fix full duplex irq handler handling
Date: Tue, 27 Jul 2021 09:19:24 -0400	[thread overview]
Message-ID: <20210727131938.834920-3-sashal@kernel.org> (raw)
In-Reply-To: <20210727131938.834920-1-sashal@kernel.org>

From: Alain Volmat <alain.volmat@foss.st.com>

[ Upstream commit e4a5c19888a5f8a9390860ca493e643be58c8791 ]

In case of Full-Duplex mode, DXP flag is set when RXP and TXP flags are
set. But to avoid 2 different handlings, just add TXP and RXP flag in
the mask instead of DXP, and then keep the initial handling of TXP and
RXP events.
Also rephrase comment about EOTIE which is one of the interrupt enable
bits. It is not triggered by any event.

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/1625042723-661-3-git-send-email-alain.volmat@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/spi/spi-stm32.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 0318f02d6212..f8ab58003e76 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -917,15 +917,18 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
 	ier = readl_relaxed(spi->base + STM32H7_SPI_IER);
 
 	mask = ier;
-	/* EOTIE is triggered on EOT, SUSP and TXC events. */
+	/*
+	 * EOTIE enables irq from EOT, SUSP and TXC events. We need to set
+	 * SUSP to acknowledge it later. TXC is automatically cleared
+	 */
+
 	mask |= STM32H7_SPI_SR_SUSP;
 	/*
-	 * When TXTF is set, DXPIE and TXPIE are cleared. So in case of
-	 * Full-Duplex, need to poll RXP event to know if there are remaining
-	 * data, before disabling SPI.
+	 * DXPIE is set in Full-Duplex, one IT will be raised if TXP and RXP
+	 * are set. So in case of Full-Duplex, need to poll TXP and RXP event.
 	 */
-	if (spi->rx_buf && !spi->cur_usedma)
-		mask |= STM32H7_SPI_SR_RXP;
+	if ((spi->cur_comm == SPI_FULL_DUPLEX) && !spi->cur_usedma)
+		mask |= STM32H7_SPI_SR_TXP | STM32H7_SPI_SR_RXP;
 
 	if (!(sr & mask)) {
 		dev_warn(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
-- 
2.30.2


  parent reply	other threads:[~2021-07-27 13:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 13:19 [PATCH AUTOSEL 5.10 01/17] regulator: rtmv20: Fix wrong mask for strobe-polarity-high Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 02/17] regulator: rt5033: Fix n_voltages settings for BUCK and LDO Sasha Levin
2021-07-27 13:19 ` Sasha Levin [this message]
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 04/17] ASoC: tlv320aic31xx: fix reversed bclk/wclk master bits Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 05/17] USB: core: Fix incorrect pipe calculation in do_proc_control() Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 06/17] r8152: Fix potential PM refcount imbalance Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 07/17] qed: fix possible unpaired spin_{un}lock_bh in _qed_mcp_cmd_and_union() Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 08/17] ASoC: rt5682: Fix the issue of garbled recording after powerd_dbus_suspend Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 09/17] mt7530 fix mt7530_fdb_write vid missing ivl bit Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 10/17] net: Fix zero-copy head len calculation Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 11/17] ASoC: ti: j721e-evm: Fix unbalanced domain activity tracking during startup Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 12/17] ASoC: ti: j721e-evm: Check for not initialized parent_clk_id Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 13/17] efi/mokvar: Reserve the table only if it is in boot services data Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 14/17] nvme: fix nvme_setup_command metadata trace event Sasha Levin
2021-08-05 12:17   ` Pavel Machek
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 15/17] drm/amd/display: Fix comparison error in dcn21 DML Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 16/17] drm/amd/display: Fix max vstartup calculation for modes with borders Sasha Levin
2021-07-27 13:19 ` [PATCH AUTOSEL 5.10 17/17] ACPI: fix NULL pointer dereference Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210727131938.834920-3-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alain.volmat@foss.st.com \
    --cc=amelie.delaunay@foss.st.com \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).