diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-13 08:32:54 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-13 08:32:54 -0400 |
commit | dc2af52c0d6d00fd530e4a5e300834cdb1bb1c1c (patch) | |
tree | 4573b99fb11e5b93bd011045039b370ddafe45e6 /drivers/spi/spi-bfin-sport.c | |
parent | f1992dde7fef6713a469a5a142b86812b8a47f9e (diff) | |
parent | 36be50515fe2aef61533b516fa2576a2c7fe7664 (diff) |
Merge tag 'v3.4-rc7' into for-3.5
Linux 3.4-rc7
Conflicts):
drivers/base/regmap/regmap.c (overlap with bug fixes)
sound/soc/blackfin/bf5xx-ssm2602.c (overlap with bug fixes)
Diffstat (limited to 'drivers/spi/spi-bfin-sport.c')
-rw-r--r-- | drivers/spi/spi-bfin-sport.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c index 248a2cc671a9..1fe51198a622 100644 --- a/drivers/spi/spi-bfin-sport.c +++ b/drivers/spi/spi-bfin-sport.c | |||
@@ -252,19 +252,15 @@ static void | |||
252 | bfin_sport_spi_restore_state(struct bfin_sport_spi_master_data *drv_data) | 252 | bfin_sport_spi_restore_state(struct bfin_sport_spi_master_data *drv_data) |
253 | { | 253 | { |
254 | struct bfin_sport_spi_slave_data *chip = drv_data->cur_chip; | 254 | struct bfin_sport_spi_slave_data *chip = drv_data->cur_chip; |
255 | unsigned int bits = (drv_data->ops == &bfin_sport_transfer_ops_u8 ? 7 : 15); | ||
256 | 255 | ||
257 | bfin_sport_spi_disable(drv_data); | 256 | bfin_sport_spi_disable(drv_data); |
258 | dev_dbg(drv_data->dev, "restoring spi ctl state\n"); | 257 | dev_dbg(drv_data->dev, "restoring spi ctl state\n"); |
259 | 258 | ||
260 | bfin_write(&drv_data->regs->tcr1, chip->ctl_reg); | 259 | bfin_write(&drv_data->regs->tcr1, chip->ctl_reg); |
261 | bfin_write(&drv_data->regs->tcr2, bits); | ||
262 | bfin_write(&drv_data->regs->tclkdiv, chip->baud); | 260 | bfin_write(&drv_data->regs->tclkdiv, chip->baud); |
263 | bfin_write(&drv_data->regs->tfsdiv, bits); | ||
264 | SSYNC(); | 261 | SSYNC(); |
265 | 262 | ||
266 | bfin_write(&drv_data->regs->rcr1, chip->ctl_reg & ~(ITCLK | ITFS)); | 263 | bfin_write(&drv_data->regs->rcr1, chip->ctl_reg & ~(ITCLK | ITFS)); |
267 | bfin_write(&drv_data->regs->rcr2, bits); | ||
268 | SSYNC(); | 264 | SSYNC(); |
269 | 265 | ||
270 | bfin_sport_spi_cs_active(chip); | 266 | bfin_sport_spi_cs_active(chip); |
@@ -420,11 +416,15 @@ bfin_sport_spi_pump_transfers(unsigned long data) | |||
420 | drv_data->cs_change = transfer->cs_change; | 416 | drv_data->cs_change = transfer->cs_change; |
421 | 417 | ||
422 | /* Bits per word setup */ | 418 | /* Bits per word setup */ |
423 | bits_per_word = transfer->bits_per_word ? : message->spi->bits_per_word; | 419 | bits_per_word = transfer->bits_per_word ? : |
424 | if (bits_per_word == 8) | 420 | message->spi->bits_per_word ? : 8; |
425 | drv_data->ops = &bfin_sport_transfer_ops_u8; | 421 | if (bits_per_word % 16 == 0) |
426 | else | ||
427 | drv_data->ops = &bfin_sport_transfer_ops_u16; | 422 | drv_data->ops = &bfin_sport_transfer_ops_u16; |
423 | else | ||
424 | drv_data->ops = &bfin_sport_transfer_ops_u8; | ||
425 | bfin_write(&drv_data->regs->tcr2, bits_per_word - 1); | ||
426 | bfin_write(&drv_data->regs->tfsdiv, bits_per_word - 1); | ||
427 | bfin_write(&drv_data->regs->rcr2, bits_per_word - 1); | ||
428 | 428 | ||
429 | drv_data->state = RUNNING_STATE; | 429 | drv_data->state = RUNNING_STATE; |
430 | 430 | ||
@@ -598,11 +598,12 @@ bfin_sport_spi_setup(struct spi_device *spi) | |||
598 | } | 598 | } |
599 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; | 599 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; |
600 | chip->idle_tx_val = chip_info->idle_tx_val; | 600 | chip->idle_tx_val = chip_info->idle_tx_val; |
601 | spi->bits_per_word = chip_info->bits_per_word; | ||
602 | } | 601 | } |
603 | } | 602 | } |
604 | 603 | ||
605 | if (spi->bits_per_word != 8 && spi->bits_per_word != 16) { | 604 | if (spi->bits_per_word % 8) { |
605 | dev_err(&spi->dev, "%d bits_per_word is not supported\n", | ||
606 | spi->bits_per_word); | ||
606 | ret = -EINVAL; | 607 | ret = -EINVAL; |
607 | goto error; | 608 | goto error; |
608 | } | 609 | } |