Updates added to support the ISIL mini-PCI reference design. The PCI part

doesn't work yet, but the changes impact the PCMCIA and PLX parts as well.
I'm checking the changes in because I want the changes that affect PCMCIA
to get wide testing as soon as possible.
This commit is contained in:
mark 2001-07-07 19:48:14 +00:00
parent 110197272f
commit 6fb8eb605e
8 changed files with 585 additions and 200 deletions

View File

@ -473,13 +473,19 @@ $ECHO ""
#=======================================================================
# Should we build for PLX??? based PCI adapters?
ask_bool "Build PLX???? based PCI (_plx) adapter drivers?" WLAN_PLX
ask_bool "Build Prism2 PLX???? based PCI (_plx) adapter drivers?" PRISM2_PLX
$ECHO ""
#=======================================================================
# Should we build for PLX??? based PCI adapters?
# Should we build for PCMCIA Card Services?
ask_bool "Build PCMCIA Card Services (_cs) drivers?" WLAN_PCMCIA
ask_bool "Build Prism2 PCMCIA Card Services (_cs) drivers?" PRISM2_PCMCIA
$ECHO ""
#=======================================================================
# Should we build for Prism2 native PCI?
ask_bool "Build Prism2 PCI (_pci) drivers?" PRISM2_PCI
$ECHO ""
#=======================================================================

View File

@ -2,8 +2,6 @@ WLAN_VERSION=0
WLAN_PATCHLEVEL=1
WLAN_SUBLEVEL=8
WLAN_EXTRAVERSION=-pre12
WLAN_PLX=n
WLAN_PCMCIA=y
LINUX_SRC=/usr/src/linux
WLAN_TARGET_ARCH=
PCMCIA_SRC=
@ -18,3 +16,6 @@ WLAN_DEBUG=n
CROSS_COMPILE_ENABLED=n
CROSS_COMPILE=
HOST_COMPILE=
PRISM2_PLX=y
PRISM2_PCMCIA=y
PRISM2_PCI=y

View File

@ -94,6 +94,13 @@
#define WLAN_ISA 2
#define WLAN_PCI 3
#define WLAN_USB 4
#define WLAN_PLX 5
/* Note: the PLX HOSTIF above refers to some vendors implementations for */
/* PCI. It's a PLX chip that is a PCI to PCMCIA adapter, but it */
/* isn't a real PCMCIA host interface adapter providing all the */
/* card&socket services. */
/* LinuxPPC users! uncomment the following line to build for LinuxPPC */
/* a header file change has created a small problem that will be fixed */

View File

@ -80,14 +80,20 @@ endif
# Source and obj and target definitions
CS_OBJ_DIR=obj_cs
PLX_OBJ_DIR=obj_plx
PCI_OBJ_DIR=obj_pci
SRC=prism2sta.c prism2mgmt.c prism2mib.c hfa384x.c
ifeq ($(WLAN_PLX), y)
ifeq ($(PRISM2_PLX), y)
SRC+=pci-scan.c
endif
ifeq ($(PRISM2_PCI), y)
SRC+=pci-scan.c
endif
CS_MODULE=prism2_cs.o
PLX_MODULE=prism2_plx.o
PCI_MODULE=prism2_pci.o
CS_OBJ= $(CS_OBJ_DIR)/prism2sta.o \
$(CS_OBJ_DIR)/prism2mgmt.o \
@ -100,15 +106,25 @@ PLX_OBJ= $(PLX_OBJ_DIR)/prism2sta.o \
$(PLX_OBJ_DIR)/pci-scan.o \
$(PLX_OBJ_DIR)/hfa384x.o
PCI_OBJ= $(PCI_OBJ_DIR)/prism2sta.o \
$(PCI_OBJ_DIR)/prism2mgmt.o \
$(PCI_OBJ_DIR)/prism2mib.o \
$(PCI_OBJ_DIR)/pci-scan.o \
$(PCI_OBJ_DIR)/hfa384x.o
# List of modules to build
MODULES=
ifeq ($(WLAN_PCMCIA), y)
ifeq ($(PRISM2_PCMCIA), y)
MODULES+=$(CS_MODULE)
endif
ifeq ($(WLAN_PLX), y)
ifeq ($(PRISM2_PLX), y)
MODULES+=$(PLX_MODULE)
endif
ifeq ($(PRISM2_PCI), y)
MODULES+=$(PCI_MODULE)
endif
# Implicit rules to handle the separate obj dirs
$(OBJ_DIR)/%.o : ../shared/%.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
@ -124,6 +140,10 @@ $(PLX_OBJ_DIR)/%.o : %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) \
-DWLAN_HOSTIF=WLAN_PLX $< -o $@
$(PCI_OBJ_DIR)/%.o : %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) \
-DWLAN_HOSTIF=WLAN_PCI $< -o $@
# Compiler Options
ifndef CFLAGS
CFLAGS = -O2 -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe
@ -157,6 +177,7 @@ all : .depend dirs $(MODULES)
dirs :
mkdir -p $(CS_OBJ_DIR)
mkdir -p $(PLX_OBJ_DIR)
mkdir -p $(PCI_OBJ_DIR)
$(CS_MODULE) : $(CS_OBJ)
$(LD) -r -o $@ $(CS_OBJ)
@ -166,12 +187,19 @@ $(PLX_MODULE) : $(PLX_OBJ)
$(LD) -r -o $@ $(PLX_OBJ)
chmod -x $@
$(PCI_MODULE) : $(PCI_OBJ)
$(LD) -r -o $@ $(PCI_OBJ)
chmod -x $@
install : $(MODULES)
ifeq ($(PRISM2_PCMCIA), y)
mkdir -p $(TARGET_MODDIR)/pcmcia
ifeq ($(WLAN_PCMCIA), y)
cp -f $(CS_MODULE) $(TARGET_MODDIR)/pcmcia
endif
ifeq ($(WLAN_PLX), y)
ifeq ($(PRISM2_PCI), y)
cp -f $(PCI_MODULE) $(TARGET_MODDIR)/net
endif
ifeq ($(PRISM2_PLX), y)
cp -f $(PLX_MODULE) $(TARGET_MODDIR)/net
endif
@ -180,16 +208,20 @@ clean:
rm -f core core.* *.o .*.o *.s *.a .depend tmp_make *~ tags
rm -fr $(CS_OBJ_DIR)
rm -fr $(PLX_OBJ_DIR)
rm -fr $(PCI_OBJ_DIR)
rm -fr $(MODULES)
# This probably isn't the best way to handle the dependencies, but it works.
DEPLIST=
ifeq ($(WLAN_PCMCIA), y)
ifeq ($(PRISM2_PCMCIA), y)
DEPLIST+=.depend.cs
endif
ifeq ($(WLAN_PLX), y)
ifeq ($(PRISM2_PLX), y)
DEPLIST+=.depend.plx
endif
ifeq ($(PRISM2_PCI), y)
DEPLIST+=.depend.pci
endif
dep .depend: $(DEPLIST)
cat $(DEPLIST) > .depend
@ -202,11 +234,19 @@ dep .depend: $(DEPLIST)
>> $@ ; \
done
.depend.pci: $(DEP_SRC) ../../../config.mk
rm -f $@
for i in $(DEP_SRC); do \
(/bin/echo -n $(PCI_OBJ_DIR)/ ; \
$(CPP) -DWLAN_HOSTIF=WLAN_PCI -M $(CPPFLAGS) $$i ) \
>> $@ ; \
done
.depend.cs: $(DEP_SRC) ../../../config.mk
rm -f $@
for i in $(DEP_SRC); do \
(/bin/echo -n $(CS_OBJ_DIR)/ ; \
$(CPP) -DWLAN_HOSTIF=WLAN_PCMCIA -M $(CPPFLAGS) $$i ) \
$(CPP) -DWLAN_HOSTIF=PRISM2_PCMCIA -M $(CPPFLAGS) $$i ) \
>> $@ ; \
done

View File

@ -150,7 +150,8 @@ extern int prism2_debug;
* Arguments:
* hw device structure
* irq device irq number
* iobase base address for register access
* iobase i/o base address for register access
* membase memory base address for register access
*
* Returns:
* nothing
@ -160,12 +161,13 @@ extern int prism2_debug;
* Call context:
* process thread
----------------------------------------------------------------*/
void hfa384x_inithw( hfa384x_t *hw, UINT irq, UINT iobase)
void hfa384x_inithw( hfa384x_t *hw, UINT irq, UINT iobase, UINT membase)
{
DBFENTER;
memset(hw, 0, sizeof(hfa384x_t));
hw->irq = irq;
hw->iobase = iobase;
hw->membase = membase;
hw->bap = HFA384x_BAP_PROC;
spin_lock_init(&(hw->cmdlock));
spin_lock_init(&(hw->baplock[0]));
@ -1480,31 +1482,31 @@ int hfa384x_cmd_aux_enable(hfa384x_t *hw)
spin_lock_irqsave( &(hw->cmdlock), flags);
/* wait for cmd the busy bit to clear */
timeout = jiffies + 1*HZ;
reg = wlan_inw_le16_to_cpu(HFA384x_CMD(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CMD);
while ( HFA384x_CMD_ISBUSY(reg) &&
time_before( jiffies, timeout) ) {
reg = wlan_inw_le16_to_cpu(HFA384x_CMD(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CMD);
}
if (!HFA384x_CMD_ISBUSY(reg)) {
/* busy bit clear, it's OK to write to ParamX regs */
wlan_outw_cpu_to_le16(HFA384x_AUXPW0,
HFA384x_PARAM0(hw->iobase));
wlan_outw_cpu_to_le16(HFA384x_AUXPW1,
HFA384x_PARAM1(hw->iobase));
wlan_outw_cpu_to_le16(HFA384x_AUXPW2,
HFA384x_PARAM2(hw->iobase));
hfa384x_setreg(hw, HFA384x_AUXPW0,
HFA384x_PARAM0);
hfa384x_setreg(hw, HFA384x_AUXPW1,
HFA384x_PARAM1);
hfa384x_setreg(hw, HFA384x_AUXPW2,
HFA384x_PARAM2);
/* Set the aux enable in the Control register */
wlan_outw_cpu_to_le16(HFA384x_CONTROL_AUX_DOENABLE,
HFA384x_CONTROL(hw->iobase));
hfa384x_setreg(hw, HFA384x_CONTROL_AUX_DOENABLE,
HFA384x_CONTROL);
/* Now wait for completion */
timeout = jiffies + 1*HZ;
reg = wlan_inw_le16_to_cpu(HFA384x_CONTROL(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CONTROL);
while ( ((reg & (BIT14|BIT15)) != HFA384x_CONTROL_AUX_ISENABLED) &&
time_before(jiffies,timeout) ){
udelay(10);
reg = wlan_inw_le16_to_cpu(HFA384x_CONTROL(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CONTROL);
}
if ( (reg & (BIT14|BIT15)) == HFA384x_CONTROL_AUX_ISENABLED ) {
result = 0;
@ -1549,19 +1551,19 @@ int hfa384x_cmd_aux_disable(hfa384x_t *hw)
if (hw->auxen) return 0;
/* Clear the aux enable in the Control register */
wlan_outw(0, HFA384x_PARAM0(hw->iobase));
wlan_outw(0, HFA384x_PARAM1(hw->iobase));
wlan_outw(0, HFA384x_PARAM2(hw->iobase));
wlan_outw_cpu_to_le16(HFA384x_CONTROL_AUX_DODISABLE,
HFA384x_CONTROL(hw->iobase));
hfa384x_setreg(hw, 0, HFA384x_PARAM0);
hfa384x_setreg(hw, 0, HFA384x_PARAM1);
hfa384x_setreg(hw, 0, HFA384x_PARAM2);
hfa384x_setreg(hw, HFA384x_CONTROL_AUX_DODISABLE,
HFA384x_CONTROL);
/* Now wait for completion */
timeout = jiffies + 1*HZ;
reg = wlan_inw_le16_to_cpu(HFA384x_CONTROL(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CONTROL);
while ( ((reg & (BIT14|BIT15)) != HFA384x_CONTROL_AUX_ISDISABLED) &&
time_before(jiffies,timeout) ){
udelay(10);
reg = wlan_inw_le16_to_cpu(HFA384x_CONTROL(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CONTROL);
}
if ((reg & (BIT14|BIT15)) == HFA384x_CONTROL_AUX_ISDISABLED ) {
result = 0;
@ -1819,26 +1821,21 @@ int hfa384x_copy_from_bap(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset,
(len > HFA384x_BAP_DATALEN_MAX) ){
result = -EINVAL;
} else {
selectreg = (bap == 1) ?
HFA384x_SELECT1(hw->iobase) :
HFA384x_SELECT0(hw->iobase) ;
offsetreg = (bap == 1) ?
HFA384x_OFFSET1(hw->iobase) :
HFA384x_OFFSET0(hw->iobase) ;
datareg = (bap == 1) ?
HFA384x_DATA1(hw->iobase) :
HFA384x_DATA0(hw->iobase) ;
selectreg = (bap == 1) ? HFA384x_SELECT1 : HFA384x_SELECT0 ;
offsetreg = (bap == 1) ? HFA384x_OFFSET1 : HFA384x_OFFSET0 ;
datareg = (bap == 1) ? HFA384x_DATA1 : HFA384x_DATA0 ;
/* Obtain lock */
spin_lock_irqsave( &(hw->baplock[bap]), flags);
/* Write id to select reg */
wlan_outw_cpu_to_le16(id, selectreg);
hfa384x_setreg(hw, id, selectreg);
/* Write offset to offset reg */
wlan_outw_cpu_to_le16(offset, offsetreg);
hfa384x_setreg(hw, offset, offsetreg);
/* Wait for offset[busy] to clear (see BAP_TIMEOUT) */
i = 0;
do {
reg = wlan_inw_le16_to_cpu(offsetreg);
reg = hfa384x_getreg(hw, offsetreg);
if ( i > 0 ) udelay(2);
i++;
} while ( i < BAP_TIMEOUT && HFA384x_OFFSET_ISBUSY(reg));
@ -1851,11 +1848,12 @@ int hfa384x_copy_from_bap(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset,
} else {
/* Read even(len) buf contents from data reg */
for ( i = 0; i < (len & 0xfffe); i+=2 ) {
*(UINT16*)(&(d[i])) = wlan_inw(datareg);
*(UINT16*)(&(d[i])) =
hfa384x_getreg_noswap(hw, datareg);
}
/* If len odd, handle last byte */
if ( len % 2 ){
reg = wlan_inw(datareg);
reg = hfa384x_getreg_noswap(hw, datareg);
d[len-1] = ((UINT8*)(&reg))[0];
}
}
@ -1922,27 +1920,21 @@ int hfa384x_copy_to_bap(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset,
(len > HFA384x_BAP_DATALEN_MAX) ){
result = -EINVAL;
} else {
selectreg = (bap == 1) ?
HFA384x_SELECT1(hw->iobase) :
HFA384x_SELECT0(hw->iobase) ;
offsetreg = (bap == 1) ?
HFA384x_OFFSET1(hw->iobase) :
HFA384x_OFFSET0(hw->iobase) ;
datareg = (bap == 1) ?
HFA384x_DATA1(hw->iobase) :
HFA384x_DATA0(hw->iobase) ;
selectreg = (bap == 1) ? HFA384x_SELECT1 : HFA384x_SELECT0;
offsetreg = (bap == 1) ? HFA384x_OFFSET1 : HFA384x_OFFSET0;
datareg = (bap == 1) ? HFA384x_DATA1 : HFA384x_DATA0;
/* Obtain lock */
spin_lock_irqsave( &(hw->baplock[bap]), flags);
/* Write id to select reg */
wlan_outw_cpu_to_le16(id, selectreg);
hfa384x_setreg(hw, id, selectreg);
udelay(10);
/* Write offset to offset reg */
wlan_outw_cpu_to_le16(offset, offsetreg);
hfa384x_setreg(hw, offset, offsetreg);
/* Wait for offset[busy] to clear (see BAP_TIMEOUT) */
i = 0;
do {
reg = wlan_inw_le16_to_cpu(offsetreg);
reg = hfa384x_getreg(hw, offsetreg);
if ( i > 0 ) udelay(2);
i++;
} while ( i < BAP_TIMEOUT && HFA384x_OFFSET_ISBUSY(reg));
@ -1955,16 +1947,18 @@ int hfa384x_copy_to_bap(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset,
} else {
/* Write even(len) buf contents to data reg */
for ( i = 0; i < (len & 0xfffe); i+=2 ) {
wlan_outw( *(UINT16*)(&(d[i])), datareg);
hfa384x_setreg_noswap(hw,
*(UINT16*)(&(d[i])), datareg);
}
/* If len odd, handle last byte */
if ( len % 2 ){
savereg = wlan_inw(datareg);
wlan_outw_cpu_to_le16((offset+(len&0xfffe)), offsetreg);
savereg = hfa384x_getreg_noswap(hw, datareg);
hfa384x_setreg_noswap(hw,
(offset+(len&0xfffe)), offsetreg);
/* Wait for offset[busy] to clear (see BAP_TIMEOUT) */
i = 0;
do {
reg = wlan_inw_le16_to_cpu(offsetreg);
reg = hfa384x_getreg(hw, offsetreg);
if ( i > 0 ) udelay(2);
i++;
} while ( i < BAP_TIMEOUT && HFA384x_OFFSET_ISBUSY(reg));
@ -1973,7 +1967,8 @@ int hfa384x_copy_to_bap(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset,
result = reg;
} else {
((UINT8*)(&savereg))[0] = d[len-1];
wlan_outw( savereg, datareg);
hfa384x_setreg_noswap(hw,
savereg, datareg);
}
}
}
@ -2037,26 +2032,26 @@ hfa384x_copy_from_aux(
/* Build appropriate aux page and offset */
currpage = HFA384x_AUX_MKPAGE(cardaddr);
curroffset = HFA384x_AUX_MKOFF(cardaddr, auxctl);
wlan_outw_cpu_to_le16(currpage, HFA384x_AUXPAGE(hw->iobase));
wlan_outw_cpu_to_le16(curroffset, HFA384x_AUXOFFSET(hw->iobase));
hfa384x_setreg(hw, currpage, HFA384x_AUXPAGE);
hfa384x_setreg(hw, curroffset, HFA384x_AUXOFFSET);
udelay(5); /* beat */
/* read the data */
while ( i < len) {
*((UINT16*)(buf+i)) = wlan_inw(HFA384x_AUXDATA(hw->iobase));
*((UINT16*)(buf+i)) = hfa384x_getreg_noswap(hw, HFA384x_AUXDATA);
i+=2;
curroffset+=2;
if ( (curroffset&HFA384x_AUX_OFF_MASK) > HFA384x_AUX_OFF_MAX ) {
currpage++;
curroffset = 0;
curroffset = HFA384x_AUX_MKOFF(curroffset, auxctl);
wlan_outw_cpu_to_le16(currpage, HFA384x_AUXPAGE(hw->iobase));
wlan_outw_cpu_to_le16(curroffset, HFA384x_AUXOFFSET(hw->iobase));
hfa384x_setreg(hw, currpage, HFA384x_AUXPAGE);
hfa384x_setreg(hw, curroffset, HFA384x_AUXOFFSET);
udelay(5); /* beat */
}
}
/* Make sure the auxctl bits are clear */
wlan_outw_cpu_to_le16(0, HFA384x_AUXOFFSET(hw->iobase));
hfa384x_setreg(hw, 0, HFA384x_AUXOFFSET);
DBFEXIT;
}
@ -2105,20 +2100,21 @@ hfa384x_copy_to_aux(
/* Build appropriate aux page and offset */
currpage = HFA384x_AUX_MKPAGE(cardaddr);
curroffset = HFA384x_AUX_MKOFF(cardaddr, auxctl);
wlan_outw_cpu_to_le16(currpage, HFA384x_AUXPAGE(hw->iobase));
wlan_outw_cpu_to_le16(curroffset, HFA384x_AUXOFFSET(hw->iobase));
hfa384x_setreg(hw, currpage, HFA384x_AUXPAGE);
hfa384x_setreg(hw, curroffset, HFA384x_AUXOFFSET);
udelay(5); /* beat */
/* write the data */
while ( i < len) {
wlan_outw( *((UINT16*)(buf+i)), HFA384x_AUXDATA(hw->iobase));
hfa384x_setreg_noswap(hw,
*((UINT16*)(buf+i)), HFA384x_AUXDATA);
i+=2;
curroffset+=2;
if ( curroffset > HFA384x_AUX_OFF_MAX ) {
currpage++;
curroffset = 0;
wlan_outw_cpu_to_le16(currpage, HFA384x_AUXPAGE(hw->iobase));
wlan_outw_cpu_to_le16(curroffset, HFA384x_AUXOFFSET(hw->iobase));
hfa384x_setreg(hw, currpage, HFA384x_AUXPAGE);
hfa384x_setreg(hw, curroffset, HFA384x_AUXOFFSET);
udelay(5); /* beat */
}
}
@ -2171,10 +2167,10 @@ int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, U
/* wait for the busy bit to clear */
counter = 0;
reg = wlan_inw_le16_to_cpu(HFA384x_CMD(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CMD);
while ( HFA384x_CMD_ISBUSY(reg) &&
(counter < 10)) {
reg = wlan_inw_le16_to_cpu(HFA384x_CMD(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CMD);
counter++;
udelay(10);
}
@ -2182,27 +2178,27 @@ int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, U
printk("counter(1)=%d\n", counter);
#endif
if (HFA384x_CMD_ISBUSY(reg)) {
printk("hfa384x_cmd timeout(1).\n");
printk("hfa384x_cmd timeout(1), reg=0x%0hx.\n", reg);
goto failed;
}
if (!HFA384x_CMD_ISBUSY(reg)) {
/* busy bit clear, write command */
wlan_outw_cpu_to_le16(parm0, HFA384x_PARAM0(hw->iobase));
wlan_outw_cpu_to_le16(parm1, HFA384x_PARAM1(hw->iobase));
wlan_outw_cpu_to_le16(parm2, HFA384x_PARAM2(hw->iobase));
hfa384x_setreg(hw, parm0, HFA384x_PARAM0);
hfa384x_setreg(hw, parm1, HFA384x_PARAM1);
hfa384x_setreg(hw, parm2, HFA384x_PARAM2);
hw->lastcmd = cmd;
wlan_outw_cpu_to_le16(cmd, HFA384x_CMD(hw->iobase));
hfa384x_setreg(hw, cmd, HFA384x_CMD);
/* Now wait for completion */
counter = 0;
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
/* Initialization is the problem. It takes about
100ms. "normal" commands are typically is about
200-400 us (I've never seen less than 200). Longer
is better so that we're not hammering the bus. */
while ( !HFA384x_EVSTAT_ISCMD(reg) &&
(counter < 1000)) {
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
counter++;
udelay(200);
}
@ -2211,12 +2207,12 @@ int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, U
#endif
if ( HFA384x_EVSTAT_ISCMD(reg) ) {
result = 0;
hw->status = wlan_inw_le16_to_cpu(HFA384x_STATUS(hw->iobase));
hw->resp0 = wlan_inw_le16_to_cpu(HFA384x_RESP0(hw->iobase));
hw->resp1 = wlan_inw_le16_to_cpu(HFA384x_RESP1(hw->iobase));
hw->resp2 = wlan_inw_le16_to_cpu(HFA384x_RESP2(hw->iobase));
wlan_outw_cpu_to_le16(HFA384x_EVACK_CMD,
HFA384x_EVACK(hw->iobase));
hw->status = hfa384x_getreg(hw, HFA384x_STATUS);
hw->resp0 = hfa384x_getreg(hw, HFA384x_RESP0);
hw->resp1 = hfa384x_getreg(hw, HFA384x_RESP1);
hw->resp2 = hfa384x_getreg(hw, HFA384x_RESP2);
hfa384x_setreg(hw, HFA384x_EVACK_CMD,
HFA384x_EVACK);
result = HFA384x_STATUS_RESULT_GET(hw->status);
} else {
printk("hfa384x_cmd timeout(2)\n");
@ -2272,9 +2268,9 @@ int hfa384x_dl_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1
DBFENTER;
/* wait for the busy bit to clear */
timeout = jiffies + 1*HZ;
reg = wlan_inw_le16_to_cpu(HFA384x_CMD(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CMD);
while ( HFA384x_CMD_ISBUSY(reg) && time_before( jiffies, timeout) ) {
reg = wlan_inw_le16_to_cpu(HFA384x_CMD(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_CMD);
udelay(10);
}
if (HFA384x_CMD_ISBUSY(reg)) {
@ -2284,11 +2280,11 @@ int hfa384x_dl_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1
if (!HFA384x_CMD_ISBUSY(reg)) {
/* busy bit clear, write command */
wlan_outw_cpu_to_le16(parm0, HFA384x_PARAM0(hw->iobase));
wlan_outw_cpu_to_le16(parm1, HFA384x_PARAM1(hw->iobase));
wlan_outw_cpu_to_le16(parm2, HFA384x_PARAM2(hw->iobase));
hfa384x_setreg(hw, parm0, HFA384x_PARAM0);
hfa384x_setreg(hw, parm1, HFA384x_PARAM1);
hfa384x_setreg(hw, parm2, HFA384x_PARAM2);
hw->lastcmd = cmd;
wlan_outw_cpu_to_le16(cmd, HFA384x_CMD(hw->iobase));
hfa384x_setreg(hw, cmd, HFA384x_CMD);
/* Now wait for completion */
if ( (HFA384x_CMD_CMDCODE_GET(hw->lastcmd) == HFA384x_CMDCODE_DOWNLD) ) {
@ -2302,18 +2298,18 @@ int hfa384x_dl_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1
} else {
timeout = jiffies + 1*HZ;
}
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
while ( !HFA384x_EVSTAT_ISCMD(reg) && time_before(jiffies,timeout) ) {
udelay(100);
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
}
if ( HFA384x_EVSTAT_ISCMD(reg) ) {
result = 0;
hw->status = wlan_inw_le16_to_cpu(HFA384x_STATUS(hw->iobase));
hw->resp0 = wlan_inw_le16_to_cpu(HFA384x_RESP0(hw->iobase));
hw->resp1 = wlan_inw_le16_to_cpu(HFA384x_RESP1(hw->iobase));
hw->resp2 = wlan_inw_le16_to_cpu(HFA384x_RESP2(hw->iobase));
wlan_outw_cpu_to_le16(HFA384x_EVACK_CMD, HFA384x_EVACK(hw->iobase));
hw->status = hfa384x_getreg(hw, HFA384x_STATUS);
hw->resp0 = hfa384x_getreg(hw, HFA384x_RESP0);
hw->resp1 = hfa384x_getreg(hw, HFA384x_RESP1);
hw->resp2 = hfa384x_getreg(hw, HFA384x_RESP2);
hfa384x_setreg(hw, HFA384x_EVACK_CMD, HFA384x_EVACK);
result = HFA384x_STATUS_RESULT_GET(hw->status);
}
}

View File

@ -534,8 +534,8 @@ int prism2mgmt_associate(wlandevice_t *wlandev, void *msgp)
HFA384x_INTEN_TXEXC_SET(1) |
HFA384x_INTEN_TX_SET(1) |
HFA384x_INTEN_RX_SET(1);
wlan_outw_cpu_to_le16(0xffff, HFA384x_EVSTAT(priv->hw->iobase));
wlan_outw_cpu_to_le16(reg, HFA384x_INTEN(hw->iobase));
hfa384x_setreg(hw, 0xffff, HFA384x_EVSTAT);
hfa384x_setreg(hw, reg, HFA384x_INTEN);
/* Enable the Port */
hfa384x_cmd_enable(hw, 0);
@ -881,8 +881,8 @@ pcf_skip:
HFA384x_INTEN_DTIM_SET(1) |
HFA384x_INTEN_TX_SET(1) |
HFA384x_INTEN_RX_SET(1);
wlan_outw_cpu_to_le16(0xffff, HFA384x_EVSTAT(priv->hw->iobase));
wlan_outw_cpu_to_le16(word, HFA384x_INTEN(hw->iobase));
hfa384x_setreg(hw, 0xffff, HFA384x_EVSTAT);
hfa384x_setreg(hw, word, HFA384x_INTEN);
/* Set the macmode so the frame setup code knows what to do */
if ( msg->bsstype.data == P80211ENUM_bsstype_infrastructure ) {
@ -977,8 +977,8 @@ int prism2mgmt_enable(wlandevice_t *wlandev, void *msgp)
HFA384x_INTEN_DTIM_SET(1) |
HFA384x_INTEN_TX_SET(1) |
HFA384x_INTEN_RX_SET(1);
wlan_outw_cpu_to_le16(0xffff, HFA384x_EVSTAT(priv->hw->iobase));
wlan_outw_cpu_to_le16(word, HFA384x_INTEN(hw->iobase));
hfa384x_setreg(hw, 0xffff, HFA384x_EVSTAT);
hfa384x_setreg(hw, word, HFA384x_INTEN);
/* Set the macmode so the frame setup code knows what to do */
wlandev->macmode = WLAN_MACMODE_ESS_AP;
@ -1713,8 +1713,8 @@ int prism2mgmt_dump_state(wlandevice_t *wlandev, void *msgp)
hfa384x_cmd_aux_disable(hw);
WLAN_LOG_NOTICE1(" cmac: FreeBlocks=%d\n", auxbuf[5]);
WLAN_LOG_NOTICE2(" cmac: IntEn=0x%02x EvStat=0x%02x\n",
wlan_inw_le16_to_cpu(HFA384x_INTEN(hw->iobase)),
wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase)));
hfa384x_getreg(hw, HFA384x_INTEN),
hfa384x_getreg(hw, HFA384x_EVSTAT));
#ifdef USE_FID_STACK
WLAN_LOG_NOTICE2(" drvr: txfid_top=%d stacksize=%d\n",
priv->txfid_top,PRISM2_FIDSTACKLEN_MAX);
@ -1972,8 +1972,8 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp)
HFA384x_INTEN_TXEXC_SET(1) |
HFA384x_INTEN_TX_SET(1) |
HFA384x_INTEN_RX_SET(1);
wlan_outw_cpu_to_le16(0xffff, HFA384x_EVSTAT(priv->hw->iobase));
wlan_outw_cpu_to_le16(reg, HFA384x_INTEN(hw->iobase));
hfa384x_setreg(hw, 0xffff, HFA384x_EVSTAT);
hfa384x_setreg(hw, reg, HFA384x_INTEN);
/* Enable the Port */
hfa384x_cmd_enable(hw, 0);

View File

@ -94,7 +94,7 @@
#include <prism2/hfa384x.h>
#include <prism2/prism2mgmt.h>
#if (WLAN_HOSTIF == WLAN_PLX)
#if ((WLAN_HOSTIF == WLAN_PLX) || (WLAN_HOSTIF == WLAN_PCI))
#include <linux/pci.h>
#include <prism2/pci-scan.h>
#include <prism2/kern_compat.h>
@ -116,6 +116,13 @@
#define PCI_CLASS_NETWORK_OTHERS 0x280 /* PCI Class & Sub-Class code, Network-'Other controller' */
#endif
#if (WLAN_HOSTIF == WLAN_PCI)
#define PCI_TYPE (PCI_USES_MEM | PCI_ADDR0 | PCI_NO_ACPI_WAKE)
#define PCI_SIZE 0x1000 /* Memory size - 4K bytes */
#define ISL3874A_ID 0x38731260 /* ISL3874A 11Mb/s WLAN controller */
#define PCI_CLASS_NETWORK_OTHERS 0x280 /* PCI Class & Sub-Class code, Network-'Other controller' */
#endif
/*================================================================*/
/* Local Macros */
@ -135,6 +142,8 @@
#if (WLAN_HOSTIF == WLAN_PCMCIA)
#define DRIVER_SUFFIX "_cs"
#elif (WLAN_HOSTIF == WLAN_PLX)
#define DRIVER_SUFFIX "_plx"
#elif (WLAN_HOSTIF == WLAN_PCI)
#define DRIVER_SUFFIX "_pci"
/* #else , TODO: Fix .depend generation for multiple driver build */
/* #error "HOSTIF unsupported or undefined!" */
@ -170,6 +179,39 @@ static struct pci_id_info pci_id_tbl[] = {
}
};
/* Function declared here because of ptr reference below */
static void *prism2sta_probe_plx(struct pci_dev *pdev, void *dev,
unsigned char *attr_mem, int irq, int chip_idx,
int fnd_cnt);
struct drv_id_info prism2_plx_drv_id = {
"prism2-plx",
0,
PCI_CLASS_NETWORK_OTHERS<<8,
pci_id_tbl,
(void *)prism2sta_probe_plx
};
#endif /* WLAN_PLX */
#if (WLAN_HOSTIF == WLAN_PCI)
static struct pci_id_info pci_id_tbl[] = {
{
"Intersil Prism2.5 ISL3874 11Mb/s WLAN Controller",
{ ISL3874A_ID, 0xffffffff},
PCI_TYPE,
PCI_SIZE,
0
},
{
NULL,
{ 0, 0},
0,
0,
0
}
};
/* Function declared here because of ptr reference below */
static void *prism2sta_probe_pci(struct pci_dev *pdev, void *dev,
unsigned char *attr_mem, int irq, int chip_idx,
@ -183,22 +225,26 @@ struct drv_id_info prism2_pci_drv_id = {
(void *)prism2sta_probe_pci
};
#endif /* WLAN_PLX */
#endif /* WLAN_PCI */
/*----------------------------------------------------------------*/
/* --Module Parameters */
int prism2_debug=0; /* Debug output level, */
static u_int irq_mask = 0xdeb8; /* Interrupt mask */
static int irq_list[4] = { -1 }; /* Interrupt list (alternative) */
static u_int prism2_irq_evread_max=20; /* Maximum number of ev_reads (loops)
in irq handler */
static u_int prism2_irq_evread_max=20; /* Maximum number of
* ev_reads (loops)
* in irq handler
*/
MODULE_PARM( prism2_debug, "i");
MODULE_PARM( prism2_irq_evread_max, "i");
#if (WLAN_HOSTIF == WLAN_PCMCIA)
static u_int irq_mask = 0xdeb8; /* Interrupt mask */
static int irq_list[4] = { -1 }; /* Interrupt list */
MODULE_PARM( irq_mask, "i");
MODULE_PARM( irq_list, "1-4i");
MODULE_PARM( prism2_irq_evread_max, "i");
#endif
/*================================================================*/
@ -948,8 +994,8 @@ int prism2sta_initmac(wlandevice_t *wlandev)
#endif
/* make sure interrupts are disabled and any layabout events cleared */
wlan_outw_cpu_to_le16(0, HFA384x_INTEN(hw->iobase));
wlan_outw_cpu_to_le16(0xffff, HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, 0, HFA384x_INTEN);
hfa384x_setreg(hw, 0xffff, HFA384x_EVACK);
/* Read the PDA */
result = hfa384x_drvr_readpda(hw, priv->pda, HFA384x_PDA_LEN_MAX);
@ -969,7 +1015,7 @@ int prism2sta_initmac(wlandevice_t *wlandev)
}
j = 0;
do {
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
udelay(10);
j++;
} while ( !HFA384x_EVSTAT_ISALLOC(reg) && j < 50); /* 50 is timeout */
@ -979,12 +1025,12 @@ int prism2sta_initmac(wlandevice_t *wlandev)
goto failed;
}
#ifdef USE_FID_STACK
priv->txfid_stack[i] = wlan_inw_le16_to_cpu(HFA384x_ALLOCFID(hw->iobase));
priv->txfid_stack[i] = hfa384x_getreg(hw, HFA384x_ALLOCFID);
#else
txfid_queue_add(priv, wlan_inw_le16_to_cpu(HFA384x_ALLOCFID(hw->iobase)));
txfid_queue_add(priv, hfa384x_getreg(hw, HFA384x_ALLOCFID));
#endif
reg = HFA384x_EVACK_ALLOC_SET(1);
wlan_outw_cpu_to_le16( reg, HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, reg, HFA384x_EVACK);
#ifdef USE_FID_STACK
WLAN_LOG_DEBUG2(1,"priv->txfid_stack[%d]=0x%04x\n",i,priv->txfid_stack[i]);
@ -999,7 +1045,7 @@ int prism2sta_initmac(wlandevice_t *wlandev)
}
i = 0;
do {
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
udelay(10);
i++;
} while ( !HFA384x_EVSTAT_ISALLOC(reg) && i < 50); /* 50 is timeout */
@ -1008,9 +1054,9 @@ int prism2sta_initmac(wlandevice_t *wlandev)
result = -ETIMEDOUT;
goto failed;
}
priv->infofid = wlan_inw_le16_to_cpu(HFA384x_ALLOCFID(hw->iobase));
priv->infofid = hfa384x_getreg(hw, HFA384x_ALLOCFID);
reg = HFA384x_EVACK_ALLOC_SET(1);
wlan_outw_cpu_to_le16( reg, HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, reg, HFA384x_EVACK);
WLAN_LOG_DEBUG1(1,"priv->infofid=0x%04x\n", priv->infofid);
/* Collect version and compatibility info */
@ -1277,7 +1323,7 @@ int prism2sta_initmac(wlandevice_t *wlandev)
/* TODO: Set any internally managed config items */
/* Set swsupport regs to magic # for card presence detection */
wlan_outw_cpu_to_le16( PRISM2STA_MAGIC, HFA384x_SWSUPPORT0(hw->iobase));
hfa384x_setreg(hw, PRISM2STA_MAGIC, HFA384x_SWSUPPORT0);
goto done;
failed:
@ -1986,7 +2032,7 @@ void prism2sta_interrupt IRQ(int irq, void *dev_id, struct pt_regs *regs)
DBFENTER;
/* Check swsupport reg magic # for card presence */
reg = wlan_inw_le16_to_cpu(HFA384x_SWSUPPORT0(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_SWSUPPORT0);
if ( reg != PRISM2STA_MAGIC) {
WLAN_LOG_DEBUG1(2, "irq=%d, no magic. Card removed?.\n", irq);
return;
@ -1996,7 +2042,7 @@ void prism2sta_interrupt IRQ(int irq, void *dev_id, struct pt_regs *regs)
hw->bap = HFA384x_BAP_INT;
/* read the EvStat register for interrupt enabled events */
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
ev_read++;
do {
@ -2004,58 +2050,58 @@ void prism2sta_interrupt IRQ(int irq, void *dev_id, struct pt_regs *regs)
/* Handle the events */
if ( HFA384x_EVSTAT_ISINFDROP(reg) ){
prism2sta_int_infdrop(wlandev);
wlan_outw_cpu_to_le16(HFA384x_EVACK_INFDROP_SET(1),
HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, HFA384x_EVACK_INFDROP_SET(1),
HFA384x_EVACK);
}
if ( HFA384x_EVSTAT_ISINFO(reg) ){
prism2sta_int_info(wlandev);
wlan_outw_cpu_to_le16(HFA384x_EVACK_INFO_SET(1),
HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, HFA384x_EVACK_INFO_SET(1),
HFA384x_EVACK);
}
if ( HFA384x_EVSTAT_ISTXEXC(reg) ){
prism2sta_int_txexc(wlandev);
wlan_outw_cpu_to_le16(HFA384x_EVACK_TXEXC_SET(1),
HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, HFA384x_EVACK_TXEXC_SET(1),
HFA384x_EVACK);
}
if ( HFA384x_EVSTAT_ISTX(reg) ){
prism2sta_int_tx(wlandev);
wlan_outw_cpu_to_le16(HFA384x_EVACK_TX_SET(1),
HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, HFA384x_EVACK_TX_SET(1),
HFA384x_EVACK);
}
if ( HFA384x_EVSTAT_ISRX(reg) ){
prism2sta_int_rx(wlandev);
wlan_outw_cpu_to_le16(HFA384x_EVACK_RX_SET(1),
HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, HFA384x_EVACK_RX_SET(1),
HFA384x_EVACK);
}
if ( HFA384x_EVSTAT_ISALLOC(reg) ){
prism2sta_int_alloc(wlandev);
wlan_outw_cpu_to_le16(HFA384x_EVACK_ALLOC_SET(1),
HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, HFA384x_EVACK_ALLOC_SET(1),
HFA384x_EVACK);
}
if ( HFA384x_EVSTAT_ISDTIM(reg) ){
prism2sta_int_dtim(wlandev);
wlan_outw_cpu_to_le16(HFA384x_EVACK_DTIM_SET(1),
HFA384x_EVACK(hw->iobase));
hfa384x_setreg(hw, HFA384x_EVACK_DTIM_SET(1),
HFA384x_EVACK);
}
/* allow the evstat to be updated after the evack */
udelay(20);
/* Check swsupport reg magic # for card presence */
reg = wlan_inw_le16_to_cpu(HFA384x_SWSUPPORT0(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_SWSUPPORT0);
if ( reg != PRISM2STA_MAGIC) {
WLAN_LOG_DEBUG1(2, "irq=%d, no magic. Card removed?.\n", irq);
return;
}
/* read the EvStat register for interrupt enabled events */
reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_EVSTAT);
ev_read++;
} while ((
@ -2159,7 +2205,7 @@ void prism2sta_int_info(wlandevice_t *wlandev)
int result;
DBFENTER;
/* Retrieve the FID */
reg = wlan_inw_le16_to_cpu(HFA384x_INFOFID(hw->iobase));
reg = hfa384x_getreg(hw, HFA384x_INFOFID);
/* Retrieve the length */
result = hfa384x_copy_from_bap( hw,
@ -2248,7 +2294,7 @@ void prism2sta_int_txexc(wlandevice_t *wlandev)
int result = 0;
DBFENTER;
/* Collect the status and display */
fid = wlan_inw_le16_to_cpu(HFA384x_TXCOMPLFID(hw->iobase));
fid = hfa384x_getreg(hw, HFA384x_TXCOMPLFID);
result = hfa384x_copy_from_bap(hw, hw->bap, fid, 0, &status, sizeof(status));
if ( result ) {
WLAN_LOG_DEBUG3(1,
@ -2288,7 +2334,7 @@ void prism2sta_int_tx(wlandevice_t *wlandev)
UINT16 status;
int result = 0;
DBFENTER;
fid = wlan_inw_le16_to_cpu(HFA384x_TXCOMPLFID(hw->iobase));
fid = hfa384x_getreg(hw, HFA384x_TXCOMPLFID);
result =hfa384x_copy_from_bap(hw, hw->bap, fid, 0, &status, sizeof(status));
if ( result ) {
WLAN_LOG_DEBUG3(1,
@ -2334,7 +2380,7 @@ void prism2sta_int_rx(wlandevice_t *wlandev)
DBFENTER;
/* Get the FID */
rxfid = wlan_inw_le16_to_cpu(HFA384x_RXFID(hw->iobase));
rxfid = hfa384x_getreg(hw, HFA384x_RXFID);
/* Get the descriptor (including headers) */
result = hfa384x_copy_from_bap(hw,
hw->bap,
@ -2636,7 +2682,7 @@ void prism2sta_int_alloc(wlandevice_t *wlandev)
/* Handle the reclaimed FID */
/* collect the FID and push it onto the stack */
fid = wlan_inw_le16_to_cpu(HFA384x_ALLOCFID(hw->iobase));
fid = hfa384x_getreg(hw, HFA384x_ALLOCFID);
#ifdef USE_FID_STACK
if (! txfid_stack_full(priv)) {
@ -3217,7 +3263,7 @@ static int prism2sta_event (event_t event, int priority, event_callback_args_t *
hfa384x_inithw(
((prism2sta_priv_t*)wlandev->priv)->hw,
wlandev->netdev->irq,
wlandev->netdev->base_addr);
wlandev->netdev->base_addr, 0);
result = prism2sta_initmac(wlandev);
if ( result != 0 ) {
WLAN_LOG_ERROR1(
@ -3279,7 +3325,7 @@ static int prism2sta_event (event_t event, int priority, event_callback_args_t *
hfa384x_inithw(
((prism2sta_priv_t*)wlandev->priv)->hw,
wlandev->netdev->irq,
wlandev->netdev->base_addr);
wlandev->netdev->base_addr, 0);
result=prism2sta_initmac(wlandev);
if ( result != 0 ) {
WLAN_LOG_ERROR1(
@ -3302,9 +3348,127 @@ static int prism2sta_event (event_t event, int priority, event_callback_args_t *
}
#endif /* WLAN_PCMCIA */
#if (WLAN_HOSTIF == WLAN_PCI)
/*----------------------------------------------------------------
* prism2sta_probe_plx
*
* PCI-SCAN probe routine.
* Initialize MAC before return.
*
* Arguments:
* pdev ptr to pci device structure containing info about
* pci configuration.
* dev ptr to that is passed in the 2nd input argument
* of pci_drv_register()
* attr_mem ptr to attribute memory of PC card
* irq interrupt number of PCI device
* chip_idx index number in pci lookup table for this card
* fnd_cnt number of found card
*
* Returns:
* NULL - failed
* Otherwise - success
*
* Side effects:
*
*
* Call context:
* process thread
*
----------------------------------------------------------------*/
static void *prism2sta_probe_pci(struct pci_dev *pdev, void *dev,
unsigned char *mem, int irq, int chip_idx, int fnd_cnt)
{
wlandevice_t *wlandev;
prism2sta_priv_t *priv;
WLAN_LOG_INFO2("A Prism2 PCI device found, "
"mem:0x%lx, irq:%d\n", (long)mem, irq);
/* Create the network device object. */
wlandev = kmalloc(sizeof(wlandevice_t), GFP_KERNEL);
if ( wlandev == NULL ) {
return NULL;
}
memset(wlandev, 0, sizeof(wlandevice_t));
/* Make up a device private data structure. */
wlandev->priv = kmalloc(sizeof(prism2sta_priv_t), GFP_KERNEL);
if ( wlandev->priv == NULL ) {
kfree_s(wlandev, sizeof(wlandevice_t));
return NULL;
}
memset(wlandev->priv, 0, sizeof(prism2sta_priv_t));
/* Make up a hw data structure. */
priv = (prism2sta_priv_t*)wlandev->priv;
priv->hw = kmalloc(sizeof(hfa384x_t), GFP_KERNEL);
if ( priv->hw == NULL ) {
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
return NULL;
}
memset(priv->hw, 0, sizeof(hfa384x_t));
/* Set our entries in the wlandev */
wlandev->open = &prism2sta_open;
wlandev->close = &prism2sta_close;
wlandev->reset = &prism2sta_reset;
wlandev->txframe = &prism2sta_txframe;
wlandev->mlmerequest = &prism2sta_mlmerequest;
/* Set up the remaining entries in the wlan common way */
wlandev->name = ((prism2sta_priv_t*)wlandev->priv)->node.dev_name;
if ( wlan_setup(wlandev) != 0 ) {
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
WLAN_LOG_ERROR0("wlan_setup() failed!\n");
return NULL;
}
wlandev->netdev->irq = irq;
wlandev->netdev->mem_start = (unsigned long)mem;
wlandev->netdev->mem_end = (unsigned long)mem + PCI_SIZE;
request_irq(wlandev->netdev->irq, prism2sta_interrupt, SA_SHIRQ, dev_info, wlandev);
if ( register_wlandev(wlandev) != 0 ) {
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
WLAN_LOG_ERROR0("register_wlandev() failed!\n");
return NULL;
}
#if 0
outw(PRISM2STA_MAGIC, HFA384x_SWSUPPORT0(wlandev->netdev->base_addr));
reg=inw( HFA384x_SWSUPPORT0(wlandev->netdev->base_addr));
if ( reg != PRISM2STA_MAGIC ) {
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
WLAN_LOG_ERROR0("MAC register access test failed!\n");
return NULL;
}
#endif
hfa384x_inithw(((prism2sta_priv_t*)wlandev->priv)->hw,
wlandev->netdev->irq, 0, wlandev->netdev->mem_start);
if ( prism2sta_initmac(wlandev) != 0) {
WLAN_LOG_ERROR0("MAC Initialization failed.");
return NULL;
}
return( (void *)wlandev);
}
#endif /* WLAN_PCI */
#if (WLAN_HOSTIF == WLAN_PLX)
/*----------------------------------------------------------------
* prism2sta_probe_pci
* prism2sta_probe_plx
*
* PCI-SCAN probe routine. Firstly, detect whether a PC card is present
* or not. If yes, register required hardware resource and allocate private
@ -3331,7 +3495,7 @@ static int prism2sta_event (event_t event, int priority, event_callback_args_t *
* process thread
*
----------------------------------------------------------------*/
static void *prism2sta_probe_pci(struct pci_dev *pdev, void *dev,
static void *prism2sta_probe_plx(struct pci_dev *pdev, void *dev,
unsigned char *attr_mem, int irq, int chip_idx, int fnd_cnt)
{
int pccard_ioaddr;
@ -3344,9 +3508,11 @@ static void *prism2sta_probe_pci(struct pci_dev *pdev, void *dev,
#else
pccard_ioaddr = pdev->base_address[(PCI_ADDR3 >> 4) & 7];
#endif
WLAN_LOG_INFO3("A Prism2 PCI device found, mem:0x%lx, irq:%d, io addr:0x%x\n", (long)attr_mem, irq, pccard_ioaddr-1);
WLAN_LOG_INFO3("A PLX PCI/PCMCIA interface device found, "
"mem:0x%lx, irq:%d, io addr:0x%x\n",
(long)attr_mem, irq, pccard_ioaddr-1);
/* Verify whether PC card is present */
/* Verify whether PC card is present (this needs improvement) */
if ( attr_mem[0] != 0x01 || attr_mem[2] != 0x03 ||
attr_mem[4] != 0x00 || attr_mem[6] != 0x00 ||
attr_mem[8] != 0xFF || attr_mem[10] != 0x17 ||
@ -3355,6 +3521,8 @@ static void *prism2sta_probe_pci(struct pci_dev *pdev, void *dev,
return NULL;
}
WLAN_LOG_INFO0("A PCMCIA WLAN adapter was found.\n");
/* Write COR to enable PC card */
attr_mem[COR_OFFSET] = COR_VALUE;
reg = attr_mem[COR_OFFSET];
@ -3415,6 +3583,7 @@ static void *prism2sta_probe_pci(struct pci_dev *pdev, void *dev,
return NULL;
}
#if 0
outw(PRISM2STA_MAGIC, HFA384x_SWSUPPORT0(wlandev->netdev->base_addr));
reg=inw( HFA384x_SWSUPPORT0(wlandev->netdev->base_addr));
if ( reg != PRISM2STA_MAGIC ) {
@ -3424,8 +3593,10 @@ static void *prism2sta_probe_pci(struct pci_dev *pdev, void *dev,
WLAN_LOG_ERROR0("IO port access failed!\n");
return NULL;
}
#endif
hfa384x_inithw(((prism2sta_priv_t*)wlandev->priv)->hw, wlandev->netdev->irq, wlandev->netdev->base_addr);
hfa384x_inithw(((prism2sta_priv_t*)wlandev->priv)->hw,
wlandev->netdev->irq, wlandev->netdev->base_addr, 0);
if ( prism2sta_initmac(wlandev) != 0) {
WLAN_LOG_ERROR0("MAC Initialization failed.");
@ -3467,14 +3638,7 @@ int init_module(void)
WLAN_LOG_NOTICE1("%s Loaded\n", version);
WLAN_LOG_NOTICE1("dev_info is: %s\n", dev_info);
#if (WLAN_HOSTIF == WLAN_PLX)
/* This call will result in a call to prism2sta_probe_pci
* if there is a matched PCI card present (ie., which
* vendor+device id are matched)
*/
pci_drv_register(&prism2_pci_drv_id, NULL);
#elif (WLAN_HOSTIF == WLAN_PCMCIA)
#if (WLAN_HOSTIF == WLAN_PCMCIA)
CardServices(GetCardServicesInfo, &serv);
if ( serv.Revision != CS_RELEASE_CODE )
{
@ -3485,6 +3649,20 @@ int init_module(void)
/* This call will result in a call to prism2sta_attach */
/* and eventually prism2sta_detach */
register_pcmcia_driver( &dev_info, &prism2sta_attach, &prism2sta_detach);
#elif (WLAN_HOSTIF == WLAN_PLX)
/* This call will result in a call to prism2sta_probe_plx
* if there is a matched PCI card present (ie., which
* vendor+device id are matched)
*/
pci_drv_register(&prism2_plx_drv_id, NULL);
#elif (WLAN_HOSTIF == WLAN_PCI)
/* This call will result in a call to prism2sta_probe_pci
* if there is a matched PCI card present (ie., which
* vendor+device id are matched)
*/
pci_drv_register(&prism2_pci_drv_id, NULL);
#endif
DBFEXIT;
@ -3523,6 +3701,11 @@ void cleanup_module(void)
#elif (WLAN_HOSTIF == WLAN_PLX)
release_region(wlandev->netdev->base_addr, 0xff);
free_irq(wlandev->netdev->irq, dev_info);
pci_drv_register(&prism2_plx_drv_id, NULL);
#elif (WLAN_HOSTIF == WLAN_PCI)
release_region(wlandev->netdev->base_addr, 0xff);
free_irq(wlandev->netdev->irq, dev_info);
pci_drv_register(&prism2_pci_drv_id, NULL);
#endif
/*

View File

@ -121,6 +121,8 @@
#define HFA384x_DLSTATE_FLASHWRITEPENDING 4
/*--- Register I/O offsets --------------------------*/
#if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX))
#define HFA384x_CMD_OFF (0x00)
#define HFA384x_PARAM0_OFF (0x02)
#define HFA384x_PARAM1_OFF (0x04)
@ -150,6 +152,50 @@
#define HFA384x_AUXOFFSET_OFF (0x3C)
#define HFA384x_AUXDATA_OFF (0x3E)
#elif (WLAN_HOSTIF == WLAN_PCI)
#define HFA384x_CMD_OFF (0x00)
#define HFA384x_PARAM0_OFF (0x04)
#define HFA384x_PARAM1_OFF (0x08)
#define HFA384x_PARAM2_OFF (0x0c)
#define HFA384x_STATUS_OFF (0x10)
#define HFA384x_RESP0_OFF (0x14)
#define HFA384x_RESP1_OFF (0x18)
#define HFA384x_RESP2_OFF (0x1c)
#define HFA384x_INFOFID_OFF (0x20)
#define HFA384x_RXFID_OFF (0x40)
#define HFA384x_ALLOCFID_OFF (0x44)
#define HFA384x_TXCOMPLFID_OFF (0x48)
#define HFA384x_SELECT0_OFF (0x30)
#define HFA384x_OFFSET0_OFF (0x38)
#define HFA384x_DATA0_OFF (0x6c)
#define HFA384x_SELECT1_OFF (0x34)
#define HFA384x_OFFSET1_OFF (0x3c)
#define HFA384x_DATA1_OFF (0x70)
#define HFA384x_EVSTAT_OFF (0x60)
#define HFA384x_INTEN_OFF (0x64)
#define HFA384x_EVACK_OFF (0x68)
#define HFA384x_CONTROL_OFF (0x28)
#define HFA384x_SWSUPPORT0_OFF (0x50)
#define HFA384x_SWSUPPORT1_OFF (0x54)
#define HFA384x_SWSUPPORT2_OFF (0x58)
#define HFA384x_AUXPAGE_OFF (0x74)
#define HFA384x_AUXOFFSET_OFF (0x78)
#define HFA384x_AUXDATA_OFF (0x7c)
#define HFA384x_PCICOR_OFF (0x4c)
#define HFA384x_PCIHCR_OFF (0x5c)
#define HFA384x_PCI_M0_ADDRH_OFF (0x80)
#define HFA384x_PCI_M0_ADDRL_OFF (0x84)
#define HFA384x_PCI_M0_LEN_OFF (0x88)
#define HFA384x_PCI_M0_CTL_OFF (0x8c)
#define HFA384x_PCI_STATUS_OFF (0x98)
#define HFA384x_PCI_M1_ADDRH_OFF (0xa0)
#define HFA384x_PCI_M1_ADDRL_OFF (0xa4)
#define HFA384x_PCI_M1_LEN_OFF (0xa8)
#define HFA384x_PCI_M1_CTL_OFF (0xac)
#endif
/*--- Register Field Masks --------------------------*/
#define HFA384x_CMD_BUSY ((UINT16)BIT15)
#define HFA384x_CMD_AINFO ((UINT16)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8))
@ -607,36 +653,36 @@ PD Record codes
/*=============================================================*/
/*------ Macros -----------------------------------------------*/
/*--- Register access macros ------------------------*/
/*--- Register ID macros ------------------------*/
#define HFA384x_CMD(base) ((UINT)(base) + HFA384x_CMD_OFF)
#define HFA384x_PARAM0(base) ((UINT)(base) + HFA384x_PARAM0_OFF)
#define HFA384x_PARAM1(base) ((UINT)(base) + HFA384x_PARAM1_OFF)
#define HFA384x_PARAM2(base) ((UINT)(base) + HFA384x_PARAM2_OFF)
#define HFA384x_STATUS(base) ((UINT)(base) + HFA384x_STATUS_OFF)
#define HFA384x_RESP0(base) ((UINT)(base) + HFA384x_RESP0_OFF)
#define HFA384x_RESP1(base) ((UINT)(base) + HFA384x_RESP1_OFF)
#define HFA384x_RESP2(base) ((UINT)(base) + HFA384x_RESP2_OFF)
#define HFA384x_INFOFID(base) ((UINT)(base) + HFA384x_INFOFID_OFF)
#define HFA384x_RXFID(base) ((UINT)(base) + HFA384x_RXFID_OFF)
#define HFA384x_ALLOCFID(base) ((UINT)(base) + HFA384x_ALLOCFID_OFF)
#define HFA384x_TXCOMPLFID(base) ((UINT)(base) + HFA384x_TXCOMPLFID_OFF)
#define HFA384x_SELECT0(base) ((UINT)(base) + HFA384x_SELECT0_OFF)
#define HFA384x_OFFSET0(base) ((UINT)(base) + HFA384x_OFFSET0_OFF)
#define HFA384x_DATA0(base) ((UINT)(base) + HFA384x_DATA0_OFF)
#define HFA384x_SELECT1(base) ((UINT)(base) + HFA384x_SELECT1_OFF)
#define HFA384x_OFFSET1(base) ((UINT)(base) + HFA384x_OFFSET1_OFF)
#define HFA384x_DATA1(base) ((UINT)(base) + HFA384x_DATA1_OFF)
#define HFA384x_EVSTAT(base) ((UINT)(base) + HFA384x_EVSTAT_OFF)