patch-2.4.2 linux/drivers/char/serial.c
Next file: linux/drivers/char/serial_21285.c
Previous file: linux/drivers/char/selection.c
Back to the patch index
Back to the overall index
- Lines: 114
- Date:
Fri Feb 16 16:02:36 2001
- Orig file:
v2.4.1/linux/drivers/char/serial.c
- Orig date:
Wed Dec 6 12:06:18 2000
diff -u --recursive --new-file v2.4.1/linux/drivers/char/serial.c linux/drivers/char/serial.c
@@ -28,7 +28,7 @@
* Stanislav V. Voronyi <stas@uanet.kharkov.ua>
*
* 3/98: Change the IRQ detection, use of probe_irq_o*(),
- * supress TIOCSERGWILD and TIOCSERSWILD
+ * suppress TIOCSERGWILD and TIOCSERSWILD
* Etienne Lorrain <etienne.lorrain@ibm.net>
*
* 4/98: Added changes to support the ARM architecture proposed by
@@ -54,6 +54,9 @@
* 7/00: fix some returns on failure not using MOD_DEC_USE_COUNT.
* Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
+ * 10/00: add in optional hardware flow control for serial console.
+ * Kanoj Sarcar <kanoj@sgi.com>
+ *
* This module exports the following rs232 io functions:
*
* int rs_init(void);
@@ -162,9 +165,6 @@
* End of serial driver configuration section.
*/
-#ifdef MODVERSIONS
-#include <linux/modversions.h>
-#endif
#include <linux/module.h>
#include <linux/types.h>
@@ -5252,6 +5252,36 @@
}
/*
+ * This is for use by architectures that know their serial port
+ * attributes only at run time. Not to be invoked after rs_init().
+ */
+int __init early_serial_setup(struct serial_struct *req)
+{
+ int i = req->line;
+
+ if (i >= NR_IRQS)
+ return(-ENOENT);
+ rs_table[i].magic = 0;
+ rs_table[i].baud_base = req->baud_base;
+ rs_table[i].port = req->port;
+ if (HIGH_BITS_OFFSET)
+ rs_table[i].port += (unsigned long) req->port_high <<
+ HIGH_BITS_OFFSET;
+ rs_table[i].irq = req->irq;
+ rs_table[i].flags = req->flags;
+ rs_table[i].close_delay = req->close_delay;
+ rs_table[i].io_type = req->io_type;
+ rs_table[i].hub6 = req->hub6;
+ rs_table[i].iomem_base = req->iomem_base;
+ rs_table[i].iomem_reg_shift = req->iomem_reg_shift;
+ rs_table[i].type = req->type;
+ rs_table[i].xmit_fifo_size = req->xmit_fifo_size;
+ rs_table[i].custom_divisor = req->custom_divisor;
+ rs_table[i].closing_wait = req->closing_wait;
+ return(0);
+}
+
+/*
* register_serial and unregister_serial allows for 16x50 serial ports to be
* configured at run-time, to support PCMCIA modems.
*/
@@ -5461,6 +5491,10 @@
if (--tmout == 0)
break;
} while((status & BOTH_EMPTY) != BOTH_EMPTY);
+ if (info->flags & ASYNC_NO_FLOW)
+ return;
+ tmout = 1000000;
+ while (--tmout && ((serial_in(info, UART_MSR) & UART_MSR_CTS) == 0));
}
@@ -5543,7 +5577,7 @@
}
/*
- * Setup initial baud/bits/parity. We do two things here:
+ * Setup initial baud/bits/parity/flow. We do two things here:
* - construct a cflag setting for the first rs_open()
* - initialize the serial port
* Return non-zero if we didn't find a serial port.
@@ -5556,6 +5590,7 @@
int baud = 9600;
int bits = 8;
int parity = 'n';
+ int doflow = 0;
int cflag = CREAD | HUPCL | CLOCAL;
int quot = 0;
char *s;
@@ -5566,7 +5601,9 @@
while(*s >= '0' && *s <= '9')
s++;
if (*s) parity = *s++;
- if (*s) bits = *s - '0';
+ if (*s) bits = *s++ - '0';
+ if ((*s) && (!strcmp(s, "rtscts")))
+ doflow = 1;
}
/*
@@ -5622,6 +5659,8 @@
* Divisor, bytesize and parity
*/
state = rs_table + co->index;
+ if (doflow == 0)
+ state->flags |= ASYNC_NO_FLOW;
info = &async_sercons;
info->magic = SERIAL_MAGIC;
info->state = state;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)