From patchwork Wed Jun 8 07:32:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 9163535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9073560467 for ; Wed, 8 Jun 2016 07:35:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 812182838E for ; Wed, 8 Jun 2016 07:35:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75ED928391; Wed, 8 Jun 2016 07:35:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 06AE72838E for ; Wed, 8 Jun 2016 07:35:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAXzj-0006RR-JZ; Wed, 08 Jun 2016 07:33:43 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAXzf-0006KH-8G; Wed, 08 Jun 2016 07:33:40 +0000 Received: by mail-wm0-x242.google.com with SMTP id m124so633798wme.3; Wed, 08 Jun 2016 00:33:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=85eBWMFoG3mD/zP87hftNHYlCl1/SwU36jcBTcYe9C8=; b=o3vjXqZvysc1Agg/lB12YPXxpmBcH5Cy2JtXM8nFE07DRPyM4f6aY30RYTuC78cBlW 1+wcYF2N+pYvj/BeTjvshYZ84W5cpllOgVvOn1FV8uCdb5eXPo5R0/c/DlrH4g5vX5ua Xkw9T9i7W2tcf4pJO8NnH7KYF+QLpjkfS60kuYj+T55SAyNXILPFAhjstFLa1Tqy7U6N ED8tyVRMF4QMiSYx6inJ45cuuoiQSVcNeguB22J78kwpt3MkDwFkgQrixfeT8tgENLY2 bAq8nlsHZNNfUihW5ggno5v/JuHaWXhlyH0yRv7M4gwAJgVCtEwhNStKDM4oP/sYcDxH 2WyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=85eBWMFoG3mD/zP87hftNHYlCl1/SwU36jcBTcYe9C8=; b=Mo6TYdMZuiFoFRJQ2ykIyVz9EOWReEzIi0YJtKY81hpp5hZByRIN5VMHpDa7NofUQi Z5GB3ryoKXS5tUajU1ltF3xG+okqTStl1qfxi2lNC2U4hafz0QZSEb3HThV+AImIpsAa J0j6dmtN710Tx55m/YnmqANJ1ufK192z/BfcJNl3KVPxI1XzmoclkSihiV7gUCZdYtVl mW2DVorTzazHKP8cnl9jS7gFqUbRcSHA33mlTnfDO+ihM4ARy/jceXN2dkdejVReFenJ SOsi2grk+RhvljdhRSdODsVnqdcod/CCfvNXggiVHIRtcuQ9OoX/wyyxQ4ckLyZrYMBE PQow== X-Gm-Message-State: ALyK8tLL9ZwLCav0P0nP5fisTM6wKk7mWi5guzHISfp/atoE31EHzHo/famzgZbxJJwzig== X-Received: by 10.194.175.36 with SMTP id bx4mr2919748wjc.35.1465371196839; Wed, 08 Jun 2016 00:33:16 -0700 (PDT) Received: from cizrna.lan ([109.72.12.252]) by smtp.gmail.com with ESMTPSA id a128sm23253606wme.16.2016.06.08.00.33.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jun 2016 00:33:15 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH] spi: rockchip: Signal unfinished DMA transfers Date: Wed, 8 Jun 2016 09:32:51 +0200 Message-Id: <1465371171-20810-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.5.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160608_003339_560659_7AEC42D4 X-CRM114-Status: GOOD ( 11.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Tomeu Vizoso , linux-rockchip@lists.infradead.org, Shawn Lin , linux-spi@vger.kernel.org, Javier Martinez Canillas , Mark Brown , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When using DMA, the transfer_one callback should return 1 because the transfer hasn't finished yet. A previous commit changed the function to return 0 when the DMA channels were correctly prepared. This manifested in Veyron boards with this message: [ 1.983605] cros-ec-spi spi0.0: EC failed to respond in time Signed-off-by: Tomeu Vizoso Fixes: ea9849113343 ("spi: rockchip: check return value of dmaengine_prep_slave_sg") Cc: Shawn Lin Cc: Heiko Stuebner Cc: Javier Martinez Canillas Tested-by: Heiko Stuebner --- drivers/spi/spi-rockchip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index cd89682065b9..1026e180eed7 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -578,7 +578,7 @@ static int rockchip_spi_transfer_one( struct spi_device *spi, struct spi_transfer *xfer) { - int ret = 1; + int ret = 0; struct rockchip_spi *rs = spi_master_get_devdata(master); WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && @@ -627,6 +627,8 @@ static int rockchip_spi_transfer_one( spi_enable_chip(rs, 1); ret = rockchip_spi_prepare_dma(rs); } + /* successful DMA prepare means the transfer is in progress */ + ret = ret ? ret : 1; } else { spi_enable_chip(rs, 1); ret = rockchip_spi_pio_transfer(rs);