aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/8250.c42
-rw-r--r--drivers/serial/8250_pci.c133
-rw-r--r--drivers/serial/8250_pnp.c10
-rw-r--r--drivers/serial/mcf.c2
-rw-r--r--drivers/serial/mpsc.c1
-rw-r--r--drivers/serial/s3c2410.c2
-rw-r--r--drivers/serial/serial_core.c20
-rw-r--r--drivers/serial/serial_cs.c6
8 files changed, 181 insertions, 35 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index f94109cbb46e..b8a4bd94f51d 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2047,7 +2047,7 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
2047 * Oxford Semi 952 rev B workaround 2047 * Oxford Semi 952 rev B workaround
2048 */ 2048 */
2049 if (up->bugs & UART_BUG_QUOT && (quot & 0xff) == 0) 2049 if (up->bugs & UART_BUG_QUOT && (quot & 0xff) == 0)
2050 quot ++; 2050 quot++;
2051 2051
2052 if (up->capabilities & UART_CAP_FIFO && up->port.fifosize > 1) { 2052 if (up->capabilities & UART_CAP_FIFO && up->port.fifosize > 1) {
2053 if (baud < 2400) 2053 if (baud < 2400)
@@ -2662,16 +2662,17 @@ static int __devinit serial8250_probe(struct platform_device *dev)
2662 memset(&port, 0, sizeof(struct uart_port)); 2662 memset(&port, 0, sizeof(struct uart_port));
2663 2663
2664 for (i = 0; p && p->flags != 0; p++, i++) { 2664 for (i = 0; p && p->flags != 0; p++, i++) {
2665 port.iobase = p->iobase; 2665 port.iobase = p->iobase;
2666 port.membase = p->membase; 2666 port.membase = p->membase;
2667 port.irq = p->irq; 2667 port.irq = p->irq;
2668 port.uartclk = p->uartclk; 2668 port.uartclk = p->uartclk;
2669 port.regshift = p->regshift; 2669 port.regshift = p->regshift;
2670 port.iotype = p->iotype; 2670 port.iotype = p->iotype;
2671 port.flags = p->flags; 2671 port.flags = p->flags;
2672 port.mapbase = p->mapbase; 2672 port.mapbase = p->mapbase;
2673 port.hub6 = p->hub6; 2673 port.hub6 = p->hub6;
2674 port.dev = &dev->dev; 2674 port.private_data = p->private_data;
2675 port.dev = &dev->dev;
2675 if (share_irqs) 2676 if (share_irqs)
2676 port.flags |= UPF_SHARE_IRQ; 2677 port.flags |= UPF_SHARE_IRQ;
2677 ret = serial8250_register_port(&port); 2678 ret = serial8250_register_port(&port);
@@ -2812,15 +2813,16 @@ int serial8250_register_port(struct uart_port *port)
2812 if (uart) { 2813 if (uart) {
2813 uart_remove_one_port(&serial8250_reg, &uart->port); 2814 uart_remove_one_port(&serial8250_reg, &uart->port);
2814 2815
2815 uart->port.iobase = port->iobase; 2816 uart->port.iobase = port->iobase;
2816 uart->port.membase = port->membase; 2817 uart->port.membase = port->membase;
2817 uart->port.irq = port->irq; 2818 uart->port.irq = port->irq;
2818 uart->port.uartclk = port->uartclk; 2819 uart->port.uartclk = port->uartclk;
2819 uart->port.fifosize = port->fifosize; 2820 uart->port.fifosize = port->fifosize;
2820 uart->port.regshift = port->regshift; 2821 uart->port.regshift = port->regshift;
2821 uart->port.iotype = port->iotype; 2822 uart->port.iotype = port->iotype;
2822 uart->port.flags = port->flags | UPF_BOOT_AUTOCONF; 2823 uart->port.flags = port->flags | UPF_BOOT_AUTOCONF;
2823 uart->port.mapbase = port->mapbase; 2824 uart->port.mapbase = port->mapbase;
2825 uart->port.private_data = port->private_data;
2824 if (port->dev) 2826 if (port->dev)
2825 uart->port.dev = port->dev; 2827 uart->port.dev = port->dev;
2826 2828
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index ceb03c9e749f..0a4ac2b6eb5a 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -106,6 +106,32 @@ setup_port(struct serial_private *priv, struct uart_port *port,
106} 106}
107 107
108/* 108/*
109 * ADDI-DATA GmbH communication cards <info@addi-data.com>
110 */
111static int addidata_apci7800_setup(struct serial_private *priv,
112 struct pciserial_board *board,
113 struct uart_port *port, int idx)
114{
115 unsigned int bar = 0, offset = board->first_offset;
116 bar = FL_GET_BASE(board->flags);
117
118 if (idx < 2) {
119 offset += idx * board->uart_offset;
120 } else if ((idx >= 2) && (idx < 4)) {
121 bar += 1;
122 offset += ((idx - 2) * board->uart_offset);
123 } else if ((idx >= 4) && (idx < 6)) {
124 bar += 2;
125 offset += ((idx - 4) * board->uart_offset);
126 } else if (idx >= 6) {
127 bar += 3;
128 offset += ((idx - 6) * board->uart_offset);
129 }
130
131 return setup_port(priv, port, bar, offset, board->reg_shift);
132}
133
134/*
109 * AFAVLAB uses a different mixture of BARs and offsets 135 * AFAVLAB uses a different mixture of BARs and offsets
110 * Not that ugly ;) -- HW 136 * Not that ugly ;) -- HW
111 */ 137 */
@@ -752,6 +778,16 @@ pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
752 */ 778 */
753static struct pci_serial_quirk pci_serial_quirks[] = { 779static struct pci_serial_quirk pci_serial_quirks[] = {
754 /* 780 /*
781 * ADDI-DATA GmbH communication cards <info@addi-data.com>
782 */
783 {
784 .vendor = PCI_VENDOR_ID_ADDIDATA_OLD,
785 .device = PCI_DEVICE_ID_ADDIDATA_APCI7800,
786 .subvendor = PCI_ANY_ID,
787 .subdevice = PCI_ANY_ID,
788 .setup = addidata_apci7800_setup,
789 },
790 /*
755 * AFAVLAB cards - these may be called via parport_serial 791 * AFAVLAB cards - these may be called via parport_serial
756 * It is not clear whether this applies to all products. 792 * It is not clear whether this applies to all products.
757 */ 793 */
@@ -1179,6 +1215,12 @@ static struct pciserial_board pci_boards[] __devinitdata = {
1179 .base_baud = 115200, 1215 .base_baud = 115200,
1180 .uart_offset = 8, 1216 .uart_offset = 8,
1181 }, 1217 },
1218 [pbn_b0_8_115200] = {
1219 .flags = FL_BASE0,
1220 .num_ports = 8,
1221 .base_baud = 115200,
1222 .uart_offset = 8,
1223 },
1182 1224
1183 [pbn_b0_1_921600] = { 1225 [pbn_b0_1_921600] = {
1184 .flags = FL_BASE0, 1226 .flags = FL_BASE0,
@@ -2697,6 +2739,97 @@ static struct pci_device_id serial_pci_tbl[] = {
2697 pbn_pasemi_1682M }, 2739 pbn_pasemi_1682M },
2698 2740
2699 /* 2741 /*
2742 * ADDI-DATA GmbH communication cards <info@addi-data.com>
2743 */
2744 { PCI_VENDOR_ID_ADDIDATA,
2745 PCI_DEVICE_ID_ADDIDATA_APCI7500,
2746 PCI_ANY_ID,
2747 PCI_ANY_ID,
2748 0,
2749 0,
2750 pbn_b0_4_115200 },
2751
2752 { PCI_VENDOR_ID_ADDIDATA,
2753 PCI_DEVICE_ID_ADDIDATA_APCI7420,
2754 PCI_ANY_ID,
2755 PCI_ANY_ID,
2756 0,
2757 0,
2758 pbn_b0_2_115200 },
2759
2760 { PCI_VENDOR_ID_ADDIDATA,
2761 PCI_DEVICE_ID_ADDIDATA_APCI7300,
2762 PCI_ANY_ID,
2763 PCI_ANY_ID,
2764 0,
2765 0,
2766 pbn_b0_1_115200 },
2767
2768 { PCI_VENDOR_ID_ADDIDATA_OLD,
2769 PCI_DEVICE_ID_ADDIDATA_APCI7800,
2770 PCI_ANY_ID,
2771 PCI_ANY_ID,
2772 0,
2773 0,
2774 pbn_b1_8_115200 },
2775
2776 { PCI_VENDOR_ID_ADDIDATA,
2777 PCI_DEVICE_ID_ADDIDATA_APCI7500_2,
2778 PCI_ANY_ID,
2779 PCI_ANY_ID,
2780 0,
2781 0,
2782 pbn_b0_4_115200 },
2783
2784 { PCI_VENDOR_ID_ADDIDATA,
2785 PCI_DEVICE_ID_ADDIDATA_APCI7420_2,
2786 PCI_ANY_ID,
2787 PCI_ANY_ID,
2788 0,
2789 0,
2790 pbn_b0_2_115200 },
2791
2792 { PCI_VENDOR_ID_ADDIDATA,
2793 PCI_DEVICE_ID_ADDIDATA_APCI7300_2,
2794 PCI_ANY_ID,
2795 PCI_ANY_ID,
2796 0,
2797 0,
2798 pbn_b0_1_115200 },
2799
2800 { PCI_VENDOR_ID_ADDIDATA,
2801 PCI_DEVICE_ID_ADDIDATA_APCI7500_3,
2802 PCI_ANY_ID,
2803 PCI_ANY_ID,
2804 0,
2805 0,
2806 pbn_b0_4_115200 },
2807
2808 { PCI_VENDOR_ID_ADDIDATA,
2809 PCI_DEVICE_ID_ADDIDATA_APCI7420_3,
2810 PCI_ANY_ID,
2811 PCI_ANY_ID,
2812 0,
2813 0,
2814 pbn_b0_2_115200 },
2815
2816 { PCI_VENDOR_ID_ADDIDATA,
2817 PCI_DEVICE_ID_ADDIDATA_APCI7300_3,
2818 PCI_ANY_ID,
2819 PCI_ANY_ID,
2820 0,
2821 0,
2822 pbn_b0_1_115200 },
2823
2824 { PCI_VENDOR_ID_ADDIDATA,
2825 PCI_DEVICE_ID_ADDIDATA_APCI7800_3,
2826 PCI_ANY_ID,
2827 PCI_ANY_ID,
2828 0,
2829 0,
2830 pbn_b0_8_115200 },
2831
2832 /*
2700 * These entries match devices with class COMMUNICATION_SERIAL, 2833 * These entries match devices with class COMMUNICATION_SERIAL,
2701 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL 2834 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
2702 */ 2835 */
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 1de098e75497..6f09cbd7fc48 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -414,8 +414,9 @@ static int __devinit check_resources(struct pnp_option *option)
414 */ 414 */
415static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags) 415static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
416{ 416{
417 if (!(check_name(pnp_dev_name(dev)) || (dev->card && check_name(dev->card->name)))) 417 if (!(check_name(pnp_dev_name(dev)) ||
418 return -ENODEV; 418 (dev->card && check_name(dev->card->name))))
419 return -ENODEV;
419 420
420 if (check_resources(dev->independent)) 421 if (check_resources(dev->independent))
421 return 0; 422 return 0;
@@ -452,8 +453,9 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
452 return -ENODEV; 453 return -ENODEV;
453 454
454#ifdef SERIAL_DEBUG_PNP 455#ifdef SERIAL_DEBUG_PNP
455 printk("Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n", 456 printk(KERN_DEBUG
456 port.iobase, port.mapbase, port.irq, port.iotype); 457 "Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n",
458 port.iobase, port.mapbase, port.irq, port.iotype);
457#endif 459#endif
458 460
459 port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; 461 port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c
index 051fcc2f5ba8..e76fc72c9b36 100644
--- a/drivers/serial/mcf.c
+++ b/drivers/serial/mcf.c
@@ -434,7 +434,7 @@ static struct uart_ops mcf_uart_ops = {
434 434
435static struct mcf_uart mcf_ports[3]; 435static struct mcf_uart mcf_ports[3];
436 436
437#define MCF_MAXPORTS (sizeof(mcf_ports) / sizeof(struct mcf_uart)) 437#define MCF_MAXPORTS ARRAY_SIZE(mcf_ports)
438 438
439/****************************************************************************/ 439/****************************************************************************/
440#if defined(CONFIG_SERIAL_MCF_CONSOLE) 440#if defined(CONFIG_SERIAL_MCF_CONSOLE)
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index 4d643c926657..cb3a91967742 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -612,6 +612,7 @@ static void mpsc_hw_init(struct mpsc_port_info *pi)
612 612
613 /* No preamble, 16x divider, low-latency, */ 613 /* No preamble, 16x divider, low-latency, */
614 writel(0x04400400, pi->mpsc_base + MPSC_MMCRH); 614 writel(0x04400400, pi->mpsc_base + MPSC_MMCRH);
615 mpsc_set_baudrate(pi, pi->default_baud);
615 616
616 if (pi->mirror_regs) { 617 if (pi->mirror_regs) {
617 pi->MPSC_CHR_1_m = 0; 618 pi->MPSC_CHR_1_m = 0;
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index e773c8e14962..45de19366030 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -1527,7 +1527,7 @@ static inline void s3c2440_serial_exit(void)
1527#define s3c2440_uart_inf_at NULL 1527#define s3c2440_uart_inf_at NULL
1528#endif /* CONFIG_CPU_S3C2440 */ 1528#endif /* CONFIG_CPU_S3C2440 */
1529 1529
1530#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413) 1530#if defined(CONFIG_CPU_S3C2412)
1531 1531
1532static int s3c2412_serial_setsource(struct uart_port *port, 1532static int s3c2412_serial_setsource(struct uart_port *port,
1533 struct s3c24xx_uart_clksrc *clk) 1533 struct s3c24xx_uart_clksrc *clk)
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 3bb5d241dd40..276da148c57e 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -371,7 +371,8 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
371 */ 371 */
372 termios->c_cflag &= ~CBAUD; 372 termios->c_cflag &= ~CBAUD;
373 if (old) { 373 if (old) {
374 termios->c_cflag |= old->c_cflag & CBAUD; 374 baud = tty_termios_baud_rate(old);
375 tty_termios_encode_baud_rate(termios, baud, baud);
375 old = NULL; 376 old = NULL;
376 continue; 377 continue;
377 } 378 }
@@ -380,7 +381,7 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
380 * As a last resort, if the quotient is zero, 381 * As a last resort, if the quotient is zero,
381 * default to 9600 bps 382 * default to 9600 bps
382 */ 383 */
383 termios->c_cflag |= B9600; 384 tty_termios_encode_baud_rate(termios, 9600, 9600);
384 } 385 }
385 386
386 return 0; 387 return 0;
@@ -1977,6 +1978,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
1977 1978
1978 if (state->info && state->info->flags & UIF_INITIALIZED) { 1979 if (state->info && state->info->flags & UIF_INITIALIZED) {
1979 const struct uart_ops *ops = port->ops; 1980 const struct uart_ops *ops = port->ops;
1981 int tries;
1980 1982
1981 state->info->flags = (state->info->flags & ~UIF_INITIALIZED) 1983 state->info->flags = (state->info->flags & ~UIF_INITIALIZED)
1982 | UIF_SUSPENDED; 1984 | UIF_SUSPENDED;
@@ -1990,9 +1992,14 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
1990 /* 1992 /*
1991 * Wait for the transmitter to empty. 1993 * Wait for the transmitter to empty.
1992 */ 1994 */
1993 while (!ops->tx_empty(port)) { 1995 for (tries = 3; !ops->tx_empty(port) && tries; tries--) {
1994 msleep(10); 1996 msleep(10);
1995 } 1997 }
1998 if (!tries)
1999 printk(KERN_ERR "%s%s%s%d: Unable to drain transmitter\n",
2000 port->dev ? port->dev->bus_id : "",
2001 port->dev ? ": " : "",
2002 drv->dev_name, port->line);
1996 2003
1997 ops->shutdown(port); 2004 ops->shutdown(port);
1998 } 2005 }
@@ -2029,8 +2036,6 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2029 } 2036 }
2030 port->suspended = 0; 2037 port->suspended = 0;
2031 2038
2032 uart_change_pm(state, 0);
2033
2034 /* 2039 /*
2035 * Re-enable the console device after suspending. 2040 * Re-enable the console device after suspending.
2036 */ 2041 */
@@ -2049,6 +2054,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2049 if (state->info && state->info->tty && termios.c_cflag == 0) 2054 if (state->info && state->info->tty && termios.c_cflag == 0)
2050 termios = *state->info->tty->termios; 2055 termios = *state->info->tty->termios;
2051 2056
2057 uart_change_pm(state, 0);
2052 port->ops->set_termios(port, &termios, NULL); 2058 port->ops->set_termios(port, &termios, NULL);
2053 console_start(port->cons); 2059 console_start(port->cons);
2054 } 2060 }
@@ -2057,6 +2063,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2057 const struct uart_ops *ops = port->ops; 2063 const struct uart_ops *ops = port->ops;
2058 int ret; 2064 int ret;
2059 2065
2066 uart_change_pm(state, 0);
2060 ops->set_mctrl(port, 0); 2067 ops->set_mctrl(port, 0);
2061 ret = ops->startup(port); 2068 ret = ops->startup(port);
2062 if (ret == 0) { 2069 if (ret == 0) {
@@ -2150,10 +2157,11 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
2150 2157
2151 /* 2158 /*
2152 * Ensure that the modem control lines are de-activated. 2159 * Ensure that the modem control lines are de-activated.
2160 * keep the DTR setting that is set in uart_set_options()
2153 * We probably don't need a spinlock around this, but 2161 * We probably don't need a spinlock around this, but
2154 */ 2162 */
2155 spin_lock_irqsave(&port->lock, flags); 2163 spin_lock_irqsave(&port->lock, flags);
2156 port->ops->set_mctrl(port, 0); 2164 port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR);
2157 spin_unlock_irqrestore(&port->lock, flags); 2165 spin_unlock_irqrestore(&port->lock, flags);
2158 2166
2159 /* 2167 /*
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index d8b660061c13..164d2a42eb59 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -389,7 +389,7 @@ static void serial_detach(struct pcmcia_device *link)
389/*====================================================================*/ 389/*====================================================================*/
390 390
391static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, 391static int setup_serial(struct pcmcia_device *handle, struct serial_info * info,
392 kio_addr_t iobase, int irq) 392 unsigned int iobase, int irq)
393{ 393{
394 struct uart_port port; 394 struct uart_port port;
395 int line; 395 int line;
@@ -456,7 +456,7 @@ next_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse)
456 456
457static int simple_config(struct pcmcia_device *link) 457static int simple_config(struct pcmcia_device *link)
458{ 458{
459 static const kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 459 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
460 static const int size_table[2] = { 8, 16 }; 460 static const int size_table[2] = { 8, 16 };
461 struct serial_info *info = link->priv; 461 struct serial_info *info = link->priv;
462 struct serial_cfg_mem *cfg_mem; 462 struct serial_cfg_mem *cfg_mem;
@@ -480,7 +480,7 @@ static int simple_config(struct pcmcia_device *link)
480 /* If the card is already configured, look up the port and irq */ 480 /* If the card is already configured, look up the port and irq */
481 i = pcmcia_get_configuration_info(link, &config); 481 i = pcmcia_get_configuration_info(link, &config);
482 if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) { 482 if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) {
483 kio_addr_t port = 0; 483 unsigned int port = 0;
484 if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) { 484 if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) {
485 port = config.BasePort2; 485 port = config.BasePort2;
486 info->slave = 1; 486 info->slave = 1;