aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-16 10:51:32 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:51:32 -0400
commit5fef06e8c8c52aa7170dbbb068aa996d83738d38 (patch)
treef46a1eefd68863bdae57afa004e5281801a6b61e /drivers/serial/8250.c
parent0c5d1eb77a8be917b638344a22afe1398236482b (diff)
parent278429cff8809958d25415ba0ed32b59866ab1a8 (diff)
Merge branch 'linus' into genirq
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r--drivers/serial/8250.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 9ccc563d8730..d3ca7d32abe0 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -44,6 +44,10 @@
44 44
45#include "8250.h" 45#include "8250.h"
46 46
47#ifdef CONFIG_SPARC
48#include "suncore.h"
49#endif
50
47/* 51/*
48 * Configuration: 52 * Configuration:
49 * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option 53 * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option
@@ -53,6 +57,13 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
53 57
54static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS; 58static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS;
55 59
60static struct uart_driver serial8250_reg;
61
62static int serial_index(struct uart_port *port)
63{
64 return (serial8250_reg.minor - 64) + port->line;
65}
66
56/* 67/*
57 * Debugging. 68 * Debugging.
58 */ 69 */
@@ -536,7 +547,7 @@ static unsigned int serial_icr_read(struct uart_8250_port *up, int offset)
536/* 547/*
537 * FIFO support. 548 * FIFO support.
538 */ 549 */
539static inline void serial8250_clear_fifos(struct uart_8250_port *p) 550static void serial8250_clear_fifos(struct uart_8250_port *p)
540{ 551{
541 if (p->capabilities & UART_CAP_FIFO) { 552 if (p->capabilities & UART_CAP_FIFO) {
542 serial_outp(p, UART_FCR, UART_FCR_ENABLE_FIFO); 553 serial_outp(p, UART_FCR, UART_FCR_ENABLE_FIFO);
@@ -551,7 +562,7 @@ static inline void serial8250_clear_fifos(struct uart_8250_port *p)
551 * capability" bit enabled. Note that on XR16C850s, we need to 562 * capability" bit enabled. Note that on XR16C850s, we need to
552 * reset LCR to write to IER. 563 * reset LCR to write to IER.
553 */ 564 */
554static inline void serial8250_set_sleep(struct uart_8250_port *p, int sleep) 565static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
555{ 566{
556 if (p->capabilities & UART_CAP_SLEEP) { 567 if (p->capabilities & UART_CAP_SLEEP) {
557 if (p->capabilities & UART_CAP_EFR) { 568 if (p->capabilities & UART_CAP_EFR) {
@@ -993,7 +1004,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
993 return; 1004 return;
994 1005
995 DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%p): ", 1006 DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%p): ",
996 up->port.line, up->port.iobase, up->port.membase); 1007 serial_index(&up->port), up->port.iobase, up->port.membase);
997 1008
998 /* 1009 /*
999 * We really do need global IRQs disabled here - we're going to 1010 * We really do need global IRQs disabled here - we're going to
@@ -1128,8 +1139,8 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1128 if (up->capabilities != uart_config[up->port.type].flags) { 1139 if (up->capabilities != uart_config[up->port.type].flags) {
1129 printk(KERN_WARNING 1140 printk(KERN_WARNING
1130 "ttyS%d: detected caps %08x should be %08x\n", 1141 "ttyS%d: detected caps %08x should be %08x\n",
1131 up->port.line, up->capabilities, 1142 serial_index(&up->port), up->capabilities,
1132 uart_config[up->port.type].flags); 1143 uart_config[up->port.type].flags);
1133 } 1144 }
1134 1145
1135 up->port.fifosize = uart_config[up->port.type].fifo_size; 1146 up->port.fifosize = uart_config[up->port.type].fifo_size;
@@ -1424,8 +1435,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
1424/* 1435/*
1425 * This handles the interrupt from one port. 1436 * This handles the interrupt from one port.
1426 */ 1437 */
1427static inline void 1438static void serial8250_handle_port(struct uart_8250_port *up)
1428serial8250_handle_port(struct uart_8250_port *up)
1429{ 1439{
1430 unsigned int status; 1440 unsigned int status;
1431 unsigned long flags; 1441 unsigned long flags;
@@ -1719,7 +1729,7 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state)
1719/* 1729/*
1720 * Wait for transmitter & holding register to empty 1730 * Wait for transmitter & holding register to empty
1721 */ 1731 */
1722static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) 1732static void wait_for_xmitr(struct uart_8250_port *up, int bits)
1723{ 1733{
1724 unsigned int status, tmout = 10000; 1734 unsigned int status, tmout = 10000;
1725 1735
@@ -1854,7 +1864,8 @@ static int serial8250_startup(struct uart_port *port)
1854 */ 1864 */
1855 if (!(up->port.flags & UPF_BUGGY_UART) && 1865 if (!(up->port.flags & UPF_BUGGY_UART) &&
1856 (serial_inp(up, UART_LSR) == 0xff)) { 1866 (serial_inp(up, UART_LSR) == 0xff)) {
1857 printk("ttyS%d: LSR safety check engaged!\n", up->port.line); 1867 printk(KERN_INFO "ttyS%d: LSR safety check engaged!\n",
1868 serial_index(&up->port));
1858 return -ENODEV; 1869 return -ENODEV;
1859 } 1870 }
1860 1871
@@ -1909,7 +1920,8 @@ static int serial8250_startup(struct uart_port *port)
1909 */ 1920 */
1910 if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { 1921 if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {
1911 up->bugs |= UART_BUG_THRE; 1922 up->bugs |= UART_BUG_THRE;
1912 pr_debug("ttyS%d - using backup timer\n", port->line); 1923 pr_debug("ttyS%d - using backup timer\n",
1924 serial_index(port));
1913 } 1925 }
1914 } 1926 }
1915 1927
@@ -1969,7 +1981,7 @@ static int serial8250_startup(struct uart_port *port)
1969 if (!(up->bugs & UART_BUG_TXEN)) { 1981 if (!(up->bugs & UART_BUG_TXEN)) {
1970 up->bugs |= UART_BUG_TXEN; 1982 up->bugs |= UART_BUG_TXEN;
1971 pr_debug("ttyS%d - enabling bad tx status workarounds\n", 1983 pr_debug("ttyS%d - enabling bad tx status workarounds\n",
1972 port->line); 1984 serial_index(port));
1973 } 1985 }
1974 } else { 1986 } else {
1975 up->bugs &= ~UART_BUG_TXEN; 1987 up->bugs &= ~UART_BUG_TXEN;
@@ -2630,7 +2642,6 @@ static int serial8250_console_early_setup(void)
2630 return serial8250_find_port_for_earlycon(); 2642 return serial8250_find_port_for_earlycon();
2631} 2643}
2632 2644
2633static struct uart_driver serial8250_reg;
2634static struct console serial8250_console = { 2645static struct console serial8250_console = {
2635 .name = "ttyS", 2646 .name = "ttyS",
2636 .write = serial8250_console_write, 2647 .write = serial8250_console_write,
@@ -2677,7 +2688,6 @@ static struct uart_driver serial8250_reg = {
2677 .dev_name = "ttyS", 2688 .dev_name = "ttyS",
2678 .major = TTY_MAJOR, 2689 .major = TTY_MAJOR,
2679 .minor = 64, 2690 .minor = 64,
2680 .nr = UART_NR,
2681 .cons = SERIAL8250_CONSOLE, 2691 .cons = SERIAL8250_CONSOLE,
2682}; 2692};
2683 2693
@@ -2962,7 +2972,12 @@ static int __init serial8250_init(void)
2962 for (i = 0; i < NR_IRQS; i++) 2972 for (i = 0; i < NR_IRQS; i++)
2963 spin_lock_init(&irq_lists[i].lock); 2973 spin_lock_init(&irq_lists[i].lock);
2964 2974
2975#ifdef CONFIG_SPARC
2976 ret = sunserial_register_minors(&serial8250_reg, UART_NR);
2977#else
2978 serial8250_reg.nr = UART_NR;
2965 ret = uart_register_driver(&serial8250_reg); 2979 ret = uart_register_driver(&serial8250_reg);
2980#endif
2966 if (ret) 2981 if (ret)
2967 goto out; 2982 goto out;
2968 2983
@@ -2987,7 +3002,11 @@ static int __init serial8250_init(void)
2987 put_dev: 3002 put_dev:
2988 platform_device_put(serial8250_isa_devs); 3003 platform_device_put(serial8250_isa_devs);
2989 unreg_uart_drv: 3004 unreg_uart_drv:
3005#ifdef CONFIG_SPARC
3006 sunserial_unregister_minors(&serial8250_reg, UART_NR);
3007#else
2990 uart_unregister_driver(&serial8250_reg); 3008 uart_unregister_driver(&serial8250_reg);
3009#endif
2991 out: 3010 out:
2992 return ret; 3011 return ret;
2993} 3012}
@@ -3006,7 +3025,11 @@ static void __exit serial8250_exit(void)
3006 platform_driver_unregister(&serial8250_isa_driver); 3025 platform_driver_unregister(&serial8250_isa_driver);
3007 platform_device_unregister(isa_dev); 3026 platform_device_unregister(isa_dev);
3008 3027
3028#ifdef CONFIG_SPARC
3029 sunserial_unregister_minors(&serial8250_reg, UART_NR);
3030#else
3009 uart_unregister_driver(&serial8250_reg); 3031 uart_unregister_driver(&serial8250_reg);
3032#endif
3010} 3033}
3011 3034
3012module_init(serial8250_init); 3035module_init(serial8250_init);