101-04-spi-mtk_spim-clear-IRQ-enable-bits.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From a7b630f02bb12f71f23866aee6f9a1a07497d475 Mon Sep 17 00:00:00 2001
  2. From: Weijie Gao <[email protected]>
  3. Date: Wed, 19 Jul 2023 17:16:02 +0800
  4. Subject: [PATCH 04/29] spi: mtk_spim: clear IRQ enable bits
  5. In u-boot we don't use IRQ. Instead, we poll busy bit in SPI_STATUS.
  6. However these IRQ enable bits may be set in previous boot stage (BootROM).
  7. If we leave these bits not cleared, although u-boot has disabled IRQ and
  8. nothing will happen, the linux kernel may encounter panic during
  9. initializing the spim driver due to IRQ event happens before IRQ handler
  10. is properly setup.
  11. This patch clear IRQ bits to prevent this from happening.
  12. Signed-off-by: SkyLake.Huang <[email protected]>
  13. Signed-off-by: Weijie Gao <[email protected]>
  14. Reviewed-by: Jagan Teki <[email protected]>
  15. ---
  16. drivers/spi/mtk_spim.c | 3 +++
  17. 1 file changed, 3 insertions(+)
  18. --- a/drivers/spi/mtk_spim.c
  19. +++ b/drivers/spi/mtk_spim.c
  20. @@ -242,6 +242,9 @@ static int mtk_spim_hw_init(struct spi_s
  21. reg_val &= ~SPI_CMD_SAMPLE_SEL;
  22. }
  23. + /* Disable interrupt enable for pause mode & normal mode */
  24. + reg_val &= ~(SPI_CMD_PAUSE_IE | SPI_CMD_FINISH_IE);
  25. +
  26. /* disable dma mode */
  27. reg_val &= ~(SPI_CMD_TX_DMA | SPI_CMD_RX_DMA);