diff options
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8192cu/hw.c')
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 0c74d4f2eeb..4bbb711a36c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -381,11 +381,11 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) | |||
381 | rtlefuse->eeprom_did = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_DID]); | 381 | rtlefuse->eeprom_did = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_DID]); |
382 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, " VID = 0x%02x PID = 0x%02x\n", | 382 | RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, " VID = 0x%02x PID = 0x%02x\n", |
383 | rtlefuse->eeprom_vid, rtlefuse->eeprom_did); | 383 | rtlefuse->eeprom_vid, rtlefuse->eeprom_did); |
384 | rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN]; | 384 | rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; |
385 | rtlefuse->eeprom_version = | 385 | rtlefuse->eeprom_version = |
386 | le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VERSION]); | 386 | le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VERSION]); |
387 | rtlefuse->txpwr_fromeprom = true; | 387 | rtlefuse->txpwr_fromeprom = true; |
388 | rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID]; | 388 | rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; |
389 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n", | 389 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n", |
390 | rtlefuse->eeprom_oemid); | 390 | rtlefuse->eeprom_oemid); |
391 | if (rtlhal->oem_id == RT_CID_DEFAULT) { | 391 | if (rtlhal->oem_id == RT_CID_DEFAULT) { |
@@ -1660,7 +1660,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1660 | for (e_aci = 0; e_aci < AC_MAX; e_aci++) | 1660 | for (e_aci = 0; e_aci < AC_MAX; e_aci++) |
1661 | rtlpriv->cfg->ops->set_hw_reg(hw, | 1661 | rtlpriv->cfg->ops->set_hw_reg(hw, |
1662 | HW_VAR_AC_PARAM, | 1662 | HW_VAR_AC_PARAM, |
1663 | (u8 *)(&e_aci)); | 1663 | &e_aci); |
1664 | } else { | 1664 | } else { |
1665 | u8 sifstime = 0; | 1665 | u8 sifstime = 0; |
1666 | u8 u1bAIFS; | 1666 | u8 u1bAIFS; |
@@ -1685,7 +1685,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1685 | } | 1685 | } |
1686 | case HW_VAR_ACK_PREAMBLE:{ | 1686 | case HW_VAR_ACK_PREAMBLE:{ |
1687 | u8 reg_tmp; | 1687 | u8 reg_tmp; |
1688 | u8 short_preamble = (bool) (*(u8 *) val); | 1688 | u8 short_preamble = (bool)*val; |
1689 | reg_tmp = 0; | 1689 | reg_tmp = 0; |
1690 | if (short_preamble) | 1690 | if (short_preamble) |
1691 | reg_tmp |= 0x80; | 1691 | reg_tmp |= 0x80; |
@@ -1696,7 +1696,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1696 | u8 min_spacing_to_set; | 1696 | u8 min_spacing_to_set; |
1697 | u8 sec_min_space; | 1697 | u8 sec_min_space; |
1698 | 1698 | ||
1699 | min_spacing_to_set = *((u8 *) val); | 1699 | min_spacing_to_set = *val; |
1700 | if (min_spacing_to_set <= 7) { | 1700 | if (min_spacing_to_set <= 7) { |
1701 | switch (rtlpriv->sec.pairwise_enc_algorithm) { | 1701 | switch (rtlpriv->sec.pairwise_enc_algorithm) { |
1702 | case NO_ENCRYPTION: | 1702 | case NO_ENCRYPTION: |
@@ -1729,7 +1729,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1729 | case HW_VAR_SHORTGI_DENSITY:{ | 1729 | case HW_VAR_SHORTGI_DENSITY:{ |
1730 | u8 density_to_set; | 1730 | u8 density_to_set; |
1731 | 1731 | ||
1732 | density_to_set = *((u8 *) val); | 1732 | density_to_set = *val; |
1733 | density_to_set &= 0x1f; | 1733 | density_to_set &= 0x1f; |
1734 | mac->min_space_cfg &= 0x07; | 1734 | mac->min_space_cfg &= 0x07; |
1735 | mac->min_space_cfg |= (density_to_set << 3); | 1735 | mac->min_space_cfg |= (density_to_set << 3); |
@@ -1747,7 +1747,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1747 | u8 index = 0; | 1747 | u8 index = 0; |
1748 | 1748 | ||
1749 | p_regtoset = regtoset_normal; | 1749 | p_regtoset = regtoset_normal; |
1750 | factor_toset = *((u8 *) val); | 1750 | factor_toset = *val; |
1751 | if (factor_toset <= 3) { | 1751 | if (factor_toset <= 3) { |
1752 | factor_toset = (1 << (factor_toset + 2)); | 1752 | factor_toset = (1 << (factor_toset + 2)); |
1753 | if (factor_toset > 0xf) | 1753 | if (factor_toset > 0xf) |
@@ -1774,7 +1774,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1774 | break; | 1774 | break; |
1775 | } | 1775 | } |
1776 | case HW_VAR_AC_PARAM:{ | 1776 | case HW_VAR_AC_PARAM:{ |
1777 | u8 e_aci = *((u8 *) val); | 1777 | u8 e_aci = *val; |
1778 | u32 u4b_ac_param; | 1778 | u32 u4b_ac_param; |
1779 | u16 cw_min = le16_to_cpu(mac->ac[e_aci].cw_min); | 1779 | u16 cw_min = le16_to_cpu(mac->ac[e_aci].cw_min); |
1780 | u16 cw_max = le16_to_cpu(mac->ac[e_aci].cw_max); | 1780 | u16 cw_max = le16_to_cpu(mac->ac[e_aci].cw_max); |
@@ -1814,11 +1814,11 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1814 | } | 1814 | } |
1815 | if (rtlusb->acm_method != eAcmWay2_SW) | 1815 | if (rtlusb->acm_method != eAcmWay2_SW) |
1816 | rtlpriv->cfg->ops->set_hw_reg(hw, | 1816 | rtlpriv->cfg->ops->set_hw_reg(hw, |
1817 | HW_VAR_ACM_CTRL, (u8 *)(&e_aci)); | 1817 | HW_VAR_ACM_CTRL, &e_aci); |
1818 | break; | 1818 | break; |
1819 | } | 1819 | } |
1820 | case HW_VAR_ACM_CTRL:{ | 1820 | case HW_VAR_ACM_CTRL:{ |
1821 | u8 e_aci = *((u8 *) val); | 1821 | u8 e_aci = *val; |
1822 | union aci_aifsn *p_aci_aifsn = (union aci_aifsn *) | 1822 | union aci_aifsn *p_aci_aifsn = (union aci_aifsn *) |
1823 | (&(mac->ac[0].aifs)); | 1823 | (&(mac->ac[0].aifs)); |
1824 | u8 acm = p_aci_aifsn->f.acm; | 1824 | u8 acm = p_aci_aifsn->f.acm; |
@@ -1874,7 +1874,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1874 | break; | 1874 | break; |
1875 | } | 1875 | } |
1876 | case HW_VAR_RETRY_LIMIT:{ | 1876 | case HW_VAR_RETRY_LIMIT:{ |
1877 | u8 retry_limit = ((u8 *) (val))[0]; | 1877 | u8 retry_limit = val[0]; |
1878 | 1878 | ||
1879 | rtl_write_word(rtlpriv, REG_RL, | 1879 | rtl_write_word(rtlpriv, REG_RL, |
1880 | retry_limit << RETRY_LIMIT_SHORT_SHIFT | | 1880 | retry_limit << RETRY_LIMIT_SHORT_SHIFT | |
@@ -1891,39 +1891,38 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1891 | rtlefuse->efuse_usedbytes = *((u16 *) val); | 1891 | rtlefuse->efuse_usedbytes = *((u16 *) val); |
1892 | break; | 1892 | break; |
1893 | case HW_VAR_EFUSE_USAGE: | 1893 | case HW_VAR_EFUSE_USAGE: |
1894 | rtlefuse->efuse_usedpercentage = *((u8 *) val); | 1894 | rtlefuse->efuse_usedpercentage = *val; |
1895 | break; | 1895 | break; |
1896 | case HW_VAR_IO_CMD: | 1896 | case HW_VAR_IO_CMD: |
1897 | rtl92c_phy_set_io_cmd(hw, (*(enum io_type *)val)); | 1897 | rtl92c_phy_set_io_cmd(hw, (*(enum io_type *)val)); |
1898 | break; | 1898 | break; |
1899 | case HW_VAR_WPA_CONFIG: | 1899 | case HW_VAR_WPA_CONFIG: |
1900 | rtl_write_byte(rtlpriv, REG_SECCFG, *((u8 *) val)); | 1900 | rtl_write_byte(rtlpriv, REG_SECCFG, *val); |
1901 | break; | 1901 | break; |
1902 | case HW_VAR_SET_RPWM:{ | 1902 | case HW_VAR_SET_RPWM:{ |
1903 | u8 rpwm_val = rtl_read_byte(rtlpriv, REG_USB_HRPWM); | 1903 | u8 rpwm_val = rtl_read_byte(rtlpriv, REG_USB_HRPWM); |
1904 | 1904 | ||
1905 | if (rpwm_val & BIT(7)) | 1905 | if (rpwm_val & BIT(7)) |
1906 | rtl_write_byte(rtlpriv, REG_USB_HRPWM, | 1906 | rtl_write_byte(rtlpriv, REG_USB_HRPWM, *val); |
1907 | (*(u8 *)val)); | ||
1908 | else | 1907 | else |
1909 | rtl_write_byte(rtlpriv, REG_USB_HRPWM, | 1908 | rtl_write_byte(rtlpriv, REG_USB_HRPWM, |
1910 | ((*(u8 *)val) | BIT(7))); | 1909 | *val | BIT(7)); |
1911 | break; | 1910 | break; |
1912 | } | 1911 | } |
1913 | case HW_VAR_H2C_FW_PWRMODE:{ | 1912 | case HW_VAR_H2C_FW_PWRMODE:{ |
1914 | u8 psmode = (*(u8 *) val); | 1913 | u8 psmode = *val; |
1915 | 1914 | ||
1916 | if ((psmode != FW_PS_ACTIVE_MODE) && | 1915 | if ((psmode != FW_PS_ACTIVE_MODE) && |
1917 | (!IS_92C_SERIAL(rtlhal->version))) | 1916 | (!IS_92C_SERIAL(rtlhal->version))) |
1918 | rtl92c_dm_rf_saving(hw, true); | 1917 | rtl92c_dm_rf_saving(hw, true); |
1919 | rtl92c_set_fw_pwrmode_cmd(hw, (*(u8 *) val)); | 1918 | rtl92c_set_fw_pwrmode_cmd(hw, (*val)); |
1920 | break; | 1919 | break; |
1921 | } | 1920 | } |
1922 | case HW_VAR_FW_PSMODE_STATUS: | 1921 | case HW_VAR_FW_PSMODE_STATUS: |
1923 | ppsc->fw_current_inpsmode = *((bool *) val); | 1922 | ppsc->fw_current_inpsmode = *((bool *) val); |
1924 | break; | 1923 | break; |
1925 | case HW_VAR_H2C_FW_JOINBSSRPT:{ | 1924 | case HW_VAR_H2C_FW_JOINBSSRPT:{ |
1926 | u8 mstatus = (*(u8 *) val); | 1925 | u8 mstatus = *val; |
1927 | u8 tmp_reg422; | 1926 | u8 tmp_reg422; |
1928 | bool recover = false; | 1927 | bool recover = false; |
1929 | 1928 | ||
@@ -1948,7 +1947,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1948 | tmp_reg422 | BIT(6)); | 1947 | tmp_reg422 | BIT(6)); |
1949 | rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); | 1948 | rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); |
1950 | } | 1949 | } |
1951 | rtl92c_set_fw_joinbss_report_cmd(hw, (*(u8 *) val)); | 1950 | rtl92c_set_fw_joinbss_report_cmd(hw, (*val)); |
1952 | break; | 1951 | break; |
1953 | } | 1952 | } |
1954 | case HW_VAR_AID:{ | 1953 | case HW_VAR_AID:{ |
@@ -1961,7 +1960,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1961 | break; | 1960 | break; |
1962 | } | 1961 | } |
1963 | case HW_VAR_CORRECT_TSF:{ | 1962 | case HW_VAR_CORRECT_TSF:{ |
1964 | u8 btype_ibss = ((u8 *) (val))[0]; | 1963 | u8 btype_ibss = val[0]; |
1965 | 1964 | ||
1966 | if (btype_ibss) | 1965 | if (btype_ibss) |
1967 | _rtl92cu_stop_tx_beacon(hw); | 1966 | _rtl92cu_stop_tx_beacon(hw); |
@@ -2184,7 +2183,7 @@ void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw) | |||
2184 | u16 sifs_timer; | 2183 | u16 sifs_timer; |
2185 | 2184 | ||
2186 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, | 2185 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, |
2187 | (u8 *)&mac->slot_time); | 2186 | &mac->slot_time); |
2188 | if (!mac->ht_enable) | 2187 | if (!mac->ht_enable) |
2189 | sifs_timer = 0x0a0a; | 2188 | sifs_timer = 0x0a0a; |
2190 | else | 2189 | else |