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

Staging: rtl8187se: Remove card8185 variable to simplify flow

When this code is used for the rtl8187se, the value of card_8185
in struct r8180_priv is always 7 or 8. As a result, the program
flow can be simplified.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Tested-by: default avatarBernhard Schiffner <bernhard@schiffner-limbach.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bbc9a991
...@@ -77,21 +77,6 @@ typedef enum _WIRELESS_MODE { ...@@ -77,21 +77,6 @@ typedef enum _WIRELESS_MODE {
WIRELESS_MODE_AUTO = 0x08, WIRELESS_MODE_AUTO = 0x08,
} WIRELESS_MODE; } WIRELESS_MODE;
typedef enum _VERSION_8185{
// RTL8185
VERSION_8185_UNKNOWN,
VERSION_8185_C, // C-cut
VERSION_8185_D, // D-cut
// RTL8185B
VERSION_8185B_B, // B-cut
VERSION_8185B_D, // D-cut
VERSION_8185B_E, // E-cut
//RTL8187S-PCIE
VERSION_8187S_B, // B-cut
VERSION_8187S_C, // C-cut
VERSION_8187S_D, // D-cut
}VERSION_8185,*PVERSION_8185;
typedef struct ChnlAccessSetting { typedef struct ChnlAccessSetting {
u16 SIFS_Timer; u16 SIFS_Timer;
u16 DIFS_Timer; u16 DIFS_Timer;
...@@ -341,8 +326,6 @@ typedef struct r8180_priv ...@@ -341,8 +326,6 @@ typedef struct r8180_priv
int irq; int irq;
struct ieee80211_device *ieee80211; struct ieee80211_device *ieee80211;
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D, 3:rtl8185B */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0; short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type; enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
......
This diff is collapsed.
...@@ -197,7 +197,6 @@ DIG_Zebra( ...@@ -197,7 +197,6 @@ DIG_Zebra(
{ // Advised from SD3 DZ { // Advised from SD3 DZ
priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm) priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm)
} }
//if(pHalData->VersionID != VERSION_8187B_B)
{ // Advised from SD3 DZ { // Advised from SD3 DZ
OfdmFA1 = 0x20; OfdmFA1 = 0x20;
} }
......
...@@ -445,30 +445,28 @@ s8 DbmToTxPwrIdx(struct r8180_priv *priv, WIRELESS_MODE WirelessMode, ...@@ -445,30 +445,28 @@ s8 DbmToTxPwrIdx(struct r8180_priv *priv, WIRELESS_MODE WirelessMode,
* OFDM Power in dBm = Index * 0.5 + 0 * OFDM Power in dBm = Index * 0.5 + 0
* CCK Power in dBm = Index * 0.25 + 13 * CCK Power in dBm = Index * 0.25 + 13
*/ */
if (priv->card_8185 >= VERSION_8187S_B) { s32 tmp = 0;
s32 tmp = 0;
if (WirelessMode == WIRELESS_MODE_G) {
if (WirelessMode == WIRELESS_MODE_G) { bUseDefault = false;
bUseDefault = false; tmp = (2 * PowerInDbm);
tmp = (2 * PowerInDbm);
if (tmp < 0)
if (tmp < 0) TxPwrIdx = 0;
TxPwrIdx = 0; else if (tmp > 40) /* 40 means 20 dBm. */
else if (tmp > 40) /* 40 means 20 dBm. */ TxPwrIdx = 40;
TxPwrIdx = 40; else
else TxPwrIdx = (s8)tmp;
TxPwrIdx = (s8)tmp; } else if (WirelessMode == WIRELESS_MODE_B) {
} else if (WirelessMode == WIRELESS_MODE_B) { bUseDefault = false;
bUseDefault = false; tmp = (4 * PowerInDbm) - 52;
tmp = (4 * PowerInDbm) - 52;
if (tmp < 0)
if(tmp < 0) TxPwrIdx = 0;
TxPwrIdx = 0; else if (tmp > 28) /* 28 means 20 dBm. */
else if (tmp > 28) /* 28 means 20 dBm. */ TxPwrIdx = 28;
TxPwrIdx = 28; else
else TxPwrIdx = (s8)tmp;
TxPwrIdx = (s8)tmp;
}
} }
/* /*
......
...@@ -1023,6 +1023,7 @@ ZEBRA_Config_85BASIC_HardCode( ...@@ -1023,6 +1023,7 @@ ZEBRA_Config_85BASIC_HardCode(
u32 addr,data; u32 addr,data;
u32 u4bRegOffset, u4bRegValue, u4bRF23, u4bRF24; u32 u4bRegOffset, u4bRegValue, u4bRF23, u4bRF24;
u8 u1b24E; u8 u1b24E;
int d_cut = 0;
//============================================================================= //=============================================================================
...@@ -1035,8 +1036,10 @@ ZEBRA_Config_85BASIC_HardCode( ...@@ -1035,8 +1036,10 @@ ZEBRA_Config_85BASIC_HardCode(
u4bRF23= RF_ReadReg(dev, 0x08); mdelay(1); u4bRF23= RF_ReadReg(dev, 0x08); mdelay(1);
u4bRF24= RF_ReadReg(dev, 0x09); mdelay(1); u4bRF24= RF_ReadReg(dev, 0x09); mdelay(1);
if (u4bRF23==0x818 && u4bRF24==0x70C && priv->card_8185 == VERSION_8187S_C) if (u4bRF23 == 0x818 && u4bRF24 == 0x70C) {
priv->card_8185 = VERSION_8187S_D; d_cut = 1;
printk(KERN_INFO "rtl8187se: card type changed from C- to D-cut\n");
}
// Page0 : reg0-reg15 // Page0 : reg0-reg15
...@@ -1070,18 +1073,9 @@ ZEBRA_Config_85BASIC_HardCode( ...@@ -1070,18 +1073,9 @@ ZEBRA_Config_85BASIC_HardCode(
RF_WriteReg(dev, 0x03, 0x0806); mdelay(1); RF_WriteReg(dev, 0x03, 0x0806); mdelay(1);
if(priv->card_8185 < VERSION_8187S_C) RF_WriteReg(dev, 0x04, 0x03a7); mdelay(1);
{ RF_WriteReg(dev, 0x05, 0x059b); mdelay(1);
RF_WriteReg(dev, 0x04, 0x03f7); mdelay(1); RF_WriteReg(dev, 0x06, 0x0081); mdelay(1);
RF_WriteReg(dev, 0x05, 0x05ab); mdelay(1);
RF_WriteReg(dev, 0x06, 0x00c1); mdelay(1);
}
else
{
RF_WriteReg(dev, 0x04, 0x03a7); mdelay(1);
RF_WriteReg(dev, 0x05, 0x059b); mdelay(1);
RF_WriteReg(dev, 0x06, 0x0081); mdelay(1);
}
RF_WriteReg(dev, 0x07, 0x01A0); mdelay(1); RF_WriteReg(dev, 0x07, 0x01A0); mdelay(1);
...@@ -1091,14 +1085,11 @@ ZEBRA_Config_85BASIC_HardCode( ...@@ -1091,14 +1085,11 @@ ZEBRA_Config_85BASIC_HardCode(
RF_WriteReg(dev, 0x0a, 0x0001); mdelay(1); RF_WriteReg(dev, 0x0a, 0x0001); mdelay(1);
RF_WriteReg(dev, 0x0b, 0x0418); mdelay(1); RF_WriteReg(dev, 0x0b, 0x0418); mdelay(1);
if(priv->card_8185 == VERSION_8187S_D) if (d_cut) {
{
RF_WriteReg(dev, 0x0c, 0x0fbe); mdelay(1); RF_WriteReg(dev, 0x0c, 0x0fbe); mdelay(1);
RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1); RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1);
RF_WriteReg(dev, 0x0e, 0x0807); mdelay(1); // RX LO buffer RF_WriteReg(dev, 0x0e, 0x0807); mdelay(1); // RX LO buffer
} } else {
else
{
RF_WriteReg(dev, 0x0c, 0x0fbe); mdelay(1); RF_WriteReg(dev, 0x0c, 0x0fbe); mdelay(1);
RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1); RF_WriteReg(dev, 0x0d, 0x0008); mdelay(1);
RF_WriteReg(dev, 0x0e, 0x0806); mdelay(1); // RX LO buffer RF_WriteReg(dev, 0x0e, 0x0806); mdelay(1); // RX LO buffer
......
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