Commit cc832dc8 authored by Pierre-Yves MORDRET's avatar Pierre-Yves MORDRET Committed by Vinod Koul

dmaengine: stm32-dma: check whether length is aligned on FIFO threshold

When a period length is not multiple of FIFO some data may be stuck
within FIFO.

Burst/FIFO Threshold/Period or buffer length check has to be hardened

In any case DMA will grant any request from client but will degraded
any parameters whether awkward.
Signed-off-by: default avatarPierre-Yves MORDRET <pierre-yves.mordret@st.com>
Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 5b394b2d
...@@ -308,20 +308,12 @@ static bool stm32_dma_fifo_threshold_is_allowed(u32 burst, u32 threshold, ...@@ -308,20 +308,12 @@ static bool stm32_dma_fifo_threshold_is_allowed(u32 burst, u32 threshold,
static bool stm32_dma_is_burst_possible(u32 buf_len, u32 threshold) static bool stm32_dma_is_burst_possible(u32 buf_len, u32 threshold)
{ {
switch (threshold) { /*
case STM32_DMA_FIFO_THRESHOLD_FULL: * Buffer or period length has to be aligned on FIFO depth.
if (buf_len >= STM32_DMA_MAX_BURST) * Otherwise bytes may be stuck within FIFO at buffer or period
return true; * length.
else */
return false; return ((buf_len % ((threshold + 1) * 4)) == 0);
case STM32_DMA_FIFO_THRESHOLD_HALFFULL:
if (buf_len >= STM32_DMA_MAX_BURST / 2)
return true;
else
return false;
default:
return false;
}
} }
static u32 stm32_dma_get_best_burst(u32 buf_len, u32 max_burst, u32 threshold, static u32 stm32_dma_get_best_burst(u32 buf_len, u32 max_burst, u32 threshold,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment