aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorScott Ellis <scott@jumpnowtek.com>2010-03-10 16:23:13 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-03-10 16:23:13 -0500
commit9bd4517ddc51c803784778ab52e6f0bc03b77a52 (patch)
tree971c3b5a412ea3b4791f84deaa195bbfbf6a7422 /drivers/spi
parent5e7749436d576a525d7b2a4bcffb17b3364b9e00 (diff)
spi/omap2_mcspi: Use transaction speed if provided
omap2_mcspi_transfer() gets called in omap2_mcspi_work() when the transaction speed_hz or bits_per_word fields are non-zero. omap2_mcspi_transfer() does not look at the speed_hz field so the override speed value is ignored. The code should probably change to one of these options. 1. Skip the call to omap2_mcsp_transfer() if the only reason was a non-zero speed_hz and it's not going to be used. 2. Use the new speed_hz value provided The patch below uses the speed_hz value. Signed-off-by: Scott Ellis <scott@jumpnowtek.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/omap2_mcspi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index 87d44eeaaa7b..4dd786b99b8b 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -578,6 +578,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
578 struct spi_master *spi_cntrl; 578 struct spi_master *spi_cntrl;
579 u32 l = 0, div = 0; 579 u32 l = 0, div = 0;
580 u8 word_len = spi->bits_per_word; 580 u8 word_len = spi->bits_per_word;
581 u32 speed_hz = spi->max_speed_hz;
581 582
582 mcspi = spi_master_get_devdata(spi->master); 583 mcspi = spi_master_get_devdata(spi->master);
583 spi_cntrl = mcspi->master; 584 spi_cntrl = mcspi->master;
@@ -587,9 +588,12 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
587 588
588 cs->word_len = word_len; 589 cs->word_len = word_len;
589 590
590 if (spi->max_speed_hz) { 591 if (t && t->speed_hz)
592 speed_hz = t->speed_hz;
593
594 if (speed_hz) {
591 while (div <= 15 && (OMAP2_MCSPI_MAX_FREQ / (1 << div)) 595 while (div <= 15 && (OMAP2_MCSPI_MAX_FREQ / (1 << div))
592 > spi->max_speed_hz) 596 > speed_hz)
593 div++; 597 div++;
594 } else 598 } else
595 div = 15; 599 div = 15;