Skip to content

Commit 9636b75

Browse files
diandersgregkh
authored andcommitted
tty/serial: Prevent drop of DCD on suspend for Tegra UARTs
On Tegra UARTs (except UART1), the DTR / DCD / DSR lines are not externally accessible. Instead, the DTR line internally appears to be looped back to be the input to the DCD and DSR lines. The net effect of this is that when we drop DTR (like when we suspend), we'll see DCD drop too. ...and when we see DCD drop, we treat that as a hangup. In order to prevent this hangup from occurring at every sleep, we need to force DTR to remain high on Tegra UARTs. This patch uses the mcr_mask / mcr_force fields, which were originally added for the kludge ALPHA_KLUDGE_MCR. Using these fields does not prevent us from removing ALPHA_KLUDGE_MCR--we can just remove the "if" tests I have added and always init mcr_mask / mcr_force from the serial8250_config. NOTE: If we have people that are using UARTA on a Tegra and need to control DTR, we'll need to either add a separate port type for UARTA or we'll need to add some tegra-specific code to detect whether the DTR needs to be left high. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent eca9dfa commit 9636b75

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎drivers/tty/serial/8250.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ static const struct serial8250_config uart_config[] = {
308308
.fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01 |
309309
UART_FCR_T_TRIG_01,
310310
.flags = UART_CAP_FIFO | UART_CAP_RTOIE,
311+
.mcr_mask = ~UART_MCR_DTR,
312+
.mcr_force = UART_MCR_DTR,
311313
},
312314
[PORT_XR17D15X] = {
313315
.name = "XR17D15X",
@@ -1229,6 +1231,10 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
12291231
up->port.fifosize = uart_config[up->port.type].fifo_size;
12301232
up->capabilities = uart_config[up->port.type].flags;
12311233
up->tx_loadsz = uart_config[up->port.type].tx_loadsz;
1234+
if (!ALPHA_KLUDGE_MCR) {
1235+
up->mcr_mask = uart_config[up->port.type].mcr_mask;
1236+
up->mcr_force = uart_config[up->port.type].mcr_force;
1237+
}
12321238

12331239
if (up->port.type == PORT_UNKNOWN)
12341240
goto out;
@@ -1987,6 +1993,10 @@ static int serial8250_startup(struct uart_port *port)
19871993
up->port.fifosize = uart_config[up->port.type].fifo_size;
19881994
up->tx_loadsz = uart_config[up->port.type].tx_loadsz;
19891995
up->capabilities = uart_config[up->port.type].flags;
1996+
if (!ALPHA_KLUDGE_MCR) {
1997+
up->mcr_mask = uart_config[up->port.type].mcr_mask;
1998+
up->mcr_force = uart_config[up->port.type].mcr_force;
1999+
}
19902000
up->mcr = 0;
19912001

19922002
if (up->port.iotype != up->cur_iotype)
@@ -2793,6 +2803,10 @@ serial8250_init_fixed_type_port(struct uart_8250_port *up, unsigned int type)
27932803
up->port.fifosize = uart_config[type].fifo_size;
27942804
up->capabilities = uart_config[type].flags;
27952805
up->tx_loadsz = uart_config[type].tx_loadsz;
2806+
if (!ALPHA_KLUDGE_MCR) {
2807+
up->mcr_mask = uart_config[type].mcr_mask;
2808+
up->mcr_force = uart_config[type].mcr_force;
2809+
}
27962810
}
27972811

27982812
static void __init

‎drivers/tty/serial/8250.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ struct serial8250_config {
3535
unsigned short tx_loadsz;
3636
unsigned char fcr;
3737
unsigned int flags;
38+
unsigned char mcr_mask;
39+
unsigned char mcr_force;
3840
};
3941

4042
#define UART_CAP_FIFO (1 << 8) /* UART has FIFO */

0 commit comments

Comments
 (0)