Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7084289d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "tty: serial: msm: Add timeout for waiting TX ready"

parents 867cedb3 85f8d252
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -395,10 +395,22 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base)

static inline void msm_wait_for_xmitr(struct uart_port *port)
{
	u32 count = 500000;

	while (!(msm_read(port, UART_SR) & UART_SR_TX_EMPTY)) {
		if (msm_read(port, UART_ISR) & UART_ISR_TX_READY)
			break;
		udelay(1);

		/* At worst case, it is stuck in this loop for waiting
		 * TX ready, have a 500ms timeout to avoid stuck here
		 * and only miss some log to uart.
		 */
		if (count-- == 0) {
			msm_write(port, UART_CR_CMD_RESET_TX, UART_CR);
			printk_deferred("uart may lost data, resetting TX!\n");
			break;
		}
	}
	msm_write(port, UART_CR_CMD_RESET_TX_READY, UART_CR);
}