diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi_mpc83xx.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c index 6832da6f7109..070c6219e2d6 100644 --- a/drivers/spi/spi_mpc83xx.c +++ b/drivers/spi/spi_mpc83xx.c | |||
@@ -266,21 +266,24 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
266 | 266 | ||
267 | cs->hw_mode |= SPMODE_LEN(bits_per_word); | 267 | cs->hw_mode |= SPMODE_LEN(bits_per_word); |
268 | 268 | ||
269 | if ((mpc83xx_spi->spibrg / hz) >= 64) { | 269 | if ((mpc83xx_spi->spibrg / hz) > 64) { |
270 | pm = mpc83xx_spi->spibrg / (hz * 64) - 1; | 270 | pm = mpc83xx_spi->spibrg / (hz * 64); |
271 | if (pm > 0x0f) { | 271 | if (pm > 16) { |
272 | dev_err(&spi->dev, "Requested speed is too " | 272 | cs->hw_mode |= SPMODE_DIV16; |
273 | "low: %d Hz. Will use %d Hz instead.\n", | 273 | pm /= 16; |
274 | hz, mpc83xx_spi->spibrg / 1024); | 274 | if (pm > 16) { |
275 | pm = 0x0f; | 275 | dev_err(&spi->dev, "Requested speed is too " |
276 | "low: %d Hz. Will use %d Hz instead.\n", | ||
277 | hz, mpc83xx_spi->spibrg / 1024); | ||
278 | pm = 16; | ||
279 | } | ||
276 | } | 280 | } |
277 | cs->hw_mode |= SPMODE_PM(pm) | SPMODE_DIV16; | 281 | } else |
278 | } else { | ||
279 | pm = mpc83xx_spi->spibrg / (hz * 4); | 282 | pm = mpc83xx_spi->spibrg / (hz * 4); |
280 | if (pm) | 283 | if (pm) |
281 | pm--; | 284 | pm--; |
282 | cs->hw_mode |= SPMODE_PM(pm); | 285 | |
283 | } | 286 | cs->hw_mode |= SPMODE_PM(pm); |
284 | regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); | 287 | regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); |
285 | if (cs->hw_mode != regval) { | 288 | if (cs->hw_mode != regval) { |
286 | unsigned long flags; | 289 | unsigned long flags; |