spi-geni: Synchronize SPI transfer and ISR
In ISR, set the complete variable at the end of the ISR so that the transfer function which is waiting for the complete variable will initiate next transfer only after the ISR is done. Change-Id: I38bb1a6f063e1553a13ceeb405fdb74f3ced84b4 Signed-off-by: Akash Asthana <akashast@codeaurora.org>
This commit is contained in:
parent
6d0b2be23e
commit
b5fa8bebe7
1 changed files with 8 additions and 3 deletions
|
|
@ -156,6 +156,7 @@ struct spi_geni_master {
|
|||
void *ipc;
|
||||
bool shared_se;
|
||||
bool dis_autosuspend;
|
||||
bool cmd_done;
|
||||
};
|
||||
|
||||
static struct spi_master *get_spi_master(struct device *dev)
|
||||
|
|
@ -1279,7 +1280,7 @@ static irqreturn_t geni_spi_irq(int irq, void *data)
|
|||
|
||||
if ((m_irq & M_CMD_DONE_EN) || (m_irq & M_CMD_CANCEL_EN) ||
|
||||
(m_irq & M_CMD_ABORT_EN)) {
|
||||
complete(&mas->xfer_done);
|
||||
mas->cmd_done = true;
|
||||
/*
|
||||
* If this happens, then a CMD_DONE came before all the
|
||||
* buffer bytes were sent out. This is unusual, log this
|
||||
|
|
@ -1319,12 +1320,16 @@ static irqreturn_t geni_spi_irq(int irq, void *data)
|
|||
if (dma_rx_status & RX_DMA_DONE)
|
||||
mas->rx_rem_bytes = 0;
|
||||
if (!mas->tx_rem_bytes && !mas->rx_rem_bytes)
|
||||
complete(&mas->xfer_done);
|
||||
mas->cmd_done = true;
|
||||
if ((m_irq & M_CMD_CANCEL_EN) || (m_irq & M_CMD_ABORT_EN))
|
||||
complete(&mas->xfer_done);
|
||||
mas->cmd_done = true;
|
||||
}
|
||||
exit_geni_spi_irq:
|
||||
geni_write_reg(m_irq, mas->base, SE_GENI_M_IRQ_CLEAR);
|
||||
if (mas->cmd_done) {
|
||||
mas->cmd_done = false;
|
||||
complete(&mas->xfer_done);
|
||||
}
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue