diff mbox

[v7,10/14] spi/spi-atmel: correct 16 bits transfers with DMA

Message ID 1363679341-4087-1-git-send-email-wenyou.yang@atmel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wenyou Yang March 19, 2013, 7:49 a.m. UTC
From: Richard Genoud <richard.genoud@gmail.com>

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
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 <wenyou.yang@atmel.com>
---
 drivers/spi/spi-atmel.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

Mark Brown April 1, 2013, 1:53 p.m. UTC | #1
On Tue, Mar 19, 2013 at 03:49:01PM +0800, Wenyou Yang wrote:
> From: Richard Genoud <richard.genoud@gmail.com>
> 
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> 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 <wenyou.yang@atmel.com>

Shouldn't this be squashed into the dmaengine patch?
Wenyou Yang April 2, 2013, 5:46 a.m. UTC | #2
Hi, Mark,

> -----Original Message-----

> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]

> Sent: 2013?4?1? 21:54

> To: Yang, Wenyou

> Cc: linux-arm-kernel@lists.infradead.org; grant.likely@secretlab.ca;

> richard.genoud@gmail.com; plagnioj@jcrosoft.com; Ferre, Nicolas; Lin, JM;

> spi-devel-general@lists.sourceforge.net; linux-kernel@vger.kernel.org

> Subject: Re: [PATCH v7 10/14] spi/spi-atmel: correct 16 bits transfers with DMA

> 

> On Tue, Mar 19, 2013 at 03:49:01PM +0800, Wenyou Yang wrote:

> > From: Richard Genoud <richard.genoud@gmail.com>

> >

> > Signed-off-by: Richard Genoud <richard.genoud@gmail.com>

> > 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 <wenyou.yang@atmel.com>

> 

> Shouldn't this be squashed into the dmaengine patch?

OK, I will squash it into the dmaengine patch

Best Regards,
Wenyou Yang
diff mbox

Patch

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 3aa3809..e6539b7 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,