Skip to contentSkip to conversation

Oxford Semiconductor's OXCB950 in 8250_pci.c

PATCH Mikhail Kolesnik 2 participants 3 messages May 7, 2006 – May 10, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi.

There was a discussion regarding support of OXCB950 in 2.4.x
http://groups.google.com/group/mlist.linux.serial/browse_frm/thread/baf6d48e25662c5/8ab3b1ea12a43420?tvc=1&q=OXCB950#8ab3b1ea12a43420
Somehow changes did not go into the kernel.

Now detailed data sheet is freely available at
http://www.oxsemi.com/oxford/documents/download/standard/dsheets/oxcb950ds.pdf

I own ST Lab RS232 serial port, model C-130. It is a CardBus Type II, 32-bit, 3.3V. After looking into that old discussion I've made the same changes for 2.6.16 kernel:

drivers/serial/8250_pci.c +3 -0
diff -ru linux-2.6.16-orig/drivers/serial/8250_pci.c linux-2.6.16/drivers/serial/8250_pci.c
@@ -2045,6 +2045,9 @@
 	{	PCI_VENDOR_ID_OXSEMI, 0x950a,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b0_2_1130000 },
+	{	PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_CB950,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_1_115200 },
 	{	PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b0_4_115200 },
include/linux/pci_ids.h +1 -0
diff -ru linux-2.6.16-orig/include/linux/pci_ids.h linux-2.6.16/include/linux/pci_ids.h
@@ -1808,6 +1808,7 @@
 #define PCI_VENDOR_ID_OXSEMI		0x1415
 #define PCI_DEVICE_ID_OXSEMI_12PCI840	0x8403
 #define PCI_DEVICE_ID_OXSEMI_16PCI954	0x9501
+#define PCI_DEVICE_ID_OXSEMI_CB950      0x950B /* OXCB950 Cardbus 16950 UART */
 #define PCI_DEVICE_ID_OXSEMI_16PCI95N	0x9511
 #define PCI_DEVICE_ID_OXSEMI_16PCI954PP	0x9513
 #define PCI_DEVICE_ID_OXSEMI_16PCI952	0x9521

Is it enough for such card to work?
(Unfortunately, I do not have enough experience to implement complex kernel things)

After applying the patch driver recognizes the card:
pccard: CardBus card inserted into slot 0
PCI: Enabling device 0000:07:00.0 (0000 -> 0003)
ACPI: PCI Interrupt 0000:07:00.0[A] -> Link [LNKA] -> GSI 11 (level,low) -> IRQ 11
ttyS4: detected caps 00000700 should be 00000100
0000:07:00.0: ttyS4 at I/O 0x3010 (irq = 11) is a 16C950/954

The problem is that card only works with baud rates from 50 to 2400. The card is connected to a common external modem, which is known to work with any reasonable rates in other PC.

C-Kermit>set line /dev/ttyS4
C-Kermit>set carrier-watch off
C-Kermit>set speed 2400
C-Kermit>connect
works... but setting any higher rate results in non responding modem. I've also tried connecting the card to devices with fixed serial
parameters: 9600 8N1. No response too.

Using wvdial with ANY Baud from 300 to 2400 results in:
"CONNECT 230400/V34/LAPM/V42B/TX=28800/RX=31200"
On Baud=2400 download speed easily exceeds 2400bps, but Baud=300 and baud=1200 speed is limited as it should be. Very strange behavior.

That leads to an idea of changing divider...

'User Manual' supplied with the card says that I should use 'Automatic Crystal Detection' in WinME and '1.8432 MHz' in 2K/XP. Baud rate divider(prescaler) value in both cases should be '8.625'. It works in XP with suggested settings.
As far as I know setting such things with setserial for CardBus devices is not a good idea.

Any suggestions?

Relevant lspci entry:
07:00.0 Serial controller: Oxford Semiconductor Ltd OXCB950 Cardbus 16950 UART (prog-if 06 [16950])

	Subsystem: Oxford Semiconductor Ltd Unknown device 0001
	Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
	Interrupt: pin A routed to IRQ 11
	Region 0: I/O ports at 3010 [size=8]
	Region 1: Memory at 34000000 (32-bit, non-prefetchable) [size=4K]
	Region 2: I/O ports at 3000 [size=16]
	Region 3: Memory at 34001000 (32-bit, non-prefetchable) [size=4K]
	Region 4: Memory at 34002000 (32-bit, non-prefetchable) [size=4K]
	Capabilities: [40] Power Management version 1
		Flags: PMEClk- DSI- D1- D2+ AuxCurrent=0mA PME(D0+,D1-,D2+,D3hot+,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Signature · 5 lines
Mikhail Kolesnik
ICQ: 260259143
IRC: mike_k at freenode/#crux, rusnet/#yalta
Jabber: [email protected]
NIC handle: MKK83-UANIC
#1 lore raw
Quoted 3 lines · Mikhail Kolesnik

There was a discussion regarding support of OXCB950 in 2.4.x
http://groups.google.com/group/mlist.linux.serial/browse_frm/thread/baf6d48e25662c5/8ab3b1ea12a43420?tvc=1&q=OXCB950#8ab3b1ea12a43420
Somehow changes did not go into the kernel.

Probably because the 8250_pci split happened prior to this discussion and it therefore got missed.

drivers/serial/8250_pci.c line 2050

Quoted 10 lines

diff -ru linux-2.6.16-orig/drivers/serial/8250_pci.c linux-2.6.16/drivers/serial/8250_pci.c

drivers/serial/8250_pci.c +3 -0
@@ -2045,6 +2045,9 @@
 	{	PCI_VENDOR_ID_OXSEMI, 0x950a,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b0_2_1130000 },
+	{	PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_CB950,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_1_115200 },

This should probably be pbn_b0_1_115200?

Quoted 15 lines
drivers/serial/8250_pci.c +0 -0
 	{	PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b0_4_115200 },

diff -ru linux-2.6.16-orig/include/linux/pci_ids.h linux-2.6.16/include/linux/pci_ids.h

include/linux/pci_ids.h +1 -0
@@ -1808,6 +1808,7 @@
 #define PCI_VENDOR_ID_OXSEMI		0x1415
 #define PCI_DEVICE_ID_OXSEMI_12PCI840	0x8403
 #define PCI_DEVICE_ID_OXSEMI_16PCI954	0x9501
+#define PCI_DEVICE_ID_OXSEMI_CB950      0x950B /* OXCB950 Cardbus 16950 UART */
 #define PCI_DEVICE_ID_OXSEMI_16PCI95N	0x9511
 #define PCI_DEVICE_ID_OXSEMI_16PCI954PP	0x9513
 #define PCI_DEVICE_ID_OXSEMI_16PCI952	0x9521
Quoted 1 line

Is it enough for such card to work?

That should be all that's required.

Quoted 3 lines

The problem is that card only works with baud rates from 50 to 2400. The card is connected to a common external modem, which is known to work with any reasonable rates in other PC.

Odd. Maybe the port isn't clocked at the usual frequency, and 115200 is the wrong base.

Quoted 2 lines

'User Manual' supplied with the card says that I should use 'Automatic Crystal Detection' in WinME and '1.8432 MHz' in 2K/XP.

Well, 1.8432MHz corresponds with a base of 115200, so that's not wrong. IS your modem showing the DTE speed in that connect line? If so, 2400 baud seems to actually correspond with 230400 baud, which would be a rather interesting state of affairs. What does setserial -bav /dev/ttyS4 say?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#2 lore raw
Quoted 7 lines · On Wed, 10 May 2006 17:36:32 +0100 Russell King <[email protected]> wrote:

drivers/serial/8250_pci.c line 2050

Quoted 4 lines · Mikhail Kolesnik

...

drivers/serial/8250_pci.c +3 -0
+	{	PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_CB950,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_1_115200 },

This should probably be pbn_b0_1_115200?

The reason was (from the discussion mentioned):

Quoted 4 lines

pbn_b0_bt_1_115200 has been used instead
of pbn_b0_1_115200, because the latter is identical to pbn_default, and the effect should be the same since OXCB950 is single-port.

Seems it is not the problem here (as card partially works). Or should I try changing it?

Quoted 6 lines
Quoted 3 lines

The problem is that card only works with baud rates from 50 to 2400. The card is connected to a common external modem, which is known to work with any reasonable rates in other PC.

Odd. Maybe the port isn't clocked at the usual frequency, and 115200 is the wrong base.

Is that datasheet of any use here?

Quoted 5 lines

Well, 1.8432MHz corresponds with a base of 115200, so that's not wrong. IS your modem showing the DTE speed in that connect line? If so, 2400 baud seems to actually correspond with 230400 baud, which would be a rather interesting state of affairs. What does setserial -bav /dev/ttyS4 say?

Yes, the first number is 'DTE data rate' (but modem's chip datasheet claims it does not support DTE higher than 115200). Note, with ANY baud from 300 to 2400 result is:
"CONNECT 230400/Vxx/LAPM/Vxxx/TX=xxxxx/RX=xxxxx"
But bauds lower than 1200 do really limit speed.

# setserial -bav /dev/ttyS4
/dev/ttyS4, Line 4, UART: 16950/954, Port: 0x3010, IRQ: 11
        Baud_base: 115200, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal skip_test

Changing divisor to 8.625 (it is reported to be '8') gave nothing.

BTW, I have many devices using IRQ 11, hope that is not causing weird things? This Laptop's bios is not a good helper here...

# lspci -v | grep "IRQ\ 11" | wc -l
7

Anything else I can do here?

Signature · 5 lines
Mikhail Kolesnik
ICQ: 260259143
IRC: mike_k at freenode/#crux, rusnet/#yalta
Jabber: [email protected]
NIC handle: MKK83-UANIC