From 14b63a5c36cc1148472cd9a385301b2a74223c90 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 19 Oct 2004 17:22:21 +0100 Subject: [PATCH] [SERIAL] Make port autoprobing set up->capabilities. Convert port autoprobing to set up->capabilities as it discovers various capabilities of the port. Warn when the detected capabilities do not match those in the uart_config table. --- drivers/serial/8250.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index e8b24bc57774f..6f0351fdfcdb5 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -490,6 +490,11 @@ static void autoconfig_has_efr(struct uart_8250_port *up) { unsigned char id1, id2, id3, rev, saved_dll, saved_dlm; + /* + * Everything with an EFR has SLEEP + */ + up->capabilities |= UART_CAP_EFR | UART_CAP_SLEEP; + /* * First we check to see if it's an Oxford Semiconductor UART. * @@ -600,6 +605,7 @@ static void autoconfig_16550a(struct uart_8250_port *up) unsigned char status1, status2; up->port.type = PORT_16550A; + up->capabilities |= UART_CAP_FIFO; /* * Check for presence of the EFR when DLAB is set. @@ -611,6 +617,7 @@ static void autoconfig_16550a(struct uart_8250_port *up) if (serial_in(up, UART_EFR) != 0) { DEBUG_AUTOCONF("EFRv1 "); up->port.type = PORT_16650; + up->capabilities |= UART_CAP_EFR | UART_CAP_SLEEP; } else { DEBUG_AUTOCONF("Motorola 8xxx DUART "); } @@ -663,6 +670,7 @@ static void autoconfig_16550a(struct uart_8250_port *up) #endif up->port.type = PORT_NS16550A; + up->capabilities |= UART_NATSEMI; return; } } @@ -686,6 +694,7 @@ static void autoconfig_16550a(struct uart_8250_port *up) if (status1 == 6 && status2 == 7) { up->port.type = PORT_16750; + up->capabilities |= UART_CAP_AFE | UART_CAP_SLEEP; return; } } @@ -716,6 +725,8 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) spin_lock_irqsave(&up->port.lock, flags); // save_flags(flags); cli(); + up->capabilities = 0; + if (!(up->port.flags & UPF_BUGGY_UART)) { /* * Do a simple existence test first; if we fail this, @@ -826,6 +837,13 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) #endif serial_outp(up, UART_LCR, save_lcr); + if (up->capabilities != uart_config[up->port.type].flags) { + printk(KERN_WARNING + "ttyS%d: detected caps %08x should be %08x\n", + up->port.line, up->capabilities, + uart_config[up->port.type].flags); + } + up->port.fifosize = uart_config[up->port.type].fifo_size; up->capabilities = uart_config[up->port.type].flags; up->tx_loadsz = uart_config[up->port.type].tx_loadsz; -- 2.53.0