Skip to content

Commit

Permalink
spi/omap2_mcspi: Use transaction speed if provided
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Scott Ellis authored and Grant Likely committed Mar 10, 2010
1 parent 5e77494 commit 9bd4517
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/spi/omap2_mcspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
struct spi_master *spi_cntrl;
u32 l = 0, div = 0;
u8 word_len = spi->bits_per_word;
u32 speed_hz = spi->max_speed_hz;

mcspi = spi_master_get_devdata(spi->master);
spi_cntrl = mcspi->master;
Expand All @@ -587,9 +588,12 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,

cs->word_len = word_len;

if (spi->max_speed_hz) {
if (t && t->speed_hz)
speed_hz = t->speed_hz;

if (speed_hz) {
while (div <= 15 && (OMAP2_MCSPI_MAX_FREQ / (1 << div))
> spi->max_speed_hz)
> speed_hz)
div++;
} else
div = 15;
Expand Down

0 comments on commit 9bd4517

Please sign in to comment.