aboutsummaryrefslogtreecommitdiffstats
path: root/tty
diff options
Diffstat (limited to 'tty')
-rw-r--r--tty/8250-allow-platforms-to-override-pm-hook.patch115
-rw-r--r--tty/alchemy-add-uart-pm-methods.patch128
-rw-r--r--tty/altera_uart-add-support-for-different-address-strides.patch223
-rw-r--r--tty/altera_uart-add-support-for-getting-mapbase-and-irq-from-resources.patch111
-rw-r--r--tty/altera_uart-add-support-for-polling-mode-irq-less.patch92
-rw-r--r--tty/altera_uart-don-t-use-plain-integer-as-null-pointer.patch33
-rw-r--r--tty/altera_uart-fix-missing-prototype-for-registering-an-early-console.patch42
-rw-r--r--tty/altera_uart-fixup-type-usage-of-port-flags.patch46
-rw-r--r--tty/altera_uart-make-it-possible-to-use-altera-uart-and-8250-ports-together.patch63
-rw-r--r--tty/serial-8250-don-t-delay-after-transmitter-is-ready.patch42
-rw-r--r--tty/serial-factor-out-uart_poll_timeout-from-8250-driver.patch91
-rw-r--r--tty/serial-mark-the-8250-driver-as-maintained.patch29
-rw-r--r--tty/tty-maintainers-add-drivers-serial-jsm-as-maintained-driver.patch35
13 files changed, 1050 insertions, 0 deletions
diff --git a/tty/8250-allow-platforms-to-override-pm-hook.patch b/tty/8250-allow-platforms-to-override-pm-hook.patch
new file mode 100644
index 00000000000000..88cdd897a75fdd
--- /dev/null
+++ b/tty/8250-allow-platforms-to-override-pm-hook.patch
@@ -0,0 +1,115 @@
+From manuel.lauss@googlemail.com Wed Oct 6 13:38:26 2010
+From: Manuel Lauss <manuel.lauss@googlemail.com>
+To: linux-serial@vger.kernel.org
+Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Greg KH <greg@kroah.com>,
+ Manuel Lauss <manuel.lauss@googlemail.com>
+Subject: 8250: allow platforms to override PM hook.
+Date: Sat, 25 Sep 2010 15:13:45 +0200
+Message-Id: <1285420426-8510-1-git-send-email-manuel.lauss@googlemail.com>
+
+Add a hook for platforms to specify custom pm methods.
+
+Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
+Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/8250.c | 27 ++++++++++++++++-----------
+ include/linux/serial_8250.h | 4 ++++
+ include/linux/serial_core.h | 2 ++
+ 3 files changed, 22 insertions(+), 11 deletions(-)
+
+--- a/drivers/serial/8250.c
++++ b/drivers/serial/8250.c
+@@ -154,12 +154,6 @@ struct uart_8250_port {
+ unsigned char lsr_saved_flags;
+ #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
+ unsigned char msr_saved_flags;
+-
+- /*
+- * We provide a per-port pm hook.
+- */
+- void (*pm)(struct uart_port *port,
+- unsigned int state, unsigned int old);
+ };
+
+ struct irq_info {
+@@ -2436,16 +2430,24 @@ serial8250_set_ldisc(struct uart_port *p
+ port->flags &= ~UPF_HARDPPS_CD;
+ }
+
+-static void
+-serial8250_pm(struct uart_port *port, unsigned int state,
+- unsigned int oldstate)
++
++void serial8250_do_pm(struct uart_port *port, unsigned int state,
++ unsigned int oldstate)
+ {
+ struct uart_8250_port *p = (struct uart_8250_port *)port;
+
+ serial8250_set_sleep(p, state != 0);
++}
++EXPORT_SYMBOL(serial8250_do_pm);
+
+- if (p->pm)
+- p->pm(port, state, oldstate);
++static void
++serial8250_pm(struct uart_port *port, unsigned int state,
++ unsigned int oldstate)
++{
++ if (port->pm)
++ port->pm(port, state, oldstate);
++ else
++ serial8250_do_pm(port, state, oldstate);
+ }
+
+ static unsigned int serial8250_port_size(struct uart_8250_port *pt)
+@@ -3006,6 +3008,7 @@ static int __devinit serial8250_probe(st
+ port.serial_in = p->serial_in;
+ port.serial_out = p->serial_out;
+ port.set_termios = p->set_termios;
++ port.pm = p->pm;
+ port.dev = &dev->dev;
+ port.irqflags |= irqflag;
+ ret = serial8250_register_port(&port);
+@@ -3172,6 +3175,8 @@ int serial8250_register_port(struct uart
+ /* Possibly override set_termios call */
+ if (port->set_termios)
+ uart->port.set_termios = port->set_termios;
++ if (port->pm)
++ uart->port.pm = port->pm;
+
+ ret = uart_add_one_port(&serial8250_reg, &uart->port);
+ if (ret == 0)
+--- a/include/linux/serial_8250.h
++++ b/include/linux/serial_8250.h
+@@ -35,6 +35,8 @@ struct plat_serial8250_port {
+ void (*set_termios)(struct uart_port *,
+ struct ktermios *new,
+ struct ktermios *old);
++ void (*pm)(struct uart_port *, unsigned int state,
++ unsigned old);
+ };
+
+ /*
+@@ -76,5 +78,7 @@ extern int serial8250_find_port_for_earl
+ extern int setup_early_serial8250_console(char *cmdline);
+ extern void serial8250_do_set_termios(struct uart_port *port,
+ struct ktermios *termios, struct ktermios *old);
++extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
++ unsigned int oldstate);
+
+ #endif
+--- a/include/linux/serial_core.h
++++ b/include/linux/serial_core.h
+@@ -289,6 +289,8 @@ struct uart_port {
+ void (*set_termios)(struct uart_port *,
+ struct ktermios *new,
+ struct ktermios *old);
++ void (*pm)(struct uart_port *, unsigned int state,
++ unsigned int old);
+ unsigned int irq; /* irq number */
+ unsigned long irqflags; /* irq flags */
+ unsigned int uartclk; /* base uart clock */
diff --git a/tty/alchemy-add-uart-pm-methods.patch b/tty/alchemy-add-uart-pm-methods.patch
new file mode 100644
index 00000000000000..8a46a9c1670331
--- /dev/null
+++ b/tty/alchemy-add-uart-pm-methods.patch
@@ -0,0 +1,128 @@
+From manuel.lauss@googlemail.com Wed Oct 6 13:38:47 2010
+From: Manuel Lauss <manuel.lauss@googlemail.com>
+To: linux-serial@vger.kernel.org
+Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Greg KH <greg@kroah.com>,
+ Manuel Lauss <manuel.lauss@googlemail.com>
+Subject: Alchemy: Add UART PM methods.
+Date: Sat, 25 Sep 2010 15:13:46 +0200
+Message-Id: <1285420426-8510-2-git-send-email-manuel.lauss@googlemail.com>
+
+Custom UART PM hook for Alchemy chips: do standard UART pm and
+additionally en/disable uart block clocks as needed.
+This allows to get rid of a debug port PM hack in the Alchemy pm code.
+
+Tested on Db1200.
+
+Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
+Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/mips/alchemy/common/platform.c | 28 ++++++++++++++++++++++++++++
+ arch/mips/alchemy/common/power.c | 35 -----------------------------------
+ 2 files changed, 28 insertions(+), 35 deletions(-)
+
+--- a/arch/mips/alchemy/common/platform.c
++++ b/arch/mips/alchemy/common/platform.c
+@@ -24,6 +24,33 @@
+
+ #include <prom.h>
+
++static void alchemy_8250_pm(struct uart_port *port, unsigned int state,
++ unsigned int old_state)
++{
++ switch (state) {
++ case 0:
++ if ((__raw_readl(port->membase + UART_MOD_CNTRL) & 3) != 3) {
++ /* power-on sequence as suggested in the databooks */
++ __raw_writel(0, port->membase + UART_MOD_CNTRL);
++ wmb();
++ __raw_writel(1, port->membase + UART_MOD_CNTRL);
++ wmb();
++ }
++ __raw_writel(3, port->membase + UART_MOD_CNTRL); /* full on */
++ wmb();
++ serial8250_do_pm(port, state, old_state);
++ break;
++ case 3: /* power off */
++ serial8250_do_pm(port, state, old_state);
++ __raw_writel(0, port->membase + UART_MOD_CNTRL);
++ wmb();
++ break;
++ default:
++ serial8250_do_pm(port, state, old_state);
++ break;
++ }
++}
++
+ #define PORT(_base, _irq) \
+ { \
+ .mapbase = _base, \
+@@ -33,6 +60,7 @@
+ .flags = UPF_SKIP_TEST | UPF_IOREMAP | \
+ UPF_FIXED_TYPE, \
+ .type = PORT_16550A, \
++ .pm = alchemy_8250_pm, \
+ }
+
+ static struct plat_serial8250_port au1x00_uart_data[] = {
+--- a/arch/mips/alchemy/common/power.c
++++ b/arch/mips/alchemy/common/power.c
+@@ -49,11 +49,6 @@
+ * We only have to save/restore registers that aren't otherwise
+ * done as part of a driver pm_* function.
+ */
+-static unsigned int sleep_uart0_inten;
+-static unsigned int sleep_uart0_fifoctl;
+-static unsigned int sleep_uart0_linectl;
+-static unsigned int sleep_uart0_clkdiv;
+-static unsigned int sleep_uart0_enable;
+ static unsigned int sleep_usb[2];
+ static unsigned int sleep_sys_clocks[5];
+ static unsigned int sleep_sys_pinfunc;
+@@ -62,22 +57,6 @@ static unsigned int sleep_static_memctlr
+
+ static void save_core_regs(void)
+ {
+- extern void save_au1xxx_intctl(void);
+- extern void pm_eth0_shutdown(void);
+-
+- /*
+- * Do the serial ports.....these really should be a pm_*
+- * registered function by the driver......but of course the
+- * standard serial driver doesn't understand our Au1xxx
+- * unique registers.
+- */
+- sleep_uart0_inten = au_readl(UART0_ADDR + UART_IER);
+- sleep_uart0_fifoctl = au_readl(UART0_ADDR + UART_FCR);
+- sleep_uart0_linectl = au_readl(UART0_ADDR + UART_LCR);
+- sleep_uart0_clkdiv = au_readl(UART0_ADDR + UART_CLK);
+- sleep_uart0_enable = au_readl(UART0_ADDR + UART_MOD_CNTRL);
+- au_sync();
+-
+ #ifndef CONFIG_SOC_AU1200
+ /* Shutdown USB host/device. */
+ sleep_usb[0] = au_readl(USB_HOST_CONFIG);
+@@ -175,20 +154,6 @@ static void restore_core_regs(void)
+ au_writel(sleep_static_memctlr[3][0], MEM_STCFG3);
+ au_writel(sleep_static_memctlr[3][1], MEM_STTIME3);
+ au_writel(sleep_static_memctlr[3][2], MEM_STADDR3);
+-
+- /*
+- * Enable the UART if it was enabled before sleep.
+- * I guess I should define module control bits........
+- */
+- if (sleep_uart0_enable & 0x02) {
+- au_writel(0, UART0_ADDR + UART_MOD_CNTRL); au_sync();
+- au_writel(1, UART0_ADDR + UART_MOD_CNTRL); au_sync();
+- au_writel(3, UART0_ADDR + UART_MOD_CNTRL); au_sync();
+- au_writel(sleep_uart0_inten, UART0_ADDR + UART_IER); au_sync();
+- au_writel(sleep_uart0_fifoctl, UART0_ADDR + UART_FCR); au_sync();
+- au_writel(sleep_uart0_linectl, UART0_ADDR + UART_LCR); au_sync();
+- au_writel(sleep_uart0_clkdiv, UART0_ADDR + UART_CLK); au_sync();
+- }
+ }
+
+ void au_sleep(void)
diff --git a/tty/altera_uart-add-support-for-different-address-strides.patch b/tty/altera_uart-add-support-for-different-address-strides.patch
new file mode 100644
index 00000000000000..938c4da17ebd9e
--- /dev/null
+++ b/tty/altera_uart-add-support-for-different-address-strides.patch
@@ -0,0 +1,223 @@
+From cbouatmailru@gmail.com Wed Oct 6 13:32:58 2010
+Date: Fri, 1 Oct 2010 17:21:54 +0400
+From: Anton Vorontsov <cbouatmailru@gmail.com>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Tobias Klauser <tklauser@distanz.ch>, linux-serial@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: altera_uart: Add support for different address strides
+Message-ID: <20101001132154.GD25897@oksana.dev.rtsoft.ru>
+Content-Disposition: inline
+
+Some controllers implement registers with a stride, to support
+those we must implement the proper IO accessors.
+
+Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
+Acked-by: Tobias Klauser <tklauser@distanz.ch>
+Cc: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/altera_uart.c | 58 +++++++++++++++++++++++++++----------------
+ include/linux/altera_uart.h | 1
+ 2 files changed, 38 insertions(+), 21 deletions(-)
+
+--- a/drivers/serial/altera_uart.c
++++ b/drivers/serial/altera_uart.c
+@@ -82,9 +82,23 @@ struct altera_uart {
+ unsigned short imr; /* Local IMR mirror */
+ };
+
++static u32 altera_uart_readl(struct uart_port *port, int reg)
++{
++ struct altera_uart_platform_uart *platp = port->private_data;
++
++ return readl(port->membase + (reg << platp->bus_shift));
++}
++
++static void altera_uart_writel(struct uart_port *port, u32 dat, int reg)
++{
++ struct altera_uart_platform_uart *platp = port->private_data;
++
++ writel(dat, port->membase + (reg << platp->bus_shift));
++}
++
+ static unsigned int altera_uart_tx_empty(struct uart_port *port)
+ {
+- return (readl(port->membase + ALTERA_UART_STATUS_REG) &
++ return (altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
+ ALTERA_UART_STATUS_TMT_MSK) ? TIOCSER_TEMT : 0;
+ }
+
+@@ -93,8 +107,7 @@ static unsigned int altera_uart_get_mctr
+ struct altera_uart *pp = container_of(port, struct altera_uart, port);
+ unsigned int sigs;
+
+- sigs =
+- (readl(port->membase + ALTERA_UART_STATUS_REG) &
++ sigs = (altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
+ ALTERA_UART_STATUS_CTS_MSK) ? TIOCM_CTS : 0;
+ sigs |= (pp->sigs & TIOCM_RTS);
+
+@@ -110,7 +123,7 @@ static void altera_uart_set_mctrl(struct
+ pp->imr |= ALTERA_UART_CONTROL_RTS_MSK;
+ else
+ pp->imr &= ~ALTERA_UART_CONTROL_RTS_MSK;
+- writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
++ altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
+ }
+
+ static void altera_uart_start_tx(struct uart_port *port)
+@@ -118,7 +131,7 @@ static void altera_uart_start_tx(struct
+ struct altera_uart *pp = container_of(port, struct altera_uart, port);
+
+ pp->imr |= ALTERA_UART_CONTROL_TRDY_MSK;
+- writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
++ altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
+ }
+
+ static void altera_uart_stop_tx(struct uart_port *port)
+@@ -126,7 +139,7 @@ static void altera_uart_stop_tx(struct u
+ struct altera_uart *pp = container_of(port, struct altera_uart, port);
+
+ pp->imr &= ~ALTERA_UART_CONTROL_TRDY_MSK;
+- writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
++ altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
+ }
+
+ static void altera_uart_stop_rx(struct uart_port *port)
+@@ -134,7 +147,7 @@ static void altera_uart_stop_rx(struct u
+ struct altera_uart *pp = container_of(port, struct altera_uart, port);
+
+ pp->imr &= ~ALTERA_UART_CONTROL_RRDY_MSK;
+- writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
++ altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
+ }
+
+ static void altera_uart_break_ctl(struct uart_port *port, int break_state)
+@@ -147,7 +160,7 @@ static void altera_uart_break_ctl(struct
+ pp->imr |= ALTERA_UART_CONTROL_TRBK_MSK;
+ else
+ pp->imr &= ~ALTERA_UART_CONTROL_TRBK_MSK;
+- writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
++ altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
+ spin_unlock_irqrestore(&port->lock, flags);
+ }
+
+@@ -171,7 +184,7 @@ static void altera_uart_set_termios(stru
+
+ spin_lock_irqsave(&port->lock, flags);
+ uart_update_timeout(port, termios->c_cflag, baud);
+- writel(baudclk, port->membase + ALTERA_UART_DIVISOR_REG);
++ altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG);
+ spin_unlock_irqrestore(&port->lock, flags);
+ }
+
+@@ -181,14 +194,15 @@ static void altera_uart_rx_chars(struct
+ unsigned char ch, flag;
+ unsigned short status;
+
+- while ((status = readl(port->membase + ALTERA_UART_STATUS_REG)) &
++ while ((status = altera_uart_readl(port, ALTERA_UART_STATUS_REG)) &
+ ALTERA_UART_STATUS_RRDY_MSK) {
+- ch = readl(port->membase + ALTERA_UART_RXDATA_REG);
++ ch = altera_uart_readl(port, ALTERA_UART_RXDATA_REG);
+ flag = TTY_NORMAL;
+ port->icount.rx++;
+
+ if (status & ALTERA_UART_STATUS_E_MSK) {
+- writel(status, port->membase + ALTERA_UART_STATUS_REG);
++ altera_uart_writel(port, status,
++ ALTERA_UART_STATUS_REG);
+
+ if (status & ALTERA_UART_STATUS_BRK_MSK) {
+ port->icount.brk++;
+@@ -228,18 +242,18 @@ static void altera_uart_tx_chars(struct
+
+ if (port->x_char) {
+ /* Send special char - probably flow control */
+- writel(port->x_char, port->membase + ALTERA_UART_TXDATA_REG);
++ altera_uart_writel(port, port->x_char, ALTERA_UART_TXDATA_REG);
+ port->x_char = 0;
+ port->icount.tx++;
+ return;
+ }
+
+- while (readl(port->membase + ALTERA_UART_STATUS_REG) &
++ while (altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
+ ALTERA_UART_STATUS_TRDY_MSK) {
+ if (xmit->head == xmit->tail)
+ break;
+- writel(xmit->buf[xmit->tail],
+- port->membase + ALTERA_UART_TXDATA_REG);
++ altera_uart_writel(port, xmit->buf[xmit->tail],
++ ALTERA_UART_TXDATA_REG);
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+ port->icount.tx++;
+ }
+@@ -249,7 +263,7 @@ static void altera_uart_tx_chars(struct
+
+ if (xmit->head == xmit->tail) {
+ pp->imr &= ~ALTERA_UART_CONTROL_TRDY_MSK;
+- writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
++ altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
+ }
+ }
+
+@@ -259,7 +273,7 @@ static irqreturn_t altera_uart_interrupt
+ struct altera_uart *pp = container_of(port, struct altera_uart, port);
+ unsigned int isr;
+
+- isr = readl(port->membase + ALTERA_UART_STATUS_REG) & pp->imr;
++ isr = altera_uart_readl(port, ALTERA_UART_STATUS_REG) & pp->imr;
+
+ spin_lock(&port->lock);
+ if (isr & ALTERA_UART_STATUS_RRDY_MSK)
+@@ -285,9 +299,9 @@ static void altera_uart_config_port(stru
+ port->type = PORT_ALTERA_UART;
+
+ /* Clear mask, so no surprise interrupts. */
+- writel(0, port->membase + ALTERA_UART_CONTROL_REG);
++ altera_uart_writel(port, 0, ALTERA_UART_CONTROL_REG);
+ /* Clear status register */
+- writel(0, port->membase + ALTERA_UART_STATUS_REG);
++ altera_uart_writel(port, 0, ALTERA_UART_STATUS_REG);
+ }
+
+ static int altera_uart_startup(struct uart_port *port)
+@@ -407,6 +421,7 @@ int __init early_altera_uart_setup(struc
+ port->uartclk = platp[i].uartclk;
+ port->flags = ASYNC_BOOT_AUTOCONF;
+ port->ops = &altera_uart_ops;
++ port->private_data = platp;
+ }
+
+ return 0;
+@@ -414,7 +429,7 @@ int __init early_altera_uart_setup(struc
+
+ static void altera_uart_console_putc(struct uart_port *port, const char c)
+ {
+- while (!(readl(port->membase + ALTERA_UART_STATUS_REG) &
++ while (!(altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
+ ALTERA_UART_STATUS_TRDY_MSK))
+ cpu_relax();
+
+@@ -535,6 +550,7 @@ static int __devinit altera_uart_probe(s
+ port->uartclk = platp->uartclk;
+ port->ops = &altera_uart_ops;
+ port->flags = ASYNC_BOOT_AUTOCONF;
++ port->private_data = platp;
+
+ uart_add_one_port(&altera_uart_driver, port);
+
+--- a/include/linux/altera_uart.h
++++ b/include/linux/altera_uart.h
+@@ -9,6 +9,7 @@ struct altera_uart_platform_uart {
+ unsigned long mapbase; /* Physical address base */
+ unsigned int irq; /* Interrupt vector */
+ unsigned int uartclk; /* UART clock rate */
++ unsigned int bus_shift; /* Bus shift (address stride) */
+ };
+
+ #endif /* __ALTUART_H */
diff --git a/tty/altera_uart-add-support-for-getting-mapbase-and-irq-from-resources.patch b/tty/altera_uart-add-support-for-getting-mapbase-and-irq-from-resources.patch
new file mode 100644
index 00000000000000..ca6035a8eef3fe
--- /dev/null
+++ b/tty/altera_uart-add-support-for-getting-mapbase-and-irq-from-resources.patch
@@ -0,0 +1,111 @@
+From cbouatmailru@gmail.com Wed Oct 6 13:32:37 2010
+Date: Fri, 1 Oct 2010 17:21:42 +0400
+From: Anton Vorontsov <cbouatmailru@gmail.com>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Tobias Klauser <tklauser@distanz.ch>, linux-serial@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: altera_uart: Add support for getting mapbase and IRQ from resources
+Message-ID: <20101001132142.GC25897@oksana.dev.rtsoft.ru>
+Content-Disposition: inline
+
+This makes it much easier to integrate the driver with the rest of
+the Linux (e.g. MFD subsystem).
+
+The old method is still supported though.
+
+Also, from now on, there is one platform device per port (no
+changes are needed for the platform code, as no one registers
+the devices anywhere in-tree yet).
+
+Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
+Acked-by: Tobias Klauser <tklauser@distanz.ch>
+Cc: Alan Cox <alan@linux.intel.com>,
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/altera_uart.c | 64 ++++++++++++++++++++++++++-----------------
+ 1 file changed, 40 insertions(+), 24 deletions(-)
+
+--- a/drivers/serial/altera_uart.c
++++ b/drivers/serial/altera_uart.c
+@@ -498,38 +498,54 @@ static int __devinit altera_uart_probe(s
+ {
+ struct altera_uart_platform_uart *platp = pdev->dev.platform_data;
+ struct uart_port *port;
+- int i;
++ struct resource *res_mem;
++ struct resource *res_irq;
++ int i = pdev->id;
++
++ /* -1 emphasizes that the platform must have one port, no .N suffix */
++ if (i == -1)
++ i = 0;
++
++ if (i >= CONFIG_SERIAL_ALTERA_UART_MAXPORTS)
++ return -EINVAL;
++
++ port = &altera_uart_ports[i].port;
++
++ res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ if (res_mem)
++ port->mapbase = res_mem->start;
++ else if (platp->mapbase)
++ port->mapbase = platp->mapbase;
++ else
++ return -EINVAL;
++
++ res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
++ if (res_irq)
++ port->irq = res_irq->start;
++ else if (platp->irq)
++ port->irq = platp->irq;
++
++ port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE);
++ if (!port->membase)
++ return -ENOMEM;
++
++ port->line = i;
++ port->type = PORT_ALTERA_UART;
++ port->iotype = SERIAL_IO_MEM;
++ port->uartclk = platp->uartclk;
++ port->ops = &altera_uart_ops;
++ port->flags = ASYNC_BOOT_AUTOCONF;
+
+- for (i = 0; i < CONFIG_SERIAL_ALTERA_UART_MAXPORTS && platp[i].mapbase; i++) {
+- port = &altera_uart_ports[i].port;
+-
+- port->line = i;
+- port->type = PORT_ALTERA_UART;
+- port->mapbase = platp[i].mapbase;
+- port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE);
+- port->iotype = SERIAL_IO_MEM;
+- port->irq = platp[i].irq;
+- port->uartclk = platp[i].uartclk;
+- port->ops = &altera_uart_ops;
+- port->flags = ASYNC_BOOT_AUTOCONF;
+-
+- uart_add_one_port(&altera_uart_driver, port);
+- }
++ uart_add_one_port(&altera_uart_driver, port);
+
+ return 0;
+ }
+
+ static int __devexit altera_uart_remove(struct platform_device *pdev)
+ {
+- struct uart_port *port;
+- int i;
+-
+- for (i = 0; i < CONFIG_SERIAL_ALTERA_UART_MAXPORTS; i++) {
+- port = &altera_uart_ports[i].port;
+- if (port)
+- uart_remove_one_port(&altera_uart_driver, port);
+- }
++ struct uart_port *port = &altera_uart_ports[pdev->id].port;
+
++ uart_remove_one_port(&altera_uart_driver, port);
+ return 0;
+ }
+
diff --git a/tty/altera_uart-add-support-for-polling-mode-irq-less.patch b/tty/altera_uart-add-support-for-polling-mode-irq-less.patch
new file mode 100644
index 00000000000000..54cda053ba5f1e
--- /dev/null
+++ b/tty/altera_uart-add-support-for-polling-mode-irq-less.patch
@@ -0,0 +1,92 @@
+From cbouatmailru@gmail.com Wed Oct 6 13:32:20 2010
+Date: Fri, 1 Oct 2010 17:21:33 +0400
+From: Anton Vorontsov <cbouatmailru@gmail.com>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Tobias Klauser <tklauser@distanz.ch>, linux-serial@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: altera_uart: Add support for polling mode (IRQ-less)
+Message-ID: <20101001132133.GB25897@oksana.dev.rtsoft.ru>
+Content-Disposition: inline
+
+Some Altera UART implementations doesn't route the IRQ line, so we have
+to work in polling mode.
+
+Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
+Acked-by: Tobias Klauser <tklauser@distanz.ch>
+Cc: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/serial/altera_uart.c | 23 ++++++++++++++++++++++-
+ 1 file changed, 22 insertions(+), 1 deletion(-)
+
+--- a/drivers/serial/altera_uart.c
++++ b/drivers/serial/altera_uart.c
+@@ -15,6 +15,7 @@
+
+ #include <linux/kernel.h>
+ #include <linux/init.h>
++#include <linux/timer.h>
+ #include <linux/interrupt.h>
+ #include <linux/module.h>
+ #include <linux/console.h>
+@@ -76,6 +77,7 @@
+ */
+ struct altera_uart {
+ struct uart_port port;
++ struct timer_list tmr;
+ unsigned int sigs; /* Local copy of line sigs */
+ unsigned short imr; /* Local IMR mirror */
+ };
+@@ -168,6 +170,7 @@ static void altera_uart_set_termios(stru
+ tty_termios_encode_baud_rate(termios, baud, baud);
+
+ spin_lock_irqsave(&port->lock, flags);
++ uart_update_timeout(port, termios->c_cflag, baud);
+ writel(baudclk, port->membase + ALTERA_UART_DIVISOR_REG);
+ spin_unlock_irqrestore(&port->lock, flags);
+ }
+@@ -268,6 +271,15 @@ static irqreturn_t altera_uart_interrupt
+ return IRQ_RETVAL(isr);
+ }
+
++static void altera_uart_timer(unsigned long data)
++{
++ struct uart_port *port = (void *)data;
++ struct altera_uart *pp = container_of(port, struct altera_uart, port);
++
++ altera_uart_interrupt(0, port);
++ mod_timer(&pp->tmr, jiffies + uart_poll_timeout(port));
++}
++
+ static void altera_uart_config_port(struct uart_port *port, int flags)
+ {
+ port->type = PORT_ALTERA_UART;
+@@ -284,6 +296,12 @@ static int altera_uart_startup(struct ua
+ unsigned long flags;
+ int ret;
+
++ if (!port->irq) {
++ setup_timer(&pp->tmr, altera_uart_timer, (unsigned long)port);
++ mod_timer(&pp->tmr, jiffies + uart_poll_timeout(port));
++ return 0;
++ }
++
+ ret = request_irq(port->irq, altera_uart_interrupt, IRQF_DISABLED,
+ DRV_NAME, port);
+ if (ret) {
+@@ -316,7 +334,10 @@ static void altera_uart_shutdown(struct
+
+ spin_unlock_irqrestore(&port->lock, flags);
+
+- free_irq(port->irq, port);
++ if (port->irq)
++ free_irq(port->irq, port);
++ else
++ del_timer_sync(&pp->tmr);
+ }
+
+ static const char *altera_uart_type(struct uart_port *port)
diff --git a/tty/altera_uart-don-t-use-plain-integer-as-null-pointer.patch b/tty/altera_uart-don-t-use-plain-integer-as-null-pointer.patch
new file mode 100644
index 00000000000000..a48a760f9d74fd
--- /dev/null
+++ b/tty/altera_uart-don-t-use-plain-integer-as-null-pointer.patch
@@ -0,0 +1,33 @@
+From cbouatmailru@gmail.com Wed Oct 6 13:34:27 2010
+Date: Fri, 1 Oct 2010 17:23:13 +0400
+From: Anton Vorontsov <cbouatmailru@gmail.com>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Tobias Klauser <tklauser@distanz.ch>, linux-serial@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: altera_uart: Don't use plain integer as NULL pointer
+Message-ID: <20101001132313.GH25897@oksana.dev.rtsoft.ru>
+Content-Disposition: inline
+
+Fixes sparse warning.
+
+Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
+Cc: Alan Cox <alan@linux.intel.com>
+Acked-by: Tobias Klauser <tklauser@distanz.ch>
+
+---
+ drivers/serial/altera_uart.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/serial/altera_uart.c
++++ b/drivers/serial/altera_uart.c
+@@ -461,7 +461,7 @@ static int __init altera_uart_console_se
+ if (co->index < 0 || co->index >= CONFIG_SERIAL_ALTERA_UART_MAXPORTS)
+ return -EINVAL;
+ port = &altera_uart_ports[co->index].port;
+- if (port->membase == 0)
++ if (!port->membase)
+ return -ENODEV;
+
+ if (options)
diff --git a/tty/altera_uart-fix-missing-prototype-for-registering-an-early-console.patch b/tty/altera_uart-fix-missing-prototype-for-registering-an-early-console.patch
new file mode 100644
index 00000000000000..40f8e89da7b0ff
--- /dev/null
+++ b/tty/altera_uart-fix-missing-prototype-for-registering-an-early-console.patch
@@ -0,0 +1,42 @@
+From cbouatmailru@gmail.com Wed Oct 6 13:34:04 2010
+Date: Fri, 1 Oct 2010 17:22:55 +0400
+From: Anton Vorontsov <cbouatmailru@gmail.com>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Tobias Klauser <tklauser@distanz.ch>, linux-serial@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: altera_uart: Fix missing prototype for registering an early console
+Message-ID: <20101001132255.GG25897@oksana.dev.rtsoft.ru>
+Content-Disposition: inline
+
+Simply add an early_altera_uart_setup() prototype declaration, otherwise
+platform code have to do it in .c files, which is ugly.
+
+Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
+Acked-by: Tobias Klauser <tklauser@distanz.ch>
+Cc: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/altera_uart.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/include/linux/altera_uart.h
++++ b/include/linux/altera_uart.h
+@@ -5,6 +5,8 @@
+ #ifndef __ALTUART_H
+ #define __ALTUART_H
+
++#include <linux/init.h>
++
+ struct altera_uart_platform_uart {
+ unsigned long mapbase; /* Physical address base */
+ unsigned int irq; /* Interrupt vector */
+@@ -12,4 +14,6 @@ struct altera_uart_platform_uart {
+ unsigned int bus_shift; /* Bus shift (address stride) */
+ };
+
++int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp);
++
+ #endif /* __ALTUART_H */
diff --git a/tty/altera_uart-fixup-type-usage-of-port-flags.patch b/tty/altera_uart-fixup-type-usage-of-port-flags.patch
new file mode 100644
index 00000000000000..b0868cdf7d8e3f
--- /dev/null
+++ b/tty/altera_uart-fixup-type-usage-of-port-flags.patch
@@ -0,0 +1,46 @@
+From cbouatmailru@gmail.com Wed Oct 6 13:33:41 2010
+Date: Fri, 1 Oct 2010 17:22:37 +0400
+From: Anton Vorontsov <cbouatmailru@gmail.com>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Tobias Klauser <tklauser@distanz.ch>, linux-serial@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: altera_uart: Fixup type usage of port flags
+Message-ID: <20101001132237.GF25897@oksana.dev.rtsoft.ru>
+Content-Disposition: inline
+
+port->flags is of type upf_t, which corresponds to UPF_* flags.
+
+ASYNC_BOOT_AUTOCONF is an unsigned integer, which happen to
+be the same as UPF_BOOT_AUTOCONF.
+
+Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
+Acked-by: Tobias Klauser <tklauser@distanz.ch>
+Cc: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/altera_uart.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/serial/altera_uart.c
++++ b/drivers/serial/altera_uart.c
+@@ -421,7 +421,7 @@ int __init early_altera_uart_setup(struc
+ port->iotype = SERIAL_IO_MEM;
+ port->irq = platp[i].irq;
+ port->uartclk = platp[i].uartclk;
+- port->flags = ASYNC_BOOT_AUTOCONF;
++ port->flags = UPF_BOOT_AUTOCONF;
+ port->ops = &altera_uart_ops;
+ port->private_data = platp;
+ }
+@@ -551,7 +551,7 @@ static int __devinit altera_uart_probe(s
+ port->iotype = SERIAL_IO_MEM;
+ port->uartclk = platp->uartclk;
+ port->ops = &altera_uart_ops;
+- port->flags = ASYNC_BOOT_AUTOCONF;
++ port->flags = UPF_BOOT_AUTOCONF;
+ port->private_data = platp;
+
+ uart_add_one_port(&altera_uart_driver, port);
diff --git a/tty/altera_uart-make-it-possible-to-use-altera-uart-and-8250-ports-together.patch b/tty/altera_uart-make-it-possible-to-use-altera-uart-and-8250-ports-together.patch
new file mode 100644
index 00000000000000..82370d70d262ba
--- /dev/null
+++ b/tty/altera_uart-make-it-possible-to-use-altera-uart-and-8250-ports-together.patch
@@ -0,0 +1,63 @@
+From cbouatmailru@gmail.com Wed Oct 6 13:33:16 2010
+Date: Fri, 1 Oct 2010 18:23:24 +0400
+From: Anton Vorontsov <cbouatmailru@gmail.com>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Tobias Klauser <tklauser@distanz.ch>, linux-serial@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: altera_uart: Make it possible to use Altera UART and 8250 ports together
+Message-ID: <20101001142324.GA4517@oksana.dev.rtsoft.ru>
+Content-Disposition: inline
+
+This fixes tty name, major and minor numbers. The major number
+204 is used across many platform-specific serial drivers, so we
+use that.
+
+Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
+Acked-by: Tobias Klauser <tklauser@distanz.ch>
+Cc: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/altera_uart.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+--- a/drivers/serial/altera_uart.c
++++ b/drivers/serial/altera_uart.c
+@@ -28,6 +28,8 @@
+ #include <linux/altera_uart.h>
+
+ #define DRV_NAME "altera_uart"
++#define SERIAL_ALTERA_MAJOR 204
++#define SERIAL_ALTERA_MINOR 213
+
+ /*
+ * Altera UART register definitions according to the Nios UART datasheet:
+@@ -471,7 +473,7 @@ static int __init altera_uart_console_se
+ static struct uart_driver altera_uart_driver;
+
+ static struct console altera_uart_console = {
+- .name = "ttyS",
++ .name = "ttyAL",
+ .write = altera_uart_console_write,
+ .device = uart_console_device,
+ .setup = altera_uart_console_setup,
+@@ -502,9 +504,9 @@ console_initcall(altera_uart_console_ini
+ static struct uart_driver altera_uart_driver = {
+ .owner = THIS_MODULE,
+ .driver_name = DRV_NAME,
+- .dev_name = "ttyS",
+- .major = TTY_MAJOR,
+- .minor = 64,
++ .dev_name = "ttyAL",
++ .major = SERIAL_ALTERA_MAJOR,
++ .minor = SERIAL_ALTERA_MINOR,
+ .nr = CONFIG_SERIAL_ALTERA_UART_MAXPORTS,
+ .cons = ALTERA_UART_CONSOLE,
+ };
+@@ -603,3 +605,4 @@ MODULE_DESCRIPTION("Altera UART driver")
+ MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>");
+ MODULE_LICENSE("GPL");
+ MODULE_ALIAS("platform:" DRV_NAME);
++MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_ALTERA_MAJOR);
diff --git a/tty/serial-8250-don-t-delay-after-transmitter-is-ready.patch b/tty/serial-8250-don-t-delay-after-transmitter-is-ready.patch
new file mode 100644
index 00000000000000..76cc960d869b85
--- /dev/null
+++ b/tty/serial-8250-don-t-delay-after-transmitter-is-ready.patch
@@ -0,0 +1,42 @@
+From David.Daney@caviumnetworks.com Wed Oct 6 13:21:08 2010
+From: David Daney <ddaney@caviumnetworks.com>
+To: linux-serial@vger.kernel.org, gregkh@suse.de,
+ linux-kernel@vger.kernel.org
+Cc: David Daney <ddaney@caviumnetworks.com>
+Subject: serial: 8250: Don't delay after transmitter is ready.
+Date: Tue, 5 Oct 2010 11:40:07 -0700
+Message-Id: <1286304007-4715-1-git-send-email-ddaney@caviumnetworks.com>
+
+The loop in wait_for_xmitr() is delaying one extra uS after the ready
+condition has been met. Rewrite the loop to only delay if the
+transmitter is not ready.
+
+Signed-off-by: David Daney <ddaney@caviumnetworks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/8250.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/serial/8250.c
++++ b/drivers/serial/8250.c
+@@ -1867,15 +1867,17 @@ static void wait_for_xmitr(struct uart_8
+ unsigned int status, tmout = 10000;
+
+ /* Wait up to 10ms for the character(s) to be sent. */
+- do {
++ for (;;) {
+ status = serial_in(up, UART_LSR);
+
+ up->lsr_saved_flags |= status & LSR_SAVE_FLAGS;
+
++ if ((status & bits) == bits)
++ break;
+ if (--tmout == 0)
+ break;
+ udelay(1);
+- } while ((status & bits) != bits);
++ }
+
+ /* Wait up to 1s for flow control if necessary */
+ if (up->port.flags & UPF_CONS_FLOW) {
diff --git a/tty/serial-factor-out-uart_poll_timeout-from-8250-driver.patch b/tty/serial-factor-out-uart_poll_timeout-from-8250-driver.patch
new file mode 100644
index 00000000000000..670fb4b5d72c19
--- /dev/null
+++ b/tty/serial-factor-out-uart_poll_timeout-from-8250-driver.patch
@@ -0,0 +1,91 @@
+From cbouatmailru@gmail.com Wed Oct 6 13:31:58 2010
+Date: Fri, 1 Oct 2010 17:21:25 +0400
+From: Anton Vorontsov <cbouatmailru@gmail.com>
+To: Greg Kroah-Hartman <gregkh@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>,
+ Andrew Morton <akpm@linux-foundation.org>,
+ Tobias Klauser <tklauser@distanz.ch>, linux-serial@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Subject: serial: Factor out uart_poll_timeout() from 8250 driver
+Message-ID: <20101001132125.GA25897@oksana.dev.rtsoft.ru>
+Content-Disposition: inline
+
+Soon we will use that handy function in the altera_uart driver.
+
+Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
+Cc: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/8250.c | 14 ++++----------
+ include/linux/serial_core.h | 8 ++++++++
+ 2 files changed, 12 insertions(+), 10 deletions(-)
+
+--- a/drivers/serial/8250.c
++++ b/drivers/serial/8250.c
+@@ -1722,12 +1722,6 @@ static void serial_unlink_irq_chain(stru
+ mutex_unlock(&hash_mutex);
+ }
+
+-/* Base timer interval for polling */
+-static inline int poll_timeout(int timeout)
+-{
+- return timeout > 6 ? (timeout / 2 - 2) : 1;
+-}
+-
+ /*
+ * This function is used to handle ports that do not have an
+ * interrupt. This doesn't work very well for 16450's, but gives
+@@ -1742,7 +1736,7 @@ static void serial8250_timeout(unsigned
+ iir = serial_in(up, UART_IIR);
+ if (!(iir & UART_IIR_NO_INT))
+ serial8250_handle_port(up);
+- mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout));
++ mod_timer(&up->timer, jiffies + uart_poll_timeout(&up->port));
+ }
+
+ static void serial8250_backup_timeout(unsigned long data)
+@@ -1787,7 +1781,7 @@ static void serial8250_backup_timeout(un
+
+ /* Standard timer interval plus 0.2s to keep the port running */
+ mod_timer(&up->timer,
+- jiffies + poll_timeout(up->port.timeout) + HZ / 5);
++ jiffies + uart_poll_timeout(&up->port) + HZ / 5);
+ }
+
+ static unsigned int serial8250_tx_empty(struct uart_port *port)
+@@ -2071,7 +2065,7 @@ static int serial8250_startup(struct uar
+ up->timer.function = serial8250_backup_timeout;
+ up->timer.data = (unsigned long)up;
+ mod_timer(&up->timer, jiffies +
+- poll_timeout(up->port.timeout) + HZ / 5);
++ uart_poll_timeout(port) + HZ / 5);
+ }
+
+ /*
+@@ -2081,7 +2075,7 @@ static int serial8250_startup(struct uar
+ */
+ if (!is_real_interrupt(up->port.irq)) {
+ up->timer.data = (unsigned long)up;
+- mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout));
++ mod_timer(&up->timer, jiffies + uart_poll_timeout(port));
+ } else {
+ retval = serial_link_irq_chain(up);
+ if (retval)
+--- a/include/linux/serial_core.h
++++ b/include/linux/serial_core.h
+@@ -411,6 +411,14 @@ unsigned int uart_get_baud_rate(struct u
+ unsigned int max);
+ unsigned int uart_get_divisor(struct uart_port *port, unsigned int baud);
+
++/* Base timer interval for polling */
++static inline int uart_poll_timeout(struct uart_port *port)
++{
++ int timeout = port->timeout;
++
++ return timeout > 6 ? (timeout / 2 - 2) : 1;
++}
++
+ /*
+ * Console helpers.
+ */
diff --git a/tty/serial-mark-the-8250-driver-as-maintained.patch b/tty/serial-mark-the-8250-driver-as-maintained.patch
new file mode 100644
index 00000000000000..9bca005b5afcd7
--- /dev/null
+++ b/tty/serial-mark-the-8250-driver-as-maintained.patch
@@ -0,0 +1,29 @@
+From foo@baz Wed Oct 6 13:29:44 PDT 2010
+Date: Wed, 06 Oct 2010 13:29:44 -0700
+To: Greg KH <greg@kroah.com>
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: serial: mark the 8250 driver as maintained
+
+Clearly I have gone insane, so I might as well tell the world about it.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ MAINTAINERS | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -157,9 +157,11 @@ S: Maintained
+ F: drivers/net/r8169.c
+
+ 8250/16?50 (AND CLONE UARTS) SERIAL DRIVER
++M: Greg Kroah-Hartman <gregkh@suse.de>
+ L: linux-serial@vger.kernel.org
+ W: http://serial.sourceforge.net
+-S: Orphan
++S: Maintained
++T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
+ F: drivers/serial/8250*
+ F: include/linux/serial_8250.h
+
diff --git a/tty/tty-maintainers-add-drivers-serial-jsm-as-maintained-driver.patch b/tty/tty-maintainers-add-drivers-serial-jsm-as-maintained-driver.patch
new file mode 100644
index 00000000000000..bc9680276c11c7
--- /dev/null
+++ b/tty/tty-maintainers-add-drivers-serial-jsm-as-maintained-driver.patch
@@ -0,0 +1,35 @@
+From linux-serial-owner@vger.kernel.org Wed Oct 6 13:16:43 2010
+From: Breno Leitao <leitao@linux.vnet.ibm.com>
+To: greg@kroah.com
+Cc: Scott.Kilau@digi.com, linux-kernel@vger.kernel.org,
+ linux-serial@vger.kernel.org,
+ Breno Leitao <leitao@linux.vnet.ibm.com>
+Subject: tty: MAINTAINERS: add drivers/serial/jsm/ as maintained driver
+Date: Wed, 6 Oct 2010 13:04:48 -0300
+Message-Id: <1286381088-7614-1-git-send-email-leitao@linux.vnet.ibm.com>
+
+Soott Kilau is handing off the maintainership of the jsm serial
+driver to me, and this patch just add the driver as maintained.
+
+Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ MAINTAINERS | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -3311,6 +3311,12 @@ F: fs/jbd*/
+ F: include/linux/ext*jbd*.h
+ F: include/linux/jbd*.h
+
++JSM Neo PCI based serial card
++M: Breno Leitao <leitao@linux.vnet.ibm.com>
++L: linux-serial@vger.kernel.org
++S: Maintained
++F: drivers/serial/jsm/
++
+ K8TEMP HARDWARE MONITORING DRIVER
+ M: Rudolf Marek <r.marek@assembler.cz>
+ L: lm-sensors@lm-sensors.org