[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180601124021.102970-6-giulio.benetti@micronovasrl.com>
Date: Fri, 1 Jun 2018 14:40:18 +0200
From: Giulio Benetti <giulio.benetti@...ronovasrl.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Jiri Slaby <jslaby@...e.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Kees Cook <keescook@...omium.org>,
Matthias Brugger <mbrugger@...e.com>,
Allen Pais <allen.lkml@...il.com>, Sean Young <sean@...s.org>,
Ed Blake <ed.blake@...drel.com>,
Stefan Potyra <Stefan.Potyra@...ktrobit.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Joshua Scott <joshua.scott@...iedtelesis.co.nz>,
Vignesh R <vigneshr@...com>,
Rolf Evers-Fischer <rolf.evers.fischer@...iv.com>,
Aaron Sierra <asierra@...-inc.com>,
Rafael Gago <rafael.gago@...il.com>,
Joel Stanley <joel@....id.au>,
Sean Wang <sean.wang@...iatek.com>,
linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
Giulio Benetti <giulio.benetti@...ronovasrl.com>
Subject: [PATCH 5/8] serial: 8250_dw: treat rpm suspend with -EBUSY if RS485 ON and RTS_AFTER_SEND
If rs485 is on and RTS_AFTER_SEND it means that in idle state rts pin
must be asserted, othwerwise rs485 transceiver will enter tx state.
dw8250 when clocks are stopped keeps rts line de-asserted(high),
resulting in keeping rs485 transceiver in tx state when port is idle.
Check if rs485 is on with RTS_AFTER_SEND set, if so return -EBUSY in
rpm_suspend,
Signed-off-by: Giulio Benetti <giulio.benetti@...ronovasrl.com>
---
drivers/tty/serial/8250/8250_dw.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 888280ff5451..6b0ee6dc8ad0 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -668,6 +668,11 @@ static int dw8250_resume(struct device *dev)
static int dw8250_runtime_suspend(struct device *dev)
{
struct dw8250_data *data = dev_get_drvdata(dev);
+ struct uart_8250_port *up = serial8250_get_port(data->line);
+ struct uart_port *p = &up->port;
+
+ if (p->rs485.flags & (SER_RS485_ENABLED | SER_RS485_RTS_AFTER_SEND))
+ return -EBUSY;
if (!IS_ERR(data->clk))
clk_disable_unprepare(data->clk);
--
2.17.0
Powered by blists - more mailing lists