aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-10-15 18:16:07 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-15 18:16:07 -0400
commit2502991560dc8244dbe10e48473d85722c1e2ec1 (patch)
tree63b1f3be2ed56ff06f1e8db709e4ce85d69c3add /drivers/serial/8250.c
parent7e69a8c4d06b7ecb874f571e82b715a9f79bc3c4 (diff)
parenta9ff8f6462635c8d9f8d64b7b10ddcea8404d77b (diff)
Merge branch 'fixes' into for-linus
Conflicts: arch/arm/mach-versatile/core.c
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r--drivers/serial/8250.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 8058533f8418..ec39203b879d 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;
@@ -2637,7 +2649,6 @@ static int serial8250_console_early_setup(void)
2637 return serial8250_find_port_for_earlycon(); 2649 return serial8250_find_port_for_earlycon();
2638} 2650}
2639 2651
2640static struct uart_driver serial8250_reg;
2641static struct console serial8250_console = { 2652static struct console serial8250_console = {
2642 .name = "ttyS", 2653 .name = "ttyS",
2643 .write = serial8250_console_write, 2654 .write = serial8250_console_write,
@@ -2684,7 +2695,6 @@ static struct uart_driver serial8250_reg = {
2684 .dev_name = "ttyS", 2695 .dev_name = "ttyS",
2685 .major = TTY_MAJOR, 2696 .major = TTY_MAJOR,
2686 .minor = 64, 2697 .minor = 64,
2687 .nr = UART_NR,
2688 .cons = SERIAL8250_CONSOLE, 2698 .cons = SERIAL8250_CONSOLE,
2689}; 2699};
2690 2700
@@ -2966,10 +2976,12 @@ static int __init serial8250_init(void)
2966 "%d ports, IRQ sharing %sabled\n", nr_uarts, 2976 "%d ports, IRQ sharing %sabled\n", nr_uarts,
2967 share_irqs ? "en" : "dis"); 2977 share_irqs ? "en" : "dis");
2968 2978
2969 for (i = 0; i < NR_IRQS; i++) 2979#ifdef CONFIG_SPARC
2970 spin_lock_init(&irq_lists[i].lock); 2980 ret = sunserial_register_minors(&serial8250_reg, UART_NR);
2971 2981#else
2982 serial8250_reg.nr = UART_NR;
2972 ret = uart_register_driver(&serial8250_reg); 2983 ret = uart_register_driver(&serial8250_reg);
2984#endif
2973 if (ret) 2985 if (ret)
2974 goto out; 2986 goto out;
2975 2987
@@ -2994,7 +3006,11 @@ static int __init serial8250_init(void)
2994 put_dev: 3006 put_dev:
2995 platform_device_put(serial8250_isa_devs); 3007 platform_device_put(serial8250_isa_devs);
2996 unreg_uart_drv: 3008 unreg_uart_drv:
3009#ifdef CONFIG_SPARC
3010 sunserial_unregister_minors(&serial8250_reg, UART_NR);
3011#else
2997 uart_unregister_driver(&serial8250_reg); 3012 uart_unregister_driver(&serial8250_reg);
3013#endif
2998 out: 3014 out:
2999 return ret; 3015 return ret;
3000} 3016}
@@ -3013,7 +3029,11 @@ static void __exit serial8250_exit(void)
3013 platform_driver_unregister(&serial8250_isa_driver); 3029 platform_driver_unregister(&serial8250_isa_driver);
3014 platform_device_unregister(isa_dev); 3030 platform_device_unregister(isa_dev);
3015 3031
3032#ifdef CONFIG_SPARC
3033 sunserial_unregister_minors(&serial8250_reg, UART_NR);
3034#else
3016 uart_unregister_driver(&serial8250_reg); 3035 uart_unregister_driver(&serial8250_reg);
3036#endif
3017} 3037}
3018 3038
3019module_init(serial8250_init); 3039module_init(serial8250_init);