linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Oxford Semiconductor's OXCB950 in 8250_pci.c
@ 2006-05-07 19:59 Mikhail Kolesnik
  2006-05-10 16:36 ` Russell King
  0 siblings, 1 reply; 4+ messages in thread
From: Mikhail Kolesnik @ 2006-05-07 19:59 UTC (permalink / raw)
  To: linux-serial; +Cc: rmk+serial

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:
diff -ru linux-2.6.16-orig/drivers/serial/8250_pci.c linux-2.6.16/drivers/serial/8250_pci.c
--- linux-2.6.16-orig/drivers/serial/8250_pci.c	2006-03-23 13:32:17.000000000 +0200
+++ linux-2.6.16/drivers/serial/8250_pci.c	2006-03-23 13:39:08.000000000 +0200
@@ -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 },
diff -ru linux-2.6.16-orig/include/linux/pci_ids.h linux-2.6.16/include/linux/pci_ids.h
--- linux-2.6.16-orig/include/linux/pci_ids.h	2006-03-23 13:32:24.000000000 +0200
+++ linux-2.6.16/include/linux/pci_ids.h	2006-03-23 13:40:32.000000000 +0200
@@ -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-


-- 
Mikhail Kolesnik
ICQ: 260259143
IRC: mike_k at freenode/#crux, rusnet/#yalta
Jabber: mike_k@jabber.lafox.net
NIC handle: MKK83-UANIC

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Oxford Semiconductor's OXCB950 in 8250_pci.c
  2006-05-07 19:59 Mikhail Kolesnik
@ 2006-05-10 16:36 ` Russell King
  2006-05-10 18:10   ` Mikhail Kolesnik
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King @ 2006-05-10 16:36 UTC (permalink / raw)
  To: Mikhail Kolesnik; +Cc: linux-serial

On Sun, May 07, 2006 at 10:59:42PM +0300, Mikhail Kolesnik wrote:
> 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.

> diff -ru linux-2.6.16-orig/drivers/serial/8250_pci.c linux-2.6.16/drivers/serial/8250_pci.c
> --- linux-2.6.16-orig/drivers/serial/8250_pci.c	2006-03-23 13:32:17.000000000 +0200
> +++ linux-2.6.16/drivers/serial/8250_pci.c	2006-03-23 13:39:08.000000000 +0200
> @@ -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?

>  	{	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
> --- linux-2.6.16-orig/include/linux/pci_ids.h	2006-03-23 13:32:24.000000000 +0200
> +++ linux-2.6.16/include/linux/pci_ids.h	2006-03-23 13:40:32.000000000 +0200
> @@ -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?

That should be all that's required.

> 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.

> '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?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Oxford Semiconductor's OXCB950 in 8250_pci.c
  2006-05-10 16:36 ` Russell King
@ 2006-05-10 18:10   ` Mikhail Kolesnik
  0 siblings, 0 replies; 4+ messages in thread
From: Mikhail Kolesnik @ 2006-05-10 18:10 UTC (permalink / raw)
  To: Russell King; +Cc: linux-serial

On Wed, 10 May 2006 17:36:32 +0100
Russell King <rmk@arm.linux.org.uk> wrote:

> On Sun, May 07, 2006 at 10:59:42PM +0300, Mikhail Kolesnik wrote:
> > ...
> > +	{	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):
> 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?

> > 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?

> 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?


-- 
Mikhail Kolesnik
ICQ: 260259143
IRC: mike_k at freenode/#crux, rusnet/#yalta
Jabber: mike_k@jabber.lafox.net
NIC handle: MKK83-UANIC

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Oxford Semiconductor's OXCB950 in 8250_pci.c
@ 2006-05-21 10:20 Mikhail Kolesnik
  0 siblings, 0 replies; 4+ messages in thread
From: Mikhail Kolesnik @ 2006-05-21 10:20 UTC (permalink / raw)
  To: linux-serial; +Cc: rmk+serial

On Wed, 10 May 2006 20:20:49 +0100
Russell King <rmk@arm.linux.org.uk> wrote:

> > > This should probably be pbn_b0_1_115200?
> > 
> > The reason was (from the discussion mentioned):
> > > 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?
> 
> The reason given there is no longer valid, and is just a preference.
Changed.
 
> What happens if you:
> 
> 1. setserial /dev/ttyS4 spd_cust divisor 104
> 2. set the baud rate to 38400 baud
I got 9600!

> If what I think has happened is correct, 104 should approximate 9600 baud,
> 52 should approximate 19200 baud, 26 should be 38400 baud, and 17 should
> approximate 57600 baud.
Yes, all this is correct, 'CONNECT...' string is the same as in MS Win.
Thanks!

What should be done to avoid such tricks in userspace and how to get
full 'divisor <-> result rate' list?

> It would be helpful if you could confirm that the modem does report the
> real DTE data rate under Windows.
Results:
 'Port set to'  'Modem Reports on connect (first is DTE rate)'
  300            CONNECT 230400/V34/LAPM/V42B/TX=28800/RX=31200
  1200           CONNECT 230400/V34/LAPM/V42B/TX=28800/RX=31200
  2400           CONNECT 230400/V34/LAPM/V42B/TX=28800/RX=31200
  4800           CONNECT 4800/V34/LAPM/V42B/TX=4800/RX=4800
  9600           CONNECT 9600/V34/LAPM/V42B/TX=9600/RX=9600
  19200          CONNECT 19200/V34/LAPM/V42B/TX=19200/RX=19200
  38400          CONNECT 38400/V34/LAPM/V42B/TX=28800/RX=31200
  57600          CONNECT 57600/V34/LAPM/V42B/TX=28800/RX=31200
  115200         CONNECT 115200/V34/LAPM/V42B/TX=28800/RX=31200
It seems to be real from 4800 to 115200 (with the same serial card).
On speeds lower than 4800 it looks odd as I can not talk to modem on
such speed.


-- 
Mikhail Kolesnik
ICQ: 260259143
IRC: mike_k at freenode/#crux, rusnet/#yalta
Jabber: mike_k@jabber.lafox.net
NIC handle: MKK83-UANIC

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-05-21 10:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-21 10:20 Oxford Semiconductor's OXCB950 in 8250_pci.c Mikhail Kolesnik
  -- strict thread matches above, loose matches on Subject: below --
2006-05-07 19:59 Mikhail Kolesnik
2006-05-10 16:36 ` Russell King
2006-05-10 18:10   ` Mikhail Kolesnik

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).