Linux Serial subsystem development
 help / color / mirror / Atom feed
From: "Stuart MacDonald" <stuartm@connecttech.com>
To: 'Russell King' <rmk@arm.linux.org.uk>,
	'Tom Rini' <trini@kernel.crashing.org>
Cc: tytso@mit.edu,
	'Kernel Mailing List' <linux-kernel@vger.kernel.org>,
	linux-serial@vger.kernel.org, gallen@arlut.utexas.edu
Subject: RE: [PATCH] Make the Startech UART detection 'more correct'.
Date: Tue, 9 Sep 2003 15:12:30 -0400	[thread overview]
Message-ID: <000701c37706$513a9a10$294b82ce@stuartm> (raw)
In-Reply-To: <20030909171859.D4216@flint.arm.linux.org.uk>

From: linux-kernel-owner@vger.kernel.org 
> size_fifo() is claimed to be unreliable at detecting the FIFO size,
> so I don't feel safe about using it here.

"Claimed" being the operative word. This claim predates my involvement
with the serial driver (IIRC tytso is reporting someone's claim
second-hand), however, my company has always used this test in various
test apps, and never had it fail, and this predates my employment with
them.

So. A number of possibilities: someone thought it was unreliable, but
they were incorrect; it was unreliable, but because the software was
wrong; it was unreliable, but only on certain very old hardware that I
personally have no knowledge of its existance.

I've never seen any concrete details about what goes wrong either,
just a simple claim of unreliability.

The premise is simple enough. Put the uart into internal loopback mode
(the rx and tx pins on the chip become on-die connected to each other,
date never leaves the chip), transmit 256 characters at a known baud
rate, wait for at least the time it takes to transmit these characters
plus some to be safe, and see how many are left in the rx fifo, which
should be full.

> I'd suggest something like:
> 
> 	serial_outp(port, UART_LCR, UART_LCR_DLAB);
> 	efr = serial_in(port, UART_EFR);
> 	if ((efr & 0xfc) == 0) {
> 		serial_out(port, UART_EFR, 0xac | (efr & 3));
> 		/* if top 6 bits return zero, its motorola */
> 		if (serial_in(port, UART_EFR) == (efr & 3)) {
> 			/* motorola port */
> 		} else {
> 			/* ST16C650V1 port */
> 		}
> 		/* restore old value */
> 		serial_outb(port, UART_EFR, efr);
> 	}
> 
> If you can guarantee that the lower two bits will always be 
> zero, you can
> drop the frobbing to ignore/preseve the lower two bits.

Does the Motorola chip have an ID register at all? Certainly using the
fifo size is a weak test and should only be a last resort.

..Stu

  reply	other threads:[~2003-09-09 19:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-08 20:54 [PATCH] Make the Startech UART detection 'more correct' Tom Rini
2003-09-09 16:18 ` Russell King
2003-09-09 19:12   ` Stuart MacDonald [this message]
2003-09-09 19:23     ` Tom Rini
2003-09-09 23:51   ` Tom Rini
2003-09-24 22:40     ` Kumar Gala
2003-11-01 20:43     ` Best way to detect received call on dumb modem Lewis Brown
2003-11-01 21:14       ` Jan-Benedict Glaw
2003-11-02  4:15         ` Lewis Brown
2003-11-02  8:28           ` David Lawyer
2003-11-04  6:17           ` Steve Tell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000701c37706$513a9a10$294b82ce@stuartm' \
    --to=stuartm@connecttech.com \
    --cc=gallen@arlut.utexas.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=trini@kernel.crashing.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox