aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-bfin-sport.c
diff options
context:
space:
mode:
authorScott Jiang <scott.jiang.linux@gmail.com>2012-04-23 18:18:09 -0400
committerGrant Likely <grant.likely@secretlab.ca>2012-04-27 14:16:21 -0400
commit488e1a9de27f0a299fc185f0b5c67246a3f0c6c9 (patch)
treea4c3130931148e5d3744e8fbb7b69fc8d924959e /drivers/spi/spi-bfin-sport.c
parent22ac3e82e1d3e5cad92538fe4ab51906cb220444 (diff)
spi/spi-bfin-sport: move word length setup to transfer handler
Each transfer may have its own bits per word. Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-bfin-sport.c')
-rw-r--r--drivers/spi/spi-bfin-sport.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c
index 248a2cc671a9..bfd90474c7e2 100644
--- a/drivers/spi/spi-bfin-sport.c
+++ b/drivers/spi/spi-bfin-sport.c
@@ -252,19 +252,15 @@ static void
252bfin_sport_spi_restore_state(struct bfin_sport_spi_master_data *drv_data) 252bfin_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);
@@ -425,6 +421,9 @@ bfin_sport_spi_pump_transfers(unsigned long data)
425 drv_data->ops = &bfin_sport_transfer_ops_u8; 421 drv_data->ops = &bfin_sport_transfer_ops_u8;
426 else 422 else
427 drv_data->ops = &bfin_sport_transfer_ops_u16; 423 drv_data->ops = &bfin_sport_transfer_ops_u16;
424 bfin_write(&drv_data->regs->tcr2, bits_per_word - 1);
425 bfin_write(&drv_data->regs->tfsdiv, bits_per_word - 1);
426 bfin_write(&drv_data->regs->rcr2, bits_per_word - 1);
428 427
429 drv_data->state = RUNNING_STATE; 428 drv_data->state = RUNNING_STATE;
430 429