Skip to contentSkip to conversation

8250: make probing for TXEN bug a config option

PATCH In review Vitaly Wool 2 participants 6 messages Dec 26, 2006 – Mar 14, 2007 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 8250: make probing for TXEN bug a config option

Hello Andrew,

probing for UART_BUG_TXEN in 8250 driver leads to weird effects on some ARM boards (pnx4008 for instance). That is, the driver detects UART_BUG_TXEN (though it apparently shouldn't) and it leads to symbol loss in console on input (i. e. you input 'a' and you get nothing, then you input 'b' and you get 'a', then you input 'c' and get 'b' and so on).

The patch below makes this very probing a configuration option turned on by default.

 drivers/serial/8250.c  |    5 ++++-
 drivers/serial/Kconfig |   10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/serial/8250.c +4 -1
index 51f3c73..cf3eb31 100644
@@ -1645,6 +1645,7 @@ static int serial8250_startup(struct uar
 
 	serial8250_set_mctrl(&up->port, up->port.mctrl);
 
+#ifndef CONFIG_SERIAL_8250_DONT_TEST_BUG_TXEN
 	/*
 	 * Do a quick test to see if we receive an
 	 * interrupt when we enable the TX irq.
@@ -1660,7 +1661,9 @@ static int serial8250_startup(struct uar
 			pr_debug("ttyS%d - enabling bad tx status workarounds\n",
 				 port->line);
 		}
-	} else {
+	} else
+#endif
+	{
 		up->bugs &= ~UART_BUG_TXEN;
 	}
 
drivers/serial/Kconfig +10 -0
index 2978c09..7efcaf3 100644
@@ -223,6 +223,16 @@ config SERIAL_8250_DETECT_IRQ
 
 	  If unsure, say N.
 
+config SERIAL_8250_DONT_TEST_BUG_TXEN
+	bool "Don't probe for TXEN bug"
+	depends on SERIAL_8250_EXTENDED
+	help
+	  Say Y here if you don't want the kernel to probe for TXEN bug
+	  on your serial port and try to workaround it. It might lead to
+	  character loss on some boards, though this is quite a rare case.
+
+	  If unsure, say N.
+
 config SERIAL_8250_RSA
 	bool "Support RSA serial ports"
 	depends on SERIAL_8250_EXTENDED
#1 lore raw

On Tue, 26 Dec 2006 19:43:17 +0300 Vitaly Wool <[email protected]> wrote:

        ^^^^^^^^^^^  Sorry.
Quoted 46 lines

Hello Andrew,

probing for UART_BUG_TXEN in 8250 driver leads to weird effects on some ARM boards (pnx4008 for instance). That is, the driver detects UART_BUG_TXEN (though it apparently shouldn't) and it leads to symbol loss in console on input (i. e. you input 'a' and you get nothing, then you input 'b' and you get 'a', then you input 'c' and get 'b' and so on).

The patch below makes this very probing a configuration option turned on by default.

 drivers/serial/8250.c  |    5 ++++-
 drivers/serial/Kconfig |   10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/serial/8250.c +4 -1
index 51f3c73..cf3eb31 100644
@@ -1645,6 +1645,7 @@ static int serial8250_startup(struct uar
 
 	serial8250_set_mctrl(&up->port, up->port.mctrl);
 
+#ifndef CONFIG_SERIAL_8250_DONT_TEST_BUG_TXEN
 	/*
 	 * Do a quick test to see if we receive an
 	 * interrupt when we enable the TX irq.
@@ -1660,7 +1661,9 @@ static int serial8250_startup(struct uar
 			pr_debug("ttyS%d - enabling bad tx status workarounds\n",
 				 port->line);
 		}
-	} else {
+	} else
+#endif
+	{
 		up->bugs &= ~UART_BUG_TXEN;
 	}
 
drivers/serial/Kconfig +3 -0
index 2978c09..7efcaf3 100644
@@ -223,6 +223,16 @@ config SERIAL_8250_DETECT_IRQ
 
 	  If unsure, say N.
 
+config SERIAL_8250_DONT_TEST_BUG_TXEN
+	bool "Don't probe for TXEN bug"
+	depends on SERIAL_8250_EXTENDED

drivers/serial/Kconfig config SERIAL_8250_DETECT_IRQ · line 238

Quoted 10 lines
drivers/serial/Kconfig +7 -0
+	help
+	  Say Y here if you don't want the kernel to probe for TXEN bug
+	  on your serial port and try to workaround it. It might lead to
+	  character loss on some boards, though this is quite a rare case.
+
+	  If unsure, say N.
+
 config SERIAL_8250_RSA
 	bool "Support RSA serial ports"
 	depends on SERIAL_8250_EXTENDED

I think this should be a module option/boot parameter, not a config-time option.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 9 lines · On Wed, 14 Feb 2007 11:37:52 +0300 "Vitaly Wool" <[email protected]> wrote:
Quoted 5 lines · Andrew Morton

I think this should be a module option/boot parameter, not a config-time option.

Hmm, why? I can't think of a platform where one 8250-compatible UART is problematic and another isn't :)

Is it not possible that the same kernel package can be installed on systems which do and don't need this feature? If so, we don't want to force the provider of that package to create two packages.

That, plus the chances of the package creator actually knowing about this option aren't great.

Generally, if it can be done at runtime it is better to do so, no?

#4 lore raw
Quoted 5 lines · Andrew Morton
Quoted 3 lines · On Wed, 14 Feb 2007 11:37:52 +0300 "Vitaly Wool" <[email protected]> wrote:

Hmm, why? I can't think of a platform where one 8250-compatible UART is problematic and another isn't :)

Quoted 8 lines

Is it not possible that the same kernel package can be installed on systems which do and don't need this feature? If so, we don't want to force the provider of that package to create two packages.

That, plus the chances of the package creator actually knowing about this option aren't great.

Generally, if it can be done at runtime it is better to do so, no?

Okay, yes, I see your point. The same kernel might actually be supporting several machines.

But having that as a config option doesn't look too attractive to me. What about adding a new flag to plat_serial 8250 stuff instead?

Vitaly

#5 lore raw
Quoted 13 lines · On Wed, 14 Feb 2007 05:41:53 -0800 "Vitaly Wool" <[email protected]> wrote:
Quoted 12 lines · Andrew Morton
Quoted 3 lines · On Wed, 14 Feb 2007 11:37:52 +0300 "Vitaly Wool" <[email protected]> wrote:

Hmm, why? I can't think of a platform where one 8250-compatible UART is problematic and another isn't :)

Is it not possible that the same kernel package can be installed on systems which do and don't need this feature? If so, we don't want to force the provider of that package to create two packages.

That, plus the chances of the package creator actually knowing about this option aren't great.

Quoted 7 lines
Quoted 1 line

Generally, if it can be done at runtime it is better to do so, no?

Okay, yes, I see your point. The same kernel might actually be supporting several machines.

But having that as a config option doesn't look too attractive to me. What about adding a new flag to plat_serial 8250 stuff instead?

plat_serial8250_port.flags? Dunno, I'm unfamiliar with it. That seems to be how the share_irqs option is handled.

#6 lore raw
In reply to Andrew Morton
Quoted 2 lines · Andrew Morton

I think this should be a module option/boot parameter, not a config-time option.

NM, the recent changes in 8250 driver eliminated the need for this patch :)

Vitaly