Skip to content

Commit 373b0eb

Browse files
Tomoya MORINAGAglikely
authored andcommitted
spi-topcliff-pch: Fix CPU read complete condition issue
We found Rx data sometimes drops.(with non-DMA transfer mode) The cause is read complete condition is not true. This patch fixes the issue. Signed-off-by: Tomoya MORINAGA <[email protected]> Signed-off-by: Grant Likely <[email protected]>
1 parent 8b7aa96 commit 373b0eb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

drivers/spi/spi-topcliff-pch.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,19 @@ static void pch_spi_handler_sub(struct pch_spi_data *data, u32 reg_spsr_val,
317317

318318
/* if transfer complete interrupt */
319319
if (reg_spsr_val & SPSR_FI_BIT) {
320-
if (tx_index < bpw_len)
320+
if ((tx_index == bpw_len) && (rx_index == tx_index)) {
321+
/* disable interrupts */
322+
pch_spi_setclr_reg(data->master, PCH_SPCR, 0, PCH_ALL);
323+
324+
/* transfer is completed;
325+
inform pch_spi_process_messages */
326+
data->transfer_complete = true;
327+
data->transfer_active = false;
328+
wake_up(&data->wait);
329+
} else {
321330
dev_err(&data->master->dev,
322331
"%s : Transfer is not completed", __func__);
323-
/* disable interrupts */
324-
pch_spi_setclr_reg(data->master, PCH_SPCR, 0, PCH_ALL);
325-
326-
/* transfer is completed;inform pch_spi_process_messages */
327-
data->transfer_complete = true;
328-
data->transfer_active = false;
329-
wake_up(&data->wait);
332+
}
330333
}
331334
}
332335

0 commit comments

Comments
 (0)