Skip to content

Commit

Permalink
serial: imx: Update cached mctrl value when changing RTS
Browse files Browse the repository at this point in the history
UART core function uart_update_mctrl relies on a cached value of
modem control lines. This was used but not updated by local RTS
control functions within imx.c. These are used for RS485 line
driver enable signalling. Having an out-of-date value in the cached
mctrl can result in the transmitter being enabled when it shouldn't
be.

Fix this by updating the mctrl value before applying it.

Signed-off-by: Ian Jamison <ian.dev@arkver.com>
Origin: id:8195c96e674517b82a6ff7fe914c7ba0f86e702b.1505375165.git.ian.dev@arkver.com
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Jamison authored and Greg Kroah-Hartman committed Oct 3, 2017
1 parent 8b25deb commit a0983c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,17 @@ static void imx_port_rts_active(struct imx_port *sport, unsigned long *ucr2)
{
*ucr2 &= ~(UCR2_CTSC | UCR2_CTS);

mctrl_gpio_set(sport->gpios, sport->port.mctrl | TIOCM_RTS);
sport->port.mctrl |= TIOCM_RTS;
mctrl_gpio_set(sport->gpios, sport->port.mctrl);
}

static void imx_port_rts_inactive(struct imx_port *sport, unsigned long *ucr2)
{
*ucr2 &= ~UCR2_CTSC;
*ucr2 |= UCR2_CTS;

mctrl_gpio_set(sport->gpios, sport->port.mctrl & ~TIOCM_RTS);
sport->port.mctrl &= ~TIOCM_RTS;
mctrl_gpio_set(sport->gpios, sport->port.mctrl);
}

static void imx_port_rts_auto(struct imx_port *sport, unsigned long *ucr2)
Expand Down

0 comments on commit a0983c7

Please sign in to comment.