aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/spi/davinci_spi.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index 1169e8e7462e..ad814f2512f0 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -142,7 +142,6 @@ struct davinci_spi {
142 const void *tx; 142 const void *tx;
143 void *rx; 143 void *rx;
144 u8 *tmp_buf; 144 u8 *tmp_buf;
145 int count;
146 struct davinci_spi_dma *dma_channels; 145 struct davinci_spi_dma *dma_channels;
147 struct davinci_spi_platform_data *pdata; 146 struct davinci_spi_platform_data *pdata;
148 147
@@ -630,8 +629,6 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
630 629
631 /* convert len to words based on bits_per_word */ 630 /* convert len to words based on bits_per_word */
632 conv = davinci_spi->bytes_per_word[spi->chip_select]; 631 conv = davinci_spi->bytes_per_word[spi->chip_select];
633 davinci_spi->count = t->len / conv;
634
635 data1_reg_val = ioread32(davinci_spi->base + SPIDAT1); 632 data1_reg_val = ioread32(davinci_spi->base + SPIDAT1);
636 633
637 INIT_COMPLETION(davinci_spi->done); 634 INIT_COMPLETION(davinci_spi->done);
@@ -643,7 +640,7 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
643 /* Enable SPI */ 640 /* Enable SPI */
644 set_io_bits(davinci_spi->base + SPIGCR1, SPIGCR1_SPIENA_MASK); 641 set_io_bits(davinci_spi->base + SPIGCR1, SPIGCR1_SPIENA_MASK);
645 642
646 count = davinci_spi->count; 643 count = t->len / conv;
647 644
648 /* Determine the command to execute READ or WRITE */ 645 /* Determine the command to execute READ or WRITE */
649 if (t->tx_buf) { 646 if (t->tx_buf) {
@@ -699,7 +696,7 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
699 } else { /* Receive in Interrupt mode */ 696 } else { /* Receive in Interrupt mode */
700 int i; 697 int i;
701 698
702 for (i = 0; i < davinci_spi->count; i++) { 699 for (i = 0; i < count; i++) {
703 set_io_bits(davinci_spi->base + SPIINT, 700 set_io_bits(davinci_spi->base + SPIINT,
704 SPIINT_BITERR_INTR 701 SPIINT_BITERR_INTR
705 | SPIINT_OVRRUN_INTR 702 | SPIINT_OVRRUN_INTR
@@ -754,7 +751,6 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
754 751
755 /* convert len to words based on bits_per_word */ 752 /* convert len to words based on bits_per_word */
756 data_type = davinci_spi->bytes_per_word[spi->chip_select]; 753 data_type = davinci_spi->bytes_per_word[spi->chip_select];
757 davinci_spi->count = t->len / data_type;
758 754
759 data1_reg_val = ioread32(davinci_spi->base + SPIDAT1); 755 data1_reg_val = ioread32(davinci_spi->base + SPIDAT1);
760 756
@@ -767,7 +763,7 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
767 if (ret) 763 if (ret)
768 return ret; 764 return ret;
769 765
770 count = davinci_spi->count; /* the number of elements */ 766 count = t->len / data_type; /* the number of elements */
771 767
772 /* disable all interrupts for dma transfers */ 768 /* disable all interrupts for dma transfers */
773 clear_io_bits(davinci_spi->base + SPIINT, SPIINT_MASKALL); 769 clear_io_bits(davinci_spi->base + SPIINT, SPIINT_MASKALL);