You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using RK3399 onboard serial port to transfer (receive) large data on high baudrate, but the data is lost periodically.
the rx data flow baudrate is 8M bps (8000000 bps), and the frame size is 50K bytes. So I firstly enable dma in the rk3399.dtsi file:
when I start to receive the data, only the last 7k+ bytes of every frame can be received, the first 40k data of every frame is lost.
I looked into the kernel source code, and find out the cause to this problem.
source file: drivers/tty/serial/8250/8250_dma.c
int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
{
unsigned int rfl, i = 0, fcr = 0, cur_index = 0;
unsigned char buf[MAX_FIFO_SIZE];
struct uart_port *port = &p->port;
struct tty_port *tty_port = &p->port.state->port;
struct dma_tx_state state;
struct uart_8250_dma *dma = p->dma;
if ((iir & 0xf) != UART_IIR_RX_TIMEOUT)
return 0;
the driver only transfer data to user space only when RX_TIMEOUT flag is set. It means the last data in the dma buffer before the end of serial frame is transferred, any previous data is overwritten.
The history git commit message proved this:
serial: 8250: support new dma transfer
The old mode uses soft timer to update received data,
which costs much cpu resource, even though there is no
data. The new mode is based on uart time out, it updates
data only when transfer completes.
Change-Id: Id12e351ff00015e4bfb36f416731ce4af5330001
Signed-off-by: Huibin Hong <[email protected]>
Hopefully this bug can be fixed officially. Thanks.
The text was updated successfully, but these errors were encountered:
Hi, I'm using RK3399 onboard serial port to transfer (receive) large data on high baudrate, but the data is lost periodically.
the rx data flow baudrate is 8M bps (8000000 bps), and the frame size is 50K bytes. So I firstly enable dma in the rk3399.dtsi file:
when I start to receive the data, only the last 7k+ bytes of every frame can be received, the first 40k data of every frame is lost.
I looked into the kernel source code, and find out the cause to this problem.
source file: drivers/tty/serial/8250/8250_dma.c
the driver only transfer data to user space only when RX_TIMEOUT flag is set. It means the last data in the dma buffer before the end of serial frame is transferred, any previous data is overwritten.
The history git commit message proved this:
Hopefully this bug can be fixed officially. Thanks.
The text was updated successfully, but these errors were encountered: