From patchwork Mon Nov 21 05:54:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanchayan X-Patchwork-Id: 9438793 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 BDD9A600BA for ; Mon, 21 Nov 2016 06:05:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B015D2898B for ; Mon, 21 Nov 2016 06:05:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4B402898E; Mon, 21 Nov 2016 06:05:12 +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 21DC32898B for ; Mon, 21 Nov 2016 06:05:12 +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 1c8hhi-0006L8-Mm; Mon, 21 Nov 2016 06:03:46 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c8hhR-00069x-9h for linux-arm-kernel@lists.infradead.org; Mon, 21 Nov 2016 06:03:30 +0000 Received: by mail-pg0-x241.google.com with SMTP id 3so27577158pgd.0 for ; Sun, 20 Nov 2016 22:03:11 -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=mh0ZJcnWFtL2r5nylH1KP3RJTNHNZ+1/E1yzVZGVYy8=; b=qq/Bit0PrNR3DC5DKptTj5r8nSjwg3/jXk6K6EEaKIjPU+6H4Fs34Gtbl0qvAFwqQz MSgB8hucn0W9nEM8zdS3Kli/NUBAnSz6gBzzNvrVYYWIdpenZpcOlKy3KRBf6vaVg07c 3IfOwCvCTqDw/YxhbWDwXo1WSSa0hkheaAy6bZau1GgaVoRJ4znq6h3bDP6pJoUrG9Ce VbsSnwO2823Z0CFCi7iL+VILVJ/vbak2cegYKaD2eZoDcsZwHA6Ak/C5eSAiSN+YLMhC MO2lTf0xzeexMJIFef+3msJlI9tWE4OtYFaB/yFD1dg27nLW9g4yiSai0EZpVmuJUXGu Q4qw== 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=mh0ZJcnWFtL2r5nylH1KP3RJTNHNZ+1/E1yzVZGVYy8=; b=Os7XzDG0V7ggA0zTbYsUOGbR+gXhfxJ0RpxCJ89XaVMd7zILIq52akR5ezYYtTrZZQ 5JdrsI4/aWy/9rh5DiHP4Xz9/VacxmgQmXzAr+O5D5N6lXROFKU8i23i3Qalm4vQSg3I 1PMeQlTPux/6B1CMEiC34/CNrxfCbU7GBPo0PxXxFdlhOgA8wgJQJ24WEVxxdi1VVbSh 8upDQKHTz+yxXoVkh00MLKVgmrifFmpS1v9T9hBay0/MG/c5vSUgEpl+xFEy3t6PbEZg yBzASOMgoIJn+63zbUzAlNlVEoMw1MJ4Qq5X1Ol0lDA7JW5fCwfbj+cuOuAvKx8k9ivy CUcQ== X-Gm-Message-State: AKaTC02S8garXDqfnDrnrTHQiNv8FbVd0b0TYqJW4TemSJwe4aabInZkaTXmiAhtHTv6mA== X-Received: by 10.99.116.92 with SMTP id e28mr28178203pgn.162.1479708190627; Sun, 20 Nov 2016 22:03:10 -0800 (PST) Received: from localhost ([115.115.243.34]) by smtp.gmail.com with ESMTPSA id b80sm34036470pfe.52.2016.11.20.22.03.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Nov 2016 22:03:10 -0800 (PST) From: Sanchayan Maity To: broonie@kernel.org Subject: [PATCH v2 1/4] spi: spi-fsl-dspi: Fix SPI transfer issue when using multiple SPI_IOC_MESSAGE Date: Mon, 21 Nov 2016 11:24:01 +0530 Message-Id: X-Mailer: git-send-email 2.10.2 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161120_220329_421298_54BC968D X-CRM114-Status: GOOD ( 11.75 ) 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);