From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262522AbUCJOaV (ORCPT ); Wed, 10 Mar 2004 09:30:21 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262632AbUCJOaV (ORCPT ); Wed, 10 Mar 2004 09:30:21 -0500 Received: from pub237.cambridge.redhat.com ([213.86.99.237]:39621 "EHLO warthog.cambridge.redhat.com") by vger.kernel.org with ESMTP id S262522AbUCJOaI (ORCPT ); Wed, 10 Mar 2004 09:30:08 -0500 From: David Howells To: Russell King cc: linux-kernel@vger.kernel.org Subject: 16552 UART detection User-Agent: EMH/1.14.1 SEMI/1.14.4 (Hosorogi) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 Emacs/21.3 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: multipart/mixed; boundary="Multipart_Wed_Mar_10_14:29:35_2004-1" Date: Wed, 10 Mar 2004 14:29:35 +0000 Message-ID: <20321.1078928975@redhat.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --Multipart_Wed_Mar_10_14:29:35_2004-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Wed_Mar_10_14:29:35_2004-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="serial-16652.patch" Content-Transfer-Encoding: 7bit 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 --Multipart_Wed_Mar_10_14:29:35_2004-1--