aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_mpc83xx.c
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2008-09-13 05:33:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-09-13 17:41:51 -0400
commit53604dbe1371c3c4458c2d741adbd8cfd8fe8e79 (patch)
tree93d032d0948f081174401cd755b68ed3c479bc6b /drivers/spi/spi_mpc83xx.c
parentd7a3e4959c28bccc25dd33315809ffcf40f7493e (diff)
spi_mpc83xx: fix clockrate calculation for low speed
Commit a61f5345 (spi_mpc83xx clockrate fixes) broke clockrate calculation for low speeds. SPMODE_DIV16 should be set if the divider is higher than 64, not only if the divider gets clipped to 1024. Furthermore, the clipping check was off by a factor 16 as well. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/spi_mpc83xx.c')
-rw-r--r--drivers/spi/spi_mpc83xx.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 070c6219e2d6..ab7ee445d8b2 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -267,16 +267,13 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
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 cs->hw_mode |= SPMODE_DIV16;
270 pm = mpc83xx_spi->spibrg / (hz * 64); 271 pm = mpc83xx_spi->spibrg / (hz * 64);
271 if (pm > 16) { 272 if (pm > 16) {
272 cs->hw_mode |= SPMODE_DIV16; 273 dev_err(&spi->dev, "Requested speed is too "
273 pm /= 16; 274 "low: %d Hz. Will use %d Hz instead.\n",
274 if (pm > 16) { 275 hz, mpc83xx_spi->spibrg / 1024);
275 dev_err(&spi->dev, "Requested speed is too " 276 pm = 16;
276 "low: %d Hz. Will use %d Hz instead.\n",
277 hz, mpc83xx_spi->spibrg / 1024);
278 pm = 16;
279 }
280 } 277 }
281 } else 278 } else
282 pm = mpc83xx_spi->spibrg / (hz * 4); 279 pm = mpc83xx_spi->spibrg / (hz * 4);