From patchwork Tue Dec 4 07:53:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 1836441 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 43CACDF215 for ; Tue, 4 Dec 2012 07:59:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1TfnPx-00005m-UZ; Tue, 04 Dec 2012 07:59:49 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1TfnPw-00005d-Rf for spi-devel-general@lists.sourceforge.net; Tue, 04 Dec 2012 07:59:48 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of atmel.com designates 204.2.163.5 as permitted sender) client-ip=204.2.163.5; envelope-from=Wenyou.Yang@atmel.com; helo=sjogate2.atmel.com; Received: from newsmtp5.atmel.com ([204.2.163.5] helo=sjogate2.atmel.com) by sog-mx-1.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1TfnPr-0001HL-G7 for spi-devel-general@lists.sourceforge.net; Tue, 04 Dec 2012 07:59:48 +0000 Received: from penbh01.corp.atmel.com ([10.168.5.31]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id qB47s8X4014574; Mon, 3 Dec 2012 23:54:17 -0800 (PST) Received: from penmb01.corp.atmel.com ([10.168.5.33]) by penbh01.corp.atmel.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 4 Dec 2012 15:59:29 +0800 Received: from shaarm01.corp.atmel.com ([10.217.6.34]) by penmb01.corp.atmel.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 4 Dec 2012 15:59:27 +0800 From: Wenyou Yang To: linux-arm-kernel@lists.infradead.org Subject: [v2 PATCH 11/14] spi/atmel_spi: correct 16 bits transfer with DMA Date: Tue, 4 Dec 2012 15:53:57 +0800 Message-Id: <1354607640-13229-12-git-send-email-wenyou.yang@atmel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1354607640-13229-1-git-send-email-wenyou.yang@atmel.com> References: <1354607640-13229-1-git-send-email-wenyou.yang@atmel.com> X-OriginalArrivalTime: 04 Dec 2012 07:59:27.0796 (UTC) FILETIME=[488C4F40:01CDD1F5] X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1TfnPr-0001HL-G7 Cc: richard.genoud@gmail.com, JM.Lin@atmel.com, nicolas.ferre@atmel.com, linux-kernel@vger.kernel.org, wenyou.yang@atmel.com, spi-devel-general@lists.sourceforge.net, plagnioj@jcrosoft.com X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net From: Richard Genoud Signed-off-by: Richard Genoud Cc: grant.likely@secretlab.ca Cc: spi-devel-general@lists.sourceforge.net --- 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 9616fab..61452a5 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -439,12 +439,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; @@ -506,7 +512,7 @@ static int __devinit 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; @@ -641,10 +647,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,