Skip to content

Commit 419bc8f

Browse files
Jon Linbroonie
authored andcommitted
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 <jon.lin@rock-chips.com> Signed-off-by: Jon <jon.lin@rock-chips.com> Link: https://lore.kernel.org/r/20220617124251.5051-1-jon.lin@rock-chips.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 6aa2707 commit 419bc8f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/spi/spi-rockchip.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,15 +381,18 @@ static int rockchip_spi_prepare_irq(struct rockchip_spi *rs,
381381
rs->tx_left = rs->tx ? xfer->len / rs->n_bytes : 0;
382382
rs->rx_left = xfer->len / rs->n_bytes;
383383

384-
if (rs->cs_inactive)
385-
writel_relaxed(INT_RF_FULL | INT_CS_INACTIVE, rs->regs + ROCKCHIP_SPI_IMR);
386-
else
387-
writel_relaxed(INT_RF_FULL, rs->regs + ROCKCHIP_SPI_IMR);
384+
writel_relaxed(0xffffffff, rs->regs + ROCKCHIP_SPI_ICR);
385+
388386
spi_enable_chip(rs, true);
389387

390388
if (rs->tx_left)
391389
rockchip_spi_pio_writer(rs);
392390

391+
if (rs->cs_inactive)
392+
writel_relaxed(INT_RF_FULL | INT_CS_INACTIVE, rs->regs + ROCKCHIP_SPI_IMR);
393+
else
394+
writel_relaxed(INT_RF_FULL, rs->regs + ROCKCHIP_SPI_IMR);
395+
393396
/* 1 means the transfer is in progress */
394397
return 1;
395398
}

0 commit comments

Comments
 (0)