Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp56515ybg; Mon, 8 Jun 2020 16:18:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhOSRNbE5G8EDz8fyb5731Si97CSkHd32lApZgwHAed5p9qNOSyKbWmGEroC9sYmflK4iD X-Received: by 2002:a17:906:7083:: with SMTP id b3mr22138731ejk.57.1591658318248; Mon, 08 Jun 2020 16:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658318; cv=none; d=google.com; s=arc-20160816; b=C6+rYyXlMkn9cywVX8z1tQBMjaLEJp/Ty5R7A1rCXOFiopQj0+chHnFT1PSmqLgytQ sRQxb3jxAxCLISwH6iCEd4rf3Jee2i9B6lm65I51qaqYNx2xyL9LNygH0mcjc9EJ5Rwe Yp6I1lI1cIsmvswhwdrBL9/HyMOs96PsaHS310Giy5zwLTkpUeMgH7nnnnEmXyuXC088 sIMeR1PQg5B4g1h8seODXO0baZ8WMMU5ytRz4qMo0VILcxznZ+EKG2YzWF6PUj9nw8sv eoFoxe5jLVEeMF2t0M8hbVxTFIwqJzfdWQEXRQBe5+GL1fY4C99g1UR91UNIJAYv5sPy QAuA== 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=+xiNPClHG0u5aj8lXEIURE/wUaQtD9qqnhfHPLvo6sY=; b=cR34t02CK6Au6PCnUfVVwxYvDd/WbN3XXcMlc12jLnOPYMuZgkNVNztKyZK4BkV8iH 3N6DtoKzf627AzcflKskcnl1Bl6BOAYom/B7h8P4D8Gr0vowZ9J0HS7NbV4Hzcvfn4P8 8l0FfnEjytTJgUVcZlMEpCy3QxMo1kOS/l+bPu/ZIQz5G5Vv1NNxg4ArJjc+HT/c7FCs hyWGSBYKGoMFvNbiZy8kKozbh5S4AURNKmNYVWbnuoSkAQLD2DQFCKs7AnI7nQNliR8Z omt51LDqmZZvQ8R8j6PsM4YnfA41huCOc7MFvbYJo8ytkM80SA6XcJE77Iu7RIXfyWcj usgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q6+yK5xc; 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 dt7si9198039ejb.395.2020.06.08.16.18.15; Mon, 08 Jun 2020 16:18:38 -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=q6+yK5xc; 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 S1728928AbgFHXOR (ORCPT + 99 others); Mon, 8 Jun 2020 19:14:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:58710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728956AbgFHXLn (ORCPT ); Mon, 8 Jun 2020 19:11:43 -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 46390208C7; Mon, 8 Jun 2020 23:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657902; bh=6HOsWHnTqpNN0Ww98s4zhADHwT4C9g+b0ZwlZiz0xY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q6+yK5xcXoToxsmXCxnJ0RYvbO864SOBliytRVPEtlmn+RjiKVCAp6pqzQydEFfdp pOFVoI2sIVECZu+C1suSAC/C3xVXxPLux/To68X1yXnRyrHJCxE0ryhhNBGuZp+HWJ VkkwIiisMKmGrEKZ4RyVGhHlaUXzO6/vR/6fy0Z8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Serge Semin , Georgy Vlasov , Ramil Zaripov , Alexey Malahov , Thomas Bogendoerfer , Arnd Bergmann , Andy Shevchenko , Feng Tang , 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 255/274] spi: dw: Return any value retrieved from the dma_transfer callback Date: Mon, 8 Jun 2020 19:05:48 -0400 Message-Id: <20200608230607.3361041-255-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 f0410bbf7d0fb80149e3b17d11d31f5b5197873e ] DW APB SSI DMA-part of the driver may need to perform the requested SPI-transfer synchronously. In that case the dma_transfer() callback will return 0 as a marker of the SPI transfer being finished so the SPI core doesn't need to wait and may proceed with the SPI message trasnfers pumping procedure. This will be needed to fix the problem when DMA transactions are finished, but there is still data left in the SPI Tx/Rx FIFOs being sent/received. But for now make dma_transfer to return 1 as the normal dw_spi_transfer_one() method. Signed-off-by: Serge Semin Cc: Georgy Vlasov Cc: Ramil Zaripov Cc: Alexey Malahov Cc: Thomas Bogendoerfer Cc: Arnd Bergmann Cc: Andy Shevchenko Cc: Feng Tang Cc: Rob Herring Cc: linux-mips@vger.kernel.org Cc: devicetree@vger.kernel.org Link: https://lore.kernel.org/r/20200529131205.31838-3-Sergey.Semin@baikalelectronics.ru Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-dw-mid.c | 2 +- drivers/spi/spi-dw.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index e6c045ecffba..23cebdeb67e2 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -266,7 +266,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer) dma_async_issue_pending(dws->txchan); } - return 0; + return 1; } static void mid_spi_dma_stop(struct dw_spi *dws) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index e8f275c850ce..594a1ac09d9c 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -373,11 +373,8 @@ static int dw_spi_transfer_one(struct spi_controller *master, spi_enable_chip(dws, 1); - if (dws->dma_mapped) { - ret = dws->dma_ops->dma_transfer(dws, transfer); - if (ret < 0) - return ret; - } + if (dws->dma_mapped) + return dws->dma_ops->dma_transfer(dws, transfer); if (chip->poll_mode) return poll_transfer(dws); -- 2.25.1