Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Mar 2003 16:12:12 +0100
From:      Andrea Franceschini <andrea.franceschini@postecom.it>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Wireless PCI card
Message-ID:  <20030320151212.GB1773@postecom.it>
In-Reply-To: <3E56751C.329F9C56@mindspring.com>
References:  <5.2.0.9.0.20030217091242.05b184b0@marble.sentex.ca> <20030220145612.GA3042@postecom.it> <3E5500FC.89B8D990@mindspring.com> <20030221183257.GA4279@postecom.it> <3E56751C.329F9C56@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 21, 2003 at 10:51:08AM -0800, Terry Lambert wrote:
> Andrea Franceschini wrote:
> > > So... going back to Alfred's question: what did the vendor say about
> > > the PCI card not claiming a memory window?
> > >
> > Who's supposed to reply this question?
> > I could try to contact the Sohoware but, due my poor PCI knowlwdge, I
> > wouldn't know what to ask for.:(
> > 
> > Can you give me more details ,about what the problem seems to be?
> 
> 
> 	Hello, company who makes the card I bought.
> 
> 	Your card's PCI information seems to indicate that it does
> 	not need a memory region in order to operate.
> 
> 	How can this be?
> 
> 	Do I have a defective card?
> 
> 	Can I flash the card memory with an updated version of card
> 	BIOS or something, in order to fix this problem?
> 
> 	If so, where can I obtain a utility to do this?
> 
> 	Thanks,
> 	Andrea Franceschini
> 
> -- Terry
> 

Just to not left this thread unfinished.
This is the reply from Sohoware:

"Andrea,

Due to the very limited information you have provided, we are unsure what
you are trying to say.  Please provide us with the following information:

1.  What OS are you running?
2.  What error message are you getting when you are trying to install the
card?
3.  Where did you buy the card from?

Regards,

Tech Support "

And this is my answer:

-----------------------------

> 1.  What OS are you running?

I'm running FreeBSD 4.7 which supports Prism2/2.5 based cards.
The card I have is a NCP130 that should be Prism based.Shouldn't it?

>2.  What error message are you getting when you are trying to install the
card?

The message i got is:
wi0: No I/O space?!
device_probe_and_attach: wi0 attach returned 6

Usually this problem comes out when the PCI card doesn't claim IO space in
the resource list,while local registers and attribute memory can both be
found.
How's this possible?
Do you have any clue?
Are these informations placed elsewhere?

>3.  Where did you buy the card from?

I bought it from E-Bay, the card was still sealed.

>
> Regards,

------------------------------

And Finally the obvious Answer :(

------------------------------

Andrea,

Yes the NCP130 is has the Prism chipset, but we do not provide drivers or
support for Linux user with the CableFREE II series product.

Regards,

------------------------------

I tried asking for further informations but without success... 

So I did further investigations on my own and I found out that the linux driver supports that card!
Using the useful informations about PCI programming found in this book  http://www.xml.com/ldd/chapter/book/index.html , I managed to modify wi driver to make it recognize the card properly.

And ... It works!

This is the patch ,I applied it against 5.0-current ,but it should work on different RELEASES , 'cause that part of code didn't get modified trough versions.
---- CUT HERE ----
diff -crN wi/if_wi_pci.c wi.new/if_wi_pci.c
*** wi/if_wi_pci.c      Wed Jan 15 21:11:31 2003
--- wi.new/if_wi_pci.c  Sat Mar 15 18:50:36 2003
***************
*** 101,106 ****
--- 101,107 ----
        {0x16ab, 0x1102, WI_BUS_PCI_PLX, "Linksys WDT11"},
        {0x1385, 0x4100, WI_BUS_PCI_PLX, "Netgear MA301"},
        {0x1638, 0x1100, WI_BUS_PCI_PLX, "PRISM2STA WaveLAN"},
+       {0x15E8, 0x0131, WI_BUS_PCI_ASIC, "Prism II InstantWave HR PCI card"},
        {0x111a, 0x1023, WI_BUS_PCI_PLX, "Siemens SpeedStream"},
        {0x16ec, 0x3685, WI_BUS_PCI_PLX, "US Robotics 2415"},
        {0, 0, 0, NULL}
***************
*** 150,162 ****
        }
  
        if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
!               error = wi_alloc(dev, WI_PCI_IORES);
!               if (error)
!                       return (error);
! 
!               /* Make sure interrupts are disabled. */
!               CSR_WRITE_2(sc, WI_INT_EN, 0);
!               CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
  
                /* We have to do a magic PLX poke to enable interrupts */
                sc->local_rid = WI_PCI_LOCALRES;
--- 151,168 ----
        }
  
        if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
!               if (sc->wi_bus_type == WI_BUS_PCI_ASIC ) {
!                         error = wi_alloc(dev, WI_PCI_MEMRES); /* with TMC7160 ioaddress is at BAR2 */
!                 } else {
!                         error = wi_alloc(dev, WI_PCI_IORES);
!                 }
!                 if (error)
!                         return (error);
! 
!                 /* Make sure interrupts are disabled. */
!                 CSR_WRITE_2(sc, WI_INT_EN, 0);
!                 CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
! 
  
                /* We have to do a magic PLX poke to enable interrupts */
                sc->local_rid = WI_PCI_LOCALRES;
***************
*** 164,202 ****
                    &sc->local_rid, 0, ~0, 1, RF_ACTIVE);
                sc->wi_localtag = rman_get_bustag(sc->local);
                sc->wi_localhandle = rman_get_bushandle(sc->local);
!               command = bus_space_read_4(sc->wi_localtag, sc->wi_localhandle,
!                   WI_LOCAL_INTCSR);
!               command |= WI_LOCAL_INTEN;
!               bus_space_write_4(sc->wi_localtag, sc->wi_localhandle,
!                   WI_LOCAL_INTCSR, command);
                bus_release_resource(dev, SYS_RES_IOPORT, sc->local_rid,
                    sc->local);
                sc->local = NULL;
  
!               sc->mem_rid = WI_PCI_MEMRES;
!               sc->mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mem_rid,
!                                       0, ~0, 1, RF_ACTIVE);
!               if (sc->mem == NULL) {
!                       device_printf(dev, "couldn't allocate memory\n");
!                       wi_free(dev);
!                       return (ENXIO);
!               }
!               sc->wi_bmemtag = rman_get_bustag(sc->mem);
!               sc->wi_bmemhandle = rman_get_bushandle(sc->mem);
! 
!               /*
!                * From Linux driver:
!                * Write COR to enable PC card
!                * This is a subset of the protocol that the pccard bus code
!                * would do.
!                */
!               CSM_WRITE_1(sc, WI_COR_OFFSET, WI_COR_VALUE); 
!               reg = CSM_READ_1(sc, WI_COR_OFFSET);
!               if (reg != WI_COR_VALUE) {
!                       device_printf(dev, "CSM_READ_1(WI_COR_OFFSET) "
!                           "wanted %d, got %d\n", WI_COR_VALUE, reg);
!                       wi_free(dev);
!                       return (ENXIO);
                }
        } else {
                error = wi_alloc(dev, WI_PCI_LMEMRES);
--- 170,225 ----
                    &sc->local_rid, 0, ~0, 1, RF_ACTIVE);
                sc->wi_localtag = rman_get_bustag(sc->local);
                sc->wi_localhandle = rman_get_bushandle(sc->local);
! 
!                 if (sc->wi_bus_type != WI_BUS_PCI_ASIC ) {
!                         command = bus_space_read_4(sc->wi_localtag, sc->wi_localhandle,
!                             WI_LOCAL_INTCSR);
!                         command |= WI_LOCAL_INTEN;
!                         bus_space_write_4(sc->wi_localtag, sc->wi_localhandle,
!                             WI_LOCAL_INTCSR, command);
!               } else {
!                         bus_space_write_1(sc->wi_localtag, sc->wi_localhandle,0,0x45);
!                         
!                         DELAY(500000);
! 
!                        command = bus_space_read_1(sc->wi_localtag, sc->wi_localhandle,0);
!                         if (command!= 0x45) {
!                                 device_printf(dev, "Initialize the TMC7160 failed. \n");
!                                 wi_free(dev);
!                                 return (ENXIO);
!                         }
!                 }
! 
                bus_release_resource(dev, SYS_RES_IOPORT, sc->local_rid,
                    sc->local);
                sc->local = NULL;
  
!               if (sc->wi_bus_type != WI_BUS_PCI_ASIC ) {
!                       sc->mem_rid = WI_PCI_MEMRES;
!                       sc->mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mem_rid,
!                                               0, ~0, 1, RF_ACTIVE);
!                       if (sc->mem == NULL) {
!                               device_printf(dev, "couldn't allocate memory\n");
!                               wi_free(dev);
!                               return (ENXIO);
!                       }
!                       sc->wi_bmemtag = rman_get_bustag(sc->mem);
!                       sc->wi_bmemhandle = rman_get_bushandle(sc->mem);
! 
!                       /*
!                        * From Linux driver:
!                        * Write COR to enable PC card
!                        * This is a subset of the protocol that the pccard bus code
!                        * would do.
!                        */
!                       CSM_WRITE_1(sc, WI_COR_OFFSET, WI_COR_VALUE); 
!                       reg = CSM_READ_1(sc, WI_COR_OFFSET);
!                       if (reg != WI_COR_VALUE) {
!                               device_printf(dev, "CSM_READ_1(WI_COR_OFFSET) "
!                                   "wanted %d, got %d\n", WI_COR_VALUE, reg);
!                               wi_free(dev);
!                               return (ENXIO);
!                       }
                }
        } else {
                error = wi_alloc(dev, WI_PCI_LMEMRES);
diff -crN wi/if_wireg.h wi.new/if_wireg.h
*** wi/if_wireg.h       Wed Jan 15 21:11:31 2003
--- wi.new/if_wireg.h   Tue Mar 11 23:42:01 2003
***************
*** 97,102 ****
--- 97,103 ----
  #define WI_BUS_PCCARD         0       /* pccard device */
  #define WI_BUS_PCI_PLX                1       /* PCI card w/ PLX PCI/PCMICA bridge */
  #define WI_BUS_PCI_NATIVE     2       /* native PCI device (Prism 2.5) */
+ #define WI_BUS_PCI_ASIC               3       /* PCI card w/ TMD7160 (ASIC) */
  
  /*
   * register space access macros



--- CUT HERE ---

This should work also with other cards of the same breed (TMC7160 based).
I didn't test it thorougly so it may have some problems with particular configurations.
Actually it may have some problems on the init/reset code and it could require some adjustment,but it works for me as it is so... :)

Bye.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030320151212.GB1773>