8250_pci: Add additional WCH CH352 device
PATCH 1/1 8250_pci: Add additional WCH CH352 device
This patch fix a problem XScale port detect code in autoconfig_16550a treat 16550A port as XScale port, caused by CH352 device use the 6th bit(UART_IER_UUE) in IER as a enhance function make this bit w/r.
for the below device:
"
01:08.0 Serial controller: Device 4348:3253 (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 20
Region 0: I/O ports at e010 [size=8]
Region 1: I/O ports at e000 [size=8]
Kernel driver in use: serial
"
[Note: I haven't test this patch, because I can't
access the hardware now, but it should be right]
--- drivers/tty/serial/8250/8250_pci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/tty/serial/8250/8250_pci.c +13 -0
@@ -1557,6 +1557,7 @@ pci_wch_ch353_setup(struct serial_private *priv,#define PCI_DEVICE_ID_WCH_CH353_4S 0x3453#define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046#define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053 +#define PCI_DEVICE_ID_WCH_CH352_2S 0x3253#define PCI_VENDOR_ID_AGESTAR 0x5372#define PCI_DEVICE_ID_AGESTAR_9375 0x6872#define PCI_VENDOR_ID_ASIX 0x9710
@@ -2180,6 +2181,14 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .subdevice = PCI_ANY_ID, .setup = pci_wch_ch353_setup, }, +/* WCH CH352 2S card (16550 clone) */ + { + .vendor = PCI_VENDOR_ID_WCH, + .device = PCI_DEVICE_ID_WCH_CH352_2S, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_wch_ch353_setup, + },/* * ASIX devices with FIFO bug */
@@ -4873,6 +4882,10 @@ static struct pci_device_id serial_pci_tbl[] = {PCI_ANY_ID ,PCI_ANY_ID , 0, 0, pbn_b0_bt_2_115200 }, + { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH352_2S, +PCI_ANY_ID ,PCI_ANY_ID , + 0, 0, pbn_b0_bt_2_115200 }, +/* * Commtech, Inc. Fastcom adapters */
Signature · 1 line
1.7.11.1.116.g8228a23
Quoted 7 lines · Wang YanQing
This patch fix a problem XScale port detect code in
autoconfig_16550atreat 16550A port as XScale port, caused by CH352 device use the 6thbit(UART_IER_UUE)in IER as a enhance function make this bit w/r.
Quoted 14 lines
for the below device:
"
01:08.0 Serial controller: Device 4348:3253 (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 20
Region 0: I/O ports at e010 [size=8]
Region 1: I/O ports at e000 [size=8]
Kernel driver in use: serial
"
[Note: I haven't test this patch, because I can't
access the hardware now, but it should be right]
I have tested it this morning, it works.
Thanks.
Quoted 7 lines · [[PATCH]8250_pci: Add additional WCH CH352 device] On 02/03/2013 (Sat 17:45)…
This patch fix a problem XScale port detect code in
autoconfig_16550atreat 16550A port as XScale port, caused by CH352 device use the 6thbit(UART_IER_UUE)in IER as a enhance function make this bit w/r.
Maybe we should add a bit more data to the short log and long log, based on what you said in the other thread. And also lets put the 352 entry before the existing 353 entries, instead of after it, something like the below...
Paul.
--
Quoted 1 line
From
d92be6ffc95c5947cc7d22d5f0c1382bfb4f0a52Mon Sep 17 00:00:00 2001
From: Wang YanQing <[email protected]>
Date: Sat, 2 Mar 2013 17:45:55 +0800
Subject: [PATCH] 8250_pci: Add WCH CH352 quirk to avoid Xscale detection
The code in 8250.c for detecting ARM/XScale UARTs says:
* Try writing and reading the UART_IER_UUE bit (b6).
* If it works, this is probably one of the Xscale platform's
* internal UARTs.
If the above passes, it then goes on to:
* It's an Xscale.
* We'll leave the UART_IER_UUE bit set to 1 (enabled).
However, the CH352 uses the UART_IER_UUE as the LOWPOWER function, so it is readable and writable. According to the datasheet:
"LOWPOWER:When the bit is 1, close the internal benchmark
clock of serial port to set into low-power status.
So it essentially gets mis-detected as Xscale, and gets powered down in the process. The device in question where this was seen is listed by lspci as:
Serial controller: Device 4348:3253 (rev 10) (prog-if 02 [16550])
Re-using the 353 quirk which just sets flags to fixed and type to 16550 is suitable for fixing the 352 as well.
drivers/tty/serial/8250/8250_pci.c +13 -0
@@ -1554,6 +1554,7 @@ pci_wch_ch353_setup(struct serial_private *priv,#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d#define PCI_VENDOR_ID_WCH 0x4348 +#define PCI_DEVICE_ID_WCH_CH352_2S 0x3253#define PCI_DEVICE_ID_WCH_CH353_4S 0x3453#define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046#define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053
@@ -2180,6 +2181,14 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .subdevice = PCI_ANY_ID, .setup = pci_wch_ch353_setup, }, +/* WCH CH352 2S card (16550 clone) */ + { + .vendor = PCI_VENDOR_ID_WCH, + .device = PCI_DEVICE_ID_WCH_CH352_2S, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_wch_ch353_setup, + },/* * ASIX devices with FIFO bug */
@@ -4869,6 +4878,10 @@ static struct pci_device_id serial_pci_tbl[] = {PCI_ANY_ID ,PCI_ANY_ID , 0, 0, pbn_b0_bt_2_115200 }, + { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH352_2S, +PCI_ANY_ID ,PCI_ANY_ID , + 0, 0, pbn_b0_bt_2_115200 }, +/* * Commtech, Inc. Fastcom adapters */
Signature · 1 line
1.8.1.2