diff options
author | Brian Niebuhr <bniebuhr@efjohnson.com> | 2010-10-01 01:52:23 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2010-11-18 08:08:34 -0500 |
commit | 49fc3f497d7d409e9b0dc384fe7c173bccd3b1a1 (patch) | |
tree | d6e92859da9116265aa007e50f66804264e0ca90 /drivers/spi | |
parent | e91c659bbcf2f47519260182a75f64ede34df3ca (diff) |
spi: davinci: use edma_write_slot() to setup EDMA PaRAM slot
Currently a series of EDMA API calls are being made to setup
various aspects of EDMA PaRAM slots for receive and transmit.
Instead setup the PaRAM using a local structure and write once
to the hardware using edma_write_slot()
Signed-off-by: Brian Niebuhr <bniebuhr@efjohnson.com>
Tested-By: Michael Williamson <michael.williamson@criticallink.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/davinci_spi.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c index 705d0069bce0..67f1e463c1f0 100644 --- a/drivers/spi/davinci_spi.c +++ b/drivers/spi/davinci_spi.c | |||
@@ -725,6 +725,7 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t) | |||
725 | struct davinci_spi_platform_data *pdata; | 725 | struct davinci_spi_platform_data *pdata; |
726 | void *rx_buf; | 726 | void *rx_buf; |
727 | struct device *sdev; | 727 | struct device *sdev; |
728 | struct edmacc_param param; | ||
728 | 729 | ||
729 | davinci_spi = spi_master_get_devdata(spi->master); | 730 | davinci_spi = spi_master_get_devdata(spi->master); |
730 | pdata = davinci_spi->pdata; | 731 | pdata = davinci_spi->pdata; |
@@ -773,14 +774,15 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t) | |||
773 | } | 774 | } |
774 | } | 775 | } |
775 | 776 | ||
776 | edma_set_transfer_params(davinci_spi_dma->dma_tx_channel, | 777 | param.opt = TCINTEN | EDMA_TCC(davinci_spi_dma->dma_tx_channel); |
777 | data_type, count, 1, 0, ASYNC); | 778 | param.src = t->tx_buf ? t->tx_dma : tx_reg; |
778 | edma_set_dest(davinci_spi_dma->dma_tx_channel, tx_reg, INCR, W8BIT); | 779 | param.a_b_cnt = count << 16 | data_type; |
779 | edma_set_src(davinci_spi_dma->dma_tx_channel, | 780 | param.dst = tx_reg; |
780 | t->tx_buf ? t->tx_dma : tx_reg, INCR, W8BIT); | 781 | param.src_dst_bidx = t->tx_buf ? data_type : 0; |
781 | edma_set_src_index(davinci_spi_dma->dma_tx_channel, | 782 | param.link_bcntrld = 0xffff; |
782 | t->tx_buf ? data_type : 0, 0); | 783 | param.src_dst_cidx = 0; |
783 | edma_set_dest_index(davinci_spi_dma->dma_tx_channel, 0, 0); | 784 | param.ccnt = 1; |
785 | edma_write_slot(davinci_spi_dma->dma_tx_channel, ¶m); | ||
784 | 786 | ||
785 | /* | 787 | /* |
786 | * Receive DMA setup | 788 | * Receive DMA setup |
@@ -812,13 +814,15 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t) | |||
812 | return -ENOMEM; | 814 | return -ENOMEM; |
813 | } | 815 | } |
814 | 816 | ||
815 | edma_set_transfer_params(davinci_spi_dma->dma_rx_channel, data_type, | 817 | param.opt = TCINTEN | EDMA_TCC(davinci_spi_dma->dma_rx_channel); |
816 | count, 1, 0, ASYNC); | 818 | param.src = rx_reg; |
817 | edma_set_src(davinci_spi_dma->dma_rx_channel, rx_reg, INCR, W8BIT); | 819 | param.a_b_cnt = count << 16 | data_type; |
818 | edma_set_dest(davinci_spi_dma->dma_rx_channel, t->rx_dma, INCR, W8BIT); | 820 | param.dst = t->rx_dma; |
819 | edma_set_src_index(davinci_spi_dma->dma_rx_channel, 0, 0); | 821 | param.src_dst_bidx = (t->rx_buf ? data_type : 0) << 16; |
820 | edma_set_dest_index(davinci_spi_dma->dma_rx_channel, | 822 | param.link_bcntrld = 0xffff; |
821 | t->rx_buf ? data_type : 0, 0); | 823 | param.src_dst_cidx = 0; |
824 | param.ccnt = 1; | ||
825 | edma_write_slot(davinci_spi_dma->dma_rx_channel, ¶m); | ||
822 | 826 | ||
823 | if (pdata->cshold_bug) { | 827 | if (pdata->cshold_bug) { |
824 | u16 spidat1 = ioread16(davinci_spi->base + SPIDAT1 + 2); | 828 | u16 spidat1 = ioread16(davinci_spi->base + SPIDAT1 + 2); |