diff options
Diffstat (limited to 'drivers/spi/spi_mpc83xx.c')
-rw-r--r-- | drivers/spi/spi_mpc83xx.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c index 070c6219e2d6..ac0e3e4b3c54 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); |
@@ -315,11 +312,20 @@ static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
315 | if (t->bits_per_word) | 312 | if (t->bits_per_word) |
316 | bits_per_word = t->bits_per_word; | 313 | bits_per_word = t->bits_per_word; |
317 | len = t->len; | 314 | len = t->len; |
318 | if (bits_per_word > 8) | 315 | if (bits_per_word > 8) { |
316 | /* invalid length? */ | ||
317 | if (len & 1) | ||
318 | return -EINVAL; | ||
319 | len /= 2; | 319 | len /= 2; |
320 | if (bits_per_word > 16) | 320 | } |
321 | if (bits_per_word > 16) { | ||
322 | /* invalid length? */ | ||
323 | if (len & 1) | ||
324 | return -EINVAL; | ||
321 | len /= 2; | 325 | len /= 2; |
326 | } | ||
322 | mpc83xx_spi->count = len; | 327 | mpc83xx_spi->count = len; |
328 | |||
323 | INIT_COMPLETION(mpc83xx_spi->done); | 329 | INIT_COMPLETION(mpc83xx_spi->done); |
324 | 330 | ||
325 | /* enable rx ints */ | 331 | /* enable rx ints */ |