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

staging: vt6656: device.h Remove typedef enum __device_init_type.

Since typedef enum __device_init_type is only ever called
in one state.

Remove the typedef from main_usb.c:device_init_registers and
replace with macro values. The other values may be needed later.

Apply cold value to sInitCmd.byInitClass.

Remove if braces and correct formatting within.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a72f8bee
...@@ -149,11 +149,9 @@ typedef enum __device_msg_level { ...@@ -149,11 +149,9 @@ 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 { #define DEVICE_INIT_COLD 0x0 /* cold init */
DEVICE_INIT_COLD = 0, /* cold init */ #define DEVICE_INIT_RESET 0x1 /* reset init or Dx to D0 power remain */
DEVICE_INIT_RESET, /* reset init or Dx to D0 power remain */ #define DEVICE_INIT_DXPL 0x2 /* Dx to D0 power lost init */
DEVICE_INIT_DXPL /* Dx to D0 power lost init */
} DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;
/* USB */ /* USB */
......
...@@ -215,8 +215,7 @@ static void device_set_multi(struct net_device *dev); ...@@ -215,8 +215,7 @@ static void device_set_multi(struct net_device *dev);
static int device_close(struct net_device *dev); static int device_close(struct net_device *dev);
static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static int device_init_registers(struct vnt_private *pDevice, static int device_init_registers(struct vnt_private *pDevice);
DEVICE_INIT_TYPE InitType);
static bool device_init_defrag_cb(struct vnt_private *pDevice); static bool device_init_defrag_cb(struct vnt_private *pDevice);
static void device_init_diversity_timer(struct vnt_private *pDevice); static void device_init_diversity_timer(struct vnt_private *pDevice);
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev); static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev);
...@@ -297,8 +296,7 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) ...@@ -297,8 +296,7 @@ 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)
DEVICE_INIT_TYPE InitType)
{ {
struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
...@@ -313,9 +311,11 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -313,9 +311,11 @@ static int device_init_registers(struct vnt_private *pDevice,
u8 byTmp; u8 byTmp;
u8 byCalibTXIQ = 0, byCalibTXDC = 0, byCalibRXIQ = 0; u8 byCalibTXIQ = 0, byCalibTXDC = 0, byCalibRXIQ = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", InitType, pDevice->byPacketType); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n",
DEVICE_INIT_COLD, pDevice->byPacketType);
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
if (InitType == DEVICE_INIT_COLD) {
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,
...@@ -342,9 +342,8 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -342,9 +342,8 @@ static int device_init_registers(struct vnt_private *pDevice,
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return false; return false;
} }
}
sInitCmd.byInitClass = (u8)InitType; sInitCmd.byInitClass = DEVICE_INIT_COLD;
sInitCmd.bExistSWNetAddr = (u8) pDevice->bExistSWNetAddr; sInitCmd.bExistSWNetAddr = (u8) pDevice->bExistSWNetAddr;
for (ii = 0; ii < 6; ii++) for (ii = 0; ii < 6; ii++)
sInitCmd.bySWNetAddr[ii] = pDevice->abyCurrentNetAddr[ii]; sInitCmd.bySWNetAddr[ii] = pDevice->abyCurrentNetAddr[ii];
...@@ -364,25 +363,21 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -364,25 +363,21 @@ static int device_init_registers(struct vnt_private *pDevice,
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return false; return false;
} }
if (InitType == DEVICE_INIT_COLD) {
ntStatus = CONTROLnsRequestIn(pDevice,MESSAGE_TYPE_INIT_RSP,0,0,sizeof(RSP_CARD_INIT), (u8 *) &(sInitRsp));
ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_INIT_RSP, 0, 0,
sizeof(RSP_CARD_INIT), (u8 *) &(sInitRsp));
if (ntStatus != STATUS_SUCCESS) { if (ntStatus != STATUS_SUCCESS) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Cardinit request in status fail!\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"Cardinit request in status fail!\n");
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return false; return false;
} }
/* local ID for AES functions */ /* local ID for AES functions */
ntStatus = CONTROLnsRequestIn(pDevice, ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ,
MESSAGE_TYPE_READ, MAC_REG_LOCALID, MESSAGE_REQUEST_MACREG, 1,
MAC_REG_LOCALID,
MESSAGE_REQUEST_MACREG,
1,
&pDevice->byLocalID); &pDevice->byLocalID);
if (ntStatus != STATUS_SUCCESS) {
if ( ntStatus != STATUS_SUCCESS ) {
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return false; return false;
} }
...@@ -395,10 +390,10 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -395,10 +390,10 @@ static int device_init_registers(struct vnt_private *pDevice,
/* only used in 11g type, sync with ERP IE */ /* only used in 11g type, sync with ERP IE */
pDevice->bNonERPPresent = false; pDevice->bNonERPPresent = false;
pDevice->bBarkerPreambleMd = false; pDevice->bBarkerPreambleMd = false;
if ( pDevice->bFixRate ) { if (pDevice->bFixRate) {
pDevice->wCurrentRate = (u16) pDevice->uConnectionRate; pDevice->wCurrentRate = (u16)pDevice->uConnectionRate;
} else { } else {
if ( pDevice->byBBType == BB_TYPE_11B ) if (pDevice->byBBType == BB_TYPE_11B)
pDevice->wCurrentRate = RATE_11M; pDevice->wCurrentRate = RATE_11M;
else else
pDevice->wCurrentRate = RATE_54M; pDevice->wCurrentRate = RATE_54M;
...@@ -416,10 +411,13 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -416,10 +411,13 @@ static int device_init_registers(struct vnt_private *pDevice,
pDevice->byOFDMPwrG = pDevice->abyEEPROM[EEP_OFS_PWR_OFDMG]; pDevice->byOFDMPwrG = pDevice->abyEEPROM[EEP_OFS_PWR_OFDMG];
/* load power table */ /* load power table */
for (ii = 0; ii < 14; ii++) { for (ii = 0; ii < 14; ii++) {
pDevice->abyCCKPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL]; pDevice->abyCCKPwrTbl[ii] =
pDevice->abyEEPROM[ii + EEP_OFS_CCK_PWR_TBL];
if (pDevice->abyCCKPwrTbl[ii] == 0) if (pDevice->abyCCKPwrTbl[ii] == 0)
pDevice->abyCCKPwrTbl[ii] = pDevice->byCCKPwr; pDevice->abyCCKPwrTbl[ii] = pDevice->byCCKPwr;
pDevice->abyOFDMPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_OFDM_PWR_TBL]; pDevice->abyOFDMPwrTbl[ii] =
pDevice->abyEEPROM[ii + EEP_OFS_OFDM_PWR_TBL];
if (pDevice->abyOFDMPwrTbl[ii] == 0) if (pDevice->abyOFDMPwrTbl[ii] == 0)
pDevice->abyOFDMPwrTbl[ii] = pDevice->byOFDMPwrG; pDevice->abyOFDMPwrTbl[ii] = pDevice->byOFDMPwrG;
} }
...@@ -428,8 +426,8 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -428,8 +426,8 @@ static int device_init_registers(struct vnt_private *pDevice,
* original zonetype is USA, but custom zonetype is Europe, * original zonetype is USA, but custom zonetype is Europe,
* then need to recover 12, 13, 14 channels with 11 channel * then need to recover 12, 13, 14 channels with 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)) {
for (ii = 11; ii < 14; ii++) { for (ii = 11; ii < 14; ii++) {
pDevice->abyCCKPwrTbl[ii] = pDevice->abyCCKPwrTbl[10]; pDevice->abyCCKPwrTbl[ii] = pDevice->abyCCKPwrTbl[10];
...@@ -441,12 +439,15 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -441,12 +439,15 @@ static int device_init_registers(struct vnt_private *pDevice,
/* load OFDM A power table */ /* load OFDM A power table */
for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) {
pDevice->abyOFDMAPwrTbl[ii] = pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL]; pDevice->abyOFDMAPwrTbl[ii] =
pDevice->abyEEPROM[ii + EEP_OFS_OFDMA_PWR_TBL];
if (pDevice->abyOFDMAPwrTbl[ii] == 0) if (pDevice->abyOFDMAPwrTbl[ii] == 0)
pDevice->abyOFDMAPwrTbl[ii] = pDevice->byOFDMPwrA; pDevice->abyOFDMAPwrTbl[ii] = pDevice->byOFDMPwrA;
} }
byAntenna = pDevice->abyEEPROM[EEP_OFS_ANTENNA]; byAntenna = pDevice->abyEEPROM[EEP_OFS_ANTENNA];
if (byAntenna & EEP_ANTINV) if (byAntenna & EEP_ANTINV)
pDevice->bTxRxAntInv = true; pDevice->bTxRxAntInv = true;
else else
...@@ -462,6 +463,7 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -462,6 +463,7 @@ static int device_init_registers(struct vnt_private *pDevice,
pDevice->byTxAntennaMode = ANT_B; pDevice->byTxAntennaMode = ANT_B;
pDevice->dwTxAntennaSel = 1; pDevice->dwTxAntennaSel = 1;
pDevice->dwRxAntennaSel = 1; pDevice->dwRxAntennaSel = 1;
if (pDevice->bTxRxAntInv == true) if (pDevice->bTxRxAntInv == true)
pDevice->byRxAntennaMode = ANT_A; pDevice->byRxAntennaMode = ANT_A;
else else
...@@ -476,22 +478,26 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -476,22 +478,26 @@ static int device_init_registers(struct vnt_private *pDevice,
pDevice->byAntennaCount = 1; pDevice->byAntennaCount = 1;
pDevice->dwTxAntennaSel = 0; pDevice->dwTxAntennaSel = 0;
pDevice->dwRxAntennaSel = 0; pDevice->dwRxAntennaSel = 0;
if (byAntenna & EEP_ANTENNA_AUX) { if (byAntenna & EEP_ANTENNA_AUX) {
pDevice->byTxAntennaMode = ANT_A; pDevice->byTxAntennaMode = ANT_A;
if (pDevice->bTxRxAntInv == true) if (pDevice->bTxRxAntInv == true)
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 == true) if (pDevice->bTxRxAntInv == true)
pDevice->byRxAntennaMode = ANT_A; pDevice->byRxAntennaMode = ANT_A;
else else
pDevice->byRxAntennaMode = ANT_B; pDevice->byRxAntennaMode = ANT_B;
} }
} }
pDevice->ulDiversityNValue = 100*255;
pDevice->ulDiversityMValue = 100*16; pDevice->ulDiversityNValue = 100 * 255;
pDevice->ulDiversityMValue = 100 * 16;
pDevice->byTMax = 1; pDevice->byTMax = 1;
pDevice->byTMax2 = 4; pDevice->byTMax2 = 4;
pDevice->ulSQ3TH = 0; pDevice->ulSQ3TH = 0;
...@@ -525,12 +531,13 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -525,12 +531,13 @@ static int device_init_registers(struct vnt_private *pDevice,
/* load vt3266 calibration parameters in EEPROM */ /* load vt3266 calibration parameters in EEPROM */
if (pDevice->byRFType == RF_VT3226D0) { if (pDevice->byRFType == RF_VT3226D0) {
if((pDevice->abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) && if ((pDevice->abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) &&
(pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) { (pDevice->abyEEPROM[EEP_OFS_MINOR_VER] >= 0x4)) {
byCalibTXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_IQ]; byCalibTXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_IQ];
byCalibTXDC = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_DC]; byCalibTXDC = pDevice->abyEEPROM[EEP_OFS_CALIB_TX_DC];
byCalibRXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_RX_IQ]; byCalibRXIQ = pDevice->abyEEPROM[EEP_OFS_CALIB_RX_IQ];
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,
...@@ -566,7 +573,7 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -566,7 +573,7 @@ static int device_init_registers(struct vnt_private *pDevice,
CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel);
/* get permanent network address */ /* get permanent network address */
memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6); memcpy(pDevice->abyPermanentNetAddr, &sInitRsp.byNetAddr[0], 6);
memcpy(pDevice->abyCurrentNetAddr, memcpy(pDevice->abyCurrentNetAddr,
pDevice->abyPermanentNetAddr, pDevice->abyPermanentNetAddr,
ETH_ALEN); ETH_ALEN);
...@@ -574,7 +581,6 @@ static int device_init_registers(struct vnt_private *pDevice, ...@@ -574,7 +581,6 @@ static int device_init_registers(struct vnt_private *pDevice,
/* 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
...@@ -962,7 +968,7 @@ static int device_open(struct net_device *dev) ...@@ -962,7 +968,7 @@ static int device_open(struct net_device *dev)
/* read config file */ /* read config file */
Read_config_file(pDevice); Read_config_file(pDevice);
if (device_init_registers(pDevice, DEVICE_INIT_COLD) == false) { if (device_init_registers(pDevice) == false) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " init register fail\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " init register fail\n");
goto free_all; goto free_all;
} }
......
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