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

Commit c6e115b9 authored by Mukesh Kumar Savaliya's avatar Mukesh Kumar Savaliya
Browse files

serial: msm_geni_serial: Bypass Flow control lines from termios



This change ensures UART driver doesn't control the flow lines when
baud change is requested. UART client must ensure that peer device
is flowed off before requesting the baud change.

If UART driver control the Flow lines it may happen that after baud
rate change, immediately driver decides to Flow it ON which may have
side effect to client if it doesn't really intend to receive anything
from ther peer side.

This way we are ensuring the window of baud change is controlled by
client and not disturbed by the driver.

Change-Id: Id88ae03dc8a81830393597e72109ee7015cb6226
Signed-off-by: default avatarMukesh Kumar Savaliya <msavaliy@codeaurora.org>
parent 42c46585
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ struct msm_geni_serial_port {
	struct completion m_cmd_timeout;
	struct completion s_cmd_timeout;
	spinlock_t rx_lock;
	bool bypass_flow_control;
};

static const struct uart_ops msm_geni_serial_pops;
@@ -1454,6 +1455,7 @@ static int stop_rx_sequencer(struct uart_port *uport)
	}

	if (!uart_console(uport)) {
		if (!port->bypass_flow_control)
			msm_geni_serial_set_manual_flow(false, port);
		/*
		 * Wait for the stale timeout to happen if there
@@ -1571,7 +1573,7 @@ static int stop_rx_sequencer(struct uart_port *uport)
	port->s_cmd = false;

exit_rx_seq:
	if (!uart_console(uport))
	if (!uart_console(uport) && !port->bypass_flow_control)
		msm_geni_serial_set_manual_flow(true, port);

	geni_status = geni_read_reg_nolog(uport->membase, SE_GENI_STATUS);
@@ -2507,7 +2509,12 @@ static void msm_geni_serial_set_termios(struct uart_port *uport,
			return;
		}
	}

	//Client must control Flow, don't touch RFR during baud change.
	port->bypass_flow_control = true;
	msm_geni_serial_stop_rx(uport);
	port->bypass_flow_control = false;

	/* baud rate */
	baud = uart_get_baud_rate(uport, termios, old, 300, 4000000);
	port->cur_baud = baud;