aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250.c
diff options
context:
space:
mode:
authorArtem B. Bityuckiy <dedekind@infradead.org>2005-07-06 10:43:18 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-07-06 13:40:38 -0400
commitb3539219c9ea20ebf6a5ea3cc534f423a3607c41 (patch)
treed17c31c0eac0a7290ba5011b59a100fd9e9c9532 /drivers/serial/8250.c
parent6430a8def12edebc1c9c7c2621d33ca0e8653c33 (diff)
parenta18bcb7450840f07a772a45229de4811d930f461 (diff)
Merge with rsync://fileserver/linux
Update to 2.6.12-rc3
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r--drivers/serial/8250.c61
1 files changed, 28 insertions, 33 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index d8b9d2b8c200..7e8fc7c1d4cc 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -77,23 +77,9 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
77 */ 77 */
78#define is_real_interrupt(irq) ((irq) != 0) 78#define is_real_interrupt(irq) ((irq) != 0)
79 79
80/*
81 * This converts from our new CONFIG_ symbols to the symbols
82 * that asm/serial.h expects. You _NEED_ to comment out the
83 * linux/config.h include contained inside asm/serial.h for
84 * this to work.
85 */
86#undef CONFIG_SERIAL_MANY_PORTS
87#undef CONFIG_SERIAL_DETECT_IRQ
88#undef CONFIG_SERIAL_MULTIPORT
89#undef CONFIG_HUB6
90
91#ifdef CONFIG_SERIAL_8250_DETECT_IRQ 80#ifdef CONFIG_SERIAL_8250_DETECT_IRQ
92#define CONFIG_SERIAL_DETECT_IRQ 1 81#define CONFIG_SERIAL_DETECT_IRQ 1
93#endif 82#endif
94#ifdef CONFIG_SERIAL_8250_MULTIPORT
95#define CONFIG_SERIAL_MULTIPORT 1
96#endif
97#ifdef CONFIG_SERIAL_8250_MANY_PORTS 83#ifdef CONFIG_SERIAL_8250_MANY_PORTS
98#define CONFIG_SERIAL_MANY_PORTS 1 84#define CONFIG_SERIAL_MANY_PORTS 1
99#endif 85#endif
@@ -119,7 +105,7 @@ static struct old_serial_port old_serial_port[] = {
119 SERIAL_PORT_DFNS /* defined in asm/serial.h */ 105 SERIAL_PORT_DFNS /* defined in asm/serial.h */
120}; 106};
121 107
122#define UART_NR (ARRAY_SIZE(old_serial_port) + CONFIG_SERIAL_8250_NR_UARTS) 108#define UART_NR CONFIG_SERIAL_8250_NR_UARTS
123 109
124#ifdef CONFIG_SERIAL_8250_RSA 110#ifdef CONFIG_SERIAL_8250_RSA
125 111
@@ -1007,21 +993,24 @@ static void autoconfig_irq(struct uart_8250_port *up)
1007 up->port.irq = (irq > 0) ? irq : 0; 993 up->port.irq = (irq > 0) ? irq : 0;
1008} 994}
1009 995
996static inline void __stop_tx(struct uart_8250_port *p)
997{
998 if (p->ier & UART_IER_THRI) {
999 p->ier &= ~UART_IER_THRI;
1000 serial_out(p, UART_IER, p->ier);
1001 }
1002}
1003
1010static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop) 1004static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop)
1011{ 1005{
1012 struct uart_8250_port *up = (struct uart_8250_port *)port; 1006 struct uart_8250_port *up = (struct uart_8250_port *)port;
1013 1007
1014 if (up->ier & UART_IER_THRI) { 1008 __stop_tx(up);
1015 up->ier &= ~UART_IER_THRI;
1016 serial_out(up, UART_IER, up->ier);
1017 }
1018 1009
1019 /* 1010 /*
1020 * We only do this from uart_stop - if we run out of 1011 * We really want to stop the transmitter from sending.
1021 * characters to send, we don't want to prevent the
1022 * FIFO from emptying.
1023 */ 1012 */
1024 if (up->port.type == PORT_16C950 && tty_stop) { 1013 if (up->port.type == PORT_16C950) {
1025 up->acr |= UART_ACR_TXDIS; 1014 up->acr |= UART_ACR_TXDIS;
1026 serial_icr_write(up, UART_ACR, up->acr); 1015 serial_icr_write(up, UART_ACR, up->acr);
1027 } 1016 }
@@ -1045,10 +1034,11 @@ static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
1045 transmit_chars(up); 1034 transmit_chars(up);
1046 } 1035 }
1047 } 1036 }
1037
1048 /* 1038 /*
1049 * We only do this from uart_start 1039 * Re-enable the transmitter if we disabled it.
1050 */ 1040 */
1051 if (tty_start && up->port.type == PORT_16C950) { 1041 if (up->port.type == PORT_16C950 && up->acr & UART_ACR_TXDIS) {
1052 up->acr &= ~UART_ACR_TXDIS; 1042 up->acr &= ~UART_ACR_TXDIS;
1053 serial_icr_write(up, UART_ACR, up->acr); 1043 serial_icr_write(up, UART_ACR, up->acr);
1054 } 1044 }
@@ -1169,7 +1159,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up)
1169 return; 1159 return;
1170 } 1160 }
1171 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { 1161 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
1172 serial8250_stop_tx(&up->port, 0); 1162 __stop_tx(up);
1173 return; 1163 return;
1174 } 1164 }
1175 1165
@@ -1188,7 +1178,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up)
1188 DEBUG_INTR("THRE..."); 1178 DEBUG_INTR("THRE...");
1189 1179
1190 if (uart_circ_empty(xmit)) 1180 if (uart_circ_empty(xmit))
1191 serial8250_stop_tx(&up->port, 0); 1181 __stop_tx(up);
1192} 1182}
1193 1183
1194static _INLINE_ void check_modem_status(struct uart_8250_port *up) 1184static _INLINE_ void check_modem_status(struct uart_8250_port *up)
@@ -1390,13 +1380,10 @@ static unsigned int serial8250_tx_empty(struct uart_port *port)
1390static unsigned int serial8250_get_mctrl(struct uart_port *port) 1380static unsigned int serial8250_get_mctrl(struct uart_port *port)
1391{ 1381{
1392 struct uart_8250_port *up = (struct uart_8250_port *)port; 1382 struct uart_8250_port *up = (struct uart_8250_port *)port;
1393 unsigned long flags;
1394 unsigned char status; 1383 unsigned char status;
1395 unsigned int ret; 1384 unsigned int ret;
1396 1385
1397 spin_lock_irqsave(&up->port.lock, flags);
1398 status = serial_in(up, UART_MSR); 1386 status = serial_in(up, UART_MSR);
1399 spin_unlock_irqrestore(&up->port.lock, flags);
1400 1387
1401 ret = 0; 1388 ret = 0;
1402 if (status & UART_MSR_DCD) 1389 if (status & UART_MSR_DCD)
@@ -2074,7 +2061,8 @@ static void __init serial8250_isa_init_ports(void)
2074 up->port.ops = &serial8250_pops; 2061 up->port.ops = &serial8250_pops;
2075 } 2062 }
2076 2063
2077 for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port); 2064 for (i = 0, up = serial8250_ports;
2065 i < ARRAY_SIZE(old_serial_port) && i < UART_NR;
2078 i++, up++) { 2066 i++, up++) {
2079 up->port.iobase = old_serial_port[i].port; 2067 up->port.iobase = old_serial_port[i].port;
2080 up->port.irq = irq_canonicalize(old_serial_port[i].irq); 2068 up->port.irq = irq_canonicalize(old_serial_port[i].irq);
@@ -2323,10 +2311,11 @@ static int __devinit serial8250_probe(struct device *dev)
2323{ 2311{
2324 struct plat_serial8250_port *p = dev->platform_data; 2312 struct plat_serial8250_port *p = dev->platform_data;
2325 struct uart_port port; 2313 struct uart_port port;
2314 int ret, i;
2326 2315
2327 memset(&port, 0, sizeof(struct uart_port)); 2316 memset(&port, 0, sizeof(struct uart_port));
2328 2317
2329 for (; p && p->flags != 0; p++) { 2318 for (i = 0; p && p->flags != 0; p++, i++) {
2330 port.iobase = p->iobase; 2319 port.iobase = p->iobase;
2331 port.membase = p->membase; 2320 port.membase = p->membase;
2332 port.irq = p->irq; 2321 port.irq = p->irq;
@@ -2335,10 +2324,16 @@ static int __devinit serial8250_probe(struct device *dev)
2335 port.iotype = p->iotype; 2324 port.iotype = p->iotype;
2336 port.flags = p->flags; 2325 port.flags = p->flags;
2337 port.mapbase = p->mapbase; 2326 port.mapbase = p->mapbase;
2327 port.hub6 = p->hub6;
2338 port.dev = dev; 2328 port.dev = dev;
2339 if (share_irqs) 2329 if (share_irqs)
2340 port.flags |= UPF_SHARE_IRQ; 2330 port.flags |= UPF_SHARE_IRQ;
2341 serial8250_register_port(&port); 2331 ret = serial8250_register_port(&port);
2332 if (ret < 0) {
2333 dev_err(dev, "unable to register port at index %d "
2334 "(IO%lx MEM%lx IRQ%d): %d\n", i,
2335 p->iobase, p->mapbase, p->irq, ret);
2336 }
2342 } 2337 }
2343 return 0; 2338 return 0;
2344} 2339}