summaryrefslogtreecommitdiff
path: root/drivers/spi/davinci_spi.c
diff options
context:
space:
mode:
authorBrian Niebuhr <bniebuhr@efjohnson.com>2010-08-19 16:42:42 +0530
committerSekhar Nori <nsekhar@ti.com>2010-11-18 18:38:28 +0530
commitb7ab24a0da96c8fc6d551ea87e82692299df6ac6 (patch)
tree4bd08aeeb692fa29873f21803eb4c480dba5c730 /drivers/spi/davinci_spi.c
parent6321be60edac6037ea76e9beef375c6ae2961765 (diff)
spi: davinci: simplify calculation of edma acount value
The EDMA acount (called data_type in davinci_spi_bufs_dma()) is simply the bytes_per_word obtained in the transfer setup function. The current code calculates the acount value from bytes_per_word in a convoluted manner. Simplify the code. 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/davinci_spi.c')
-rw-r--r--drivers/spi/davinci_spi.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index f1c3502c2d01..b0b338fc4466 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -39,9 +39,6 @@
#define CS_DEFAULT 0xFF
#define SPI_BUFSIZ (SMP_CACHE_BYTES + 1)
-#define DAVINCI_DMA_DATA_TYPE_S8 0x01
-#define DAVINCI_DMA_DATA_TYPE_S16 0x02
-#define DAVINCI_DMA_DATA_TYPE_S32 0x04
#define SPIFMT_PHASE_MASK BIT(16)
#define SPIFMT_POLARITY_MASK BIT(17)
@@ -729,19 +726,14 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
return t->len;
}
-#define DAVINCI_DMA_DATA_TYPE_S8 0x01
-#define DAVINCI_DMA_DATA_TYPE_S16 0x02
-#define DAVINCI_DMA_DATA_TYPE_S32 0x04
-
static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
{
struct davinci_spi *davinci_spi;
int int_status = 0;
int count, temp_count;
- u8 conv = 1;
u32 data1_reg_val;
struct davinci_spi_dma *davinci_spi_dma;
- int word_len, data_type, ret;
+ int data_type, ret;
unsigned long tx_reg, rx_reg;
struct device *sdev;
@@ -757,8 +749,8 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
davinci_spi->rx = t->rx_buf;
/* convert len to words based on bits_per_word */
- conv = davinci_spi->bytes_per_word[spi->chip_select];
- davinci_spi->count = t->len / conv;
+ data_type = davinci_spi->bytes_per_word[spi->chip_select];
+ davinci_spi->count = t->len / data_type;
data1_reg_val = ioread32(davinci_spi->base + SPIDAT1);
@@ -767,17 +759,6 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
init_completion(&davinci_spi_dma->dma_rx_completion);
init_completion(&davinci_spi_dma->dma_tx_completion);
- word_len = conv * 8;
-
- if (word_len <= 8)
- data_type = DAVINCI_DMA_DATA_TYPE_S8;
- else if (word_len <= 16)
- data_type = DAVINCI_DMA_DATA_TYPE_S16;
- else if (word_len <= 32)
- data_type = DAVINCI_DMA_DATA_TYPE_S32;
- else
- return -EINVAL;
-
ret = davinci_spi_bufs_prep(spi, davinci_spi);
if (ret)
return ret;