Skip to content

Commit

Permalink
spi-topcliff-pch: Fix CPU read complete condition issue
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Tomoya MORINAGA authored and glikely committed Oct 4, 2011
1 parent 8b7aa96 commit 373b0eb
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions drivers/spi/spi-topcliff-pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,19 @@ static void pch_spi_handler_sub(struct pch_spi_data *data, u32 reg_spsr_val,

/* if transfer complete interrupt */
if (reg_spsr_val & SPSR_FI_BIT) {
if (tx_index < bpw_len)
if ((tx_index == bpw_len) && (rx_index == tx_index)) {
/* disable interrupts */
pch_spi_setclr_reg(data->master, PCH_SPCR, 0, PCH_ALL);

/* transfer is completed;
inform pch_spi_process_messages */
data->transfer_complete = true;
data->transfer_active = false;
wake_up(&data->wait);
} else {
dev_err(&data->master->dev,
"%s : Transfer is not completed", __func__);
/* disable interrupts */
pch_spi_setclr_reg(data->master, PCH_SPCR, 0, PCH_ALL);

/* transfer is completed;inform pch_spi_process_messages */
data->transfer_complete = true;
data->transfer_active = false;
wake_up(&data->wait);
}
}
}

Expand Down

0 comments on commit 373b0eb

Please sign in to comment.