Skip to content

Commit

Permalink
serial: imx: Fix the CTS_B polarity in RS485 mode
Browse files Browse the repository at this point in the history
When userspace passes the SER_RS485_RTS_ON_SEND flag it means that the
CTS_B pin should go to logic level high before the transmission begins.

CTS_B goes to logic level high when both CTSC and CTS bits are cleared.

When userspace passes the SER_RS485_RTS_AFTER_SEND flag it means that the
CTS_B pin should go to logic level low after the transmission finishes.

CTS_B goes to logic level low when CTSC bit is cleared and CTS bit is set.

So fix the CTS_B polarity logic.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Fabio Estevam authored and gregkh committed Jan 31, 2017
1 parent 1a61362 commit bc2be23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ static void imx_port_ucrs_restore(struct uart_port *port,

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

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

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

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

0 comments on commit bc2be23

Please sign in to comment.