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

Commit f2b4a9fe authored by Naveen Kaje's avatar Naveen Kaje
Browse files

msm_serial_hs: Disable RFR line and auto RFR in set_termios



This change disables the RFR line during set_termios call so that
the remote side does not send data during this call and thus prevents
data omission and corruption.

CRs-Fixed: 557659
Change-Id: I0708168b858a42d102ad3e5ebcbd6ca33943c8b1
Signed-off-by: default avatarNaveen Kaje <nkaje@codeaurora.org>
parent 6badacdb
Loading
Loading
Loading
Loading
+22 −12
Original line number Diff line number Diff line
@@ -998,6 +998,14 @@ static void msm_hs_set_termios(struct uart_port *uport,
	mutex_lock(&msm_uport->clk_mutex);
	msm_hs_write(uport, UART_DM_IMR, 0);

	/* Clear the Rx Ready Ctl bit - This ensures that
	* flow control lines stop the other side from sending
	* data while we change the parameters
	*/
	data = msm_hs_read(uport, UART_DM_MR1);
	data &= ~UARTDM_MR1_RX_RDY_CTL_BMSK;
	msm_hs_write(uport, UART_DM_MR1, data);

	/*
	 * Disable Rx channel of UARTDM
	 * DMA Rx Stall happens if enqueue and flush of Rx command happens
@@ -1071,18 +1079,6 @@ static void msm_hs_set_termios(struct uart_port *uport,
	/* write parity/bits per char/stop bit configuration */
	msm_hs_write(uport, UART_DM_MR2, data);

	/* Configure HW flow control */
	data = msm_hs_read(uport, UART_DM_MR1);

	data &= ~(UARTDM_MR1_CTS_CTL_BMSK | UARTDM_MR1_RX_RDY_CTL_BMSK);

	if (c_cflag & CRTSCTS) {
		data |= UARTDM_MR1_CTS_CTL_BMSK;
		data |= UARTDM_MR1_RX_RDY_CTL_BMSK;
	}

	msm_hs_write(uport, UART_DM_MR1, data);

	uport->ignore_status_mask = termios->c_iflag & INPCK;
	uport->ignore_status_mask |= termios->c_iflag & IGNPAR;
	uport->ignore_status_mask |= termios->c_iflag & IGNBRK;
@@ -1131,6 +1127,20 @@ static void msm_hs_set_termios(struct uart_port *uport,
		}
	}

	/* Configure HW flow control
	 * UART Core would see status of CTS line when it is sending data
	 * to remote uart to confirm that it can receive or not.
	 * UART Core would trigger RFR if it is not having any space with
	 * RX FIFO.
	 */
	data = msm_hs_read(uport, UART_DM_MR1);
	data &= ~(UARTDM_MR1_CTS_CTL_BMSK | UARTDM_MR1_RX_RDY_CTL_BMSK);
	if (c_cflag & CRTSCTS) {
		data |= UARTDM_MR1_CTS_CTL_BMSK;
		data |= UARTDM_MR1_RX_RDY_CTL_BMSK;
	}
	msm_hs_write(uport, UART_DM_MR1, data);

	msm_hs_write(uport, UART_DM_IMR, msm_uport->imr_reg);
	mb();
	mutex_unlock(&msm_uport->clk_mutex);