Commit 8daba6b9 authored by Larry Finger's avatar Larry Finger Committed by Greg Kroah-Hartman

Staging: r8187se: Remove two private variables that have a fixed value

For the RTL8187SE, the variable priv->rf_chip is always RF_ZEBRA4
and priv->RegThreeWireMode is always HW_THREE_WIRE_SI. Remove these
2 variables.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b1b7621b
......@@ -366,7 +366,6 @@ typedef struct r8180_priv
short diversity;
u8 cs_treshold;
short rcr_csense;
short rf_chip;
u32 key0[4];
short (*rf_set_sens)(struct net_device *dev,short sens);
void (*rf_set_chan)(struct net_device *dev,short ch);
......@@ -479,9 +478,6 @@ typedef struct r8180_priv
u8 retry_rts;
u16 rts;
//add for RF power on power off by lizhaoming 080512
u8 RegThreeWireMode; // See "Three wire mode" defined above, 2006.05.31, by rcnjko.
//by amy for led
LED_STRATEGY_8185 LedStrategy;
//by amy for led
......
......@@ -663,11 +663,8 @@ unsigned char STRENGTH_MAP[] = {
void rtl8180_RSSI_calc(struct net_device *dev, u8 *rssi, u8 *qual)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
u32 temp;
u32 temp2;
u32 temp3;
u32 lsb;
u32 q;
u32 orig_qual;
u8 _rssi;
......@@ -689,88 +686,6 @@ void rtl8180_RSSI_calc(struct net_device *dev, u8 *rssi, u8 *qual)
*qual = temp;
temp2 = *rssi;
switch(priv->rf_chip){
case RFCHIPID_RFMD:
lsb = temp2 & 1;
temp2 &= 0x7e;
if ( !lsb || !(temp2 <= 0x3c) ) {
temp2 = 0x64;
} else {
temp2 = 100 * temp2 / 0x3c;
}
*rssi = temp2 & 0xff;
_rssi = temp2 & 0xff;
break;
case RFCHIPID_INTERSIL:
lsb = temp2;
temp2 &= 0xfffffffe;
temp2 *= 251;
temp3 = temp2;
temp2 <<= 6;
temp3 += temp2;
temp3 <<= 1;
temp2 = 0x4950df;
temp2 -= temp3;
lsb &= 1;
if ( temp2 <= 0x3e0000 ) {
if ( temp2 < 0xffef0000 )
temp2 = 0xffef0000;
} else {
temp2 = 0x3e0000;
}
if ( !lsb ) {
temp2 -= 0xf0000;
} else {
temp2 += 0xf0000;
}
temp3 = 0x4d0000;
temp3 -= temp2;
temp3 *= 100;
temp3 = temp3 / 0x6d;
temp3 >>= 0x10;
_rssi = temp3 & 0xff;
*rssi = temp3 & 0xff;
break;
case RFCHIPID_GCT:
lsb = temp2 & 1;
temp2 &= 0x7e;
if ( ! lsb || !(temp2 <= 0x3c) ){
temp2 = 0x64;
} else {
temp2 = (100 * temp2) / 0x3c;
}
*rssi = temp2 & 0xff;
_rssi = temp2 & 0xff;
break;
case RFCHIPID_PHILIPS:
if( orig_qual <= 0x4e ){
_rssi = STRENGTH_MAP[orig_qual];
*rssi = _rssi;
} else {
orig_qual -= 0x80;
if ( !orig_qual ){
_rssi = 1;
*rssi = 1;
} else {
_rssi = 0x32;
*rssi = 0x32;
}
}
break;
case RFCHIPID_MAXIM:
lsb = temp2 & 1;
temp2 &= 0x7e;
temp2 >>= 1;
temp2 += 0x42;
if( lsb != 0 ){
temp2 += 0xa;
}
*rssi = temp2 & 0xff;
_rssi = temp2 & 0xff;
break;
}
if ( _rssi < 0x64 ){
if ( _rssi == 0 ) {
*rssi = 1;
......@@ -2707,8 +2622,6 @@ short rtl8180_init(struct net_device *dev)
priv->txbeaconcount = 2;
priv->rx_skb_complete = 1;
priv->RegThreeWireMode = HW_THREE_WIRE_SI;
priv->RFChangeInProgress = false;
priv->SetRFPowerStateInProgress = false;
priv->RFProgType = 0;
......@@ -2999,9 +2912,6 @@ short rtl8180_init(struct net_device *dev)
priv->cs_treshold = (eeprom_val & 0xff00) >> 8;
eeprom_93cx6_read(&eeprom, RFCHIPID, &eeprom_val);
priv->rf_chip = 0xff & eeprom_val;
priv->rf_chip = RF_ZEBRA4;
priv->rf_sleep = rtl8225z4_rf_sleep;
priv->rf_wakeup = rtl8225z4_rf_wakeup;
DMESGW("**PLEASE** REPORT SUCCESSFUL/UNSUCCESSFUL TO Realtek!");
......
......@@ -282,30 +282,13 @@ DIG_Zebra(
// Dispatch DIG implementation according to RF.
//
void
DynamicInitGain(
struct net_device *dev
)
DynamicInitGain(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
switch(priv->rf_chip)
{
case RF_ZEBRA2: // [AnnieWorkaround] For Zebra2, 2005-08-01.
case RF_ZEBRA4:
DIG_Zebra( dev );
break;
default:
printk("DynamicInitGain(): unknown RFChipID(%d) !!!\n", priv->rf_chip);
break;
}
DIG_Zebra(dev);
}
void rtl8180_hw_dig_wq (struct work_struct *work)
{
// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
// struct ieee80211_device * ieee = (struct ieee80211_device*)
// container_of(work, struct ieee80211_device, watch_dog_wq);
struct delayed_work *dwork = to_delayed_work(work);
struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_dig_wq);
struct net_device *dev = ieee->dev;
......@@ -1310,44 +1293,24 @@ SetAntenna8185(
switch(u1bAntennaIndex)
{
case 0:
switch(priv->rf_chip)
{
case RF_ZEBRA2:
case RF_ZEBRA4:
// Mac register, main antenna
write_nic_byte(dev, ANTSEL, 0x03);
//base band
write_phy_cck(dev,0x11, 0x9b); // Config CCK RX antenna.
write_phy_ofdm(dev, 0x0d, 0x5c); // Config OFDM RX antenna.
bAntennaSwitched = true;
break;
/* Mac register, main antenna */
write_nic_byte(dev, ANTSEL, 0x03);
/* base band */
write_phy_cck(dev, 0x11, 0x9b); /* Config CCK RX antenna. */
write_phy_ofdm(dev, 0x0d, 0x5c); /* Config OFDM RX antenna. */
default:
printk("SetAntenna8185: unknown RFChipID(%d)\n", priv->rf_chip);
break;
}
bAntennaSwitched = true;
break;
case 1:
switch(priv->rf_chip)
{
case RF_ZEBRA2:
case RF_ZEBRA4:
// Mac register, aux antenna
write_nic_byte(dev, ANTSEL, 0x00);
//base band
write_phy_cck(dev, 0x11, 0xbb); // Config CCK RX antenna.
write_phy_ofdm(dev, 0x0d, 0x54); // Config OFDM RX antenna.
bAntennaSwitched = true;
break;
/* Mac register, aux antenna */
write_nic_byte(dev, ANTSEL, 0x00);
/* base band */
write_phy_cck(dev, 0x11, 0xbb); /* Config CCK RX antenna. */
write_phy_ofdm(dev, 0x0d, 0x54); /* Config OFDM RX antenna. */
bAntennaSwitched = true;
default:
printk("SetAntenna8185: unknown RFChipID(%d)\n", priv->rf_chip);
break;
}
break;
default:
......
......@@ -854,134 +854,48 @@ bool SetZebraRFPowerState8185(struct net_device *dev,
btConfig3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, (btConfig3 | CONFIG3_PARM_En));
switch (priv->rf_chip) {
case RF_ZEBRA2:
switch (eRFPowerState) {
case eRfOn:
RF_WriteReg(dev,0x4,0x9FF);
switch (eRFPowerState) {
case eRfOn:
write_nic_word(dev, 0x37C, 0x00EC);
write_nic_dword(dev, ANAPARAM, ANAPARM_ON);
write_nic_dword(dev, ANAPARAM2, ANAPARM2_ON);
/* turn on AFE */
write_nic_byte(dev, 0x54, 0x00);
write_nic_byte(dev, 0x62, 0x00);
write_nic_byte(dev, CONFIG4, priv->RFProgType);
/* turn on RF */
RF_WriteReg(dev, 0x0, 0x009f); udelay(500);
RF_WriteReg(dev, 0x4, 0x0972); udelay(500);
/* turn on CCK and OFDM */
u1bTmp = read_nic_byte(dev, 0x24E);
write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5 | BIT6))));
break;
case eRfSleep:
break;
case eRfOff:
break;
default:
bResult = false;
break;
}
break;
case RF_ZEBRA4:
switch (eRFPowerState) {
case eRfOn:
write_nic_word(dev, 0x37C, 0x00EC);
/* turn on AFE */
write_nic_byte(dev, 0x54, 0x00);
write_nic_byte(dev, 0x62, 0x00);
/* turn on RF */
RF_WriteReg(dev, 0x0, 0x009f); udelay(500);
RF_WriteReg(dev, 0x4, 0x0972); udelay(500);
/* turn on RF again */
RF_WriteReg(dev, 0x0, 0x009f); udelay(500);
RF_WriteReg(dev, 0x4, 0x0972); udelay(500);
/* turn on RF again */
RF_WriteReg(dev, 0x0, 0x009f); udelay(500);
RF_WriteReg(dev, 0x4, 0x0972); udelay(500);
/* turn on BB */
write_phy_ofdm(dev,0x10,0x40);
write_phy_ofdm(dev,0x12,0x40);
/* Avoid power down at init time. */
write_nic_byte(dev, CONFIG4, priv->RFProgType);
u1bTmp = read_nic_byte(dev, 0x24E);
write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5 | BIT6))));
break;
case eRfSleep:
for (QueueID = 0, i = 0; QueueID < 6;) {
if (get_curr_tx_free_desc(dev, QueueID) == priv->txringcount) {
QueueID++;
continue;
} else {
priv->TxPollingTimes ++;
if (priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE) {
bActionAllowed = false;
break;
} else
udelay(10);
}
}
/* turn on BB */
write_phy_ofdm(dev, 0x10, 0x40);
write_phy_ofdm(dev, 0x12, 0x40);
if (bActionAllowed) {
/* turn off BB RXIQ matrix to cut off rx signal */
write_phy_ofdm(dev, 0x10, 0x00);
write_phy_ofdm(dev, 0x12, 0x00);
/* turn off RF */
RF_WriteReg(dev, 0x4, 0x0000);
RF_WriteReg(dev, 0x0, 0x0000);
/* turn off AFE except PLL */
write_nic_byte(dev, 0x62, 0xff);
write_nic_byte(dev, 0x54, 0xec);
mdelay(1);
{
int i = 0;
while (true) {
u8 tmp24F = read_nic_byte(dev, 0x24f);
if ((tmp24F == 0x01) || (tmp24F == 0x09)) {
bTurnOffBB = true;
break;
} else {
udelay(10);
i++;
priv->TxPollingTimes++;
if (priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE) {
bTurnOffBB = false;
break;
} else
udelay(10);
}
}
}
if (bTurnOffBB) {
/* turn off BB */
u1bTmp = read_nic_byte(dev, 0x24E);
write_nic_byte(dev, 0x24E, (u1bTmp | BIT5 | BIT6));
/* turn off AFE PLL */
write_nic_byte(dev, 0x54, 0xFC);
write_nic_word(dev, 0x37C, 0x00FC);
}
}
break;
case eRfOff:
for (QueueID = 0, i = 0; QueueID < 6;) {
if (get_curr_tx_free_desc(dev, QueueID) == priv->txringcount) {
QueueID++;
continue;
} else {
udelay(10);
i++;
}
/* Avoid power down at init time. */
write_nic_byte(dev, CONFIG4, priv->RFProgType);
if (i >= MAX_DOZE_WAITING_TIMES_85B)
u1bTmp = read_nic_byte(dev, 0x24E);
write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5 | BIT6))));
break;
case eRfSleep:
for (QueueID = 0, i = 0; QueueID < 6;) {
if (get_curr_tx_free_desc(dev, QueueID) == priv->txringcount) {
QueueID++;
continue;
} else {
priv->TxPollingTimes++;
if (priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE) {
bActionAllowed = false;
break;
} else
udelay(10);
}
}
if (bActionAllowed) {
/* turn off BB RXIQ matrix to cut off rx signal */
write_phy_ofdm(dev, 0x10, 0x00);
write_phy_ofdm(dev, 0x12, 0x00);
......@@ -998,22 +912,23 @@ bool SetZebraRFPowerState8185(struct net_device *dev,
{
int i = 0;
while (true)
{
while (true) {
u8 tmp24F = read_nic_byte(dev, 0x24f);
if ((tmp24F == 0x01) || (tmp24F == 0x09)) {
bTurnOffBB = true;
break;
} else {
bTurnOffBB = false;
udelay(10);
i++;
}
priv->TxPollingTimes++;
if (i > MAX_POLLING_24F_TIMES_87SE)
break;
if (priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE) {
bTurnOffBB = false;
break;
} else
udelay(10);
}
}
}
......@@ -1022,15 +937,68 @@ bool SetZebraRFPowerState8185(struct net_device *dev,
u1bTmp = read_nic_byte(dev, 0x24E);
write_nic_byte(dev, 0x24E, (u1bTmp | BIT5 | BIT6));
/* turn off AFE PLL (80M) */
/* turn off AFE PLL */
write_nic_byte(dev, 0x54, 0xFC);
write_nic_word(dev, 0x37C, 0x00FC);
}
break;
default:
bResult = false;
printk("SetZebraRFPowerState8185(): unknown state to set: 0x%X!!!\n", eRFPowerState);
break;
}
break;
case eRfOff:
for (QueueID = 0, i = 0; QueueID < 6;) {
if (get_curr_tx_free_desc(dev, QueueID) == priv->txringcount) {
QueueID++;
continue;
} else {
udelay(10);
i++;
}
if (i >= MAX_DOZE_WAITING_TIMES_85B)
break;
}
/* turn off BB RXIQ matrix to cut off rx signal */
write_phy_ofdm(dev, 0x10, 0x00);
write_phy_ofdm(dev, 0x12, 0x00);
/* turn off RF */
RF_WriteReg(dev, 0x4, 0x0000);
RF_WriteReg(dev, 0x0, 0x0000);
/* turn off AFE except PLL */
write_nic_byte(dev, 0x62, 0xff);
write_nic_byte(dev, 0x54, 0xec);
mdelay(1);
{
int i = 0;
while (true) {
u8 tmp24F = read_nic_byte(dev, 0x24f);
if ((tmp24F == 0x01) || (tmp24F == 0x09)) {
bTurnOffBB = true;
break;
} else {
bTurnOffBB = false;
udelay(10);
i++;
}
if (i > MAX_POLLING_24F_TIMES_87SE)
break;
}
}
if (bTurnOffBB) {
/* turn off BB */
u1bTmp = read_nic_byte(dev, 0x24E);
write_nic_byte(dev, 0x24E, (u1bTmp | BIT5 | BIT6));
/* turn off AFE PLL (80M) */
write_nic_byte(dev, 0x54, 0xFC);
write_nic_word(dev, 0x37C, 0x00FC);
}
break;
}
......
This diff is collapsed.
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