Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp115219ybg; Mon, 8 Jun 2020 18:02:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiHTXbm4DT0i/iXD6jwOdb6pxm+mXlNBzwMRJ59f58FOggHEJ3EoaV8X4PSO5NAnrlhOW6 X-Received: by 2002:a17:906:5e06:: with SMTP id n6mr22360579eju.504.1591664541834; Mon, 08 Jun 2020 18:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664541; cv=none; d=google.com; s=arc-20160816; b=U/xvDCb3R5jdl5jEdq5uhx3NnO4CLbeBsPJe+FlIasZJaXw7LLxV561Nd0OuKeTNIc FCZoy0WXcO7Aa3o83UDTdbJbgLB2zMH3WzCnTrFNBUMCZZOCXB3/bLDrpDsjrnl3xu+k bD9VWTPwMM7+1IN3JU3ubw3J0xhQgIvoTorzQGxJhiBth84SCO/1sIkDqQ7TLHl37Klg 0dQNxyCIzuYvyklgqfVEDK0+v2jNKUB914FRhfvMkauPwopw9wf/wRDzyTV1plLy8BkB TsfEwEbfdWGnwf2p1JfJrSJcEu015c/scb0mxgFfjcvbDkNuf6/YNlcOZtLJXYZaZYGr 2f5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DeciFu2oZ7bkYORkqDjNHfjkJIHHsgpuwEpwAq3Nk64=; b=WDrM48Z5aHrzNzUleMo+WSnNE+tWceXP5FD2buzlJ+XRx3Gp2pt0+C4KugyiSnzV4m +Ln4hAqUPk66brTaewf0fzzDJFPRDpaPv4PLuJUaoSNV4hY4Jp6nSFHiKsJ7ulvYYmM5 6WJN88xBnXenTVEhDcIZVTTehw/D+1lmFqqbQQIeSi80NHQbvpWfnhpbLD+o969fVuKm z4JG7VbGI4XELhnf4gaCUGQlzsjaH/+dEpyL+FhBA7m5y08emFVKyzPJZrq/Za8lnm9S UXJ3YOTrjiFjsSz/rRquDfuuX2p1wv1LvMD77dxhC71QK/LSrgmgP/zBL2TgifKfPLlA yayQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="oUnAVq/M"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n7si9988709edt.65.2020.06.08.18.01.58; Mon, 08 Jun 2020 18:02:21 -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=@kernel.org header.s=default header.b="oUnAVq/M"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728146AbgFHXIU (ORCPT + 99 others); Mon, 8 Jun 2020 19:08:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:51676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727903AbgFHXH2 (ORCPT ); Mon, 8 Jun 2020 19:07:28 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FFCB20872; Mon, 8 Jun 2020 23:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657647; bh=GwEbOMu8/8JRIBBYzWPx5EysyBB4jEBoWyltDTe3v+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUnAVq/M1u/jUhL8Lwy4M2r5AstnD44z/Sit1/q3/B5qnDvqqti9HnVUOrwGw8Tj5 gw2o9PViPv5ZXH2hQhaeBhL5DJqSBylVGvQ7kIlhx+9+FPZrnEMa2edagafVfzKm93 0k8G72AzoO2FUDcvXiaO7B+B+eei1isqLfhYIUS0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Serge Semin , Georgy Vlasov , Ramil Zaripov , Alexey Malahov , Thomas Bogendoerfer , Paul Burton , Ralf Baechle , Arnd Bergmann , Andy Shevchenko , Rob Herring , linux-mips@vger.kernel.org, devicetree@vger.kernel.org, Mark Brown , Sasha Levin , linux-spi@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 062/274] spi: dw: Enable interrupts in accordance with DMA xfer mode Date: Mon, 8 Jun 2020 19:02:35 -0400 Message-Id: <20200608230607.3361041-62-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin [ Upstream commit 43dba9f3f98c2b184a19f856f06fe22817bfd9e0 ] It's pointless to track the Tx overrun interrupts if Rx-only SPI transfer is issued. Similarly there is no need in handling the Rx overrun/underrun interrupts if Tx-only SPI transfer is executed. So lets unmask the interrupts only if corresponding SPI transactions are implied. Co-developed-by: Georgy Vlasov Signed-off-by: Georgy Vlasov Signed-off-by: Serge Semin Cc: Ramil Zaripov Cc: Alexey Malahov Cc: Thomas Bogendoerfer Cc: Paul Burton Cc: Ralf Baechle Cc: Arnd Bergmann Cc: Andy Shevchenko Cc: Rob Herring Cc: linux-mips@vger.kernel.org Cc: devicetree@vger.kernel.org Link: https://lore.kernel.org/r/20200522000806.7381-3-Sergey.Semin@baikalelectronics.ru Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-dw-mid.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 1058b8a6c8a0..e6c045ecffba 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -220,19 +220,23 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws, static int mid_spi_dma_setup(struct dw_spi *dws, struct spi_transfer *xfer) { - u16 dma_ctrl = 0; + u16 imr = 0, dma_ctrl = 0; dw_writel(dws, DW_SPI_DMARDLR, 0xf); dw_writel(dws, DW_SPI_DMATDLR, 0x10); - if (xfer->tx_buf) + if (xfer->tx_buf) { dma_ctrl |= SPI_DMA_TDMAE; - if (xfer->rx_buf) + imr |= SPI_INT_TXOI; + } + if (xfer->rx_buf) { dma_ctrl |= SPI_DMA_RDMAE; + imr |= SPI_INT_RXUI | SPI_INT_RXOI; + } dw_writel(dws, DW_SPI_DMACR, dma_ctrl); /* Set the interrupt mask */ - spi_umask_intr(dws, SPI_INT_TXOI | SPI_INT_RXUI | SPI_INT_RXOI); + spi_umask_intr(dws, imr); dws->transfer_handler = dma_transfer; -- 2.25.1