# PCMCIA, WG511, 2.6 kernel - what do I need...?

## bLaXe

Ok, I'm trying to get gentoo to play nice on my epia MII system.

I have a netgear wg511 pcmcia wireless card that I need to use. I have discovered that I have the 'version3' variant of the card, which does not work with the prism54 driver. I have been told that I can use ndiswrapper with this card (I have the driver cd supplied with the card).

However, I am rather confused about exactly what I need to get pcmcia working. I am using the 2.6.9-epia0 kernel, built from the sources installed via this ebuild. I am planning to reinstall the whole system, as I'm not really sure what I have installed (since I've spent a week messing about with various drivers etc). I don't need the wireless card to install, but I will need it when the system is in use, so I want to get it working before I start installing anything else.

Could someone tell me step by step what I need to compile into the kernel, what I need to compile as modules and what services (hotplug..? etc) I need to install. Please.... I'm tearing my hair out over this...

I can post dmesg, lsmod from a livecd, or anything else that would help... 

Any help would be much apreshitated.

----------

## luckyluke3310

i use my wg511 with Prism54 without problem but i don't know which version i have, i will check it this evening

----------

## bLaXe

 *luckyluke3310 wrote:*   

> i use my wg511 with Prism54 without problem but i don't know which version i have, i will check it this evening

 

I expect you do - the earlier version of the card are suppost to work fine with the prims54 driver.

What I'm confused about it what I need to do to get PCMCIA working. A lot of what I've read seems to be contradictory.

I can't seem to find anything that addresses what you need for PCMCIA on a 2.6.x series kernel.

Can anyone enlighten me?

----------

## Codo

I have that card as well and works like a charm with ndiswrapper.

** Disable SMP in your kernel (or you will hang your computer) **

```
$> ACCEPT_KEYWORDS="~x86" emerge ndiswrapper

$> emerge wireless-tools

$> ndiswrapper -i [your-path-to-windows-inf-file]
```

and edit /etc/modules.d/ndiswrapper and uncomment the alias

then, run

```
modules-update
```

and you're ready to go.

I am using wpa-supplicant as well, and it works very, very good.

have a look at

https://forums.gentoo.org/viewtopic.php?t=259485&highlight=

https://forums.gentoo.org/viewtopic.php?t=258787&highlight=

and very important, Top wi-fi guide:

https://forums.gentoo.org/viewtopic.php?t=122435

And, the card is not PCMCIA (16bit), is CARDBUS (32 bit).  Enable yenta-compatible in your kernel (or the chipset you have)

----------

## bLaXe

Is that all I need to be enabled in the kernel then? Just the yenta support? Oh and yes, my controller is yenta compatible. It's an epia m2 board in case that matters.

Do I need pcmcia-cs or hotplug?

Is there a way I can tell if I have my pcmcia/carbus controller working ok?

I'm somewhat confused.

----------

## Codo

put support for hotplugging, and then do:

```
emerge hotplug
```

everything is the gentoo docs...

do a lsmod to see if yenta gets autoloaded and when you plug your card check /var/log/messages...

----------

## bLaXe

 *Codo wrote:*   

> everything is the gentoo docs...

 

I'll have another good read through the handbook etc tonight and give it another try. I had consulted the docs before, but I'd got confused about what was need for a 2.6 kernel.

Thanks for your help.

----------

## bLaXe

Ok, so I've emerged ndiswrapper (~x86) and wireless-tools.

```
# ndiswrapper -l

netwg511        driver present, hardware present
```

So I guess ndiswrapper is working ok. However, iwconfig does not show up wlan0,  only eth0 (wired NIC) and lo. I have uncommented the alias in the /etc/modules.d/ndiswrapper file, as you suggested. So I'm assuming that something is not right with the WG511.

I have not installed hotplug (do I need this?), however I have added the yenta_socket modules to the /etc/modules.autoload.d/kernel-2.6 file and checked that this autooads the pcmcia_core module as well.

From examining the output from dmesg I spotted:

```
Linux Kernel Card Services

  options:  [pci] [cardbus] [pm]

ACPI: PCI interrupt 0000:00:0a.0[A] -> GSI 5 (level, low) -> IRQ 5

Yenta: CardBus bridge found at 0000:00:0a.0 [1106:aa01]

Yenta: ISA IRQ mask 0x0c00, PCI irq 5

Socket status: 30000820

ACPI: PCI interrupt 0000:00:0a.1[B] -> GSI 5 (level, low) -> IRQ 5

Yenta: CardBus bridge found at 0000:00:0a.1 [1106:aa01]

Yenta: ISA IRQ mask 0x0c00, PCI irq 5

Socket status: 30000006

PCI: Failed to allocate mem resource #0:2000@de004000 for 0000:02:00.0
```

By looking at lspci -v I have determined that 0000:02:00.0 is indeed the WG511

```
0000:02:00.0 Network controller: Intersil Corporation Intersil ISL3890 [Prism GT/Prism Duette] (rev 01)

        Subsystem: Netgear WG511 Wireless Adapter

        Flags: medium devsel, IRQ 5

        [virtual] Memory at de004000 (32-bit, non-prefetchable) [disabled]

        Capabilities: [dc] Power Management version 1
```

I'm lost as to where to go from here? I'm guessing (more of a stab in the dark really) that I need change the memory range that is allocated to the card, but I have no idea how I would go about doing this.

----------

## Codo

Did you run $> modules-update?

I would recommend installing hotplug and coldplug.  It automatically handles everything for you, so you don't have to edit modules.autoload.  Everything will get autodetected at bootup.

```
emerge hotplug coldplug
```

Could you post the output of 

```
$> ifconfig -a
```

----------

## bLaXe

I did indeed run modules-update, and as requested:

```
mu root # ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:40:63:D4:CB:50  

          inet addr:192.168.6.99  Bcast:192.168.6.255  Mask:255.255.255.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:5175 errors:0 dropped:0 overruns:0 frame:0

          TX packets:7407 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:404232 (394.7 Kb)  TX bytes:2082106 (1.9 Mb)

          Interrupt:5 Base address:0x2000 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
```

Although I'm (almost) certain that the problem is related to how the kernel is allocating memory to the card rather than a problem with ndiswrapper since this error

```
PCI: Failed to allocate mem resource #0:2000@de004000 for 0000:02:00.0

```

happens well before ndiswrapper would start.

I'm thinking that either; A) this memory range is already used by something else, or B) this memory range is non-existant (or possibly in a 'hole').

I'll have a go at trying to fix this and let you know how I get on, but first, more coffee!

----------

## Codo

Boot with your card out and check /var/log/messages for errors.  Then plug it in, and everything should be autoloaded (hotplug, coldplug).  Check again.

If you installed prism54, etc... make sure it is well uninstalled and remove modules from /lib/modules/${VERSION}, as the manufacturer hasn't updated the PCIID, and the driver thinks it should get loaded (prism54).

----------

## bLaXe

Well, I've got it working! It was in fact a problem with the memory allocation for the card.

I was sure it was a problem with the memory range that the card was trying to access being invalid. As stated above, lspci -v showed that the card was looking for memory at 0:2000@de004000. I checked this range against the ram map that dmesg gave:

```
BIOS-provided physical RAM map:

 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)

 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)

 BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)

 BIOS-e820: 0000000000100000 - 000000000dff0000 (usable)

 BIOS-e820: 000000000dff0000 - 000000000dff3000 (ACPI NVS)

 BIOS-e820: 000000000dff3000 - 000000000e000000 (ACPI data)

 BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)
```

After much head scratching I realised that this range was not in the ram map - it is in a memory hole! Why there is memory hole I don't know, and I don't have the time to find out. Anyway, a quick bit of googling revealed a post on the viaarena forums metioning a way around this problem (clicky for link). Apparently the problem is caused by the Ricoh PCI -> PCMCIA bridge chip misbehaving in linux. Anyway, here's what I did to get the thing working.

I needed to parse a param to the kernel to 'patch' the memory hole - but forcing the kernel to reserve a chunk of memory. I deduced (well, guessed) the start point and length for the memory to reserve from the range that I got from lspci -l. To reserve the memory all that is needed is to add a param to the 'kernel' line in grub.conf.

So this...

```
kernel /kernel-2.6.9-epia0 root=/dev/hda3
```

...becomes this...

```
kernel /kernel-2.6.9-epia0 reserve=0xde004000,0x8000 root=/dev/hda3
```

Where 0xde004000 is the start of the range and 0x8000 is the length. I had tried with 0x2000 as the length, as this is the length that the card appeared to be expecting but it didn't seem to like (although it gave a different error message) it so I made it much larger and tried again.

After a reboot using the 'reserve' param, lspci -v shows:

```
0000:02:00.0 Network controller: Intersil Corporation Intersil ISL3890 [Prism GT/Prism Duette] (rev 01)

        Subsystem: Netgear WG511 Wireless Adapter

        Flags: bus master, medium devsel, latency 56, IRQ 5

        Memory at 10400000 (32-bit, non-prefetchable)

        Capabilities: [dc] Power Management version 1
```

And iwconfig reports:

```
wlan0     IEEE 802.11g  ESSID:"TOM-WAP"  

          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:0F:66:11:2B:DA   

          Bit Rate:48 Mb/s   Tx-Power:32 dBm   

          RTS thr:2347 B   Fragment thr:2346 B   

          Encryption key:off

          Power Management:off

          Link Quality:100/100  Signal level:-66 dBm  Noise level:-256 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:3  Invalid misc:8877   Missed beacon:0
```

Success!!!  :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

That's without hotplug or doing anything with the wireless config scripts - it found the AP straight away. I love it when a plan comes together...

I don't need hotplug imho, as this is going to be the systems main network interface I'm not planning on removing the card and it seems to work fine without it.

Thanks for the help Codo - apreshiated  :Smile: 

----------

## Codo

Congratulations!   :Razz: 

----------

