From patchwork Thu Mar 7 03:33:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 2229881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 7F845DF223 for ; Thu, 7 Mar 2013 03:45:09 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UDReY-0007xI-3z; Thu, 07 Mar 2013 03:37:59 +0000 Received: from nasmtp01.atmel.com ([192.199.1.246] helo=DVREDG02.corp.atmel.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UDRd2-0007IQ-7D for linux-arm-kernel@lists.infradead.org; Thu, 07 Mar 2013 03:36:27 +0000 Received: from apsmtp01.atmel.com (10.168.254.31) by DVREDG02.corp.atmel.com (10.42.103.31) with Microsoft SMTP Server (TLS) id 14.2.318.1; Wed, 6 Mar 2013 20:36:23 -0700 Received: from shaarm01.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.2.318.1; Thu, 7 Mar 2013 11:36:04 +0800 From: Wenyou Yang To: Subject: [PATCH v6 11/16] spi/spi-atmel: correct 16 bits transfers with DMA Date: Thu, 7 Mar 2013 11:33:29 +0800 Message-ID: <1362627210-8209-1-git-send-email-wenyou.yang@atmel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1362626715-6549-1-git-send-email-wenyou.yang@atmel.com> References: <1362626715-6549-1-git-send-email-wenyou.yang@atmel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130306_223626_351314_1BF2A63C X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: richard.genoud@gmail.com, JM.Lin@atmel.com, nicolas.ferre@atmel.com, linux-kernel@vger.kernel.org, wenyou.yang@atmel.com, grant.likely@secretlab.ca, spi-devel-general@lists.sourceforge.net, plagnioj@jcrosoft.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Richard Genoud Signed-off-by: Richard Genoud Cc: spi-devel-general@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org [wenyou.yang@atmel.com: submit the patch] Signed-off-by: Wenyou Yang --- drivers/spi/spi-atmel.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index d287889..1e212d1 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -388,12 +388,18 @@ static inline int atmel_spi_xfer_can_be_chained(struct spi_transfer *xfer) } static int atmel_spi_dma_slave_config(struct atmel_spi *as, - struct dma_slave_config *slave_config) + struct dma_slave_config *slave_config, + u8 bits_per_word) { int err = 0; - slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; - slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; + if (bits_per_word > 8) { + slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; + slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; + } else { + slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; + slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; + } slave_config->dst_addr = (dma_addr_t)as->phybase + SPI_TDR; slave_config->src_addr = (dma_addr_t)as->phybase + SPI_RDR; @@ -454,7 +460,7 @@ static int atmel_spi_configure_dma(struct atmel_spi *as) goto error; } - err = atmel_spi_dma_slave_config(as, &slave_config); + err = atmel_spi_dma_slave_config(as, &slave_config, 8); if (err) goto error; @@ -588,10 +594,9 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, *plen = len; - if (atmel_spi_dma_slave_config(as, &slave_config)) + if (atmel_spi_dma_slave_config(as, &slave_config, 8)) goto err_exit; - /* Send both scatterlists */ rxdesc = rxchan->device->device_prep_slave_sg(rxchan, &as->dma.sgrx,