aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Lin <[email protected]>2022-06-17 20:42:51 +0800
committerMark Brown <[email protected]>2022-06-20 11:35:43 +0100
commit419bc8f681a0dc63588cee693b6d45e7caa6006c (patch)
tree8059d2c1b775410db898d1e183efd583f66e4def
parent6aa27071e4354c351d98e345fc888b70f335f185 (diff)
spi: rockchip: Unmask IRQ at the final to avoid preemption
Avoid pio_write process is preempted, resulting in abnormal state. Signed-off-by: Jon Lin <[email protected]> Signed-off-by: Jon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--drivers/spi/spi-rockchip.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index a08215eb9e14..79242dc5272d 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -381,15 +381,18 @@ static int rockchip_spi_prepare_irq(struct rockchip_spi *rs,
rs->tx_left = rs->tx ? xfer->len / rs->n_bytes : 0;
rs->rx_left = xfer->len / rs->n_bytes;
- if (rs->cs_inactive)
- writel_relaxed(INT_RF_FULL | INT_CS_INACTIVE, rs->regs + ROCKCHIP_SPI_IMR);
- else
- writel_relaxed(INT_RF_FULL, rs->regs + ROCKCHIP_SPI_IMR);
+ writel_relaxed(0xffffffff, rs->regs + ROCKCHIP_SPI_ICR);
+
spi_enable_chip(rs, true);
if (rs->tx_left)
rockchip_spi_pio_writer(rs);
+ if (rs->cs_inactive)
+ writel_relaxed(INT_RF_FULL | INT_CS_INACTIVE, rs->regs + ROCKCHIP_SPI_IMR);
+ else
+ writel_relaxed(INT_RF_FULL, rs->regs + ROCKCHIP_SPI_IMR);
+
/* 1 means the transfer is in progress */
return 1;
}