serial: msm_geni_serial: Add delay for rx invalid transfer

Check for RX data in rx buffer for faulty transfer and add
delay of 2 msecs delay in order for dma rx transfer
to be actually completed.

Also dump required qup registers when the uart dma rx data is
seen as all zeros.

Change-Id: Ifaa0cb7d22b8419ffacfee7212b0a28ed8ebf2a1
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
This commit is contained in:
Chandana Kishori Chiluveru 2020-09-10 13:29:46 +05:30 • committed by Paras Sharma
commit de89e43ada

View file

@ -1686,6 +1686,40 @@ exit_handle_tx:
return 0;
}
static void check_rx_buf(char *buf, struct uart_port *uport, int size)
{
struct msm_geni_serial_port *msm_port = GET_DEV_PORT(uport);
unsigned int rx_data;
bool fault = false;
rx_data = *(u32 *)buf;
/* check for first 4 bytes of RX data for faulty zero pattern */
if (rx_data == 0x0) {
if (size <= 4) {
fault = true;
} else {
/*
* check for last 4 bytes of data in RX buffer for
* faulty pattern
*/
if (memcmp(buf+(size-4), "\x0\x0\x0\x0", 4) == 0)
fault = true;
}
if (fault) {
IPC_LOG_MSG(msm_port->ipc_log_rx,
"RX Invalid packet %s\n", __func__);
geni_se_dump_dbg_regs(&msm_port->serial_rsc,
uport->membase, msm_port->ipc_log_misc);
/*
* Add 2 msecs delay in order for dma rx transfer
* to be actually completed.
*/
udelay(2000);
}
}
}
static int msm_geni_serial_handle_dma_rx(struct uart_port *uport, bool drop_rx)
{
struct msm_geni_serial_port *msm_port = GET_DEV_PORT(uport);
@ -1714,6 +1748,10 @@ static int msm_geni_serial_handle_dma_rx(struct uart_port *uport, bool drop_rx)
__func__, rx_bytes);
goto exit_handle_dma_rx;
}
/* Check RX buffer data for faulty pattern*/
check_rx_buf((char *)msm_port->rx_buf, uport, rx_bytes);
if (drop_rx)
goto exit_handle_dma_rx;