Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jon Lin and committed by
Mark Brown
419bc8f6 6aa27071

+7 -4
+7 -4
drivers/spi/spi-rockchip.c
··· 381 381 rs->tx_left = rs->tx ? xfer->len / rs->n_bytes : 0; 382 382 rs->rx_left = xfer->len / rs->n_bytes; 383 383 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 + 388 386 spi_enable_chip(rs, true); 389 387 390 388 if (rs->tx_left) 391 389 rockchip_spi_pio_writer(rs); 390 + 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); 392 395 393 396 /* 1 means the transfer is in progress */ 394 397 return 1;