From patchwork Thu Nov 17 12:16:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanchayan X-Patchwork-Id: 9434199 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 A51006047D for ; Thu, 17 Nov 2016 12:30:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9435629407 for ; Thu, 17 Nov 2016 12:30:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87E692947A; Thu, 17 Nov 2016 12:30:09 +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 278F229407 for ; Thu, 17 Nov 2016 12:30:09 +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 1c7Ln0-00031r-Dg; Thu, 17 Nov 2016 12:27:38 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c7Llj-0002NP-Lq for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2016 12:26:21 +0000 Received: by mail-pg0-x242.google.com with SMTP id p66so17547304pga.2 for ; Thu, 17 Nov 2016 04:25:58 -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=3alHszxoa/aryuQuAHd3Ge3b/QouyIMLTiP40wp9aTA=; b=ML9XMe8py1265zhghaD5/9Rjs2LP54pj/3rECt3EuIVpDNfjY9VumVeI3CJXHLXCn2 XzWbiC4/caM8rJjhqTIdLFGFfbGkbKMsrpmkgezfG/vyFq+WjoPxWbHtvAzPJn48bq7m ogXvqQlh8ABdpGQj6giHwiP9ykY5OoxWG+8gNlx+or8V7nfw2MVkorZr32uhJaO1Bb2Q 3m499YpUa5ucdNP/5UYY5S8D9yIFa1Wxhwkl7h5ej7uvNcC2k///tI6y6oeWpT2SpX8E zXZJ6tgsejItRoNzhcJ604wAbArRUxjEUkB1hZw1vTPeB7EF2o0KUFVnZVKPCNjMjE7o /X8g== 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=3alHszxoa/aryuQuAHd3Ge3b/QouyIMLTiP40wp9aTA=; b=Xl5ueGsAMnYQBSDg6Xq+olDTNJfBpVkbBLsgGfwXp9eS/sN4d/nxuZtFp+hMhbi0t+ 82q70PsLlKfOqe++qp/i36v6m9JaivSuSaftMc++W2UVkPAXdyPwo4oc8/Z8Gi7oI+CO MdfBt4BVkbhO2NqS3uzULAmigPG7RIDLySI9+r4M+F9uJZsQAQu8MvVT+dBoHma/Lykh neJ2NUpmOf5zAGpkIq5M/Q/btZ4QNgoNmebYtuLBQxW+ukdyMMuUcWbTC7GqVvRhmqgb MShySg4r05UZW2QnI11sumEXmKasLktkSdXmgdT0A30SiTuXG2qo8+PXJzVko9lT27ZL zYMg== X-Gm-Message-State: ABUngvf2asnwWwRiY3y6siKfLEA0LrF3c4bDiM8RKhV/g+xRXZhy0DrBh1sfd5kvQkcVPA== X-Received: by 10.98.67.89 with SMTP id q86mr4438572pfa.178.1479385558372; Thu, 17 Nov 2016 04:25:58 -0800 (PST) Received: from localhost ([115.115.243.34]) by smtp.gmail.com with ESMTPSA id q27sm7180568pfd.49.2016.11.17.04.25.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Nov 2016 04:25:57 -0800 (PST) From: Sanchayan Maity To: broonie@kernel.org Subject: [PATCH 3/4] spi: spi-fsl-dspi: Fix continuous selection format Date: Thu, 17 Nov 2016 17:46:50 +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_042619_887142_F1FDB187 X-CRM114-Status: GOOD ( 10.85 ) 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 was not handling the continuous selection format viz. SPI chip select would be deasserted even between sequential serial transfers. Use the cs_change variable and correctly set or reset the CONT bit accordingly for case where peripherals require the chip select to be asserted between sequential transfers. Signed-off-by: Sanchayan Maity --- drivers/spi/spi-fsl-dspi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index aee8c88..164e2e1 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -258,9 +258,16 @@ static int dspi_next_xfer_dma_submit(struct fsl_dspi *dspi) } val = tx_word ? *(u16 *) dspi->tx : *(u8 *) dspi->tx; - dspi->dma->tx_dma_buf[i] = SPI_PUSHR_TXDATA(val) | - SPI_PUSHR_PCS(dspi->cs) | - SPI_PUSHR_CTAS(0); + if (dspi->cs_change) { + dspi->dma->tx_dma_buf[i] = SPI_PUSHR_TXDATA(val) | + SPI_PUSHR_PCS(dspi->cs) | + SPI_PUSHR_CTAS(0); + } else { + dspi->dma->tx_dma_buf[i] = SPI_PUSHR_TXDATA(val) | + SPI_PUSHR_PCS(dspi->cs) | + SPI_PUSHR_CTAS(0) | + SPI_PUSHR_CONT; + } dspi->tx += tx_word + 1; dma->tx_desc = dmaengine_prep_slave_single(dma->chan_tx,