Skip to content

Commit 4d3f6a3

Browse files
rettichschnidicarlescufi
authored andcommitted
drivers: dma: si32: Improve start and stop logic
As per dma_stop() documentation, the implementation has to not just stop the transfer, but also to disable the channel. Before this commit, only the transfer has been stopped. Same goes for dma_start(). This also allows the enabling of a channel to be removed from dma_si32_config(). Signed-off-by: Reto Schneider <[email protected]>
1 parent d32c58b commit 4d3f6a3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/dma/dma_si32.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,6 @@ static int dma_si32_config(const struct device *dev, uint32_t channel, struct dm
333333
return -EINVAL;
334334
}
335335

336-
SI32_DMACTRL_A_enable_channel(SI32_DMACTRL_0, channel);
337-
338336
return 0;
339337
}
340338

@@ -365,7 +363,6 @@ static int dma_si32_start(const struct device *dev, const uint32_t channel)
365363
__ASSERT(SI32_DMACTRL_A_is_primary_selected(SI32_DMACTRL_0, channel),
366364
"Primary descriptors must be used for basic and auto-request operations.");
367365
__ASSERT(SI32_SCONFIG_0->CONFIG.FDMAEN, "Fast mode is recommened to be enabled.");
368-
__ASSERT(SI32_DMACTRL_0->CHENSET.U32 & BIT(channel), "Channel must be enabled.");
369366
__ASSERT(SI32_DMACTRL_0->CHSTATUS.U32 & BIT(channel),
370367
"Channel must be waiting for request");
371368

@@ -377,6 +374,8 @@ static int dma_si32_start(const struct device *dev, const uint32_t channel)
377374
/* Enable interrupt for this DMA channels. */
378375
irq_enable(DMACH0_IRQn + channel);
379376

377+
SI32_DMACTRL_A_enable_channel(SI32_DMACTRL_0, channel);
378+
380379
/* memory-to-memory transfers have to be started by this driver. When peripherals are
381380
* involved, the caller has to enable the peripheral to start the transfer.
382381
*/
@@ -405,6 +404,8 @@ static int dma_si32_stop(const struct device *dev, const uint32_t channel)
405404

406405
channel_descriptors[channel].CONFIG.TMD = 0; /* Stop the DMA channel. */
407406

407+
SI32_DMACTRL_A_disable_channel(SI32_DMACTRL_0, channel);
408+
408409
return 0;
409410
}
410411

0 commit comments

Comments
 (0)