]> git.hungrycats.org Git - linux/commitdiff
[SERIAL] Convert TI16C750 flow control into a port capability.
authorRussell King <rmk@flint.arm.linux.org.uk>
Tue, 19 Oct 2004 15:37:05 +0000 (16:37 +0100)
committerRussell King <rmk@flint.arm.linux.org.uk>
Tue, 19 Oct 2004 15:37:05 +0000 (16:37 +0100)
Add UART_CAP_AFE, and use this to enable TI16C750 flow control,
but only if we have 32 bytes or more of FIFO.

drivers/serial/8250.c
drivers/serial/8250.h

index 6e2e62dec267e4ec9d9618bdb20d3b7b0c96bac1..7e63a7fe645ff1aa0cbe4bdb9edcbb25ad6430a4 100644 (file)
@@ -210,7 +210,7 @@ static const struct serial8250_config uart_config[] = {
                .tx_loadsz      = 64,
                .fcr            = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 |
                                  UART_FCR7_64BYTE,
-               .flags          = UART_CAP_FIFO | UART_CAP_SLEEP,
+               .flags          = UART_CAP_FIFO | UART_CAP_SLEEP | UART_CAP_AFE,
        },
        [PORT_STARTECH] = {
                .name           = "Startech",
@@ -1584,11 +1584,14 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
        }
 
        /*
-        * TI16C750: hardware flow control and 64 byte FIFOs. When AFE is
-        * enabled, RTS will be deasserted when the receive FIFO contains
-        * more characters than the trigger, or the MCR RTS bit is cleared.
+        * MCR-based auto flow control.  When AFE is enabled, RTS will be
+        * deasserted when the receive FIFO contains more characters than
+        * the trigger, or the MCR RTS bit is cleared.  In the case where
+        * the remote UART is not using CTS auto flow control, we must
+        * have sufficient FIFO entries for the latency of the remote
+        * UART to respond.  IOW, at least 32 bytes of FIFO.
         */
-       if (up->port.type == PORT_16750) {
+       if (up->capabilities & UART_CAP_AFE && up->port.fifosize >= 32) {
                up->mcr &= ~UART_MCR_AFE;
                if (termios->c_cflag & CRTSCTS)
                        up->mcr |= UART_MCR_AFE;
index bbf767dbde067a7e4323f6e9e5741c6b755d301f..dcf585929ae8047adb4df820c9bb9082fef9c570 100644 (file)
@@ -47,6 +47,7 @@ struct serial8250_config {
 #define UART_CAP_FIFO  (1 << 8)        /* UART has FIFO */
 #define UART_CAP_EFR   (1 << 9)        /* UART has EFR */
 #define UART_CAP_SLEEP (1 << 10)       /* UART has IER sleep */
+#define UART_CAP_AFE   (1 << 11)       /* MCR-based hw flow control */
 
 #undef SERIAL_DEBUG_PCI