Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b891d8cd authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "spi-geni: Synchronize SPI transfer and ISR"

parents 8bcc077a b5fa8beb
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -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;
}