struct sdma_buffer_descriptor *bd;
int error = 0;
enum dma_status old_status = sdmac->status;
+ int count = 0;
/*
* loop mode. Iterate over descriptors, re-setup them and
bd = &desc->bd[desc->buf_tail];
+ /*
+ * re-enable HSTART_HE if all bds consumed at the last time,
+ * that happens in high loading case which sdma_handle_channel_
+ * loop can't be handled in time while all bds run out in sdma
+ * side, then sdma script clear HE and cause channel stop.
+ */
+ if (count == desc->num_bd) {
+ dev_warn(sdmac->sdma->dev, "All bds consumed,restart now.\n");
+ sdma_enable_channel(sdmac->sdma, sdmac->channel);
+ }
+
if (bd->mode.status & BD_DONE)
break;
bd->mode.count = desc->period_len;
desc->buf_ptail = desc->buf_tail;
desc->buf_tail = (desc->buf_tail + 1) % desc->num_bd;
+ count++;
/*
* The callback is called from the interrupt context in order