@@ -580,18 +580,24 @@ 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;
- if (t != NULL && t->bits_per_word)
- word_len = t->bits_per_word;
+ if (t != NULL) {
+ if (t->bits_per_word)
+ word_len = t->bits_per_word;
+
+ if (t->speed_hz)
+ speed_hz = t->speed_hz;
+ }
cs->word_len = word_len;
- if (spi->max_speed_hz) {
+ if (speed_hz) {
while (div <= mcspi->max_clk_div &&
- (OMAP2_MCSPI_MAX_FREQ/(1 << div)) > spi->max_speed_hz)
+ (OMAP2_MCSPI_MAX_FREQ/(1 << div)) > speed_hz)
div++;
} else {
div = mcspi->max_clk_div;