History

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.

Desmond Liu committed 11 years ago

Commit dfd37661 parent 7cf91102 files · +48 −0Browse files

Unified · Split

2 files
  1. Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt +16 −0
  2. drivers/tty/serial/8250/8250_dw.c +32 −0
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt+16−0
@@ -21,6 +21,18 @@ Optional properties: · 20 unmodified lines
21- reg-io-width : the size (in bytes) of the IO accesses that should be21- 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 byte22 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: · 4 unmodified lines
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:
drivers/tty/serial/8250/8250_dw.c+32−0
@@ -59,6 +59,8 @@ struct dw8250_data { · 58 unmodified lines
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) · 16 unmodified lines
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, · 247 unmodified lines
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;