File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ struct lantiq_ssc_spi {
183
183
unsigned int tx_fifo_size ;
184
184
unsigned int rx_fifo_size ;
185
185
unsigned int base_cs ;
186
+ unsigned int fdx_tx_level ;
186
187
};
187
188
188
189
static u32 lantiq_ssc_readl (const struct lantiq_ssc_spi * spi , u32 reg )
@@ -480,6 +481,7 @@ static void tx_fifo_write(struct lantiq_ssc_spi *spi)
480
481
u32 data ;
481
482
unsigned int tx_free = tx_fifo_free (spi );
482
483
484
+ spi -> fdx_tx_level = 0 ;
483
485
while (spi -> tx_todo && tx_free ) {
484
486
switch (spi -> bits_per_word ) {
485
487
case 2 ... 8 :
@@ -508,6 +510,7 @@ static void tx_fifo_write(struct lantiq_ssc_spi *spi)
508
510
509
511
lantiq_ssc_writel (spi , data , LTQ_SPI_TB );
510
512
tx_free -- ;
513
+ spi -> fdx_tx_level ++ ;
511
514
}
512
515
}
513
516
@@ -519,6 +522,13 @@ static void rx_fifo_read_full_duplex(struct lantiq_ssc_spi *spi)
519
522
u32 data ;
520
523
unsigned int rx_fill = rx_fifo_level (spi );
521
524
525
+ /*
526
+ * Wait until all expected data to be shifted in.
527
+ * Otherwise, rx overrun may occur.
528
+ */
529
+ while (rx_fill != spi -> fdx_tx_level )
530
+ rx_fill = rx_fifo_level (spi );
531
+
522
532
while (rx_fill ) {
523
533
data = lantiq_ssc_readl (spi , LTQ_SPI_RB );
524
534
You can’t perform that action at this time.
0 commit comments