Skip to content

Commit

Permalink
serial: imx: Support common rs485 binding for RTS polarity
Browse files Browse the repository at this point in the history
Invoke the ->rs485_config callback on probe to adjust the initial RTS
polarity based on the UART's device properties.

This implicitly fixes a bug:  If RTS control is not available, rs485
should be disabled even if it was enabled through a device property.
Log an error when that occurs.

Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Lukas Wunner authored and Greg Kroah-Hartman committed Nov 28, 2017
1 parent 01d8453 commit b8f3bff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,12 @@ static int serial_imx_probe(struct platform_device *pdev)

uart_get_rs485_mode(&pdev->dev, &sport->port.rs485);

if (sport->port.rs485.flags & SER_RS485_ENABLED &&
(!sport->have_rtscts || !sport->have_rtsgpio))
dev_err(&pdev->dev, "no RTS control, disabling rs485\n");

imx_rs485_config(&sport->port, &sport->port.rs485);

/* Disable interrupts before requesting them */
reg = readl_relaxed(sport->port.membase + UCR1);
reg &= ~(UCR1_ADEN | UCR1_TRDYEN | UCR1_IDEN | UCR1_RRDYEN |
Expand Down

0 comments on commit b8f3bff

Please sign in to comment.