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