aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-12-06 17:31:30 -0500
committerLen Brown <len.brown@intel.com>2005-12-06 17:31:30 -0500
commit3d5271f9883cba7b54762bc4fe027d4172f06db7 (patch)
treeab8a881a14478598a0c8bda0d26c62cdccfffd6d /drivers/serial
parent378b2556f4e09fa6f87ff0cb5c4395ff28257d02 (diff)
parent9115a6c787596e687df03010d97fccc5e0762506 (diff)
Pull release into acpica branch
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/68328serial.c7
-rw-r--r--drivers/serial/8250.c122
-rw-r--r--drivers/serial/8250.h1
-rw-r--r--drivers/serial/8250_au1x00.c102
-rw-r--r--drivers/serial/8250_early.c2
-rw-r--r--drivers/serial/8250_gsc.c6
-rw-r--r--drivers/serial/8250_pci.c28
-rw-r--r--drivers/serial/8250_pnp.c6
-rw-r--r--drivers/serial/Kconfig10
-rw-r--r--drivers/serial/Makefile1
-rw-r--r--drivers/serial/amba-pl010.c1
-rw-r--r--drivers/serial/amba-pl011.c46
-rw-r--r--drivers/serial/clps711x.c2
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c2
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.c2
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.c2
-rw-r--r--drivers/serial/crisv10.c9
-rw-r--r--drivers/serial/dz.c48
-rw-r--r--drivers/serial/imx.c88
-rw-r--r--drivers/serial/ioc4_serial.c92
-rw-r--r--drivers/serial/mcfserial.c37
-rw-r--r--drivers/serial/mpc52xx_uart.c42
-rw-r--r--drivers/serial/mpsc.c69
-rw-r--r--drivers/serial/mux.c30
-rw-r--r--drivers/serial/pxa.c62
-rw-r--r--drivers/serial/s3c2410.c75
-rw-r--r--drivers/serial/sa1100.c43
-rw-r--r--drivers/serial/serial_core.c94
-rw-r--r--drivers/serial/serial_cs.c7
-rw-r--r--drivers/serial/sh-sci.c2
-rw-r--r--drivers/serial/sunsab.c1
-rw-r--r--drivers/serial/sunsu.c6
-rw-r--r--drivers/serial/sunzilog.c5
-rw-r--r--drivers/serial/vr41xx_siu.c35
34 files changed, 689 insertions, 396 deletions
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index 2efb317153ce..67e9afa000c1 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -34,6 +34,7 @@
34#include <linux/keyboard.h> 34#include <linux/keyboard.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/pm.h> 36#include <linux/pm.h>
37#include <linux/pm_legacy.h>
37#include <linux/bitops.h> 38#include <linux/bitops.h>
38#include <linux/delay.h> 39#include <linux/delay.h>
39 40
@@ -1343,7 +1344,7 @@ static void show_serial_version(void)
1343 printk("MC68328 serial driver version 1.00\n"); 1344 printk("MC68328 serial driver version 1.00\n");
1344} 1345}
1345 1346
1346#ifdef CONFIG_PM 1347#ifdef CONFIG_PM_LEGACY
1347/* Serial Power management 1348/* Serial Power management
1348 * The console (currently fixed at line 0) is a special case for power 1349 * The console (currently fixed at line 0) is a special case for power
1349 * management because the kernel is so chatty. The console will be 1350 * management because the kernel is so chatty. The console will be
@@ -1393,7 +1394,7 @@ void startup_console(void)
1393 struct m68k_serial *info = &m68k_soft[0]; 1394 struct m68k_serial *info = &m68k_soft[0];
1394 startup(info); 1395 startup(info);
1395} 1396}
1396#endif 1397#endif /* CONFIG_PM_LEGACY */
1397 1398
1398 1399
1399static struct tty_operations rs_ops = { 1400static struct tty_operations rs_ops = {
@@ -1486,7 +1487,7 @@ rs68328_init(void)
1486 IRQ_FLG_STD, 1487 IRQ_FLG_STD,
1487 "M68328_UART", NULL)) 1488 "M68328_UART", NULL))
1488 panic("Unable to attach 68328 serial interrupt\n"); 1489 panic("Unable to attach 68328 serial interrupt\n");
1489#ifdef CONFIG_PM 1490#ifdef CONFIG_PM_LEGACY
1490 serial_pm[i] = pm_register(PM_SYS_DEV, PM_SYS_COM, serial_pm_callback); 1491 serial_pm[i] = pm_register(PM_SYS_DEV, PM_SYS_COM, serial_pm_callback);
1491 if (serial_pm[i]) 1492 if (serial_pm[i])
1492 serial_pm[i]->data = info; 1493 serial_pm[i]->data = info;
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 4d75cdfa0a0a..d2bcd1f87cd6 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -33,13 +33,14 @@
33#include <linux/sysrq.h> 33#include <linux/sysrq.h>
34#include <linux/mca.h> 34#include <linux/mca.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/device.h> 36#include <linux/platform_device.h>
37#include <linux/tty.h> 37#include <linux/tty.h>
38#include <linux/tty_flip.h> 38#include <linux/tty_flip.h>
39#include <linux/serial_reg.h> 39#include <linux/serial_reg.h>
40#include <linux/serial_core.h> 40#include <linux/serial_core.h>
41#include <linux/serial.h> 41#include <linux/serial.h>
42#include <linux/serial_8250.h> 42#include <linux/serial_8250.h>
43#include <linux/nmi.h>
43 44
44#include <asm/io.h> 45#include <asm/io.h>
45#include <asm/irq.h> 46#include <asm/irq.h>
@@ -101,7 +102,7 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
101#define SERIAL_PORT_DFNS 102#define SERIAL_PORT_DFNS
102#endif 103#endif
103 104
104static struct old_serial_port old_serial_port[] = { 105static const struct old_serial_port old_serial_port[] = {
105 SERIAL_PORT_DFNS /* defined in asm/serial.h */ 106 SERIAL_PORT_DFNS /* defined in asm/serial.h */
106}; 107};
107 108
@@ -251,9 +252,53 @@ static const struct serial8250_config uart_config[] = {
251 }, 252 },
252}; 253};
253 254
255#ifdef CONFIG_SERIAL_8250_AU1X00
256
257/* Au1x00 UART hardware has a weird register layout */
258static const u8 au_io_in_map[] = {
259 [UART_RX] = 0,
260 [UART_IER] = 2,
261 [UART_IIR] = 3,
262 [UART_LCR] = 5,
263 [UART_MCR] = 6,
264 [UART_LSR] = 7,
265 [UART_MSR] = 8,
266};
267
268static const u8 au_io_out_map[] = {
269 [UART_TX] = 1,
270 [UART_IER] = 2,
271 [UART_FCR] = 4,
272 [UART_LCR] = 5,
273 [UART_MCR] = 6,
274};
275
276/* sane hardware needs no mapping */
277static inline int map_8250_in_reg(struct uart_8250_port *up, int offset)
278{
279 if (up->port.iotype != UPIO_AU)
280 return offset;
281 return au_io_in_map[offset];
282}
283
284static inline int map_8250_out_reg(struct uart_8250_port *up, int offset)
285{
286 if (up->port.iotype != UPIO_AU)
287 return offset;
288 return au_io_out_map[offset];
289}
290
291#else
292
293/* sane hardware needs no mapping */
294#define map_8250_in_reg(up, offset) (offset)
295#define map_8250_out_reg(up, offset) (offset)
296
297#endif
298
254static _INLINE_ unsigned int serial_in(struct uart_8250_port *up, int offset) 299static _INLINE_ unsigned int serial_in(struct uart_8250_port *up, int offset)
255{ 300{
256 offset <<= up->port.regshift; 301 offset = map_8250_in_reg(up, offset) << up->port.regshift;
257 302
258 switch (up->port.iotype) { 303 switch (up->port.iotype) {
259 case UPIO_HUB6: 304 case UPIO_HUB6:
@@ -266,6 +311,11 @@ static _INLINE_ unsigned int serial_in(struct uart_8250_port *up, int offset)
266 case UPIO_MEM32: 311 case UPIO_MEM32:
267 return readl(up->port.membase + offset); 312 return readl(up->port.membase + offset);
268 313
314#ifdef CONFIG_SERIAL_8250_AU1X00
315 case UPIO_AU:
316 return __raw_readl(up->port.membase + offset);
317#endif
318
269 default: 319 default:
270 return inb(up->port.iobase + offset); 320 return inb(up->port.iobase + offset);
271 } 321 }
@@ -274,7 +324,7 @@ static _INLINE_ unsigned int serial_in(struct uart_8250_port *up, int offset)
274static _INLINE_ void 324static _INLINE_ void
275serial_out(struct uart_8250_port *up, int offset, int value) 325serial_out(struct uart_8250_port *up, int offset, int value)
276{ 326{
277 offset <<= up->port.regshift; 327 offset = map_8250_out_reg(up, offset) << up->port.regshift;
278 328
279 switch (up->port.iotype) { 329 switch (up->port.iotype) {
280 case UPIO_HUB6: 330 case UPIO_HUB6:
@@ -290,6 +340,12 @@ serial_out(struct uart_8250_port *up, int offset, int value)
290 writel(value, up->port.membase + offset); 340 writel(value, up->port.membase + offset);
291 break; 341 break;
292 342
343#ifdef CONFIG_SERIAL_8250_AU1X00
344 case UPIO_AU:
345 __raw_writel(value, up->port.membase + offset);
346 break;
347#endif
348
293 default: 349 default:
294 outb(value, up->port.iobase + offset); 350 outb(value, up->port.iobase + offset);
295 } 351 }
@@ -910,6 +966,13 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
910 } 966 }
911 } 967 }
912#endif 968#endif
969
970#ifdef CONFIG_SERIAL_8250_AU1X00
971 /* if access method is AU, it is a 16550 with a quirk */
972 if (up->port.type == PORT_16550A && up->port.iotype == UPIO_AU)
973 up->bugs |= UART_BUG_NOMSR;
974#endif
975
913 serial_outp(up, UART_LCR, save_lcr); 976 serial_outp(up, UART_LCR, save_lcr);
914 977
915 if (up->capabilities != uart_config[up->port.type].flags) { 978 if (up->capabilities != uart_config[up->port.type].flags) {
@@ -936,7 +999,10 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
936 serial_outp(up, UART_MCR, save_mcr); 999 serial_outp(up, UART_MCR, save_mcr);
937 serial8250_clear_fifos(up); 1000 serial8250_clear_fifos(up);
938 (void)serial_in(up, UART_RX); 1001 (void)serial_in(up, UART_RX);
939 serial_outp(up, UART_IER, 0); 1002 if (up->capabilities & UART_CAP_UUE)
1003 serial_outp(up, UART_IER, UART_IER_UUE);
1004 else
1005 serial_outp(up, UART_IER, 0);
940 1006
941 out: 1007 out:
942 spin_unlock_irqrestore(&up->port.lock, flags); 1008 spin_unlock_irqrestore(&up->port.lock, flags);
@@ -1057,6 +1123,10 @@ static void serial8250_enable_ms(struct uart_port *port)
1057{ 1123{
1058 struct uart_8250_port *up = (struct uart_8250_port *)port; 1124 struct uart_8250_port *up = (struct uart_8250_port *)port;
1059 1125
1126 /* no MSR capabilities */
1127 if (up->bugs & UART_BUG_NOMSR)
1128 return;
1129
1060 up->ier |= UART_IER_MSI; 1130 up->ier |= UART_IER_MSI;
1061 serial_out(up, UART_IER, up->ier); 1131 serial_out(up, UART_IER, up->ier);
1062} 1132}
@@ -1774,7 +1844,8 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
1774 * CTS flow control flag and modem status interrupts 1844 * CTS flow control flag and modem status interrupts
1775 */ 1845 */
1776 up->ier &= ~UART_IER_MSI; 1846 up->ier &= ~UART_IER_MSI;
1777 if (UART_ENABLE_MS(&up->port, termios->c_cflag)) 1847 if (!(up->bugs & UART_BUG_NOMSR) &&
1848 UART_ENABLE_MS(&up->port, termios->c_cflag))
1778 up->ier |= UART_IER_MSI; 1849 up->ier |= UART_IER_MSI;
1779 if (up->capabilities & UART_CAP_UUE) 1850 if (up->capabilities & UART_CAP_UUE)
1780 up->ier |= UART_IER_UUE | UART_IER_RTOIE; 1851 up->ier |= UART_IER_UUE | UART_IER_RTOIE;
@@ -2141,6 +2212,8 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
2141 unsigned int ier; 2212 unsigned int ier;
2142 int i; 2213 int i;
2143 2214
2215 touch_nmi_watchdog();
2216
2144 /* 2217 /*
2145 * First save the UER then disable the interrupts 2218 * First save the UER then disable the interrupts
2146 */ 2219 */
@@ -2311,9 +2384,9 @@ void serial8250_resume_port(int line)
2311 * list is terminated with a zero flags entry, which means we expect 2384 * list is terminated with a zero flags entry, which means we expect
2312 * all entries to have at least UPF_BOOT_AUTOCONF set. 2385 * all entries to have at least UPF_BOOT_AUTOCONF set.
2313 */ 2386 */
2314static int __devinit serial8250_probe(struct device *dev) 2387static int __devinit serial8250_probe(struct platform_device *dev)
2315{ 2388{
2316 struct plat_serial8250_port *p = dev->platform_data; 2389 struct plat_serial8250_port *p = dev->dev.platform_data;
2317 struct uart_port port; 2390 struct uart_port port;
2318 int ret, i; 2391 int ret, i;
2319 2392
@@ -2329,12 +2402,12 @@ static int __devinit serial8250_probe(struct device *dev)
2329 port.flags = p->flags; 2402 port.flags = p->flags;
2330 port.mapbase = p->mapbase; 2403 port.mapbase = p->mapbase;
2331 port.hub6 = p->hub6; 2404 port.hub6 = p->hub6;
2332 port.dev = dev; 2405 port.dev = &dev->dev;
2333 if (share_irqs) 2406 if (share_irqs)
2334 port.flags |= UPF_SHARE_IRQ; 2407 port.flags |= UPF_SHARE_IRQ;
2335 ret = serial8250_register_port(&port); 2408 ret = serial8250_register_port(&port);
2336 if (ret < 0) { 2409 if (ret < 0) {
2337 dev_err(dev, "unable to register port at index %d " 2410 dev_err(&dev->dev, "unable to register port at index %d "
2338 "(IO%lx MEM%lx IRQ%d): %d\n", i, 2411 "(IO%lx MEM%lx IRQ%d): %d\n", i,
2339 p->iobase, p->mapbase, p->irq, ret); 2412 p->iobase, p->mapbase, p->irq, ret);
2340 } 2413 }
@@ -2345,60 +2418,55 @@ static int __devinit serial8250_probe(struct device *dev)
2345/* 2418/*
2346 * Remove serial ports registered against a platform device. 2419 * Remove serial ports registered against a platform device.
2347 */ 2420 */
2348static int __devexit serial8250_remove(struct device *dev) 2421static int __devexit serial8250_remove(struct platform_device *dev)
2349{ 2422{
2350 int i; 2423 int i;
2351 2424
2352 for (i = 0; i < UART_NR; i++) { 2425 for (i = 0; i < UART_NR; i++) {
2353 struct uart_8250_port *up = &serial8250_ports[i]; 2426 struct uart_8250_port *up = &serial8250_ports[i];
2354 2427
2355 if (up->port.dev == dev) 2428 if (up->port.dev == &dev->dev)
2356 serial8250_unregister_port(i); 2429 serial8250_unregister_port(i);
2357 } 2430 }
2358 return 0; 2431 return 0;
2359} 2432}
2360 2433
2361static int serial8250_suspend(struct device *dev, pm_message_t state, u32 level) 2434static int serial8250_suspend(struct platform_device *dev, pm_message_t state)
2362{ 2435{
2363 int i; 2436 int i;
2364 2437
2365 if (level != SUSPEND_DISABLE)
2366 return 0;
2367
2368 for (i = 0; i < UART_NR; i++) { 2438 for (i = 0; i < UART_NR; i++) {
2369 struct uart_8250_port *up = &serial8250_ports[i]; 2439 struct uart_8250_port *up = &serial8250_ports[i];
2370 2440
2371 if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) 2441 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
2372 uart_suspend_port(&serial8250_reg, &up->port); 2442 uart_suspend_port(&serial8250_reg, &up->port);
2373 } 2443 }
2374 2444
2375 return 0; 2445 return 0;
2376} 2446}
2377 2447
2378static int serial8250_resume(struct device *dev, u32 level) 2448static int serial8250_resume(struct platform_device *dev)
2379{ 2449{
2380 int i; 2450 int i;
2381 2451
2382 if (level != RESUME_ENABLE)
2383 return 0;
2384
2385 for (i = 0; i < UART_NR; i++) { 2452 for (i = 0; i < UART_NR; i++) {
2386 struct uart_8250_port *up = &serial8250_ports[i]; 2453 struct uart_8250_port *up = &serial8250_ports[i];
2387 2454
2388 if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) 2455 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
2389 uart_resume_port(&serial8250_reg, &up->port); 2456 uart_resume_port(&serial8250_reg, &up->port);
2390 } 2457 }
2391 2458
2392 return 0; 2459 return 0;
2393} 2460}
2394 2461
2395static struct device_driver serial8250_isa_driver = { 2462static struct platform_driver serial8250_isa_driver = {
2396 .name = "serial8250",
2397 .bus = &platform_bus_type,
2398 .probe = serial8250_probe, 2463 .probe = serial8250_probe,
2399 .remove = __devexit_p(serial8250_remove), 2464 .remove = __devexit_p(serial8250_remove),
2400 .suspend = serial8250_suspend, 2465 .suspend = serial8250_suspend,
2401 .resume = serial8250_resume, 2466 .resume = serial8250_resume,
2467 .driver = {
2468 .name = "serial8250",
2469 },
2402}; 2470};
2403 2471
2404/* 2472/*
@@ -2544,7 +2612,7 @@ static int __init serial8250_init(void)
2544 2612
2545 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); 2613 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
2546 2614
2547 ret = driver_register(&serial8250_isa_driver); 2615 ret = platform_driver_register(&serial8250_isa_driver);
2548 if (ret == 0) 2616 if (ret == 0)
2549 goto out; 2617 goto out;
2550 2618
@@ -2566,7 +2634,7 @@ static void __exit serial8250_exit(void)
2566 */ 2634 */
2567 serial8250_isa_devs = NULL; 2635 serial8250_isa_devs = NULL;
2568 2636
2569 driver_unregister(&serial8250_isa_driver); 2637 platform_driver_unregister(&serial8250_isa_driver);
2570 platform_device_unregister(isa_dev); 2638 platform_device_unregister(isa_dev);
2571 2639
2572 uart_unregister_driver(&serial8250_reg); 2640 uart_unregister_driver(&serial8250_reg);
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h
index b1b459efda52..a607b98016db 100644
--- a/drivers/serial/8250.h
+++ b/drivers/serial/8250.h
@@ -49,6 +49,7 @@ struct serial8250_config {
49 49
50#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ 50#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
51#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ 51#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
52#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */
52 53
53#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486)) 54#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486))
54#define _INLINE_ inline 55#define _INLINE_ inline
diff --git a/drivers/serial/8250_au1x00.c b/drivers/serial/8250_au1x00.c
new file mode 100644
index 000000000000..06ae8fbcc947
--- /dev/null
+++ b/drivers/serial/8250_au1x00.c
@@ -0,0 +1,102 @@
1/*
2 * Serial Device Initialisation for Au1x00
3 *
4 * (C) Copyright Embedded Alley Solutions, Inc 2005
5 * Author: Pantelis Antoniou <pantelis@embeddedalley.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/errno.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/ioport.h>
17#include <linux/module.h>
18#include <linux/serial_core.h>
19#include <linux/signal.h>
20#include <linux/slab.h>
21#include <linux/types.h>
22
23#include <linux/serial_8250.h>
24
25#include <asm/mach-au1x00/au1000.h>
26
27#include "8250.h"
28
29#define PORT(_base, _irq) \
30 { \
31 .iobase = _base, \
32 .membase = (void __iomem *)_base,\
33 .mapbase = _base, \
34 .irq = _irq, \
35 .uartclk = 0, /* filled */ \
36 .regshift = 2, \
37 .iotype = UPIO_AU, \
38 .flags = UPF_SKIP_TEST | \
39 UPF_IOREMAP, \
40 }
41
42static struct plat_serial8250_port au1x00_data[] = {
43#if defined(CONFIG_SOC_AU1000)
44 PORT(UART0_ADDR, AU1000_UART0_INT),
45 PORT(UART1_ADDR, AU1000_UART1_INT),
46 PORT(UART2_ADDR, AU1000_UART2_INT),
47 PORT(UART3_ADDR, AU1000_UART3_INT),
48#elif defined(CONFIG_SOC_AU1500)
49 PORT(UART0_ADDR, AU1500_UART0_INT),
50 PORT(UART3_ADDR, AU1500_UART3_INT),
51#elif defined(CONFIG_SOC_AU1100)
52 PORT(UART0_ADDR, AU1100_UART0_INT),
53 PORT(UART1_ADDR, AU1100_UART1_INT),
54 PORT(UART2_ADDR, AU1100_UART2_INT),
55 PORT(UART3_ADDR, AU1100_UART3_INT),
56#elif defined(CONFIG_SOC_AU1550)
57 PORT(UART0_ADDR, AU1550_UART0_INT),
58 PORT(UART1_ADDR, AU1550_UART1_INT),
59 PORT(UART2_ADDR, AU1550_UART2_INT),
60 PORT(UART3_ADDR, AU1550_UART3_INT),
61#elif defined(CONFIG_SOC_AU1200)
62 PORT(UART0_ADDR, AU1200_UART0_INT),
63 PORT(UART1_ADDR, AU1200_UART1_INT),
64#endif
65 { },
66};
67
68static struct platform_device au1x00_device = {
69 .name = "serial8250",
70 .id = PLAT8250_DEV_AU1X00,
71 .dev = {
72 .platform_data = au1x00_data,
73 },
74};
75
76static int __init au1x00_init(void)
77{
78 int i;
79 unsigned int uartclk;
80
81 /* get uart clock */
82 uartclk = get_au1x00_uart_baud_base() * 16;
83
84 /* fill up uartclk */
85 for (i = 0; au1x00_data[i].flags ; i++)
86 au1x00_data[i].uartclk = uartclk;
87
88 return platform_device_register(&au1x00_device);
89}
90
91/* XXX: Yes, I know this doesn't yet work. */
92static void __exit au1x00_exit(void)
93{
94 platform_device_unregister(&au1x00_device);
95}
96
97module_init(au1x00_init);
98module_exit(au1x00_exit);
99
100MODULE_AUTHOR("Pantelis Antoniou <pantelis@embeddedalley.com>");
101MODULE_DESCRIPTION("8250 serial probe module for Au1x000 cards");
102MODULE_LICENSE("GPL");
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c
index b7a5dd710228..59ba5d993b4b 100644
--- a/drivers/serial/8250_early.c
+++ b/drivers/serial/8250_early.c
@@ -164,7 +164,7 @@ static int __init parse_options(struct early_uart_device *device, char *options)
164 164
165 if ((options = strchr(options, ','))) { 165 if ((options = strchr(options, ','))) {
166 options++; 166 options++;
167 device->baud = simple_strtoul(options, 0, 0); 167 device->baud = simple_strtoul(options, NULL, 0);
168 length = min(strcspn(options, " "), sizeof(device->options)); 168 length = min(strcspn(options, " "), sizeof(device->options));
169 strncpy(device->options, options, length); 169 strncpy(device->options, options, length);
170 } else { 170 } else {
diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c
index 431aa5761a7a..8b4947933d9b 100644
--- a/drivers/serial/8250_gsc.c
+++ b/drivers/serial/8250_gsc.c
@@ -29,7 +29,6 @@
29static int __init 29static int __init
30serial_init_chip(struct parisc_device *dev) 30serial_init_chip(struct parisc_device *dev)
31{ 31{
32 static int serial_line_nr;
33 struct uart_port port; 32 struct uart_port port;
34 unsigned long address; 33 unsigned long address;
35 int err; 34 int err;
@@ -42,12 +41,13 @@ serial_init_chip(struct parisc_device *dev)
42 */ 41 */
43 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) { 42 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
44 printk(KERN_INFO "Serial: device 0x%lx not configured.\n" 43 printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
45 "Enable support for Wax, Lasi, Asp or Dino.\n", dev->hpa); 44 "Enable support for Wax, Lasi, Asp or Dino.\n",
45 dev->hpa.start);
46 } 46 }
47 return -ENODEV; 47 return -ENODEV;
48 } 48 }
49 49
50 address = dev->hpa; 50 address = dev->hpa.start;
51 if (dev->id.sversion != 0x8d) { 51 if (dev->id.sversion != 0x8d) {
52 address += 0x800; 52 address += 0x800;
53 } 53 }
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 0e21f583690e..8d92adfbb8bd 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -152,6 +152,7 @@ static int __devinit pci_hp_diva_init(struct pci_dev *dev)
152 rc = 4; 152 rc = 4;
153 break; 153 break;
154 case PCI_DEVICE_ID_HP_DIVA_POWERBAR: 154 case PCI_DEVICE_ID_HP_DIVA_POWERBAR:
155 case PCI_DEVICE_ID_HP_DIVA_HURRICANE:
155 rc = 1; 156 rc = 1;
156 break; 157 break;
157 } 158 }
@@ -226,8 +227,10 @@ static int __devinit pci_plx9050_init(struct pci_dev *dev)
226 } 227 }
227 228
228 irq_config = 0x41; 229 irq_config = 0x41;
229 if (dev->vendor == PCI_VENDOR_ID_PANACOM) 230 if (dev->vendor == PCI_VENDOR_ID_PANACOM ||
231 dev->subsystem_vendor == PCI_SUBVENDOR_ID_EXSYS) {
230 irq_config = 0x43; 232 irq_config = 0x43;
233 }
231 if ((dev->vendor == PCI_VENDOR_ID_PLX) && 234 if ((dev->vendor == PCI_VENDOR_ID_PLX) &&
232 (dev->device == PCI_DEVICE_ID_PLX_ROMULUS)) { 235 (dev->device == PCI_DEVICE_ID_PLX_ROMULUS)) {
233 /* 236 /*
@@ -465,7 +468,7 @@ static unsigned short timedia_eight_port[] = {
465 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 468 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
466}; 469};
467 470
468static struct timedia_struct { 471static const struct timedia_struct {
469 int num; 472 int num;
470 unsigned short *ids; 473 unsigned short *ids;
471} timedia_data[] = { 474} timedia_data[] = {
@@ -664,6 +667,15 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
664 { 667 {
665 .vendor = PCI_VENDOR_ID_PLX, 668 .vendor = PCI_VENDOR_ID_PLX,
666 .device = PCI_DEVICE_ID_PLX_9050, 669 .device = PCI_DEVICE_ID_PLX_9050,
670 .subvendor = PCI_SUBVENDOR_ID_EXSYS,
671 .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055,
672 .init = pci_plx9050_init,
673 .setup = pci_default_setup,
674 .exit = __devexit_p(pci_plx9050_exit),
675 },
676 {
677 .vendor = PCI_VENDOR_ID_PLX,
678 .device = PCI_DEVICE_ID_PLX_9050,
667 .subvendor = PCI_SUBVENDOR_ID_KEYSPAN, 679 .subvendor = PCI_SUBVENDOR_ID_KEYSPAN,
668 .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2, 680 .subdevice = PCI_SUBDEVICE_ID_KEYSPAN_SX2,
669 .init = pci_plx9050_init, 681 .init = pci_plx9050_init,
@@ -927,6 +939,7 @@ enum pci_board_num_t {
927 pbn_panacom, 939 pbn_panacom,
928 pbn_panacom2, 940 pbn_panacom2,
929 pbn_panacom4, 941 pbn_panacom4,
942 pbn_exsys_4055,
930 pbn_plx_romulus, 943 pbn_plx_romulus,
931 pbn_oxsemi, 944 pbn_oxsemi,
932 pbn_intel_i960, 945 pbn_intel_i960,
@@ -1292,6 +1305,13 @@ static struct pciserial_board pci_boards[] __devinitdata = {
1292 .reg_shift = 7, 1305 .reg_shift = 7,
1293 }, 1306 },
1294 1307
1308 [pbn_exsys_4055] = {
1309 .flags = FL_BASE2,
1310 .num_ports = 4,
1311 .base_baud = 115200,
1312 .uart_offset = 8,
1313 },
1314
1295 /* I think this entry is broken - the first_offset looks wrong --rmk */ 1315 /* I think this entry is broken - the first_offset looks wrong --rmk */
1296 [pbn_plx_romulus] = { 1316 [pbn_plx_romulus] = {
1297 .flags = FL_BASE2, 1317 .flags = FL_BASE2,
@@ -1853,6 +1873,10 @@ static struct pci_device_id serial_pci_tbl[] = {
1853 PCI_SUBVENDOR_ID_CHASE_PCIRAS, 1873 PCI_SUBVENDOR_ID_CHASE_PCIRAS,
1854 PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0, 1874 PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0,
1855 pbn_b2_8_460800 }, 1875 pbn_b2_8_460800 },
1876 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
1877 PCI_SUBVENDOR_ID_EXSYS,
1878 PCI_SUBDEVICE_ID_EXSYS_4055, 0, 0,
1879 pbn_exsys_4055 },
1856 /* 1880 /*
1857 * Megawolf Romulus PCI Serial Card, from Mike Hudson 1881 * Megawolf Romulus PCI Serial Card, from Mike Hudson
1858 * (Exoray@isys.ca) 1882 * (Exoray@isys.ca)
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 6b321e82cafb..b79ed0665d51 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -272,8 +272,12 @@ static const struct pnp_device_id pnp_dev_table[] = {
272 { "SUP1421", 0 }, 272 { "SUP1421", 0 },
273 /* SupraExpress 33.6 Data/Fax PnP modem */ 273 /* SupraExpress 33.6 Data/Fax PnP modem */
274 { "SUP1590", 0 }, 274 { "SUP1590", 0 },
275 /* SupraExpress 336i Sp ASVD */
276 { "SUP1620", 0 },
275 /* SupraExpress 33.6 Data/Fax PnP modem */ 277 /* SupraExpress 33.6 Data/Fax PnP modem */
276 { "SUP1760", 0 }, 278 { "SUP1760", 0 },
279 /* SupraExpress 56i Sp Intl */
280 { "SUP2171", 0 },
277 /* Phoebe Micro */ 281 /* Phoebe Micro */
278 /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */ 282 /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */
279 { "TEX0011", 0 }, 283 { "TEX0011", 0 },
@@ -319,6 +323,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
319 { "USR9180", 0 }, 323 { "USR9180", 0 },
320 /* U.S. Robotics 56K Voice INT PnP*/ 324 /* U.S. Robotics 56K Voice INT PnP*/
321 { "USR9190", 0 }, 325 { "USR9190", 0 },
326 /* HP Compaq Tablet PC tc1100 Wacom tablet */
327 { "WACF005", 0 },
322 /* Rockwell's (PORALiNK) 33600 INT PNP */ 328 /* Rockwell's (PORALiNK) 33600 INT PNP */
323 { "WCI0003", 0 }, 329 { "WCI0003", 0 },
324 /* Unkown PnP modems */ 330 /* Unkown PnP modems */
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index b745a1b9e835..ad47c1b84c3f 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -207,6 +207,14 @@ config SERIAL_8250_ACORN
207 system, say Y to this option. The driver can handle 1, 2, or 3 port 207 system, say Y to this option. The driver can handle 1, 2, or 3 port
208 cards. If unsure, say N. 208 cards. If unsure, say N.
209 209
210config SERIAL_8250_AU1X00
211 bool "AU1X00 serial port support"
212 depends on SERIAL_8250 != n && SOC_AU1X00
213 help
214 If you have an Au1x00 board and want to use the serial port, say Y
215 to this option. The driver can handle 1 or 2 serial ports.
216 If unsure, say N.
217
210comment "Non-8250 serial port support" 218comment "Non-8250 serial port support"
211 219
212config SERIAL_AMBA_PL010 220config SERIAL_AMBA_PL010
@@ -499,7 +507,7 @@ config SERIAL_SUNSU_CONSOLE
499 507
500config SERIAL_MUX 508config SERIAL_MUX
501 tristate "Serial MUX support" 509 tristate "Serial MUX support"
502 depends on PARISC 510 depends on GSC
503 select SERIAL_CORE 511 select SERIAL_CORE
504 default y 512 default y
505 ---help--- 513 ---help---
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 11c7dc483f93..d7c7c7180e33 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_SERIAL_8250_ACCENT) += 8250_accent.o
22obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o 22obj-$(CONFIG_SERIAL_8250_BOCA) += 8250_boca.o
23obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o 23obj-$(CONFIG_SERIAL_8250_HUB6) += 8250_hub6.o
24obj-$(CONFIG_SERIAL_8250_MCA) += 8250_mca.o 24obj-$(CONFIG_SERIAL_8250_MCA) += 8250_mca.o
25obj-$(CONFIG_SERIAL_8250_AU1X00) += 8250_au1x00.o
25obj-$(CONFIG_SERIAL_AMBA_PL010) += amba-pl010.o 26obj-$(CONFIG_SERIAL_AMBA_PL010) += amba-pl010.o
26obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o 27obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o
27obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o 28obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 679e678c7e6a..ddd0307fece2 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -50,6 +50,7 @@
50 50
51#include <asm/io.h> 51#include <asm/io.h>
52#include <asm/irq.h> 52#include <asm/irq.h>
53#include <asm/hardware.h>
53#include <asm/hardware/amba.h> 54#include <asm/hardware/amba.h>
54#include <asm/hardware/amba_serial.h> 55#include <asm/hardware/amba_serial.h>
55 56
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 1ff629c74750..89d7bd3eaee3 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -49,7 +49,7 @@
49#include <linux/serial.h> 49#include <linux/serial.h>
50 50
51#include <asm/io.h> 51#include <asm/io.h>
52#include <asm/irq.h> 52#include <asm/sizes.h>
53#include <asm/hardware/amba.h> 53#include <asm/hardware/amba.h>
54#include <asm/hardware/clock.h> 54#include <asm/hardware/clock.h>
55#include <asm/hardware/amba_serial.h> 55#include <asm/hardware/amba_serial.h>
@@ -62,7 +62,8 @@
62 62
63#define AMBA_ISR_PASS_LIMIT 256 63#define AMBA_ISR_PASS_LIMIT 256
64 64
65#define UART_DUMMY_RSR_RX 256 65#define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE)
66#define UART_DUMMY_DR_RX (1 << 16)
66 67
67/* 68/*
68 * We wrap our port structure around the generic uart_port. 69 * We wrap our port structure around the generic uart_port.
@@ -115,7 +116,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
115#endif 116#endif
116{ 117{
117 struct tty_struct *tty = uap->port.info->tty; 118 struct tty_struct *tty = uap->port.info->tty;
118 unsigned int status, ch, flag, rsr, max_count = 256; 119 unsigned int status, ch, flag, max_count = 256;
119 120
120 status = readw(uap->port.membase + UART01x_FR); 121 status = readw(uap->port.membase + UART01x_FR);
121 while ((status & UART01x_FR_RXFE) == 0 && max_count--) { 122 while ((status & UART01x_FR_RXFE) == 0 && max_count--) {
@@ -128,7 +129,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
128 */ 129 */
129 } 130 }
130 131
131 ch = readw(uap->port.membase + UART01x_DR); 132 ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX;
132 flag = TTY_NORMAL; 133 flag = TTY_NORMAL;
133 uap->port.icount.rx++; 134 uap->port.icount.rx++;
134 135
@@ -136,34 +137,33 @@ pl011_rx_chars(struct uart_amba_port *uap)
136 * Note that the error handling code is 137 * Note that the error handling code is
137 * out of the main execution path 138 * out of the main execution path
138 */ 139 */
139 rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; 140 if (unlikely(ch & UART_DR_ERROR)) {
140 if (unlikely(rsr & UART01x_RSR_ANY)) { 141 if (ch & UART011_DR_BE) {
141 if (rsr & UART01x_RSR_BE) { 142 ch &= ~(UART011_DR_FE | UART011_DR_PE);
142 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
143 uap->port.icount.brk++; 143 uap->port.icount.brk++;
144 if (uart_handle_break(&uap->port)) 144 if (uart_handle_break(&uap->port))
145 goto ignore_char; 145 goto ignore_char;
146 } else if (rsr & UART01x_RSR_PE) 146 } else if (ch & UART011_DR_PE)
147 uap->port.icount.parity++; 147 uap->port.icount.parity++;
148 else if (rsr & UART01x_RSR_FE) 148 else if (ch & UART011_DR_FE)
149 uap->port.icount.frame++; 149 uap->port.icount.frame++;
150 if (rsr & UART01x_RSR_OE) 150 if (ch & UART011_DR_OE)
151 uap->port.icount.overrun++; 151 uap->port.icount.overrun++;
152 152
153 rsr &= uap->port.read_status_mask; 153 ch &= uap->port.read_status_mask;
154 154
155 if (rsr & UART01x_RSR_BE) 155 if (ch & UART011_DR_BE)
156 flag = TTY_BREAK; 156 flag = TTY_BREAK;
157 else if (rsr & UART01x_RSR_PE) 157 else if (ch & UART011_DR_PE)
158 flag = TTY_PARITY; 158 flag = TTY_PARITY;
159 else if (rsr & UART01x_RSR_FE) 159 else if (ch & UART011_DR_FE)
160 flag = TTY_FRAME; 160 flag = TTY_FRAME;
161 } 161 }
162 162
163 if (uart_handle_sysrq_char(&uap->port, ch, regs)) 163 if (uart_handle_sysrq_char(&uap->port, ch, regs))
164 goto ignore_char; 164 goto ignore_char;
165 165
166 uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); 166 uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);
167 167
168 ignore_char: 168 ignore_char:
169 status = readw(uap->port.membase + UART01x_FR); 169 status = readw(uap->port.membase + UART01x_FR);
@@ -475,33 +475,33 @@ pl011_set_termios(struct uart_port *port, struct termios *termios,
475 */ 475 */
476 uart_update_timeout(port, termios->c_cflag, baud); 476 uart_update_timeout(port, termios->c_cflag, baud);
477 477
478 port->read_status_mask = UART01x_RSR_OE; 478 port->read_status_mask = UART011_DR_OE | 255;
479 if (termios->c_iflag & INPCK) 479 if (termios->c_iflag & INPCK)
480 port->read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; 480 port->read_status_mask |= UART011_DR_FE | UART011_DR_PE;
481 if (termios->c_iflag & (BRKINT | PARMRK)) 481 if (termios->c_iflag & (BRKINT | PARMRK))
482 port->read_status_mask |= UART01x_RSR_BE; 482 port->read_status_mask |= UART011_DR_BE;
483 483
484 /* 484 /*
485 * Characters to ignore 485 * Characters to ignore
486 */ 486 */
487 port->ignore_status_mask = 0; 487 port->ignore_status_mask = 0;
488 if (termios->c_iflag & IGNPAR) 488 if (termios->c_iflag & IGNPAR)
489 port->ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; 489 port->ignore_status_mask |= UART011_DR_FE | UART011_DR_PE;
490 if (termios->c_iflag & IGNBRK) { 490 if (termios->c_iflag & IGNBRK) {
491 port->ignore_status_mask |= UART01x_RSR_BE; 491 port->ignore_status_mask |= UART011_DR_BE;
492 /* 492 /*
493 * If we're ignoring parity and break indicators, 493 * If we're ignoring parity and break indicators,
494 * ignore overruns too (for real raw support). 494 * ignore overruns too (for real raw support).
495 */ 495 */
496 if (termios->c_iflag & IGNPAR) 496 if (termios->c_iflag & IGNPAR)
497 port->ignore_status_mask |= UART01x_RSR_OE; 497 port->ignore_status_mask |= UART011_DR_OE;
498 } 498 }
499 499
500 /* 500 /*
501 * Ignore all characters if CREAD is not set. 501 * Ignore all characters if CREAD is not set.
502 */ 502 */
503 if ((termios->c_cflag & CREAD) == 0) 503 if ((termios->c_cflag & CREAD) == 0)
504 port->ignore_status_mask |= UART_DUMMY_RSR_RX; 504 port->ignore_status_mask |= UART_DUMMY_DR_RX;
505 505
506 if (UART_ENABLE_MS(port, termios->c_cflag)) 506 if (UART_ENABLE_MS(port, termios->c_cflag))
507 pl011_enable_ms(port); 507 pl011_enable_ms(port);
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c
index 78c1f36ad9b7..87ef368384fb 100644
--- a/drivers/serial/clps711x.c
+++ b/drivers/serial/clps711x.c
@@ -98,7 +98,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re
98{ 98{
99 struct uart_port *port = dev_id; 99 struct uart_port *port = dev_id;
100 struct tty_struct *tty = port->info->tty; 100 struct tty_struct *tty = port->info->tty;
101 unsigned int status, ch, flg, ignored = 0; 101 unsigned int status, ch, flg;
102 102
103 status = clps_readl(SYSFLG(port)); 103 status = clps_readl(SYSFLG(port));
104 while (!(status & SYSFLG_URXFE)) { 104 while (!(status & SYSFLG_URXFE)) {
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 25825f2aba22..987d22b53c22 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -7,7 +7,7 @@
7 * Based on ppc8xx.c by Thomas Gleixner 7 * Based on ppc8xx.c by Thomas Gleixner
8 * Based on drivers/serial/amba.c by Russell King 8 * Based on drivers/serial/amba.c by Russell King
9 * 9 *
10 * Maintainer: Kumar Gala (kumar.gala@freescale.com) (CPM2) 10 * Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2)
11 * Pantelis Antoniou (panto@intracom.gr) (CPM1) 11 * Pantelis Antoniou (panto@intracom.gr) (CPM1)
12 * 12 *
13 * Copyright (C) 2004 Freescale Semiconductor, Inc. 13 * Copyright (C) 2004 Freescale Semiconductor, Inc.
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 4b0786e7eb7f..d789ee55cbb7 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Driver for CPM (SCC/SMC) serial ports; CPM1 definitions 4 * Driver for CPM (SCC/SMC) serial ports; CPM1 definitions
5 * 5 *
6 * Maintainer: Kumar Gala (kumar.gala@freescale.com) (CPM2) 6 * Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2)
7 * Pantelis Antoniou (panto@intracom.gr) (CPM1) 7 * Pantelis Antoniou (panto@intracom.gr) (CPM1)
8 * 8 *
9 * Copyright (C) 2004 Freescale Semiconductor, Inc. 9 * Copyright (C) 2004 Freescale Semiconductor, Inc.
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index 15ad58d94889..fd9e53ed3feb 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Driver for CPM (SCC/SMC) serial ports; CPM2 definitions 4 * Driver for CPM (SCC/SMC) serial ports; CPM2 definitions
5 * 5 *
6 * Maintainer: Kumar Gala (kumar.gala@freescale.com) (CPM2) 6 * Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2)
7 * Pantelis Antoniou (panto@intracom.gr) (CPM1) 7 * Pantelis Antoniou (panto@intracom.gr) (CPM1)
8 * 8 *
9 * Copyright (C) 2004 Freescale Semiconductor, Inc. 9 * Copyright (C) 2004 Freescale Semiconductor, Inc.
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 40d3e7139cfe..08c42c000188 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -4416,10 +4416,8 @@ rs_close(struct tty_struct *tty, struct file * filp)
4416 info->event = 0; 4416 info->event = 0;
4417 info->tty = 0; 4417 info->tty = 0;
4418 if (info->blocked_open) { 4418 if (info->blocked_open) {
4419 if (info->close_delay) { 4419 if (info->close_delay)
4420 set_current_state(TASK_INTERRUPTIBLE); 4420 schedule_timeout_interruptible(info->close_delay);
4421 schedule_timeout(info->close_delay);
4422 }
4423 wake_up_interruptible(&info->open_wait); 4421 wake_up_interruptible(&info->open_wait);
4424 } 4422 }
4425 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 4423 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
@@ -4469,8 +4467,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
4469 while (info->xmit.head != info->xmit.tail || /* More in send queue */ 4467 while (info->xmit.head != info->xmit.tail || /* More in send queue */
4470 (*info->ostatusadr & 0x007f) || /* more in FIFO */ 4468 (*info->ostatusadr & 0x007f) || /* more in FIFO */
4471 (elapsed_usec < 2*info->char_time_usec)) { 4469 (elapsed_usec < 2*info->char_time_usec)) {
4472 set_current_state(TASK_INTERRUPTIBLE); 4470 schedule_timeout_interruptible(1);
4473 schedule_timeout(1);
4474 if (signal_pending(current)) 4471 if (signal_pending(current))
4475 break; 4472 break;
4476 if (timeout && time_after(jiffies, orig_jiffies + timeout)) 4473 if (timeout && time_after(jiffies, orig_jiffies + timeout))
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
index e63b9dffc8d7..4d8516d1bb71 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * dz.c: Serial port driver for DECStations equiped 2 * dz.c: Serial port driver for DECStations equiped
3 * with the DZ chipset. 3 * with the DZ chipset.
4 * 4 *
5 * Copyright (C) 1998 Olivier A. D. Lebaillif 5 * Copyright (C) 1998 Olivier A. D. Lebaillif
6 * 6 *
7 * Email: olivier.lebaillif@ifrsys.com 7 * Email: olivier.lebaillif@ifrsys.com
8 * 8 *
9 * [31-AUG-98] triemer 9 * [31-AUG-98] triemer
@@ -11,14 +11,14 @@
11 * removed base_addr code - moving address assignment to setup.c 11 * removed base_addr code - moving address assignment to setup.c
12 * Changed name of dz_init to rs_init to be consistent with tc code 12 * Changed name of dz_init to rs_init to be consistent with tc code
13 * [13-NOV-98] triemer fixed code to receive characters 13 * [13-NOV-98] triemer fixed code to receive characters
14 * after patches by harald to irq code. 14 * after patches by harald to irq code.
15 * [09-JAN-99] triemer minor fix for schedule - due to removal of timeout 15 * [09-JAN-99] triemer minor fix for schedule - due to removal of timeout
16 * field from "current" - somewhere between 2.1.121 and 2.1.131 16 * field from "current" - somewhere between 2.1.121 and 2.1.131
17 Qua Jun 27 15:02:26 BRT 2001 17 Qua Jun 27 15:02:26 BRT 2001
18 * [27-JUN-2001] Arnaldo Carvalho de Melo <acme@conectiva.com.br> - cleanups 18 * [27-JUN-2001] Arnaldo Carvalho de Melo <acme@conectiva.com.br> - cleanups
19 * 19 *
20 * Parts (C) 1999 David Airlie, airlied@linux.ie 20 * Parts (C) 1999 David Airlie, airlied@linux.ie
21 * [07-SEP-99] Bugfixes 21 * [07-SEP-99] Bugfixes
22 * 22 *
23 * [06-Jan-2002] Russell King <rmk@arm.linux.org.uk> 23 * [06-Jan-2002] Russell King <rmk@arm.linux.org.uk>
24 * Converted to new serial core 24 * Converted to new serial core
@@ -64,7 +64,7 @@ static struct dz_port dz_ports[DZ_NB_PORT];
64 64
65#ifdef DEBUG_DZ 65#ifdef DEBUG_DZ
66/* 66/*
67 * debugging code to send out chars via prom 67 * debugging code to send out chars via prom
68 */ 68 */
69static void debug_console(const char *s, int count) 69static void debug_console(const char *s, int count)
70{ 70{
@@ -82,7 +82,7 @@ static void debug_console(const char *s, int count)
82 * ------------------------------------------------------------ 82 * ------------------------------------------------------------
83 * dz_in () and dz_out () 83 * dz_in () and dz_out ()
84 * 84 *
85 * These routines are used to access the registers of the DZ 85 * These routines are used to access the registers of the DZ
86 * chip, hiding relocation differences between implementation. 86 * chip, hiding relocation differences between implementation.
87 * ------------------------------------------------------------ 87 * ------------------------------------------------------------
88 */ 88 */
@@ -106,8 +106,8 @@ static inline void dz_out(struct dz_port *dport, unsigned offset,
106 * ------------------------------------------------------------ 106 * ------------------------------------------------------------
107 * rs_stop () and rs_start () 107 * rs_stop () and rs_start ()
108 * 108 *
109 * These routines are called before setting or resetting 109 * These routines are called before setting or resetting
110 * tty->stopped. They enable or disable transmitter interrupts, 110 * tty->stopped. They enable or disable transmitter interrupts,
111 * as necessary. 111 * as necessary.
112 * ------------------------------------------------------------ 112 * ------------------------------------------------------------
113 */ 113 */
@@ -156,17 +156,17 @@ static void dz_enable_ms(struct uart_port *port)
156 156
157/* 157/*
158 * ------------------------------------------------------------ 158 * ------------------------------------------------------------
159 * Here starts the interrupt handling routines. All of the 159 * Here starts the interrupt handling routines. All of the
160 * following subroutines are declared as inline and are folded 160 * following subroutines are declared as inline and are folded
161 * into dz_interrupt. They were separated out for readability's 161 * into dz_interrupt. They were separated out for readability's
162 * sake. 162 * sake.
163 * 163 *
164 * Note: rs_interrupt() is a "fast" interrupt, which means that it 164 * Note: rs_interrupt() is a "fast" interrupt, which means that it
165 * runs with interrupts turned off. People who may want to modify 165 * runs with interrupts turned off. People who may want to modify
166 * rs_interrupt() should try to keep the interrupt handler as fast as 166 * rs_interrupt() should try to keep the interrupt handler as fast as
167 * possible. After you are done making modifications, it is not a bad 167 * possible. After you are done making modifications, it is not a bad
168 * idea to do: 168 * idea to do:
169 * 169 *
170 * make drivers/serial/dz.s 170 * make drivers/serial/dz.s
171 * 171 *
172 * and look at the resulting assemble code in dz.s. 172 * and look at the resulting assemble code in dz.s.
@@ -403,7 +403,7 @@ static void dz_set_mctrl(struct uart_port *uport, unsigned int mctrl)
403 * startup () 403 * startup ()
404 * 404 *
405 * various initialization tasks 405 * various initialization tasks
406 * ------------------------------------------------------------------- 406 * -------------------------------------------------------------------
407 */ 407 */
408static int dz_startup(struct uart_port *uport) 408static int dz_startup(struct uart_port *uport)
409{ 409{
@@ -430,13 +430,13 @@ static int dz_startup(struct uart_port *uport)
430 return 0; 430 return 0;
431} 431}
432 432
433/* 433/*
434 * ------------------------------------------------------------------- 434 * -------------------------------------------------------------------
435 * shutdown () 435 * shutdown ()
436 * 436 *
437 * This routine will shutdown a serial port; interrupts are disabled, and 437 * This routine will shutdown a serial port; interrupts are disabled, and
438 * DTR is dropped if the hangup on close termio flag is on. 438 * DTR is dropped if the hangup on close termio flag is on.
439 * ------------------------------------------------------------------- 439 * -------------------------------------------------------------------
440 */ 440 */
441static void dz_shutdown(struct uart_port *uport) 441static void dz_shutdown(struct uart_port *uport)
442{ 442{
@@ -451,7 +451,7 @@ static void dz_shutdown(struct uart_port *uport)
451 * release the bus after transmitting. This must be done when 451 * release the bus after transmitting. This must be done when
452 * the transmit shift register is empty, not be done when the 452 * the transmit shift register is empty, not be done when the
453 * transmit holding register is empty. This functionality 453 * transmit holding register is empty. This functionality
454 * allows an RS485 driver to be written in user space. 454 * allows an RS485 driver to be written in user space.
455 */ 455 */
456static unsigned int dz_tx_empty(struct uart_port *uport) 456static unsigned int dz_tx_empty(struct uart_port *uport)
457{ 457{
@@ -645,9 +645,9 @@ static void __init dz_init_ports(void)
645 645
646 if (mips_machtype == MACH_DS23100 || 646 if (mips_machtype == MACH_DS23100 ||
647 mips_machtype == MACH_DS5100) 647 mips_machtype == MACH_DS5100)
648 base = (unsigned long) KN01_DZ11_BASE; 648 base = CKSEG1ADDR(KN01_SLOT_BASE + KN01_DZ11);
649 else 649 else
650 base = (unsigned long) KN02_DZ11_BASE; 650 base = CKSEG1ADDR(KN02_SLOT_BASE + KN02_DZ11);
651 651
652 for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) { 652 for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) {
653 spin_lock_init(&dport->port.lock); 653 spin_lock_init(&dport->port.lock);
@@ -695,13 +695,13 @@ static void dz_console_put_char(struct dz_port *dport, unsigned char ch)
695 695
696 spin_unlock_irqrestore(&dport->port.lock, flags); 696 spin_unlock_irqrestore(&dport->port.lock, flags);
697} 697}
698/* 698/*
699 * ------------------------------------------------------------------- 699 * -------------------------------------------------------------------
700 * dz_console_print () 700 * dz_console_print ()
701 * 701 *
702 * dz_console_print is registered for printk. 702 * dz_console_print is registered for printk.
703 * The console must be locked when we get here. 703 * The console must be locked when we get here.
704 * ------------------------------------------------------------------- 704 * -------------------------------------------------------------------
705 */ 705 */
706static void dz_console_print(struct console *cons, 706static void dz_console_print(struct console *cons,
707 const char *str, 707 const char *str,
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 4c985e6b3784..83c4c1216587 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -36,7 +36,7 @@
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/console.h> 37#include <linux/console.h>
38#include <linux/sysrq.h> 38#include <linux/sysrq.h>
39#include <linux/device.h> 39#include <linux/platform_device.h>
40#include <linux/tty.h> 40#include <linux/tty.h>
41#include <linux/tty_flip.h> 41#include <linux/tty_flip.h>
42#include <linux/serial_core.h> 42#include <linux/serial_core.h>
@@ -73,7 +73,7 @@ struct imx_port {
73 struct uart_port port; 73 struct uart_port port;
74 struct timer_list timer; 74 struct timer_list timer;
75 unsigned int old_status; 75 unsigned int old_status;
76 int txirq,rxirq; 76 int txirq,rxirq,rtsirq;
77}; 77};
78 78
79/* 79/*
@@ -181,6 +181,22 @@ static void imx_start_tx(struct uart_port *port)
181 imx_transmit_buffer(sport); 181 imx_transmit_buffer(sport);
182} 182}
183 183
184static irqreturn_t imx_rtsint(int irq, void *dev_id, struct pt_regs *regs)
185{
186 struct imx_port *sport = (struct imx_port *)dev_id;
187 unsigned int val = USR1((u32)sport->port.membase)&USR1_RTSS;
188 unsigned long flags;
189
190 spin_lock_irqsave(&sport->port.lock, flags);
191
192 USR1((u32)sport->port.membase) = USR1_RTSD;
193 uart_handle_cts_change(&sport->port, !!val);
194 wake_up_interruptible(&sport->port.info->delta_msr_wait);
195
196 spin_unlock_irqrestore(&sport->port.lock, flags);
197 return IRQ_HANDLED;
198}
199
184static irqreturn_t imx_txint(int irq, void *dev_id, struct pt_regs *regs) 200static irqreturn_t imx_txint(int irq, void *dev_id, struct pt_regs *regs)
185{ 201{
186 struct imx_port *sport = (struct imx_port *)dev_id; 202 struct imx_port *sport = (struct imx_port *)dev_id;
@@ -383,18 +399,24 @@ static int imx_startup(struct uart_port *port)
383 */ 399 */
384 retval = request_irq(sport->rxirq, imx_rxint, 0, 400 retval = request_irq(sport->rxirq, imx_rxint, 0,
385 DRIVER_NAME, sport); 401 DRIVER_NAME, sport);
386 if (retval) goto error_out2; 402 if (retval) goto error_out1;
387 403
388 retval = request_irq(sport->txirq, imx_txint, 0, 404 retval = request_irq(sport->txirq, imx_txint, 0,
389 "imx-uart", sport); 405 DRIVER_NAME, sport);
390 if (retval) goto error_out1; 406 if (retval) goto error_out2;
407
408 retval = request_irq(sport->rtsirq, imx_rtsint, 0,
409 DRIVER_NAME, sport);
410 if (retval) goto error_out3;
411 set_irq_type(sport->rtsirq, IRQT_BOTHEDGE);
391 412
392 /* 413 /*
393 * Finally, clear and enable interrupts 414 * Finally, clear and enable interrupts
394 */ 415 */
395 416
417 USR1((u32)sport->port.membase) = USR1_RTSD;
396 UCR1((u32)sport->port.membase) |= 418 UCR1((u32)sport->port.membase) |=
397 (UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_UARTEN); 419 (UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN);
398 420
399 UCR2((u32)sport->port.membase) |= (UCR2_RXEN | UCR2_TXEN); 421 UCR2((u32)sport->port.membase) |= (UCR2_RXEN | UCR2_TXEN);
400 /* 422 /*
@@ -406,10 +428,11 @@ static int imx_startup(struct uart_port *port)
406 428
407 return 0; 429 return 0;
408 430
409error_out1: 431error_out3:
410 free_irq(sport->rxirq, sport);
411error_out2:
412 free_irq(sport->txirq, sport); 432 free_irq(sport->txirq, sport);
433error_out2:
434 free_irq(sport->rxirq, sport);
435error_out1:
413 return retval; 436 return retval;
414} 437}
415 438
@@ -425,6 +448,7 @@ static void imx_shutdown(struct uart_port *port)
425 /* 448 /*
426 * Free the interrupts 449 * Free the interrupts
427 */ 450 */
451 free_irq(sport->rtsirq, sport);
428 free_irq(sport->txirq, sport); 452 free_irq(sport->txirq, sport);
429 free_irq(sport->rxirq, sport); 453 free_irq(sport->rxirq, sport);
430 454
@@ -433,7 +457,7 @@ static void imx_shutdown(struct uart_port *port)
433 */ 457 */
434 458
435 UCR1((u32)sport->port.membase) &= 459 UCR1((u32)sport->port.membase) &=
436 ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_UARTEN); 460 ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN);
437} 461}
438 462
439static void 463static void
@@ -523,7 +547,7 @@ imx_set_termios(struct uart_port *port, struct termios *termios,
523 * disable interrupts and drain transmitter 547 * disable interrupts and drain transmitter
524 */ 548 */
525 old_ucr1 = UCR1((u32)sport->port.membase); 549 old_ucr1 = UCR1((u32)sport->port.membase);
526 UCR1((u32)sport->port.membase) &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN); 550 UCR1((u32)sport->port.membase) &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN);
527 551
528 while ( !(USR2((u32)sport->port.membase) & USR2_TXDC)) 552 while ( !(USR2((u32)sport->port.membase) & USR2_TXDC))
529 barrier(); 553 barrier();
@@ -644,6 +668,7 @@ static struct imx_port imx_ports[] = {
644 { 668 {
645 .txirq = UART1_MINT_TX, 669 .txirq = UART1_MINT_TX,
646 .rxirq = UART1_MINT_RX, 670 .rxirq = UART1_MINT_RX,
671 .rtsirq = UART1_MINT_RTS,
647 .port = { 672 .port = {
648 .type = PORT_IMX, 673 .type = PORT_IMX,
649 .iotype = SERIAL_IO_MEM, 674 .iotype = SERIAL_IO_MEM,
@@ -659,6 +684,7 @@ static struct imx_port imx_ports[] = {
659 }, { 684 }, {
660 .txirq = UART2_MINT_TX, 685 .txirq = UART2_MINT_TX,
661 .rxirq = UART2_MINT_RX, 686 .rxirq = UART2_MINT_RX,
687 .rtsirq = UART2_MINT_RTS,
662 .port = { 688 .port = {
663 .type = PORT_IMX, 689 .type = PORT_IMX,
664 .iotype = SERIAL_IO_MEM, 690 .iotype = SERIAL_IO_MEM,
@@ -738,7 +764,7 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
738 764
739 UCR1((u32)sport->port.membase) = 765 UCR1((u32)sport->port.membase) =
740 (old_ucr1 | UCR1_UARTCLKEN | UCR1_UARTEN) 766 (old_ucr1 | UCR1_UARTCLKEN | UCR1_UARTEN)
741 & ~(UCR1_TXMPTYEN | UCR1_RRDYEN); 767 & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN);
742 UCR2((u32)sport->port.membase) = old_ucr2 | UCR2_TXEN; 768 UCR2((u32)sport->port.membase) = old_ucr2 | UCR2_TXEN;
743 769
744 /* 770 /*
@@ -860,7 +886,7 @@ imx_console_setup(struct console *co, char *options)
860 return uart_set_options(&sport->port, co, baud, parity, bits, flow); 886 return uart_set_options(&sport->port, co, baud, parity, bits, flow);
861} 887}
862 888
863extern struct uart_driver imx_reg; 889static struct uart_driver imx_reg;
864static struct console imx_console = { 890static struct console imx_console = {
865 .name = "ttySMX", 891 .name = "ttySMX",
866 .write = imx_console_write, 892 .write = imx_console_write,
@@ -895,41 +921,39 @@ static struct uart_driver imx_reg = {
895 .cons = IMX_CONSOLE, 921 .cons = IMX_CONSOLE,
896}; 922};
897 923
898static int serial_imx_suspend(struct device *_dev, pm_message_t state, u32 level) 924static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
899{ 925{
900 struct imx_port *sport = dev_get_drvdata(_dev); 926 struct imx_port *sport = platform_get_drvdata(dev);
901 927
902 if (sport && level == SUSPEND_DISABLE) 928 if (sport)
903 uart_suspend_port(&imx_reg, &sport->port); 929 uart_suspend_port(&imx_reg, &sport->port);
904 930
905 return 0; 931 return 0;
906} 932}
907 933
908static int serial_imx_resume(struct device *_dev, u32 level) 934static int serial_imx_resume(struct platform_device *dev)
909{ 935{
910 struct imx_port *sport = dev_get_drvdata(_dev); 936 struct imx_port *sport = platform_get_drvdata(dev);
911 937
912 if (sport && level == RESUME_ENABLE) 938 if (sport)
913 uart_resume_port(&imx_reg, &sport->port); 939 uart_resume_port(&imx_reg, &sport->port);
914 940
915 return 0; 941 return 0;
916} 942}
917 943
918static int serial_imx_probe(struct device *_dev) 944static int serial_imx_probe(struct platform_device *dev)
919{ 945{
920 struct platform_device *dev = to_platform_device(_dev); 946 imx_ports[dev->id].port.dev = &dev->dev;
921
922 imx_ports[dev->id].port.dev = _dev;
923 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); 947 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port);
924 dev_set_drvdata(_dev, &imx_ports[dev->id]); 948 platform_set_drvdata(dev, &imx_ports[dev->id]);
925 return 0; 949 return 0;
926} 950}
927 951
928static int serial_imx_remove(struct device *_dev) 952static int serial_imx_remove(struct platform_device *dev)
929{ 953{
930 struct imx_port *sport = dev_get_drvdata(_dev); 954 struct imx_port *sport = platform_get_drvdata(dev);
931 955
932 dev_set_drvdata(_dev, NULL); 956 platform_set_drvdata(dev, NULL);
933 957
934 if (sport) 958 if (sport)
935 uart_remove_one_port(&imx_reg, &sport->port); 959 uart_remove_one_port(&imx_reg, &sport->port);
@@ -937,14 +961,15 @@ static int serial_imx_remove(struct device *_dev)
937 return 0; 961 return 0;
938} 962}
939 963
940static struct device_driver serial_imx_driver = { 964static struct platform_driver serial_imx_driver = {
941 .name = "imx-uart",
942 .bus = &platform_bus_type,
943 .probe = serial_imx_probe, 965 .probe = serial_imx_probe,
944 .remove = serial_imx_remove, 966 .remove = serial_imx_remove,
945 967
946 .suspend = serial_imx_suspend, 968 .suspend = serial_imx_suspend,
947 .resume = serial_imx_resume, 969 .resume = serial_imx_resume,
970 .driver = {
971 .name = "imx-uart",
972 },
948}; 973};
949 974
950static int __init imx_serial_init(void) 975static int __init imx_serial_init(void)
@@ -959,7 +984,7 @@ static int __init imx_serial_init(void)
959 if (ret) 984 if (ret)
960 return ret; 985 return ret;
961 986
962 ret = driver_register(&serial_imx_driver); 987 ret = platform_driver_register(&serial_imx_driver);
963 if (ret != 0) 988 if (ret != 0)
964 uart_unregister_driver(&imx_reg); 989 uart_unregister_driver(&imx_reg);
965 990
@@ -969,6 +994,7 @@ static int __init imx_serial_init(void)
969static void __exit imx_serial_exit(void) 994static void __exit imx_serial_exit(void)
970{ 995{
971 uart_unregister_driver(&imx_reg); 996 uart_unregister_driver(&imx_reg);
997 platform_driver_unregister(&serial_imx_driver);
972} 998}
973 999
974module_init(imx_serial_init); 1000module_init(imx_serial_init);
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 0c5c96a582b3..771676abee60 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -308,6 +308,8 @@ struct ioc4_serial {
308typedef void ioc4_intr_func_f(void *, uint32_t); 308typedef void ioc4_intr_func_f(void *, uint32_t);
309typedef ioc4_intr_func_f *ioc4_intr_func_t; 309typedef ioc4_intr_func_f *ioc4_intr_func_t;
310 310
311static unsigned int Num_of_ioc4_cards;
312
311/* defining this will get you LOTS of great debug info */ 313/* defining this will get you LOTS of great debug info */
312//#define DEBUG_INTERRUPTS 314//#define DEBUG_INTERRUPTS
313#define DPRINT_CONFIG(_x...) ; 315#define DPRINT_CONFIG(_x...) ;
@@ -317,7 +319,8 @@ typedef ioc4_intr_func_f *ioc4_intr_func_t;
317#define WAKEUP_CHARS 256 319#define WAKEUP_CHARS 256
318 320
319/* number of characters we want to transmit to the lower level at a time */ 321/* number of characters we want to transmit to the lower level at a time */
320#define IOC4_MAX_CHARS 128 322#define IOC4_MAX_CHARS 256
323#define IOC4_FIFO_CHARS 255
321 324
322/* Device name we're using */ 325/* Device name we're using */
323#define DEVICE_NAME "ttyIOC" 326#define DEVICE_NAME "ttyIOC"
@@ -973,18 +976,6 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)
973 this_ir &= ~this_mir; 976 this_ir &= ~this_mir;
974 } 977 }
975 } 978 }
976 if (this_ir) {
977 printk(KERN_ERR
978 "unknown IOC4 %s interrupt 0x%x, sio_ir = 0x%x,"
979 " sio_ies = 0x%x, other_ir = 0x%x :"
980 "other_ies = 0x%x\n",
981 (intr_type == IOC4_SIO_INTR_TYPE) ? "sio" :
982 "other", this_ir,
983 readl(&soft->is_ioc4_misc_addr->sio_ir.raw),
984 readl(&soft->is_ioc4_misc_addr->sio_ies.raw),
985 readl(&soft->is_ioc4_misc_addr->other_ir.raw),
986 readl(&soft->is_ioc4_misc_addr->other_ies.raw));
987 }
988 } 979 }
989#ifdef DEBUG_INTERRUPTS 980#ifdef DEBUG_INTERRUPTS
990 { 981 {
@@ -1050,6 +1041,7 @@ static int inline ioc4_attach_local(struct ioc4_driver_data *idd)
1050 return -ENOMEM; 1041 return -ENOMEM;
1051 } 1042 }
1052 memset(port, 0, sizeof(struct ioc4_port)); 1043 memset(port, 0, sizeof(struct ioc4_port));
1044 spin_lock_init(&port->ip_lock);
1053 1045
1054 /* we need to remember the previous ones, to point back to 1046 /* we need to remember the previous ones, to point back to
1055 * them farther down - setting up the ring buffers. 1047 * them farther down - setting up the ring buffers.
@@ -1703,12 +1695,14 @@ ioc4_change_speed(struct uart_port *the_port,
1703 baud = 9600; 1695 baud = 9600;
1704 1696
1705 if (!the_port->fifosize) 1697 if (!the_port->fifosize)
1706 the_port->fifosize = IOC4_MAX_CHARS; 1698 the_port->fifosize = IOC4_FIFO_CHARS;
1707 the_port->timeout = ((the_port->fifosize * HZ * bits) / (baud / 10)); 1699 the_port->timeout = ((the_port->fifosize * HZ * bits) / (baud / 10));
1708 the_port->timeout += HZ / 50; /* Add .02 seconds of slop */ 1700 the_port->timeout += HZ / 50; /* Add .02 seconds of slop */
1709 1701
1710 the_port->ignore_status_mask = N_ALL_INPUT; 1702 the_port->ignore_status_mask = N_ALL_INPUT;
1711 1703
1704 info->tty->low_latency = 1;
1705
1712 if (I_IGNPAR(info->tty)) 1706 if (I_IGNPAR(info->tty))
1713 the_port->ignore_status_mask &= ~(N_PARITY_ERROR 1707 the_port->ignore_status_mask &= ~(N_PARITY_ERROR
1714 | N_FRAMING_ERROR); 1708 | N_FRAMING_ERROR);
@@ -1754,7 +1748,6 @@ ioc4_change_speed(struct uart_port *the_port,
1754 */ 1748 */
1755static inline int ic4_startup_local(struct uart_port *the_port) 1749static inline int ic4_startup_local(struct uart_port *the_port)
1756{ 1750{
1757 int retval = 0;
1758 struct ioc4_port *port; 1751 struct ioc4_port *port;
1759 struct uart_info *info; 1752 struct uart_info *info;
1760 1753
@@ -1766,9 +1759,6 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1766 return -1; 1759 return -1;
1767 1760
1768 info = the_port->info; 1761 info = the_port->info;
1769 if (info->flags & UIF_INITIALIZED) {
1770 return retval;
1771 }
1772 1762
1773 if (info->tty) { 1763 if (info->tty) {
1774 set_bit(TTY_IO_ERROR, &info->tty->flags); 1764 set_bit(TTY_IO_ERROR, &info->tty->flags);
@@ -1787,7 +1777,6 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1787 /* set the speed of the serial port */ 1777 /* set the speed of the serial port */
1788 ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); 1778 ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0);
1789 1779
1790 info->flags |= UIF_INITIALIZED;
1791 return 0; 1780 return 0;
1792} 1781}
1793 1782
@@ -1797,9 +1786,13 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1797 */ 1786 */
1798static void ioc4_cb_output_lowat(struct ioc4_port *port) 1787static void ioc4_cb_output_lowat(struct ioc4_port *port)
1799{ 1788{
1789 unsigned long pflags;
1790
1800 /* ip_lock is set on the call here */ 1791 /* ip_lock is set on the call here */
1801 if (port->ip_port) { 1792 if (port->ip_port) {
1793 spin_lock_irqsave(&port->ip_port->lock, pflags);
1802 transmit_chars(port->ip_port); 1794 transmit_chars(port->ip_port);
1795 spin_unlock_irqrestore(&port->ip_port->lock, pflags);
1803 } 1796 }
1804} 1797}
1805 1798
@@ -2076,8 +2069,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
2076 * available data as long as it returns some. 2069 * available data as long as it returns some.
2077 */ 2070 */
2078 /* Re-arm the timer */ 2071 /* Re-arm the timer */
2079 writel(port->ip_rx_cons | IOC4_SRCIR_ARM, 2072 writel(port->ip_rx_cons | IOC4_SRCIR_ARM, &port->ip_serial_regs->srcir);
2080 &port->ip_serial_regs->srcir);
2081 2073
2082 prod_ptr = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK; 2074 prod_ptr = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK;
2083 cons_ptr = port->ip_rx_cons; 2075 cons_ptr = port->ip_rx_cons;
@@ -2311,6 +2303,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
2311 } 2303 }
2312 return total; 2304 return total;
2313} 2305}
2306
2314/** 2307/**
2315 * receive_chars - upper level read. Called with ip_lock. 2308 * receive_chars - upper level read. Called with ip_lock.
2316 * @the_port: port to read from 2309 * @the_port: port to read from
@@ -2319,9 +2312,11 @@ static void receive_chars(struct uart_port *the_port)
2319{ 2312{
2320 struct tty_struct *tty; 2313 struct tty_struct *tty;
2321 unsigned char ch[IOC4_MAX_CHARS]; 2314 unsigned char ch[IOC4_MAX_CHARS];
2322 int read_count, request_count; 2315 int read_count, request_count = IOC4_MAX_CHARS;
2323 struct uart_icount *icount; 2316 struct uart_icount *icount;
2324 struct uart_info *info = the_port->info; 2317 struct uart_info *info = the_port->info;
2318 int flip = 0;
2319 unsigned long pflags;
2325 2320
2326 /* Make sure all the pointers are "good" ones */ 2321 /* Make sure all the pointers are "good" ones */
2327 if (!info) 2322 if (!info)
@@ -2329,16 +2324,17 @@ static void receive_chars(struct uart_port *the_port)
2329 if (!info->tty) 2324 if (!info->tty)
2330 return; 2325 return;
2331 2326
2327 spin_lock_irqsave(&the_port->lock, pflags);
2332 tty = info->tty; 2328 tty = info->tty;
2333 2329
2334 request_count = TTY_FLIPBUF_SIZE - tty->flip.count - 1; 2330 if (request_count > TTY_FLIPBUF_SIZE - tty->flip.count)
2331 request_count = TTY_FLIPBUF_SIZE - tty->flip.count;
2335 2332
2336 if (request_count > 0) { 2333 if (request_count > 0) {
2337 if (request_count > IOC4_MAX_CHARS - 2)
2338 request_count = IOC4_MAX_CHARS - 2;
2339 icount = &the_port->icount; 2334 icount = &the_port->icount;
2340 read_count = do_read(the_port, ch, request_count); 2335 read_count = do_read(the_port, ch, request_count);
2341 if (read_count > 0) { 2336 if (read_count > 0) {
2337 flip = 1;
2342 memcpy(tty->flip.char_buf_ptr, ch, read_count); 2338 memcpy(tty->flip.char_buf_ptr, ch, read_count);
2343 memset(tty->flip.flag_buf_ptr, TTY_NORMAL, read_count); 2339 memset(tty->flip.flag_buf_ptr, TTY_NORMAL, read_count);
2344 tty->flip.char_buf_ptr += read_count; 2340 tty->flip.char_buf_ptr += read_count;
@@ -2347,7 +2343,11 @@ static void receive_chars(struct uart_port *the_port)
2347 icount->rx += read_count; 2343 icount->rx += read_count;
2348 } 2344 }
2349 } 2345 }
2350 tty_flip_buffer_push(tty); 2346
2347 spin_unlock_irqrestore(&the_port->lock, pflags);
2348
2349 if (flip)
2350 tty_flip_buffer_push(tty);
2351} 2351}
2352 2352
2353/** 2353/**
@@ -2405,18 +2405,14 @@ static void ic4_shutdown(struct uart_port *the_port)
2405 2405
2406 info = the_port->info; 2406 info = the_port->info;
2407 2407
2408 if (!(info->flags & UIF_INITIALIZED))
2409 return;
2410
2411 wake_up_interruptible(&info->delta_msr_wait); 2408 wake_up_interruptible(&info->delta_msr_wait);
2412 2409
2413 if (info->tty) 2410 if (info->tty)
2414 set_bit(TTY_IO_ERROR, &info->tty->flags); 2411 set_bit(TTY_IO_ERROR, &info->tty->flags);
2415 2412
2416 spin_lock_irqsave(&port->ip_lock, port_flags); 2413 spin_lock_irqsave(&the_port->lock, port_flags);
2417 set_notification(port, N_ALL, 0); 2414 set_notification(port, N_ALL, 0);
2418 info->flags &= ~UIF_INITIALIZED; 2415 spin_unlock_irqrestore(&the_port->lock, port_flags);
2419 spin_unlock_irqrestore(&port->ip_lock, port_flags);
2420} 2416}
2421 2417
2422/** 2418/**
@@ -2475,12 +2471,10 @@ static unsigned int ic4_get_mctrl(struct uart_port *the_port)
2475static void ic4_start_tx(struct uart_port *the_port) 2471static void ic4_start_tx(struct uart_port *the_port)
2476{ 2472{
2477 struct ioc4_port *port = get_ioc4_port(the_port); 2473 struct ioc4_port *port = get_ioc4_port(the_port);
2478 unsigned long flags;
2479 2474
2480 if (port) { 2475 if (port) {
2481 spin_lock_irqsave(&port->ip_lock, flags); 2476 set_notification(port, N_OUTPUT_LOWAT, 1);
2482 transmit_chars(the_port); 2477 enable_intrs(port, port->ip_hooks->intr_tx_mt);
2483 spin_unlock_irqrestore(&port->ip_lock, flags);
2484 } 2478 }
2485} 2479}
2486 2480
@@ -2522,9 +2516,9 @@ static int ic4_startup(struct uart_port *the_port)
2522 } 2516 }
2523 2517
2524 /* Start up the serial port */ 2518 /* Start up the serial port */
2525 spin_lock_irqsave(&port->ip_lock, port_flags); 2519 spin_lock_irqsave(&the_port->lock, port_flags);
2526 retval = ic4_startup_local(the_port); 2520 retval = ic4_startup_local(the_port);
2527 spin_unlock_irqrestore(&port->ip_lock, port_flags); 2521 spin_unlock_irqrestore(&the_port->lock, port_flags);
2528 return retval; 2522 return retval;
2529} 2523}
2530 2524
@@ -2539,12 +2533,11 @@ static void
2539ic4_set_termios(struct uart_port *the_port, 2533ic4_set_termios(struct uart_port *the_port,
2540 struct termios *termios, struct termios *old_termios) 2534 struct termios *termios, struct termios *old_termios)
2541{ 2535{
2542 struct ioc4_port *port = get_ioc4_port(the_port);
2543 unsigned long port_flags; 2536 unsigned long port_flags;
2544 2537
2545 spin_lock_irqsave(&port->ip_lock, port_flags); 2538 spin_lock_irqsave(&the_port->lock, port_flags);
2546 ioc4_change_speed(the_port, termios, old_termios); 2539 ioc4_change_speed(the_port, termios, old_termios);
2547 spin_unlock_irqrestore(&port->ip_lock, port_flags); 2540 spin_unlock_irqrestore(&the_port->lock, port_flags);
2548} 2541}
2549 2542
2550/** 2543/**
@@ -2619,24 +2612,25 @@ ioc4_serial_core_attach(struct pci_dev *pdev)
2619 __FUNCTION__, (void *)the_port, 2612 __FUNCTION__, (void *)the_port,
2620 (void *)port)); 2613 (void *)port));
2621 2614
2622 spin_lock_init(&the_port->lock);
2623 /* membase, iobase and mapbase just need to be non-0 */ 2615 /* membase, iobase and mapbase just need to be non-0 */
2624 the_port->membase = (unsigned char __iomem *)1; 2616 the_port->membase = (unsigned char __iomem *)1;
2625 the_port->line = the_port->iobase = ii; 2617 the_port->iobase = (pdev->bus->number << 16) | ii;
2618 the_port->line = (Num_of_ioc4_cards << 2) | ii;
2626 the_port->mapbase = 1; 2619 the_port->mapbase = 1;
2627 the_port->type = PORT_16550A; 2620 the_port->type = PORT_16550A;
2628 the_port->fifosize = IOC4_MAX_CHARS; 2621 the_port->fifosize = IOC4_FIFO_CHARS;
2629 the_port->ops = &ioc4_ops; 2622 the_port->ops = &ioc4_ops;
2630 the_port->irq = control->ic_irq; 2623 the_port->irq = control->ic_irq;
2631 the_port->dev = &pdev->dev; 2624 the_port->dev = &pdev->dev;
2625 spin_lock_init(&the_port->lock);
2632 if (uart_add_one_port(&ioc4_uart, the_port) < 0) { 2626 if (uart_add_one_port(&ioc4_uart, the_port) < 0) {
2633 printk(KERN_WARNING 2627 printk(KERN_WARNING
2634 "%s: unable to add port %d\n", 2628 "%s: unable to add port %d bus %d\n",
2635 __FUNCTION__, the_port->line); 2629 __FUNCTION__, the_port->line, pdev->bus->number);
2636 } else { 2630 } else {
2637 DPRINT_CONFIG( 2631 DPRINT_CONFIG(
2638 ("IOC4 serial driver port %d irq = %d\n", 2632 ("IOC4 serial port %d irq = %d, bus %d\n",
2639 the_port->line, the_port->irq)); 2633 the_port->line, the_port->irq, pdev->bus->number));
2640 } 2634 }
2641 /* all ports are rs232 for now */ 2635 /* all ports are rs232 for now */
2642 ioc4_set_proto(port, PROTO_RS232); 2636 ioc4_set_proto(port, PROTO_RS232);
@@ -2746,6 +2740,8 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
2746 if ((ret = ioc4_serial_core_attach(idd->idd_pdev))) 2740 if ((ret = ioc4_serial_core_attach(idd->idd_pdev)))
2747 goto out4; 2741 goto out4;
2748 2742
2743 Num_of_ioc4_cards++;
2744
2749 return ret; 2745 return ret;
2750 2746
2751 /* error exits that give back resources */ 2747 /* error exits that give back resources */
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
index e2ebdcad553c..47f7404cb045 100644
--- a/drivers/serial/mcfserial.c
+++ b/drivers/serial/mcfserial.c
@@ -57,7 +57,8 @@ struct timer_list mcfrs_timer_struct;
57 * keep going. Perhaps one day the cflag settings for the 57 * keep going. Perhaps one day the cflag settings for the
58 * console can be used instead. 58 * console can be used instead.
59 */ 59 */
60#if defined(CONFIG_ARNEWSH) || defined(CONFIG_MOTOROLA) || defined(CONFIG_senTec) || defined(CONFIG_SNEHA) 60#if defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \
61 defined(CONFIG_senTec) || defined(CONFIG_SNEHA)
61#define CONSOLE_BAUD_RATE 19200 62#define CONSOLE_BAUD_RATE 19200
62#define DEFAULT_CBAUD B19200 63#define DEFAULT_CBAUD B19200
63#endif 64#endif
@@ -67,7 +68,7 @@ struct timer_list mcfrs_timer_struct;
67#define DEFAULT_CBAUD B38400 68#define DEFAULT_CBAUD B38400
68#endif 69#endif
69 70
70#if defined(CONFIG_MOD5272) 71#if defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB)
71#define CONSOLE_BAUD_RATE 115200 72#define CONSOLE_BAUD_RATE 115200
72#define DEFAULT_CBAUD B115200 73#define DEFAULT_CBAUD B115200
73#endif 74#endif
@@ -95,7 +96,8 @@ static struct tty_driver *mcfrs_serial_driver;
95#undef SERIAL_DEBUG_OPEN 96#undef SERIAL_DEBUG_OPEN
96#undef SERIAL_DEBUG_FLOW 97#undef SERIAL_DEBUG_FLOW
97 98
98#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) 99#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
100 defined(CONFIG_M520x)
99#define IRQBASE (MCFINT_VECBASE+MCFINT_UART0) 101#define IRQBASE (MCFINT_VECBASE+MCFINT_UART0)
100#else 102#else
101#define IRQBASE 73 103#define IRQBASE 73
@@ -1528,6 +1530,35 @@ static void mcfrs_irqinit(struct mcf_serial *info)
1528 imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 + 1530 imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 +
1529 MCFINTC_IMRL); 1531 MCFINTC_IMRL);
1530 *imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1); 1532 *imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1);
1533#elif defined(CONFIG_M520x)
1534 volatile unsigned char *icrp, *uartp;
1535 volatile unsigned long *imrp;
1536
1537 uartp = info->addr;
1538
1539 icrp = (volatile unsigned char *) (MCF_MBAR + MCFICM_INTC0 +
1540 MCFINTC_ICR0 + MCFINT_UART0 + info->line);
1541 *icrp = 0x03;
1542
1543 imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 +
1544 MCFINTC_IMRL);
1545 *imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1);
1546 if (info->line < 2) {
1547 unsigned short *uart_par;
1548 uart_par = (unsigned short *)(MCF_IPSBAR + MCF_GPIO_PAR_UART);
1549 if (info->line == 0)
1550 *uart_par |= MCF_GPIO_PAR_UART_PAR_UTXD0
1551 | MCF_GPIO_PAR_UART_PAR_URXD0;
1552 else if (info->line == 1)
1553 *uart_par |= MCF_GPIO_PAR_UART_PAR_UTXD1
1554 | MCF_GPIO_PAR_UART_PAR_URXD1;
1555 } else if (info->line == 2) {
1556 unsigned char *feci2c_par;
1557 feci2c_par = (unsigned char *)(MCF_IPSBAR + MCF_GPIO_PAR_FECI2C);
1558 *feci2c_par &= ~0x0F;
1559 *feci2c_par |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2
1560 | MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
1561 }
1531#else 1562#else
1532 volatile unsigned char *icrp, *uartp; 1563 volatile unsigned char *icrp, *uartp;
1533 1564
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 0585ab27ffde..b8727d9bf690 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -45,7 +45,7 @@
45 */ 45 */
46 46
47#include <linux/config.h> 47#include <linux/config.h>
48#include <linux/device.h> 48#include <linux/platform_device.h>
49#include <linux/module.h> 49#include <linux/module.h>
50#include <linux/tty.h> 50#include <linux/tty.h>
51#include <linux/serial.h> 51#include <linux/serial.h>
@@ -717,16 +717,15 @@ static struct uart_driver mpc52xx_uart_driver = {
717/* ======================================================================== */ 717/* ======================================================================== */
718 718
719static int __devinit 719static int __devinit
720mpc52xx_uart_probe(struct device *dev) 720mpc52xx_uart_probe(struct platform_device *dev)
721{ 721{
722 struct platform_device *pdev = to_platform_device(dev); 722 struct resource *res = dev->resource;
723 struct resource *res = pdev->resource;
724 723
725 struct uart_port *port = NULL; 724 struct uart_port *port = NULL;
726 int i, idx, ret; 725 int i, idx, ret;
727 726
728 /* Check validity & presence */ 727 /* Check validity & presence */
729 idx = pdev->id; 728 idx = dev->id;
730 if (idx < 0 || idx >= MPC52xx_PSC_MAXNUM) 729 if (idx < 0 || idx >= MPC52xx_PSC_MAXNUM)
731 return -EINVAL; 730 return -EINVAL;
732 731
@@ -749,7 +748,7 @@ mpc52xx_uart_probe(struct device *dev)
749 port->ops = &mpc52xx_uart_ops; 748 port->ops = &mpc52xx_uart_ops;
750 749
751 /* Search for IRQ and mapbase */ 750 /* Search for IRQ and mapbase */
752 for (i=0 ; i<pdev->num_resources ; i++, res++) { 751 for (i=0 ; i<dev->num_resources ; i++, res++) {
753 if (res->flags & IORESOURCE_MEM) 752 if (res->flags & IORESOURCE_MEM)
754 port->mapbase = res->start; 753 port->mapbase = res->start;
755 else if (res->flags & IORESOURCE_IRQ) 754 else if (res->flags & IORESOURCE_IRQ)
@@ -761,17 +760,17 @@ mpc52xx_uart_probe(struct device *dev)
761 /* Add the port to the uart sub-system */ 760 /* Add the port to the uart sub-system */
762 ret = uart_add_one_port(&mpc52xx_uart_driver, port); 761 ret = uart_add_one_port(&mpc52xx_uart_driver, port);
763 if (!ret) 762 if (!ret)
764 dev_set_drvdata(dev, (void*)port); 763 platform_set_drvdata(dev, (void*)port);
765 764
766 return ret; 765 return ret;
767} 766}
768 767
769static int 768static int
770mpc52xx_uart_remove(struct device *dev) 769mpc52xx_uart_remove(struct platform_device *dev)
771{ 770{
772 struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); 771 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
773 772
774 dev_set_drvdata(dev, NULL); 773 platform_set_drvdata(dev, NULL);
775 774
776 if (port) 775 if (port)
777 uart_remove_one_port(&mpc52xx_uart_driver, port); 776 uart_remove_one_port(&mpc52xx_uart_driver, port);
@@ -781,37 +780,38 @@ mpc52xx_uart_remove(struct device *dev)
781 780
782#ifdef CONFIG_PM 781#ifdef CONFIG_PM
783static int 782static int
784mpc52xx_uart_suspend(struct device *dev, pm_message_t state, u32 level) 783mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state)
785{ 784{
786 struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); 785 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
787 786
788 if (sport && level == SUSPEND_DISABLE) 787 if (sport)
789 uart_suspend_port(&mpc52xx_uart_driver, port); 788 uart_suspend_port(&mpc52xx_uart_driver, port);
790 789
791 return 0; 790 return 0;
792} 791}
793 792
794static int 793static int
795mpc52xx_uart_resume(struct device *dev, u32 level) 794mpc52xx_uart_resume(struct platform_device *dev)
796{ 795{
797 struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); 796 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
798 797
799 if (port && level == RESUME_ENABLE) 798 if (port)
800 uart_resume_port(&mpc52xx_uart_driver, port); 799 uart_resume_port(&mpc52xx_uart_driver, port);
801 800
802 return 0; 801 return 0;
803} 802}
804#endif 803#endif
805 804
806static struct device_driver mpc52xx_uart_platform_driver = { 805static struct platform_driver mpc52xx_uart_platform_driver = {
807 .name = "mpc52xx-psc",
808 .bus = &platform_bus_type,
809 .probe = mpc52xx_uart_probe, 806 .probe = mpc52xx_uart_probe,
810 .remove = mpc52xx_uart_remove, 807 .remove = mpc52xx_uart_remove,
811#ifdef CONFIG_PM 808#ifdef CONFIG_PM
812 .suspend = mpc52xx_uart_suspend, 809 .suspend = mpc52xx_uart_suspend,
813 .resume = mpc52xx_uart_resume, 810 .resume = mpc52xx_uart_resume,
814#endif 811#endif
812 .driver = {
813 .name = "mpc52xx-psc",
814 },
815}; 815};
816 816
817 817
@@ -828,7 +828,7 @@ mpc52xx_uart_init(void)
828 828
829 ret = uart_register_driver(&mpc52xx_uart_driver); 829 ret = uart_register_driver(&mpc52xx_uart_driver);
830 if (ret == 0) { 830 if (ret == 0) {
831 ret = driver_register(&mpc52xx_uart_platform_driver); 831 ret = platform_driver_register(&mpc52xx_uart_platform_driver);
832 if (ret) 832 if (ret)
833 uart_unregister_driver(&mpc52xx_uart_driver); 833 uart_unregister_driver(&mpc52xx_uart_driver);
834 } 834 }
@@ -839,7 +839,7 @@ mpc52xx_uart_init(void)
839static void __exit 839static void __exit
840mpc52xx_uart_exit(void) 840mpc52xx_uart_exit(void)
841{ 841{
842 driver_unregister(&mpc52xx_uart_platform_driver); 842 platform_driver_unregister(&mpc52xx_uart_platform_driver);
843 uart_unregister_driver(&mpc52xx_uart_driver); 843 uart_unregister_driver(&mpc52xx_uart_driver);
844} 844}
845 845
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index efe79b1fd431..8f83e4007ecd 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -52,6 +52,8 @@
52 * 4) AFAICT, hardware flow control isn't supported by the controller --MAG. 52 * 4) AFAICT, hardware flow control isn't supported by the controller --MAG.
53 */ 53 */
54 54
55#include <linux/platform_device.h>
56
55#include "mpsc.h" 57#include "mpsc.h"
56 58
57/* 59/*
@@ -1100,6 +1102,8 @@ mpsc_start_rx(struct mpsc_port_info *pi)
1100{ 1102{
1101 pr_debug("mpsc_start_rx[%d]: Starting...\n", pi->port.line); 1103 pr_debug("mpsc_start_rx[%d]: Starting...\n", pi->port.line);
1102 1104
1105 /* Issue a Receive Abort to clear any receive errors */
1106 writel(MPSC_CHR_2_RA, pi->mpsc_base + MPSC_CHR_2);
1103 if (pi->rcv_data) { 1107 if (pi->rcv_data) {
1104 mpsc_enter_hunt(pi); 1108 mpsc_enter_hunt(pi);
1105 mpsc_sdma_cmd(pi, SDMA_SDCM_ERD); 1109 mpsc_sdma_cmd(pi, SDMA_SDCM_ERD);
@@ -1547,15 +1551,14 @@ mpsc_shared_unmap_regs(void)
1547} 1551}
1548 1552
1549static int 1553static int
1550mpsc_shared_drv_probe(struct device *dev) 1554mpsc_shared_drv_probe(struct platform_device *dev)
1551{ 1555{
1552 struct platform_device *pd = to_platform_device(dev);
1553 struct mpsc_shared_pdata *pdata; 1556 struct mpsc_shared_pdata *pdata;
1554 int rc = -ENODEV; 1557 int rc = -ENODEV;
1555 1558
1556 if (pd->id == 0) { 1559 if (dev->id == 0) {
1557 if (!(rc = mpsc_shared_map_regs(pd))) { 1560 if (!(rc = mpsc_shared_map_regs(dev))) {
1558 pdata = (struct mpsc_shared_pdata *)dev->platform_data; 1561 pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data;
1559 1562
1560 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; 1563 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val;
1561 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; 1564 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val;
@@ -1573,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev)
1573} 1576}
1574 1577
1575static int 1578static int
1576mpsc_shared_drv_remove(struct device *dev) 1579mpsc_shared_drv_remove(struct platform_device *dev)
1577{ 1580{
1578 struct platform_device *pd = to_platform_device(dev);
1579 int rc = -ENODEV; 1581 int rc = -ENODEV;
1580 1582
1581 if (pd->id == 0) { 1583 if (dev->id == 0) {
1582 mpsc_shared_unmap_regs(); 1584 mpsc_shared_unmap_regs();
1583 mpsc_shared_regs.MPSC_MRR_m = 0; 1585 mpsc_shared_regs.MPSC_MRR_m = 0;
1584 mpsc_shared_regs.MPSC_RCRR_m = 0; 1586 mpsc_shared_regs.MPSC_RCRR_m = 0;
@@ -1591,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev)
1591 return rc; 1593 return rc;
1592} 1594}
1593 1595
1594static struct device_driver mpsc_shared_driver = { 1596static struct platform_driver mpsc_shared_driver = {
1595 .name = MPSC_SHARED_NAME,
1596 .bus = &platform_bus_type,
1597 .probe = mpsc_shared_drv_probe, 1597 .probe = mpsc_shared_drv_probe,
1598 .remove = mpsc_shared_drv_remove, 1598 .remove = mpsc_shared_drv_remove,
1599 .driver = {
1600 .name = MPSC_SHARED_NAME,
1601 },
1599}; 1602};
1600 1603
1601/* 1604/*
@@ -1728,19 +1731,18 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
1728} 1731}
1729 1732
1730static int 1733static int
1731mpsc_drv_probe(struct device *dev) 1734mpsc_drv_probe(struct platform_device *dev)
1732{ 1735{
1733 struct platform_device *pd = to_platform_device(dev);
1734 struct mpsc_port_info *pi; 1736 struct mpsc_port_info *pi;
1735 int rc = -ENODEV; 1737 int rc = -ENODEV;
1736 1738
1737 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); 1739 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id);
1738 1740
1739 if (pd->id < MPSC_NUM_CTLRS) { 1741 if (dev->id < MPSC_NUM_CTLRS) {
1740 pi = &mpsc_ports[pd->id]; 1742 pi = &mpsc_ports[dev->id];
1741 1743
1742 if (!(rc = mpsc_drv_map_regs(pi, pd))) { 1744 if (!(rc = mpsc_drv_map_regs(pi, dev))) {
1743 mpsc_drv_get_platform_data(pi, pd, pd->id); 1745 mpsc_drv_get_platform_data(pi, dev, dev->id);
1744 1746
1745 if (!(rc = mpsc_make_ready(pi))) 1747 if (!(rc = mpsc_make_ready(pi)))
1746 if (!(rc = uart_add_one_port(&mpsc_reg, 1748 if (!(rc = uart_add_one_port(&mpsc_reg,
@@ -1760,27 +1762,26 @@ mpsc_drv_probe(struct device *dev)
1760} 1762}
1761 1763
1762static int 1764static int
1763mpsc_drv_remove(struct device *dev) 1765mpsc_drv_remove(struct platform_device *dev)
1764{ 1766{
1765 struct platform_device *pd = to_platform_device(dev); 1767 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
1766
1767 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id);
1768 1768
1769 if (pd->id < MPSC_NUM_CTLRS) { 1769 if (dev->id < MPSC_NUM_CTLRS) {
1770 uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); 1770 uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
1771 mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port); 1771 mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port);
1772 mpsc_drv_unmap_regs(&mpsc_ports[pd->id]); 1772 mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
1773 return 0; 1773 return 0;
1774 } 1774 }
1775 else 1775 else
1776 return -ENODEV; 1776 return -ENODEV;
1777} 1777}
1778 1778
1779static struct device_driver mpsc_driver = { 1779static struct platform_driver mpsc_driver = {
1780 .name = MPSC_CTLR_NAME,
1781 .bus = &platform_bus_type,
1782 .probe = mpsc_drv_probe, 1780 .probe = mpsc_drv_probe,
1783 .remove = mpsc_drv_remove, 1781 .remove = mpsc_drv_remove,
1782 .driver = {
1783 .name = MPSC_CTLR_NAME,
1784 },
1784}; 1785};
1785 1786
1786static int __init 1787static int __init
@@ -1794,9 +1795,9 @@ mpsc_drv_init(void)
1794 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1795 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
1795 1796
1796 if (!(rc = uart_register_driver(&mpsc_reg))) { 1797 if (!(rc = uart_register_driver(&mpsc_reg))) {
1797 if (!(rc = driver_register(&mpsc_shared_driver))) { 1798 if (!(rc = platform_driver_register(&mpsc_shared_driver))) {
1798 if ((rc = driver_register(&mpsc_driver))) { 1799 if ((rc = platform_driver_register(&mpsc_driver))) {
1799 driver_unregister(&mpsc_shared_driver); 1800 platform_driver_unregister(&mpsc_shared_driver);
1800 uart_unregister_driver(&mpsc_reg); 1801 uart_unregister_driver(&mpsc_reg);
1801 } 1802 }
1802 } 1803 }
@@ -1811,8 +1812,8 @@ mpsc_drv_init(void)
1811static void __exit 1812static void __exit
1812mpsc_drv_exit(void) 1813mpsc_drv_exit(void)
1813{ 1814{
1814 driver_unregister(&mpsc_driver); 1815 platform_driver_unregister(&mpsc_driver);
1815 driver_unregister(&mpsc_shared_driver); 1816 platform_driver_unregister(&mpsc_shared_driver);
1816 uart_unregister_driver(&mpsc_reg); 1817 uart_unregister_driver(&mpsc_reg);
1817 memset(mpsc_ports, 0, sizeof(mpsc_ports)); 1818 memset(mpsc_ports, 0, sizeof(mpsc_ports));
1818 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1819 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index 189064607709..7633132a10aa 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -27,6 +27,7 @@
27#include <linux/delay.h> /* for udelay */ 27#include <linux/delay.h> /* for udelay */
28#include <linux/device.h> 28#include <linux/device.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h>
30#include <asm/parisc-device.h> 31#include <asm/parisc-device.h>
31 32
32#ifdef CONFIG_MAGIC_SYSRQ 33#ifdef CONFIG_MAGIC_SYSRQ
@@ -64,8 +65,8 @@ static struct uart_driver mux_driver = {
64 65
65static struct timer_list mux_timer; 66static struct timer_list mux_timer;
66 67
67#define UART_PUT_CHAR(p, c) __raw_writel((c), (unsigned long)(p)->membase + IO_DATA_REG_OFFSET) 68#define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET)
68#define UART_GET_FIFO_CNT(p) __raw_readl((unsigned long)(p)->membase + IO_DCOUNT_REG_OFFSET) 69#define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET)
69#define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 70#define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8
70 71
71/** 72/**
@@ -78,10 +79,7 @@ static struct timer_list mux_timer;
78 */ 79 */
79static unsigned int mux_tx_empty(struct uart_port *port) 80static unsigned int mux_tx_empty(struct uart_port *port)
80{ 81{
81 unsigned int cnt = __raw_readl((unsigned long)port->membase 82 return UART_GET_FIFO_CNT(port) ? 0 : TIOCSER_TEMT;
82 + IO_DCOUNT_REG_OFFSET);
83
84 return cnt ? 0 : TIOCSER_TEMT;
85} 83}
86 84
87/** 85/**
@@ -217,8 +215,7 @@ static void mux_read(struct uart_port *port)
217 __u32 start_count = port->icount.rx; 215 __u32 start_count = port->icount.rx;
218 216
219 while(1) { 217 while(1) {
220 data = __raw_readl((unsigned long)port->membase 218 data = __raw_readl(port->membase + IO_DATA_REG_OFFSET);
221 + IO_DATA_REG_OFFSET);
222 219
223 if (MUX_STATUS(data)) 220 if (MUX_STATUS(data))
224 continue; 221 continue;
@@ -444,7 +441,7 @@ static int __init mux_probe(struct parisc_device *dev)
444 unsigned long bytecnt; 441 unsigned long bytecnt;
445 struct uart_port *port; 442 struct uart_port *port;
446 443
447 status = pdc_iodc_read(&bytecnt, dev->hpa, 0, iodc_data, 32); 444 status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32);
448 if(status != PDC_OK) { 445 if(status != PDC_OK) {
449 printk(KERN_ERR "Serial mux: Unable to read IODC.\n"); 446 printk(KERN_ERR "Serial mux: Unable to read IODC.\n");
450 return 1; 447 return 1;
@@ -469,16 +466,25 @@ static int __init mux_probe(struct parisc_device *dev)
469 for(i = 0; i < ports; ++i, ++port_cnt) { 466 for(i = 0; i < ports; ++i, ++port_cnt) {
470 port = &mux_ports[port_cnt]; 467 port = &mux_ports[port_cnt];
471 port->iobase = 0; 468 port->iobase = 0;
472 port->mapbase = dev->hpa + MUX_OFFSET + (i * MUX_LINE_OFFSET); 469 port->mapbase = dev->hpa.start + MUX_OFFSET +
470 (i * MUX_LINE_OFFSET);
473 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET); 471 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET);
474 port->iotype = SERIAL_IO_MEM; 472 port->iotype = SERIAL_IO_MEM;
475 port->type = PORT_MUX; 473 port->type = PORT_MUX;
476 port->irq = SERIAL_IRQ_NONE; 474 port->irq = NO_IRQ;
477 port->uartclk = 0; 475 port->uartclk = 0;
478 port->fifosize = MUX_FIFO_SIZE; 476 port->fifosize = MUX_FIFO_SIZE;
479 port->ops = &mux_pops; 477 port->ops = &mux_pops;
480 port->flags = UPF_BOOT_AUTOCONF; 478 port->flags = UPF_BOOT_AUTOCONF;
481 port->line = port_cnt; 479 port->line = port_cnt;
480
481 /* The port->timeout needs to match what is present in
482 * uart_wait_until_sent in serial_core.c. Otherwise
483 * the time spent in msleep_interruptable will be very
484 * long, causing the appearance of a console hang.
485 */
486 port->timeout = HZ / 50;
487 spin_lock_init(&port->lock);
482 status = uart_add_one_port(&mux_driver, port); 488 status = uart_add_one_port(&mux_driver, port);
483 BUG_ON(status); 489 BUG_ON(status);
484 } 490 }
@@ -497,7 +503,7 @@ static struct parisc_device_id mux_tbl[] = {
497MODULE_DEVICE_TABLE(parisc, mux_tbl); 503MODULE_DEVICE_TABLE(parisc, mux_tbl);
498 504
499static struct parisc_driver serial_mux_driver = { 505static struct parisc_driver serial_mux_driver = {
500 .name = "Serial MUX", 506 .name = "serial_mux",
501 .id_table = mux_tbl, 507 .id_table = mux_tbl,
502 .probe = mux_probe, 508 .probe = mux_probe,
503}; 509};
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 672b359b07ce..ff5e6309d682 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -39,7 +39,7 @@
39#include <linux/circ_buf.h> 39#include <linux/circ_buf.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/device.h> 42#include <linux/platform_device.h>
43#include <linux/tty.h> 43#include <linux/tty.h>
44#include <linux/tty_flip.h> 44#include <linux/tty_flip.h>
45#include <linux/serial_core.h> 45#include <linux/serial_core.h>
@@ -358,6 +358,9 @@ static int serial_pxa_startup(struct uart_port *port)
358 unsigned long flags; 358 unsigned long flags;
359 int retval; 359 int retval;
360 360
361 if (port->line == 3) /* HWUART */
362 up->mcr |= UART_MCR_AFE;
363 else
361 up->mcr = 0; 364 up->mcr = 0;
362 365
363 /* 366 /*
@@ -481,8 +484,10 @@ serial_pxa_set_termios(struct uart_port *port, struct termios *termios,
481 484
482 if ((up->port.uartclk / quot) < (2400 * 16)) 485 if ((up->port.uartclk / quot) < (2400 * 16))
483 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR1; 486 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR1;
484 else 487 else if ((up->port.uartclk / quot) < (230400 * 16))
485 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR8; 488 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR8;
489 else
490 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR32;
486 491
487 /* 492 /*
488 * Ok, we're now changing the port state. Do it with 493 * Ok, we're now changing the port state. Do it with
@@ -499,7 +504,7 @@ serial_pxa_set_termios(struct uart_port *port, struct termios *termios,
499 /* 504 /*
500 * Update the per-port timeout. 505 * Update the per-port timeout.
501 */ 506 */
502 uart_update_timeout(port, termios->c_cflag, quot); 507 uart_update_timeout(port, termios->c_cflag, baud);
503 508
504 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; 509 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
505 if (termios->c_iflag & INPCK) 510 if (termios->c_iflag & INPCK)
@@ -772,6 +777,20 @@ static struct uart_pxa_port serial_pxa_ports[] = {
772 .ops = &serial_pxa_pops, 777 .ops = &serial_pxa_pops,
773 .line = 2, 778 .line = 2,
774 }, 779 },
780 }, { /* HWUART */
781 .name = "HWUART",
782 .cken = CKEN4_HWUART,
783 .port = {
784 .type = PORT_PXA,
785 .iotype = UPIO_MEM,
786 .membase = (void *)&HWUART,
787 .mapbase = __PREG(HWUART),
788 .irq = IRQ_HWUART,
789 .uartclk = 921600 * 16,
790 .fifosize = 64,
791 .ops = &serial_pxa_pops,
792 .line = 3,
793 },
775 } 794 }
776}; 795};
777 796
@@ -786,41 +805,39 @@ static struct uart_driver serial_pxa_reg = {
786 .cons = PXA_CONSOLE, 805 .cons = PXA_CONSOLE,
787}; 806};
788 807
789static int serial_pxa_suspend(struct device *_dev, pm_message_t state, u32 level) 808static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state)
790{ 809{
791 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 810 struct uart_pxa_port *sport = platform_get_drvdata(dev);
792 811
793 if (sport && level == SUSPEND_DISABLE) 812 if (sport)
794 uart_suspend_port(&serial_pxa_reg, &sport->port); 813 uart_suspend_port(&serial_pxa_reg, &sport->port);
795 814
796 return 0; 815 return 0;
797} 816}
798 817
799static int serial_pxa_resume(struct device *_dev, u32 level) 818static int serial_pxa_resume(struct platform_device *dev)
800{ 819{
801 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 820 struct uart_pxa_port *sport = platform_get_drvdata(dev);
802 821
803 if (sport && level == RESUME_ENABLE) 822 if (sport)
804 uart_resume_port(&serial_pxa_reg, &sport->port); 823 uart_resume_port(&serial_pxa_reg, &sport->port);
805 824
806 return 0; 825 return 0;
807} 826}
808 827
809static int serial_pxa_probe(struct device *_dev) 828static int serial_pxa_probe(struct platform_device *dev)
810{ 829{
811 struct platform_device *dev = to_platform_device(_dev); 830 serial_pxa_ports[dev->id].port.dev = &dev->dev;
812
813 serial_pxa_ports[dev->id].port.dev = _dev;
814 uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); 831 uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port);
815 dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); 832 platform_set_drvdata(dev, &serial_pxa_ports[dev->id]);
816 return 0; 833 return 0;
817} 834}
818 835
819static int serial_pxa_remove(struct device *_dev) 836static int serial_pxa_remove(struct platform_device *dev)
820{ 837{
821 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 838 struct uart_pxa_port *sport = platform_get_drvdata(dev);
822 839
823 dev_set_drvdata(_dev, NULL); 840 platform_set_drvdata(dev, NULL);
824 841
825 if (sport) 842 if (sport)
826 uart_remove_one_port(&serial_pxa_reg, &sport->port); 843 uart_remove_one_port(&serial_pxa_reg, &sport->port);
@@ -828,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev)
828 return 0; 845 return 0;
829} 846}
830 847
831static struct device_driver serial_pxa_driver = { 848static struct platform_driver serial_pxa_driver = {
832 .name = "pxa2xx-uart",
833 .bus = &platform_bus_type,
834 .probe = serial_pxa_probe, 849 .probe = serial_pxa_probe,
835 .remove = serial_pxa_remove, 850 .remove = serial_pxa_remove,
836 851
837 .suspend = serial_pxa_suspend, 852 .suspend = serial_pxa_suspend,
838 .resume = serial_pxa_resume, 853 .resume = serial_pxa_resume,
854 .driver = {
855 .name = "pxa2xx-uart",
856 },
839}; 857};
840 858
841int __init serial_pxa_init(void) 859int __init serial_pxa_init(void)
@@ -846,7 +864,7 @@ int __init serial_pxa_init(void)
846 if (ret != 0) 864 if (ret != 0)
847 return ret; 865 return ret;
848 866
849 ret = driver_register(&serial_pxa_driver); 867 ret = platform_driver_register(&serial_pxa_driver);
850 if (ret != 0) 868 if (ret != 0)
851 uart_unregister_driver(&serial_pxa_reg); 869 uart_unregister_driver(&serial_pxa_reg);
852 870
@@ -855,7 +873,7 @@ int __init serial_pxa_init(void)
855 873
856void __exit serial_pxa_exit(void) 874void __exit serial_pxa_exit(void)
857{ 875{
858 driver_unregister(&serial_pxa_driver); 876 platform_driver_unregister(&serial_pxa_driver);
859 uart_unregister_driver(&serial_pxa_reg); 877 uart_unregister_driver(&serial_pxa_reg);
860} 878}
861 879
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index c361c6fb0809..47681c4654e4 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -63,7 +63,7 @@
63 63
64#include <linux/module.h> 64#include <linux/module.h>
65#include <linux/ioport.h> 65#include <linux/ioport.h>
66#include <linux/device.h> 66#include <linux/platform_device.h>
67#include <linux/init.h> 67#include <linux/init.h>
68#include <linux/sysrq.h> 68#include <linux/sysrq.h>
69#include <linux/console.h> 69#include <linux/console.h>
@@ -82,8 +82,6 @@
82#include <asm/arch/regs-serial.h> 82#include <asm/arch/regs-serial.h>
83#include <asm/arch/regs-gpio.h> 83#include <asm/arch/regs-gpio.h>
84 84
85#include <asm/mach-types.h>
86
87/* structures */ 85/* structures */
88 86
89struct s3c24xx_uart_info { 87struct s3c24xx_uart_info {
@@ -753,8 +751,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
753{ 751{
754 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port); 752 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port);
755 struct s3c24xx_uart_port *ourport = to_ourport(port); 753 struct s3c24xx_uart_port *ourport = to_ourport(port);
756 struct s3c24xx_uart_clksrc *clksrc; 754 struct s3c24xx_uart_clksrc *clksrc = NULL;
757 struct clk *clk; 755 struct clk *clk = NULL;
758 unsigned long flags; 756 unsigned long flags;
759 unsigned int baud, quot; 757 unsigned int baud, quot;
760 unsigned int ulcon; 758 unsigned int ulcon;
@@ -1094,14 +1092,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1094 1092
1095static int probe_index = 0; 1093static int probe_index = 0;
1096 1094
1097int s3c24xx_serial_probe(struct device *_dev, 1095static int s3c24xx_serial_probe(struct platform_device *dev,
1098 struct s3c24xx_uart_info *info) 1096 struct s3c24xx_uart_info *info)
1099{ 1097{
1100 struct s3c24xx_uart_port *ourport; 1098 struct s3c24xx_uart_port *ourport;
1101 struct platform_device *dev = to_platform_device(_dev);
1102 int ret; 1099 int ret;
1103 1100
1104 dbg("s3c24xx_serial_probe(%p, %p) %d\n", _dev, info, probe_index); 1101 dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index);
1105 1102
1106 ourport = &s3c24xx_serial_ports[probe_index]; 1103 ourport = &s3c24xx_serial_ports[probe_index];
1107 probe_index++; 1104 probe_index++;
@@ -1114,7 +1111,7 @@ int s3c24xx_serial_probe(struct device *_dev,
1114 1111
1115 dbg("%s: adding port\n", __FUNCTION__); 1112 dbg("%s: adding port\n", __FUNCTION__);
1116 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); 1113 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
1117 dev_set_drvdata(_dev, &ourport->port); 1114 platform_set_drvdata(dev, &ourport->port);
1118 1115
1119 return 0; 1116 return 0;
1120 1117
@@ -1122,9 +1119,9 @@ int s3c24xx_serial_probe(struct device *_dev,
1122 return ret; 1119 return ret;
1123} 1120}
1124 1121
1125int s3c24xx_serial_remove(struct device *_dev) 1122static int s3c24xx_serial_remove(struct platform_device *dev)
1126{ 1123{
1127 struct uart_port *port = s3c24xx_dev_to_port(_dev); 1124 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1128 1125
1129 if (port) 1126 if (port)
1130 uart_remove_one_port(&s3c24xx_uart_drv, port); 1127 uart_remove_one_port(&s3c24xx_uart_drv, port);
@@ -1136,22 +1133,22 @@ int s3c24xx_serial_remove(struct device *_dev)
1136 1133
1137#ifdef CONFIG_PM 1134#ifdef CONFIG_PM
1138 1135
1139int s3c24xx_serial_suspend(struct device *dev, pm_message_t state, u32 level) 1136static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state)
1140{ 1137{
1141 struct uart_port *port = s3c24xx_dev_to_port(dev); 1138 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1142 1139
1143 if (port && level == SUSPEND_DISABLE) 1140 if (port)
1144 uart_suspend_port(&s3c24xx_uart_drv, port); 1141 uart_suspend_port(&s3c24xx_uart_drv, port);
1145 1142
1146 return 0; 1143 return 0;
1147} 1144}
1148 1145
1149int s3c24xx_serial_resume(struct device *dev, u32 level) 1146static int s3c24xx_serial_resume(struct platform_device *dev)
1150{ 1147{
1151 struct uart_port *port = s3c24xx_dev_to_port(dev); 1148 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1152 struct s3c24xx_uart_port *ourport = to_ourport(port); 1149 struct s3c24xx_uart_port *ourport = to_ourport(port);
1153 1150
1154 if (port && level == RESUME_ENABLE) { 1151 if (port) {
1155 clk_enable(ourport->clk); 1152 clk_enable(ourport->clk);
1156 s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port)); 1153 s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
1157 clk_disable(ourport->clk); 1154 clk_disable(ourport->clk);
@@ -1167,11 +1164,11 @@ int s3c24xx_serial_resume(struct device *dev, u32 level)
1167#define s3c24xx_serial_resume NULL 1164#define s3c24xx_serial_resume NULL
1168#endif 1165#endif
1169 1166
1170int s3c24xx_serial_init(struct device_driver *drv, 1167static int s3c24xx_serial_init(struct platform_driver *drv,
1171 struct s3c24xx_uart_info *info) 1168 struct s3c24xx_uart_info *info)
1172{ 1169{
1173 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); 1170 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
1174 return driver_register(drv); 1171 return platform_driver_register(drv);
1175} 1172}
1176 1173
1177 1174
@@ -1230,18 +1227,20 @@ static struct s3c24xx_uart_info s3c2400_uart_inf = {
1230 .reset_port = s3c2400_serial_resetport, 1227 .reset_port = s3c2400_serial_resetport,
1231}; 1228};
1232 1229
1233static int s3c2400_serial_probe(struct device *dev) 1230static int s3c2400_serial_probe(struct platform_device *dev)
1234{ 1231{
1235 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); 1232 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf);
1236} 1233}
1237 1234
1238static struct device_driver s3c2400_serial_drv = { 1235static struct platform_driver s3c2400_serial_drv = {
1239 .name = "s3c2400-uart",
1240 .bus = &platform_bus_type,
1241 .probe = s3c2400_serial_probe, 1236 .probe = s3c2400_serial_probe,
1242 .remove = s3c24xx_serial_remove, 1237 .remove = s3c24xx_serial_remove,
1243 .suspend = s3c24xx_serial_suspend, 1238 .suspend = s3c24xx_serial_suspend,
1244 .resume = s3c24xx_serial_resume, 1239 .resume = s3c24xx_serial_resume,
1240 .driver = {
1241 .name = "s3c2400-uart",
1242 .owner = THIS_MODULE,
1243 },
1245}; 1244};
1246 1245
1247static inline int s3c2400_serial_init(void) 1246static inline int s3c2400_serial_init(void)
@@ -1251,7 +1250,7 @@ static inline int s3c2400_serial_init(void)
1251 1250
1252static inline void s3c2400_serial_exit(void) 1251static inline void s3c2400_serial_exit(void)
1253{ 1252{
1254 driver_unregister(&s3c2400_serial_drv); 1253 platform_driver_unregister(&s3c2400_serial_drv);
1255} 1254}
1256 1255
1257#define s3c2400_uart_inf_at &s3c2400_uart_inf 1256#define s3c2400_uart_inf_at &s3c2400_uart_inf
@@ -1333,18 +1332,20 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = {
1333 1332
1334/* device management */ 1333/* device management */
1335 1334
1336static int s3c2410_serial_probe(struct device *dev) 1335static int s3c2410_serial_probe(struct platform_device *dev)
1337{ 1336{
1338 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); 1337 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf);
1339} 1338}
1340 1339
1341static struct device_driver s3c2410_serial_drv = { 1340static struct platform_driver s3c2410_serial_drv = {
1342 .name = "s3c2410-uart",
1343 .bus = &platform_bus_type,
1344 .probe = s3c2410_serial_probe, 1341 .probe = s3c2410_serial_probe,
1345 .remove = s3c24xx_serial_remove, 1342 .remove = s3c24xx_serial_remove,
1346 .suspend = s3c24xx_serial_suspend, 1343 .suspend = s3c24xx_serial_suspend,
1347 .resume = s3c24xx_serial_resume, 1344 .resume = s3c24xx_serial_resume,
1345 .driver = {
1346 .name = "s3c2410-uart",
1347 .owner = THIS_MODULE,
1348 },
1348}; 1349};
1349 1350
1350static inline int s3c2410_serial_init(void) 1351static inline int s3c2410_serial_init(void)
@@ -1354,7 +1355,7 @@ static inline int s3c2410_serial_init(void)
1354 1355
1355static inline void s3c2410_serial_exit(void) 1356static inline void s3c2410_serial_exit(void)
1356{ 1357{
1357 driver_unregister(&s3c2410_serial_drv); 1358 platform_driver_unregister(&s3c2410_serial_drv);
1358} 1359}
1359 1360
1360#define s3c2410_uart_inf_at &s3c2410_uart_inf 1361#define s3c2410_uart_inf_at &s3c2410_uart_inf
@@ -1493,19 +1494,21 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = {
1493 1494
1494/* device management */ 1495/* device management */
1495 1496
1496static int s3c2440_serial_probe(struct device *dev) 1497static int s3c2440_serial_probe(struct platform_device *dev)
1497{ 1498{
1498 dbg("s3c2440_serial_probe: dev=%p\n", dev); 1499 dbg("s3c2440_serial_probe: dev=%p\n", dev);
1499 return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); 1500 return s3c24xx_serial_probe(dev, &s3c2440_uart_inf);
1500} 1501}
1501 1502
1502static struct device_driver s3c2440_serial_drv = { 1503static struct platform_driver s3c2440_serial_drv = {
1503 .name = "s3c2440-uart",
1504 .bus = &platform_bus_type,
1505 .probe = s3c2440_serial_probe, 1504 .probe = s3c2440_serial_probe,
1506 .remove = s3c24xx_serial_remove, 1505 .remove = s3c24xx_serial_remove,
1507 .suspend = s3c24xx_serial_suspend, 1506 .suspend = s3c24xx_serial_suspend,
1508 .resume = s3c24xx_serial_resume, 1507 .resume = s3c24xx_serial_resume,
1508 .driver = {
1509 .name = "s3c2440-uart",
1510 .owner = THIS_MODULE,
1511 },
1509}; 1512};
1510 1513
1511 1514
@@ -1516,7 +1519,7 @@ static inline int s3c2440_serial_init(void)
1516 1519
1517static inline void s3c2440_serial_exit(void) 1520static inline void s3c2440_serial_exit(void)
1518{ 1521{
1519 driver_unregister(&s3c2440_serial_drv); 1522 platform_driver_unregister(&s3c2440_serial_drv);
1520} 1523}
1521 1524
1522#define s3c2440_uart_inf_at &s3c2440_uart_inf 1525#define s3c2440_uart_inf_at &s3c2440_uart_inf
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index dd8aed242357..25a086458ab9 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -35,7 +35,7 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/console.h> 36#include <linux/console.h>
37#include <linux/sysrq.h> 37#include <linux/sysrq.h>
38#include <linux/device.h> 38#include <linux/platform_device.h>
39#include <linux/tty.h> 39#include <linux/tty.h>
40#include <linux/tty_flip.h> 40#include <linux/tty_flip.h>
41#include <linux/serial_core.h> 41#include <linux/serial_core.h>
@@ -156,19 +156,16 @@ static void sa1100_stop_tx(struct uart_port *port)
156} 156}
157 157
158/* 158/*
159 * interrupts may not be disabled on entry 159 * port locked and interrupts disabled
160 */ 160 */
161static void sa1100_start_tx(struct uart_port *port) 161static void sa1100_start_tx(struct uart_port *port)
162{ 162{
163 struct sa1100_port *sport = (struct sa1100_port *)port; 163 struct sa1100_port *sport = (struct sa1100_port *)port;
164 unsigned long flags;
165 u32 utcr3; 164 u32 utcr3;
166 165
167 spin_lock_irqsave(&sport->port.lock, flags);
168 utcr3 = UART_GET_UTCR3(sport); 166 utcr3 = UART_GET_UTCR3(sport);
169 sport->port.read_status_mask |= UTSR0_TO_SM(UTSR0_TFS); 167 sport->port.read_status_mask |= UTSR0_TO_SM(UTSR0_TFS);
170 UART_PUT_UTCR3(sport, utcr3 | UTCR3_TIE); 168 UART_PUT_UTCR3(sport, utcr3 | UTCR3_TIE);
171 spin_unlock_irqrestore(&sport->port.lock, flags);
172} 169}
173 170
174/* 171/*
@@ -834,29 +831,28 @@ static struct uart_driver sa1100_reg = {
834 .cons = SA1100_CONSOLE, 831 .cons = SA1100_CONSOLE,
835}; 832};
836 833
837static int sa1100_serial_suspend(struct device *_dev, pm_message_t state, u32 level) 834static int sa1100_serial_suspend(struct platform_device *dev, pm_message_t state)
838{ 835{
839 struct sa1100_port *sport = dev_get_drvdata(_dev); 836 struct sa1100_port *sport = platform_get_drvdata(dev);
840 837
841 if (sport && level == SUSPEND_DISABLE) 838 if (sport)
842 uart_suspend_port(&sa1100_reg, &sport->port); 839 uart_suspend_port(&sa1100_reg, &sport->port);
843 840
844 return 0; 841 return 0;
845} 842}
846 843
847static int sa1100_serial_resume(struct device *_dev, u32 level) 844static int sa1100_serial_resume(struct platform_device *dev)
848{ 845{
849 struct sa1100_port *sport = dev_get_drvdata(_dev); 846 struct sa1100_port *sport = platform_get_drvdata(dev);
850 847
851 if (sport && level == RESUME_ENABLE) 848 if (sport)
852 uart_resume_port(&sa1100_reg, &sport->port); 849 uart_resume_port(&sa1100_reg, &sport->port);
853 850
854 return 0; 851 return 0;
855} 852}
856 853
857static int sa1100_serial_probe(struct device *_dev) 854static int sa1100_serial_probe(struct platform_device *dev)
858{ 855{
859 struct platform_device *dev = to_platform_device(_dev);
860 struct resource *res = dev->resource; 856 struct resource *res = dev->resource;
861 int i; 857 int i;
862 858
@@ -869,9 +865,9 @@ static int sa1100_serial_probe(struct device *_dev)
869 if (sa1100_ports[i].port.mapbase != res->start) 865 if (sa1100_ports[i].port.mapbase != res->start)
870 continue; 866 continue;
871 867
872 sa1100_ports[i].port.dev = _dev; 868 sa1100_ports[i].port.dev = &dev->dev;
873 uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); 869 uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port);
874 dev_set_drvdata(_dev, &sa1100_ports[i]); 870 platform_set_drvdata(dev, &sa1100_ports[i]);
875 break; 871 break;
876 } 872 }
877 } 873 }
@@ -879,11 +875,11 @@ static int sa1100_serial_probe(struct device *_dev)
879 return 0; 875 return 0;
880} 876}
881 877
882static int sa1100_serial_remove(struct device *_dev) 878static int sa1100_serial_remove(struct platform_device *pdev)
883{ 879{
884 struct sa1100_port *sport = dev_get_drvdata(_dev); 880 struct sa1100_port *sport = platform_get_drvdata(pdev);
885 881
886 dev_set_drvdata(_dev, NULL); 882 platform_set_drvdata(pdev, NULL);
887 883
888 if (sport) 884 if (sport)
889 uart_remove_one_port(&sa1100_reg, &sport->port); 885 uart_remove_one_port(&sa1100_reg, &sport->port);
@@ -891,13 +887,14 @@ static int sa1100_serial_remove(struct device *_dev)
891 return 0; 887 return 0;
892} 888}
893 889
894static struct device_driver sa11x0_serial_driver = { 890static struct platform_driver sa11x0_serial_driver = {
895 .name = "sa11x0-uart",
896 .bus = &platform_bus_type,
897 .probe = sa1100_serial_probe, 891 .probe = sa1100_serial_probe,
898 .remove = sa1100_serial_remove, 892 .remove = sa1100_serial_remove,
899 .suspend = sa1100_serial_suspend, 893 .suspend = sa1100_serial_suspend,
900 .resume = sa1100_serial_resume, 894 .resume = sa1100_serial_resume,
895 .driver = {
896 .name = "sa11x0-uart",
897 },
901}; 898};
902 899
903static int __init sa1100_serial_init(void) 900static int __init sa1100_serial_init(void)
@@ -910,7 +907,7 @@ static int __init sa1100_serial_init(void)
910 907
911 ret = uart_register_driver(&sa1100_reg); 908 ret = uart_register_driver(&sa1100_reg);
912 if (ret == 0) { 909 if (ret == 0) {
913 ret = driver_register(&sa11x0_serial_driver); 910 ret = platform_driver_register(&sa11x0_serial_driver);
914 if (ret) 911 if (ret)
915 uart_unregister_driver(&sa1100_reg); 912 uart_unregister_driver(&sa1100_reg);
916 } 913 }
@@ -919,7 +916,7 @@ static int __init sa1100_serial_init(void)
919 916
920static void __exit sa1100_serial_exit(void) 917static void __exit sa1100_serial_exit(void)
921{ 918{
922 driver_unregister(&sa11x0_serial_driver); 919 platform_driver_unregister(&sa11x0_serial_driver);
923 uart_unregister_driver(&sa1100_reg); 920 uart_unregister_driver(&sa1100_reg);
924} 921}
925 922
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 2d8622eef701..c17d680e3f04 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -147,8 +147,7 @@ static int uart_startup(struct uart_state *state, int init_hw)
147 * once we have successfully opened the port. Also set 147 * once we have successfully opened the port. Also set
148 * up the tty->alt_speed kludge 148 * up the tty->alt_speed kludge
149 */ 149 */
150 if (info->tty) 150 set_bit(TTY_IO_ERROR, &info->tty->flags);
151 set_bit(TTY_IO_ERROR, &info->tty->flags);
152 151
153 if (port->type == PORT_UNKNOWN) 152 if (port->type == PORT_UNKNOWN)
154 return 0; 153 return 0;
@@ -210,33 +209,45 @@ static void uart_shutdown(struct uart_state *state)
210 struct uart_info *info = state->info; 209 struct uart_info *info = state->info;
211 struct uart_port *port = state->port; 210 struct uart_port *port = state->port;
212 211
213 if (!(info->flags & UIF_INITIALIZED))
214 return;
215
216 /* 212 /*
217 * Turn off DTR and RTS early. 213 * Set the TTY IO error marker
218 */ 214 */
219 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) 215 if (info->tty)
220 uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 216 set_bit(TTY_IO_ERROR, &info->tty->flags);
221 217
222 /* 218 if (info->flags & UIF_INITIALIZED) {
223 * clear delta_msr_wait queue to avoid mem leaks: we may free 219 info->flags &= ~UIF_INITIALIZED;
224 * the irq here so the queue might never be woken up. Note
225 * that we won't end up waiting on delta_msr_wait again since
226 * any outstanding file descriptors should be pointing at
227 * hung_up_tty_fops now.
228 */
229 wake_up_interruptible(&info->delta_msr_wait);
230 220
231 /* 221 /*
232 * Free the IRQ and disable the port. 222 * Turn off DTR and RTS early.
233 */ 223 */
234 port->ops->shutdown(port); 224 if (!info->tty || (info->tty->termios->c_cflag & HUPCL))
225 uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
226
227 /*
228 * clear delta_msr_wait queue to avoid mem leaks: we may free
229 * the irq here so the queue might never be woken up. Note
230 * that we won't end up waiting on delta_msr_wait again since
231 * any outstanding file descriptors should be pointing at
232 * hung_up_tty_fops now.
233 */
234 wake_up_interruptible(&info->delta_msr_wait);
235
236 /*
237 * Free the IRQ and disable the port.
238 */
239 port->ops->shutdown(port);
240
241 /*
242 * Ensure that the IRQ handler isn't running on another CPU.
243 */
244 synchronize_irq(port->irq);
245 }
235 246
236 /* 247 /*
237 * Ensure that the IRQ handler isn't running on another CPU. 248 * kill off our tasklet
238 */ 249 */
239 synchronize_irq(port->irq); 250 tasklet_kill(&info->tlet);
240 251
241 /* 252 /*
242 * Free the transmit buffer page. 253 * Free the transmit buffer page.
@@ -245,15 +256,6 @@ static void uart_shutdown(struct uart_state *state)
245 free_page((unsigned long)info->xmit.buf); 256 free_page((unsigned long)info->xmit.buf);
246 info->xmit.buf = NULL; 257 info->xmit.buf = NULL;
247 } 258 }
248
249 /*
250 * kill off our tasklet
251 */
252 tasklet_kill(&info->tlet);
253 if (info->tty)
254 set_bit(TTY_IO_ERROR, &info->tty->flags);
255
256 info->flags &= ~UIF_INITIALIZED;
257} 259}
258 260
259/** 261/**
@@ -1777,7 +1779,7 @@ struct baud_rates {
1777 unsigned int cflag; 1779 unsigned int cflag;
1778}; 1780};
1779 1781
1780static struct baud_rates baud_rates[] = { 1782static const struct baud_rates baud_rates[] = {
1781 { 921600, B921600 }, 1783 { 921600, B921600 },
1782 { 460800, B460800 }, 1784 { 460800, B460800 },
1783 { 230400, B230400 }, 1785 { 230400, B230400 },
@@ -1929,14 +1931,25 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
1929 1931
1930 if (state->info && state->info->flags & UIF_INITIALIZED) { 1932 if (state->info && state->info->flags & UIF_INITIALIZED) {
1931 struct uart_ops *ops = port->ops; 1933 struct uart_ops *ops = port->ops;
1934 int ret;
1932 1935
1933 ops->set_mctrl(port, 0); 1936 ops->set_mctrl(port, 0);
1934 ops->startup(port); 1937 ret = ops->startup(port);
1935 uart_change_speed(state, NULL); 1938 if (ret == 0) {
1936 spin_lock_irq(&port->lock); 1939 uart_change_speed(state, NULL);
1937 ops->set_mctrl(port, port->mctrl); 1940 spin_lock_irq(&port->lock);
1938 ops->start_tx(port); 1941 ops->set_mctrl(port, port->mctrl);
1939 spin_unlock_irq(&port->lock); 1942 ops->start_tx(port);
1943 spin_unlock_irq(&port->lock);
1944 } else {
1945 /*
1946 * Failed to resume - maybe hardware went away?
1947 * Clear the "initialized" flag so we won't try
1948 * to call the low level drivers shutdown method.
1949 */
1950 state->info->flags &= ~UIF_INITIALIZED;
1951 uart_shutdown(state);
1952 }
1940 } 1953 }
1941 1954
1942 up(&state->sem); 1955 up(&state->sem);
@@ -1960,6 +1973,7 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
1960 break; 1973 break;
1961 case UPIO_MEM: 1974 case UPIO_MEM:
1962 case UPIO_MEM32: 1975 case UPIO_MEM32:
1976 case UPIO_AU:
1963 snprintf(address, sizeof(address), 1977 snprintf(address, sizeof(address),
1964 "MMIO 0x%lx", port->mapbase); 1978 "MMIO 0x%lx", port->mapbase);
1965 break; 1979 break;
@@ -1968,7 +1982,9 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
1968 break; 1982 break;
1969 } 1983 }
1970 1984
1971 printk(KERN_INFO "%s%d at %s (irq = %d) is a %s\n", 1985 printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n",
1986 port->dev ? port->dev->bus_id : "",
1987 port->dev ? ": " : "",
1972 drv->dev_name, port->line, address, port->irq, uart_type(port)); 1988 drv->dev_name, port->line, address, port->irq, uart_type(port));
1973} 1989}
1974 1990
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 1ae0b381c162..7ce0c7e66d37 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -85,7 +85,7 @@ struct multi_id {
85 int multi; /* 1 = multifunction, > 1 = # ports */ 85 int multi; /* 1 = multifunction, > 1 = # ports */
86}; 86};
87 87
88static struct multi_id multi_id[] = { 88static const struct multi_id multi_id[] = {
89 { MANFID_OMEGA, PRODID_OMEGA_QSP_100, 4 }, 89 { MANFID_OMEGA, PRODID_OMEGA_QSP_100, 4 },
90 { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 }, 90 { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 },
91 { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 }, 91 { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 },
@@ -354,8 +354,8 @@ next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse)
354 354
355static int simple_config(dev_link_t *link) 355static int simple_config(dev_link_t *link)
356{ 356{
357 static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 357 static const kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
358 static int size_table[2] = { 8, 16 }; 358 static const int size_table[2] = { 8, 16 };
359 client_handle_t handle = link->handle; 359 client_handle_t handle = link->handle;
360 struct serial_info *info = link->priv; 360 struct serial_info *info = link->priv;
361 struct serial_cfg_mem *cfg_mem; 361 struct serial_cfg_mem *cfg_mem;
@@ -859,6 +859,7 @@ static struct pcmcia_device_id serial_ids[] = {
859 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0175, 0x0000, "DP83903.cis"), 859 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0175, 0x0000, "DP83903.cis"),
860 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "3CXEM556.cis"), 860 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "3CXEM556.cis"),
861 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "3CXEM556.cis"), 861 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "3CXEM556.cis"),
862 PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0x0710, "SW_7xx_SER.cis"), /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */
862 PCMCIA_DEVICE_CIS_PROD_ID12("MultiTech", "PCMCIA 56K DataFax", 0x842047ee, 0xc2efcf03, "MT5634ZLX.cis"), 863 PCMCIA_DEVICE_CIS_PROD_ID12("MultiTech", "PCMCIA 56K DataFax", 0x842047ee, 0xc2efcf03, "MT5634ZLX.cis"),
863 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "COMpad4.cis"), 864 PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "COMpad4.cis"),
864 PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"), 865 PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"),
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 512266307866..430754ebac8a 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -967,7 +967,7 @@ static int sci_startup(struct uart_port *port)
967#endif 967#endif
968 968
969 sci_request_irq(s); 969 sci_request_irq(s);
970 sci_start_tx(port, 1); 970 sci_start_tx(port);
971 sci_start_rx(port, 1); 971 sci_start_rx(port, 1);
972 972
973 return 0; 973 return 0;
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index e971156daa60..ba9381fd3f2d 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -274,7 +274,6 @@ static void transmit_chars(struct uart_sunsab_port *up,
274 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { 274 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
275 up->interrupt_mask1 |= SAB82532_IMR1_XPR; 275 up->interrupt_mask1 |= SAB82532_IMR1_XPR;
276 writeb(up->interrupt_mask1, &up->regs->w.imr1); 276 writeb(up->interrupt_mask1, &up->regs->w.imr1);
277 uart_write_wakeup(&up->port);
278 return; 277 return;
279 } 278 }
280 279
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 5959e6755a81..f0738533f39a 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -518,11 +518,7 @@ static void sunsu_change_mouse_baud(struct uart_sunsu_port *up)
518 518
519 quot = up->port.uartclk / (16 * new_baud); 519 quot = up->port.uartclk / (16 * new_baud);
520 520
521 spin_unlock(&up->port.lock);
522
523 sunsu_change_speed(&up->port, up->cflag, 0, quot); 521 sunsu_change_speed(&up->port, up->cflag, 0, quot);
524
525 spin_lock(&up->port.lock);
526} 522}
527 523
528static void receive_kbd_ms_chars(struct uart_sunsu_port *up, struct pt_regs *regs, int is_break) 524static void receive_kbd_ms_chars(struct uart_sunsu_port *up, struct pt_regs *regs, int is_break)
@@ -1445,7 +1441,7 @@ static void sunsu_console_write(struct console *co, const char *s,
1445 * - initialize the serial port 1441 * - initialize the serial port
1446 * Return non-zero if we didn't find a serial port. 1442 * Return non-zero if we didn't find a serial port.
1447 */ 1443 */
1448static int __init sunsu_console_setup(struct console *co, char *options) 1444static int sunsu_console_setup(struct console *co, char *options)
1449{ 1445{
1450 struct uart_port *port; 1446 struct uart_port *port;
1451 int baud = 9600; 1447 int baud = 9600;
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index d75445738c88..7653d6cf05af 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -517,10 +517,9 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up,
517 if (up->port.info == NULL) 517 if (up->port.info == NULL)
518 goto ack_tx_int; 518 goto ack_tx_int;
519 xmit = &up->port.info->xmit; 519 xmit = &up->port.info->xmit;
520 if (uart_circ_empty(xmit)) { 520 if (uart_circ_empty(xmit))
521 uart_write_wakeup(&up->port);
522 goto ack_tx_int; 521 goto ack_tx_int;
523 } 522
524 if (uart_tx_stopped(&up->port)) 523 if (uart_tx_stopped(&up->port))
525 goto ack_tx_int; 524 goto ack_tx_int;
526 525
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index 0c5d65a08f6e..865d4dea65df 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -26,7 +26,7 @@
26#endif 26#endif
27 27
28#include <linux/console.h> 28#include <linux/console.h>
29#include <linux/device.h> 29#include <linux/platform_device.h>
30#include <linux/err.h> 30#include <linux/err.h>
31#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/init.h> 32#include <linux/init.h>
@@ -924,7 +924,7 @@ static struct uart_driver siu_uart_driver = {
924 .cons = SERIAL_VR41XX_CONSOLE, 924 .cons = SERIAL_VR41XX_CONSOLE,
925}; 925};
926 926
927static int siu_probe(struct device *dev) 927static int siu_probe(struct platform_device *dev)
928{ 928{
929 struct uart_port *port; 929 struct uart_port *port;
930 int num, i, retval; 930 int num, i, retval;
@@ -941,7 +941,7 @@ static int siu_probe(struct device *dev)
941 for (i = 0; i < num; i++) { 941 for (i = 0; i < num; i++) {
942 port = &siu_uart_ports[i]; 942 port = &siu_uart_ports[i];
943 port->ops = &siu_uart_ops; 943 port->ops = &siu_uart_ops;
944 port->dev = dev; 944 port->dev = &dev->dev;
945 945
946 retval = uart_add_one_port(&siu_uart_driver, port); 946 retval = uart_add_one_port(&siu_uart_driver, port);
947 if (retval < 0) { 947 if (retval < 0) {
@@ -958,14 +958,14 @@ static int siu_probe(struct device *dev)
958 return 0; 958 return 0;
959} 959}
960 960
961static int siu_remove(struct device *dev) 961static int siu_remove(struct platform_device *dev)
962{ 962{
963 struct uart_port *port; 963 struct uart_port *port;
964 int i; 964 int i;
965 965
966 for (i = 0; i < siu_uart_driver.nr; i++) { 966 for (i = 0; i < siu_uart_driver.nr; i++) {
967 port = &siu_uart_ports[i]; 967 port = &siu_uart_ports[i];
968 if (port->dev == dev) { 968 if (port->dev == &dev->dev) {
969 uart_remove_one_port(&siu_uart_driver, port); 969 uart_remove_one_port(&siu_uart_driver, port);
970 port->dev = NULL; 970 port->dev = NULL;
971 } 971 }
@@ -976,18 +976,15 @@ static int siu_remove(struct device *dev)
976 return 0; 976 return 0;
977} 977}
978 978
979static int siu_suspend(struct device *dev, pm_message_t state, u32 level) 979static int siu_suspend(struct platform_device *dev, pm_message_t state)
980{ 980{
981 struct uart_port *port; 981 struct uart_port *port;
982 int i; 982 int i;
983 983
984 if (level != SUSPEND_DISABLE)
985 return 0;
986
987 for (i = 0; i < siu_uart_driver.nr; i++) { 984 for (i = 0; i < siu_uart_driver.nr; i++) {
988 port = &siu_uart_ports[i]; 985 port = &siu_uart_ports[i];
989 if ((port->type == PORT_VR41XX_SIU || 986 if ((port->type == PORT_VR41XX_SIU ||
990 port->type == PORT_VR41XX_DSIU) && port->dev == dev) 987 port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev)
991 uart_suspend_port(&siu_uart_driver, port); 988 uart_suspend_port(&siu_uart_driver, port);
992 989
993 } 990 }
@@ -995,18 +992,15 @@ static int siu_suspend(struct device *dev, pm_message_t state, u32 level)
995 return 0; 992 return 0;
996} 993}
997 994
998static int siu_resume(struct device *dev, u32 level) 995static int siu_resume(struct platform_device *dev)
999{ 996{
1000 struct uart_port *port; 997 struct uart_port *port;
1001 int i; 998 int i;
1002 999
1003 if (level != RESUME_ENABLE)
1004 return 0;
1005
1006 for (i = 0; i < siu_uart_driver.nr; i++) { 1000 for (i = 0; i < siu_uart_driver.nr; i++) {
1007 port = &siu_uart_ports[i]; 1001 port = &siu_uart_ports[i];
1008 if ((port->type == PORT_VR41XX_SIU || 1002 if ((port->type == PORT_VR41XX_SIU ||
1009 port->type == PORT_VR41XX_DSIU) && port->dev == dev) 1003 port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev)
1010 uart_resume_port(&siu_uart_driver, port); 1004 uart_resume_port(&siu_uart_driver, port);
1011 } 1005 }
1012 1006
@@ -1015,13 +1009,14 @@ static int siu_resume(struct device *dev, u32 level)
1015 1009
1016static struct platform_device *siu_platform_device; 1010static struct platform_device *siu_platform_device;
1017 1011
1018static struct device_driver siu_device_driver = { 1012static struct platform_driver siu_device_driver = {
1019 .name = "SIU",
1020 .bus = &platform_bus_type,
1021 .probe = siu_probe, 1013 .probe = siu_probe,
1022 .remove = siu_remove, 1014 .remove = siu_remove,
1023 .suspend = siu_suspend, 1015 .suspend = siu_suspend,
1024 .resume = siu_resume, 1016 .resume = siu_resume,
1017 .driver = {
1018 .name = "SIU",
1019 },
1025}; 1020};
1026 1021
1027static int __devinit vr41xx_siu_init(void) 1022static int __devinit vr41xx_siu_init(void)
@@ -1032,7 +1027,7 @@ static int __devinit vr41xx_siu_init(void)
1032 if (IS_ERR(siu_platform_device)) 1027 if (IS_ERR(siu_platform_device))
1033 return PTR_ERR(siu_platform_device); 1028 return PTR_ERR(siu_platform_device);
1034 1029
1035 retval = driver_register(&siu_device_driver); 1030 retval = platform_driver_register(&siu_device_driver);
1036 if (retval < 0) 1031 if (retval < 0)
1037 platform_device_unregister(siu_platform_device); 1032 platform_device_unregister(siu_platform_device);
1038 1033
@@ -1041,7 +1036,7 @@ static int __devinit vr41xx_siu_init(void)
1041 1036
1042static void __devexit vr41xx_siu_exit(void) 1037static void __devexit vr41xx_siu_exit(void)
1043{ 1038{
1044 driver_unregister(&siu_device_driver); 1039 platform_driver_unregister(&siu_device_driver);
1045 1040
1046 platform_device_unregister(siu_platform_device); 1041 platform_device_unregister(siu_platform_device);
1047} 1042}