public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial 8250: tighten test for using backup timer
@ 2008-03-19 16:50 Alex Williamson
  2008-08-05 11:44 ` Will Newton
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Williamson @ 2008-03-19 16:50 UTC (permalink / raw)
  To: linux-serial; +Cc: linux-kernel, Thomas Koeller

Hi,

   Thomas Koeller had reported an issue where a device that had been
making use of the UART_BUG_TXEN code in the 8250 driver was mistakenly
being caught by the backup timer test, causing the device to work
improperly.  To fix this, the patch below tightens the test requirements
to enable the backup timer workaround.  The backup timer is really meant
to catch UARTs that don't re-assert the THRE interrupt.  The expectation
is that they do initially assert THRE.  This patch clarifies the test.
Thanks,

	Alex

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---

diff -r 2202c155b8c3 drivers/serial/8250.c
--- a/drivers/serial/8250.c	Tue Mar 18 21:34:48 2008 -0700
+++ b/drivers/serial/8250.c	Wed Mar 19 10:32:40 2008 -0600
@@ -1814,6 +1814,7 @@ static int serial8250_startup(struct uar
 	}
 
 	if (is_real_interrupt(up->port.irq)) {
+		unsigned char iir1;
 		/*
 		 * Test for UARTs that do not reassert THRE when the
 		 * transmitter is idle and the interrupt has already
@@ -1827,7 +1828,7 @@ static int serial8250_startup(struct uar
 		wait_for_xmitr(up, UART_LSR_THRE);
 		serial_out_sync(up, UART_IER, UART_IER_THRI);
 		udelay(1); /* allow THRE to set */
-		serial_in(up, UART_IIR);
+		iir1 = serial_in(up, UART_IIR);
 		serial_out(up, UART_IER, 0);
 		serial_out_sync(up, UART_IER, UART_IER_THRI);
 		udelay(1); /* allow a working UART time to re-assert THRE */
@@ -1840,7 +1841,7 @@ static int serial8250_startup(struct uar
 		 * If the interrupt is not reasserted, setup a timer to
 		 * kick the UART on a regular basis.
 		 */
-		if (iir & UART_IIR_NO_INT) {
+		if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {
 			pr_debug("ttyS%d - using backup timer\n", port->line);
 			up->timer.function = serial8250_backup_timeout;
 			up->timer.data = (unsigned long)up;




^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH] serial 8250: tighten test for using backup timer
@ 2008-08-26 17:45 David Brownell
  2008-08-26 17:58 ` Andrew Morton
  0 siblings, 1 reply; 11+ messages in thread
From: David Brownell @ 2008-08-26 17:45 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lkml, Alex Williamson

> > Also, how serious is the problem which is being fixed here?  It
> > _sounds_ like it's of the "fatal for people who have that hardware"
> > variety, in which case we should get this into 2.6.27 and probably
> > 2.6.26.x.  Not sure about 2.5.26.x though - the patch doesn't apply
> > there, but I didn't check whether this is due to functional changes.
>
> For users of this version of this particular UART IP it is fatal. From
> looking at the git history it looks like the original patch went into
> 2.6.26 so it might also affect that kernel.

Second that:  serial-8250-tighten-test-for-using-backup-timer.patch
(from MMOTM) in mainline sooner-not-later seems right.

My own exposure to this is that the UART on DaVinci hardware, which
TI allegedly derived from its original 16550 logic, has periodically
gone from working to unusable with the mainline 8250.c ... and back
and forth a bunch.  Currently it's "unusable", a regression from some
previous versions.  With this patch from Alex, it's usable.

Of course there are a bunch of arch/arm/mach-davinci patches needed
to make that platform more functional in mainline.  I expect they'll
probably merge in the 2.6.28-rc0 window.  Meanwhile, running out of
ramdisk with a serial console should at least work right!  :)

- Dave

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

end of thread, other threads:[~2008-09-01 17:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-19 16:50 [PATCH] serial 8250: tighten test for using backup timer Alex Williamson
2008-08-05 11:44 ` Will Newton
2008-08-05 20:06   ` Alex Williamson
2008-08-06 10:53     ` Will Newton
2008-08-11 21:32       ` Andrew Morton
2008-08-12  8:32         ` Will Newton
  -- strict thread matches above, loose matches on Subject: below --
2008-08-26 17:45 David Brownell
2008-08-26 17:58 ` Andrew Morton
2008-08-26 18:10   ` Will Newton
2008-09-01 13:36   ` Will Newton
2008-09-01 17:56     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox