After some debugging i found that , data reception is enabled by setting CTSC. ( According to datasheet CTSC = 0 -> CTS line is controlled by CTS bit of UCR2, and CTS bit= 1 means CTS line is asserted, CTSC = 1 ->
CTS output pin is controlled by the receiver ).
RTS and CTS status are tracked using "mctrl" variable, which should be updated every time CTS/CTSC or RTS is changed. However this is done in /driver/tty/serial/serial_core.c, whereas initially CTSC is set in imx.c, without updating mctrl.
Throttle function in serial_core.c call imx_set_mctrl only when there is change in mctrl status. First time calling throttle to clear RTS find that this bit is never set (but CTSC is already set in set_termios without updating mctrl)
Which cause throttle functionality not to work as expected.
Following change in imx_set_termios() make it work as expected.
if (termios->c_cflag & CRTSCTS) {
if( sport->have_rtscts ) {
sport->port.mctrl |= TIOCM_RTS;
ucr2 &= ~UCR2_IRTS;
ucr2 |= UCR2_CTSC;
} else {
termios->c_cflag &= ~CRTSCTS;
}
}
Can anyone please validate this observation ?