Subject: Re: pcmcia io alloc and map (can this be right?)
To: None <tech-kern@netbsd.org>
From: Sverre Froyen <sverre@viewmark.com>
List: tech-kern
Date: 02/21/2006 21:16:22
--Boundary-00=_WW++DPvQivclUDw
Content-Type: text/plain;
  charset="iso-8859-6"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi again,

Sorry to follow up to my own message.  However, I received a couple of 
suggestions privatly and was able to get the modem card working!

It appears the card was confused being accessed on addresses above 0x4000 (I 
found a note about it only decoding the lower 10 bits, see also the strange 
CCR register values in my original posting).

To get the card to work I did the following: (i) Set the cardbus IO window 
offset to 0x10000-0x4000+0x3f8 and (ii) set the PC card IOBASE to 0x3f8.  
This causes the card to be addressed at base address 0x3f8 rather than 0x4000 
(as assigned by rbus).

I suspect other values than 0x3f8 would work as well.  The 0x3f8 was used 
because it matched the selected config table entry in the card.

Since this modem uses the Lucent/Agere Venus chipset, it is likely that the 
above solution may help with other non-working modem cards as well.

Thanks to Christos and Garrett for helpful comments.

Thanks,

Sverre

PS I've attached a (much shortened) dmesg output.

On Saturday 18 February 2006 11:41, Sverre Froyen wrote:
> Hi,
>
> With a pcmcia modem card (which does not work with NetBSD) I observe the
> following from the dmesg output (attached):
>
> The function pcmcia_function_configure is called.  It calls the following
> functions with the attendant dmesg output in parenthesis:
>
> pcmcia_config_alloc
> 	pccbb_pcmcia_io_alloc
> 		rbus_space_alloc
> 		(addr 3f8, size 8, mask 3ff, align 400)
> 	(alloc port 0x4000+0x8)
> pcmcia_config_map
> 	pcmcia_io_map
> 		pccbb_pcmcia_io_map
> 		(window 0 io8 port 4000+8)
> 			pccbb_pcmcia_do_io_map
> 			(win 0 addr 0x4000 size 0x8 width 8)
> 			(start 00 40, stop 07 40, ioctl 00 enable 40)
>
> When attempting to read or write to the modem, the bus_space read and write
> functions are using a bus_space_tag_t value of 0 (IO space) and a
> bus_addr_t value of 0x43f8.  This appears to conflict with the dmesg output
> from pccbb_pcmcia_io_alloc which says the address space ranges from 0x4000
> to 0x4008 (not including 0x43f8) and also with the output from
> pccbb_pcmcia_do_io_map which maps the same range.
>
> Comments and help are appreciated!
>
> Attached is the dmesg output before inserting the modem card (dmesg) and
> the additional dmesg output when the card is inserted (dmesg_pcmcia).
>
> Thanks,
>
> Sverre

--Boundary-00=_WW++DPvQivclUDw
Content-Type: text/plain;
  charset="iso-8859-6";
  name="dmesg_pcmcia2"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
	filename="dmesg_pcmcia2"

cbb1: 0x00000000 card inserted, 0x30000510
pccbb_pcmcia_socket_enable: 5V card
pccbb_power: CARDBUS_VCC_0V and CARDBUS_VPP_0V [0x44]
pccbb_power: CARDBUS_VCC_5V and CARDBUS_VPP_VCC [0x15]
pccbb_pcmcia_delay: "pccen1" 0x0, sleep 1 ms
pccbb_pcmcia_delay: "pccen2" 0x0, sleep 20 ms
pccbb_pcmcia_delay: "pccwr0" 0x0, sleep 10 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 100 ms
pcmcia1: ++enabled_count = 1
rbus_space_alloc: addr 0, size 1000, mask fff, align 1000
pccbb_pcmcia_alloc_mem: addr 0x40000000 size 0x400, realsize 0x1000
pccbb_pcmcia_mem_map window 0 bus 40000000+0+400 at card addr 0
pccbb_pcmcia_do_mem_map: start 0x40000000 end 0x400003ff off 0xc0000000
pccbb_pcmcia_do_mem_map window 0: 0000 0080 0040 40
pccbb_pcmcia_mem_map window 0 bus 40000000+0+400 at card addr 0
pccbb_pcmcia_do_mem_map: start 0x40000000 end 0x400003ff off 0xc0000000
pccbb_pcmcia_do_mem_map window 0: 0000 0080 0000 40
pcmcia1: CIS version PCMCIA 2.0 or 2.1
pcmcia1: CIS info: Zoom-VENUS, PCMCIA V92 DataFax
pcmcia1: Manufacturer code 0x200, product 0x1
pcmcia1: function 0: serial port, ccr addr ff80 mask 67
pcmcia1: function 0, config table entry 15: I/O card; irq mask 86bc; iomask a, iospace 3f8-3ff; rdybsy_active io8 irqshare irqpulse irqlevel powerdown audio
pcmcia1: function 0, config table entry 23: I/O card; irq mask 86bc; iomask a, iospace 2f8-2ff; rdybsy_active io8 irqshare irqpulse irqlevel powerdown audio
pcmcia1: function 0, config table entry 31: I/O card; irq mask 86bc; iomask a, iospace 3e8-3ef; rdybsy_active io8 irqshare irqpulse irqlevel powerdown audio
pcmcia1: function 0, config table entry 39: I/O card; irq mask 86bc; iomask a, iospace 2e8-2ef; rdybsy_active io8 irqshare irqpulse irqlevel powerdown audio
com3 at pcmcia1 function 0: <Zoom-VENUS, PCMCIA V92 DataFax>
pcmcia_config_alloc: io 0 start=3f8 length=8 align=400 skew=3f8
rbus_space_alloc: addr 3f8, size 8, mask 3ff, align 400
pccbb_pcmcia_io_alloc alloc port 0x4000+0x8
pccbb_pcmcia_io_map window 0 io8 port 4000+8
pccbb_pcmcia_do_io_map win 0 addr 0x4000 size 0x8 width 8
 start 00 40, stop 07 40, ioctl 00 enable 40
pccbb_pcmcia_do_io_map: PCIC_SIA_OFFSET = c3f8
window iobase 4000 iomax 4007
function iobase 4000 iomax 4007
pccbb_intr_establish start. 0x0
pccbb_intr_establish add pil. 0xc143a4a0
pcmcia1: ++enabled_count = 2
cbb1: pccbb_pcmcia_socket_settype 01 type io 70
rbus_space_alloc: addr 0, size 1000, mask fff, align 1000
pccbb_pcmcia_alloc_mem: addr 0x40000000 size 0x14, realsize 0x1000
pccbb_pcmcia_mem_map window 0 bus 40000000+f80+14 at card addr f000
pccbb_pcmcia_do_mem_map: start 0x40000000 end 0x40000f93 off 0xc000f000
pccbb_pcmcia_do_mem_map window 0: 0000 0080 0f40 40
pcmcia1: function 0 CCR at 0 offset f80: 4f 88 ee f8, f8 3 ff ff, ff
com3: ns16550a, working fifo
pcmcia1: --enabled_count = 1
pccbb_intr_disestablish start. 0xc143a4a0
pccbb_intr_disestablish: pil 0xc143a4a0
pccbb_intr_disestablish frees one pil
pccbb_intr_disestablish frees one pil
pccbb_intr_disestablish: no interrupt handler
pccbb_pcmcia_socket_disable
pccbb_power: CARDBUS_VCC_0V and CARDBUS_VPP_0V [0x44]
pccbb_pcmcia_delay: "pccwr1" 0x0, sleep 300 ms
pcmcia1: --enabled_count = 0

--Boundary-00=_WW++DPvQivclUDw--