From patchwork Thu Nov 17 12:16:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanchayan X-Patchwork-Id: 9434193 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 DDA816047D for ; Thu, 17 Nov 2016 12:29:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE8C529407 for ; Thu, 17 Nov 2016 12:29:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2A092947A; Thu, 17 Nov 2016 12:29:00 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 39EB129407 for ; Thu, 17 Nov 2016 12:29:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c7Llp-0002Tu-Ib; Thu, 17 Nov 2016 12:26:25 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c7LlZ-0002MQ-0F for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2016 12:26:10 +0000 Received: by mail-pg0-x243.google.com with SMTP id e9so17176162pgc.1 for ; Thu, 17 Nov 2016 04:25:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=nwG4WsKxnQZgGtWvt8rYOLu1Y7DnXfbSe3s7C56h0FY=; b=LKr+P8OYY94CiyM7JxoHrLfgRINZWnAmYKE9qBj4H5O3cutY8uvJkkPzDQ+QUTyBpc eaPgw36uTJtv9FRqVpjXbo3voanBQD1Lrw42mzvWDhCvL43k0WZ/xkCel+XipLN+uZ6B 63uJXoL87R7Y/60jOpObowhCmRUyDKgEMCWeSYBianlu4MNs3eA4tu31zI223kfga4q/ PichUruyQ9cmIC2qlNLj24GmavQaVj51TdHKPCeJCotMKJXOleO9DDnTgOft1ssK9Tzs tzrv50H6t9F/mnBCuQlu4HvoOIZxlWwJuo8+Xyf01kLJivNfVMxNMMz5f8rvxnFhjroG m/Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=nwG4WsKxnQZgGtWvt8rYOLu1Y7DnXfbSe3s7C56h0FY=; b=mK6RdnUaRaQh8NJeUrN6uDG4fYzsRa5XC8WU2NuhGV4YpbEzetEijD7VskBBMisaQL LSzO89D0CZZWLubecb8U5ySpNJj5HQdXLQNGB/b8PaXXdFWzsMIAPsCjoN8QEH3G6Zzy qOz6bktDluqhIMJlzQ28Ew1dXu65fOQ6NzBqYLE0/1VdgNSSQ/kdcZyP883RuMGoYBAO cc03PtntzTIBmcInLMsSFjbyL+CqTrzLNebATNkKn8bJPDa5HHZ53L4qxyB6l6RT8t+2 RdtNc7IJVsgE84s/oph1nJuqIvXrJVgKkPUbwxM9SF2kJrckUEK7QJCyiWFFLSK9znZC H0cg== X-Gm-Message-State: ABUngvcwHtwL31zHnmBg1dzgS1jA4zTOQhlS+TnWXasoIS5Yz/9WgXi5nyLCjBM8NhEshQ== X-Received: by 10.99.6.134 with SMTP id 128mr7029359pgg.53.1479385551067; Thu, 17 Nov 2016 04:25:51 -0800 (PST) Received: from localhost ([115.115.243.34]) by smtp.gmail.com with ESMTPSA id b12sm4852212pfb.78.2016.11.17.04.25.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Nov 2016 04:25:50 -0800 (PST) From: Sanchayan Maity To: broonie@kernel.org Subject: [PATCH 1/4] spi: spi-fsl-dspi: Fix SPI transfer issue when using multiple SPI_IOC_MESSAGE Date: Thu, 17 Nov 2016 17:46:48 +0530 Message-Id: X-Mailer: git-send-email 2.10.2 In-Reply-To: References: <20161111122036.fubv7b4jc5vkdxhc@sirena.org.uk> In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161117_042609_195950_1A44CCC9 X-CRM114-Status: GOOD ( 12.06 ) 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: Sanchayan Maity , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, stefan@agner.ch, linux-kernel@vger.kernel.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 Current DMA implementation had a bug where the DMA transfer would exit the loop in dspi_transfer_one_message after the completion of a single transfer. This results in a multi message transfer submitted with SPI_IOC_MESSAGE to terminate incorrectly without an error. Signed-off-by: Sanchayan Maity Reviewed-by: Stefan Agner --- drivers/spi/spi-fsl-dspi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index bc64700..b1ee1f5 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -714,7 +714,7 @@ static int dspi_transfer_one_message(struct spi_master *master, SPI_RSER_TFFFE | SPI_RSER_TFFFD | SPI_RSER_RFDFE | SPI_RSER_RFDFD); status = dspi_dma_xfer(dspi); - goto out; + break; default: dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", trans_mode); @@ -722,9 +722,13 @@ static int dspi_transfer_one_message(struct spi_master *master, goto out; } - if (wait_event_interruptible(dspi->waitq, dspi->waitflags)) - dev_err(&dspi->pdev->dev, "wait transfer complete fail!\n"); - dspi->waitflags = 0; + if (trans_mode != DSPI_DMA_MODE) { + if (wait_event_interruptible(dspi->waitq, + dspi->waitflags)) + dev_err(&dspi->pdev->dev, + "wait transfer complete fail!\n"); + dspi->waitflags = 0; + } if (transfer->delay_usecs) udelay(transfer->delay_usecs);