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: 9435077 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 CAD626047D for ; Thu, 17 Nov 2016 18:22:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC75629671 for ; Thu, 17 Nov 2016 18:22:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF58A29689; Thu, 17 Nov 2016 18:22:10 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A60729671 for ; Thu, 17 Nov 2016 18:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753119AbcKQSWJ (ORCPT ); Thu, 17 Nov 2016 13:22:09 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35232 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752960AbcKQSWI (ORCPT ); Thu, 17 Nov 2016 13:22:08 -0500 Received: by mail-pg0-f68.google.com with SMTP id p66so18208250pga.2; Thu, 17 Nov 2016 10:22:08 -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=ZgRuVYFOZDd9ASn+zLNHHNq0aW5kQheTOrn8HQ2dKH1xSsYlMu3q/wRKYsXnPw3sjY 5dCk2GboHV04he6VBthr75OJskQIy5MtcaS8uQYkCSoiA+aXnR4GJ8oLCDpJKrhqrMIw bSa+HuOPNGRUcOCGedYtejw+fdFwxrFYF4+gU5fv8x5CpjJ9q8F7MtvGCG3U+MzvDnvl qOOGepBMoyd9TQB0ubdqoG5UuU1R3zadVmm9luH6q4DlkWT8FMZ6RlextjjvsQoColIH mOkglwSpICCBg6FI/qto0joQYJVJJRXjQ98RRyjr2AUmF2nI51XWm0vrVbmyOEysVkuj YRjQ== X-Gm-Message-State: ABUngvfFK7pMhTLy2/uhQJZLOWs+n5l3lY+hrdftYoR+thlTfvSnfFyEnbI4rjw3qhcWqA== 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 Cc: stefan@agner.ch, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Sanchayan Maity 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: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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);