summaryrefslogtreecommitdiffstats
path: root/drivers/spi/davinci_spi.c
diff options
context:
space:
mode:
authorBrian Niebuhr <bniebuhr@efjohnson.com>2010-08-19 12:44:31 +0530
committerSekhar Nori <nsekhar@ti.com>2010-11-18 18:38:26 +0530
commitfd764463fe28ac53371565f851240e74775fb1aa (patch)
tree1a9e23f335559bd40f61f04b787ba20d2e05b2ba /drivers/spi/davinci_spi.c
parent25f33512f6ae7e37d7b3d353d57d4d6d066033ce (diff)
downloadop-kernel-dev-fd764463fe28ac53371565f851240e74775fb1aa.zip
op-kernel-dev-fd764463fe28ac53371565f851240e74775fb1aa.tar.gz
spi: davinci: setup chip-select timers values only if timer enabled
Setup chip-select timers values only if timer is enabled (timer_disbled in spi configuration is false). As a nice side effect, this patch removes code duplicated in davinci_spi_bufs_pio() and davinci_spi_bufs_dma(). 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.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index 34b28fe..d09b63c 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -374,6 +374,10 @@ static int davinci_spi_setup_transfer(struct spi_device *spi,
if (spicfg->timer_disable)
spifmt |= SPIFMT_DISTIMER_MASK;
+ else
+ iowrite32((spicfg->c2tdelay << SPI_C2TDELAY_SHIFT) |
+ (spicfg->t2cdelay << SPI_T2CDELAY_SHIFT),
+ davinci_spi->base + SPIDELAY);
if (spi->mode & SPI_READY)
spifmt |= SPIFMT_WAITENA_MASK;
@@ -607,13 +611,9 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
u32 tx_data, data1_reg_val;
u32 buf_val, flg_val;
struct davinci_spi_platform_data *pdata;
- struct davinci_spi_config *spicfg;
davinci_spi = spi_master_get_devdata(spi->master);
pdata = davinci_spi->pdata;
- spicfg = (struct davinci_spi_config *)spi->controller_data;
- if (!spicfg)
- spicfg = &davinci_spi_default_cfg;
davinci_spi->tx = t->tx_buf;
davinci_spi->rx = t->rx_buf;
@@ -633,10 +633,6 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
/* Enable SPI */
set_io_bits(davinci_spi->base + SPIGCR1, SPIGCR1_SPIENA_MASK);
- iowrite32((spicfg->c2tdelay << SPI_C2TDELAY_SHIFT) |
- (spicfg->t2cdelay << SPI_T2CDELAY_SHIFT),
- davinci_spi->base + SPIDELAY);
-
count = davinci_spi->count;
/* Determine the command to execute READ or WRITE */
@@ -741,14 +737,10 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
struct davinci_spi_dma *davinci_spi_dma;
int word_len, data_type, ret;
unsigned long tx_reg, rx_reg;
- struct davinci_spi_config *spicfg;
struct device *sdev;
davinci_spi = spi_master_get_devdata(spi->master);
sdev = davinci_spi->bitbang.master->dev.parent;
- spicfg = (struct davinci_spi_config *)spi->controller_data;
- if (!spicfg)
- spicfg = &davinci_spi_default_cfg;
davinci_spi_dma = &davinci_spi->dma_channels[spi->chip_select];
@@ -784,11 +776,6 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
if (ret)
return ret;
- /* Put delay val if required */
- iowrite32((spicfg->c2tdelay << SPI_C2TDELAY_SHIFT) |
- (spicfg->t2cdelay << SPI_T2CDELAY_SHIFT),
- davinci_spi->base + SPIDELAY);
-
count = davinci_spi->count; /* the number of elements */
/* disable all interrupts for dma transfers */
OpenPOWER on IntegriCloud