From: David Howells <dhowells@redhat.com>
To: Russell King <rmk@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: 16552 UART detection
Date: Wed, 10 Mar 2004 14:29:35 +0000 [thread overview]
Message-ID: <20321.1078928975@redhat.com> (raw)
[-- 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
reply other threads:[~2004-03-10 14:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20321.1078928975@redhat.com \
--to=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
/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