Re: NS PC87338 support

Theodore Y. Ts'o (tytso@mit.edu)
Fri, 16 Oct 1998 20:42:08 -0400


Date: Fri, 16 Oct 1998 19:09:24 +0200
From: Pavel Machek <pavel@bug.ucw.cz>

This is support for National Semiconductors PC87338. It allows serial
to operate at speeds up-to 1500000bps. I wonder if something like this
has chance to make it into mainstream kernel?

Certainly not for Linux 2.2, not at this late date....

Can you send me a URL to the data sheet for this thing?
I want to take a very careful look at it.

Here are a couple of tips about the patch in terms of programming
style. First of all when you do autodetection code, make sure you
carefully consider what happens if the autodetect code runs on some
other chip other than the one you are expecting. The autodetect code
makes me nervous, since on a non PC87338, if someone types the wrong
character on the terminal attached to the serial port during the kernel
boot, the autodetect code could get confused into thinking it's a
PC87338 when it really isn't.

Secondly, when writing autodetect code, make sure you save the state of
registers you touch and restore them when you're through. This won't
always avoid problems with accidentally setting the wrong port, but it's
good programming practice.

Also, it's generally a bad idea to tie a base_baud setting to a
particular chip, unless you *know* that the UART only works with a
particular clock frequency, or that only one manufacturer manufacturers
a serial board using that UART, and you can gaurantee that they will
always, for now and forever, always be using the same clock frequency
with that UART. Sure, your serial board with a PC87338 can support
speeeds up to 1500000bps, which presumably means that for your board,
they are using a 24MHz clock crystal, instead of the more standard
1.8432 MHz clock crystal. But is that really the maximum clock crystal
it can support? Or just the one that happened to be on your serial
board?

For example, the datasheet for the OX16C950 lists divisor programming
tables for 1.84332 MHz, 7.372 MHZ, 14.7456 MHz, 18.432 MHz, 32.0 MHz,
33.0 MHz, 40.0 MHz, 50.0 Mhz, and 60.0 Mhz crystals. Depending on which
clock crystals you use, you can get speeds such as like 1.0 Mbs, 1.25
Mbs, 1.563 Mbs, 2.0 Mbs, 2.5 Mbs, etc. (Top speed is 15.0 Mbs, but this
is really stressing the chip and requires a rock-solid clock source.)

PS: On my Thinkpad, I have to run attached program before trying to insert
module for ttyS0 to be detected properly. Seems like it is disabled by
default.

This is almost certainly so that by default, your Thinkpad is compatible
with the standard serial ports (which have the 1.8432 MHz crystal).

PPS: Are there known bugs in serial.c's usage counts? I've seen really
strange things like module usage cound == -1.

There were such problems a while back, but I thought the patches to
clear them up got included in the most recent 2.1 kernels.

- Ted

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/