* 16552 UART detection
@ 2004-03-10 14:29 David Howells
0 siblings, 0 replies; only message in thread
From: David Howells @ 2004-03-10 14:29 UTC (permalink / raw)
To: Russell King; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 466 bytes --]
Hi Russell,
Would something like the following be a reasonable way of detecting a NatSemi
PC16552 UART?:
if type == 16650A
then
set LCR.DLAB to 1
if EFR bits 7-3 are 0
then
set EFR to 0xff
if EFR == 0x07
then
set type to 16552
set EFR to 0
fi
else
restore EFR to previous value
fi
fi
This needs to be inserted before the test for the StarTech ST16650.
I've implemented by the attached patch against a 2.4.18 kernel.
David
[-- Attachment #2: serial-16652.patch --]
[-- Type: application/octet-stream, Size: 1633 bytes --]
Index: drivers/char/serial.c
===================================================================
RCS file: /home/cvs/linux-am33-2.4.18/drivers/char/serial.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 serial.c
--- drivers/char/serial.c 8 May 2002 12:07:55 -0000 1.1.1.1
+++ drivers/char/serial.c 10 Mar 2004 13:48:32 -0000
@@ -312,6 +312,7 @@
{ "XR16850", 128, UART_CLEAR_FIFO | UART_USE_FIFO |
UART_STARTECH },
{ "RSA", 2048, UART_CLEAR_FIFO | UART_USE_FIFO },
+ { "16552", 16, UART_CLEAR_FIFO | UART_USE_FIFO },
{ 0, 0}
};
@@ -3739,6 +3740,19 @@
case 3:
state->type = PORT_16550A;
break;
+ }
+ if (state->type == PORT_16550A) {
+ /* check for half of an NS 16552 */
+ serial_outp(info, UART_LCR, UART_LCR_DLAB);
+ scratch = serial_in(info, UART_EFR);
+ if ((scratch & ~7) == 0) {
+ serial_outp(info, UART_EFR, 0xff);
+ if (serial_in(info, UART_EFR) == 7) {
+ state->type = PORT_16552;
+ scratch = 0;
+ }
+ serial_outp(info, UART_EFR, scratch);
+ }
}
if (state->type == PORT_16550A) {
/* Check for Startech UART's */
Index: include/linux/serial.h
===================================================================
RCS file: /home/cvs/linux-am33-2.4.18/include/linux/serial.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 serial.h
--- include/linux/serial.h 8 May 2002 12:11:50 -0000 1.1.1.1
+++ include/linux/serial.h 10 Mar 2004 13:48:10 -0000
@@ -75,7 +75,8 @@
#define PORT_16654 11
#define PORT_16850 12
#define PORT_RSA 13 /* RSA-DV II/S card */
-#define PORT_MAX 13
+#define PORT_16552 14
+#define PORT_MAX 14
#define SERIAL_IO_PORT 0
#define SERIAL_IO_HUB6 1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-03-10 14:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-10 14:29 16552 UART detection David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox