staging: r8188eu: Fix while-loop that iterates only once
[linux-2.6-microblaze.git] / drivers / staging / rtl8188eu / hal / rtl8188e_hal_init.c
index 0b46af1..1c63658 100644 (file)
@@ -24,11 +24,8 @@ void iol_mode_enable(struct adapter *padapter, u8 enable)
                reg_0xf0 = usb_read8(padapter, REG_SYS_CFG);
                usb_write8(padapter, REG_SYS_CFG, reg_0xf0 | SW_OFFLOAD_EN);
 
-               if (!padapter->bFWReady) {
-                       DBG_88E("bFWReady == false call reset 8051...\n");
+               if (!padapter->bFWReady)
                        _8051Reset88E(padapter);
-               }
-
        } else {
                /* disable initial offload */
                reg_0xf0 = usb_read8(padapter, REG_SYS_CFG);
@@ -74,7 +71,6 @@ s32 rtl8188e_iol_efuse_patch(struct adapter *padapter)
 {
        s32     result = _SUCCESS;
 
-       DBG_88E("==> %s\n", __func__);
        if (rtw_iol_applied(padapter)) {
                iol_mode_enable(padapter, 1);
                result = iol_execute(padapter, CMD_READ_EFUSE_MAP);
@@ -95,7 +91,6 @@ void _8051Reset88E(struct adapter *padapter)
        u1bTmp = usb_read8(padapter, REG_SYS_FUNC_EN + 1);
        usb_write8(padapter, REG_SYS_FUNC_EN + 1, u1bTmp & (~BIT(2)));
        usb_write8(padapter, REG_SYS_FUNC_EN + 1, u1bTmp | (BIT(2)));
-       DBG_88E("=====> %s(): 8051 reset success .\n", __func__);
 }
 
 void rtl8188e_InitializeFirmwareVars(struct adapter *padapter)
@@ -139,11 +134,9 @@ void rtw_hal_set_odm_var(struct adapter *Adapter, enum hal_odm_variable eVariabl
                        struct sta_info *psta = pValue1;
 
                        if (bSet) {
-                               DBG_88E("### Set STA_(%d) info\n", psta->mac_id);
                                ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
                                ODM_RAInfo_Init(podmpriv, psta->mac_id);
                        } else {
-                               DBG_88E("### Clean STA_(%d) info\n", psta->mac_id);
                                ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
                        }
                }
@@ -161,13 +154,10 @@ void rtw_hal_set_odm_var(struct adapter *Adapter, enum hal_odm_variable eVariabl
 
 void rtw_hal_notch_filter(struct adapter *adapter, bool enable)
 {
-       if (enable) {
-               DBG_88E("Enable notch filter\n");
+       if (enable)
                usb_write8(adapter, rOFDM0_RxDSP + 1, usb_read8(adapter, rOFDM0_RxDSP + 1) | BIT(1));
-       } else {
-               DBG_88E("Disable notch filter\n");
+       else
                usb_write8(adapter, rOFDM0_RxDSP + 1, usb_read8(adapter, rOFDM0_RxDSP + 1) & ~BIT(1));
-       }
 }
 
 /*  */
@@ -178,25 +168,24 @@ void rtw_hal_notch_filter(struct adapter *adapter, bool enable)
 static s32 _LLTWrite(struct adapter *padapter, u32 address, u32 data)
 {
        s32     status = _SUCCESS;
-       s32     count = 0;
+       s32     count;
        u32     value = _LLT_INIT_ADDR(address) | _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS);
        u16     LLTReg = REG_LLT_INIT;
 
        usb_write32(padapter, LLTReg, value);
 
        /* polling */
-       do {
+       for (count = 0; ; count++) {
                value = usb_read32(padapter, LLTReg);
                if (_LLT_OP_VALUE(value) == _LLT_NO_ACTIVE)
                        break;
 
                if (count > POLLING_LLT_THRESHOLD) {
-                       RT_TRACE(_module_hal_init_c_, _drv_err_, ("Failed to polling write LLT done at address %d!\n", address));
                        status = _FAIL;
                        break;
                }
                udelay(5);
-       } while (count++);
+       }
 
        return status;
 }
@@ -241,19 +230,8 @@ s32 InitLLTTable(struct adapter *padapter, u8 txpktbuf_bndy)
 
 void Hal_InitPGData88E(struct adapter *padapter)
 {
-       struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
-
-       if (!pEEPROM->bautoload_fail_flag) { /*  autoload OK. */
-               if (!is_boot_from_eeprom(padapter)) {
-                       /*  Read EFUSE real map to shadow. */
-                       EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
-               }
-       } else {/* autoload fail */
-               RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("AutoLoad Fail reported from CR9346!!\n"));
-               /* update to default value 0xFF */
-               if (!is_boot_from_eeprom(padapter))
-                       EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI);
-       }
+       if (!is_boot_from_eeprom(padapter))
+               EFUSE_ShadowMapUpdate(padapter);
 }
 
 void Hal_EfuseParseIDCode88E(struct adapter *padapter, u8 *hwinfo)
@@ -263,14 +241,10 @@ void Hal_EfuseParseIDCode88E(struct adapter *padapter, u8 *hwinfo)
 
        /*  Checl 0x8129 again for making sure autoload status!! */
        EEPROMId = le16_to_cpu(*((__le16 *)hwinfo));
-       if (EEPROMId != RTL_EEPROM_ID) {
-               DBG_88E("EEPROM ID(%#x) is invalid!!\n", EEPROMId);
+       if (EEPROMId != RTL_EEPROM_ID)
                pEEPROM->bautoload_fail_flag = true;
-       } else {
+       else
                pEEPROM->bautoload_fail_flag = false;
-       }
-
-       DBG_88E("EEPROM ID = 0x%04x\n", EEPROMId);
 }
 
 static void Hal_ReadPowerValueFromPROM_8188E(struct txpowerinfo24g *pwrInfo24G, u8 *PROMContent, bool AutoLoadFail)
@@ -404,11 +378,6 @@ void Hal_ReadPowerSavingMode88E(struct adapter *padapter, u8 *hwinfo, bool AutoL
                /*  decide hw if support remote wakeup function */
                /*  if hw supported, 8051 (SIE) will generate WeakUP signal(D+/D- toggle) when autoresume */
                padapter->pwrctrlpriv.bSupportRemoteWakeup = (hwinfo[EEPROM_USB_OPTIONAL_FUNCTION0] & BIT(1)) ? true : false;
-
-               DBG_88E("%s...bHWPwrPindetect(%x)-bHWPowerdown(%x) , bSupportRemoteWakeup(%x)\n", __func__,
-                       padapter->pwrctrlpriv.bHWPwrPindetect, padapter->pwrctrlpriv.bHWPowerdown, padapter->pwrctrlpriv.bSupportRemoteWakeup);
-
-               DBG_88E("### PS params =>  power_mgnt(%x), usbss_enable(%x) ###\n", padapter->registrypriv.power_mgnt, padapter->registrypriv.usbss_enable);
        }
 }
 
@@ -431,21 +400,12 @@ void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool Auto
                        pHalData->Index24G_BW40_Base[0][ch] = pwrInfo24G.IndexBW40_Base[0][4];
                else
                        pHalData->Index24G_BW40_Base[0][ch] = pwrInfo24G.IndexBW40_Base[0][group];
-
-               DBG_88E("======= Path %d, Channel %d =======\n", 0, ch);
-               DBG_88E("Index24G_CCK_Base[%d][%d] = 0x%x\n", 0, ch, pHalData->Index24G_CCK_Base[0][ch]);
-               DBG_88E("Index24G_BW40_Base[%d][%d] = 0x%x\n", 0, ch, pHalData->Index24G_BW40_Base[0][ch]);
        }
        for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) {
                pHalData->CCK_24G_Diff[0][TxCount] = pwrInfo24G.CCK_Diff[0][TxCount];
                pHalData->OFDM_24G_Diff[0][TxCount] = pwrInfo24G.OFDM_Diff[0][TxCount];
                pHalData->BW20_24G_Diff[0][TxCount] = pwrInfo24G.BW20_Diff[0][TxCount];
                pHalData->BW40_24G_Diff[0][TxCount] = pwrInfo24G.BW40_Diff[0][TxCount];
-               DBG_88E("======= TxCount %d =======\n", TxCount);
-               DBG_88E("CCK_24G_Diff[%d][%d] = %d\n", 0, TxCount, pHalData->CCK_24G_Diff[0][TxCount]);
-               DBG_88E("OFDM_24G_Diff[%d][%d] = %d\n", 0, TxCount, pHalData->OFDM_24G_Diff[0][TxCount]);
-               DBG_88E("BW20_24G_Diff[%d][%d] = %d\n", 0, TxCount, pHalData->BW20_24G_Diff[0][TxCount]);
-               DBG_88E("BW40_24G_Diff[%d][%d] = %d\n", 0, TxCount, pHalData->BW40_24G_Diff[0][TxCount]);
        }
 
        /*  2010/10/19 MH Add Regulator recognize for CU. */
@@ -456,7 +416,6 @@ void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool Auto
        } else {
                pHalData->EEPROMRegulatory = 0;
        }
-       DBG_88E("EEPROMRegulatory = 0x%x\n", pHalData->EEPROMRegulatory);
 }
 
 void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail)
@@ -470,7 +429,6 @@ void Hal_EfuseParseXtal_8188E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoa
        } else {
                pHalData->CrystalCap = EEPROM_Default_CrystalCap_88E;
        }
-       DBG_88E("CrystalCap: 0x%2x\n", pHalData->CrystalCap);
 }
 
 void Hal_EfuseParseBoardType88E(struct adapter *pAdapter, u8 *hwinfo, bool AutoLoadFail)
@@ -482,7 +440,6 @@ void Hal_EfuseParseBoardType88E(struct adapter *pAdapter, u8 *hwinfo, bool AutoL
                                        & 0xE0) >> 5;
        else
                pHalData->BoardType = 0;
-       DBG_88E("Board Type: 0x%2x\n", pHalData->BoardType);
 }
 
 void Hal_EfuseParseEEPROMVer88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
@@ -496,9 +453,6 @@ void Hal_EfuseParseEEPROMVer88E(struct adapter *padapter, u8 *hwinfo, bool AutoL
        } else {
                pHalData->EEPROMVersion = 1;
        }
-       RT_TRACE(_module_hci_hal_init_c_, _drv_info_,
-                ("Hal_EfuseParseEEPROMVer(), EEVer = %d\n",
-                pHalData->EEPROMVersion));
 }
 
 void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
@@ -508,7 +462,6 @@ void rtl8188e_EfuseParseChnlPlan(struct adapter *padapter, u8 *hwinfo, bool Auto
                                          padapter->registrypriv.channel_plan,
                                          RT_CHANNEL_DOMAIN_WORLD_WIDE_13, AutoLoadFail);
 
-       DBG_88E("mlmepriv.ChannelPlan = 0x%02x\n", padapter->mlmepriv.ChannelPlan);
 }
 
 void Hal_EfuseParseCustomerID88E(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail)
@@ -521,7 +474,6 @@ void Hal_EfuseParseCustomerID88E(struct adapter *padapter, u8 *hwinfo, bool Auto
                pHalData->EEPROMCustomerID = 0;
                pHalData->EEPROMSubCustomerID = 0;
        }
-       DBG_88E("EEPROM Customer ID: 0x%2x\n", pHalData->EEPROMCustomerID);
 }
 
 void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool AutoLoadFail)
@@ -553,7 +505,6 @@ void Hal_ReadAntennaDiversity88E(struct adapter *pAdapter, u8 *PROMContent, bool
        } else {
                pHalData->AntDivCfg = 0;
        }
-       DBG_88E("EEPROM : AntDivCfg = %x, TRxAntDivType = %x\n", pHalData->AntDivCfg, pHalData->TRxAntDivType);
 }
 
 void Hal_ReadThermalMeter_88E(struct adapter *Adapter, u8 *PROMContent, bool AutoloadFail)
@@ -569,5 +520,4 @@ void Hal_ReadThermalMeter_88E(struct adapter *Adapter, u8 *PROMContent, bool Aut
        if (pHalData->EEPROMThermalMeter == 0xff || AutoloadFail) {
                pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E;
        }
-       DBG_88E("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter);
 }