]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
tty: serial8250: add break handler quirk for tegra
authorBibek Basu <bbasu@nvidia.com>
Mon, 28 Apr 2014 05:29:24 +0000 (10:59 +0530)
committerWinnie Hsu <whsu@nvidia.com>
Thu, 8 May 2014 23:40:38 +0000 (16:40 -0700)
On tegra,after a break is issued, uart status register
generates FIFOE error rather than the next character
ready status. For that quirk is already present. Hook is added
for the quirk so that sysrq key combination works. This helps
in debugging soft hangs

Bug 1401397

Change-Id: I0131cfc986aba694ddc21d859685748843534611
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/401535
(cherry picked from commit c72b366e010b5cfbac6541eb339a0324b863ff17)
Reviewed-on: http://git-master/r/406398
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/tty/serial/8250/8250_core.c
drivers/tty/serial/of_serial.c
include/linux/serial_8250.h

index 264054fe8a66a3ac3bf0b3f63d7fc0f978e500c3..5914e7a9ed5a800a5277243aa724b83df8af4e20 100644 (file)
@@ -1601,6 +1601,24 @@ static int serial8250_tegra_handle_irq(struct uart_port *port)
        return 1;
 }
 
+#ifdef CONFIG_ARCH_TEGRA
+void tegra_serial_handle_break(struct uart_port *p)
+{
+       unsigned int status, tmout = 10000;
+
+       do {
+               status = p->serial_in(p, UART_LSR);
+               if (status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS))
+                       status = p->serial_in(p, UART_RX);
+               else
+                       break;
+               if (--tmout == 0)
+                       break;
+               udelay(1);
+       } while (1);
+}
+#endif
+
 /*
  * These Exar UARTs have an extra interrupt indicator that could
  * fire for a few unimplemented interrupts.  One of which is a
@@ -2761,6 +2779,9 @@ static void serial8250_config_port(struct uart_port *port, int flags)
        if (port->type == PORT_TEGRA) {
                up->bugs |= UART_BUG_NOMSR;
                port->handle_irq = serial8250_tegra_handle_irq;
+#if defined CONFIG_ARCH_TEGRA
+               port->handle_break = tegra_serial_handle_break;
+#endif
        }
 
        if (port->type != PORT_UNKNOWN && flags & UART_CONFIG_IRQ)
index 39c7ea4cb14fb9e95fbc920d86010f39db2aa691..261c0ad164ece3be366899e4e99b1b7f32b68d77 100644 (file)
@@ -29,28 +29,6 @@ struct of_serial_info {
        int line;
 };
 
-#ifdef CONFIG_ARCH_TEGRA
-void tegra_serial_handle_break(struct uart_port *p)
-{
-       unsigned int status, tmout = 10000;
-
-       do {
-               status = p->serial_in(p, UART_LSR);
-               if (status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS))
-                       status = p->serial_in(p, UART_RX);
-               else
-                       break;
-               if (--tmout == 0)
-                       break;
-               udelay(1);
-       } while (1);
-}
-#else
-static inline void tegra_serial_handle_break(struct uart_port *port)
-{
-}
-#endif
-
 /*
  * Fill a struct uart_port for a given device node
  */
index af47a8af6024e4b6511634f6441593033c7bd61e..b4ddb420405cbbf8c51fd6d66a61cbfb47ce5e40 100644 (file)
@@ -125,5 +125,12 @@ unsigned int serial8250_modem_status(struct uart_8250_port *up);
 extern void serial8250_set_isa_configurator(void (*v)
                                        (int port, struct uart_port *up,
                                                unsigned short *capabilities));
+#ifdef CONFIG_ARCH_TEGRA
+extern void tegra_serial_handle_break(struct uart_port *p);
+#else
+static inline void tegra_serial_handle_break(struct uart_port *port)
+{
+}
+#endif
 
 #endif