diff options
author | Lukas Wunner <lukas@wunner.de> | 2017-11-24 17:26:40 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-28 10:05:20 -0500 |
commit | b8f3bff057b017309fbd61fe74712b1f185b5399 (patch) | |
tree | 4f6acb9fe8cdafd64a2ed39289039455fbcca5b0 | |
parent | 01d845352a81df133234a106f34cc93937dcb7bd (diff) |
serial: imx: Support common rs485 binding for RTS polarity
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>
-rw-r--r-- | drivers/tty/serial/imx.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index d2c7d88d5774..c2b29fd66e8a 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -2092,6 +2092,12 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
2092 | 2092 | ||
2093 | uart_get_rs485_mode(&pdev->dev, &sport->port.rs485); | 2093 | uart_get_rs485_mode(&pdev->dev, &sport->port.rs485); |
2094 | 2094 | ||
2095 | if (sport->port.rs485.flags & SER_RS485_ENABLED && | ||
2096 | (!sport->have_rtscts || !sport->have_rtsgpio)) | ||
2097 | dev_err(&pdev->dev, "no RTS control, disabling rs485\n"); | ||
2098 | |||
2099 | imx_rs485_config(&sport->port, &sport->port.rs485); | ||
2100 | |||
2095 | /* Disable interrupts before requesting them */ | 2101 | /* Disable interrupts before requesting them */ |
2096 | reg = readl_relaxed(sport->port.membase + UCR1); | 2102 | reg = readl_relaxed(sport->port.membase + UCR1); |
2097 | reg &= ~(UCR1_ADEN | UCR1_TRDYEN | UCR1_IDEN | UCR1_RRDYEN | | 2103 | reg &= ~(UCR1_ADEN | UCR1_TRDYEN | UCR1_IDEN | UCR1_RRDYEN | |