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: 9435081 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 2B4816047D for ; Thu, 17 Nov 2016 18:28:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF676284AA for ; Thu, 17 Nov 2016 18:28:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2F9D28505; Thu, 17 Nov 2016 18:28:23 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 78E5D284AA for ; Thu, 17 Nov 2016 18:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754597AbcKQS2W (ORCPT ); Thu, 17 Nov 2016 13:28:22 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:32840 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbcKQS2V (ORCPT ); Thu, 17 Nov 2016 13:28:21 -0500 Received: by mail-pg0-f65.google.com with SMTP id 3so18219158pgd.0; Thu, 17 Nov 2016 10:28:21 -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=bCQ6RJBhCVTbz0rFJzfwNhyA28Pmta8zO83GuMNMVoIGXpWqIxyFQiXxuIsw2jPoFA ZsRBfEKCeplGpSlCJYNkb2oKb0Wt4QSI+FKOU03TB6yoemkAERYyEwRzPNVRbLE1b4C4 f5HV9bjZrbfjkMDujQociHrDOze9YIhYratTfhLKmAavqHsVQynqufGHPnJSrEYfCBf0 5iirqHeUYMO31izCK2HhJaMPUn7RjgpF2jBdAejXGLpG0RPKlch34+xaS13lhvMUvv5f P3deLcqg7SO1urRZKK5VtZEnqrRmbb5oOnavtUdJ3kySxZ3455C0lEhbfIHPAA9+RwRB 0jwA== X-Gm-Message-State: ABUngvcV7699EtL6iCiumjqQt0D6smRfy1EHnUAHKsHJZXxqL9VO5/5D210AdCkI/w5N5w== 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 Cc: stefan@agner.ch, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Sanchayan Maity 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: 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 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,