From c9bd9d01db02319c33767da5ee310ea37afda059 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Tue, 26 Oct 2010 14:20:48 -0400 Subject: 8250: add support for Kouwell KW-L221N-2 Add support for Kouwell KW-L221N-2 card. Signed-off-by: Mikulas Patocka Signed-off-by: Greg Kroah-Hartman --- drivers/serial/8250_pci.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/serial') diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 53be4d35a0aa..2ada93e19cc3 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c @@ -2863,6 +2863,9 @@ static struct pci_device_id serial_pci_tbl[] = { PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL, 0, 0, pbn_b0_4_1152000 }, + { PCI_VENDOR_ID_OXSEMI, 0x9505, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, + pbn_b0_bt_2_921600 }, /* * The below card is a little controversial since it is the -- cgit v1.2.2 From a89f2466a9e5032514776b67926295b6296d702e Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 7 Nov 2010 13:10:23 -0800 Subject: drivers/serial/bfin_5xx.c: Fix line continuation defects Signed-off-by: Joe Perches Acked-by: Sonic Zhang Signed-off-by: Greg Kroah-Hartman --- drivers/serial/bfin_5xx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index a9eff2b18eab..351cc03578eb 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -734,8 +734,7 @@ static int bfin_serial_startup(struct uart_port *port) IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_DISABLED, "BFIN_UART_CTS", uart)) { uart->cts_pin = -1; - pr_info("Unable to attach BlackFin UART CTS interrupt.\ - So, disable it.\n"); + pr_info("Unable to attach BlackFin UART CTS interrupt. So, disable it.\n"); } } if (uart->rts_pin >= 0) { @@ -747,8 +746,7 @@ static int bfin_serial_startup(struct uart_port *port) if (request_irq(uart->status_irq, bfin_serial_mctrl_cts_int, IRQF_DISABLED, "BFIN_UART_MODEM_STATUS", uart)) { - pr_info("Unable to attach BlackFin UART Modem \ - Status interrupt.\n"); + pr_info("Unable to attach BlackFin UART Modem Status interrupt.\n"); } /* CTS RTS PINs are negative assertive. */ -- cgit v1.2.2 From ebf7c06635fbcf21a59e60187e166c5c23c57b06 Mon Sep 17 00:00:00 2001 From: Maciej Szmigiero Date: Tue, 26 Oct 2010 21:48:21 +0200 Subject: SERIAL: blacklist si3052 chip [SERIAL]blacklist si3052 chip Si3052-based softmodems aren't serial ports so don't bind serial driver to them. Allows proper driver to bind to them. Signed-off-by: Maciej Szmigiero Signed-off-by: Greg Kroah-Hartman --- drivers/serial/8250_pci.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/serial') diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 2ada93e19cc3..842e3b2a02b1 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c @@ -2285,6 +2285,8 @@ static struct pciserial_board pci_boards[] __devinitdata = { static const struct pci_device_id softmodem_blacklist[] = { { PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */ + { PCI_VDEVICE(MOTOROLA, 0x3052), }, /* Motorola Si3052-based modem */ + { PCI_DEVICE(0x1543, 0x3052), }, /* Si3052-based modem, default IDs */ }; /* -- cgit v1.2.2 From 47d3904fe40d62deee8cd46e79ca784e7a548acd Mon Sep 17 00:00:00 2001 From: Lawrence Rust Date: Wed, 27 Oct 2010 14:41:02 +0200 Subject: 8250: Fix tcsetattr to avoid ioctl(TIOCMIWAIT) hang Calling tcsetattr prevents any thread(s) currently suspended in ioctl TIOCMIWAIT for the same device from ever resuming. If a thread is suspended inside a call to ioctl TIOCMIWAIT, waiting for a modem status change, then the 8250 driver enables modem status interrupts (MSI). The device interrupt service routine resumes the suspended thread(s) on the next MSI. If while the thread(s) are suspended, another thread calls tcsetattr then the 8250 driver disables MSI (unless CTS/RTS handshaking is enabled) thus preventing the suspended thread(s) from ever being resumed. This patch only disables MSI in tcsetattr handling if there are no suspended threads. Program to demonstrate bug & fix: /* gcc miwait.c -o miwait -l pthread */ #include #include #include #include #include #include #include #include static void* monitor( void* pv); static int s_fd; int main( void) { const char kszDev[] = "/dev/ttyS0"; pthread_t t; struct termios tio; s_fd = open( kszDev, O_RDWR | O_NONBLOCK); if ( s_fd < 0) return fprintf( stderr, "Error(%d) opening %s: %s\n", errno, kszDev, strerror( errno)), 1; pthread_create( &t, NULL, &monitor, NULL); /* Modem status changes seen here */ puts( "Main: awaiting status changes"); sleep( 5); tcgetattr( s_fd, &tio); tio.c_cflag ^= CSTOPB; /* But not after here */ puts( "Main: tcsetattr called"); tcsetattr( s_fd, TCSANOW, &tio); for (;;) sleep( 1); } static void* monitor( void* pv) { (void)pv; for(;;) { unsigned uModem; struct serial_icounter_struct cnt; if ( ioctl( s_fd, TIOCMGET, &uModem) < 0) fprintf( stderr, "Error(%d) in TIOCMGET: %s\n", errno, strerror( errno)); printf( "Modem status:%s%s%s%s%s%s\n", (uModem & TIOCM_RTS) ? " RTS" : "", (uModem & TIOCM_DTR) ? " DTR" : "", (uModem & TIOCM_CTS) ? " CTS" : "", (uModem & TIOCM_DSR) ? " DSR" : "", (uModem & TIOCM_CD) ? " CD" : "", (uModem & TIOCM_RI) ? " RI" : "" ); if ( ioctl( s_fd, TIOCGICOUNT, &cnt) < 0) fprintf( stderr, "Error(%d) in TIOCGICOUNT: %s\n", errno, strerror( errno)); printf( "Irqs: CTS:%d DSR:%d RNG:%d DCD:%d Rx:%d Tx:%d Frame:%d Orun:%d Par:%d Brk:%d Oflow:%d\n", cnt.cts, cnt.dsr, cnt.rng, cnt.dcd, cnt.rx, cnt.tx, cnt.frame, cnt.overrun, cnt.parity, cnt.brk, cnt.buf_overrun ); fputs( "Waiting...", stdout), fflush( stdout); if ( 0 > ioctl( s_fd, TIOCMIWAIT, (unsigned long)(TIOCM_CAR | TIOCM_RNG | TIOCM_DSR | TIOCM_CTS))) fprintf( stderr, "\nError(%d) in TIOCMIWAIT: %s\n", errno, strerror( errno)); fputs( "\n", stdout); } return NULL; } Signed-off by Lawrence Rust Signed-off-by: Greg Kroah-Hartman --- drivers/serial/8250.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/serial') diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 4d8e14b7aa93..dd5e1ac22251 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -2343,8 +2343,11 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, /* * CTS flow control flag and modem status interrupts + * Only disable MSI if no threads are waiting in + * serial_core::uart_wait_modem_status */ - up->ier &= ~UART_IER_MSI; + if (!waitqueue_active(&up->port.state->port.delta_msr_wait)) + up->ier &= ~UART_IER_MSI; if (!(up->bugs & UART_BUG_NOMSR) && UART_ENABLE_MS(&up->port, termios->c_cflag)) up->ier |= UART_IER_MSI; -- cgit v1.2.2 From b6100992e31e61a2f252acb8df1f65c01f0b626d Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Wed, 27 Oct 2010 04:16:47 -0400 Subject: serial: bfin_5xx: always include DMA headers On Blackfin systems, peripherals that have optional DMA support always route their interrupts through the corresponding DMA channel -- even when DMA is not being used. So in PIO mode, we still need to request the DMA channel (so interrupts are delivered) which means we need to always include the DMA header for the DMA defines/functions. Signed-off-by: Sonic Zhang Signed-off-by: Mike Frysinger Signed-off-by: Greg Kroah-Hartman --- drivers/serial/bfin_5xx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 351cc03578eb..c8ca3b43487d 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -23,6 +23,7 @@ #include #include #include +#include #if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \ defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE) @@ -33,12 +34,10 @@ #include #include -#ifdef CONFIG_SERIAL_BFIN_DMA -#include +#include #include #include #include -#endif #ifdef CONFIG_SERIAL_BFIN_MODULE # undef CONFIG_EARLY_PRINTK @@ -688,6 +687,13 @@ static int bfin_serial_startup(struct uart_port *port) # ifdef CONFIG_BF54x { + /* + * UART2 and UART3 on BF548 share interrupt PINs and DMA + * controllers with SPORT2 and SPORT3. UART rx and tx + * interrupts are generated in PIO mode only when configure + * their peripheral mapping registers properly, which means + * request corresponding DMA channels in PIO mode as well. + */ unsigned uart_dma_ch_rx, uart_dma_ch_tx; switch (uart->port.irq) { -- cgit v1.2.2 From 001a05d56edd9d82b27e69951fb9520f9ce6ed72 Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Wed, 27 Oct 2010 04:16:48 -0400 Subject: serial: bfin_5xx: remove redundant SSYNC to improve TX speed We don't need to force a SSYNC here as the LSR register will already be updated by the time we get back to reading it. This speeds up TX throughput and lowers general system overhead (since SSYNC is system wide, not peripheral-specific). Signed-off-by: Sonic Zhang Signed-off-by: Mike Frysinger Signed-off-by: Greg Kroah-Hartman --- drivers/serial/bfin_5xx.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index c8ca3b43487d..a454e427c949 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -359,7 +359,6 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart) UART_PUT_CHAR(uart, xmit->buf[xmit->tail]); xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); uart->port.icount.tx++; - SSYNC(); } if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) -- cgit v1.2.2 From 6d9e44986891345636e2d6069c4ae1612b2337d4 Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Wed, 27 Oct 2010 04:16:49 -0400 Subject: serial: bfin_5xx: disable CON_PRINTBUFFER for consoles If we are using early serial, don't let the normal console rewind the log buffer, since that causes things to be printed multiple times. Signed-off-by: Sonic Zhang Signed-off-by: Mike Frysinger Signed-off-by: Greg Kroah-Hartman --- drivers/serial/bfin_5xx.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index a454e427c949..965532157c65 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -1324,6 +1324,14 @@ struct console __init *bfin_earlyserial_init(unsigned int port, struct bfin_serial_port *uart; struct ktermios t; +#ifdef CONFIG_SERIAL_BFIN_CONSOLE + /* + * If we are using early serial, don't let the normal console rewind + * log buffer, since that causes things to be printed multiple times + */ + bfin_serial_console.flags &= ~CON_PRINTBUFFER; +#endif + if (port == -1 || port >= nr_active_ports) port = 0; bfin_serial_init_ports(); -- cgit v1.2.2 From 5bb06b62bc445eed66fb256c3b5f86e5911797e4 Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Wed, 27 Oct 2010 04:16:50 -0400 Subject: serial: bfin_5xx: grab port lock before making port termios changes The port lock exists to protect these resources, so we need to grab it before making changes. Signed-off-by: Sonic Zhang Signed-off-by: Mike Frysinger Signed-off-by: Greg Kroah-Hartman --- drivers/serial/bfin_5xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/serial') diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 965532157c65..19cac9f610fd 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c @@ -849,6 +849,8 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, if (termios->c_cflag & CMSPAR) lcr |= STP; + spin_lock_irqsave(&uart->port.lock, flags); + port->read_status_mask = OE; if (termios->c_iflag & INPCK) port->read_status_mask |= (FE | PE); @@ -878,8 +880,6 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, if (termios->c_line != N_IRDA) quot -= ANOMALY_05000230; - spin_lock_irqsave(&uart->port.lock, flags); - UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15); /* Disable UART */ -- cgit v1.2.2