aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt16
-rw-r--r--drivers/tty/serial/8250/8250_dw.c32
2 files changed, 48 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt
index 7f76214f728a..289c40ed7470 100644
--- a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt
+++ b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt
@@ -21,6 +21,18 @@ Optional properties:
21- reg-io-width : the size (in bytes) of the IO accesses that should be 21- reg-io-width : the size (in bytes) of the IO accesses that should be
22 performed on the device. If this property is not present then single byte 22 performed on the device. If this property is not present then single byte
23 accesses are used. 23 accesses are used.
24- dcd-override : Override the DCD modem status signal. This signal will always
25 be reported as active instead of being obtained from the modem status
26 register. Define this if your serial port does not use this pin.
27- dsr-override : Override the DTS modem status signal. This signal will always
28 be reported as active instead of being obtained from the modem status
29 register. Define this if your serial port does not use this pin.
30- cts-override : Override the CTS modem status signal. This signal will always
31 be reported as active instead of being obtained from the modem status
32 register. Define this if your serial port does not use this pin.
33- ri-override : Override the RI modem status signal. This signal will always be
34 reported as inactive instead of being obtained from the modem status register.
35 Define this if your serial port does not use this pin.
24 36
25Example: 37Example:
26 38
@@ -31,6 +43,10 @@ Example:
31 interrupts = <10>; 43 interrupts = <10>;
32 reg-shift = <2>; 44 reg-shift = <2>;
33 reg-io-width = <4>; 45 reg-io-width = <4>;
46 dcd-override;
47 dsr-override;
48 cts-override;
49 ri-override;
34 }; 50 };
35 51
36Example with one clock: 52Example with one clock:
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;