From 0d971d4673b5e724091120bebc06c88d9bef20c4 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Tue, 18 Aug 2020 14:02:22 +0900 Subject: [PATCH] arch: cxd56xx: Fix IRQ control in cxd56_dmac.c Summary: - This commit fixes IRQ control for the following use case - The gs2200m Wi-Fi driver requests SPI-DMA to receive a packet. - cxd56_dma.c enables IRQ for the SPI-DMA and start transfer. - Then LCD driver requests SPI-DMA to display an image. - These SPI-DMAs use different DMA channels but share the DMA controller. - Also, they share the same IRQ. - When the first SPI-DMA finishes the transfer, it disables the IRQ. - And if the second SPI-DMA finishes the transfer just after the IRQ disabled. - The second SPI-DMA will be in a deadlock condition. - To resolve this issue, do not control IRQ during DMA transfer. - Instead, up_enable_irq() is called in up_dma_initialize() Impact: - All use cases which use DMA Testing: - Tested with spresense:wifi with LCD Signed-off-by: Masayuki Ishikawa --- arch/arm/src/cxd56xx/cxd56_dmac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/arm/src/cxd56xx/cxd56_dmac.c b/arch/arm/src/cxd56xx/cxd56_dmac.c index 557c913202..a38efc96d3 100644 --- a/arch/arm/src/cxd56xx/cxd56_dmac.c +++ b/arch/arm/src/cxd56xx/cxd56_dmac.c @@ -644,8 +644,6 @@ static int dma_setintrcallback(int ch, dma_callback_t func, void *data) g_dmach[ch].callback = func; g_dmach[ch].arg = data; - up_enable_irq(irq_map[ch]); - return 0; } @@ -659,8 +657,6 @@ static int dma_clearintrcallback(int ch) g_dmach[ch].callback = NULL; g_dmach[ch].arg = NULL; - up_disable_irq(irq_map[ch]); - return 0; } @@ -738,6 +734,7 @@ void weak_function arm_dma_initialize(void) for (i = 0; i < NCHANNELS; i++) { g_dmach[i].chan = i; + up_enable_irq(irq_map[i]); } nxsem_init(&g_dmaexc, 0, 1);