Subject: need help with PCMCIA code
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 10/07/2001 22:59:00
Hi,
I have a Xircom REM56G-100 (ethernet 10/100 + modem 56) in hands, and I'm
trying to get it working.
The ethernet part isn't hard, I got it working with minor hacking to
if_xi.c.  Now I'm trying to get the modem working.

The problem I have is with the mapping in I/O or memory space. I'm not sure
how it works with pcmcia. To make things harder if_xi uses a hack to
apply a quirk to the PCMCIA CIS instead of using the generic one.
In the attach function it changes ccr_base & ccr_mask, and reinit the
CFE list with a fake CFE.

The CIS info provided by the card is:
pcmcia0: CIS version PC Card Standard 5.0
pcmcia0: CIS info: Xircom, CreditCard Ethernet 10/100 + Modem 56, CEM56, 1.00
pcmcia0: Manufacturer code 0x105, product 0x110a
pcmcia0: function 0: serial port, ccr addr ff80 mask 67
pcmcia0: function 0, config table entry 39: I/O card; irq mask 8ebc; iomask a, i
ospace 2e8-2ef; mwait_required rdybsy_active io8 io16 irqshare irqpulse irqlevel
 powerdown
pcmcia0: function 0, config table entry 31: I/O card; irq mask 8ebc; iomask a, i
ospace 3e8-3ef; mwait_required rdybsy_active io8 io16 irqshare irqpulse irqlevel
 powerdown
pcmcia0: function 0, config table entry 23: I/O card; irq mask 8ebc; iomask a, i
ospace 2f8-2ff; mwait_required rdybsy_active io8 io16 irqshare irqpulse irqlevel
 powerdown
pcmcia0: function 0, config table entry 15: I/O card; irq mask 8ebc; iomask a, i
ospace 3f8-3ff; mwait_required rdybsy_active io8 io16 irqshare irqpulse irqlevel
 powerdown
pcmcia0: function 0, config table entry 63: I/O card; irq mask 8ebc; iomask 3, i
ospace 0-7; mwait_required rdybsy_active io8 io16 irqshare irqpulse irqlevel pow
erdown
pcmcia0: function 1: network adapter, ccr addr 0 mask 0

So pretty much standart COM entry, although the ethernet part is also part
of funtion 0 (and attaching com_pcmcia to this adapter doesn't give a working
modem, but that's another problem :)
To get ethernet to work if_xi chnages ccr_base to 0x800, ccr_mask to 0x67,
kill the CFE list and builds one with just IRQ mask set to 0x8eb0
(no I/O space). cfe number is set to 5 (I'm not sure this is important) and
cfe->flags to 0 (which looks wrong, but it works).
Now if I try to do this in the generic quirk system, the ethernet part
stop working: it doesn't detect the PHY any more, which makes me think that
the driver can't read/write to the chip registers properly.
So the pcmcia system is doing something before xi_attach is called which makes
the adapter work (but I don't know what).

The linux driver also maps CCR at offset 0x800 to get access to the card
registers, but I think it leaves the original mapping here, to access the
modem part. Is there a way to do this in the NetBSD PCMCIA framework ?

BTW, if someone has a general document on how PCMCIA works, I'm interested.
I'm not sure what CCR is :)

--
Manuel Bouyer <bouyer@antioche.eu.org>
--