diff options
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8188ee/hw.c')
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c index e06971be7df7..bd2a26bafb69 100644 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include "fw.h" | 41 | #include "fw.h" |
42 | #include "led.h" | 42 | #include "led.h" |
43 | #include "hw.h" | 43 | #include "hw.h" |
44 | #include "pwrseqcmd.h" | ||
45 | #include "pwrseq.h" | 44 | #include "pwrseq.h" |
46 | 45 | ||
47 | #define LLT_CONFIG 5 | 46 | #define LLT_CONFIG 5 |
@@ -509,7 +508,7 @@ void rtl88ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
509 | u8 e_aci = *((u8 *)val); | 508 | u8 e_aci = *((u8 *)val); |
510 | rtl88e_dm_init_edca_turbo(hw); | 509 | rtl88e_dm_init_edca_turbo(hw); |
511 | 510 | ||
512 | if (rtlpci->acm_method != eAcmWay2_SW) | 511 | if (rtlpci->acm_method != EACMWAY2_SW) |
513 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACM_CTRL, | 512 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACM_CTRL, |
514 | (u8 *)(&e_aci)); | 513 | (u8 *)(&e_aci)); |
515 | break; } | 514 | break; } |
@@ -815,11 +814,11 @@ static bool _rtl88ee_init_mac(struct ieee80211_hw *hw) | |||
815 | 814 | ||
816 | rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00); | 815 | rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00); |
817 | /* HW Power on sequence */ | 816 | /* HW Power on sequence */ |
818 | if (!rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, | 817 | if (!rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, |
819 | PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, | 818 | PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, |
820 | Rtl8188E_NIC_ENABLE_FLOW)) { | 819 | Rtl8188E_NIC_ENABLE_FLOW)) { |
821 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | 820 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, |
822 | "init MAC Fail as rtl88_hal_pwrseqcmdparsing\n"); | 821 | "init MAC Fail as rtl_hal_pwrseqcmdparsing\n"); |
823 | return false; | 822 | return false; |
824 | } | 823 | } |
825 | 824 | ||
@@ -1025,9 +1024,20 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw) | |||
1025 | bool rtstatus = true; | 1024 | bool rtstatus = true; |
1026 | int err = 0; | 1025 | int err = 0; |
1027 | u8 tmp_u1b, u1byte; | 1026 | u8 tmp_u1b, u1byte; |
1027 | unsigned long flags; | ||
1028 | 1028 | ||
1029 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Rtl8188EE hw init\n"); | 1029 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Rtl8188EE hw init\n"); |
1030 | rtlpriv->rtlhal.being_init_adapter = true; | 1030 | rtlpriv->rtlhal.being_init_adapter = true; |
1031 | /* As this function can take a very long time (up to 350 ms) | ||
1032 | * and can be called with irqs disabled, reenable the irqs | ||
1033 | * to let the other devices continue being serviced. | ||
1034 | * | ||
1035 | * It is safe doing so since our own interrupts will only be enabled | ||
1036 | * in a subsequent step. | ||
1037 | */ | ||
1038 | local_save_flags(flags); | ||
1039 | local_irq_enable(); | ||
1040 | |||
1031 | rtlpriv->intf_ops->disable_aspm(hw); | 1041 | rtlpriv->intf_ops->disable_aspm(hw); |
1032 | 1042 | ||
1033 | tmp_u1b = rtl_read_byte(rtlpriv, REG_SYS_CLKR+1); | 1043 | tmp_u1b = rtl_read_byte(rtlpriv, REG_SYS_CLKR+1); |
@@ -1043,7 +1053,7 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw) | |||
1043 | if (rtstatus != true) { | 1053 | if (rtstatus != true) { |
1044 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n"); | 1054 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n"); |
1045 | err = 1; | 1055 | err = 1; |
1046 | return err; | 1056 | goto exit; |
1047 | } | 1057 | } |
1048 | 1058 | ||
1049 | err = rtl88e_download_fw(hw, false); | 1059 | err = rtl88e_download_fw(hw, false); |
@@ -1051,8 +1061,7 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw) | |||
1051 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | 1061 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, |
1052 | "Failed to download FW. Init HW without FW now..\n"); | 1062 | "Failed to download FW. Init HW without FW now..\n"); |
1053 | err = 1; | 1063 | err = 1; |
1054 | rtlhal->fw_ready = false; | 1064 | goto exit; |
1055 | return err; | ||
1056 | } else { | 1065 | } else { |
1057 | rtlhal->fw_ready = true; | 1066 | rtlhal->fw_ready = true; |
1058 | } | 1067 | } |
@@ -1097,7 +1106,7 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw) | |||
1097 | if (ppsc->rfpwr_state == ERFON) { | 1106 | if (ppsc->rfpwr_state == ERFON) { |
1098 | if ((rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV) || | 1107 | if ((rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV) || |
1099 | ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) && | 1108 | ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) && |
1100 | (rtlhal->oem_id == RT_CID_819x_HP))) { | 1109 | (rtlhal->oem_id == RT_CID_819X_HP))) { |
1101 | rtl88e_phy_set_rfpath_switch(hw, true); | 1110 | rtl88e_phy_set_rfpath_switch(hw, true); |
1102 | rtlpriv->dm.fat_table.rx_idle_ant = MAIN_ANT; | 1111 | rtlpriv->dm.fat_table.rx_idle_ant = MAIN_ANT; |
1103 | } else { | 1112 | } else { |
@@ -1135,10 +1144,12 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw) | |||
1135 | } | 1144 | } |
1136 | rtl_write_byte(rtlpriv, REG_NAV_CTRL+2, ((30000+127)/128)); | 1145 | rtl_write_byte(rtlpriv, REG_NAV_CTRL+2, ((30000+127)/128)); |
1137 | rtl88e_dm_init(hw); | 1146 | rtl88e_dm_init(hw); |
1147 | exit: | ||
1148 | local_irq_restore(flags); | ||
1138 | rtlpriv->rtlhal.being_init_adapter = false; | 1149 | rtlpriv->rtlhal.being_init_adapter = false; |
1139 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "end of Rtl8188EE hw init %x\n", | 1150 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "end of Rtl8188EE hw init %x\n", |
1140 | err); | 1151 | err); |
1141 | return 0; | 1152 | return err; |
1142 | } | 1153 | } |
1143 | 1154 | ||
1144 | static enum version_8188e _rtl88ee_read_chip_version(struct ieee80211_hw *hw) | 1155 | static enum version_8188e _rtl88ee_read_chip_version(struct ieee80211_hw *hw) |
@@ -1235,12 +1246,13 @@ static int _rtl88ee_set_media_status(struct ieee80211_hw *hw, | |||
1235 | void rtl88ee_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) | 1246 | void rtl88ee_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) |
1236 | { | 1247 | { |
1237 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1248 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1238 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 1249 | u32 reg_rcr; |
1239 | u32 reg_rcr = rtlpci->receive_config; | ||
1240 | 1250 | ||
1241 | if (rtlpriv->psc.rfpwr_state != ERFON) | 1251 | if (rtlpriv->psc.rfpwr_state != ERFON) |
1242 | return; | 1252 | return; |
1243 | 1253 | ||
1254 | rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *)(®_rcr)); | ||
1255 | |||
1244 | if (check_bssid == true) { | 1256 | if (check_bssid == true) { |
1245 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); | 1257 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
1246 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1258 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
@@ -1345,9 +1357,9 @@ static void _rtl88ee_poweroff_adapter(struct ieee80211_hw *hw) | |||
1345 | } | 1357 | } |
1346 | rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+1, 0xFF); | 1358 | rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+1, 0xFF); |
1347 | 1359 | ||
1348 | rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, | 1360 | rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, |
1349 | PWR_INTF_PCI_MSK, | 1361 | PWR_INTF_PCI_MSK, |
1350 | Rtl8188E_NIC_LPS_ENTER_FLOW); | 1362 | Rtl8188E_NIC_LPS_ENTER_FLOW); |
1351 | 1363 | ||
1352 | rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00); | 1364 | rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00); |
1353 | 1365 | ||
@@ -1361,8 +1373,8 @@ static void _rtl88ee_poweroff_adapter(struct ieee80211_hw *hw) | |||
1361 | u1b_tmp = rtl_read_byte(rtlpriv, REG_32K_CTRL); | 1373 | u1b_tmp = rtl_read_byte(rtlpriv, REG_32K_CTRL); |
1362 | rtl_write_byte(rtlpriv, REG_32K_CTRL, (u1b_tmp & (~BIT(0)))); | 1374 | rtl_write_byte(rtlpriv, REG_32K_CTRL, (u1b_tmp & (~BIT(0)))); |
1363 | 1375 | ||
1364 | rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, | 1376 | rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, |
1365 | PWR_INTF_PCI_MSK, Rtl8188E_NIC_DISABLE_FLOW); | 1377 | PWR_INTF_PCI_MSK, Rtl8188E_NIC_DISABLE_FLOW); |
1366 | 1378 | ||
1367 | u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); | 1379 | u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); |
1368 | rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(3)))); | 1380 | rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(3)))); |
@@ -1872,15 +1884,15 @@ static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw) | |||
1872 | case EEPROM_CID_DEFAULT: | 1884 | case EEPROM_CID_DEFAULT: |
1873 | if (rtlefuse->eeprom_did == 0x8179) { | 1885 | if (rtlefuse->eeprom_did == 0x8179) { |
1874 | if (rtlefuse->eeprom_svid == 0x1025) { | 1886 | if (rtlefuse->eeprom_svid == 0x1025) { |
1875 | rtlhal->oem_id = RT_CID_819x_Acer; | 1887 | rtlhal->oem_id = RT_CID_819X_ACER; |
1876 | } else if ((rtlefuse->eeprom_svid == 0x10EC && | 1888 | } else if ((rtlefuse->eeprom_svid == 0x10EC && |
1877 | rtlefuse->eeprom_smid == 0x0179) || | 1889 | rtlefuse->eeprom_smid == 0x0179) || |
1878 | (rtlefuse->eeprom_svid == 0x17AA && | 1890 | (rtlefuse->eeprom_svid == 0x17AA && |
1879 | rtlefuse->eeprom_smid == 0x0179)) { | 1891 | rtlefuse->eeprom_smid == 0x0179)) { |
1880 | rtlhal->oem_id = RT_CID_819x_Lenovo; | 1892 | rtlhal->oem_id = RT_CID_819X_LENOVO; |
1881 | } else if (rtlefuse->eeprom_svid == 0x103c && | 1893 | } else if (rtlefuse->eeprom_svid == 0x103c && |
1882 | rtlefuse->eeprom_smid == 0x197d) { | 1894 | rtlefuse->eeprom_smid == 0x197d) { |
1883 | rtlhal->oem_id = RT_CID_819x_HP; | 1895 | rtlhal->oem_id = RT_CID_819X_HP; |
1884 | } else { | 1896 | } else { |
1885 | rtlhal->oem_id = RT_CID_DEFAULT; | 1897 | rtlhal->oem_id = RT_CID_DEFAULT; |
1886 | } | 1898 | } |
@@ -1892,7 +1904,7 @@ static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw) | |||
1892 | rtlhal->oem_id = RT_CID_TOSHIBA; | 1904 | rtlhal->oem_id = RT_CID_TOSHIBA; |
1893 | break; | 1905 | break; |
1894 | case EEPROM_CID_QMI: | 1906 | case EEPROM_CID_QMI: |
1895 | rtlhal->oem_id = RT_CID_819x_QMI; | 1907 | rtlhal->oem_id = RT_CID_819X_QMI; |
1896 | break; | 1908 | break; |
1897 | case EEPROM_CID_WHQL: | 1909 | case EEPROM_CID_WHQL: |
1898 | default: | 1910 | default: |
@@ -1911,14 +1923,14 @@ static void _rtl88ee_hal_customized_behavior(struct ieee80211_hw *hw) | |||
1911 | pcipriv->ledctl.led_opendrain = true; | 1923 | pcipriv->ledctl.led_opendrain = true; |
1912 | 1924 | ||
1913 | switch (rtlhal->oem_id) { | 1925 | switch (rtlhal->oem_id) { |
1914 | case RT_CID_819x_HP: | 1926 | case RT_CID_819X_HP: |
1915 | pcipriv->ledctl.led_opendrain = true; | 1927 | pcipriv->ledctl.led_opendrain = true; |
1916 | break; | 1928 | break; |
1917 | case RT_CID_819x_Lenovo: | 1929 | case RT_CID_819X_LENOVO: |
1918 | case RT_CID_DEFAULT: | 1930 | case RT_CID_DEFAULT: |
1919 | case RT_CID_TOSHIBA: | 1931 | case RT_CID_TOSHIBA: |
1920 | case RT_CID_CCX: | 1932 | case RT_CID_CCX: |
1921 | case RT_CID_819x_Acer: | 1933 | case RT_CID_819X_ACER: |
1922 | case RT_CID_WHQL: | 1934 | case RT_CID_WHQL: |
1923 | default: | 1935 | default: |
1924 | break; | 1936 | break; |