Commit cbc06fb1 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6656: cleanup device_init_registers

White space and formatting clean up.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 748bf69c
...@@ -294,7 +294,6 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) ...@@ -294,7 +294,6 @@ static void device_init_diversity_timer(struct vnt_private *pDevice)
/* /*
* initialization of MAC & BBP registers * initialization of MAC & BBP registers
*/ */
static int device_init_registers(struct vnt_private *pDevice) static int device_init_registers(struct vnt_private *pDevice)
{ {
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
...@@ -317,30 +316,29 @@ static int device_init_registers(struct vnt_private *pDevice) ...@@ -317,30 +316,29 @@ static int device_init_registers(struct vnt_private *pDevice)
memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN);
memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN);
memcpy(pDevice->abySNAP_Bridgetunnel, memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN);
abySNAP_Bridgetunnel,
ETH_ALEN); if (!FIRMWAREbCheckVersion(pDevice)) {
if (FIRMWAREbDownload(pDevice) == true) {
if ( !FIRMWAREbCheckVersion(pDevice) ) { if (FIRMWAREbBrach2Sram(pDevice) == false) {
if (FIRMWAREbDownload(pDevice) == true) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
if (FIRMWAREbBrach2Sram(pDevice) == false) { " FIRMWAREbBrach2Sram fail\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" FIRMWAREbBrach2Sram fail \n"); spin_unlock_irq(&pDevice->lock);
spin_unlock_irq(&pDevice->lock); return false;
return false; }
} } else {
} else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
" FIRMWAREbDownload fail\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" FIRMWAREbDownload fail \n"); spin_unlock_irq(&pDevice->lock);
spin_unlock_irq(&pDevice->lock); return false;
return false; }
} }
}
if ( !BBbVT3184Init(pDevice) ) { if (!BBbVT3184Init(pDevice)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" BBbVT3184Init fail \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" BBbVT3184Init fail\n");
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return false; return false;
} }
init_cmd->init_class = DEVICE_INIT_COLD; init_cmd->init_class = DEVICE_INIT_COLD;
init_cmd->exist_sw_net_addr = (u8) pDevice->bExistSWNetAddr; init_cmd->exist_sw_net_addr = (u8) pDevice->bExistSWNetAddr;
...@@ -353,12 +351,11 @@ static int device_init_registers(struct vnt_private *pDevice) ...@@ -353,12 +351,11 @@ static int device_init_registers(struct vnt_private *pDevice)
ntStatus = CONTROLnsRequestOut(pDevice, ntStatus = CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_CARDINIT, 0, 0, MESSAGE_TYPE_CARDINIT, 0, 0,
sizeof(struct vnt_cmd_card_init), (u8 *)init_cmd); sizeof(struct vnt_cmd_card_init), (u8 *)init_cmd);
if (ntStatus != STATUS_SUCCESS) {
if ( ntStatus != STATUS_SUCCESS ) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Issue Card init fail \n"); spin_unlock_irq(&pDevice->lock);
spin_unlock_irq(&pDevice->lock); return false;
return false; }
}
ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_INIT_RSP, 0, 0, ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_INIT_RSP, 0, 0,
sizeof(struct vnt_rsp_card_init), (u8 *)init_rsp); sizeof(struct vnt_rsp_card_init), (u8 *)init_rsp);
...@@ -500,30 +497,30 @@ static int device_init_registers(struct vnt_private *pDevice) ...@@ -500,30 +497,30 @@ static int device_init_registers(struct vnt_private *pDevice)
pDevice->byTMax3 = 64; pDevice->byTMax3 = 64;
/* get Auto Fall Back type */ /* get Auto Fall Back type */
pDevice->byAutoFBCtrl = AUTO_FB_0; pDevice->byAutoFBCtrl = AUTO_FB_0;
/* set SCAN Time */ /* set SCAN Time */
pDevice->uScanTime = WLAN_SCAN_MINITIME; pDevice->uScanTime = WLAN_SCAN_MINITIME;
/* default Auto Mode */ /* default Auto Mode */
/* pDevice->NetworkType = Ndis802_11Automode; */ /* pDevice->NetworkType = Ndis802_11Automode; */
pDevice->eConfigPHYMode = PHY_TYPE_AUTO; pDevice->eConfigPHYMode = PHY_TYPE_AUTO;
pDevice->byBBType = BB_TYPE_11G; pDevice->byBBType = BB_TYPE_11G;
/* initialize BBP registers */ /* initialize BBP registers */
pDevice->ulTxPower = 25; pDevice->ulTxPower = 25;
/* get channel range */ /* get channel range */
pDevice->byMinChannel = 1; pDevice->byMinChannel = 1;
pDevice->byMaxChannel = CB_MAX_CHANNEL; pDevice->byMaxChannel = CB_MAX_CHANNEL;
/* get RFType */ /* get RFType */
pDevice->byRFType = init_rsp->rf_type; pDevice->byRFType = init_rsp->rf_type;
if ((pDevice->byRFType & RF_EMU) != 0) { if ((pDevice->byRFType & RF_EMU) != 0) {
/* force change RevID for VT3253 emu */ /* force change RevID for VT3253 emu */
pDevice->byRevId = 0x80; pDevice->byRevId = 0x80;
} }
/* load vt3266 calibration parameters in EEPROM */ /* load vt3266 calibration parameters in EEPROM */
if (pDevice->byRFType == RF_VT3226D0) { if (pDevice->byRFType == RF_VT3226D0) {
...@@ -536,105 +533,113 @@ static int device_init_registers(struct vnt_private *pDevice) ...@@ -536,105 +533,113 @@ static int device_init_registers(struct vnt_private *pDevice)
if (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) { if (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) {
/* CR255, enable TX/RX IQ and DC compensation mode */ /* CR255, enable TX/RX IQ and DC compensation mode */
ControlvWriteByte(pDevice, ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG, MESSAGE_REQUEST_BBREG,
0xFF, 0xff,
0x03); 0x03);
/* CR251, TX I/Q Imbalance Calibration */ /* CR251, TX I/Q Imbalance Calibration */
ControlvWriteByte(pDevice, ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG, MESSAGE_REQUEST_BBREG,
0xFB, 0xfb,
byCalibTXIQ); byCalibTXIQ);
/* CR252, TX DC-Offset Calibration */ /* CR252, TX DC-Offset Calibration */
ControlvWriteByte(pDevice, ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG, MESSAGE_REQUEST_BBREG,
0xFC, 0xfC,
byCalibTXDC); byCalibTXDC);
/* CR253, RX I/Q Imbalance Calibration */ /* CR253, RX I/Q Imbalance Calibration */
ControlvWriteByte(pDevice, ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG, MESSAGE_REQUEST_BBREG,
0xFD, 0xfd,
byCalibRXIQ); byCalibRXIQ);
} else { } else {
/* CR255, turn off BB Calibration compensation */ /* CR255, turn off BB Calibration compensation */
ControlvWriteByte(pDevice, ControlvWriteByte(pDevice,
MESSAGE_REQUEST_BBREG, MESSAGE_REQUEST_BBREG,
0xFF, 0xff,
0x0); 0x0);
} }
} }
} }
pMgmt->eScanType = WMAC_SCAN_PASSIVE;
pMgmt->uCurrChannel = pDevice->uChannel; pMgmt->eScanType = WMAC_SCAN_PASSIVE;
pMgmt->uIBSSChannel = pDevice->uChannel; pMgmt->uCurrChannel = pDevice->uChannel;
CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); pMgmt->uIBSSChannel = pDevice->uChannel;
CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel);
/* get permanent network address */ /* get permanent network address */
memcpy(pDevice->abyPermanentNetAddr, init_rsp->net_addr, 6); memcpy(pDevice->abyPermanentNetAddr, init_rsp->net_addr, 6);
memcpy(pDevice->abyCurrentNetAddr, memcpy(pDevice->abyCurrentNetAddr,
pDevice->abyPermanentNetAddr, pDevice->abyPermanentNetAddr, ETH_ALEN);
ETH_ALEN);
/* if exist SW network address, use it */ /* if exist SW network address, use it */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n",
pDevice->abyCurrentNetAddr); pDevice->abyCurrentNetAddr);
/* /*
* 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->byBBType == BB_TYPE_11A) { if (pDevice->byBBType == BB_TYPE_11A) {
CARDbAddBasicRate(pDevice, RATE_6M); CARDbAddBasicRate(pDevice, RATE_6M);
pDevice->bShortSlotTime = true; pDevice->bShortSlotTime = true;
} else { } else {
CARDbAddBasicRate(pDevice, RATE_1M); CARDbAddBasicRate(pDevice, RATE_1M);
pDevice->bShortSlotTime = false; pDevice->bShortSlotTime = false;
} }
BBvSetShortSlotTime(pDevice);
CARDvSetBSSMode(pDevice);
if (pDevice->bUpdateBBVGA) { BBvSetShortSlotTime(pDevice);
pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; CARDvSetBSSMode(pDevice);
pDevice->byBBVGANew = pDevice->byBBVGACurrent;
BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]);
}
pDevice->byRadioCtl = pDevice->abyEEPROM[EEP_OFS_RADIOCTL]; if (pDevice->bUpdateBBVGA) {
pDevice->bHWRadioOff = false; pDevice->byBBVGACurrent = pDevice->abyBBVGA[0];
if ( (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) != 0 ) { pDevice->byBBVGANew = pDevice->byBBVGACurrent;
ntStatus = CONTROLnsRequestIn(pDevice,
MESSAGE_TYPE_READ,
MAC_REG_GPIOCTL1,
MESSAGE_REQUEST_MACREG,
1,
&byTmp);
if ( ntStatus != STATUS_SUCCESS ) {
spin_unlock_irq(&pDevice->lock);
return false;
}
if ( (byTmp & GPIO3_DATA) == 0 ) {
pDevice->bHWRadioOff = true;
MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD);
} else {
MACvRegBitsOff(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD);
pDevice->bHWRadioOff = false;
}
} BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]);
}
ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_TMLEN,0x38); pDevice->byRadioCtl = pDevice->abyEEPROM[EEP_OFS_RADIOCTL];
ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); pDevice->bHWRadioOff = false;
MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL0,0x01);
if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) { if ((pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) != 0) {
CARDbRadioPowerOff(pDevice); ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ,
} else { MAC_REG_GPIOCTL1, MESSAGE_REQUEST_MACREG, 1, &byTmp);
CARDbRadioPowerOn(pDevice);
}
spin_unlock_irq(&pDevice->lock); if (ntStatus != STATUS_SUCCESS) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----INIbInitAdapter Exit\n"); spin_unlock_irq(&pDevice->lock);
return true; return false;
}
if ((byTmp & GPIO3_DATA) == 0) {
pDevice->bHWRadioOff = true;
MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD);
} else {
MACvRegBitsOff(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD);
pDevice->bHWRadioOff = false;
}
}
ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG,
MAC_REG_PAPEDELAY, LEDSTS_TMLEN, 0x38);
ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG,
MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL0, 0x01);
if ((pDevice->bHWRadioOff == true) ||
(pDevice->bRadioControlOff == true)) {
CARDbRadioPowerOff(pDevice);
} else {
CARDbRadioPowerOn(pDevice);
}
spin_unlock_irq(&pDevice->lock);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----INIbInitAdapter Exit\n");
return true;
} }
#ifdef CONFIG_PM /* Minimal support for suspend and resume */ #ifdef CONFIG_PM /* Minimal support for suspend and resume */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment