Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp485410pxt; Fri, 6 Aug 2021 06:48:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSjE0JfNRsDRGvV5X6cZPAuws5jReRKEM7YuFqzg9JjnAE/Lf8vcblslykmHXskEB2ufOE X-Received: by 2002:a92:9407:: with SMTP id c7mr363944ili.193.1628257730163; Fri, 06 Aug 2021 06:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628257730; cv=none; d=google.com; s=arc-20160816; b=OE5z4r5goTValMgh6m1BIEA+4jnxVHO/Lsxt0KJzCzChL6AE8+LjarMHx2UXxa4SFJ 2p2SOMyRn7R33vHte4oLinmsRAv4nwXdbKB/h1f191vyIc2helDYoeOr9JjSbb282iAa uYqNGj/wfy4ZZ/kxXFjgKWZfvtMF4gFWUU+PMpXFTBZV5HRI3Uf5rFl/Dd0JszsseOhX V/M7v6WfaR+lx05T541IV4lEco+KCZerNOEMbekf8c8yrZflVGilqZEasdar+dut43nj Dha63yzHTKk6vkl7fiw+RLR/fC9VzkVK5UXDeXVxmvj2wSTZN5dHPcKURjZYGvZ0soJD JzrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uOfGoa+QyrS5DRgBq0e6zrvVheM2tpX9bBpBWsZF4I0=; b=Q2NWCx5y2+2KtR1kKM3WnI9Q3VSgYeDJAzfpJup7BZvlBTgebg4M+SWkJNOvugCrjo TmaMP1WgzxkfCQphAXWV2CJUdxw/v18te4QkcMHbqS3c1Tebz7UItx31ocJnmIYZwNRn l8RDDfIVIEcXexXc6TGd53OMLxXX73Pa6Ugxw2lrTlKrlV9TbUMhS2z8S7mYxrcoriGt iuayPMGDDRI+suMDiw0sjcFvm8nZVIEoRyIsGPLD2brYgkX7v3aKImQfFuYt9JQ2Y7P0 ItV/SkglWsTGzA9gXoCB5t3OMofptdyEn8EHOx1BqP04o8K5FMpFsgwrj2/EsthBbDBZ vKNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UNrMYksj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i22si8639215jal.120.2021.08.06.06.48.38; Fri, 06 Aug 2021 06:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UNrMYksj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244385AbhHFIWB (ORCPT + 99 others); Fri, 6 Aug 2021 04:22:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:49122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244199AbhHFIT1 (ORCPT ); Fri, 6 Aug 2021 04:19:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 68EF861212; Fri, 6 Aug 2021 08:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628237947; bh=POxMPzvKDcusGfvE8I213YzTJZQa0kTeHSRyWDZuAW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UNrMYksjKRA789GugQBQarez1W8wciMYedccef7L5BpRTvbj4eO8XQkkJejN2WbgK yYGG0XubwHOIZTJlsbYDL42nHzskofUk8c2bYRnfhTxv++P4PsJSTmaxFMnKPc9T8V mkndQrpas3yeVx1FKPP8PH0fvgKgg26hNGTLuHkE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amelie Delaunay , Alain Volmat , Mark Brown , Sasha Levin Subject: [PATCH 5.10 07/30] spi: stm32h7: fix full duplex irq handler handling Date: Fri, 6 Aug 2021 10:16:45 +0200 Message-Id: <20210806081113.374963345@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806081113.126861800@linuxfoundation.org> References: <20210806081113.126861800@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 8f91f8705eee..a6dfc8fef20c 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