aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/21285.c2
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/serial/8250_hp300.c53
-rw-r--r--drivers/serial/8250_pci.c2
-rw-r--r--drivers/serial/amba-pl010.c2
-rw-r--r--drivers/serial/amba-pl011.c2
-rw-r--r--drivers/serial/clps711x.c65
-rw-r--r--drivers/serial/imx.c68
-rw-r--r--drivers/serial/ioc4_serial.c50
-rw-r--r--drivers/serial/jsm/jsm.h1
-rw-r--r--drivers/serial/jsm/jsm_neo.c2
-rw-r--r--drivers/serial/jsm/jsm_tty.c4
-rw-r--r--drivers/serial/mpsc.c14
-rw-r--r--drivers/serial/mpsc.h10
-rw-r--r--drivers/serial/s3c2410.c2
-rw-r--r--drivers/serial/sa1100.c65
-rw-r--r--drivers/serial/serial_cs.c173
-rw-r--r--drivers/serial/serial_lh7a40x.c2
-rw-r--r--drivers/serial/sn_console.c4
-rw-r--r--drivers/serial/sunsab.c16
-rw-r--r--drivers/serial/sunsu.c11
21 files changed, 315 insertions, 235 deletions
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index f8504b0adebc..33fbda79f350 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -110,7 +110,7 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id, struct pt_regs *r
110 port->icount.rx++; 110 port->icount.rx++;
111 111
112 rxs = *CSR_RXSTAT | RXSTAT_DUMMY_READ; 112 rxs = *CSR_RXSTAT | RXSTAT_DUMMY_READ;
113 if (rxs & RXSTAT_ANYERR) { 113 if (unlikely(rxs & RXSTAT_ANYERR)) {
114 if (rxs & RXSTAT_PARITY) 114 if (rxs & RXSTAT_PARITY)
115 port->icount.parity++; 115 port->icount.parity++;
116 else if (rxs & RXSTAT_FRAME) 116 else if (rxs & RXSTAT_FRAME)
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 218b69372c0b..0d9358608fdf 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -51,7 +51,7 @@
51 * share_irqs - whether we pass SA_SHIRQ to request_irq(). This option 51 * share_irqs - whether we pass SA_SHIRQ to request_irq(). This option
52 * is unsafe when used on edge-triggered interrupts. 52 * is unsafe when used on edge-triggered interrupts.
53 */ 53 */
54unsigned int share_irqs = SERIAL8250_SHARE_IRQS; 54static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
55 55
56/* 56/*
57 * Debugging. 57 * Debugging.
diff --git a/drivers/serial/8250_hp300.c b/drivers/serial/8250_hp300.c
index b8d51eb56bff..4315afe9c080 100644
--- a/drivers/serial/8250_hp300.c
+++ b/drivers/serial/8250_hp300.c
@@ -9,15 +9,15 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/tty.h>
13#include <linux/serial.h> 12#include <linux/serial.h>
14#include <linux/serialP.h>
15#include <linux/serial_core.h> 13#include <linux/serial_core.h>
16#include <linux/delay.h> 14#include <linux/delay.h>
17#include <linux/dio.h> 15#include <linux/dio.h>
18#include <linux/console.h> 16#include <linux/console.h>
19#include <asm/io.h> 17#include <asm/io.h>
20 18
19#include "8250.h"
20
21#if !defined(CONFIG_HPDCA) && !defined(CONFIG_HPAPCI) 21#if !defined(CONFIG_HPDCA) && !defined(CONFIG_HPAPCI)
22#warning CONFIG_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure? 22#warning CONFIG_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure?
23#endif 23#endif
@@ -163,7 +163,7 @@ int __init hp300_setup_serial_console(void)
163static int __devinit hpdca_init_one(struct dio_dev *d, 163static int __devinit hpdca_init_one(struct dio_dev *d,
164 const struct dio_device_id *ent) 164 const struct dio_device_id *ent)
165{ 165{
166 struct serial_struct serial_req; 166 struct uart_port port;
167 int line; 167 int line;
168 168
169#ifdef CONFIG_SERIAL_8250_CONSOLE 169#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -172,21 +172,22 @@ static int __devinit hpdca_init_one(struct dio_dev *d,
172 return 0; 172 return 0;
173 } 173 }
174#endif 174#endif
175 memset(&serial_req, 0, sizeof(struct serial_struct)); 175 memset(&port, 0, sizeof(struct uart_port));
176 176
177 /* Memory mapped I/O */ 177 /* Memory mapped I/O */
178 serial_req.io_type = SERIAL_IO_MEM; 178 port.iotype = UPIO_MEM;
179 serial_req.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; 179 port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF;
180 serial_req.irq = d->ipl; 180 port.irq = d->ipl;
181 serial_req.baud_base = HPDCA_BAUD_BASE; 181 port.uartclk = HPDCA_BAUD_BASE * 16;
182 serial_req.iomap_base = (d->resource.start + UART_OFFSET); 182 port.mapbase = (d->resource.start + UART_OFFSET);
183 serial_req.iomem_base = (char *)(serial_req.iomap_base + DIO_VIRADDRBASE); 183 port.membase = (char *)(port.mapbase + DIO_VIRADDRBASE);
184 serial_req.iomem_reg_shift = 1; 184 port.regshift = 1;
185 line = register_serial(&serial_req); 185 port.dev = &d->dev;
186 line = serial8250_register_port(&port);
186 187
187 if (line < 0) { 188 if (line < 0) {
188 printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d" 189 printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d"
189 " irq %d failed\n", d->scode, serial_req.irq); 190 " irq %d failed\n", d->scode, port.irq);
190 return -ENOMEM; 191 return -ENOMEM;
191 } 192 }
192 193
@@ -209,7 +210,7 @@ static int __init hp300_8250_init(void)
209#ifdef CONFIG_HPAPCI 210#ifdef CONFIG_HPAPCI
210 int line; 211 int line;
211 unsigned long base; 212 unsigned long base;
212 struct serial_struct serial_req; 213 struct uart_port uport;
213 struct hp300_port *port; 214 struct hp300_port *port;
214 int i; 215 int i;
215#endif 216#endif
@@ -251,25 +252,25 @@ static int __init hp300_8250_init(void)
251 if (!port) 252 if (!port)
252 return -ENOMEM; 253 return -ENOMEM;
253 254
254 memset(&serial_req, 0, sizeof(struct serial_struct)); 255 memset(&uport, 0, sizeof(struct uart_port));
255 256
256 base = (FRODO_BASE + FRODO_APCI_OFFSET(i)); 257 base = (FRODO_BASE + FRODO_APCI_OFFSET(i));
257 258
258 /* Memory mapped I/O */ 259 /* Memory mapped I/O */
259 serial_req.io_type = SERIAL_IO_MEM; 260 uport.iotype = UPIO_MEM;
260 serial_req.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; 261 uport.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF;
261 /* XXX - no interrupt support yet */ 262 /* XXX - no interrupt support yet */
262 serial_req.irq = 0; 263 uport.irq = 0;
263 serial_req.baud_base = HPAPCI_BAUD_BASE; 264 uport.uartclk = HPAPCI_BAUD_BASE * 16;
264 serial_req.iomap_base = base; 265 uport.mapbase = base;
265 serial_req.iomem_base = (char *)(serial_req.iomap_base + DIO_VIRADDRBASE); 266 uport.membase = (char *)(base + DIO_VIRADDRBASE);
266 serial_req.iomem_reg_shift = 2; 267 uport.regshift = 2;
267 268
268 line = register_serial(&serial_req); 269 line = serial8250_register_port(&uport);
269 270
270 if (line < 0) { 271 if (line < 0) {
271 printk(KERN_NOTICE "8250_hp300: register_serial() APCI %d" 272 printk(KERN_NOTICE "8250_hp300: register_serial() APCI %d"
272 " irq %d failed\n", i, serial_req.irq); 273 " irq %d failed\n", i, uport.irq);
273 kfree(port); 274 kfree(port);
274 continue; 275 continue;
275 } 276 }
@@ -299,7 +300,7 @@ static void __devexit hpdca_remove_one(struct dio_dev *d)
299 /* Disable board-interrupts */ 300 /* Disable board-interrupts */
300 out_8(d->resource.start + DIO_VIRADDRBASE + DCA_IC, 0); 301 out_8(d->resource.start + DIO_VIRADDRBASE + DCA_IC, 0);
301 } 302 }
302 unregister_serial(line); 303 serial8250_unregister_port(line);
303} 304}
304#endif 305#endif
305 306
@@ -309,7 +310,7 @@ static void __exit hp300_8250_exit(void)
309 struct hp300_port *port, *to_free; 310 struct hp300_port *port, *to_free;
310 311
311 for (port = hp300_ports; port; ) { 312 for (port = hp300_ports; port; ) {
312 unregister_serial(port->line); 313 serial8250_unregister_port(port->line);
313 to_free = port; 314 to_free = port;
314 port = port->next; 315 port = port->next;
315 kfree(to_free); 316 kfree(to_free);
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index f8d90d0ecfea..de54bdc5398b 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -1009,6 +1009,8 @@ get_pci_irq(struct pci_dev *dev, struct pci_board *board, int idx)
1009 * n = number of serial ports 1009 * n = number of serial ports
1010 * baud = baud rate 1010 * baud = baud rate
1011 * 1011 *
1012 * This table is sorted by (in order): baud, bt, bn, n.
1013 *
1012 * Please note: in theory if n = 1, _bt infix should make no difference. 1014 * Please note: in theory if n = 1, _bt infix should make no difference.
1013 * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200 1015 * ie, pbn_b0_1_115200 is the same as pbn_b0_bt_1_115200
1014 */ 1016 */
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 484f6fb900b5..f2a5e2933c47 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -172,7 +172,7 @@ pl010_rx_chars(struct uart_port *port)
172 * out of the main execution path 172 * out of the main execution path
173 */ 173 */
174 rsr = UART_GET_RSR(port) | UART_DUMMY_RSR_RX; 174 rsr = UART_GET_RSR(port) | UART_DUMMY_RSR_RX;
175 if (rsr & UART01x_RSR_ANY) { 175 if (unlikely(rsr & UART01x_RSR_ANY)) {
176 if (rsr & UART01x_RSR_BE) { 176 if (rsr & UART01x_RSR_BE) {
177 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); 177 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
178 port->icount.brk++; 178 port->icount.brk++;
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index ff658a830f34..d5cbef3fe8b6 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -137,7 +137,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
137 * out of the main execution path 137 * out of the main execution path
138 */ 138 */
139 rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; 139 rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
140 if (rsr & UART01x_RSR_ANY) { 140 if (unlikely(rsr & UART01x_RSR_ANY)) {
141 if (rsr & UART01x_RSR_BE) { 141 if (rsr & UART01x_RSR_BE) {
142 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); 142 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
143 uap->port.icount.brk++; 143 uap->port.icount.brk++;
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c
index 16592fae47f3..6242f3090a96 100644
--- a/drivers/serial/clps711x.c
+++ b/drivers/serial/clps711x.c
@@ -116,54 +116,43 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re
116 * Note that the error handling code is 116 * Note that the error handling code is
117 * out of the main execution path 117 * out of the main execution path
118 */ 118 */
119 if (ch & UART_ANY_ERR) 119 if (unlikely(ch & UART_ANY_ERR)) {
120 goto handle_error; 120 if (ch & UARTDR_PARERR)
121 port->icount.parity++;
122 else if (ch & UARTDR_FRMERR)
123 port->icount.frame++;
124 if (ch & UARTDR_OVERR)
125 port->icount.overrun++;
121 126
122 if (uart_handle_sysrq_char(port, ch, regs)) 127 ch &= port->read_status_mask;
123 goto ignore_char;
124 128
125 error_return: 129 if (ch & UARTDR_PARERR)
126 tty_insert_flip_char(tty, ch, flg); 130 flg = TTY_PARITY;
127 ignore_char: 131 else if (ch & UARTDR_FRMERR)
128 status = clps_readl(SYSFLG(port)); 132 flg = TTY_FRAME;
129 }
130 out:
131 tty_flip_buffer_push(tty);
132 return IRQ_HANDLED;
133 133
134 handle_error: 134#ifdef SUPPORT_SYSRQ
135 if (ch & UARTDR_PARERR) 135 port->sysrq = 0;
136 port->icount.parity++; 136#endif
137 else if (ch & UARTDR_FRMERR) 137 }
138 port->icount.frame++;
139 if (ch & UARTDR_OVERR)
140 port->icount.overrun++;
141
142 if (ch & port->ignore_status_mask) {
143 if (++ignored > 100)
144 goto out;
145 goto ignore_char;
146 }
147 ch &= port->read_status_mask;
148 138
149 if (ch & UARTDR_PARERR) 139 if (uart_handle_sysrq_char(port, ch, regs))
150 flg = TTY_PARITY; 140 goto ignore_char;
151 else if (ch & UARTDR_FRMERR)
152 flg = TTY_FRAME;
153 141
154 if (ch & UARTDR_OVERR) {
155 /* 142 /*
156 * CHECK: does overrun affect the current character? 143 * CHECK: does overrun affect the current character?
157 * ASSUMPTION: it does not. 144 * ASSUMPTION: it does not.
158 */ 145 */
159 tty_insert_flip_char(tty, ch, flg); 146 if ((ch & port->ignore_status_mask & ~RXSTAT_OVERRUN) == 0)
160 ch = 0; 147 tty_insert_flip_char(tty, ch, flg);
161 flg = TTY_OVERRUN; 148 if ((ch & ~port->ignore_status_mask & RXSTAT_OVERRUN) == 0)
149 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
150
151 ignore_char:
152 status = clps_readl(SYSFLG(port));
162 } 153 }
163#ifdef SUPPORT_SYSRQ 154 tty_flip_buffer_push(tty);
164 port->sysrq = 0; 155 return IRQ_HANDLED;
165#endif
166 goto error_return;
167} 156}
168 157
169static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs) 158static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs)
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index c682c6308cde..01a8726a3f97 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -321,18 +321,39 @@ static void imx_break_ctl(struct uart_port *port, int break_state)
321#define TXTL 2 /* reset default */ 321#define TXTL 2 /* reset default */
322#define RXTL 1 /* reset default */ 322#define RXTL 1 /* reset default */
323 323
324static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
325{
326 unsigned int val;
327 unsigned int ufcr_rfdiv;
328
329 /* set receiver / transmitter trigger level.
330 * RFDIV is set such way to satisfy requested uartclk value
331 */
332 val = TXTL<<10 | RXTL;
333 ufcr_rfdiv = (imx_get_perclk1() + sport->port.uartclk / 2) / sport->port.uartclk;
334
335 if(!ufcr_rfdiv)
336 ufcr_rfdiv = 1;
337
338 if(ufcr_rfdiv >= 7)
339 ufcr_rfdiv = 6;
340 else
341 ufcr_rfdiv = 6 - ufcr_rfdiv;
342
343 val |= UFCR_RFDIV & (ufcr_rfdiv << 7);
344
345 UFCR((u32)sport->port.membase) = val;
346
347 return 0;
348}
349
324static int imx_startup(struct uart_port *port) 350static int imx_startup(struct uart_port *port)
325{ 351{
326 struct imx_port *sport = (struct imx_port *)port; 352 struct imx_port *sport = (struct imx_port *)port;
327 int retval; 353 int retval;
328 unsigned int val;
329 unsigned long flags; 354 unsigned long flags;
330 355
331 /* set receiver / transmitter trigger level. We assume 356 imx_setup_ufcr(sport, 0);
332 * that RFDIV has been set by the arch setup or by the bootloader.
333 */
334 val = (UFCR((u32)sport->port.membase) & UFCR_RFDIV) | TXTL<<10 | RXTL;
335 UFCR((u32)sport->port.membase) = val;
336 357
337 /* disable the DREN bit (Data Ready interrupt enable) before 358 /* disable the DREN bit (Data Ready interrupt enable) before
338 * requesting IRQs 359 * requesting IRQs
@@ -737,9 +758,12 @@ static void __init
737imx_console_get_options(struct imx_port *sport, int *baud, 758imx_console_get_options(struct imx_port *sport, int *baud,
738 int *parity, int *bits) 759 int *parity, int *bits)
739{ 760{
761
740 if ( UCR1((u32)sport->port.membase) | UCR1_UARTEN ) { 762 if ( UCR1((u32)sport->port.membase) | UCR1_UARTEN ) {
741 /* ok, the port was enabled */ 763 /* ok, the port was enabled */
742 unsigned int ucr2, ubir,ubmr, uartclk; 764 unsigned int ucr2, ubir,ubmr, uartclk;
765 unsigned int baud_raw;
766 unsigned int ucfr_rfdiv;
743 767
744 ucr2 = UCR2((u32)sport->port.membase); 768 ucr2 = UCR2((u32)sport->port.membase);
745 769
@@ -758,9 +782,35 @@ imx_console_get_options(struct imx_port *sport, int *baud,
758 782
759 ubir = UBIR((u32)sport->port.membase) & 0xffff; 783 ubir = UBIR((u32)sport->port.membase) & 0xffff;
760 ubmr = UBMR((u32)sport->port.membase) & 0xffff; 784 ubmr = UBMR((u32)sport->port.membase) & 0xffff;
761 uartclk = sport->port.uartclk;
762 785
763 *baud = ((uartclk/16) * (ubir + 1)) / (ubmr + 1); 786
787 ucfr_rfdiv = (UFCR((u32)sport->port.membase) & UFCR_RFDIV) >> 7;
788 if (ucfr_rfdiv == 6)
789 ucfr_rfdiv = 7;
790 else
791 ucfr_rfdiv = 6 - ucfr_rfdiv;
792
793 uartclk = imx_get_perclk1();
794 uartclk /= ucfr_rfdiv;
795
796 { /*
797 * The next code provides exact computation of
798 * baud_raw = round(((uartclk/16) * (ubir + 1)) / (ubmr + 1))
799 * without need of float support or long long division,
800 * which would be required to prevent 32bit arithmetic overflow
801 */
802 unsigned int mul = ubir + 1;
803 unsigned int div = 16 * (ubmr + 1);
804 unsigned int rem = uartclk % div;
805
806 baud_raw = (uartclk / div) * mul;
807 baud_raw += (rem * mul + div / 2) / div;
808 *baud = (baud_raw + 50) / 100 * 100;
809 }
810
811 if(*baud != baud_raw)
812 printk(KERN_INFO "Serial: Console IMX rounded baud rate from %d to %d\n",
813 baud_raw, *baud);
764 } 814 }
765} 815}
766 816
@@ -787,6 +837,8 @@ imx_console_setup(struct console *co, char *options)
787 else 837 else
788 imx_console_get_options(sport, &baud, &parity, &bits); 838 imx_console_get_options(sport, &baud, &parity, &bits);
789 839
840 imx_setup_ufcr(sport, 0);
841
790 return uart_set_options(&sport->port, co, baud, parity, bits, flow); 842 return uart_set_options(&sport->port, co, baud, parity, bits, flow);
791} 843}
792 844
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index d054f1265701..ba4e13a22a50 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -838,7 +838,7 @@ static int inline port_init(struct ioc4_port *port)
838 port->ip_tx_prod = readl(&port->ip_serial_regs->stcir) & PROD_CONS_MASK; 838 port->ip_tx_prod = readl(&port->ip_serial_regs->stcir) & PROD_CONS_MASK;
839 writel(port->ip_tx_prod, &port->ip_serial_regs->stpir); 839 writel(port->ip_tx_prod, &port->ip_serial_regs->stpir);
840 port->ip_rx_cons = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK; 840 port->ip_rx_cons = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK;
841 writel(port->ip_rx_cons, &port->ip_serial_regs->srcir); 841 writel(port->ip_rx_cons | IOC4_SRCIR_ARM, &port->ip_serial_regs->srcir);
842 842
843 /* Disable interrupts for this 16550 */ 843 /* Disable interrupts for this 16550 */
844 uart = port->ip_uart_regs; 844 uart = port->ip_uart_regs;
@@ -1272,8 +1272,9 @@ static inline int set_rx_timeout(struct ioc4_port *port, int timeout)
1272 * and set the rx threshold to that amount. There are 4 chars 1272 * and set the rx threshold to that amount. There are 4 chars
1273 * per ring entry, so we'll divide the number of chars that will 1273 * per ring entry, so we'll divide the number of chars that will
1274 * arrive in timeout by 4. 1274 * arrive in timeout by 4.
1275 * So .... timeout * baud / 10 / HZ / 4, with HZ = 100.
1275 */ 1276 */
1276 threshold = timeout * port->ip_baud / 10 / HZ / 4; 1277 threshold = timeout * port->ip_baud / 4000;
1277 if (threshold == 0) 1278 if (threshold == 0)
1278 threshold = 1; /* otherwise we'll intr all the time! */ 1279 threshold = 1; /* otherwise we'll intr all the time! */
1279 1280
@@ -1285,8 +1286,10 @@ static inline int set_rx_timeout(struct ioc4_port *port, int timeout)
1285 1286
1286 writel(port->ip_sscr, &port->ip_serial_regs->sscr); 1287 writel(port->ip_sscr, &port->ip_serial_regs->sscr);
1287 1288
1288 /* Now set the rx timeout to the given value */ 1289 /* Now set the rx timeout to the given value
1289 timeout = timeout * IOC4_SRTR_HZ / HZ; 1290 * again timeout * IOC4_SRTR_HZ / HZ
1291 */
1292 timeout = timeout * IOC4_SRTR_HZ / 100;
1290 if (timeout > IOC4_SRTR_CNT) 1293 if (timeout > IOC4_SRTR_CNT)
1291 timeout = IOC4_SRTR_CNT; 1294 timeout = IOC4_SRTR_CNT;
1292 1295
@@ -1380,7 +1383,7 @@ config_port(struct ioc4_port *port,
1380 if (port->ip_tx_lowat == 0) 1383 if (port->ip_tx_lowat == 0)
1381 port->ip_tx_lowat = 1; 1384 port->ip_tx_lowat = 1;
1382 1385
1383 set_rx_timeout(port, port->ip_rx_timeout); 1386 set_rx_timeout(port, 2);
1384 1387
1385 return 0; 1388 return 0;
1386} 1389}
@@ -1685,8 +1688,8 @@ ioc4_change_speed(struct uart_port *the_port,
1685{ 1688{
1686 struct ioc4_port *port = get_ioc4_port(the_port); 1689 struct ioc4_port *port = get_ioc4_port(the_port);
1687 int baud, bits; 1690 int baud, bits;
1688 unsigned cflag, cval; 1691 unsigned cflag;
1689 int new_parity = 0, new_parity_enable = 0, new_stop = 1, new_data = 8; 1692 int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8;
1690 struct uart_info *info = the_port->info; 1693 struct uart_info *info = the_port->info;
1691 1694
1692 cflag = new_termios->c_cflag; 1695 cflag = new_termios->c_cflag;
@@ -1694,48 +1697,35 @@ ioc4_change_speed(struct uart_port *the_port,
1694 switch (cflag & CSIZE) { 1697 switch (cflag & CSIZE) {
1695 case CS5: 1698 case CS5:
1696 new_data = 5; 1699 new_data = 5;
1697 cval = 0x00;
1698 bits = 7; 1700 bits = 7;
1699 break; 1701 break;
1700 case CS6: 1702 case CS6:
1701 new_data = 6; 1703 new_data = 6;
1702 cval = 0x01;
1703 bits = 8; 1704 bits = 8;
1704 break; 1705 break;
1705 case CS7: 1706 case CS7:
1706 new_data = 7; 1707 new_data = 7;
1707 cval = 0x02;
1708 bits = 9; 1708 bits = 9;
1709 break; 1709 break;
1710 case CS8: 1710 case CS8:
1711 new_data = 8; 1711 new_data = 8;
1712 cval = 0x03;
1713 bits = 10; 1712 bits = 10;
1714 break; 1713 break;
1715 default: 1714 default:
1716 /* cuz we always need a default ... */ 1715 /* cuz we always need a default ... */
1717 new_data = 5; 1716 new_data = 5;
1718 cval = 0x00;
1719 bits = 7; 1717 bits = 7;
1720 break; 1718 break;
1721 } 1719 }
1722 if (cflag & CSTOPB) { 1720 if (cflag & CSTOPB) {
1723 cval |= 0x04;
1724 bits++; 1721 bits++;
1725 new_stop = 1; 1722 new_stop = 1;
1726 } 1723 }
1727 if (cflag & PARENB) { 1724 if (cflag & PARENB) {
1728 cval |= UART_LCR_PARITY;
1729 bits++; 1725 bits++;
1730 new_parity_enable = 1; 1726 new_parity_enable = 1;
1731 } 1727 if (cflag & PARODD)
1732 if (cflag & PARODD) { 1728 new_parity = 1;
1733 cval |= UART_LCR_EPAR;
1734 new_parity = 1;
1735 }
1736 if (cflag & IGNPAR) {
1737 cval &= ~UART_LCR_PARITY;
1738 new_parity_enable = 0;
1739 } 1729 }
1740 baud = uart_get_baud_rate(the_port, new_termios, old_termios, 1730 baud = uart_get_baud_rate(the_port, new_termios, old_termios,
1741 MIN_BAUD_SUPPORTED, MAX_BAUD_SUPPORTED); 1731 MIN_BAUD_SUPPORTED, MAX_BAUD_SUPPORTED);
@@ -1765,10 +1755,15 @@ ioc4_change_speed(struct uart_port *the_port,
1765 the_port->ignore_status_mask &= ~N_DATA_READY; 1755 the_port->ignore_status_mask &= ~N_DATA_READY;
1766 } 1756 }
1767 1757
1768 if (cflag & CRTSCTS) 1758 if (cflag & CRTSCTS) {
1769 info->flags |= ASYNC_CTS_FLOW; 1759 info->flags |= ASYNC_CTS_FLOW;
1770 else 1760 port->ip_sscr |= IOC4_SSCR_HFC_EN;
1761 }
1762 else {
1771 info->flags &= ~ASYNC_CTS_FLOW; 1763 info->flags &= ~ASYNC_CTS_FLOW;
1764 port->ip_sscr &= ~IOC4_SSCR_HFC_EN;
1765 }
1766 writel(port->ip_sscr, &port->ip_serial_regs->sscr);
1772 1767
1773 /* Set the configuration and proper notification call */ 1768 /* Set the configuration and proper notification call */
1774 DPRINT_CONFIG(("%s : port 0x%p cflag 0%o " 1769 DPRINT_CONFIG(("%s : port 0x%p cflag 0%o "
@@ -1825,12 +1820,6 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1825 /* set the speed of the serial port */ 1820 /* set the speed of the serial port */
1826 ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); 1821 ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0);
1827 1822
1828 /* enable hardware flow control - after ioc4_change_speed because
1829 * ASYNC_CTS_FLOW is set there */
1830 if (info->flags & ASYNC_CTS_FLOW) {
1831 port->ip_sscr |= IOC4_SSCR_HFC_EN;
1832 writel(port->ip_sscr, &port->ip_serial_regs->sscr);
1833 }
1834 info->flags |= UIF_INITIALIZED; 1823 info->flags |= UIF_INITIALIZED;
1835 return 0; 1824 return 0;
1836} 1825}
@@ -1847,7 +1836,6 @@ static void ioc4_cb_output_lowat(struct ioc4_port *port)
1847 } 1836 }
1848} 1837}
1849 1838
1850
1851/** 1839/**
1852 * handle_intr - service any interrupts for the given port - 2nd level 1840 * handle_intr - service any interrupts for the given port - 2nd level
1853 * called via sd_intr 1841 * called via sd_intr
diff --git a/drivers/serial/jsm/jsm.h b/drivers/serial/jsm/jsm.h
index e0717611c940..777829fa3300 100644
--- a/drivers/serial/jsm/jsm.h
+++ b/drivers/serial/jsm/jsm.h
@@ -393,7 +393,6 @@ int jsm_tty_init(struct jsm_board *);
393int jsm_uart_port_init(struct jsm_board *); 393int jsm_uart_port_init(struct jsm_board *);
394int jsm_remove_uart_port(struct jsm_board *); 394int jsm_remove_uart_port(struct jsm_board *);
395void jsm_input(struct jsm_channel *ch); 395void jsm_input(struct jsm_channel *ch);
396void jsm_carrier(struct jsm_channel *ch);
397void jsm_check_queue_flow_control(struct jsm_channel *ch); 396void jsm_check_queue_flow_control(struct jsm_channel *ch);
398 397
399#endif 398#endif
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c
index 9b79c1ff6c72..3a11a69feb44 100644
--- a/drivers/serial/jsm/jsm_neo.c
+++ b/drivers/serial/jsm/jsm_neo.c
@@ -688,7 +688,7 @@ static void neo_flush_uart_read(struct jsm_channel *ch)
688/* 688/*
689 * No locks are assumed to be held when calling this function. 689 * No locks are assumed to be held when calling this function.
690 */ 690 */
691void neo_clear_break(struct jsm_channel *ch, int force) 691static void neo_clear_break(struct jsm_channel *ch, int force)
692{ 692{
693 unsigned long lock_flags; 693 unsigned long lock_flags;
694 694
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 24fe76c28833..98de2258fd06 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -31,6 +31,8 @@
31 31
32#include "jsm.h" 32#include "jsm.h"
33 33
34static void jsm_carrier(struct jsm_channel *ch);
35
34static inline int jsm_get_mstat(struct jsm_channel *ch) 36static inline int jsm_get_mstat(struct jsm_channel *ch)
35{ 37{
36 unsigned char mstat; 38 unsigned char mstat;
@@ -755,7 +757,7 @@ void jsm_input(struct jsm_channel *ch)
755 jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n"); 757 jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n");
756} 758}
757 759
758void jsm_carrier(struct jsm_channel *ch) 760static void jsm_carrier(struct jsm_channel *ch)
759{ 761{
760 struct jsm_board *bd; 762 struct jsm_board *bd;
761 763
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index d0dfc3cf9245..a8314aee2ab8 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -329,8 +329,8 @@ mpsc_sdma_stop(struct mpsc_port_info *pi)
329 mpsc_sdma_cmd(pi, SDMA_SDCM_AR | SDMA_SDCM_AT); 329 mpsc_sdma_cmd(pi, SDMA_SDCM_AR | SDMA_SDCM_AT);
330 330
331 /* Clear the SDMA current and first TX and RX pointers */ 331 /* Clear the SDMA current and first TX and RX pointers */
332 mpsc_sdma_set_tx_ring(pi, 0); 332 mpsc_sdma_set_tx_ring(pi, NULL);
333 mpsc_sdma_set_rx_ring(pi, 0); 333 mpsc_sdma_set_rx_ring(pi, NULL);
334 334
335 /* Disable interrupts */ 335 /* Disable interrupts */
336 mpsc_sdma_intr_mask(pi, 0xf); 336 mpsc_sdma_intr_mask(pi, 0xf);
@@ -1540,8 +1540,8 @@ mpsc_shared_unmap_regs(void)
1540 MPSC_SDMA_INTR_REG_BLOCK_SIZE); 1540 MPSC_SDMA_INTR_REG_BLOCK_SIZE);
1541 } 1541 }
1542 1542
1543 mpsc_shared_regs.mpsc_routing_base = 0; 1543 mpsc_shared_regs.mpsc_routing_base = NULL;
1544 mpsc_shared_regs.sdma_intr_base = 0; 1544 mpsc_shared_regs.sdma_intr_base = NULL;
1545 1545
1546 mpsc_shared_regs.mpsc_routing_base_p = 0; 1546 mpsc_shared_regs.mpsc_routing_base_p = 0;
1547 mpsc_shared_regs.sdma_intr_base_p = 0; 1547 mpsc_shared_regs.sdma_intr_base_p = 0;
@@ -1678,9 +1678,9 @@ mpsc_drv_unmap_regs(struct mpsc_port_info *pi)
1678 release_mem_region(pi->brg_base_p, MPSC_BRG_REG_BLOCK_SIZE); 1678 release_mem_region(pi->brg_base_p, MPSC_BRG_REG_BLOCK_SIZE);
1679 } 1679 }
1680 1680
1681 pi->mpsc_base = 0; 1681 pi->mpsc_base = NULL;
1682 pi->sdma_base = 0; 1682 pi->sdma_base = NULL;
1683 pi->brg_base = 0; 1683 pi->brg_base = NULL;
1684 1684
1685 pi->mpsc_base_p = 0; 1685 pi->mpsc_base_p = 0;
1686 pi->sdma_base_p = 0; 1686 pi->sdma_base_p = 0;
diff --git a/drivers/serial/mpsc.h b/drivers/serial/mpsc.h
index 1f7294b7095f..678dbcf06c8f 100644
--- a/drivers/serial/mpsc.h
+++ b/drivers/serial/mpsc.h
@@ -83,8 +83,8 @@ struct mpsc_shared_regs {
83 phys_addr_t mpsc_routing_base_p; 83 phys_addr_t mpsc_routing_base_p;
84 phys_addr_t sdma_intr_base_p; 84 phys_addr_t sdma_intr_base_p;
85 85
86 void *mpsc_routing_base; 86 void __iomem *mpsc_routing_base;
87 void *sdma_intr_base; 87 void __iomem *sdma_intr_base;
88 88
89 u32 MPSC_MRR_m; 89 u32 MPSC_MRR_m;
90 u32 MPSC_RCRR_m; 90 u32 MPSC_RCRR_m;
@@ -120,9 +120,9 @@ struct mpsc_port_info {
120 phys_addr_t brg_base_p; 120 phys_addr_t brg_base_p;
121 121
122 /* Virtual addresses of various blocks of registers (from platform) */ 122 /* Virtual addresses of various blocks of registers (from platform) */
123 void *mpsc_base; 123 void __iomem *mpsc_base;
124 void *sdma_base; 124 void __iomem *sdma_base;
125 void *brg_base; 125 void __iomem *brg_base;
126 126
127 /* Descriptor ring and buffer allocations */ 127 /* Descriptor ring and buffer allocations */
128 void *dma_region; 128 void *dma_region;
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index bd6782aeb831..435750d40a47 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -364,7 +364,7 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id, struct pt_regs *regs)
364 flag = TTY_NORMAL; 364 flag = TTY_NORMAL;
365 port->icount.rx++; 365 port->icount.rx++;
366 366
367 if (uerstat & S3C2410_UERSTAT_ANY) { 367 if (unlikely(uerstat & S3C2410_UERSTAT_ANY)) {
368 dbg("rxerr: port ch=0x%02x, rxs=0x%08x\n", 368 dbg("rxerr: port ch=0x%02x, rxs=0x%08x\n",
369 ch, uerstat); 369 ch, uerstat);
370 370
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 086065210d1e..157218bc6c6f 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -214,56 +214,39 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs)
214 * note that the error handling code is 214 * note that the error handling code is
215 * out of the main execution path 215 * out of the main execution path
216 */ 216 */
217 if (status & UTSR1_TO_SM(UTSR1_PRE | UTSR1_FRE | UTSR1_ROR)) 217 if (status & UTSR1_TO_SM(UTSR1_PRE | UTSR1_FRE | UTSR1_ROR)) {
218 goto handle_error; 218 if (status & UTSR1_TO_SM(UTSR1_PRE))
219 sport->port.icount.parity++;
220 else if (status & UTSR1_TO_SM(UTSR1_FRE))
221 sport->port.icount.frame++;
222 if (status & UTSR1_TO_SM(UTSR1_ROR))
223 sport->port.icount.overrun++;
224
225 status &= sport->port.read_status_mask;
226
227 if (status & UTSR1_TO_SM(UTSR1_PRE))
228 flg = TTY_PARITY;
229 else if (status & UTSR1_TO_SM(UTSR1_FRE))
230 flg = TTY_FRAME;
231
232#ifdef SUPPORT_SYSRQ
233 sport->port.sysrq = 0;
234#endif
235 }
219 236
220 if (uart_handle_sysrq_char(&sport->port, ch, regs)) 237 if (uart_handle_sysrq_char(&sport->port, ch, regs))
221 goto ignore_char; 238 goto ignore_char;
222 239
223 error_return: 240 if ((status & port->ignore_status_mask & ~UTSR1_TO_SM(UTSR1_ROR)) == 0)
224 tty_insert_flip_char(tty, ch, flg); 241 tty_insert_flip_char(tty, ch, flg);
242 if (status & ~port->ignore_status_mask & UTSR1_TO_SM(UTSR1_ROR))
243 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
244
225 ignore_char: 245 ignore_char:
226 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | 246 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
227 UTSR0_TO_SM(UART_GET_UTSR0(sport)); 247 UTSR0_TO_SM(UART_GET_UTSR0(sport));
228 } 248 }
229 out:
230 tty_flip_buffer_push(tty); 249 tty_flip_buffer_push(tty);
231 return;
232
233 handle_error:
234 if (status & UTSR1_TO_SM(UTSR1_PRE))
235 sport->port.icount.parity++;
236 else if (status & UTSR1_TO_SM(UTSR1_FRE))
237 sport->port.icount.frame++;
238 if (status & UTSR1_TO_SM(UTSR1_ROR))
239 sport->port.icount.overrun++;
240
241 if (status & sport->port.ignore_status_mask) {
242 if (++ignored > 100)
243 goto out;
244 goto ignore_char;
245 }
246
247 status &= sport->port.read_status_mask;
248
249 if (status & UTSR1_TO_SM(UTSR1_PRE))
250 flg = TTY_PARITY;
251 else if (status & UTSR1_TO_SM(UTSR1_FRE))
252 flg = TTY_FRAME;
253
254 if (status & UTSR1_TO_SM(UTSR1_ROR)) {
255 /*
256 * overrun does *not* affect the character
257 * we read from the FIFO
258 */
259 tty_insert_flip_char(tty, ch, flg);
260 ch = 0;
261 flg = TTY_OVERRUN;
262 }
263#ifdef SUPPORT_SYSRQ
264 sport->port.sysrq = 0;
265#endif
266 goto error_return;
267} 250}
268 251
269static void sa1100_tx_chars(struct sa1100_port *sport) 252static void sa1100_tx_chars(struct sa1100_port *sport)
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 9034f9ad37c7..6eeb48f6a482 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -107,6 +107,13 @@ struct serial_info {
107 int line[4]; 107 int line[4];
108}; 108};
109 109
110struct serial_cfg_mem {
111 tuple_t tuple;
112 cisparse_t parse;
113 u_char buf[256];
114};
115
116
110static void serial_config(dev_link_t * link); 117static void serial_config(dev_link_t * link);
111static int serial_event(event_t event, int priority, 118static int serial_event(event_t event, int priority,
112 event_callback_args_t * args); 119 event_callback_args_t * args);
@@ -357,14 +364,24 @@ static int simple_config(dev_link_t *link)
357 static int size_table[2] = { 8, 16 }; 364 static int size_table[2] = { 8, 16 };
358 client_handle_t handle = link->handle; 365 client_handle_t handle = link->handle;
359 struct serial_info *info = link->priv; 366 struct serial_info *info = link->priv;
360 tuple_t tuple; 367 struct serial_cfg_mem *cfg_mem;
361 u_char buf[256]; 368 tuple_t *tuple;
362 cisparse_t parse; 369 u_char *buf;
363 cistpl_cftable_entry_t *cf = &parse.cftable_entry; 370 cisparse_t *parse;
371 cistpl_cftable_entry_t *cf;
364 config_info_t config; 372 config_info_t config;
365 int i, j, try; 373 int i, j, try;
366 int s; 374 int s;
367 375
376 cfg_mem = kmalloc(sizeof(struct serial_cfg_mem), GFP_KERNEL);
377 if (!cfg_mem)
378 return -1;
379
380 tuple = &cfg_mem->tuple;
381 parse = &cfg_mem->parse;
382 cf = &parse->cftable_entry;
383 buf = cfg_mem->buf;
384
368 /* If the card is already configured, look up the port and irq */ 385 /* If the card is already configured, look up the port and irq */
369 i = pcmcia_get_configuration_info(handle, &config); 386 i = pcmcia_get_configuration_info(handle, &config);
370 if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) { 387 if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) {
@@ -377,21 +394,23 @@ static int simple_config(dev_link_t *link)
377 port = config.BasePort1 + 0x28; 394 port = config.BasePort1 + 0x28;
378 info->slave = 1; 395 info->slave = 1;
379 } 396 }
380 if (info->slave) 397 if (info->slave) {
398 kfree(cfg_mem);
381 return setup_serial(handle, info, port, config.AssignedIRQ); 399 return setup_serial(handle, info, port, config.AssignedIRQ);
400 }
382 } 401 }
383 link->conf.Vcc = config.Vcc; 402 link->conf.Vcc = config.Vcc;
384 403
385 /* First pass: look for a config entry that looks normal. */ 404 /* First pass: look for a config entry that looks normal. */
386 tuple.TupleData = (cisdata_t *) buf; 405 tuple->TupleData = (cisdata_t *) buf;
387 tuple.TupleOffset = 0; 406 tuple->TupleOffset = 0;
388 tuple.TupleDataMax = 255; 407 tuple->TupleDataMax = 255;
389 tuple.Attributes = 0; 408 tuple->Attributes = 0;
390 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 409 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
391 /* Two tries: without IO aliases, then with aliases */ 410 /* Two tries: without IO aliases, then with aliases */
392 for (s = 0; s < 2; s++) { 411 for (s = 0; s < 2; s++) {
393 for (try = 0; try < 2; try++) { 412 for (try = 0; try < 2; try++) {
394 i = first_tuple(handle, &tuple, &parse); 413 i = first_tuple(handle, tuple, parse);
395 while (i != CS_NO_MORE_ITEMS) { 414 while (i != CS_NO_MORE_ITEMS) {
396 if (i != CS_SUCCESS) 415 if (i != CS_SUCCESS)
397 goto next_entry; 416 goto next_entry;
@@ -409,14 +428,14 @@ static int simple_config(dev_link_t *link)
409 goto found_port; 428 goto found_port;
410 } 429 }
411next_entry: 430next_entry:
412 i = next_tuple(handle, &tuple, &parse); 431 i = next_tuple(handle, tuple, parse);
413 } 432 }
414 } 433 }
415 } 434 }
416 /* Second pass: try to find an entry that isn't picky about 435 /* Second pass: try to find an entry that isn't picky about
417 its base address, then try to grab any standard serial port 436 its base address, then try to grab any standard serial port
418 address, and finally try to get any free port. */ 437 address, and finally try to get any free port. */
419 i = first_tuple(handle, &tuple, &parse); 438 i = first_tuple(handle, tuple, parse);
420 while (i != CS_NO_MORE_ITEMS) { 439 while (i != CS_NO_MORE_ITEMS) {
421 if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && 440 if ((i == CS_SUCCESS) && (cf->io.nwin > 0) &&
422 ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 441 ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
@@ -429,7 +448,7 @@ next_entry:
429 goto found_port; 448 goto found_port;
430 } 449 }
431 } 450 }
432 i = next_tuple(handle, &tuple, &parse); 451 i = next_tuple(handle, tuple, parse);
433 } 452 }
434 453
435 found_port: 454 found_port:
@@ -437,6 +456,7 @@ next_entry:
437 printk(KERN_NOTICE 456 printk(KERN_NOTICE
438 "serial_cs: no usable port range found, giving up\n"); 457 "serial_cs: no usable port range found, giving up\n");
439 cs_error(link->handle, RequestIO, i); 458 cs_error(link->handle, RequestIO, i);
459 kfree(cfg_mem);
440 return -1; 460 return -1;
441 } 461 }
442 462
@@ -450,9 +470,10 @@ next_entry:
450 i = pcmcia_request_configuration(link->handle, &link->conf); 470 i = pcmcia_request_configuration(link->handle, &link->conf);
451 if (i != CS_SUCCESS) { 471 if (i != CS_SUCCESS) {
452 cs_error(link->handle, RequestConfiguration, i); 472 cs_error(link->handle, RequestConfiguration, i);
473 kfree(cfg_mem);
453 return -1; 474 return -1;
454 } 475 }
455 476 kfree(cfg_mem);
456 return setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); 477 return setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ);
457} 478}
458 479
@@ -460,29 +481,39 @@ static int multi_config(dev_link_t * link)
460{ 481{
461 client_handle_t handle = link->handle; 482 client_handle_t handle = link->handle;
462 struct serial_info *info = link->priv; 483 struct serial_info *info = link->priv;
463 tuple_t tuple; 484 struct serial_cfg_mem *cfg_mem;
464 u_char buf[256]; 485 tuple_t *tuple;
465 cisparse_t parse; 486 u_char *buf;
466 cistpl_cftable_entry_t *cf = &parse.cftable_entry; 487 cisparse_t *parse;
488 cistpl_cftable_entry_t *cf;
467 config_info_t config; 489 config_info_t config;
468 int i, base2 = 0; 490 int i, rc, base2 = 0;
491
492 cfg_mem = kmalloc(sizeof(struct serial_cfg_mem), GFP_KERNEL);
493 if (!cfg_mem)
494 return -1;
495 tuple = &cfg_mem->tuple;
496 parse = &cfg_mem->parse;
497 cf = &parse->cftable_entry;
498 buf = cfg_mem->buf;
469 499
470 i = pcmcia_get_configuration_info(handle, &config); 500 i = pcmcia_get_configuration_info(handle, &config);
471 if (i != CS_SUCCESS) { 501 if (i != CS_SUCCESS) {
472 cs_error(handle, GetConfigurationInfo, i); 502 cs_error(handle, GetConfigurationInfo, i);
473 return -1; 503 rc = -1;
504 goto free_cfg_mem;
474 } 505 }
475 link->conf.Vcc = config.Vcc; 506 link->conf.Vcc = config.Vcc;
476 507
477 tuple.TupleData = (cisdata_t *) buf; 508 tuple->TupleData = (cisdata_t *) buf;
478 tuple.TupleOffset = 0; 509 tuple->TupleOffset = 0;
479 tuple.TupleDataMax = 255; 510 tuple->TupleDataMax = 255;
480 tuple.Attributes = 0; 511 tuple->Attributes = 0;
481 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 512 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
482 513
483 /* First, look for a generic full-sized window */ 514 /* First, look for a generic full-sized window */
484 link->io.NumPorts1 = info->multi * 8; 515 link->io.NumPorts1 = info->multi * 8;
485 i = first_tuple(handle, &tuple, &parse); 516 i = first_tuple(handle, tuple, parse);
486 while (i != CS_NO_MORE_ITEMS) { 517 while (i != CS_NO_MORE_ITEMS) {
487 /* The quad port cards have bad CIS's, so just look for a 518 /* The quad port cards have bad CIS's, so just look for a
488 window larger than 8 ports and assume it will be right */ 519 window larger than 8 ports and assume it will be right */
@@ -497,14 +528,14 @@ static int multi_config(dev_link_t * link)
497 if (i == CS_SUCCESS) 528 if (i == CS_SUCCESS)
498 break; 529 break;
499 } 530 }
500 i = next_tuple(handle, &tuple, &parse); 531 i = next_tuple(handle, tuple, parse);
501 } 532 }
502 533
503 /* If that didn't work, look for two windows */ 534 /* If that didn't work, look for two windows */
504 if (i != CS_SUCCESS) { 535 if (i != CS_SUCCESS) {
505 link->io.NumPorts1 = link->io.NumPorts2 = 8; 536 link->io.NumPorts1 = link->io.NumPorts2 = 8;
506 info->multi = 2; 537 info->multi = 2;
507 i = first_tuple(handle, &tuple, &parse); 538 i = first_tuple(handle, tuple, parse);
508 while (i != CS_NO_MORE_ITEMS) { 539 while (i != CS_NO_MORE_ITEMS) {
509 if ((i == CS_SUCCESS) && (cf->io.nwin == 2)) { 540 if ((i == CS_SUCCESS) && (cf->io.nwin == 2)) {
510 link->conf.ConfigIndex = cf->index; 541 link->conf.ConfigIndex = cf->index;
@@ -517,13 +548,14 @@ static int multi_config(dev_link_t * link)
517 if (i == CS_SUCCESS) 548 if (i == CS_SUCCESS)
518 break; 549 break;
519 } 550 }
520 i = next_tuple(handle, &tuple, &parse); 551 i = next_tuple(handle, tuple, parse);
521 } 552 }
522 } 553 }
523 554
524 if (i != CS_SUCCESS) { 555 if (i != CS_SUCCESS) {
525 cs_error(link->handle, RequestIO, i); 556 cs_error(link->handle, RequestIO, i);
526 return -1; 557 rc = -1;
558 goto free_cfg_mem;
527 } 559 }
528 560
529 i = pcmcia_request_irq(link->handle, &link->irq); 561 i = pcmcia_request_irq(link->handle, &link->irq);
@@ -541,7 +573,8 @@ static int multi_config(dev_link_t * link)
541 i = pcmcia_request_configuration(link->handle, &link->conf); 573 i = pcmcia_request_configuration(link->handle, &link->conf);
542 if (i != CS_SUCCESS) { 574 if (i != CS_SUCCESS) {
543 cs_error(link->handle, RequestConfiguration, i); 575 cs_error(link->handle, RequestConfiguration, i);
544 return -1; 576 rc = -1;
577 goto free_cfg_mem;
545 } 578 }
546 579
547 /* The Oxford Semiconductor OXCF950 cards are in fact single-port: 580 /* The Oxford Semiconductor OXCF950 cards are in fact single-port:
@@ -554,17 +587,23 @@ static int multi_config(dev_link_t * link)
554 setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); 587 setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ);
555 outb(12, base2 + 1); 588 outb(12, base2 + 1);
556 } 589 }
557 return 0; 590 rc = 0;
591 goto free_cfg_mem;
558 } 592 }
559 593
560 setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ); 594 setup_serial(handle, info, link->io.BasePort1, link->irq.AssignedIRQ);
561 /* The Nokia cards are not really multiport cards */ 595 /* The Nokia cards are not really multiport cards */
562 if (info->manfid == MANFID_NOKIA) 596 if (info->manfid == MANFID_NOKIA) {
563 return 0; 597 rc = 0;
598 goto free_cfg_mem;
599 }
564 for (i = 0; i < info->multi - 1; i++) 600 for (i = 0; i < info->multi - 1; i++)
565 setup_serial(handle, info, base2 + (8 * i), link->irq.AssignedIRQ); 601 setup_serial(handle, info, base2 + (8 * i),
566 602 link->irq.AssignedIRQ);
567 return 0; 603 rc = 0;
604free_cfg_mem:
605 kfree(cfg_mem);
606 return rc;
568} 607}
569 608
570/*====================================================================== 609/*======================================================================
@@ -579,39 +618,49 @@ void serial_config(dev_link_t * link)
579{ 618{
580 client_handle_t handle = link->handle; 619 client_handle_t handle = link->handle;
581 struct serial_info *info = link->priv; 620 struct serial_info *info = link->priv;
582 tuple_t tuple; 621 struct serial_cfg_mem *cfg_mem;
583 u_short buf[128]; 622 tuple_t *tuple;
584 cisparse_t parse; 623 u_char *buf;
585 cistpl_cftable_entry_t *cf = &parse.cftable_entry; 624 cisparse_t *parse;
625 cistpl_cftable_entry_t *cf;
586 int i, last_ret, last_fn; 626 int i, last_ret, last_fn;
587 627
588 DEBUG(0, "serial_config(0x%p)\n", link); 628 DEBUG(0, "serial_config(0x%p)\n", link);
589 629
590 tuple.TupleData = (cisdata_t *) buf; 630 cfg_mem = kmalloc(sizeof(struct serial_cfg_mem), GFP_KERNEL);
591 tuple.TupleOffset = 0; 631 if (!cfg_mem)
592 tuple.TupleDataMax = 255; 632 goto failed;
593 tuple.Attributes = 0; 633
634 tuple = &cfg_mem->tuple;
635 parse = &cfg_mem->parse;
636 cf = &parse->cftable_entry;
637 buf = cfg_mem->buf;
638
639 tuple->TupleData = (cisdata_t *) buf;
640 tuple->TupleOffset = 0;
641 tuple->TupleDataMax = 255;
642 tuple->Attributes = 0;
594 /* Get configuration register information */ 643 /* Get configuration register information */
595 tuple.DesiredTuple = CISTPL_CONFIG; 644 tuple->DesiredTuple = CISTPL_CONFIG;
596 last_ret = first_tuple(handle, &tuple, &parse); 645 last_ret = first_tuple(handle, tuple, parse);
597 if (last_ret != CS_SUCCESS) { 646 if (last_ret != CS_SUCCESS) {
598 last_fn = ParseTuple; 647 last_fn = ParseTuple;
599 goto cs_failed; 648 goto cs_failed;
600 } 649 }
601 link->conf.ConfigBase = parse.config.base; 650 link->conf.ConfigBase = parse->config.base;
602 link->conf.Present = parse.config.rmask[0]; 651 link->conf.Present = parse->config.rmask[0];
603 652
604 /* Configure card */ 653 /* Configure card */
605 link->state |= DEV_CONFIG; 654 link->state |= DEV_CONFIG;
606 655
607 /* Is this a compliant multifunction card? */ 656 /* Is this a compliant multifunction card? */
608 tuple.DesiredTuple = CISTPL_LONGLINK_MFC; 657 tuple->DesiredTuple = CISTPL_LONGLINK_MFC;
609 tuple.Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; 658 tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK;
610 info->multi = (first_tuple(handle, &tuple, &parse) == CS_SUCCESS); 659 info->multi = (first_tuple(handle, tuple, parse) == CS_SUCCESS);
611 660
612 /* Is this a multiport card? */ 661 /* Is this a multiport card? */
613 tuple.DesiredTuple = CISTPL_MANFID; 662 tuple->DesiredTuple = CISTPL_MANFID;
614 if (first_tuple(handle, &tuple, &parse) == CS_SUCCESS) { 663 if (first_tuple(handle, tuple, parse) == CS_SUCCESS) {
615 info->manfid = le16_to_cpu(buf[0]); 664 info->manfid = le16_to_cpu(buf[0]);
616 for (i = 0; i < MULTI_COUNT; i++) 665 for (i = 0; i < MULTI_COUNT; i++)
617 if ((info->manfid == multi_id[i].manfid) && 666 if ((info->manfid == multi_id[i].manfid) &&
@@ -623,13 +672,13 @@ void serial_config(dev_link_t * link)
623 672
624 /* Another check for dual-serial cards: look for either serial or 673 /* Another check for dual-serial cards: look for either serial or
625 multifunction cards that ask for appropriate IO port ranges */ 674 multifunction cards that ask for appropriate IO port ranges */
626 tuple.DesiredTuple = CISTPL_FUNCID; 675 tuple->DesiredTuple = CISTPL_FUNCID;
627 if ((info->multi == 0) && 676 if ((info->multi == 0) &&
628 ((first_tuple(handle, &tuple, &parse) != CS_SUCCESS) || 677 ((first_tuple(handle, tuple, parse) != CS_SUCCESS) ||
629 (parse.funcid.func == CISTPL_FUNCID_MULTI) || 678 (parse->funcid.func == CISTPL_FUNCID_MULTI) ||
630 (parse.funcid.func == CISTPL_FUNCID_SERIAL))) { 679 (parse->funcid.func == CISTPL_FUNCID_SERIAL))) {
631 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 680 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
632 if (first_tuple(handle, &tuple, &parse) == CS_SUCCESS) { 681 if (first_tuple(handle, tuple, parse) == CS_SUCCESS) {
633 if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) 682 if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0))
634 info->multi = cf->io.win[0].len >> 3; 683 info->multi = cf->io.win[0].len >> 3;
635 if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && 684 if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) &&
@@ -664,6 +713,7 @@ void serial_config(dev_link_t * link)
664 713
665 link->dev = &info->node[0]; 714 link->dev = &info->node[0];
666 link->state &= ~DEV_CONFIG_PENDING; 715 link->state &= ~DEV_CONFIG_PENDING;
716 kfree(cfg_mem);
667 return; 717 return;
668 718
669 cs_failed: 719 cs_failed:
@@ -671,6 +721,7 @@ void serial_config(dev_link_t * link)
671 failed: 721 failed:
672 serial_remove(link); 722 serial_remove(link);
673 link->state &= ~DEV_CONFIG_PENDING; 723 link->state &= ~DEV_CONFIG_PENDING;
724 kfree(cfg_mem);
674} 725}
675 726
676/*====================================================================== 727/*======================================================================
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 4ce3a41f1611..85cfa08d3bad 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -162,7 +162,7 @@ lh7a40xuart_rx_chars (struct uart_port* port)
162 flag = TTY_NORMAL; 162 flag = TTY_NORMAL;
163 ++port->icount.rx; 163 ++port->icount.rx;
164 164
165 if (data & RxError) { /* Quick check, short-circuit */ 165 if (unlikely(data & RxError)) { /* Quick check, short-circuit */
166 if (data & RxBreak) { 166 if (data & RxBreak) {
167 data &= ~(RxFramingError | RxParityError); 167 data &= ~(RxFramingError | RxParityError);
168 ++port->icount.brk; 168 ++port->icount.brk;
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index ffaab9b90fd8..fee6418e84c4 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -787,7 +787,7 @@ static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port)
787 787
788static void sn_sal_console_write(struct console *, const char *, unsigned); 788static void sn_sal_console_write(struct console *, const char *, unsigned);
789static int __init sn_sal_console_setup(struct console *, char *); 789static int __init sn_sal_console_setup(struct console *, char *);
790extern struct uart_driver sal_console_uart; 790static struct uart_driver sal_console_uart;
791extern struct tty_driver *uart_console_device(struct console *, int *); 791extern struct tty_driver *uart_console_device(struct console *, int *);
792 792
793static struct console sal_console = { 793static struct console sal_console = {
@@ -801,7 +801,7 @@ static struct console sal_console = {
801 801
802#define SAL_CONSOLE &sal_console 802#define SAL_CONSOLE &sal_console
803 803
804struct uart_driver sal_console_uart = { 804static struct uart_driver sal_console_uart = {
805 .owner = THIS_MODULE, 805 .owner = THIS_MODULE,
806 .driver_name = "sn_console", 806 .driver_name = "sn_console",
807 .dev_name = DEVICE_NAME, 807 .dev_name = DEVICE_NAME,
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 8caaf2e5e47c..39b788d95e39 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -682,7 +682,8 @@ static void calc_ebrg(int baud, int *n_ret, int *m_ret)
682 682
683/* Internal routine, port->lock is held and local interrupts are disabled. */ 683/* Internal routine, port->lock is held and local interrupts are disabled. */
684static void sunsab_convert_to_sab(struct uart_sunsab_port *up, unsigned int cflag, 684static void sunsab_convert_to_sab(struct uart_sunsab_port *up, unsigned int cflag,
685 unsigned int iflag, int baud) 685 unsigned int iflag, unsigned int baud,
686 unsigned int quot)
686{ 687{
687 unsigned int ebrg; 688 unsigned int ebrg;
688 unsigned char dafo; 689 unsigned char dafo;
@@ -766,6 +767,9 @@ static void sunsab_convert_to_sab(struct uart_sunsab_port *up, unsigned int cfla
766 up->port.ignore_status_mask |= (SAB82532_ISR0_RPF | 767 up->port.ignore_status_mask |= (SAB82532_ISR0_RPF |
767 SAB82532_ISR0_TCD); 768 SAB82532_ISR0_TCD);
768 769
770 uart_update_timeout(&up->port, cflag,
771 (up->port.uartclk / (16 * quot)));
772
769 /* Now bang the new settings into the chip. */ 773 /* Now bang the new settings into the chip. */
770 sunsab_cec_wait(up); 774 sunsab_cec_wait(up);
771 sunsab_tec_wait(up); 775 sunsab_tec_wait(up);
@@ -784,10 +788,11 @@ static void sunsab_set_termios(struct uart_port *port, struct termios *termios,
784{ 788{
785 struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; 789 struct uart_sunsab_port *up = (struct uart_sunsab_port *) port;
786 unsigned long flags; 790 unsigned long flags;
787 int baud = uart_get_baud_rate(port, termios, old, 0, 4000000); 791 unsigned int baud = uart_get_baud_rate(port, termios, old, 0, 4000000);
792 unsigned int quot = uart_get_divisor(port, baud);
788 793
789 spin_lock_irqsave(&up->port.lock, flags); 794 spin_lock_irqsave(&up->port.lock, flags);
790 sunsab_convert_to_sab(up, termios->c_cflag, termios->c_iflag, baud); 795 sunsab_convert_to_sab(up, termios->c_cflag, termios->c_iflag, baud, quot);
791 spin_unlock_irqrestore(&up->port.lock, flags); 796 spin_unlock_irqrestore(&up->port.lock, flags);
792} 797}
793 798
@@ -880,7 +885,7 @@ static int sunsab_console_setup(struct console *con, char *options)
880{ 885{
881 struct uart_sunsab_port *up = &sunsab_ports[con->index]; 886 struct uart_sunsab_port *up = &sunsab_ports[con->index];
882 unsigned long flags; 887 unsigned long flags;
883 int baud; 888 unsigned int baud, quot;
884 889
885 printk("Console: ttyS%d (SAB82532)\n", 890 printk("Console: ttyS%d (SAB82532)\n",
886 (sunsab_reg.minor - 64) + con->index); 891 (sunsab_reg.minor - 64) + con->index);
@@ -926,7 +931,8 @@ static int sunsab_console_setup(struct console *con, char *options)
926 SAB82532_IMR1_XPR; 931 SAB82532_IMR1_XPR;
927 writeb(up->interrupt_mask1, &up->regs->w.imr1); 932 writeb(up->interrupt_mask1, &up->regs->w.imr1);
928 933
929 sunsab_convert_to_sab(up, con->cflag, 0, baud); 934 quot = uart_get_divisor(&up->port, baud);
935 sunsab_convert_to_sab(up, con->cflag, 0, baud, quot);
930 sunsab_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS); 936 sunsab_set_mctrl(&up->port, TIOCM_DTR | TIOCM_RTS);
931 937
932 spin_unlock_irqrestore(&up->port.lock, flags); 938 spin_unlock_irqrestore(&up->port.lock, flags);
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 23d19d394320..ddc97c905e14 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1285,6 +1285,7 @@ static struct uart_driver sunsu_reg = {
1285 1285
1286static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel) 1286static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel)
1287{ 1287{
1288 int quot, baud;
1288#ifdef CONFIG_SERIO 1289#ifdef CONFIG_SERIO
1289 struct serio *serio; 1290 struct serio *serio;
1290#endif 1291#endif
@@ -1293,10 +1294,14 @@ static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel)
1293 up->port.type = PORT_UNKNOWN; 1294 up->port.type = PORT_UNKNOWN;
1294 up->port.uartclk = (SU_BASE_BAUD * 16); 1295 up->port.uartclk = (SU_BASE_BAUD * 16);
1295 1296
1296 if (up->su_type == SU_PORT_KBD) 1297 if (up->su_type == SU_PORT_KBD) {
1297 up->cflag = B1200 | CS8 | CLOCAL | CREAD; 1298 up->cflag = B1200 | CS8 | CLOCAL | CREAD;
1298 else 1299 baud = 1200;
1300 } else {
1299 up->cflag = B4800 | CS8 | CLOCAL | CREAD; 1301 up->cflag = B4800 | CS8 | CLOCAL | CREAD;
1302 baud = 4800;
1303 }
1304 quot = up->port.uartclk / (16 * baud);
1300 1305
1301 sunsu_autoconfig(up); 1306 sunsu_autoconfig(up);
1302 if (up->port.type == PORT_UNKNOWN) 1307 if (up->port.type == PORT_UNKNOWN)
@@ -1337,6 +1342,8 @@ static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel)
1337 } 1342 }
1338#endif 1343#endif
1339 1344
1345 sunsu_change_speed(&up->port, up->cflag, 0, quot);
1346
1340 sunsu_startup(&up->port); 1347 sunsu_startup(&up->port);
1341 return 0; 1348 return 0;
1342} 1349}