aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorDesmond Liu <desmondl@broadcom.com>2015-02-26 19:35:57 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-06 21:06:51 -0500
commitdfd37668ea6d5029fb5d8a66ea5e202d0655fad7 (patch)
tree5756f16796a97d4061fe9a3396b08b4781610afd /drivers/tty
parent7cf91108d44dbef3d48766fd0e7f7347c2e48bda (diff)
serial: 8250_dw: Fix get_mctrl behaviour
Fixed behaviour of get_mctrl() serial driver function as documented in: https://www.kernel.org/doc/Documentation/serial/driver Added device-tree properties 'dcd-override', 'dsr-override', 'cts-override', and 'ri-override' specific to the Synopsis 8250 DesignWare UART driver. Allows one to force Data Carrier Detect, Clear To Send, and Data Set Ready signals to permanently be reported as active. The Ring indicator can be forced to be reported as inactive. It is possible that if modem control signalling is enabled on a port that doesn't have these pins (e.g. - a simple two wire Tx/Rx port), the driver can hang indefinitely waiting for the state to change. The new DT properties allow the driver to ignore the state of these pins on serial ports that don't support them, as recommended in the kernel documentation. Reviewed-by: JD (Jiandong) Zheng <jdzheng@broadcom.com> Signed-off-by: Jonathan Richardson <jonathar@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/8250/8250_dw.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index e60116235836..2ab229ddee38 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -59,6 +59,8 @@ struct dw8250_data {
59 u8 usr_reg; 59 u8 usr_reg;
60 int last_mcr; 60 int last_mcr;
61 int line; 61 int line;
62 int msr_mask_on;
63 int msr_mask_off;
62 struct clk *clk; 64 struct clk *clk;
63 struct clk *pclk; 65 struct clk *pclk;
64 struct reset_control *rst; 66 struct reset_control *rst;
@@ -81,6 +83,12 @@ static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value)
81 value &= ~UART_MSR_DCTS; 83 value &= ~UART_MSR_DCTS;
82 } 84 }
83 85
86 /* Override any modem control signals if needed */
87 if (offset == UART_MSR) {
88 value |= d->msr_mask_on;
89 value &= ~d->msr_mask_off;
90 }
91
84 return value; 92 return value;
85} 93}
86 94
@@ -334,6 +342,30 @@ static int dw8250_probe_of(struct uart_port *p,
334 if (id >= 0) 342 if (id >= 0)
335 p->line = id; 343 p->line = id;
336 344
345 if (of_property_read_bool(np, "dcd-override")) {
346 /* Always report DCD as active */
347 data->msr_mask_on |= UART_MSR_DCD;
348 data->msr_mask_off |= UART_MSR_DDCD;
349 }
350
351 if (of_property_read_bool(np, "dsr-override")) {
352 /* Always report DSR as active */
353 data->msr_mask_on |= UART_MSR_DSR;
354 data->msr_mask_off |= UART_MSR_DDSR;
355 }
356
357 if (of_property_read_bool(np, "cts-override")) {
358 /* Always report DSR as active */
359 data->msr_mask_on |= UART_MSR_DSR;
360 data->msr_mask_off |= UART_MSR_DDSR;
361 }
362
363 if (of_property_read_bool(np, "ri-override")) {
364 /* Always report Ring indicator as inactive */
365 data->msr_mask_off |= UART_MSR_RI;
366 data->msr_mask_off |= UART_MSR_TERI;
367 }
368
337 /* clock got configured through clk api, all done */ 369 /* clock got configured through clk api, all done */
338 if (p->uartclk) 370 if (p->uartclk)
339 return 0; 371 return 0;