aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/68328serial.c7
-rw-r--r--drivers/serial/8250.c38
-rw-r--r--drivers/serial/8250_pci.c4
-rw-r--r--drivers/serial/8250_pnp.c2
-rw-r--r--drivers/serial/Kconfig12
-rw-r--r--drivers/serial/amba-pl011.c47
-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/dz.c48
-rw-r--r--drivers/serial/imx.c33
-rw-r--r--drivers/serial/mpc52xx_uart.c36
-rw-r--r--drivers/serial/mpsc.c65
-rw-r--r--drivers/serial/mux.c19
-rw-r--r--drivers/serial/pxa.c37
-rw-r--r--drivers/serial/s3c2410.c62
-rw-r--r--drivers/serial/sa1100.c37
-rw-r--r--drivers/serial/serial_core.c86
-rw-r--r--drivers/serial/serial_cs.c6
-rw-r--r--drivers/serial/vr41xx_siu.c27
20 files changed, 295 insertions, 277 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 98820603e75f..d2bcd1f87cd6 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -102,7 +102,7 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
102#define SERIAL_PORT_DFNS 102#define SERIAL_PORT_DFNS
103#endif 103#endif
104 104
105static struct old_serial_port old_serial_port[] = { 105static const struct old_serial_port old_serial_port[] = {
106 SERIAL_PORT_DFNS /* defined in asm/serial.h */ 106 SERIAL_PORT_DFNS /* defined in asm/serial.h */
107}; 107};
108 108
@@ -999,7 +999,10 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
999 serial_outp(up, UART_MCR, save_mcr); 999 serial_outp(up, UART_MCR, save_mcr);
1000 serial8250_clear_fifos(up); 1000 serial8250_clear_fifos(up);
1001 (void)serial_in(up, UART_RX); 1001 (void)serial_in(up, UART_RX);
1002 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);
1003 1006
1004 out: 1007 out:
1005 spin_unlock_irqrestore(&up->port.lock, flags); 1008 spin_unlock_irqrestore(&up->port.lock, flags);
@@ -2381,9 +2384,9 @@ void serial8250_resume_port(int line)
2381 * 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
2382 * all entries to have at least UPF_BOOT_AUTOCONF set. 2385 * all entries to have at least UPF_BOOT_AUTOCONF set.
2383 */ 2386 */
2384static int __devinit serial8250_probe(struct device *dev) 2387static int __devinit serial8250_probe(struct platform_device *dev)
2385{ 2388{
2386 struct plat_serial8250_port *p = dev->platform_data; 2389 struct plat_serial8250_port *p = dev->dev.platform_data;
2387 struct uart_port port; 2390 struct uart_port port;
2388 int ret, i; 2391 int ret, i;
2389 2392
@@ -2399,12 +2402,12 @@ static int __devinit serial8250_probe(struct device *dev)
2399 port.flags = p->flags; 2402 port.flags = p->flags;
2400 port.mapbase = p->mapbase; 2403 port.mapbase = p->mapbase;
2401 port.hub6 = p->hub6; 2404 port.hub6 = p->hub6;
2402 port.dev = dev; 2405 port.dev = &dev->dev;
2403 if (share_irqs) 2406 if (share_irqs)
2404 port.flags |= UPF_SHARE_IRQ; 2407 port.flags |= UPF_SHARE_IRQ;
2405 ret = serial8250_register_port(&port); 2408 ret = serial8250_register_port(&port);
2406 if (ret < 0) { 2409 if (ret < 0) {
2407 dev_err(dev, "unable to register port at index %d " 2410 dev_err(&dev->dev, "unable to register port at index %d "
2408 "(IO%lx MEM%lx IRQ%d): %d\n", i, 2411 "(IO%lx MEM%lx IRQ%d): %d\n", i,
2409 p->iobase, p->mapbase, p->irq, ret); 2412 p->iobase, p->mapbase, p->irq, ret);
2410 } 2413 }
@@ -2415,54 +2418,55 @@ static int __devinit serial8250_probe(struct device *dev)
2415/* 2418/*
2416 * Remove serial ports registered against a platform device. 2419 * Remove serial ports registered against a platform device.
2417 */ 2420 */
2418static int __devexit serial8250_remove(struct device *dev) 2421static int __devexit serial8250_remove(struct platform_device *dev)
2419{ 2422{
2420 int i; 2423 int i;
2421 2424
2422 for (i = 0; i < UART_NR; i++) { 2425 for (i = 0; i < UART_NR; i++) {
2423 struct uart_8250_port *up = &serial8250_ports[i]; 2426 struct uart_8250_port *up = &serial8250_ports[i];
2424 2427
2425 if (up->port.dev == dev) 2428 if (up->port.dev == &dev->dev)
2426 serial8250_unregister_port(i); 2429 serial8250_unregister_port(i);
2427 } 2430 }
2428 return 0; 2431 return 0;
2429} 2432}
2430 2433
2431static int serial8250_suspend(struct device *dev, pm_message_t state) 2434static int serial8250_suspend(struct platform_device *dev, pm_message_t state)
2432{ 2435{
2433 int i; 2436 int i;
2434 2437
2435 for (i = 0; i < UART_NR; i++) { 2438 for (i = 0; i < UART_NR; i++) {
2436 struct uart_8250_port *up = &serial8250_ports[i]; 2439 struct uart_8250_port *up = &serial8250_ports[i];
2437 2440
2438 if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) 2441 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
2439 uart_suspend_port(&serial8250_reg, &up->port); 2442 uart_suspend_port(&serial8250_reg, &up->port);
2440 } 2443 }
2441 2444
2442 return 0; 2445 return 0;
2443} 2446}
2444 2447
2445static int serial8250_resume(struct device *dev) 2448static int serial8250_resume(struct platform_device *dev)
2446{ 2449{
2447 int i; 2450 int i;
2448 2451
2449 for (i = 0; i < UART_NR; i++) { 2452 for (i = 0; i < UART_NR; i++) {
2450 struct uart_8250_port *up = &serial8250_ports[i]; 2453 struct uart_8250_port *up = &serial8250_ports[i];
2451 2454
2452 if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) 2455 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
2453 uart_resume_port(&serial8250_reg, &up->port); 2456 uart_resume_port(&serial8250_reg, &up->port);
2454 } 2457 }
2455 2458
2456 return 0; 2459 return 0;
2457} 2460}
2458 2461
2459static struct device_driver serial8250_isa_driver = { 2462static struct platform_driver serial8250_isa_driver = {
2460 .name = "serial8250",
2461 .bus = &platform_bus_type,
2462 .probe = serial8250_probe, 2463 .probe = serial8250_probe,
2463 .remove = __devexit_p(serial8250_remove), 2464 .remove = __devexit_p(serial8250_remove),
2464 .suspend = serial8250_suspend, 2465 .suspend = serial8250_suspend,
2465 .resume = serial8250_resume, 2466 .resume = serial8250_resume,
2467 .driver = {
2468 .name = "serial8250",
2469 },
2466}; 2470};
2467 2471
2468/* 2472/*
@@ -2608,7 +2612,7 @@ static int __init serial8250_init(void)
2608 2612
2609 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); 2613 serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
2610 2614
2611 ret = driver_register(&serial8250_isa_driver); 2615 ret = platform_driver_register(&serial8250_isa_driver);
2612 if (ret == 0) 2616 if (ret == 0)
2613 goto out; 2617 goto out;
2614 2618
@@ -2630,7 +2634,7 @@ static void __exit serial8250_exit(void)
2630 */ 2634 */
2631 serial8250_isa_devs = NULL; 2635 serial8250_isa_devs = NULL;
2632 2636
2633 driver_unregister(&serial8250_isa_driver); 2637 platform_driver_unregister(&serial8250_isa_driver);
2634 platform_device_unregister(isa_dev); 2638 platform_device_unregister(isa_dev);
2635 2639
2636 uart_unregister_driver(&serial8250_reg); 2640 uart_unregister_driver(&serial8250_reg);
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 5c3c03932d6d..8adca0ce267f 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -468,7 +468,7 @@ static unsigned short timedia_eight_port[] = {
468 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 468 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
469}; 469};
470 470
471static struct timedia_struct { 471static const struct timedia_struct {
472 int num; 472 int num;
473 unsigned short *ids; 473 unsigned short *ids;
474} timedia_data[] = { 474} timedia_data[] = {
@@ -516,7 +516,7 @@ pci_timedia_setup(struct serial_private *priv, struct pciserial_board *board,
516 break; 516 break;
517 case 3: 517 case 3:
518 offset = board->uart_offset; 518 offset = board->uart_offset;
519 bar = 1; 519 /* FALLTHROUGH */
520 case 4: /* BAR 2 */ 520 case 4: /* BAR 2 */
521 case 5: /* BAR 3 */ 521 case 5: /* BAR 3 */
522 case 6: /* BAR 4 */ 522 case 6: /* BAR 4 */
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 5d8660a42b77..b79ed0665d51 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -323,6 +323,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
323 { "USR9180", 0 }, 323 { "USR9180", 0 },
324 /* U.S. Robotics 56K Voice INT PnP*/ 324 /* U.S. Robotics 56K Voice INT PnP*/
325 { "USR9190", 0 }, 325 { "USR9190", 0 },
326 /* HP Compaq Tablet PC tc1100 Wacom tablet */
327 { "WACF005", 0 },
326 /* Rockwell's (PORALiNK) 33600 INT PNP */ 328 /* Rockwell's (PORALiNK) 33600 INT PNP */
327 { "WCI0003", 0 }, 329 { "WCI0003", 0 },
328 /* Unkown PnP modems */ 330 /* Unkown PnP modems */
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index ff36f0c9fdad..812bae62c8ec 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -10,7 +10,7 @@ menu "Serial drivers"
10# The new 8250/16550 serial drivers 10# The new 8250/16550 serial drivers
11config SERIAL_8250 11config SERIAL_8250
12 tristate "8250/16550 and compatible serial support" 12 tristate "8250/16550 and compatible serial support"
13 depends on (BROKEN || !(SPARC64 || SPARC32)) 13 depends on (BROKEN || !SPARC)
14 select SERIAL_CORE 14 select SERIAL_CORE
15 ---help--- 15 ---help---
16 This selects whether you want to include the driver for the standard 16 This selects whether you want to include the driver for the standard
@@ -469,14 +469,14 @@ config SERIAL_IMX_CONSOLE
469 469
470config SERIAL_SUNCORE 470config SERIAL_SUNCORE
471 bool 471 bool
472 depends on SPARC32 || SPARC64 472 depends on SPARC
473 select SERIAL_CORE 473 select SERIAL_CORE
474 select SERIAL_CORE_CONSOLE 474 select SERIAL_CORE_CONSOLE
475 default y 475 default y
476 476
477config SERIAL_SUNZILOG 477config SERIAL_SUNZILOG
478 tristate "Sun Zilog8530 serial support" 478 tristate "Sun Zilog8530 serial support"
479 depends on SPARC32 || SPARC64 479 depends on SPARC
480 help 480 help
481 This driver supports the Zilog8530 serial ports found on many Sparc 481 This driver supports the Zilog8530 serial ports found on many Sparc
482 systems. Say Y or M if you want to be able to these serial ports. 482 systems. Say Y or M if you want to be able to these serial ports.
@@ -491,7 +491,7 @@ config SERIAL_SUNZILOG_CONSOLE
491 491
492config SERIAL_SUNSU 492config SERIAL_SUNSU
493 tristate "Sun SU serial support" 493 tristate "Sun SU serial support"
494 depends on (SPARC32 || SPARC64) && PCI 494 depends on SPARC && PCI
495 help 495 help
496 This driver supports the 8250 serial ports that run the keyboard and 496 This driver supports the 8250 serial ports that run the keyboard and
497 mouse on (PCI) UltraSPARC systems. Say Y or M if you want to be able 497 mouse on (PCI) UltraSPARC systems. Say Y or M if you want to be able
@@ -507,7 +507,7 @@ config SERIAL_SUNSU_CONSOLE
507 507
508config SERIAL_MUX 508config SERIAL_MUX
509 tristate "Serial MUX support" 509 tristate "Serial MUX support"
510 depends on PARISC 510 depends on GSC
511 select SERIAL_CORE 511 select SERIAL_CORE
512 default y 512 default y
513 ---help--- 513 ---help---
@@ -547,7 +547,7 @@ config PDC_CONSOLE
547 547
548config SERIAL_SUNSAB 548config SERIAL_SUNSAB
549 tristate "Sun Siemens SAB82532 serial support" 549 tristate "Sun Siemens SAB82532 serial support"
550 depends on (SPARC32 || SPARC64) && PCI 550 depends on SPARC && PCI
551 help 551 help
552 This driver supports the Siemens SAB82532 DUSCC serial ports on newer 552 This driver supports the Siemens SAB82532 DUSCC serial ports on newer
553 (PCI) UltraSPARC systems. Say Y or M if you want to be able to these 553 (PCI) UltraSPARC systems. Say Y or M if you want to be able to these
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 938d185841c9..d84476ee6592 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -49,7 +49,6 @@
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>
53#include <asm/sizes.h> 52#include <asm/sizes.h>
54#include <asm/hardware/amba.h> 53#include <asm/hardware/amba.h>
55#include <asm/hardware/clock.h> 54#include <asm/hardware/clock.h>
@@ -63,7 +62,8 @@
63 62
64#define AMBA_ISR_PASS_LIMIT 256 63#define AMBA_ISR_PASS_LIMIT 256
65 64
66#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)
67 67
68/* 68/*
69 * We wrap our port structure around the generic uart_port. 69 * We wrap our port structure around the generic uart_port.
@@ -116,7 +116,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
116#endif 116#endif
117{ 117{
118 struct tty_struct *tty = uap->port.info->tty; 118 struct tty_struct *tty = uap->port.info->tty;
119 unsigned int status, ch, flag, rsr, max_count = 256; 119 unsigned int status, ch, flag, max_count = 256;
120 120
121 status = readw(uap->port.membase + UART01x_FR); 121 status = readw(uap->port.membase + UART01x_FR);
122 while ((status & UART01x_FR_RXFE) == 0 && max_count--) { 122 while ((status & UART01x_FR_RXFE) == 0 && max_count--) {
@@ -129,7 +129,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
129 */ 129 */
130 } 130 }
131 131
132 ch = readw(uap->port.membase + UART01x_DR); 132 ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX;
133 flag = TTY_NORMAL; 133 flag = TTY_NORMAL;
134 uap->port.icount.rx++; 134 uap->port.icount.rx++;
135 135
@@ -137,34 +137,33 @@ pl011_rx_chars(struct uart_amba_port *uap)
137 * Note that the error handling code is 137 * Note that the error handling code is
138 * out of the main execution path 138 * out of the main execution path
139 */ 139 */
140 rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; 140 if (unlikely(ch & UART_DR_ERROR)) {
141 if (unlikely(rsr & UART01x_RSR_ANY)) { 141 if (ch & UART011_DR_BE) {
142 if (rsr & UART01x_RSR_BE) { 142 ch &= ~(UART011_DR_FE | UART011_DR_PE);
143 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
144 uap->port.icount.brk++; 143 uap->port.icount.brk++;
145 if (uart_handle_break(&uap->port)) 144 if (uart_handle_break(&uap->port))
146 goto ignore_char; 145 goto ignore_char;
147 } else if (rsr & UART01x_RSR_PE) 146 } else if (ch & UART011_DR_PE)
148 uap->port.icount.parity++; 147 uap->port.icount.parity++;
149 else if (rsr & UART01x_RSR_FE) 148 else if (ch & UART011_DR_FE)
150 uap->port.icount.frame++; 149 uap->port.icount.frame++;
151 if (rsr & UART01x_RSR_OE) 150 if (ch & UART011_DR_OE)
152 uap->port.icount.overrun++; 151 uap->port.icount.overrun++;
153 152
154 rsr &= uap->port.read_status_mask; 153 ch &= uap->port.read_status_mask;
155 154
156 if (rsr & UART01x_RSR_BE) 155 if (ch & UART011_DR_BE)
157 flag = TTY_BREAK; 156 flag = TTY_BREAK;
158 else if (rsr & UART01x_RSR_PE) 157 else if (ch & UART011_DR_PE)
159 flag = TTY_PARITY; 158 flag = TTY_PARITY;
160 else if (rsr & UART01x_RSR_FE) 159 else if (ch & UART011_DR_FE)
161 flag = TTY_FRAME; 160 flag = TTY_FRAME;
162 } 161 }
163 162
164 if (uart_handle_sysrq_char(&uap->port, ch, regs)) 163 if (uart_handle_sysrq_char(&uap->port, ch & 255, regs))
165 goto ignore_char; 164 goto ignore_char;
166 165
167 uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); 166 uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);
168 167
169 ignore_char: 168 ignore_char:
170 status = readw(uap->port.membase + UART01x_FR); 169 status = readw(uap->port.membase + UART01x_FR);
@@ -476,33 +475,33 @@ pl011_set_termios(struct uart_port *port, struct termios *termios,
476 */ 475 */
477 uart_update_timeout(port, termios->c_cflag, baud); 476 uart_update_timeout(port, termios->c_cflag, baud);
478 477
479 port->read_status_mask = UART01x_RSR_OE; 478 port->read_status_mask = UART011_DR_OE | 255;
480 if (termios->c_iflag & INPCK) 479 if (termios->c_iflag & INPCK)
481 port->read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; 480 port->read_status_mask |= UART011_DR_FE | UART011_DR_PE;
482 if (termios->c_iflag & (BRKINT | PARMRK)) 481 if (termios->c_iflag & (BRKINT | PARMRK))
483 port->read_status_mask |= UART01x_RSR_BE; 482 port->read_status_mask |= UART011_DR_BE;
484 483
485 /* 484 /*
486 * Characters to ignore 485 * Characters to ignore
487 */ 486 */
488 port->ignore_status_mask = 0; 487 port->ignore_status_mask = 0;
489 if (termios->c_iflag & IGNPAR) 488 if (termios->c_iflag & IGNPAR)
490 port->ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; 489 port->ignore_status_mask |= UART011_DR_FE | UART011_DR_PE;
491 if (termios->c_iflag & IGNBRK) { 490 if (termios->c_iflag & IGNBRK) {
492 port->ignore_status_mask |= UART01x_RSR_BE; 491 port->ignore_status_mask |= UART011_DR_BE;
493 /* 492 /*
494 * If we're ignoring parity and break indicators, 493 * If we're ignoring parity and break indicators,
495 * ignore overruns too (for real raw support). 494 * ignore overruns too (for real raw support).
496 */ 495 */
497 if (termios->c_iflag & IGNPAR) 496 if (termios->c_iflag & IGNPAR)
498 port->ignore_status_mask |= UART01x_RSR_OE; 497 port->ignore_status_mask |= UART011_DR_OE;
499 } 498 }
500 499
501 /* 500 /*
502 * Ignore all characters if CREAD is not set. 501 * Ignore all characters if CREAD is not set.
503 */ 502 */
504 if ((termios->c_cflag & CREAD) == 0) 503 if ((termios->c_cflag & CREAD) == 0)
505 port->ignore_status_mask |= UART_DUMMY_RSR_RX; 504 port->ignore_status_mask |= UART_DUMMY_DR_RX;
506 505
507 if (UART_ENABLE_MS(port, termios->c_cflag)) 506 if (UART_ENABLE_MS(port, termios->c_cflag))
508 pl011_enable_ms(port); 507 pl011_enable_ms(port);
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/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 4a54ff584700..83c4c1216587 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -921,9 +921,9 @@ static struct uart_driver imx_reg = {
921 .cons = IMX_CONSOLE, 921 .cons = IMX_CONSOLE,
922}; 922};
923 923
924static int serial_imx_suspend(struct device *_dev, pm_message_t state) 924static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
925{ 925{
926 struct imx_port *sport = dev_get_drvdata(_dev); 926 struct imx_port *sport = platform_get_drvdata(dev);
927 927
928 if (sport) 928 if (sport)
929 uart_suspend_port(&imx_reg, &sport->port); 929 uart_suspend_port(&imx_reg, &sport->port);
@@ -931,9 +931,9 @@ static int serial_imx_suspend(struct device *_dev, pm_message_t state)
931 return 0; 931 return 0;
932} 932}
933 933
934static int serial_imx_resume(struct device *_dev) 934static int serial_imx_resume(struct platform_device *dev)
935{ 935{
936 struct imx_port *sport = dev_get_drvdata(_dev); 936 struct imx_port *sport = platform_get_drvdata(dev);
937 937
938 if (sport) 938 if (sport)
939 uart_resume_port(&imx_reg, &sport->port); 939 uart_resume_port(&imx_reg, &sport->port);
@@ -941,21 +941,19 @@ static int serial_imx_resume(struct device *_dev)
941 return 0; 941 return 0;
942} 942}
943 943
944static int serial_imx_probe(struct device *_dev) 944static int serial_imx_probe(struct platform_device *dev)
945{ 945{
946 struct platform_device *dev = to_platform_device(_dev); 946 imx_ports[dev->id].port.dev = &dev->dev;
947
948 imx_ports[dev->id].port.dev = _dev;
949 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); 947 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port);
950 dev_set_drvdata(_dev, &imx_ports[dev->id]); 948 platform_set_drvdata(dev, &imx_ports[dev->id]);
951 return 0; 949 return 0;
952} 950}
953 951
954static int serial_imx_remove(struct device *_dev) 952static int serial_imx_remove(struct platform_device *dev)
955{ 953{
956 struct imx_port *sport = dev_get_drvdata(_dev); 954 struct imx_port *sport = platform_get_drvdata(dev);
957 955
958 dev_set_drvdata(_dev, NULL); 956 platform_set_drvdata(dev, NULL);
959 957
960 if (sport) 958 if (sport)
961 uart_remove_one_port(&imx_reg, &sport->port); 959 uart_remove_one_port(&imx_reg, &sport->port);
@@ -963,14 +961,15 @@ static int serial_imx_remove(struct device *_dev)
963 return 0; 961 return 0;
964} 962}
965 963
966static struct device_driver serial_imx_driver = { 964static struct platform_driver serial_imx_driver = {
967 .name = "imx-uart",
968 .bus = &platform_bus_type,
969 .probe = serial_imx_probe, 965 .probe = serial_imx_probe,
970 .remove = serial_imx_remove, 966 .remove = serial_imx_remove,
971 967
972 .suspend = serial_imx_suspend, 968 .suspend = serial_imx_suspend,
973 .resume = serial_imx_resume, 969 .resume = serial_imx_resume,
970 .driver = {
971 .name = "imx-uart",
972 },
974}; 973};
975 974
976static int __init imx_serial_init(void) 975static int __init imx_serial_init(void)
@@ -985,7 +984,7 @@ static int __init imx_serial_init(void)
985 if (ret) 984 if (ret)
986 return ret; 985 return ret;
987 986
988 ret = driver_register(&serial_imx_driver); 987 ret = platform_driver_register(&serial_imx_driver);
989 if (ret != 0) 988 if (ret != 0)
990 uart_unregister_driver(&imx_reg); 989 uart_unregister_driver(&imx_reg);
991 990
@@ -995,7 +994,7 @@ static int __init imx_serial_init(void)
995static void __exit imx_serial_exit(void) 994static void __exit imx_serial_exit(void)
996{ 995{
997 uart_unregister_driver(&imx_reg); 996 uart_unregister_driver(&imx_reg);
998 driver_unregister(&serial_imx_driver); 997 platform_driver_unregister(&serial_imx_driver);
999} 998}
1000 999
1001module_init(imx_serial_init); 1000module_init(imx_serial_init);
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 0dd08a09e7e6..b8727d9bf690 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -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,9 +780,9 @@ 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) 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) 787 if (sport)
789 uart_suspend_port(&mpc52xx_uart_driver, port); 788 uart_suspend_port(&mpc52xx_uart_driver, port);
@@ -792,9 +791,9 @@ mpc52xx_uart_suspend(struct device *dev, pm_message_t state)
792} 791}
793 792
794static int 793static int
795mpc52xx_uart_resume(struct device *dev) 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) 798 if (port)
800 uart_resume_port(&mpc52xx_uart_driver, port); 799 uart_resume_port(&mpc52xx_uart_driver, port);
@@ -803,15 +802,16 @@ mpc52xx_uart_resume(struct device *dev)
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 ba8838b234da..8f83e4007ecd 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -1551,15 +1551,14 @@ mpsc_shared_unmap_regs(void)
1551} 1551}
1552 1552
1553static int 1553static int
1554mpsc_shared_drv_probe(struct device *dev) 1554mpsc_shared_drv_probe(struct platform_device *dev)
1555{ 1555{
1556 struct platform_device *pd = to_platform_device(dev);
1557 struct mpsc_shared_pdata *pdata; 1556 struct mpsc_shared_pdata *pdata;
1558 int rc = -ENODEV; 1557 int rc = -ENODEV;
1559 1558
1560 if (pd->id == 0) { 1559 if (dev->id == 0) {
1561 if (!(rc = mpsc_shared_map_regs(pd))) { 1560 if (!(rc = mpsc_shared_map_regs(dev))) {
1562 pdata = (struct mpsc_shared_pdata *)dev->platform_data; 1561 pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data;
1563 1562
1564 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; 1563 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val;
1565 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; 1564 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val;
@@ -1577,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev)
1577} 1576}
1578 1577
1579static int 1578static int
1580mpsc_shared_drv_remove(struct device *dev) 1579mpsc_shared_drv_remove(struct platform_device *dev)
1581{ 1580{
1582 struct platform_device *pd = to_platform_device(dev);
1583 int rc = -ENODEV; 1581 int rc = -ENODEV;
1584 1582
1585 if (pd->id == 0) { 1583 if (dev->id == 0) {
1586 mpsc_shared_unmap_regs(); 1584 mpsc_shared_unmap_regs();
1587 mpsc_shared_regs.MPSC_MRR_m = 0; 1585 mpsc_shared_regs.MPSC_MRR_m = 0;
1588 mpsc_shared_regs.MPSC_RCRR_m = 0; 1586 mpsc_shared_regs.MPSC_RCRR_m = 0;
@@ -1595,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev)
1595 return rc; 1593 return rc;
1596} 1594}
1597 1595
1598static struct device_driver mpsc_shared_driver = { 1596static struct platform_driver mpsc_shared_driver = {
1599 .name = MPSC_SHARED_NAME,
1600 .bus = &platform_bus_type,
1601 .probe = mpsc_shared_drv_probe, 1597 .probe = mpsc_shared_drv_probe,
1602 .remove = mpsc_shared_drv_remove, 1598 .remove = mpsc_shared_drv_remove,
1599 .driver = {
1600 .name = MPSC_SHARED_NAME,
1601 },
1603}; 1602};
1604 1603
1605/* 1604/*
@@ -1732,19 +1731,18 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
1732} 1731}
1733 1732
1734static int 1733static int
1735mpsc_drv_probe(struct device *dev) 1734mpsc_drv_probe(struct platform_device *dev)
1736{ 1735{
1737 struct platform_device *pd = to_platform_device(dev);
1738 struct mpsc_port_info *pi; 1736 struct mpsc_port_info *pi;
1739 int rc = -ENODEV; 1737 int rc = -ENODEV;
1740 1738
1741 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); 1739 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id);
1742 1740
1743 if (pd->id < MPSC_NUM_CTLRS) { 1741 if (dev->id < MPSC_NUM_CTLRS) {
1744 pi = &mpsc_ports[pd->id]; 1742 pi = &mpsc_ports[dev->id];
1745 1743
1746 if (!(rc = mpsc_drv_map_regs(pi, pd))) { 1744 if (!(rc = mpsc_drv_map_regs(pi, dev))) {
1747 mpsc_drv_get_platform_data(pi, pd, pd->id); 1745 mpsc_drv_get_platform_data(pi, dev, dev->id);
1748 1746
1749 if (!(rc = mpsc_make_ready(pi))) 1747 if (!(rc = mpsc_make_ready(pi)))
1750 if (!(rc = uart_add_one_port(&mpsc_reg, 1748 if (!(rc = uart_add_one_port(&mpsc_reg,
@@ -1764,27 +1762,26 @@ mpsc_drv_probe(struct device *dev)
1764} 1762}
1765 1763
1766static int 1764static int
1767mpsc_drv_remove(struct device *dev) 1765mpsc_drv_remove(struct platform_device *dev)
1768{ 1766{
1769 struct platform_device *pd = to_platform_device(dev); 1767 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
1770 1768
1771 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id); 1769 if (dev->id < MPSC_NUM_CTLRS) {
1772 1770 uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
1773 if (pd->id < MPSC_NUM_CTLRS) { 1771 mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port);
1774 uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); 1772 mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
1775 mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port);
1776 mpsc_drv_unmap_regs(&mpsc_ports[pd->id]);
1777 return 0; 1773 return 0;
1778 } 1774 }
1779 else 1775 else
1780 return -ENODEV; 1776 return -ENODEV;
1781} 1777}
1782 1778
1783static struct device_driver mpsc_driver = { 1779static struct platform_driver mpsc_driver = {
1784 .name = MPSC_CTLR_NAME,
1785 .bus = &platform_bus_type,
1786 .probe = mpsc_drv_probe, 1780 .probe = mpsc_drv_probe,
1787 .remove = mpsc_drv_remove, 1781 .remove = mpsc_drv_remove,
1782 .driver = {
1783 .name = MPSC_CTLR_NAME,
1784 },
1788}; 1785};
1789 1786
1790static int __init 1787static int __init
@@ -1798,9 +1795,9 @@ mpsc_drv_init(void)
1798 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1795 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
1799 1796
1800 if (!(rc = uart_register_driver(&mpsc_reg))) { 1797 if (!(rc = uart_register_driver(&mpsc_reg))) {
1801 if (!(rc = driver_register(&mpsc_shared_driver))) { 1798 if (!(rc = platform_driver_register(&mpsc_shared_driver))) {
1802 if ((rc = driver_register(&mpsc_driver))) { 1799 if ((rc = platform_driver_register(&mpsc_driver))) {
1803 driver_unregister(&mpsc_shared_driver); 1800 platform_driver_unregister(&mpsc_shared_driver);
1804 uart_unregister_driver(&mpsc_reg); 1801 uart_unregister_driver(&mpsc_reg);
1805 } 1802 }
1806 } 1803 }
@@ -1815,8 +1812,8 @@ mpsc_drv_init(void)
1815static void __exit 1812static void __exit
1816mpsc_drv_exit(void) 1813mpsc_drv_exit(void)
1817{ 1814{
1818 driver_unregister(&mpsc_driver); 1815 platform_driver_unregister(&mpsc_driver);
1819 driver_unregister(&mpsc_shared_driver); 1816 platform_driver_unregister(&mpsc_shared_driver);
1820 uart_unregister_driver(&mpsc_reg); 1817 uart_unregister_driver(&mpsc_reg);
1821 memset(mpsc_ports, 0, sizeof(mpsc_ports)); 1818 memset(mpsc_ports, 0, sizeof(mpsc_ports));
1822 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 660bae5ba179..7633132a10aa 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -65,8 +65,8 @@ static struct uart_driver mux_driver = {
65 65
66static struct timer_list mux_timer; 66static struct timer_list mux_timer;
67 67
68#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)
69#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)
70#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
71 71
72/** 72/**
@@ -79,10 +79,7 @@ static struct timer_list mux_timer;
79 */ 79 */
80static unsigned int mux_tx_empty(struct uart_port *port) 80static unsigned int mux_tx_empty(struct uart_port *port)
81{ 81{
82 unsigned int cnt = __raw_readl((unsigned long)port->membase 82 return UART_GET_FIFO_CNT(port) ? 0 : TIOCSER_TEMT;
83 + IO_DCOUNT_REG_OFFSET);
84
85 return cnt ? 0 : TIOCSER_TEMT;
86} 83}
87 84
88/** 85/**
@@ -218,8 +215,7 @@ static void mux_read(struct uart_port *port)
218 __u32 start_count = port->icount.rx; 215 __u32 start_count = port->icount.rx;
219 216
220 while(1) { 217 while(1) {
221 data = __raw_readl((unsigned long)port->membase 218 data = __raw_readl(port->membase + IO_DATA_REG_OFFSET);
222 + IO_DATA_REG_OFFSET);
223 219
224 if (MUX_STATUS(data)) 220 if (MUX_STATUS(data))
225 continue; 221 continue;
@@ -481,6 +477,13 @@ static int __init mux_probe(struct parisc_device *dev)
481 port->ops = &mux_pops; 477 port->ops = &mux_pops;
482 port->flags = UPF_BOOT_AUTOCONF; 478 port->flags = UPF_BOOT_AUTOCONF;
483 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;
484 spin_lock_init(&port->lock); 487 spin_lock_init(&port->lock);
485 status = uart_add_one_port(&mux_driver, port); 488 status = uart_add_one_port(&mux_driver, port);
486 BUG_ON(status); 489 BUG_ON(status);
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 16b2f9417af9..cc998b99a19f 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -361,7 +361,7 @@ static int serial_pxa_startup(struct uart_port *port)
361 if (port->line == 3) /* HWUART */ 361 if (port->line == 3) /* HWUART */
362 up->mcr |= UART_MCR_AFE; 362 up->mcr |= UART_MCR_AFE;
363 else 363 else
364 up->mcr = 0; 364 up->mcr = 0;
365 365
366 /* 366 /*
367 * Allocate the IRQ 367 * Allocate the IRQ
@@ -641,7 +641,7 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count)
641 int i; 641 int i;
642 642
643 /* 643 /*
644 * First save the UER then disable the interrupts 644 * First save the IER then disable the interrupts
645 */ 645 */
646 ier = serial_in(up, UART_IER); 646 ier = serial_in(up, UART_IER);
647 serial_out(up, UART_IER, UART_IER_UUE); 647 serial_out(up, UART_IER, UART_IER_UUE);
@@ -805,9 +805,9 @@ static struct uart_driver serial_pxa_reg = {
805 .cons = PXA_CONSOLE, 805 .cons = PXA_CONSOLE,
806}; 806};
807 807
808static int serial_pxa_suspend(struct device *_dev, pm_message_t state) 808static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state)
809{ 809{
810 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 810 struct uart_pxa_port *sport = platform_get_drvdata(dev);
811 811
812 if (sport) 812 if (sport)
813 uart_suspend_port(&serial_pxa_reg, &sport->port); 813 uart_suspend_port(&serial_pxa_reg, &sport->port);
@@ -815,9 +815,9 @@ static int serial_pxa_suspend(struct device *_dev, pm_message_t state)
815 return 0; 815 return 0;
816} 816}
817 817
818static int serial_pxa_resume(struct device *_dev) 818static int serial_pxa_resume(struct platform_device *dev)
819{ 819{
820 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 820 struct uart_pxa_port *sport = platform_get_drvdata(dev);
821 821
822 if (sport) 822 if (sport)
823 uart_resume_port(&serial_pxa_reg, &sport->port); 823 uart_resume_port(&serial_pxa_reg, &sport->port);
@@ -825,21 +825,19 @@ static int serial_pxa_resume(struct device *_dev)
825 return 0; 825 return 0;
826} 826}
827 827
828static int serial_pxa_probe(struct device *_dev) 828static int serial_pxa_probe(struct platform_device *dev)
829{ 829{
830 struct platform_device *dev = to_platform_device(_dev); 830 serial_pxa_ports[dev->id].port.dev = &dev->dev;
831
832 serial_pxa_ports[dev->id].port.dev = _dev;
833 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);
834 dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); 832 platform_set_drvdata(dev, &serial_pxa_ports[dev->id]);
835 return 0; 833 return 0;
836} 834}
837 835
838static int serial_pxa_remove(struct device *_dev) 836static int serial_pxa_remove(struct platform_device *dev)
839{ 837{
840 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 838 struct uart_pxa_port *sport = platform_get_drvdata(dev);
841 839
842 dev_set_drvdata(_dev, NULL); 840 platform_set_drvdata(dev, NULL);
843 841
844 if (sport) 842 if (sport)
845 uart_remove_one_port(&serial_pxa_reg, &sport->port); 843 uart_remove_one_port(&serial_pxa_reg, &sport->port);
@@ -847,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev)
847 return 0; 845 return 0;
848} 846}
849 847
850static struct device_driver serial_pxa_driver = { 848static struct platform_driver serial_pxa_driver = {
851 .name = "pxa2xx-uart",
852 .bus = &platform_bus_type,
853 .probe = serial_pxa_probe, 849 .probe = serial_pxa_probe,
854 .remove = serial_pxa_remove, 850 .remove = serial_pxa_remove,
855 851
856 .suspend = serial_pxa_suspend, 852 .suspend = serial_pxa_suspend,
857 .resume = serial_pxa_resume, 853 .resume = serial_pxa_resume,
854 .driver = {
855 .name = "pxa2xx-uart",
856 },
858}; 857};
859 858
860int __init serial_pxa_init(void) 859int __init serial_pxa_init(void)
@@ -865,7 +864,7 @@ int __init serial_pxa_init(void)
865 if (ret != 0) 864 if (ret != 0)
866 return ret; 865 return ret;
867 866
868 ret = driver_register(&serial_pxa_driver); 867 ret = platform_driver_register(&serial_pxa_driver);
869 if (ret != 0) 868 if (ret != 0)
870 uart_unregister_driver(&serial_pxa_reg); 869 uart_unregister_driver(&serial_pxa_reg);
871 870
@@ -874,7 +873,7 @@ int __init serial_pxa_init(void)
874 873
875void __exit serial_pxa_exit(void) 874void __exit serial_pxa_exit(void)
876{ 875{
877 driver_unregister(&serial_pxa_driver); 876 platform_driver_unregister(&serial_pxa_driver);
878 uart_unregister_driver(&serial_pxa_reg); 877 uart_unregister_driver(&serial_pxa_reg);
879} 878}
880 879
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 036792328d49..47681c4654e4 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -1092,14 +1092,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1092 1092
1093static int probe_index = 0; 1093static int probe_index = 0;
1094 1094
1095static int s3c24xx_serial_probe(struct device *_dev, 1095static int s3c24xx_serial_probe(struct platform_device *dev,
1096 struct s3c24xx_uart_info *info) 1096 struct s3c24xx_uart_info *info)
1097{ 1097{
1098 struct s3c24xx_uart_port *ourport; 1098 struct s3c24xx_uart_port *ourport;
1099 struct platform_device *dev = to_platform_device(_dev);
1100 int ret; 1099 int ret;
1101 1100
1102 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);
1103 1102
1104 ourport = &s3c24xx_serial_ports[probe_index]; 1103 ourport = &s3c24xx_serial_ports[probe_index];
1105 probe_index++; 1104 probe_index++;
@@ -1112,7 +1111,7 @@ static int s3c24xx_serial_probe(struct device *_dev,
1112 1111
1113 dbg("%s: adding port\n", __FUNCTION__); 1112 dbg("%s: adding port\n", __FUNCTION__);
1114 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); 1113 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
1115 dev_set_drvdata(_dev, &ourport->port); 1114 platform_set_drvdata(dev, &ourport->port);
1116 1115
1117 return 0; 1116 return 0;
1118 1117
@@ -1120,9 +1119,9 @@ static int s3c24xx_serial_probe(struct device *_dev,
1120 return ret; 1119 return ret;
1121} 1120}
1122 1121
1123static int s3c24xx_serial_remove(struct device *_dev) 1122static int s3c24xx_serial_remove(struct platform_device *dev)
1124{ 1123{
1125 struct uart_port *port = s3c24xx_dev_to_port(_dev); 1124 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1126 1125
1127 if (port) 1126 if (port)
1128 uart_remove_one_port(&s3c24xx_uart_drv, port); 1127 uart_remove_one_port(&s3c24xx_uart_drv, port);
@@ -1134,9 +1133,9 @@ static int s3c24xx_serial_remove(struct device *_dev)
1134 1133
1135#ifdef CONFIG_PM 1134#ifdef CONFIG_PM
1136 1135
1137static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state) 1136static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state)
1138{ 1137{
1139 struct uart_port *port = s3c24xx_dev_to_port(dev); 1138 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1140 1139
1141 if (port) 1140 if (port)
1142 uart_suspend_port(&s3c24xx_uart_drv, port); 1141 uart_suspend_port(&s3c24xx_uart_drv, port);
@@ -1144,9 +1143,9 @@ static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state)
1144 return 0; 1143 return 0;
1145} 1144}
1146 1145
1147static int s3c24xx_serial_resume(struct device *dev) 1146static int s3c24xx_serial_resume(struct platform_device *dev)
1148{ 1147{
1149 struct uart_port *port = s3c24xx_dev_to_port(dev); 1148 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
1150 struct s3c24xx_uart_port *ourport = to_ourport(port); 1149 struct s3c24xx_uart_port *ourport = to_ourport(port);
1151 1150
1152 if (port) { 1151 if (port) {
@@ -1165,11 +1164,11 @@ static int s3c24xx_serial_resume(struct device *dev)
1165#define s3c24xx_serial_resume NULL 1164#define s3c24xx_serial_resume NULL
1166#endif 1165#endif
1167 1166
1168static int s3c24xx_serial_init(struct device_driver *drv, 1167static int s3c24xx_serial_init(struct platform_driver *drv,
1169 struct s3c24xx_uart_info *info) 1168 struct s3c24xx_uart_info *info)
1170{ 1169{
1171 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); 1170 dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
1172 return driver_register(drv); 1171 return platform_driver_register(drv);
1173} 1172}
1174 1173
1175 1174
@@ -1228,19 +1227,20 @@ static struct s3c24xx_uart_info s3c2400_uart_inf = {
1228 .reset_port = s3c2400_serial_resetport, 1227 .reset_port = s3c2400_serial_resetport,
1229}; 1228};
1230 1229
1231static int s3c2400_serial_probe(struct device *dev) 1230static int s3c2400_serial_probe(struct platform_device *dev)
1232{ 1231{
1233 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); 1232 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf);
1234} 1233}
1235 1234
1236static struct device_driver s3c2400_serial_drv = { 1235static struct platform_driver s3c2400_serial_drv = {
1237 .name = "s3c2400-uart",
1238 .owner = THIS_MODULE,
1239 .bus = &platform_bus_type,
1240 .probe = s3c2400_serial_probe, 1236 .probe = s3c2400_serial_probe,
1241 .remove = s3c24xx_serial_remove, 1237 .remove = s3c24xx_serial_remove,
1242 .suspend = s3c24xx_serial_suspend, 1238 .suspend = s3c24xx_serial_suspend,
1243 .resume = s3c24xx_serial_resume, 1239 .resume = s3c24xx_serial_resume,
1240 .driver = {
1241 .name = "s3c2400-uart",
1242 .owner = THIS_MODULE,
1243 },
1244}; 1244};
1245 1245
1246static inline int s3c2400_serial_init(void) 1246static inline int s3c2400_serial_init(void)
@@ -1250,7 +1250,7 @@ static inline int s3c2400_serial_init(void)
1250 1250
1251static inline void s3c2400_serial_exit(void) 1251static inline void s3c2400_serial_exit(void)
1252{ 1252{
1253 driver_unregister(&s3c2400_serial_drv); 1253 platform_driver_unregister(&s3c2400_serial_drv);
1254} 1254}
1255 1255
1256#define s3c2400_uart_inf_at &s3c2400_uart_inf 1256#define s3c2400_uart_inf_at &s3c2400_uart_inf
@@ -1332,19 +1332,20 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = {
1332 1332
1333/* device management */ 1333/* device management */
1334 1334
1335static int s3c2410_serial_probe(struct device *dev) 1335static int s3c2410_serial_probe(struct platform_device *dev)
1336{ 1336{
1337 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); 1337 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf);
1338} 1338}
1339 1339
1340static struct device_driver s3c2410_serial_drv = { 1340static struct platform_driver s3c2410_serial_drv = {
1341 .name = "s3c2410-uart",
1342 .owner = THIS_MODULE,
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,20 +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 .owner = THIS_MODULE,
1505 .bus = &platform_bus_type,
1506 .probe = s3c2440_serial_probe, 1504 .probe = s3c2440_serial_probe,
1507 .remove = s3c24xx_serial_remove, 1505 .remove = s3c24xx_serial_remove,
1508 .suspend = s3c24xx_serial_suspend, 1506 .suspend = s3c24xx_serial_suspend,
1509 .resume = s3c24xx_serial_resume, 1507 .resume = s3c24xx_serial_resume,
1508 .driver = {
1509 .name = "s3c2440-uart",
1510 .owner = THIS_MODULE,
1511 },
1510}; 1512};
1511 1513
1512 1514
@@ -1517,7 +1519,7 @@ static inline int s3c2440_serial_init(void)
1517 1519
1518static inline void s3c2440_serial_exit(void) 1520static inline void s3c2440_serial_exit(void)
1519{ 1521{
1520 driver_unregister(&s3c2440_serial_drv); 1522 platform_driver_unregister(&s3c2440_serial_drv);
1521} 1523}
1522 1524
1523#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 ed618cc7ae96..25a086458ab9 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -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,9 +831,9 @@ 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) 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) 838 if (sport)
842 uart_suspend_port(&sa1100_reg, &sport->port); 839 uart_suspend_port(&sa1100_reg, &sport->port);
@@ -844,9 +841,9 @@ static int sa1100_serial_suspend(struct device *_dev, pm_message_t state)
844 return 0; 841 return 0;
845} 842}
846 843
847static int sa1100_serial_resume(struct device *_dev) 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) 848 if (sport)
852 uart_resume_port(&sa1100_reg, &sport->port); 849 uart_resume_port(&sa1100_reg, &sport->port);
@@ -854,9 +851,8 @@ static int sa1100_serial_resume(struct device *_dev)
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 427a23858076..c17d680e3f04 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -209,33 +209,45 @@ static void uart_shutdown(struct uart_state *state)
209 struct uart_info *info = state->info; 209 struct uart_info *info = state->info;
210 struct uart_port *port = state->port; 210 struct uart_port *port = state->port;
211 211
212 if (!(info->flags & UIF_INITIALIZED))
213 return;
214
215 /* 212 /*
216 * Turn off DTR and RTS early. 213 * Set the TTY IO error marker
217 */ 214 */
218 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) 215 if (info->tty)
219 uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 216 set_bit(TTY_IO_ERROR, &info->tty->flags);
220 217
221 /* 218 if (info->flags & UIF_INITIALIZED) {
222 * clear delta_msr_wait queue to avoid mem leaks: we may free 219 info->flags &= ~UIF_INITIALIZED;
223 * the irq here so the queue might never be woken up. Note
224 * that we won't end up waiting on delta_msr_wait again since
225 * any outstanding file descriptors should be pointing at
226 * hung_up_tty_fops now.
227 */
228 wake_up_interruptible(&info->delta_msr_wait);
229 220
230 /* 221 /*
231 * Free the IRQ and disable the port. 222 * Turn off DTR and RTS early.
232 */ 223 */
233 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 }
234 246
235 /* 247 /*
236 * Ensure that the IRQ handler isn't running on another CPU. 248 * kill off our tasklet
237 */ 249 */
238 synchronize_irq(port->irq); 250 tasklet_kill(&info->tlet);
239 251
240 /* 252 /*
241 * Free the transmit buffer page. 253 * Free the transmit buffer page.
@@ -244,15 +256,6 @@ static void uart_shutdown(struct uart_state *state)
244 free_page((unsigned long)info->xmit.buf); 256 free_page((unsigned long)info->xmit.buf);
245 info->xmit.buf = NULL; 257 info->xmit.buf = NULL;
246 } 258 }
247
248 /*
249 * kill off our tasklet
250 */
251 tasklet_kill(&info->tlet);
252 if (info->tty)
253 set_bit(TTY_IO_ERROR, &info->tty->flags);
254
255 info->flags &= ~UIF_INITIALIZED;
256} 259}
257 260
258/** 261/**
@@ -1776,7 +1779,7 @@ struct baud_rates {
1776 unsigned int cflag; 1779 unsigned int cflag;
1777}; 1780};
1778 1781
1779static struct baud_rates baud_rates[] = { 1782static const struct baud_rates baud_rates[] = {
1780 { 921600, B921600 }, 1783 { 921600, B921600 },
1781 { 460800, B460800 }, 1784 { 460800, B460800 },
1782 { 230400, B230400 }, 1785 { 230400, B230400 },
@@ -1928,14 +1931,25 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
1928 1931
1929 if (state->info && state->info->flags & UIF_INITIALIZED) { 1932 if (state->info && state->info->flags & UIF_INITIALIZED) {
1930 struct uart_ops *ops = port->ops; 1933 struct uart_ops *ops = port->ops;
1934 int ret;
1931 1935
1932 ops->set_mctrl(port, 0); 1936 ops->set_mctrl(port, 0);
1933 ops->startup(port); 1937 ret = ops->startup(port);
1934 uart_change_speed(state, NULL); 1938 if (ret == 0) {
1935 spin_lock_irq(&port->lock); 1939 uart_change_speed(state, NULL);
1936 ops->set_mctrl(port, port->mctrl); 1940 spin_lock_irq(&port->lock);
1937 ops->start_tx(port); 1941 ops->set_mctrl(port, port->mctrl);
1938 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 }
1939 } 1953 }
1940 1954
1941 up(&state->sem); 1955 up(&state->sem);
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 2c7d3ef76e8e..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;
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index 01696b3e3f61..865d4dea65df 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -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,7 +976,7 @@ 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) 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;
@@ -984,7 +984,7 @@ static int siu_suspend(struct device *dev, pm_message_t state)
984 for (i = 0; i < siu_uart_driver.nr; i++) { 984 for (i = 0; i < siu_uart_driver.nr; i++) {
985 port = &siu_uart_ports[i]; 985 port = &siu_uart_ports[i];
986 if ((port->type == PORT_VR41XX_SIU || 986 if ((port->type == PORT_VR41XX_SIU ||
987 port->type == PORT_VR41XX_DSIU) && port->dev == dev) 987 port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev)
988 uart_suspend_port(&siu_uart_driver, port); 988 uart_suspend_port(&siu_uart_driver, port);
989 989
990 } 990 }
@@ -992,7 +992,7 @@ static int siu_suspend(struct device *dev, pm_message_t state)
992 return 0; 992 return 0;
993} 993}
994 994
995static int siu_resume(struct device *dev) 995static int siu_resume(struct platform_device *dev)
996{ 996{
997 struct uart_port *port; 997 struct uart_port *port;
998 int i; 998 int i;
@@ -1000,7 +1000,7 @@ static int siu_resume(struct device *dev)
1000 for (i = 0; i < siu_uart_driver.nr; i++) { 1000 for (i = 0; i < siu_uart_driver.nr; i++) {
1001 port = &siu_uart_ports[i]; 1001 port = &siu_uart_ports[i];
1002 if ((port->type == PORT_VR41XX_SIU || 1002 if ((port->type == PORT_VR41XX_SIU ||
1003 port->type == PORT_VR41XX_DSIU) && port->dev == dev) 1003 port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev)
1004 uart_resume_port(&siu_uart_driver, port); 1004 uart_resume_port(&siu_uart_driver, port);
1005 } 1005 }
1006 1006
@@ -1009,13 +1009,14 @@ static int siu_resume(struct device *dev)
1009 1009
1010static struct platform_device *siu_platform_device; 1010static struct platform_device *siu_platform_device;
1011 1011
1012static struct device_driver siu_device_driver = { 1012static struct platform_driver siu_device_driver = {
1013 .name = "SIU",
1014 .bus = &platform_bus_type,
1015 .probe = siu_probe, 1013 .probe = siu_probe,
1016 .remove = siu_remove, 1014 .remove = siu_remove,
1017 .suspend = siu_suspend, 1015 .suspend = siu_suspend,
1018 .resume = siu_resume, 1016 .resume = siu_resume,
1017 .driver = {
1018 .name = "SIU",
1019 },
1019}; 1020};
1020 1021
1021static int __devinit vr41xx_siu_init(void) 1022static int __devinit vr41xx_siu_init(void)
@@ -1026,7 +1027,7 @@ static int __devinit vr41xx_siu_init(void)
1026 if (IS_ERR(siu_platform_device)) 1027 if (IS_ERR(siu_platform_device))
1027 return PTR_ERR(siu_platform_device); 1028 return PTR_ERR(siu_platform_device);
1028 1029
1029 retval = driver_register(&siu_device_driver); 1030 retval = platform_driver_register(&siu_device_driver);
1030 if (retval < 0) 1031 if (retval < 0)
1031 platform_device_unregister(siu_platform_device); 1032 platform_device_unregister(siu_platform_device);
1032 1033
@@ -1035,7 +1036,7 @@ static int __devinit vr41xx_siu_init(void)
1035 1036
1036static void __devexit vr41xx_siu_exit(void) 1037static void __devexit vr41xx_siu_exit(void)
1037{ 1038{
1038 driver_unregister(&siu_device_driver); 1039 platform_driver_unregister(&siu_device_driver);
1039 1040
1040 platform_device_unregister(siu_platform_device); 1041 platform_device_unregister(siu_platform_device);
1041} 1042}