Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp787102ybt; Fri, 19 Jun 2020 13:48:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8OCiFnXKWhG8KQMr7PF0J/ovy/sGaVXFxX+pJ/tpYrw7FAE2RoH2lZOIlX26nd7SO1bUS X-Received: by 2002:a17:906:ced0:: with SMTP id si16mr4978287ejb.545.1592599737448; Fri, 19 Jun 2020 13:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592599737; cv=none; d=google.com; s=arc-20160816; b=qRbBb6fh/NI6XA9Af+rtZ9SOThudnC1zJSlKRnKgQVdZWbmtq87yf5VZLBa7OXRWa6 KzadtabCrgC5A2OL68Mz1IAQ4Gf4v9iDDBmam8jCpr8BY390ihQzM1fCKtaQoTasjI9c ewJn0zGPiSbZoC0ATkSto361fSLWnBtoKZFm4QqXtYWlVL1ov4S5kmlSOK1Mp4PumLeK k7JziLhur5WcjLASAQq90AEn3fvvR2ZEtfB6dXRP7nVIrVygIqYh/MBYtEWkh0voO4kl pOrBUL4GL8EXlQE1kunFDuSbAuNXNamJ5c9IqTwMFknGzGZPQG391DXzaPvLlyVLsDw7 i04Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jIAARpFHnm5G0D80KxMeyKSJoempCPNwRgSsHjgSJSA=; b=UM4qpmUjiYysbUStwBQFvkuxhLD647JwGv3fxyMWC7rD9IXxvwJLq/FgCSGJd111AR XKt4SO42bJtE8+zgT60SJRhaRy7dtBYEGOFNwBgtNosSg67dINSDZUpZKWGU9bqdxdrm fg06SeGltLz59ujCTMvBpFM5OO74eRHVsNhD8EFCWqm7LdW/y8hBC8TT8+91h5Mi6Mj2 H1KX+KbkUbTVtojiFW5F2NsU4iNxi6CHDrP09G7IvMaAryLmH2qgsK8LsUzReC19kLNr ZWV3vYJa4Y60ed6dOHZ+drCT7gZJga8LoyFDcwIVYOxlvNuAy1WmwZRvCB4PzMAlqC+Q tq/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f2LVDoNa; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si4633809eds.213.2020.06.19.13.48.35; Fri, 19 Jun 2020 13:48:57 -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=f2LVDoNa; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390732AbgFSPBk (ORCPT + 99 others); Fri, 19 Jun 2020 11:01:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:57378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390671AbgFSPA6 (ORCPT ); Fri, 19 Jun 2020 11:00:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 84DE020734; Fri, 19 Jun 2020 15:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578858; bh=Pg7o7hR6OuF3WqB28s1pOE/hk0d383YdOIRcUIRuGsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2LVDoNa45YBAG9lbXrTibHbHAkGdI/umi2h6DPNOabQa3Lw2QibgDUI5Ptt6uteL 4kbUZ3cqzhtCQ9D/rFeK1b8SOxX61+jDjZkcDDtP0BIk8pyiNxEiwgQsnHH3bGJL7I rZSQdmQTuglTjCzF6/yb6L8yzsUzJ2vvnhHwvteU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, 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 Subject: [PATCH 4.19 182/267] spi: dw: Return any value retrieved from the dma_transfer callback Date: Fri, 19 Jun 2020 16:32:47 +0200 Message-Id: <20200619141657.498868116@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 e1b34ef9a31c..10f328558d55 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c @@ -274,7 +274,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 3fbd6f01fb10..b1c137261d0f 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -383,11 +383,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