Hello. David Brownell wrote:
From: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx> Subject: musb_hdrc: bugfixes for multi-packet TXDMA support
We really want to use DMA mode 1 for all multi-packet transfers; that's one IRQ on DMA completion, instead of one per packet.
There is an important issue with such transfers, especially on the host side: we must defer musb_dma_completion() calls until
We can't defer these calls. We can only defer URB completion.
the FIFO empties. Else we report URB completions too soon, and may clobber data in the FIFO fifo when writing the next packet (losing data).
The Inventra DMA support uses DMA mode 1, but it ignores that issue.
Sigh. It doesn't ignore the issue completely, just one particular case of it (full-size last packet, when it doesn't have to set TxPktRdy manually).
The CPPI DMA support uses mode 0, but doesn't handle its TXPKTRDY interrupts quite right either;
It's not the task of the CPPI DMA support as I've pointed out.
it can get stale "packet ready" interrupts, and report transfer completion too early using slightly different code paths, also losing data.
So I'm solving it in a generic way -- by adding a sort of the "interrupt filter" into musb_host_tx(), catching these cases where a DMA completion IRQ doesn't suffice and removing some needlessly controller-specific logic. When a TXDMA interrupt happens and DMA request mode 1 is active, that filter resets to mode 0 and defers URB completion processing until TXPKTRDY,
TXPKRDY *what*, again?
unless the FIFO is already empty. Related filtering logic in Inventra and CPPI code gets removed.
Since it should be competely safe now to use the DMA request mode 1 for host side transfers with the CPPI DMA controller, set it in musb_h_tx_dma_start() ... now renamed (and shared).
[ dbrownell@xxxxxxxxxxxxxxxxxxxxx: don't introduce more CamElCase; use more concise explanations ]
s/concise/muddled/. :-(
Signed-off-by: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx> Cc: Felipe Balbi <felipe.balbi@xxxxxxxxx> Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx> --- Minor comment update.
Too bad it was only minor... WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html