Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D9E2C4338F for ; Tue, 27 Jul 2021 13:21:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 529FE61A0B for ; Tue, 27 Jul 2021 13:21:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 529FE61A0B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/2XAyh3o7UcekJUKzXWYp2B4tC2KVVauoGiqMYAtkBI=; b=EgR1/frWPRg0dy txuvKqkbFDmfhvMR1eBjGOHyFNUBV06vHbTOjP8+cKxMqa26XIFDaRt7TEmcIKc6ZoXrSz1Yr2hcH oXsAy/ZX9BtBwsQ9X18LlR4DTVK2VjHiy+uq7Vmdz1s9vk1w7SHQ83eA1upc46YWIcmfNvDbPH54s M47AmmKGndaV6mCHdEgiXEtS6x44J3PUYD6m6+4D/xY8G0C2pdsNQDJHpXs1cX0KKWbPU8WqauPZg pQEA0OhDzFq8/2+NQjJl071fxcmz6BXxKVMMRn9grYQ652i7Ptnd7ab73QrRH/dDjJDoeHvLWWjTy STFdTBevZ3X09r9BSUpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8N0I-00Er5s-I3; Tue, 27 Jul 2021 13:20:15 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8Mzn-00EqsV-9E for linux-arm-kernel@lists.infradead.org; Tue, 27 Jul 2021 13:19:44 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0D58261ABD; Tue, 27 Jul 2021 13:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627391983; bh=V+7xNq7+gPU2NOZVEY9BOCfMq/nNLrnWILtJ9O8Ro7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QLB+7+IVp+74oXCir3IEK/nSwTXzj2dMkbuNN1bldTkQw3kyCZHqC41ogIxKnKEAy 3kctVRM+JlYNTjYbGmlHNVL2/cHFYRJOojSOOmVI3+Oho5bZdat6kzKUDyfnZesfDy sUCvgOWrhPCIaitJyqAPB2M90KyP0PaCRAfU/CWy2nJFw3VocnOlTxjpEjOUw5avp9 UF+1AF3Tcwtg7qdMGNn4GkNvxfcvZGCSHEy1NTa14+adqqUkXc14rneYCjeOy7Pkcj Cg+oUJyD8Q+NNQVMRr9DDHFtK1YSew9+5n9nCo1dGvQR2HCGENeK0eR8pzW341fYui FA7hRI3bLnIvg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alain Volmat , Amelie Delaunay , Mark Brown , Sasha Levin , 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 Message-Id: <20210727131938.834920-3-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210727131938.834920-1-sashal@kernel.org> References: <20210727131938.834920-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210727_061943_388629_C0294BA3 X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Alain Volmat [ 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 Signed-off-by: Alain Volmat Reviewed-by: Amelie Delaunay Link: https://lore.kernel.org/r/1625042723-661-3-git-send-email-alain.volmat@foss.st.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel