linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 8250: option 'force_polling' for buggy IRQs
@ 2016-07-25 17:36 Max Staudt
  2016-07-25 17:47 ` Greg KH
  2016-07-25 18:19 ` kbuild test robot
  0 siblings, 2 replies; 20+ messages in thread
From: Max Staudt @ 2016-07-25 17:36 UTC (permalink / raw)
  To: gregkh; +Cc: mstaudt, linux-serial, linux-kernel

Some serial ports may not emit IRQs properly, or there may be a defect
in their routing on the motherboard.

This patch allows these ports to be used anyway (or until a better
workaround is known for a specific platform), though with no guarantees.

If you have such a buggy UART, boot Linux with 8250.force_polling=1 .

It is essentially the kernel level version of:

  setserial /dev/ttySn irq 0

and builds upon the polling code that is already in the kernel.
---
 drivers/tty/serial/8250/8250_core.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 13ad5c3..c6a7fd1 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -58,6 +58,11 @@ static struct uart_driver serial8250_reg;
 
 static unsigned int skip_txen_test; /* force skip of txen test at init time */
 
+/* Force polled mode for all newly detected ports.
+ * This can be used if IRQs don't arrive and similar buggyness.
+ */
+static unsigned int force_polling;
+
 #define PASS_LIMIT	512
 
 #include <asm/serial.h>
@@ -335,6 +340,13 @@ static int univ8250_setup_irq(struct uart_8250_port *up)
 			  uart_poll_timeout(port) + HZ / 5);
 	}
 
+	if (force_polling) {
+		pr_debug("ttyS%d - using polled mode instead of interrupt %u\n",
+			 serial_index(port),
+			 port->irq);
+		port->irq = 0;
+	}
+
 	/*
 	 * If the "interrupt" for this port doesn't correspond with any
 	 * hardware interrupt, we use a timer-based system.  The original
@@ -1206,6 +1218,9 @@ MODULE_PARM_DESC(nr_uarts, "Maximum number of UARTs supported. (1-" __MODULE_STR
 module_param(skip_txen_test, uint, 0644);
 MODULE_PARM_DESC(skip_txen_test, "Skip checking for the TXEN bug at init time");
 
+module_param(force_polling, uint, 0644);
+MODULE_PARM_DESC(force_polling, "Set ports to polling mode at init time");
+
 #ifdef CONFIG_SERIAL_8250_RSA
 module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444);
 MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
@@ -1232,6 +1247,7 @@ static void __used s8250_options(void)
 	module_param_cb(share_irqs, &param_ops_uint, &share_irqs, 0644);
 	module_param_cb(nr_uarts, &param_ops_uint, &nr_uarts, 0644);
 	module_param_cb(skip_txen_test, &param_ops_uint, &skip_txen_test, 0644);
+	module_param_cb(force_polling, uint, 0644);
 #ifdef CONFIG_SERIAL_8250_RSA
 	__module_param_call(MODULE_PARAM_PREFIX, probe_rsa,
 		&param_array_ops, .arr = &__param_arr_probe_rsa,
-- 
2.6.6

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-08-01 15:28 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25 17:36 [PATCH] 8250: option 'force_polling' for buggy IRQs Max Staudt
2016-07-25 17:47 ` Greg KH
2016-07-26 11:42   ` Max Staudt
2016-07-26 15:08     ` Greg KH
2016-07-26 16:18       ` Max Staudt
2016-07-27 12:09         ` One Thousand Gnomes
2016-07-27 12:14           ` Max Staudt
2016-07-27 13:33             ` Theodore Ts'o
2016-07-27 20:01               ` One Thousand Gnomes
2016-07-28  9:59               ` Max Staudt
2016-07-28 14:47                 ` Greg KH
2016-07-28 16:01                   ` Theodore Ts'o
2016-07-28 18:40                 ` Eric W. Biederman
2016-07-29  9:23                   ` One Thousand Gnomes
2016-07-29  9:58                     ` Max Staudt
2016-07-29 17:38                       ` Eric W. Biederman
2016-08-01 15:27                         ` One Thousand Gnomes
2016-07-25 18:19 ` kbuild test robot
2016-07-26 11:47   ` [PATCHv2] " Max Staudt
2016-07-26 11:54   ` [PATCHv3] " Max Staudt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).