Skip to content

Commit 71f021c

Browse files
committed
Merge branch 'topic/stm' into for-linus
2 parents 4b4447b + cc832dc commit 71f021c

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

drivers/dma/stm32-dma.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -308,20 +308,12 @@ static bool stm32_dma_fifo_threshold_is_allowed(u32 burst, u32 threshold,
308308

309309
static bool stm32_dma_is_burst_possible(u32 buf_len, u32 threshold)
310310
{
311-
switch (threshold) {
312-
case STM32_DMA_FIFO_THRESHOLD_FULL:
313-
if (buf_len >= STM32_DMA_MAX_BURST)
314-
return true;
315-
else
316-
return false;
317-
case STM32_DMA_FIFO_THRESHOLD_HALFFULL:
318-
if (buf_len >= STM32_DMA_MAX_BURST / 2)
319-
return true;
320-
else
321-
return false;
322-
default:
323-
return false;
324-
}
311+
/*
312+
* Buffer or period length has to be aligned on FIFO depth.
313+
* Otherwise bytes may be stuck within FIFO at buffer or period
314+
* length.
315+
*/
316+
return ((buf_len % ((threshold + 1) * 4)) == 0);
325317
}
326318

327319
static u32 stm32_dma_get_best_burst(u32 buf_len, u32 max_burst, u32 threshold,

0 commit comments

Comments
 (0)