Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LF-631-7 tty: serial: linflexuart: Add support for FIFO with DMA
Add LINFlexD FIFO mode support with DMA to avoid generating one interrupt per character and losing characters while copy-pasting. If the eDMA is not enabled, the LINFlexD driver will fall back to Buffer mode. The support is based on the version of the Freescale LPUART driver after the commit b3e3bf2 ("Merge 4.0-rc7 into tty-next"). In addition, it includes multiple fixes for the ALB codebase: - The memory used to be corrupted when using DMA. The issue was easily seen when the SLUB allocator was used and that affected the RT patch. The corruption used to happen in linflex_dma_tx_complete(), when calling async_tx_ack(), because the function modified the memory freed in fsl_edma_free_desc(). DMA_CTRL_ACK, if cleared, the descriptor cannot be reused by provider until the client sends ACK, i.e. has a chance to establish any dependency chains. In our case, we don't need the descriptor after completion so we can set the flag in dmaengine_prep_slave_single(); - When executing the 'reboot' command, the driver used to freeze inside a DMA transfer function because of the DTFTFF bit of the UARTSR register not being cleared. When operating using DMA, thus in FIFO mode, this bit is set and cleared by hardware to indicate whether or not the TX FIFO is full. The workaround was to write a NULL character to the device TX FIFO, thus causing it send said character and in turn clear the DTFTFF bit. The workaround is applied only after the boot sequence has been completed, with the assumption that a standard boot process does not take longer than 10 seconds to complete; - The DMA rx timeout is set according to the baud rate; - There was a deadlock between linflex_dma_rx_complete() and linflex_timer_func() caused by not disabling the timer when the DMA callback was called; - DMATXE is now enabled only after LINFlexD is configured to run in FIFO mode, as the reference manual indicates; - DMA is deactivated while calling linflex_console_write(), as the reference manual indicates; - In the open port function, we used to allocate memory without freeing it. The memory is now freed when we close the port. Signed-off-by: Stoica Cosmin-Stefan <cosmin.stoica@nxp.com> Signed-off-by: Larisa Grigore <Larisa.Grigore@nxp.com> Signed-off-by: Adrian.Nitu <adrian.nitu@freescale.com> Signed-off-by: Nica Dan <dan.nica@nxp.com> Signed-off-by: Costea Ciprian <ciprianmarian.costea@nxp.com> Signed-off-by: Phu Luu An <phu.luuan@nxp.com> Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com> Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
- Loading branch information