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

Signed-off-by: Richard Genoud <richard.gen...@gmail.com>
Cc: grant.lik...@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 a20cd03..8984563 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -452,12 +452,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;
@@ -519,7 +525,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;
 
@@ -653,10 +659,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,
-- 
1.7.9.5


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to