From: gianluca <gianluca@sottospazio.it>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org
Subject: unrecognized multi io pci card
Date: Tue, 28 Aug 2012 14:24:58 +0200 [thread overview]
Message-ID: <20120828122458.GB1258@server> (raw)
[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]
Hello,
I recently bought a pci card with two serial ports and one parallel port
since my machine didn't have any, but the card isn't autodetected by linux.
Here follows a lspci -vvvxxx of the device
5:01.0 Serial controller: Device 4348:7053 (rev 10) (prog-if 02 [16550])
Subsystem: Device 4348:3253
Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Interrupt: pin A routed to IRQ 17
Region 0: I/O ports at ec00 [size=8]
Region 1: I/O ports at e880 [size=8]
Region 2: I/O ports at e800 [size=8]
Region 3: I/O ports at e480 [size=16]
Kernel driver in use: parport_serial
00: 48 43 53 70 01 00 00 02 10 02 00 07 00 00 00 00
10: 01 ec 00 00 81 e8 00 00 01 e8 00 00 81 e4 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 48 43 53 32
30: 00 00 00 00 00 00 00 00 00 00 00 00 0a 01 00 00
I tried to patch parport_serial.c which, as I understand, is suited to provide
all the parallel and serial ports to userspace. That driver is unmantained
unfortunately but since the card is also a serial card I'm writing to you and
this list to get feedback on what I've done.
After adding the IDs and descriptions I found unfortunately that the module
8250_pci reclaims the pci device as a serial card only and this prevents the
successful registration of the parport_serial driver (which also depends on
8250_pci).
So I blacklisted the card in 8250_pci.c using the sofmodem blacklist mechanism
already in place. I know this isn't really the right place to do it but it
works and I didn't find another way.
Eventually the parallel and the serial ports are detected but only the parallel
port works because the serial ports are wrongly recognized as XScale when they
are actually 16550 clones: if I set the port type by hand with setserial they work.
So I changed the autoconfig function in 8250.c this way: checks also the RTOIE
bit in IER to detect the port as XSCALE. I don't think this is really correct
but I've no knowledge on XSCALE or my serial card hardware to do it better.
After this last change the ports are detected and work flawlessly.
In attachment you'll find all the patches.
Thank you.
[-- Attachment #2: parport-serial.patch --]
[-- Type: text/plain, Size: 2932 bytes --]
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index e9c3227..a8d65a2 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -62,6 +62,7 @@ enum parport_pc_pci_cards {
timedia_9079a,
timedia_9079b,
timedia_9079c,
+ wch_ch353_2s1p,
};
/* each element directly indexed from enum list, above */
@@ -145,6 +146,7 @@ static struct parport_pc_pci cards[] __devinitdata = {
/* timedia_9079a */ { 1, { { 2, 3 }, } },
/* timedia_9079b */ { 1, { { 2, 3 }, } },
/* timedia_9079c */ { 1, { { 2, 3 }, } },
+ /* wch_ch353_2s1p*/ { 1, { { 2, -1}, } },
};
static struct pci_device_id parport_serial_pci_tbl[] = {
@@ -243,7 +245,7 @@ static struct pci_device_id parport_serial_pci_tbl[] = {
{ 0x1409, 0x7168, 0x1409, 0xb079, 0, 0, timedia_9079a },
{ 0x1409, 0x7168, 0x1409, 0xc079, 0, 0, timedia_9079b },
{ 0x1409, 0x7168, 0x1409, 0xd079, 0, 0, timedia_9079c },
-
+ { 0x4348, 0x7053, 0x4348, 0x3253, 0, 0, wch_ch353_2s1p},
{ 0, } /* terminate list */
};
MODULE_DEVICE_TABLE(pci,parport_serial_pci_tbl);
@@ -460,6 +462,12 @@ static struct pciserial_board pci_parport_serial_boards[] __devinitdata = {
.base_baud = 921600,
.uart_offset = 8,
},
+ [wch_ch353_2s1p] = {
+ .flags = FL_BASE0|FL_BASE_BARS,
+ .num_ports = 2,
+ .base_baud = 115200,
+ .uart_offset = 8,
+ },
};
struct parport_serial_private {
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index e9c3227..a8d65a2 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -62,6 +62,7 @@ enum parport_pc_pci_cards {
timedia_9079a,
timedia_9079b,
timedia_9079c,
+ wch_ch353_2s1p,
};
/* each element directly indexed from enum list, above */
@@ -145,6 +146,7 @@ static struct parport_pc_pci cards[] __devinitdata = {
/* timedia_9079a */ { 1, { { 2, 3 }, } },
/* timedia_9079b */ { 1, { { 2, 3 }, } },
/* timedia_9079c */ { 1, { { 2, 3 }, } },
+ /* wch_ch353_2s1p*/ { 1, { { 2, -1}, } },
};
static struct pci_device_id parport_serial_pci_tbl[] = {
@@ -243,7 +245,7 @@ static struct pci_device_id parport_serial_pci_tbl[] = {
{ 0x1409, 0x7168, 0x1409, 0xb079, 0, 0, timedia_9079a },
{ 0x1409, 0x7168, 0x1409, 0xc079, 0, 0, timedia_9079b },
{ 0x1409, 0x7168, 0x1409, 0xd079, 0, 0, timedia_9079c },
-
+ { 0x4348, 0x7053, 0x4348, 0x3253, 0, 0, wch_ch353_2s1p},
{ 0, } /* terminate list */
};
MODULE_DEVICE_TABLE(pci,parport_serial_pci_tbl);
@@ -460,6 +462,12 @@ static struct pciserial_board pci_parport_serial_boards[] __devinitdata = {
.base_baud = 921600,
.uart_offset = 8,
},
+ [wch_ch353_2s1p] = {
+ .flags = FL_BASE0|FL_BASE_BARS,
+ .num_ports = 2,
+ .base_baud = 115200,
+ .uart_offset = 8,
+ },
};
struct parport_serial_private {
[-- Attachment #3: 8250-pci.patch --]
[-- Type: text/plain, Size: 562 bytes --]
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 28e7c7c..61aadfc 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -2628,6 +2628,7 @@ static const struct pci_device_id softmodem_blacklist[] = {
{ PCI_VDEVICE(AL, 0x5457), }, /* ALi Corporation M5457 AC'97 Modem */
{ PCI_VDEVICE(MOTOROLA, 0x3052), }, /* Motorola Si3052-based modem */
{ PCI_DEVICE(0x1543, 0x3052), }, /* Si3052-based modem, default IDs */
+ { PCI_DEVICE(0x4348, 0x7053), }, /* wch ch353 2S1P */
};
/*
[-- Attachment #4: 8250.patch --]
[-- Type: text/plain, Size: 971 bytes --]
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 6e1958a..9693d5a 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -980,14 +980,17 @@ static void autoconfig_16550a(struct uart_8250_port *up)
*/
serial_out(up, UART_IER, iersave | UART_IER_UUE);
if (serial_in(up, UART_IER) & UART_IER_UUE) {
- /*
- * It's an Xscale.
- * We'll leave the UART_IER_UUE bit set to 1 (enabled).
- */
- DEBUG_AUTOCONF("Xscale ");
- up->port.type = PORT_XSCALE;
- up->capabilities |= UART_CAP_UUE | UART_CAP_RTOIE;
- return;
+ serial_out(up, UART_IER, iersave | UART_IER_RTOIE);
+ if (serial_in(up, UART_IER) & UART_IER_RTOIE) {
+ /*
+ * It's an Xscale.
+ * We'll leave the UART_IER_UUE bit set to 1 (enabled).
+ */
+ DEBUG_AUTOCONF("Xscale ");
+ up->port.type = PORT_XSCALE;
+ up->capabilities |= UART_CAP_UUE | UART_CAP_RTOIE;
+ return;
+ }
}
} else {
/*
next reply other threads:[~2012-08-28 12:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-28 12:24 gianluca [this message]
2012-08-28 12:55 ` unrecognized multi io pci card Alan Cox
2012-08-28 13:57 ` gianluca
2012-08-29 13:28 ` Alan Cox
2012-08-29 18:24 ` [PATCH] Add PCI IDs and quirks for WCH CH353 2S1P card gianluca
2012-09-05 23:38 ` Greg KH
2012-09-06 6:41 ` gianluca
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=20120828122458.GB1258@server \
--to=gianluca@sottospazio.it \
--cc=gregkh@linuxfoundation.org \
--cc=linux-serial@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).