aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/spi/spi_bfin5xx.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index ce4692cdb3b2..f61b5eeb0427 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -358,14 +358,10 @@ static void u8_cs_chg_reader(struct driver_data *drv_data)
358 358
359static void u8_duplex(struct driver_data *drv_data) 359static void u8_duplex(struct driver_data *drv_data)
360{ 360{
361 /* poll for SPI completion before start */
362 while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
363 cpu_relax();
364
365 /* in duplex mode, clk is triggered by writing of TDBR */ 361 /* in duplex mode, clk is triggered by writing of TDBR */
366 while (drv_data->rx < drv_data->rx_end) { 362 while (drv_data->rx < drv_data->rx_end) {
367 write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); 363 write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
368 while (read_STAT(drv_data) & BIT_STAT_TXS) 364 while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
369 cpu_relax(); 365 cpu_relax();
370 while (!(read_STAT(drv_data) & BIT_STAT_RXS)) 366 while (!(read_STAT(drv_data) & BIT_STAT_RXS))
371 cpu_relax(); 367 cpu_relax();
@@ -495,14 +491,10 @@ static void u16_cs_chg_reader(struct driver_data *drv_data)
495 491
496static void u16_duplex(struct driver_data *drv_data) 492static void u16_duplex(struct driver_data *drv_data)
497{ 493{
498 /* poll for SPI completion before start */
499 while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
500 cpu_relax();
501
502 /* in duplex mode, clk is triggered by writing of TDBR */ 494 /* in duplex mode, clk is triggered by writing of TDBR */
503 while (drv_data->tx < drv_data->tx_end) { 495 while (drv_data->tx < drv_data->tx_end) {
504 write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); 496 write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
505 while (read_STAT(drv_data) & BIT_STAT_TXS) 497 while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
506 cpu_relax(); 498 cpu_relax();
507 while (!(read_STAT(drv_data) & BIT_STAT_RXS)) 499 while (!(read_STAT(drv_data) & BIT_STAT_RXS))
508 cpu_relax(); 500 cpu_relax();
@@ -516,15 +508,11 @@ static void u16_cs_chg_duplex(struct driver_data *drv_data)
516{ 508{
517 struct chip_data *chip = drv_data->cur_chip; 509 struct chip_data *chip = drv_data->cur_chip;
518 510
519 /* poll for SPI completion before start */
520 while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
521 cpu_relax();
522
523 while (drv_data->tx < drv_data->tx_end) { 511 while (drv_data->tx < drv_data->tx_end) {
524 cs_active(drv_data, chip); 512 cs_active(drv_data, chip);
525 513
526 write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); 514 write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
527 while (read_STAT(drv_data) & BIT_STAT_TXS) 515 while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
528 cpu_relax(); 516 cpu_relax();
529 while (!(read_STAT(drv_data) & BIT_STAT_RXS)) 517 while (!(read_STAT(drv_data) & BIT_STAT_RXS))
530 cpu_relax(); 518 cpu_relax();