Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f34de35 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman
Browse files

staging: vt6655: remove typedef enum __device_init_type



The value is either DEVICE_INIT_COLD or DEVICE_INIT_DXPL making no
difference to code.

Remove typedef and remove if statement in device_init_registers
pulling the code in.

Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fbf515b8
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -185,12 +185,6 @@ typedef enum __device_msg_level {
	MSG_LEVEL_DEBUG = 4           //Only for debug purpose.
	MSG_LEVEL_DEBUG = 4           //Only for debug purpose.
} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;


typedef enum __device_init_type {
	DEVICE_INIT_COLD = 0,         // cold init
	DEVICE_INIT_RESET,          // reset init or Dx to D0 power remain init
	DEVICE_INIT_DXPL            // Dx to D0 power lost init
} DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;

//++ NDIS related
//++ NDIS related


#define MAX_BSSIDINFO_4_PMKID   16
#define MAX_BSSIDINFO_4_PMKID   16
+225 −187
Original line number Original line Diff line number Diff line
@@ -304,7 +304,7 @@ static int ethtool_ioctl(struct net_device *dev, void __user *useraddr);
static int  device_rx_srv(PSDevice pDevice, unsigned int uIdx);
static int  device_rx_srv(PSDevice pDevice, unsigned int uIdx);
static int  device_tx_srv(PSDevice pDevice, unsigned int uIdx);
static int  device_tx_srv(PSDevice pDevice, unsigned int uIdx);
static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pDesc);
static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pDesc);
static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType);
static void device_init_registers(PSDevice pDevice);
static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc);
static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc);
static void device_free_td0_ring(PSDevice pDevice);
static void device_free_td0_ring(PSDevice pDevice);
static void device_free_td1_ring(PSDevice pDevice);
static void device_free_td1_ring(PSDevice pDevice);
@@ -453,7 +453,7 @@ static void s_vCompleteCurrentMeasure(PSDevice pDevice, unsigned char byResult)
// Initialisation of MAC & BBP registers
// Initialisation of MAC & BBP registers
//
//


static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
static void device_init_registers(PSDevice pDevice)
{
{
	unsigned int ii;
	unsigned int ii;
	unsigned char byValue;
	unsigned char byValue;
@@ -466,39 +466,42 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
	MACbShutdown(pDevice->PortOffset);
	MACbShutdown(pDevice->PortOffset);
	BBvSoftwareReset(pDevice->PortOffset);
	BBvSoftwareReset(pDevice->PortOffset);


	if ((InitType == DEVICE_INIT_COLD) ||
	/* Do MACbSoftwareReset in MACvInitialize */
	    (InitType == DEVICE_INIT_DXPL)) {
		// Do MACbSoftwareReset in MACvInitialize
	MACbSoftwareReset(pDevice->PortOffset);
	MACbSoftwareReset(pDevice->PortOffset);
		// force CCK

	/* force CCK */
	pDevice->bCCK = true;
	pDevice->bCCK = true;
	pDevice->bAES = false;
	pDevice->bAES = false;
		pDevice->bProtectMode = false;      //Only used in 11g type, sync with ERP IE

	/* Only used in 11g type, sync with ERP IE */
	pDevice->bProtectMode = false;

	pDevice->bNonERPPresent = false;
	pDevice->bNonERPPresent = false;
	pDevice->bBarkerPreambleMd = false;
	pDevice->bBarkerPreambleMd = false;
	pDevice->wCurrentRate = RATE_1M;
	pDevice->wCurrentRate = RATE_1M;
	pDevice->byTopOFDMBasicRate = RATE_24M;
	pDevice->byTopOFDMBasicRate = RATE_24M;
	pDevice->byTopCCKBasicRate = RATE_1M;
	pDevice->byTopCCKBasicRate = RATE_1M;


		pDevice->byRevId = 0;                   //Target to IF pin while programming to RF chip.
	/* Target to IF pin while programming to RF chip. */
	pDevice->byRevId = 0;


		// init MAC
	/* init MAC */
	MACvInitialize(pDevice->PortOffset);
	MACvInitialize(pDevice->PortOffset);


		// Get Local ID
	/* Get Local ID */
		VNSvInPortB(pDevice->PortOffset + MAC_REG_LOCALID, &(pDevice->byLocalID));
	VNSvInPortB(pDevice->PortOffset + MAC_REG_LOCALID, &pDevice->byLocalID);


	spin_lock_irq(&pDevice->lock);
	spin_lock_irq(&pDevice->lock);

	SROMvReadAllContents(pDevice->PortOffset, pDevice->abyEEPROM);
	SROMvReadAllContents(pDevice->PortOffset, pDevice->abyEEPROM);


	spin_unlock_irq(&pDevice->lock);
	spin_unlock_irq(&pDevice->lock);


		// Get Channel range
	/* Get Channel range */

	pDevice->byMinChannel = 1;
	pDevice->byMinChannel = 1;
	pDevice->byMaxChannel = CB_MAX_CHANNEL;
	pDevice->byMaxChannel = CB_MAX_CHANNEL;


		// Get Antena
	/* Get Antena */
	byValue = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA);
	byValue = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA);
	if (byValue & EEP_ANTINV)
	if (byValue & EEP_ANTINV)
		pDevice->bTxRxAntInv = true;
		pDevice->bTxRxAntInv = true;
@@ -506,7 +509,8 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
		pDevice->bTxRxAntInv = false;
		pDevice->bTxRxAntInv = false;


	byValue &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
	byValue &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
		if (byValue == 0) // if not set default is All
	/* if not set default is All */
	if (byValue == 0)
		byValue = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
		byValue = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);


	pDevice->ulDiversityNValue = 100*260;
	pDevice->ulDiversityNValue = 100*260;
@@ -521,12 +525,15 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
		pDevice->byTxAntennaMode = ANT_B;
		pDevice->byTxAntennaMode = ANT_B;
		pDevice->dwTxAntennaSel = 1;
		pDevice->dwTxAntennaSel = 1;
		pDevice->dwRxAntennaSel = 1;
		pDevice->dwRxAntennaSel = 1;

		if (pDevice->bTxRxAntInv)
		if (pDevice->bTxRxAntInv)
			pDevice->byRxAntennaMode = ANT_A;
			pDevice->byRxAntennaMode = ANT_A;
		else
		else
			pDevice->byRxAntennaMode = ANT_B;
			pDevice->byRxAntennaMode = ANT_B;
			// chester for antenna

			byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA);
		byValue1 = SROMbyReadEmbedded(pDevice->PortOffset,
					      EEP_OFS_ANTENNA);

		if ((byValue1 & 0x08) == 0)
		if ((byValue1 & 0x08) == 0)
			pDevice->bDiversityEnable = false;
			pDevice->bDiversityEnable = false;
		else
		else
@@ -536,60 +543,73 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
		pDevice->byAntennaCount = 1;
		pDevice->byAntennaCount = 1;
		pDevice->dwTxAntennaSel = 0;
		pDevice->dwTxAntennaSel = 0;
		pDevice->dwRxAntennaSel = 0;
		pDevice->dwRxAntennaSel = 0;

		if (byValue & EEP_ANTENNA_AUX) {
		if (byValue & EEP_ANTENNA_AUX) {
			pDevice->byTxAntennaMode = ANT_A;
			pDevice->byTxAntennaMode = ANT_A;

			if (pDevice->bTxRxAntInv)
			if (pDevice->bTxRxAntInv)
				pDevice->byRxAntennaMode = ANT_B;
				pDevice->byRxAntennaMode = ANT_B;
			else
			else
				pDevice->byRxAntennaMode = ANT_A;
				pDevice->byRxAntennaMode = ANT_A;
		} else {
		} else {
			pDevice->byTxAntennaMode = ANT_B;
			pDevice->byTxAntennaMode = ANT_B;

			if (pDevice->bTxRxAntInv)
			if (pDevice->bTxRxAntInv)
				pDevice->byRxAntennaMode = ANT_A;
				pDevice->byRxAntennaMode = ANT_A;
			else
			else
				pDevice->byRxAntennaMode = ANT_B;
				pDevice->byRxAntennaMode = ANT_B;
		}
		}
	}
	}
		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n",
			pDevice->bDiversityEnable, (int)pDevice->ulDiversityNValue, (int)pDevice->ulDiversityMValue, pDevice->byTMax, pDevice->byTMax2);


//2008-8-4 <add> by chester
	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
//zonetype initial
		"bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n",
		pDevice->bDiversityEnable, (int)pDevice->ulDiversityNValue,
		(int)pDevice->ulDiversityMValue, pDevice->byTMax, pDevice->byTMax2);

	/* zonetype initial */
	pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
	pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
	zonetype = Config_FileOperation(pDevice, false, NULL);
	zonetype = Config_FileOperation(pDevice, false, NULL);
		if (zonetype >= 0) {         //read zonetype file ok!

	if (zonetype >= 0) {
		if ((zonetype == 0) &&
		if ((zonetype == 0) &&
			    (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) {          //for USA
		    (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) {
			/* for USA */
			pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
			pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
			pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
			pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;

			DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :USA\n");
			DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :USA\n");
		} else if ((zonetype == 1) &&
		} else if ((zonetype == 1) &&
				 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) {   //for Japan
			 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) {
			/* for Japan */
			pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
			pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
			pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
			pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
		} else if ((zonetype == 2) &&
		} else if ((zonetype == 2) &&
				 (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) {   //for Europe
			  (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) {
			/* for Europe */
			pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
			pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
			pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
			pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :Europe\n");
			}


			else {
			DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :Europe\n");
		} else {
			if (zonetype != pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
			if (zonetype != pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
					pr_debug("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n", zonetype, pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
				pr_debug("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",
					 zonetype,
					 pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
			else
			else
					pr_debug("Read Zonetype file success,use default zonetype setting[%02x]\n", zonetype);
				pr_debug("Read Zonetype file success,use default zonetype setting[%02x]\n",
					 zonetype);
		}
	} else {
		pr_debug("Read Zonetype file fail,use default zonetype setting[%02x]\n",
			 SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE));
	}
	}
		} else
			pr_debug("Read Zonetype file fail,use default zonetype setting[%02x]\n", SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE));


		// Get RFType
	/* Get RFType */
	pDevice->byRFType = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RFTYPE);
	pDevice->byRFType = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RFTYPE);


		if ((pDevice->byRFType & RF_EMU) != 0) {
	/* force change RevID for VT3253 emu */
			// force change RevID for VT3253 emu
	if ((pDevice->byRFType & RF_EMU) != 0)
			pDevice->byRevId = 0x80;
			pDevice->byRevId = 0x80;
		}


	pDevice->byRFType &= RF_MASK;
	pDevice->byRFType &= RF_MASK;
	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType);
	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType);
@@ -599,30 +619,33 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)


	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType);
	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType);


		//Init RF module
	/* Init RF module */
	RFbInit(pDevice);
	RFbInit(pDevice);


		//Get Desire Power Value
	/* Get Desire Power Value */
	pDevice->byCurPwr = 0xFF;
	pDevice->byCurPwr = 0xFF;
	pDevice->byCCKPwr = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_CCK);
	pDevice->byCCKPwr = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_CCK);
	pDevice->byOFDMPwrG = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_OFDMG);
	pDevice->byOFDMPwrG = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_OFDMG);


		// Load power Table
	/* Load power Table */

	for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) {
	for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) {
			pDevice->abyCCKPwrTbl[ii + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_CCK_PWR_TBL));
		pDevice->abyCCKPwrTbl[ii + 1] =
			SROMbyReadEmbedded(pDevice->PortOffset,
					   (unsigned char)(ii + EEP_OFS_CCK_PWR_TBL));
		if (pDevice->abyCCKPwrTbl[ii + 1] == 0)
		if (pDevice->abyCCKPwrTbl[ii + 1] == 0)
			pDevice->abyCCKPwrTbl[ii+1] = pDevice->byCCKPwr;
			pDevice->abyCCKPwrTbl[ii+1] = pDevice->byCCKPwr;


			pDevice->abyOFDMPwrTbl[ii + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDM_PWR_TBL));
		pDevice->abyOFDMPwrTbl[ii + 1] =
			SROMbyReadEmbedded(pDevice->PortOffset,
					   (unsigned char)(ii + EEP_OFS_OFDM_PWR_TBL));
		if (pDevice->abyOFDMPwrTbl[ii + 1] == 0)
		if (pDevice->abyOFDMPwrTbl[ii + 1] == 0)
			pDevice->abyOFDMPwrTbl[ii + 1] = pDevice->byOFDMPwrG;
			pDevice->abyOFDMPwrTbl[ii + 1] = pDevice->byOFDMPwrG;


		pDevice->abyCCKDefaultPwr[ii + 1] = byCCKPwrdBm;
		pDevice->abyCCKDefaultPwr[ii + 1] = byCCKPwrdBm;
		pDevice->abyOFDMDefaultPwr[ii + 1] = byOFDMPwrdBm;
		pDevice->abyOFDMDefaultPwr[ii + 1] = byOFDMPwrdBm;
	}
	}
		//2008-8-4 <add> by chester

		//recover 12,13 ,14channel for EUROPE by 11 channel
	/* recover 12,13 ,14channel for EUROPE by 11 channel */
	if (((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) ||
	if (((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) ||
	     (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe)) &&
	     (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe)) &&
	    (pDevice->byOriginalZonetype == ZoneType_USA)) {
	    (pDevice->byOriginalZonetype == ZoneType_USA)) {
@@ -633,32 +656,42 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
		}
		}
	}
	}


		// Load OFDM A Power Table
	/* Load OFDM A Power Table */
		for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { //RobertYu:20041224, bug using CB_MAX_CHANNEL
	for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) {
			pDevice->abyOFDMPwrTbl[ii + CB_MAX_CHANNEL_24G + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_TBL));
		pDevice->abyOFDMPwrTbl[ii + CB_MAX_CHANNEL_24G + 1] =
			pDevice->abyOFDMDefaultPwr[ii + CB_MAX_CHANNEL_24G + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_dBm));
			SROMbyReadEmbedded(pDevice->PortOffset,
					   (unsigned char)(ii + EEP_OFS_OFDMA_PWR_TBL));

		pDevice->abyOFDMDefaultPwr[ii + CB_MAX_CHANNEL_24G + 1] =
			SROMbyReadEmbedded(pDevice->PortOffset,
					   (unsigned char)(ii + EEP_OFS_OFDMA_PWR_dBm));
	}
	}

	init_channel_table((void *)pDevice);
	init_channel_table((void *)pDevice);


	if (pDevice->byLocalID > REV_ID_VT3253_B1) {
	if (pDevice->byLocalID > REV_ID_VT3253_B1) {
		MACvSelectPage1(pDevice->PortOffset);
		MACvSelectPage1(pDevice->PortOffset);
			VNSvOutPortB(pDevice->PortOffset + MAC_REG_MSRCTL + 1, (MSRCTL1_TXPWR | MSRCTL1_CSAPAREN));

		VNSvOutPortB(pDevice->PortOffset + MAC_REG_MSRCTL + 1,
			     (MSRCTL1_TXPWR | MSRCTL1_CSAPAREN));

		MACvSelectPage0(pDevice->PortOffset);
		MACvSelectPage0(pDevice->PortOffset);
	}
	}


		// use relative tx timeout and 802.11i D4
	/* use relative tx timeout and 802.11i D4 */
		MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_CFG, (CFG_TKIPOPT | CFG_NOTXTIMEOUT));
	MACvWordRegBitsOn(pDevice->PortOffset,
			  MAC_REG_CFG, (CFG_TKIPOPT | CFG_NOTXTIMEOUT));


		// set performance parameter by registry
	/* set performance parameter by registry */
	MACvSetShortRetryLimit(pDevice->PortOffset, pDevice->byShortRetryLimit);
	MACvSetShortRetryLimit(pDevice->PortOffset, pDevice->byShortRetryLimit);
	MACvSetLongRetryLimit(pDevice->PortOffset, pDevice->byLongRetryLimit);
	MACvSetLongRetryLimit(pDevice->PortOffset, pDevice->byLongRetryLimit);


		// reset TSF counter
	/* reset TSF counter */
	VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
	VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
		// enable TSF counter
	/* enable TSF counter */
	VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
	VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);


		// initialize BBP registers
	/* initialize BBP registers */
	BBbVT3253Init(pDevice);
	BBbVT3253Init(pDevice);


	if (pDevice->bUpdateBBVGA) {
	if (pDevice->bUpdateBBVGA) {
@@ -666,39 +699,43 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
		pDevice->byBBVGANew = pDevice->byBBVGACurrent;
		pDevice->byBBVGANew = pDevice->byBBVGACurrent;
		BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]);
		BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]);
	}
	}

	BBvSetRxAntennaMode(pDevice->PortOffset, pDevice->byRxAntennaMode);
	BBvSetRxAntennaMode(pDevice->PortOffset, pDevice->byRxAntennaMode);
	BBvSetTxAntennaMode(pDevice->PortOffset, pDevice->byTxAntennaMode);
	BBvSetTxAntennaMode(pDevice->PortOffset, pDevice->byTxAntennaMode);


	pDevice->byCurrentCh = 0;
	pDevice->byCurrentCh = 0;


		// Set BB and packet type at the same time.
	/* Set BB and packet type at the same time. */
		// Set Short Slot Time, xIFS, and RSPINF.
	/* Set Short Slot Time, xIFS, and RSPINF. */
	if (pDevice->uConnectionRate == RATE_AUTO)
	if (pDevice->uConnectionRate == RATE_AUTO)
		pDevice->wCurrentRate = RATE_54M;
		pDevice->wCurrentRate = RATE_54M;
	else
	else
		pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
		pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;


		// default G Mode
	/* default G Mode */
	VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_11G);
	VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_11G);
	VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_AUTO);
	VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_AUTO);


	pDevice->bRadioOff = false;
	pDevice->bRadioOff = false;


		pDevice->byRadioCtl = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RADIOCTL);
	pDevice->byRadioCtl = SROMbyReadEmbedded(pDevice->PortOffset,
						 EEP_OFS_RADIOCTL);
	pDevice->bHWRadioOff = false;
	pDevice->bHWRadioOff = false;


	if (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) {
	if (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) {
			// Get GPIO
		/* Get GPIO */
		MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO);
		MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO);
//2008-4-14 <add> by chester for led issue

		if (((pDevice->byGPIO & GPIO0_DATA) && !(pDevice->byRadioCtl & EEP_RADIOCTL_INV)) ||
		if (((pDevice->byGPIO & GPIO0_DATA) &&
		    (!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) {
		     !(pDevice->byRadioCtl & EEP_RADIOCTL_INV)) ||
		     (!(pDevice->byGPIO & GPIO0_DATA) &&
		     (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
			pDevice->bHWRadioOff = true;
			pDevice->bHWRadioOff = true;
	}
	}
	}

	if (pDevice->bHWRadioOff || pDevice->bRadioControlOff)
	if (pDevice->bHWRadioOff || pDevice->bRadioControlOff)
		CARDbRadioPowerOff(pDevice);
		CARDbRadioPowerOff(pDevice);
}

pMgmt->eScanType = WMAC_SCAN_PASSIVE;
pMgmt->eScanType = WMAC_SCAN_PASSIVE;
// get Permanent network address
// get Permanent network address
SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
@@ -1642,7 +1679,8 @@ static int device_open(struct net_device *dev)
	vMgrTimerInit(pDevice);
	vMgrTimerInit(pDevice);


	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n");
	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n");
	device_init_registers(pDevice, DEVICE_INIT_COLD);
	device_init_registers(pDevice);

	MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
	MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
	memcpy(pDevice->pMgmt->abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN);
	memcpy(pDevice->pMgmt->abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN);
	device_set_multi(pDevice->dev);
	device_set_multi(pDevice->dev);
@@ -3187,7 +3225,7 @@ viawget_resume(struct pci_dev *pcid)
	if (netif_running(pDevice->dev)) {
	if (netif_running(pDevice->dev)) {
		spin_lock_irq(&pDevice->lock);
		spin_lock_irq(&pDevice->lock);
		MACvRestoreContext(pDevice->PortOffset, pDevice->abyMacContext);
		MACvRestoreContext(pDevice->PortOffset, pDevice->abyMacContext);
		device_init_registers(pDevice, DEVICE_INIT_DXPL);
		device_init_registers(pDevice);
		if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS
		if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS
			pMgmt->sNodeDBTable[0].bActive = false;
			pMgmt->sNodeDBTable[0].bActive = false;
			pDevice->bLinkPass = false;
			pDevice->bLinkPass = false;