aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:26:39 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:26:39 -0500
commit8926574c4d0055ca4c4a02d1f6b2c249d01a0621 (patch)
tree0c02c3cfff77e868d605246204add4664503b2af /drivers/net
parentc056b734e54e12f38f34a2583a4824e6cecc16c1 (diff)
parentb0302aba812bcc39291cdab9ad7e37008f352a91 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts: drivers/net/wireless/rtlwifi/rtl8192se/sw.c
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c5
-rw-r--r--drivers/net/wireless/ath/ath5k/mac80211-ops.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c154
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c15
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c2
-rw-r--r--drivers/net/wireless/ath/carl9170/carl9170.h2
-rw-r--r--drivers/net/wireless/ath/carl9170/fw.c33
-rw-r--r--drivers/net/wireless/ath/carl9170/mac.c35
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c18
-rw-r--r--drivers/net/wireless/ath/carl9170/phy.c36
-rw-r--r--drivers/net/wireless/ath/carl9170/tx.c2
-rw-r--r--drivers/net/wireless/b43/b43.h12
-rw-r--r--drivers/net/wireless/b43/main.c67
-rw-r--r--drivers/net/wireless/b43/phy_n.c532
-rw-r--r--drivers/net/wireless/b43/phy_n.h1
-rw-r--r--drivers/net/wireless/b43/tables_nphy.c76
-rw-r--r--drivers/net/wireless/b43/tables_nphy.h14
-rw-r--r--drivers/net/wireless/brcm80211/Makefile2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c3
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd.h4
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c17
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h20
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c10
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c216
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c6
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h36
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/aiutils.c4
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/ampdu.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/dma.c8
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c24
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h2
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c194
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.h6
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c5
-rw-r--r--drivers/net/wireless/brcm80211/brcmutil/utils.c26
-rw-r--r--drivers/net/wireless/brcm80211/include/brcmu_utils.h15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-2000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-calib.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-calib.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-hw.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rx.c30
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-sta.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tt.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tt.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c103
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-bus.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-cfg.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-csr.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-devtrace.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-devtrace.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fh.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-mac80211.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-pci.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-prph.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c23
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-testmode.c64
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-testmode.h32
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-ucode.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-wifi.h4
-rw-r--r--drivers/net/wireless/mwifiex/11n_aggr.c3
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c37
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c3
-rw-r--r--drivers/net/wireless/mwifiex/decl.h6
-rw-r--r--drivers/net/wireless/mwifiex/init.c5
-rw-r--r--drivers/net/wireless/mwifiex/main.c25
-rw-r--r--drivers/net/wireless/mwifiex/main.h4
-rw-r--r--drivers/net/wireless/mwifiex/scan.c8
-rw-r--r--drivers/net/wireless/mwifiex/sta_rx.c6
-rw-r--r--drivers/net/wireless/mwifiex/sta_tx.c3
-rw-r--r--drivers/net/wireless/mwifiex/txrx.c6
-rw-r--r--drivers/net/wireless/mwifiex/util.c3
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c5
-rw-r--r--drivers/net/wireless/mwifiex/wmm.h4
-rw-r--r--drivers/net/wireless/mwl8k.c2
-rw-r--r--drivers/net/wireless/orinoco/orinoco_usb.c5
-rw-r--r--drivers/net/wireless/p54/main.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c23
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c4
-rw-r--r--drivers/net/wireless/rtlwifi/Kconfig5
-rw-r--r--drivers/net/wireless/rtlwifi/base.c67
-rw-r--r--drivers/net/wireless/rtlwifi/base.h2
-rw-r--r--drivers/net/wireless/rtlwifi/cam.c85
-rw-r--r--drivers/net/wireless/rtlwifi/cam.h2
-rw-r--r--drivers/net/wireless/rtlwifi/core.c174
-rw-r--r--drivers/net/wireless/rtlwifi/core.h6
-rw-r--r--drivers/net/wireless/rtlwifi/debug.c4
-rw-r--r--drivers/net/wireless/rtlwifi/debug.h121
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.c63
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.h2
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c243
-rw-r--r--drivers/net/wireless/rtlwifi/pci.h3
-rw-r--r--drivers/net/wireless/rtlwifi/ps.c36
-rw-r--r--drivers/net/wireless/rtlwifi/ps.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rc.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rc.h2
-rw-r--r--drivers/net/wireless/rtlwifi/regd.c14
-rw-r--r--drivers/net/wireless/rtlwifi/regd.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c191
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c99
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/main.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c213
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/def.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/dm.c26
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/dm.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/hw.c279
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/hw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/led.c18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/led.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/phy.c110
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/phy.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/reg.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/rf.c85
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/rf.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/sw.c37
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/sw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/table.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/table.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.c25
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/def.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/dm.c26
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/dm.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.c464
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/led.c17
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/led.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/mac.c133
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/mac.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/phy.c123
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/phy.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/reg.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/rf.c73
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/rf.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c34
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/table.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/table.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/trx.c44
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/trx.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/def.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/dm.c241
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/dm.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/fw.c137
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/fw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/hw.c193
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/hw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/led.c16
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/led.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/phy.c684
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/phy.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/reg.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/rf.c97
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/rf.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/sw.c57
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/sw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/table.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/table.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/trx.c28
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/trx.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/def.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/dm.c32
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/dm.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/fw.c70
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/fw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/hw.c262
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/hw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/led.c22
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/led.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/phy.c208
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/phy.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/reg.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/rf.c64
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/rf.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/sw.c82
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/sw.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/table.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/table.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/trx.c20
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/trx.h2
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c92
-rw-r--r--drivers/net/wireless/rtlwifi/usb.h3
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h8
-rw-r--r--drivers/net/wireless/wl1251/main.c7
-rw-r--r--drivers/net/wireless/wl12xx/main.c5
224 files changed, 3837 insertions, 3627 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index d366dadcf86e..a339693fbe26 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -80,7 +80,7 @@ static bool modparam_fastchanswitch;
80module_param_named(fastchanswitch, modparam_fastchanswitch, bool, S_IRUGO); 80module_param_named(fastchanswitch, modparam_fastchanswitch, bool, S_IRUGO);
81MODULE_PARM_DESC(fastchanswitch, "Enable fast channel switching for AR2413/AR5413 radios."); 81MODULE_PARM_DESC(fastchanswitch, "Enable fast channel switching for AR2413/AR5413 radios.");
82 82
83static int ath5k_modparam_no_hw_rfkill_switch; 83static bool ath5k_modparam_no_hw_rfkill_switch;
84module_param_named(no_hw_rfkill_switch, ath5k_modparam_no_hw_rfkill_switch, 84module_param_named(no_hw_rfkill_switch, ath5k_modparam_no_hw_rfkill_switch,
85 bool, S_IRUGO); 85 bool, S_IRUGO);
86MODULE_PARM_DESC(no_hw_rfkill_switch, "Ignore the GPIO RFKill switch state"); 86MODULE_PARM_DESC(no_hw_rfkill_switch, "Ignore the GPIO RFKill switch state");
@@ -2442,6 +2442,9 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
2442 BIT(NL80211_IFTYPE_ADHOC) | 2442 BIT(NL80211_IFTYPE_ADHOC) |
2443 BIT(NL80211_IFTYPE_MESH_POINT); 2443 BIT(NL80211_IFTYPE_MESH_POINT);
2444 2444
2445 /* SW support for IBSS_RSN is provided by mac80211 */
2446 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
2447
2445 /* both antennas can be configured as RX or TX */ 2448 /* both antennas can be configured as RX or TX */
2446 hw->wiphy->available_antennas_tx = 0x3; 2449 hw->wiphy->available_antennas_tx = 0x3;
2447 hw->wiphy->available_antennas_rx = 0x3; 2450 hw->wiphy->available_antennas_rx = 0x3;
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index 6ed4c0717e3e..af4c7ecb4b30 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -483,6 +483,14 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
483 if (ath5k_modparam_nohwcrypt) 483 if (ath5k_modparam_nohwcrypt)
484 return -EOPNOTSUPP; 484 return -EOPNOTSUPP;
485 485
486 if (vif->type == NL80211_IFTYPE_ADHOC &&
487 (key->cipher == WLAN_CIPHER_SUITE_TKIP ||
488 key->cipher == WLAN_CIPHER_SUITE_CCMP) &&
489 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
490 /* don't program group keys when using IBSS_RSN */
491 return -EOPNOTSUPP;
492 }
493
486 switch (key->cipher) { 494 switch (key->cipher) {
487 case WLAN_CIPHER_SUITE_WEP40: 495 case WLAN_CIPHER_SUITE_WEP40:
488 case WLAN_CIPHER_SUITE_WEP104: 496 case WLAN_CIPHER_SUITE_WEP104:
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 77c8ded8de57..f317515d8bf3 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -968,8 +968,7 @@ static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev)
968 ath9k_hif_usb_dealloc_rx_urbs(hif_dev); 968 ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
969} 969}
970 970
971static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev, 971static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
972 u32 drv_info)
973{ 972{
974 int transfer, err; 973 int transfer, err;
975 const void *data = hif_dev->firmware->data; 974 const void *data = hif_dev->firmware->data;
@@ -1000,7 +999,7 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev,
1000 } 999 }
1001 kfree(buf); 1000 kfree(buf);
1002 1001
1003 if (IS_AR7010_DEVICE(drv_info)) 1002 if (IS_AR7010_DEVICE(hif_dev->usb_device_id->driver_info))
1004 firm_offset = AR7010_FIRMWARE_TEXT; 1003 firm_offset = AR7010_FIRMWARE_TEXT;
1005 else 1004 else
1006 firm_offset = AR9271_FIRMWARE_TEXT; 1005 firm_offset = AR9271_FIRMWARE_TEXT;
@@ -1021,28 +1020,18 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev,
1021 return 0; 1020 return 0;
1022} 1021}
1023 1022
1024static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev, u32 drv_info) 1023static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
1025{ 1024{
1026 int ret, idx;
1027 struct usb_host_interface *alt = &hif_dev->interface->altsetting[0]; 1025 struct usb_host_interface *alt = &hif_dev->interface->altsetting[0];
1028 struct usb_endpoint_descriptor *endp; 1026 struct usb_endpoint_descriptor *endp;
1027 int ret, idx;
1029 1028
1030 /* Request firmware */ 1029 ret = ath9k_hif_usb_download_fw(hif_dev);
1031 ret = request_firmware(&hif_dev->firmware, hif_dev->fw_name,
1032 &hif_dev->udev->dev);
1033 if (ret) {
1034 dev_err(&hif_dev->udev->dev,
1035 "ath9k_htc: Firmware - %s not found\n", hif_dev->fw_name);
1036 goto err_fw_req;
1037 }
1038
1039 /* Download firmware */
1040 ret = ath9k_hif_usb_download_fw(hif_dev, drv_info);
1041 if (ret) { 1030 if (ret) {
1042 dev_err(&hif_dev->udev->dev, 1031 dev_err(&hif_dev->udev->dev,
1043 "ath9k_htc: Firmware - %s download failed\n", 1032 "ath9k_htc: Firmware - %s download failed\n",
1044 hif_dev->fw_name); 1033 hif_dev->fw_name);
1045 goto err_fw_download; 1034 return ret;
1046 } 1035 }
1047 1036
1048 /* On downloading the firmware to the target, the USB descriptor of EP4 1037 /* On downloading the firmware to the target, the USB descriptor of EP4
@@ -1064,23 +1053,84 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev, u32 drv_info)
1064 if (ret) { 1053 if (ret) {
1065 dev_err(&hif_dev->udev->dev, 1054 dev_err(&hif_dev->udev->dev,
1066 "ath9k_htc: Unable to allocate URBs\n"); 1055 "ath9k_htc: Unable to allocate URBs\n");
1067 goto err_fw_download; 1056 return ret;
1068 } 1057 }
1069 1058
1070 return 0; 1059 return 0;
1071
1072err_fw_download:
1073 release_firmware(hif_dev->firmware);
1074err_fw_req:
1075 hif_dev->firmware = NULL;
1076 return ret;
1077} 1060}
1078 1061
1079static void ath9k_hif_usb_dev_deinit(struct hif_device_usb *hif_dev) 1062static void ath9k_hif_usb_dev_deinit(struct hif_device_usb *hif_dev)
1080{ 1063{
1081 ath9k_hif_usb_dealloc_urbs(hif_dev); 1064 ath9k_hif_usb_dealloc_urbs(hif_dev);
1082 if (hif_dev->firmware) 1065}
1083 release_firmware(hif_dev->firmware); 1066
1067/*
1068 * If initialization fails or the FW cannot be retrieved,
1069 * detach the device.
1070 */
1071static void ath9k_hif_usb_firmware_fail(struct hif_device_usb *hif_dev)
1072{
1073 struct device *parent = hif_dev->udev->dev.parent;
1074
1075 complete(&hif_dev->fw_done);
1076
1077 if (parent)
1078 device_lock(parent);
1079
1080 device_release_driver(&hif_dev->udev->dev);
1081
1082 if (parent)
1083 device_unlock(parent);
1084}
1085
1086static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context)
1087{
1088 struct hif_device_usb *hif_dev = context;
1089 int ret;
1090
1091 if (!fw) {
1092 dev_err(&hif_dev->udev->dev,
1093 "ath9k_htc: Failed to get firmware %s\n",
1094 hif_dev->fw_name);
1095 goto err_fw;
1096 }
1097
1098 hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb,
1099 &hif_dev->udev->dev);
1100 if (hif_dev->htc_handle == NULL) {
1101 goto err_fw;
1102 }
1103
1104 hif_dev->firmware = fw;
1105
1106 /* Proceed with initialization */
1107
1108 ret = ath9k_hif_usb_dev_init(hif_dev);
1109 if (ret)
1110 goto err_dev_init;
1111
1112 ret = ath9k_htc_hw_init(hif_dev->htc_handle,
1113 &hif_dev->interface->dev,
1114 hif_dev->usb_device_id->idProduct,
1115 hif_dev->udev->product,
1116 hif_dev->usb_device_id->driver_info);
1117 if (ret) {
1118 ret = -EINVAL;
1119 goto err_htc_hw_init;
1120 }
1121
1122 complete(&hif_dev->fw_done);
1123
1124 return;
1125
1126err_htc_hw_init:
1127 ath9k_hif_usb_dev_deinit(hif_dev);
1128err_dev_init:
1129 ath9k_htc_hw_free(hif_dev->htc_handle);
1130 release_firmware(fw);
1131 hif_dev->firmware = NULL;
1132err_fw:
1133 ath9k_hif_usb_firmware_fail(hif_dev);
1084} 1134}
1085 1135
1086/* 1136/*
@@ -1155,20 +1205,16 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
1155 } 1205 }
1156 1206
1157 usb_get_dev(udev); 1207 usb_get_dev(udev);
1208
1158 hif_dev->udev = udev; 1209 hif_dev->udev = udev;
1159 hif_dev->interface = interface; 1210 hif_dev->interface = interface;
1160 hif_dev->device_id = id->idProduct; 1211 hif_dev->usb_device_id = id;
1161#ifdef CONFIG_PM 1212#ifdef CONFIG_PM
1162 udev->reset_resume = 1; 1213 udev->reset_resume = 1;
1163#endif 1214#endif
1164 usb_set_intfdata(interface, hif_dev); 1215 usb_set_intfdata(interface, hif_dev);
1165 1216
1166 hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb, 1217 init_completion(&hif_dev->fw_done);
1167 &hif_dev->udev->dev);
1168 if (hif_dev->htc_handle == NULL) {
1169 ret = -ENOMEM;
1170 goto err_htc_hw_alloc;
1171 }
1172 1218
1173 /* Find out which firmware to load */ 1219 /* Find out which firmware to load */
1174 1220
@@ -1177,29 +1223,22 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
1177 else 1223 else
1178 hif_dev->fw_name = FIRMWARE_AR9271; 1224 hif_dev->fw_name = FIRMWARE_AR9271;
1179 1225
1180 ret = ath9k_hif_usb_dev_init(hif_dev, id->driver_info); 1226 ret = request_firmware_nowait(THIS_MODULE, true, hif_dev->fw_name,
1181 if (ret) { 1227 &hif_dev->udev->dev, GFP_KERNEL,
1182 ret = -EINVAL; 1228 hif_dev, ath9k_hif_usb_firmware_cb);
1183 goto err_hif_init_usb;
1184 }
1185
1186 ret = ath9k_htc_hw_init(hif_dev->htc_handle,
1187 &interface->dev, hif_dev->device_id,
1188 hif_dev->udev->product, id->driver_info);
1189 if (ret) { 1229 if (ret) {
1190 ret = -EINVAL; 1230 dev_err(&hif_dev->udev->dev,
1191 goto err_htc_hw_init; 1231 "ath9k_htc: Async request for firmware %s failed\n",
1232 hif_dev->fw_name);
1233 goto err_fw_req;
1192 } 1234 }
1193 1235
1194 dev_info(&hif_dev->udev->dev, "ath9k_htc: USB layer initialized\n"); 1236 dev_info(&hif_dev->udev->dev, "ath9k_htc: Firmware %s requested\n",
1237 hif_dev->fw_name);
1195 1238
1196 return 0; 1239 return 0;
1197 1240
1198err_htc_hw_init: 1241err_fw_req:
1199 ath9k_hif_usb_dev_deinit(hif_dev);
1200err_hif_init_usb:
1201 ath9k_htc_hw_free(hif_dev->htc_handle);
1202err_htc_hw_alloc:
1203 usb_set_intfdata(interface, NULL); 1242 usb_set_intfdata(interface, NULL);
1204 kfree(hif_dev); 1243 kfree(hif_dev);
1205 usb_put_dev(udev); 1244 usb_put_dev(udev);
@@ -1234,9 +1273,15 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
1234 if (!hif_dev) 1273 if (!hif_dev)
1235 return; 1274 return;
1236 1275
1237 ath9k_htc_hw_deinit(hif_dev->htc_handle, unplugged); 1276 wait_for_completion(&hif_dev->fw_done);
1238 ath9k_htc_hw_free(hif_dev->htc_handle); 1277
1239 ath9k_hif_usb_dev_deinit(hif_dev); 1278 if (hif_dev->firmware) {
1279 ath9k_htc_hw_deinit(hif_dev->htc_handle, unplugged);
1280 ath9k_htc_hw_free(hif_dev->htc_handle);
1281 ath9k_hif_usb_dev_deinit(hif_dev);
1282 release_firmware(hif_dev->firmware);
1283 }
1284
1240 usb_set_intfdata(interface, NULL); 1285 usb_set_intfdata(interface, NULL);
1241 1286
1242 if (!unplugged && (hif_dev->flags & HIF_USB_START)) 1287 if (!unplugged && (hif_dev->flags & HIF_USB_START))
@@ -1276,8 +1321,7 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface)
1276 return ret; 1321 return ret;
1277 1322
1278 if (hif_dev->firmware) { 1323 if (hif_dev->firmware) {
1279 ret = ath9k_hif_usb_download_fw(hif_dev, 1324 ret = ath9k_hif_usb_download_fw(hif_dev);
1280 htc_handle->drv_priv->ah->hw_version.usbdev);
1281 if (ret) 1325 if (ret)
1282 goto fail_resume; 1326 goto fail_resume;
1283 } else { 1327 } else {
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h
index 794f63094e5d..487ff658b4c1 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.h
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.h
@@ -87,10 +87,11 @@ struct cmd_buf {
87#define HIF_USB_START BIT(0) 87#define HIF_USB_START BIT(0)
88 88
89struct hif_device_usb { 89struct hif_device_usb {
90 u16 device_id;
91 struct usb_device *udev; 90 struct usb_device *udev;
92 struct usb_interface *interface; 91 struct usb_interface *interface;
92 const struct usb_device_id *usb_device_id;
93 const struct firmware *firmware; 93 const struct firmware *firmware;
94 struct completion fw_done;
94 struct htc_target *htc_handle; 95 struct htc_target *htc_handle;
95 struct hif_usb_tx tx; 96 struct hif_usb_tx tx;
96 struct usb_anchor regout_submitted; 97 struct usb_anchor regout_submitted;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 9be10a2da1c2..fc7519c93390 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -741,6 +741,8 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
741 741
742 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 742 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
743 743
744 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
745
744 hw->queues = 4; 746 hw->queues = 4;
745 hw->channel_change_time = 5000; 747 hw->channel_change_time = 5000;
746 hw->max_listen_interval = 10; 748 hw->max_listen_interval = 10;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index ef4c60661290..06101b6bdeac 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1409,6 +1409,21 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
1409 if (htc_modparam_nohwcrypt) 1409 if (htc_modparam_nohwcrypt)
1410 return -ENOSPC; 1410 return -ENOSPC;
1411 1411
1412 if ((vif->type == NL80211_IFTYPE_ADHOC ||
1413 vif->type == NL80211_IFTYPE_MESH_POINT) &&
1414 (key->cipher == WLAN_CIPHER_SUITE_TKIP ||
1415 key->cipher == WLAN_CIPHER_SUITE_CCMP) &&
1416 !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
1417 /*
1418 * For now, disable hw crypto for the RSN IBSS group keys. This
1419 * could be optimized in the future to use a modified key cache
1420 * design to support per-STA RX GTK, but until that gets
1421 * implemented, use of software crypto for group addressed
1422 * frames is a acceptable to allow RSN IBSS to be used.
1423 */
1424 return -EOPNOTSUPP;
1425 }
1426
1412 mutex_lock(&priv->mutex); 1427 mutex_lock(&priv->mutex);
1413 ath_dbg(common, CONFIG, "Set HW Key\n"); 1428 ath_dbg(common, CONFIG, "Set HW Key\n");
1414 ath9k_htc_ps_wakeup(priv); 1429 ath9k_htc_ps_wakeup(priv);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 4a00806e2852..ec82e926badc 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -340,9 +340,7 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan,
340 fastcc = false; 340 fastcc = false;
341 341
342 ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n", 342 ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n",
343 hchan->channel, !!(hchan->channelFlags & (CHANNEL_HT40MINUS | 343 hchan->channel, IS_CHAN_HT40(hchan), fastcc);
344 CHANNEL_HT40PLUS)),
345 fastcc);
346 344
347 r = ath9k_hw_reset(ah, hchan, caldata, fastcc); 345 r = ath9k_hw_reset(ah, hchan, caldata, fastcc);
348 if (r) { 346 if (r) {
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index b3c3798fe513..635b592ad961 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -694,7 +694,7 @@ static u8 ath_rc_get_highest_rix(struct ath_softc *sc,
694 return rate; 694 return rate;
695 695
696 /* This should not happen */ 696 /* This should not happen */
697 WARN_ON(1); 697 WARN_ON_ONCE(1);
698 698
699 rate = ath_rc_priv->valid_rate_index[0]; 699 rate = ath_rc_priv->valid_rate_index[0];
700 700
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index 6cfbb419e2f6..0cea20e3e250 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -559,6 +559,7 @@ int carl9170_set_hwretry_limit(struct ar9170 *ar, const u32 max_retry);
559int carl9170_upload_key(struct ar9170 *ar, const u8 id, const u8 *mac, 559int carl9170_upload_key(struct ar9170 *ar, const u8 id, const u8 *mac,
560 const u8 ktype, const u8 keyidx, const u8 *keydata, const int keylen); 560 const u8 ktype, const u8 keyidx, const u8 *keydata, const int keylen);
561int carl9170_disable_key(struct ar9170 *ar, const u8 id); 561int carl9170_disable_key(struct ar9170 *ar, const u8 id);
562int carl9170_set_mac_tpc(struct ar9170 *ar, struct ieee80211_channel *channel);
562 563
563/* RX */ 564/* RX */
564void carl9170_rx(struct ar9170 *ar, void *buf, unsigned int len); 565void carl9170_rx(struct ar9170 *ar, void *buf, unsigned int len);
@@ -593,7 +594,6 @@ int carl9170_get_noisefloor(struct ar9170 *ar);
593 594
594/* FW */ 595/* FW */
595int carl9170_parse_firmware(struct ar9170 *ar); 596int carl9170_parse_firmware(struct ar9170 *ar);
596int carl9170_fw_fix_eeprom(struct ar9170 *ar);
597 597
598extern struct ieee80211_rate __carl9170_ratetable[]; 598extern struct ieee80211_rate __carl9170_ratetable[];
599extern int modparam_noht; 599extern int modparam_noht;
diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c
index 3de61adacd34..cffde8d9a521 100644
--- a/drivers/net/wireless/ath/carl9170/fw.c
+++ b/drivers/net/wireless/ath/carl9170/fw.c
@@ -389,39 +389,6 @@ carl9170_find_fw_desc(struct ar9170 *ar, const __u8 *fw_data, const size_t len)
389 return (void *)&fw_data[scan - found]; 389 return (void *)&fw_data[scan - found];
390} 390}
391 391
392int carl9170_fw_fix_eeprom(struct ar9170 *ar)
393{
394 const struct carl9170fw_fix_desc *fix_desc = NULL;
395 unsigned int i, n, off;
396 u32 *data = (void *)&ar->eeprom;
397
398 fix_desc = carl9170_fw_find_desc(ar, FIX_MAGIC,
399 sizeof(*fix_desc), CARL9170FW_FIX_DESC_CUR_VER);
400
401 if (!fix_desc)
402 return 0;
403
404 n = (le16_to_cpu(fix_desc->head.length) - sizeof(*fix_desc)) /
405 sizeof(struct carl9170fw_fix_entry);
406
407 for (i = 0; i < n; i++) {
408 off = le32_to_cpu(fix_desc->data[i].address) -
409 AR9170_EEPROM_START;
410
411 if (off >= sizeof(struct ar9170_eeprom) || (off & 3)) {
412 dev_err(&ar->udev->dev, "Skip invalid entry %d\n", i);
413 continue;
414 }
415
416 data[off / sizeof(*data)] &=
417 le32_to_cpu(fix_desc->data[i].mask);
418 data[off / sizeof(*data)] |=
419 le32_to_cpu(fix_desc->data[i].value);
420 }
421
422 return 0;
423}
424
425int carl9170_parse_firmware(struct ar9170 *ar) 392int carl9170_parse_firmware(struct ar9170 *ar)
426{ 393{
427 const struct carl9170fw_desc_head *fw_desc = NULL; 394 const struct carl9170fw_desc_head *fw_desc = NULL;
diff --git a/drivers/net/wireless/ath/carl9170/mac.c b/drivers/net/wireless/ath/carl9170/mac.c
index dfda91970995..53415bfd8bef 100644
--- a/drivers/net/wireless/ath/carl9170/mac.c
+++ b/drivers/net/wireless/ath/carl9170/mac.c
@@ -485,3 +485,38 @@ int carl9170_disable_key(struct ar9170 *ar, const u8 id)
485 return carl9170_exec_cmd(ar, CARL9170_CMD_DKEY, 485 return carl9170_exec_cmd(ar, CARL9170_CMD_DKEY,
486 sizeof(key), (u8 *)&key, 0, NULL); 486 sizeof(key), (u8 *)&key, 0, NULL);
487} 487}
488
489int carl9170_set_mac_tpc(struct ar9170 *ar, struct ieee80211_channel *channel)
490{
491 unsigned int power, chains;
492
493 if (ar->eeprom.tx_mask != 1)
494 chains = AR9170_TX_PHY_TXCHAIN_2;
495 else
496 chains = AR9170_TX_PHY_TXCHAIN_1;
497
498 switch (channel->band) {
499 case IEEE80211_BAND_2GHZ:
500 power = ar->power_2G_ofdm[0] & 0x3f;
501 break;
502 case IEEE80211_BAND_5GHZ:
503 power = ar->power_5G_leg[0] & 0x3f;
504 break;
505 default:
506 BUG_ON(1);
507 }
508
509 power = min_t(unsigned int, power, ar->hw->conf.power_level * 2);
510
511 carl9170_regwrite_begin(ar);
512 carl9170_regwrite(AR9170_MAC_REG_ACK_TPC,
513 0x3c1e | power << 20 | chains << 26);
514 carl9170_regwrite(AR9170_MAC_REG_RTS_CTS_TPC,
515 power << 5 | chains << 11 |
516 power << 21 | chains << 27);
517 carl9170_regwrite(AR9170_MAC_REG_CFEND_QOSNULL_TPC,
518 power << 5 | chains << 11 |
519 power << 21 | chains << 27);
520 carl9170_regwrite_finish();
521 return carl9170_regwrite_result();
522}
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index db774212161b..8d2523b3f722 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -853,11 +853,6 @@ static int carl9170_op_config(struct ieee80211_hw *hw, u32 changed)
853 goto out; 853 goto out;
854 } 854 }
855 855
856 if (changed & IEEE80211_CONF_CHANGE_POWER) {
857 /* TODO */
858 err = 0;
859 }
860
861 if (changed & IEEE80211_CONF_CHANGE_SMPS) { 856 if (changed & IEEE80211_CONF_CHANGE_SMPS) {
862 /* TODO */ 857 /* TODO */
863 err = 0; 858 err = 0;
@@ -891,6 +886,12 @@ static int carl9170_op_config(struct ieee80211_hw *hw, u32 changed)
891 goto out; 886 goto out;
892 } 887 }
893 888
889 if (changed & IEEE80211_CONF_CHANGE_POWER) {
890 err = carl9170_set_mac_tpc(ar, ar->hw->conf.channel);
891 if (err)
892 goto out;
893 }
894
894out: 895out:
895 mutex_unlock(&ar->mutex); 896 mutex_unlock(&ar->mutex);
896 return err; 897 return err;
@@ -1796,6 +1797,9 @@ void *carl9170_alloc(size_t priv_size)
1796 ar->noise[i] = -95; /* ATH_DEFAULT_NOISE_FLOOR */ 1797 ar->noise[i] = -95; /* ATH_DEFAULT_NOISE_FLOOR */
1797 1798
1798 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 1799 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
1800
1801 /* As IBSS Encryption is software-based, IBSS RSN is supported. */
1802 hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
1799 return ar; 1803 return ar;
1800 1804
1801err_nomem: 1805err_nomem:
@@ -1931,10 +1935,6 @@ int carl9170_register(struct ar9170 *ar)
1931 if (err) 1935 if (err)
1932 return err; 1936 return err;
1933 1937
1934 err = carl9170_fw_fix_eeprom(ar);
1935 if (err)
1936 return err;
1937
1938 err = carl9170_parse_eeprom(ar); 1938 err = carl9170_parse_eeprom(ar);
1939 if (err) 1939 if (err)
1940 return err; 1940 return err;
diff --git a/drivers/net/wireless/ath/carl9170/phy.c b/drivers/net/wireless/ath/carl9170/phy.c
index 472efc7e3402..b72c09cf43a4 100644
--- a/drivers/net/wireless/ath/carl9170/phy.c
+++ b/drivers/net/wireless/ath/carl9170/phy.c
@@ -1426,15 +1426,15 @@ static void carl9170_calc_ctl(struct ar9170 *ar, u32 freq, enum carl9170_bw bw)
1426#undef EDGES 1426#undef EDGES
1427} 1427}
1428 1428
1429static int carl9170_set_power_cal(struct ar9170 *ar, u32 freq, 1429static void carl9170_set_power_cal(struct ar9170 *ar, u32 freq,
1430 enum carl9170_bw bw) 1430 enum carl9170_bw bw)
1431{ 1431{
1432 struct ar9170_calibration_target_power_legacy *ctpl; 1432 struct ar9170_calibration_target_power_legacy *ctpl;
1433 struct ar9170_calibration_target_power_ht *ctph; 1433 struct ar9170_calibration_target_power_ht *ctph;
1434 u8 *ctpres; 1434 u8 *ctpres;
1435 int ntargets; 1435 int ntargets;
1436 int idx, i, n; 1436 int idx, i, n;
1437 u8 ackpower, ackchains, f; 1437 u8 f;
1438 u8 pwr_freqs[AR5416_MAX_NUM_TGT_PWRS]; 1438 u8 pwr_freqs[AR5416_MAX_NUM_TGT_PWRS];
1439 1439
1440 if (freq < 3000) 1440 if (freq < 3000)
@@ -1523,32 +1523,6 @@ static int carl9170_set_power_cal(struct ar9170 *ar, u32 freq,
1523 1523
1524 /* calc. conformance test limits and apply to ar->power*[] */ 1524 /* calc. conformance test limits and apply to ar->power*[] */
1525 carl9170_calc_ctl(ar, freq, bw); 1525 carl9170_calc_ctl(ar, freq, bw);
1526
1527 /* set ACK/CTS TX power */
1528 carl9170_regwrite_begin(ar);
1529
1530 if (ar->eeprom.tx_mask != 1)
1531 ackchains = AR9170_TX_PHY_TXCHAIN_2;
1532 else
1533 ackchains = AR9170_TX_PHY_TXCHAIN_1;
1534
1535 if (freq < 3000)
1536 ackpower = ar->power_2G_ofdm[0] & 0x3f;
1537 else
1538 ackpower = ar->power_5G_leg[0] & 0x3f;
1539
1540 carl9170_regwrite(AR9170_MAC_REG_ACK_TPC,
1541 0x3c1e | ackpower << 20 | ackchains << 26);
1542 carl9170_regwrite(AR9170_MAC_REG_RTS_CTS_TPC,
1543 ackpower << 5 | ackchains << 11 |
1544 ackpower << 21 | ackchains << 27);
1545
1546 carl9170_regwrite(AR9170_MAC_REG_CFEND_QOSNULL_TPC,
1547 ackpower << 5 | ackchains << 11 |
1548 ackpower << 21 | ackchains << 27);
1549
1550 carl9170_regwrite_finish();
1551 return carl9170_regwrite_result();
1552} 1526}
1553 1527
1554int carl9170_get_noisefloor(struct ar9170 *ar) 1528int carl9170_get_noisefloor(struct ar9170 *ar)
@@ -1712,7 +1686,9 @@ int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
1712 if (err) 1686 if (err)
1713 return err; 1687 return err;
1714 1688
1715 err = carl9170_set_power_cal(ar, channel->center_freq, bw); 1689 carl9170_set_power_cal(ar, channel->center_freq, bw);
1690
1691 err = carl9170_set_mac_tpc(ar, channel);
1716 if (err) 1692 if (err)
1717 return err; 1693 return err;
1718 1694
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index d19a9ee9d057..771e1a9294c5 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -719,6 +719,8 @@ static void carl9170_tx_rate_tpc_chains(struct ar9170 *ar,
719 else 719 else
720 *chains = AR9170_TX_PHY_TXCHAIN_2; 720 *chains = AR9170_TX_PHY_TXCHAIN_2;
721 } 721 }
722
723 *tpc = min_t(unsigned int, *tpc, ar->hw->conf.power_level * 2);
722} 724}
723 725
724static __le32 carl9170_tx_physet(struct ar9170 *ar, 726static __le32 carl9170_tx_physet(struct ar9170 *ar,
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 16e8f8058155..835462dc1206 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -999,6 +999,12 @@ static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value)
999 dev->dev->write16(dev->dev, offset, value); 999 dev->dev->write16(dev->dev, offset, value);
1000} 1000}
1001 1001
1002static inline void b43_maskset16(struct b43_wldev *dev, u16 offset, u16 mask,
1003 u16 set)
1004{
1005 b43_write16(dev, offset, (b43_read16(dev, offset) & mask) | set);
1006}
1007
1002static inline u32 b43_read32(struct b43_wldev *dev, u16 offset) 1008static inline u32 b43_read32(struct b43_wldev *dev, u16 offset)
1003{ 1009{
1004 return dev->dev->read32(dev->dev, offset); 1010 return dev->dev->read32(dev->dev, offset);
@@ -1009,6 +1015,12 @@ static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value)
1009 dev->dev->write32(dev->dev, offset, value); 1015 dev->dev->write32(dev->dev, offset, value);
1010} 1016}
1011 1017
1018static inline void b43_maskset32(struct b43_wldev *dev, u16 offset, u32 mask,
1019 u32 set)
1020{
1021 b43_write32(dev, offset, (b43_read32(dev, offset) & mask) | set);
1022}
1023
1012static inline void b43_block_read(struct b43_wldev *dev, void *buffer, 1024static inline void b43_block_read(struct b43_wldev *dev, void *buffer,
1013 size_t count, u16 offset, u8 reg_width) 1025 size_t count, u16 offset, u8 reg_width)
1014{ 1026{
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 23ffb1b9a86f..5189cf38123a 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -580,22 +580,14 @@ void b43_tsf_read(struct b43_wldev *dev, u64 *tsf)
580 580
581static void b43_time_lock(struct b43_wldev *dev) 581static void b43_time_lock(struct b43_wldev *dev)
582{ 582{
583 u32 macctl; 583 b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_TBTTHOLD);
584
585 macctl = b43_read32(dev, B43_MMIO_MACCTL);
586 macctl |= B43_MACCTL_TBTTHOLD;
587 b43_write32(dev, B43_MMIO_MACCTL, macctl);
588 /* Commit the write */ 584 /* Commit the write */
589 b43_read32(dev, B43_MMIO_MACCTL); 585 b43_read32(dev, B43_MMIO_MACCTL);
590} 586}
591 587
592static void b43_time_unlock(struct b43_wldev *dev) 588static void b43_time_unlock(struct b43_wldev *dev)
593{ 589{
594 u32 macctl; 590 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_TBTTHOLD, 0);
595
596 macctl = b43_read32(dev, B43_MMIO_MACCTL);
597 macctl &= ~B43_MACCTL_TBTTHOLD;
598 b43_write32(dev, B43_MMIO_MACCTL, macctl);
599 /* Commit the write */ 591 /* Commit the write */
600 b43_read32(dev, B43_MMIO_MACCTL); 592 b43_read32(dev, B43_MMIO_MACCTL);
601} 593}
@@ -2487,10 +2479,8 @@ static int b43_upload_microcode(struct b43_wldev *dev)
2487 b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, B43_IRQ_ALL); 2479 b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, B43_IRQ_ALL);
2488 2480
2489 /* Start the microcode PSM */ 2481 /* Start the microcode PSM */
2490 macctl = b43_read32(dev, B43_MMIO_MACCTL); 2482 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_JMP0,
2491 macctl &= ~B43_MACCTL_PSM_JMP0; 2483 B43_MACCTL_PSM_RUN);
2492 macctl |= B43_MACCTL_PSM_RUN;
2493 b43_write32(dev, B43_MMIO_MACCTL, macctl);
2494 2484
2495 /* Wait for the microcode to load and respond */ 2485 /* Wait for the microcode to load and respond */
2496 i = 0; 2486 i = 0;
@@ -2590,10 +2580,9 @@ static int b43_upload_microcode(struct b43_wldev *dev)
2590 return 0; 2580 return 0;
2591 2581
2592error: 2582error:
2593 macctl = b43_read32(dev, B43_MMIO_MACCTL); 2583 /* Stop the microcode PSM. */
2594 macctl &= ~B43_MACCTL_PSM_RUN; 2584 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN,
2595 macctl |= B43_MACCTL_PSM_JMP0; 2585 B43_MACCTL_PSM_JMP0);
2596 b43_write32(dev, B43_MMIO_MACCTL, macctl);
2597 2586
2598 return err; 2587 return err;
2599} 2588}
@@ -2708,11 +2697,8 @@ static int b43_gpio_init(struct b43_wldev *dev)
2708 struct ssb_device *gpiodev; 2697 struct ssb_device *gpiodev;
2709 u32 mask, set; 2698 u32 mask, set;
2710 2699
2711 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) 2700 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0);
2712 & ~B43_MACCTL_GPOUTSMSK); 2701 b43_maskset16(dev, B43_MMIO_GPIO_MASK, ~0, 0xF);
2713
2714 b43_write16(dev, B43_MMIO_GPIO_MASK, b43_read16(dev, B43_MMIO_GPIO_MASK)
2715 | 0x000F);
2716 2702
2717 mask = 0x0000001F; 2703 mask = 0x0000001F;
2718 set = 0x0000000F; 2704 set = 0x0000000F;
@@ -2800,9 +2786,7 @@ void b43_mac_enable(struct b43_wldev *dev)
2800 dev->mac_suspended--; 2786 dev->mac_suspended--;
2801 B43_WARN_ON(dev->mac_suspended < 0); 2787 B43_WARN_ON(dev->mac_suspended < 0);
2802 if (dev->mac_suspended == 0) { 2788 if (dev->mac_suspended == 0) {
2803 b43_write32(dev, B43_MMIO_MACCTL, 2789 b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_ENABLED);
2804 b43_read32(dev, B43_MMIO_MACCTL)
2805 | B43_MACCTL_ENABLED);
2806 b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, 2790 b43_write32(dev, B43_MMIO_GEN_IRQ_REASON,
2807 B43_IRQ_MAC_SUSPENDED); 2791 B43_IRQ_MAC_SUSPENDED);
2808 /* Commit writes */ 2792 /* Commit writes */
@@ -2823,9 +2807,7 @@ void b43_mac_suspend(struct b43_wldev *dev)
2823 2807
2824 if (dev->mac_suspended == 0) { 2808 if (dev->mac_suspended == 0) {
2825 b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); 2809 b43_power_saving_ctl_bits(dev, B43_PS_AWAKE);
2826 b43_write32(dev, B43_MMIO_MACCTL, 2810 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_ENABLED, 0);
2827 b43_read32(dev, B43_MMIO_MACCTL)
2828 & ~B43_MACCTL_ENABLED);
2829 /* force pci to flush the write */ 2811 /* force pci to flush the write */
2830 b43_read32(dev, B43_MMIO_MACCTL); 2812 b43_read32(dev, B43_MMIO_MACCTL);
2831 for (i = 35; i; i--) { 2813 for (i = 35; i; i--) {
@@ -2931,15 +2913,10 @@ static void b43_adjust_opmode(struct b43_wldev *dev)
2931 * so always disable it. If we want to implement PMQ, 2913 * so always disable it. If we want to implement PMQ,
2932 * we need to enable it here (clear DISCPMQ) in AP mode. 2914 * we need to enable it here (clear DISCPMQ) in AP mode.
2933 */ 2915 */
2934 if (0 /* ctl & B43_MACCTL_AP */) { 2916 if (0 /* ctl & B43_MACCTL_AP */)
2935 b43_write32(dev, B43_MMIO_MACCTL, 2917 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_DISCPMQ, 0);
2936 b43_read32(dev, B43_MMIO_MACCTL) 2918 else
2937 & ~B43_MACCTL_DISCPMQ); 2919 b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_DISCPMQ);
2938 } else {
2939 b43_write32(dev, B43_MMIO_MACCTL,
2940 b43_read32(dev, B43_MMIO_MACCTL)
2941 | B43_MACCTL_DISCPMQ);
2942 }
2943} 2920}
2944 2921
2945static void b43_rate_memory_write(struct b43_wldev *dev, u16 rate, int is_ofdm) 2922static void b43_rate_memory_write(struct b43_wldev *dev, u16 rate, int is_ofdm)
@@ -3083,10 +3060,8 @@ static int b43_chip_init(struct b43_wldev *dev)
3083 if (dev->dev->core_rev < 5) 3060 if (dev->dev->core_rev < 5)
3084 b43_write32(dev, 0x010C, 0x01000000); 3061 b43_write32(dev, 0x010C, 0x01000000);
3085 3062
3086 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) 3063 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_INFRA, 0);
3087 & ~B43_MACCTL_INFRA); 3064 b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_INFRA);
3088 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL)
3089 | B43_MACCTL_INFRA);
3090 3065
3091 /* Probe Response Timeout value */ 3066 /* Probe Response Timeout value */
3092 /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */ 3067 /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */
@@ -4564,8 +4539,6 @@ static void b43_set_pretbtt(struct b43_wldev *dev)
4564/* Locking: wl->mutex */ 4539/* Locking: wl->mutex */
4565static void b43_wireless_core_exit(struct b43_wldev *dev) 4540static void b43_wireless_core_exit(struct b43_wldev *dev)
4566{ 4541{
4567 u32 macctl;
4568
4569 B43_WARN_ON(dev && b43_status(dev) > B43_STAT_INITIALIZED); 4542 B43_WARN_ON(dev && b43_status(dev) > B43_STAT_INITIALIZED);
4570 if (!dev || b43_status(dev) != B43_STAT_INITIALIZED) 4543 if (!dev || b43_status(dev) != B43_STAT_INITIALIZED)
4571 return; 4544 return;
@@ -4576,10 +4549,8 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
4576 b43_set_status(dev, B43_STAT_UNINIT); 4549 b43_set_status(dev, B43_STAT_UNINIT);
4577 4550
4578 /* Stop the microcode PSM. */ 4551 /* Stop the microcode PSM. */
4579 macctl = b43_read32(dev, B43_MMIO_MACCTL); 4552 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN,
4580 macctl &= ~B43_MACCTL_PSM_RUN; 4553 B43_MACCTL_PSM_JMP0);
4581 macctl |= B43_MACCTL_PSM_JMP0;
4582 b43_write32(dev, B43_MMIO_MACCTL, macctl);
4583 4554
4584 b43_dma_free(dev); 4555 b43_dma_free(dev);
4585 b43_pio_free(dev); 4556 b43_pio_free(dev);
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index bf5a43855358..108118820b36 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -85,22 +85,11 @@ static inline bool b43_nphy_ipa(struct b43_wldev *dev)
85 (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ)); 85 (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ));
86} 86}
87 87
88/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetIpaGainTbl */ 88/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreGetState */
89static const u32 *b43_nphy_get_ipa_gain_table(struct b43_wldev *dev) 89static u8 b43_nphy_get_rx_core_state(struct b43_wldev *dev)
90{ 90{
91 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 91 return (b43_phy_read(dev, B43_NPHY_RFSEQCA) & B43_NPHY_RFSEQCA_RXEN) >>
92 if (dev->phy.rev >= 6) { 92 B43_NPHY_RFSEQCA_RXEN_SHIFT;
93 if (dev->dev->chip_id == 47162)
94 return txpwrctrl_tx_gain_ipa_rev5;
95 return txpwrctrl_tx_gain_ipa_rev6;
96 } else if (dev->phy.rev >= 5) {
97 return txpwrctrl_tx_gain_ipa_rev5;
98 } else {
99 return txpwrctrl_tx_gain_ipa;
100 }
101 } else {
102 return txpwrctrl_tx_gain_ipa_5g;
103 }
104} 93}
105 94
106/************************************************** 95/**************************************************
@@ -229,7 +218,7 @@ static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
229 218
230 reg = (i == 0) ? 219 reg = (i == 0) ?
231 B43_NPHY_RFCTL_INTC1 : B43_NPHY_RFCTL_INTC2; 220 B43_NPHY_RFCTL_INTC1 : B43_NPHY_RFCTL_INTC2;
232 b43_phy_mask(dev, reg, 0xFBFF); 221 b43_phy_set(dev, reg, 0x400);
233 222
234 switch (field) { 223 switch (field) {
235 case 0: 224 case 0:
@@ -245,7 +234,7 @@ static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
245 b43_phy_set(dev, B43_NPHY_RFCTL_CMD, 234 b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
246 B43_NPHY_RFCTL_CMD_START); 235 B43_NPHY_RFCTL_CMD_START);
247 for (j = 0; j < 100; j++) { 236 for (j = 0; j < 100; j++) {
248 if (b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_START) { 237 if (!(b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_START)) {
249 j = 0; 238 j = 0;
250 break; 239 break;
251 } 240 }
@@ -264,7 +253,7 @@ static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
264 b43_phy_set(dev, B43_NPHY_RFCTL_CMD, 253 b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
265 B43_NPHY_RFCTL_CMD_RXTX); 254 B43_NPHY_RFCTL_CMD_RXTX);
266 for (j = 0; j < 100; j++) { 255 for (j = 0; j < 100; j++) {
267 if (b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_RXTX) { 256 if (!(b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_RXTX)) {
268 j = 0; 257 j = 0;
269 break; 258 break;
270 } 259 }
@@ -1231,12 +1220,12 @@ static int b43_nphy_poll_rssi(struct b43_wldev *dev, u8 type, s32 *buf,
1231 u16 s[2]; 1220 u16 s[2];
1232 1221
1233 if (dev->phy.rev >= 3) { 1222 if (dev->phy.rev >= 3) {
1234 save_regs_phy[0] = b43_phy_read(dev, 1223 save_regs_phy[0] = b43_phy_read(dev, B43_NPHY_AFECTL_C1);
1224 save_regs_phy[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2);
1225 save_regs_phy[2] = b43_phy_read(dev,
1235 B43_NPHY_RFCTL_LUT_TRSW_UP1); 1226 B43_NPHY_RFCTL_LUT_TRSW_UP1);
1236 save_regs_phy[1] = b43_phy_read(dev, 1227 save_regs_phy[3] = b43_phy_read(dev,
1237 B43_NPHY_RFCTL_LUT_TRSW_UP2); 1228 B43_NPHY_RFCTL_LUT_TRSW_UP2);
1238 save_regs_phy[2] = b43_phy_read(dev, B43_NPHY_AFECTL_C1);
1239 save_regs_phy[3] = b43_phy_read(dev, B43_NPHY_AFECTL_C2);
1240 save_regs_phy[4] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1); 1229 save_regs_phy[4] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1);
1241 save_regs_phy[5] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); 1230 save_regs_phy[5] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
1242 save_regs_phy[6] = b43_phy_read(dev, B43_NPHY_TXF_40CO_B1S0); 1231 save_regs_phy[6] = b43_phy_read(dev, B43_NPHY_TXF_40CO_B1S0);
@@ -1285,12 +1274,12 @@ static int b43_nphy_poll_rssi(struct b43_wldev *dev, u8 type, s32 *buf,
1285 b43_phy_write(dev, B43_NPHY_GPIO_SEL, save_regs_phy[8]); 1274 b43_phy_write(dev, B43_NPHY_GPIO_SEL, save_regs_phy[8]);
1286 1275
1287 if (dev->phy.rev >= 3) { 1276 if (dev->phy.rev >= 3) {
1277 b43_phy_write(dev, B43_NPHY_AFECTL_C1, save_regs_phy[0]);
1278 b43_phy_write(dev, B43_NPHY_AFECTL_C2, save_regs_phy[1]);
1288 b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1, 1279 b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1,
1289 save_regs_phy[0]); 1280 save_regs_phy[2]);
1290 b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 1281 b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2,
1291 save_regs_phy[1]); 1282 save_regs_phy[3]);
1292 b43_phy_write(dev, B43_NPHY_AFECTL_C1, save_regs_phy[2]);
1293 b43_phy_write(dev, B43_NPHY_AFECTL_C2, save_regs_phy[3]);
1294 b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, save_regs_phy[4]); 1283 b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, save_regs_phy[4]);
1295 b43_phy_write(dev, B43_NPHY_AFECTL_OVER, save_regs_phy[5]); 1284 b43_phy_write(dev, B43_NPHY_AFECTL_OVER, save_regs_phy[5]);
1296 b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S0, save_regs_phy[6]); 1285 b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S0, save_regs_phy[6]);
@@ -1308,6 +1297,186 @@ static int b43_nphy_poll_rssi(struct b43_wldev *dev, u8 type, s32 *buf,
1308 return out; 1297 return out;
1309} 1298}
1310 1299
1300/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */
1301static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
1302{
1303 struct b43_phy_n *nphy = dev->phy.n;
1304
1305 u16 saved_regs_phy_rfctl[2];
1306 u16 saved_regs_phy[13];
1307 u16 regs_to_store[] = {
1308 B43_NPHY_AFECTL_OVER1, B43_NPHY_AFECTL_OVER,
1309 B43_NPHY_AFECTL_C1, B43_NPHY_AFECTL_C2,
1310 B43_NPHY_TXF_40CO_B1S1, B43_NPHY_RFCTL_OVER,
1311 B43_NPHY_TXF_40CO_B1S0, B43_NPHY_TXF_40CO_B32S1,
1312 B43_NPHY_RFCTL_CMD,
1313 B43_NPHY_RFCTL_LUT_TRSW_UP1, B43_NPHY_RFCTL_LUT_TRSW_UP2,
1314 B43_NPHY_RFCTL_RSSIO1, B43_NPHY_RFCTL_RSSIO2
1315 };
1316
1317 u16 class;
1318
1319 u16 clip_state[2];
1320 u16 clip_off[2] = { 0xFFFF, 0xFFFF };
1321
1322 u8 vcm_final = 0;
1323 s8 offset[4];
1324 s32 results[8][4] = { };
1325 s32 results_min[4] = { };
1326 s32 poll_results[4] = { };
1327
1328 u16 *rssical_radio_regs = NULL;
1329 u16 *rssical_phy_regs = NULL;
1330
1331 u16 r; /* routing */
1332 u8 rx_core_state;
1333 u8 core, i, j;
1334
1335 class = b43_nphy_classifier(dev, 0, 0);
1336 b43_nphy_classifier(dev, 7, 4);
1337 b43_nphy_read_clip_detection(dev, clip_state);
1338 b43_nphy_write_clip_detection(dev, clip_off);
1339
1340 saved_regs_phy_rfctl[0] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
1341 saved_regs_phy_rfctl[1] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
1342 for (i = 0; i < ARRAY_SIZE(regs_to_store); i++)
1343 saved_regs_phy[i] = b43_phy_read(dev, regs_to_store[i]);
1344
1345 b43_nphy_rf_control_intc_override(dev, 0, 0, 7);
1346 b43_nphy_rf_control_intc_override(dev, 1, 1, 7);
1347 b43_nphy_rf_control_override(dev, 0x1, 0, 0, false);
1348 b43_nphy_rf_control_override(dev, 0x2, 1, 0, false);
1349 b43_nphy_rf_control_override(dev, 0x80, 1, 0, false);
1350 b43_nphy_rf_control_override(dev, 0x40, 1, 0, false);
1351
1352 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
1353 b43_nphy_rf_control_override(dev, 0x20, 0, 0, false);
1354 b43_nphy_rf_control_override(dev, 0x10, 1, 0, false);
1355 } else {
1356 b43_nphy_rf_control_override(dev, 0x10, 0, 0, false);
1357 b43_nphy_rf_control_override(dev, 0x20, 1, 0, false);
1358 }
1359
1360 rx_core_state = b43_nphy_get_rx_core_state(dev);
1361 for (core = 0; core < 2; core++) {
1362 if (!(rx_core_state & (1 << core)))
1363 continue;
1364 r = core ? B2056_RX1 : B2056_RX0;
1365 b43_nphy_scale_offset_rssi(dev, 0, 0, core + 1, 0, 2);
1366 b43_nphy_scale_offset_rssi(dev, 0, 0, core + 1, 1, 2);
1367 for (i = 0; i < 8; i++) {
1368 b43_radio_maskset(dev, r | B2056_RX_RSSI_MISC, 0xE3,
1369 i << 2);
1370 b43_nphy_poll_rssi(dev, 2, results[i], 8);
1371 }
1372 for (i = 0; i < 4; i++) {
1373 s32 curr;
1374 s32 mind = 40;
1375 s32 minpoll = 249;
1376 u8 minvcm = 0;
1377 if (2 * core != i)
1378 continue;
1379 for (j = 0; j < 8; j++) {
1380 curr = results[j][i] * results[j][i] +
1381 results[j][i + 1] * results[j][i];
1382 if (curr < mind) {
1383 mind = curr;
1384 minvcm = j;
1385 }
1386 if (results[j][i] < minpoll)
1387 minpoll = results[j][i];
1388 }
1389 vcm_final = minvcm;
1390 results_min[i] = minpoll;
1391 }
1392 b43_radio_maskset(dev, r | B2056_RX_RSSI_MISC, 0xE3,
1393 vcm_final << 2);
1394 for (i = 0; i < 4; i++) {
1395 if (core != i / 2)
1396 continue;
1397 offset[i] = -results[vcm_final][i];
1398 if (offset[i] < 0)
1399 offset[i] = -((abs(offset[i]) + 4) / 8);
1400 else
1401 offset[i] = (offset[i] + 4) / 8;
1402 if (results_min[i] == 248)
1403 offset[i] = -32;
1404 b43_nphy_scale_offset_rssi(dev, 0, offset[i],
1405 (i / 2 == 0) ? 1 : 2,
1406 (i % 2 == 0) ? 0 : 1,
1407 2);
1408 }
1409 }
1410 for (core = 0; core < 2; core++) {
1411 if (!(rx_core_state & (1 << core)))
1412 continue;
1413 for (i = 0; i < 2; i++) {
1414 b43_nphy_scale_offset_rssi(dev, 0, 0, core + 1, 0, i);
1415 b43_nphy_scale_offset_rssi(dev, 0, 0, core + 1, 1, i);
1416 b43_nphy_poll_rssi(dev, i, poll_results, 8);
1417 for (j = 0; j < 4; j++) {
1418 if (j / 2 == core)
1419 offset[j] = 232 - poll_results[j];
1420 if (offset[j] < 0)
1421 offset[j] = -(abs(offset[j] + 4) / 8);
1422 else
1423 offset[j] = (offset[j] + 4) / 8;
1424 b43_nphy_scale_offset_rssi(dev, 0,
1425 offset[2 * core], core + 1, j % 2, i);
1426 }
1427 }
1428 }
1429
1430 b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, saved_regs_phy_rfctl[0]);
1431 b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, saved_regs_phy_rfctl[1]);
1432
1433 b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
1434
1435 b43_phy_set(dev, B43_NPHY_TXF_40CO_B1S1, 0x1);
1436 b43_phy_set(dev, B43_NPHY_RFCTL_CMD, B43_NPHY_RFCTL_CMD_START);
1437 b43_phy_mask(dev, B43_NPHY_TXF_40CO_B1S1, ~0x1);
1438
1439 b43_phy_set(dev, B43_NPHY_RFCTL_OVER, 0x1);
1440 b43_phy_set(dev, B43_NPHY_RFCTL_CMD, B43_NPHY_RFCTL_CMD_RXTX);
1441 b43_phy_mask(dev, B43_NPHY_TXF_40CO_B1S1, ~0x1);
1442
1443 for (i = 0; i < ARRAY_SIZE(regs_to_store); i++)
1444 b43_phy_write(dev, regs_to_store[i], saved_regs_phy[i]);
1445
1446 /* Store for future configuration */
1447 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
1448 rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G;
1449 rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G;
1450 } else {
1451 rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G;
1452 rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G;
1453 }
1454 rssical_radio_regs[0] = b43_radio_read(dev, 0x602B);
1455 rssical_radio_regs[0] = b43_radio_read(dev, 0x702B);
1456 rssical_phy_regs[0] = b43_phy_read(dev, B43_NPHY_RSSIMC_0I_RSSI_Z);
1457 rssical_phy_regs[1] = b43_phy_read(dev, B43_NPHY_RSSIMC_0Q_RSSI_Z);
1458 rssical_phy_regs[2] = b43_phy_read(dev, B43_NPHY_RSSIMC_1I_RSSI_Z);
1459 rssical_phy_regs[3] = b43_phy_read(dev, B43_NPHY_RSSIMC_1Q_RSSI_Z);
1460 rssical_phy_regs[4] = b43_phy_read(dev, B43_NPHY_RSSIMC_0I_RSSI_X);
1461 rssical_phy_regs[5] = b43_phy_read(dev, B43_NPHY_RSSIMC_0Q_RSSI_X);
1462 rssical_phy_regs[6] = b43_phy_read(dev, B43_NPHY_RSSIMC_1I_RSSI_X);
1463 rssical_phy_regs[7] = b43_phy_read(dev, B43_NPHY_RSSIMC_1Q_RSSI_X);
1464 rssical_phy_regs[8] = b43_phy_read(dev, B43_NPHY_RSSIMC_0I_RSSI_Y);
1465 rssical_phy_regs[9] = b43_phy_read(dev, B43_NPHY_RSSIMC_0Q_RSSI_Y);
1466 rssical_phy_regs[10] = b43_phy_read(dev, B43_NPHY_RSSIMC_1I_RSSI_Y);
1467 rssical_phy_regs[11] = b43_phy_read(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y);
1468
1469 /* Remember for which channel we store configuration */
1470 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
1471 nphy->rssical_chanspec_2G.center_freq = dev->phy.channel_freq;
1472 else
1473 nphy->rssical_chanspec_5G.center_freq = dev->phy.channel_freq;
1474
1475 /* End of calibration, restore configuration */
1476 b43_nphy_classifier(dev, 7, class);
1477 b43_nphy_write_clip_detection(dev, clip_state);
1478}
1479
1311/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal */ 1480/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal */
1312static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type) 1481static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1313{ 1482{
@@ -1472,12 +1641,6 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1472 b43_nphy_reset_cca(dev); 1641 b43_nphy_reset_cca(dev);
1473} 1642}
1474 1643
1475/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */
1476static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
1477{
1478 /* TODO */
1479}
1480
1481/* 1644/*
1482 * RSSI Calibration 1645 * RSSI Calibration
1483 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal 1646 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal
@@ -2229,27 +2392,12 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
2229 */ 2392 */
2230 2393
2231 for (i = 0; i < 2; i++) { 2394 for (i = 0; i < 2; i++) {
2232 if (dev->phy.rev >= 3) { 2395 txgain = *(b43_nphy_get_tx_gain_table(dev) + txpi[i]);
2233 if (b43_nphy_ipa(dev)) { 2396
2234 txgain = *(b43_nphy_get_ipa_gain_table(dev) + 2397 if (dev->phy.rev >= 3)
2235 txpi[i]);
2236 } else if (b43_current_band(dev->wl) ==
2237 IEEE80211_BAND_5GHZ) {
2238 /* FIXME: use 5GHz tables */
2239 txgain =
2240 b43_ntab_tx_gain_rev3plus_2ghz[txpi[i]];
2241 } else {
2242 if (dev->phy.rev >= 5 &&
2243 sprom->fem.ghz5.extpa_gain == 3)
2244 ; /* FIXME: 5GHz_txgain_HiPwrEPA */
2245 txgain =
2246 b43_ntab_tx_gain_rev3plus_2ghz[txpi[i]];
2247 }
2248 radio_gain = (txgain >> 16) & 0x1FFFF; 2398 radio_gain = (txgain >> 16) & 0x1FFFF;
2249 } else { 2399 else
2250 txgain = b43_ntab_tx_gain_rev0_1_2[txpi[i]];
2251 radio_gain = (txgain >> 16) & 0x1FFF; 2400 radio_gain = (txgain >> 16) & 0x1FFF;
2252 }
2253 2401
2254 if (dev->phy.rev >= 7) 2402 if (dev->phy.rev >= 7)
2255 dac_gain = (txgain >> 8) & 0x7; 2403 dac_gain = (txgain >> 8) & 0x7;
@@ -2420,55 +2568,252 @@ static void b43_nphy_tx_power_ctl_idle_tssi(struct b43_wldev *dev)
2420 nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF; 2568 nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF;
2421} 2569}
2422 2570
2423static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev) 2571/* http://bcm-v4.sipsolutions.net/PHY/N/TxPwrLimitToTbl */
2572static void b43_nphy_tx_prepare_adjusted_power_table(struct b43_wldev *dev)
2424{ 2573{
2425 struct b43_phy *phy = &dev->phy; 2574 struct b43_phy_n *nphy = dev->phy.n;
2426 2575
2427 const u32 *table = NULL; 2576 u8 idx, delta;
2428#if 0 2577 u8 i, stf_mode;
2429 TODO: b43_ntab_papd_pga_gain_delta_ipa_2*
2430 u32 rfpwr_offset;
2431 u8 pga_gain;
2432 int i;
2433#endif
2434 2578
2435 if (phy->rev >= 3) { 2579 for (i = 0; i < 4; i++)
2436 if (b43_nphy_ipa(dev)) { 2580 nphy->adj_pwr_tbl[i] = nphy->tx_power_offset[i];
2437 table = b43_nphy_get_ipa_gain_table(dev); 2581
2582 for (stf_mode = 0; stf_mode < 4; stf_mode++) {
2583 delta = 0;
2584 switch (stf_mode) {
2585 case 0:
2586 if (dev->phy.is_40mhz && dev->phy.rev >= 5) {
2587 idx = 68;
2588 } else {
2589 delta = 1;
2590 idx = dev->phy.is_40mhz ? 52 : 4;
2591 }
2592 break;
2593 case 1:
2594 idx = dev->phy.is_40mhz ? 76 : 28;
2595 break;
2596 case 2:
2597 idx = dev->phy.is_40mhz ? 84 : 36;
2598 break;
2599 case 3:
2600 idx = dev->phy.is_40mhz ? 92 : 44;
2601 break;
2602 }
2603
2604 for (i = 0; i < 20; i++) {
2605 nphy->adj_pwr_tbl[4 + 4 * i + stf_mode] =
2606 nphy->tx_power_offset[idx];
2607 if (i == 0)
2608 idx += delta;
2609 if (i == 14)
2610 idx += 1 - delta;
2611 if (i == 3 || i == 4 || i == 7 || i == 8 || i == 11 ||
2612 i == 13)
2613 idx += 1;
2614 }
2615 }
2616}
2617
2618/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlSetup */
2619static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev)
2620{
2621 struct b43_phy_n *nphy = dev->phy.n;
2622 struct ssb_sprom *sprom = dev->dev->bus_sprom;
2623
2624 s16 a1[2], b0[2], b1[2];
2625 u8 idle[2];
2626 s8 target[2];
2627 s32 num, den, pwr;
2628 u32 regval[64];
2629
2630 u16 freq = dev->phy.channel_freq;
2631 u16 tmp;
2632 u16 r; /* routing */
2633 u8 i, c;
2634
2635 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) {
2636 b43_maskset32(dev, B43_MMIO_MACCTL, ~0, 0x200000);
2637 b43_read32(dev, B43_MMIO_MACCTL);
2638 udelay(1);
2639 }
2640
2641 if (nphy->hang_avoid)
2642 b43_nphy_stay_in_carrier_search(dev, true);
2643
2644 b43_phy_set(dev, B43_NPHY_TSSIMODE, B43_NPHY_TSSIMODE_EN);
2645 if (dev->phy.rev >= 3)
2646 b43_phy_mask(dev, B43_NPHY_TXPCTL_CMD,
2647 ~B43_NPHY_TXPCTL_CMD_PCTLEN & 0xFFFF);
2648 else
2649 b43_phy_set(dev, B43_NPHY_TXPCTL_CMD,
2650 B43_NPHY_TXPCTL_CMD_PCTLEN);
2651
2652 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12)
2653 b43_maskset32(dev, B43_MMIO_MACCTL, ~0x200000, 0);
2654
2655 if (sprom->revision < 4) {
2656 idle[0] = nphy->pwr_ctl_info[0].idle_tssi_2g;
2657 idle[1] = nphy->pwr_ctl_info[1].idle_tssi_2g;
2658 target[0] = target[1] = 52;
2659 a1[0] = a1[1] = -424;
2660 b0[0] = b0[1] = 5612;
2661 b1[0] = b1[1] = -1393;
2662 } else {
2663 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
2664 for (c = 0; c < 2; c++) {
2665 idle[c] = nphy->pwr_ctl_info[c].idle_tssi_2g;
2666 target[c] = sprom->core_pwr_info[c].maxpwr_2g;
2667 a1[c] = sprom->core_pwr_info[c].pa_2g[0];
2668 b0[c] = sprom->core_pwr_info[c].pa_2g[1];
2669 b1[c] = sprom->core_pwr_info[c].pa_2g[2];
2670 }
2671 } else if (freq >= 4900 && freq < 5100) {
2672 for (c = 0; c < 2; c++) {
2673 idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g;
2674 target[c] = sprom->core_pwr_info[c].maxpwr_5gl;
2675 a1[c] = sprom->core_pwr_info[c].pa_5gl[0];
2676 b0[c] = sprom->core_pwr_info[c].pa_5gl[1];
2677 b1[c] = sprom->core_pwr_info[c].pa_5gl[2];
2678 }
2679 } else if (freq >= 5100 && freq < 5500) {
2680 for (c = 0; c < 2; c++) {
2681 idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g;
2682 target[c] = sprom->core_pwr_info[c].maxpwr_5g;
2683 a1[c] = sprom->core_pwr_info[c].pa_5g[0];
2684 b0[c] = sprom->core_pwr_info[c].pa_5g[1];
2685 b1[c] = sprom->core_pwr_info[c].pa_5g[2];
2686 }
2687 } else if (freq >= 5500) {
2688 for (c = 0; c < 2; c++) {
2689 idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g;
2690 target[c] = sprom->core_pwr_info[c].maxpwr_5gh;
2691 a1[c] = sprom->core_pwr_info[c].pa_5gh[0];
2692 b0[c] = sprom->core_pwr_info[c].pa_5gh[1];
2693 b1[c] = sprom->core_pwr_info[c].pa_5gh[2];
2694 }
2438 } else { 2695 } else {
2439 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { 2696 idle[0] = nphy->pwr_ctl_info[0].idle_tssi_5g;
2440 if (phy->rev == 3) 2697 idle[1] = nphy->pwr_ctl_info[1].idle_tssi_5g;
2441 table = b43_ntab_tx_gain_rev3_5ghz; 2698 target[0] = target[1] = 52;
2442 if (phy->rev == 4) 2699 a1[0] = a1[1] = -424;
2443 table = b43_ntab_tx_gain_rev4_5ghz; 2700 b0[0] = b0[1] = 5612;
2444 else 2701 b1[0] = b1[1] = -1393;
2445 table = b43_ntab_tx_gain_rev5plus_5ghz; 2702 }
2703 }
2704 /* target[0] = target[1] = nphy->tx_power_max; */
2705
2706 if (dev->phy.rev >= 3) {
2707 if (sprom->fem.ghz2.tssipos)
2708 b43_phy_set(dev, B43_NPHY_TXPCTL_ITSSI, 0x4000);
2709 if (dev->phy.rev >= 7) {
2710 for (c = 0; c < 2; c++) {
2711 r = c ? 0x190 : 0x170;
2712 if (b43_nphy_ipa(dev))
2713 b43_radio_write(dev, r + 0x9, (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) ? 0xE : 0xC);
2714 }
2715 } else {
2716 if (b43_nphy_ipa(dev)) {
2717 tmp = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? 0xC : 0xE;
2718 b43_radio_write(dev,
2719 B2056_TX0 | B2056_TX_TX_SSI_MUX, tmp);
2720 b43_radio_write(dev,
2721 B2056_TX1 | B2056_TX_TX_SSI_MUX, tmp);
2446 } else { 2722 } else {
2447 table = b43_ntab_tx_gain_rev3plus_2ghz; 2723 b43_radio_write(dev,
2724 B2056_TX0 | B2056_TX_TX_SSI_MUX, 0x11);
2725 b43_radio_write(dev,
2726 B2056_TX1 | B2056_TX_TX_SSI_MUX, 0x11);
2448 } 2727 }
2449 } 2728 }
2729 }
2730
2731 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) {
2732 b43_maskset32(dev, B43_MMIO_MACCTL, ~0, 0x200000);
2733 b43_read32(dev, B43_MMIO_MACCTL);
2734 udelay(1);
2735 }
2736
2737 if (dev->phy.rev >= 7) {
2738 b43_phy_maskset(dev, B43_NPHY_TXPCTL_CMD,
2739 ~B43_NPHY_TXPCTL_CMD_INIT, 0x19);
2740 b43_phy_maskset(dev, B43_NPHY_TXPCTL_INIT,
2741 ~B43_NPHY_TXPCTL_INIT_PIDXI1, 0x19);
2450 } else { 2742 } else {
2451 table = b43_ntab_tx_gain_rev0_1_2; 2743 b43_phy_maskset(dev, B43_NPHY_TXPCTL_CMD,
2744 ~B43_NPHY_TXPCTL_CMD_INIT, 0x40);
2745 if (dev->phy.rev > 1)
2746 b43_phy_maskset(dev, B43_NPHY_TXPCTL_INIT,
2747 ~B43_NPHY_TXPCTL_INIT_PIDXI1, 0x40);
2748 }
2749
2750 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12)
2751 b43_maskset32(dev, B43_MMIO_MACCTL, ~0x200000, 0);
2752
2753 b43_phy_write(dev, B43_NPHY_TXPCTL_N,
2754 0xF0 << B43_NPHY_TXPCTL_N_TSSID_SHIFT |
2755 3 << B43_NPHY_TXPCTL_N_NPTIL2_SHIFT);
2756 b43_phy_write(dev, B43_NPHY_TXPCTL_ITSSI,
2757 idle[0] << B43_NPHY_TXPCTL_ITSSI_0_SHIFT |
2758 idle[1] << B43_NPHY_TXPCTL_ITSSI_1_SHIFT |
2759 B43_NPHY_TXPCTL_ITSSI_BINF);
2760 b43_phy_write(dev, B43_NPHY_TXPCTL_TPWR,
2761 target[0] << B43_NPHY_TXPCTL_TPWR_0_SHIFT |
2762 target[1] << B43_NPHY_TXPCTL_TPWR_1_SHIFT);
2763
2764 for (c = 0; c < 2; c++) {
2765 for (i = 0; i < 64; i++) {
2766 num = 8 * (16 * b0[c] + b1[c] * i);
2767 den = 32768 + a1[c] * i;
2768 pwr = max((4 * num + den / 2) / den, -8);
2769 if (dev->phy.rev < 3 && (i <= (31 - idle[c] + 1)))
2770 pwr = max(pwr, target[c] + 1);
2771 regval[i] = pwr;
2772 }
2773 b43_ntab_write_bulk(dev, B43_NTAB32(26 + c, 0), 64, regval);
2452 } 2774 }
2775
2776 b43_nphy_tx_prepare_adjusted_power_table(dev);
2777 /*
2778 b43_ntab_write_bulk(dev, B43_NTAB16(26, 64), 84, nphy->adj_pwr_tbl);
2779 b43_ntab_write_bulk(dev, B43_NTAB16(27, 64), 84, nphy->adj_pwr_tbl);
2780 */
2781
2782 if (nphy->hang_avoid)
2783 b43_nphy_stay_in_carrier_search(dev, false);
2784}
2785
2786static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev)
2787{
2788 struct b43_phy *phy = &dev->phy;
2789
2790 const u32 *table = NULL;
2791 u32 rfpwr_offset;
2792 u8 pga_gain;
2793 int i;
2794
2795 table = b43_nphy_get_tx_gain_table(dev);
2453 b43_ntab_write_bulk(dev, B43_NTAB32(26, 192), 128, table); 2796 b43_ntab_write_bulk(dev, B43_NTAB32(26, 192), 128, table);
2454 b43_ntab_write_bulk(dev, B43_NTAB32(27, 192), 128, table); 2797 b43_ntab_write_bulk(dev, B43_NTAB32(27, 192), 128, table);
2455 2798
2456 if (phy->rev >= 3) { 2799 if (phy->rev >= 3) {
2457#if 0 2800#if 0
2458 nphy->gmval = (table[0] >> 16) & 0x7000; 2801 nphy->gmval = (table[0] >> 16) & 0x7000;
2802#endif
2459 2803
2460 for (i = 0; i < 128; i++) { 2804 for (i = 0; i < 128; i++) {
2461 pga_gain = (table[i] >> 24) & 0xF; 2805 pga_gain = (table[i] >> 24) & 0xF;
2462 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) 2806 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
2463 rfpwr_offset = b43_ntab_papd_pga_gain_delta_ipa_2g[pga_gain]; 2807 rfpwr_offset =
2808 b43_ntab_papd_pga_gain_delta_ipa_2g[pga_gain];
2464 else 2809 else
2465 rfpwr_offset = b43_ntab_papd_pga_gain_delta_ipa_5g[pga_gain]; 2810 rfpwr_offset =
2811 0; /* FIXME */
2466 b43_ntab_write(dev, B43_NTAB32(26, 576 + i), 2812 b43_ntab_write(dev, B43_NTAB32(26, 576 + i),
2467 rfpwr_offset); 2813 rfpwr_offset);
2468 b43_ntab_write(dev, B43_NTAB32(27, 576 + i), 2814 b43_ntab_write(dev, B43_NTAB32(27, 576 + i),
2469 rfpwr_offset); 2815 rfpwr_offset);
2470 } 2816 }
2471#endif
2472 } 2817 }
2473} 2818}
2474 2819
@@ -3139,32 +3484,13 @@ static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
3139 B43_NPHY_TXPCTL_STAT_BIDX_SHIFT; 3484 B43_NPHY_TXPCTL_STAT_BIDX_SHIFT;
3140 3485
3141 for (i = 0; i < 2; ++i) { 3486 for (i = 0; i < 2; ++i) {
3487 table = b43_nphy_get_tx_gain_table(dev);
3142 if (dev->phy.rev >= 3) { 3488 if (dev->phy.rev >= 3) {
3143 enum ieee80211_band band =
3144 b43_current_band(dev->wl);
3145
3146 if (b43_nphy_ipa(dev)) {
3147 table = b43_nphy_get_ipa_gain_table(dev);
3148 } else {
3149 if (band == IEEE80211_BAND_5GHZ) {
3150 if (dev->phy.rev == 3)
3151 table = b43_ntab_tx_gain_rev3_5ghz;
3152 else if (dev->phy.rev == 4)
3153 table = b43_ntab_tx_gain_rev4_5ghz;
3154 else
3155 table = b43_ntab_tx_gain_rev5plus_5ghz;
3156 } else {
3157 table = b43_ntab_tx_gain_rev3plus_2ghz;
3158 }
3159 }
3160
3161 target.ipa[i] = (table[index[i]] >> 16) & 0xF; 3489 target.ipa[i] = (table[index[i]] >> 16) & 0xF;
3162 target.pad[i] = (table[index[i]] >> 20) & 0xF; 3490 target.pad[i] = (table[index[i]] >> 20) & 0xF;
3163 target.pga[i] = (table[index[i]] >> 24) & 0xF; 3491 target.pga[i] = (table[index[i]] >> 24) & 0xF;
3164 target.txgm[i] = (table[index[i]] >> 28) & 0xF; 3492 target.txgm[i] = (table[index[i]] >> 28) & 0xF;
3165 } else { 3493 } else {
3166 table = b43_ntab_tx_gain_rev0_1_2;
3167
3168 target.ipa[i] = (table[index[i]] >> 16) & 0x3; 3494 target.ipa[i] = (table[index[i]] >> 16) & 0x3;
3169 target.pad[i] = (table[index[i]] >> 18) & 0x3; 3495 target.pad[i] = (table[index[i]] >> 18) & 0x3;
3170 target.pga[i] = (table[index[i]] >> 20) & 0x7; 3496 target.pga[i] = (table[index[i]] >> 20) & 0x7;
@@ -3968,13 +4294,10 @@ static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init)
3968#endif 4294#endif
3969 } 4295 }
3970 4296
3971 b43_write32(dev, B43_MMIO_MACCTL, 4297 b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0);
3972 b43_read32(dev, B43_MMIO_MACCTL) & 4298 b43_maskset16(dev, B43_MMIO_GPIO_MASK, ~0, 0xFC00);
3973 ~B43_MACCTL_GPOUTSMSK); 4299 b43_maskset16(dev, B43_MMIO_GPIO_CONTROL, (~0xFC00 & 0xFFFF),
3974 b43_write16(dev, B43_MMIO_GPIO_MASK, 4300 0);
3975 b43_read16(dev, B43_MMIO_GPIO_MASK) | 0xFC00);
3976 b43_write16(dev, B43_MMIO_GPIO_CONTROL,
3977 b43_read16(dev, B43_MMIO_GPIO_CONTROL) & ~0xFC00);
3978 4301
3979 if (init) { 4302 if (init) {
3980 b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8); 4303 b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8);
@@ -4110,7 +4433,7 @@ int b43_phy_initn(struct b43_wldev *dev)
4110 b43_nphy_tx_power_ctrl(dev, false); 4433 b43_nphy_tx_power_ctrl(dev, false);
4111 b43_nphy_tx_power_fix(dev); 4434 b43_nphy_tx_power_fix(dev);
4112 b43_nphy_tx_power_ctl_idle_tssi(dev); 4435 b43_nphy_tx_power_ctl_idle_tssi(dev);
4113 /* TODO N PHY TX Power Control Setup */ 4436 b43_nphy_tx_power_ctl_setup(dev);
4114 b43_nphy_tx_gain_table_upload(dev); 4437 b43_nphy_tx_gain_table_upload(dev);
4115 4438
4116 if (nphy->phyrxchain != 3) 4439 if (nphy->phyrxchain != 3)
@@ -4530,8 +4853,7 @@ static void b43_nphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
4530{ 4853{
4531 check_phyreg(dev, reg); 4854 check_phyreg(dev, reg);
4532 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); 4855 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg);
4533 b43_write16(dev, B43_MMIO_PHY_DATA, 4856 b43_maskset16(dev, B43_MMIO_PHY_DATA, mask, set);
4534 (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set);
4535} 4857}
4536 4858
4537static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg) 4859static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg)
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 5de8f74cc02f..fd12b386fea1 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -798,6 +798,7 @@ struct b43_phy_n {
798 bool txpwrctrl; 798 bool txpwrctrl;
799 bool pwg_gain_5ghz; 799 bool pwg_gain_5ghz;
800 u8 tx_pwr_idx[2]; 800 u8 tx_pwr_idx[2];
801 s8 tx_power_offset[101];
801 u16 adj_pwr_tbl[84]; 802 u16 adj_pwr_tbl[84];
802 u16 txcal_bbmult; 803 u16 txcal_bbmult;
803 u16 txiqlocal_bestc[11]; 804 u16 txiqlocal_bestc[11];
diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index f7def13524dd..f0d8377429c6 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -2214,7 +2214,7 @@ static const u16 b43_ntab_antswctl2g_r3[4][32] = {
2214}; 2214};
2215 2215
2216/* TX gain tables */ 2216/* TX gain tables */
2217const u32 b43_ntab_tx_gain_rev0_1_2[] = { 2217static const u32 b43_ntab_tx_gain_rev0_1_2[] = {
2218 0x03cc2b44, 0x03cc2b42, 0x03cc2a44, 0x03cc2a42, 2218 0x03cc2b44, 0x03cc2b42, 0x03cc2a44, 0x03cc2a42,
2219 0x03cc2944, 0x03c82b44, 0x03c82b42, 0x03c82a44, 2219 0x03cc2944, 0x03c82b44, 0x03c82b42, 0x03c82a44,
2220 0x03c82a42, 0x03c82944, 0x03c82942, 0x03c82844, 2220 0x03c82a42, 0x03c82944, 0x03c82942, 0x03c82844,
@@ -2249,7 +2249,7 @@ const u32 b43_ntab_tx_gain_rev0_1_2[] = {
2249 0x03801442, 0x03801344, 0x03801342, 0x00002b00, 2249 0x03801442, 0x03801344, 0x03801342, 0x00002b00,
2250}; 2250};
2251 2251
2252const u32 b43_ntab_tx_gain_rev3plus_2ghz[] = { 2252static const u32 b43_ntab_tx_gain_rev3plus_2ghz[] = {
2253 0x1f410044, 0x1f410042, 0x1f410040, 0x1f41003e, 2253 0x1f410044, 0x1f410042, 0x1f410040, 0x1f41003e,
2254 0x1f41003c, 0x1f41003b, 0x1f410039, 0x1f410037, 2254 0x1f41003c, 0x1f41003b, 0x1f410039, 0x1f410037,
2255 0x1e410044, 0x1e410042, 0x1e410040, 0x1e41003e, 2255 0x1e410044, 0x1e410042, 0x1e410040, 0x1e41003e,
@@ -2284,7 +2284,7 @@ const u32 b43_ntab_tx_gain_rev3plus_2ghz[] = {
2284 0x1041003c, 0x1041003b, 0x10410039, 0x10410037, 2284 0x1041003c, 0x1041003b, 0x10410039, 0x10410037,
2285}; 2285};
2286 2286
2287const u32 b43_ntab_tx_gain_rev3_5ghz[] = { 2287static const u32 b43_ntab_tx_gain_rev3_5ghz[] = {
2288 0xcff70044, 0xcff70042, 0xcff70040, 0xcff7003e, 2288 0xcff70044, 0xcff70042, 0xcff70040, 0xcff7003e,
2289 0xcff7003c, 0xcff7003b, 0xcff70039, 0xcff70037, 2289 0xcff7003c, 0xcff7003b, 0xcff70039, 0xcff70037,
2290 0xcef70044, 0xcef70042, 0xcef70040, 0xcef7003e, 2290 0xcef70044, 0xcef70042, 0xcef70040, 0xcef7003e,
@@ -2319,7 +2319,7 @@ const u32 b43_ntab_tx_gain_rev3_5ghz[] = {
2319 0xc0f7003c, 0xc0f7003b, 0xc0f70039, 0xc0f70037, 2319 0xc0f7003c, 0xc0f7003b, 0xc0f70039, 0xc0f70037,
2320}; 2320};
2321 2321
2322const u32 b43_ntab_tx_gain_rev4_5ghz[] = { 2322static const u32 b43_ntab_tx_gain_rev4_5ghz[] = {
2323 0x2ff20044, 0x2ff20042, 0x2ff20040, 0x2ff2003e, 2323 0x2ff20044, 0x2ff20042, 0x2ff20040, 0x2ff2003e,
2324 0x2ff2003c, 0x2ff2003b, 0x2ff20039, 0x2ff20037, 2324 0x2ff2003c, 0x2ff2003b, 0x2ff20039, 0x2ff20037,
2325 0x2ef20044, 0x2ef20042, 0x2ef20040, 0x2ef2003e, 2325 0x2ef20044, 0x2ef20042, 0x2ef20040, 0x2ef2003e,
@@ -2354,7 +2354,7 @@ const u32 b43_ntab_tx_gain_rev4_5ghz[] = {
2354 0x20d2003a, 0x20d20038, 0x20d20036, 0x20d20034, 2354 0x20d2003a, 0x20d20038, 0x20d20036, 0x20d20034,
2355}; 2355};
2356 2356
2357const u32 b43_ntab_tx_gain_rev5plus_5ghz[] = { 2357static const u32 b43_ntab_tx_gain_rev5plus_5ghz[] = {
2358 0x0f62004a, 0x0f620048, 0x0f620046, 0x0f620044, 2358 0x0f62004a, 0x0f620048, 0x0f620046, 0x0f620044,
2359 0x0f620042, 0x0f620040, 0x0f62003e, 0x0f62003c, 2359 0x0f620042, 0x0f620040, 0x0f62003e, 0x0f62003c,
2360 0x0e620044, 0x0e620042, 0x0e620040, 0x0e62003e, 2360 0x0e620044, 0x0e620042, 0x0e620040, 0x0e62003e,
@@ -2389,7 +2389,7 @@ const u32 b43_ntab_tx_gain_rev5plus_5ghz[] = {
2389 0x0062003b, 0x00620039, 0x00620037, 0x00620035, 2389 0x0062003b, 0x00620039, 0x00620037, 0x00620035,
2390}; 2390};
2391 2391
2392const u32 txpwrctrl_tx_gain_ipa[] = { 2392static const u32 txpwrctrl_tx_gain_ipa[] = {
2393 0x5ff7002d, 0x5ff7002b, 0x5ff7002a, 0x5ff70029, 2393 0x5ff7002d, 0x5ff7002b, 0x5ff7002a, 0x5ff70029,
2394 0x5ff70028, 0x5ff70027, 0x5ff70026, 0x5ff70025, 2394 0x5ff70028, 0x5ff70027, 0x5ff70026, 0x5ff70025,
2395 0x5ef7002d, 0x5ef7002b, 0x5ef7002a, 0x5ef70029, 2395 0x5ef7002d, 0x5ef7002b, 0x5ef7002a, 0x5ef70029,
@@ -2424,7 +2424,7 @@ const u32 txpwrctrl_tx_gain_ipa[] = {
2424 0x50f70028, 0x50f70027, 0x50f70026, 0x50f70025, 2424 0x50f70028, 0x50f70027, 0x50f70026, 0x50f70025,
2425}; 2425};
2426 2426
2427const u32 txpwrctrl_tx_gain_ipa_rev5[] = { 2427static const u32 txpwrctrl_tx_gain_ipa_rev5[] = {
2428 0x1ff7002d, 0x1ff7002b, 0x1ff7002a, 0x1ff70029, 2428 0x1ff7002d, 0x1ff7002b, 0x1ff7002a, 0x1ff70029,
2429 0x1ff70028, 0x1ff70027, 0x1ff70026, 0x1ff70025, 2429 0x1ff70028, 0x1ff70027, 0x1ff70026, 0x1ff70025,
2430 0x1ef7002d, 0x1ef7002b, 0x1ef7002a, 0x1ef70029, 2430 0x1ef7002d, 0x1ef7002b, 0x1ef7002a, 0x1ef70029,
@@ -2459,7 +2459,7 @@ const u32 txpwrctrl_tx_gain_ipa_rev5[] = {
2459 0x10f70028, 0x10f70027, 0x10f70026, 0x10f70025, 2459 0x10f70028, 0x10f70027, 0x10f70026, 0x10f70025,
2460}; 2460};
2461 2461
2462const u32 txpwrctrl_tx_gain_ipa_rev6[] = { 2462static const u32 txpwrctrl_tx_gain_ipa_rev6[] = {
2463 0x0ff7002d, 0x0ff7002b, 0x0ff7002a, 0x0ff70029, 2463 0x0ff7002d, 0x0ff7002b, 0x0ff7002a, 0x0ff70029,
2464 0x0ff70028, 0x0ff70027, 0x0ff70026, 0x0ff70025, 2464 0x0ff70028, 0x0ff70027, 0x0ff70026, 0x0ff70025,
2465 0x0ef7002d, 0x0ef7002b, 0x0ef7002a, 0x0ef70029, 2465 0x0ef7002d, 0x0ef7002b, 0x0ef7002a, 0x0ef70029,
@@ -2494,7 +2494,7 @@ const u32 txpwrctrl_tx_gain_ipa_rev6[] = {
2494 0x00f70028, 0x00f70027, 0x00f70026, 0x00f70025, 2494 0x00f70028, 0x00f70027, 0x00f70026, 0x00f70025,
2495}; 2495};
2496 2496
2497const u32 txpwrctrl_tx_gain_ipa_5g[] = { 2497static const u32 txpwrctrl_tx_gain_ipa_5g[] = {
2498 0x7ff70035, 0x7ff70033, 0x7ff70032, 0x7ff70031, 2498 0x7ff70035, 0x7ff70033, 0x7ff70032, 0x7ff70031,
2499 0x7ff7002f, 0x7ff7002e, 0x7ff7002d, 0x7ff7002b, 2499 0x7ff7002f, 0x7ff7002e, 0x7ff7002d, 0x7ff7002b,
2500 0x7ff7002a, 0x7ff70029, 0x7ff70028, 0x7ff70027, 2500 0x7ff7002a, 0x7ff70029, 0x7ff70028, 0x7ff70027,
@@ -2529,6 +2529,11 @@ const u32 txpwrctrl_tx_gain_ipa_5g[] = {
2529 0x70f70021, 0x70f70020, 0x70f70020, 0x70f7001f, 2529 0x70f70021, 0x70f70020, 0x70f70020, 0x70f7001f,
2530}; 2530};
2531 2531
2532const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[] = {
2533 -114, -108, -98, -91, -84, -78, -70, -62,
2534 -54, -46, -39, -31, -23, -15, -8, 0
2535};
2536
2532const u16 tbl_iqcal_gainparams[2][9][8] = { 2537const u16 tbl_iqcal_gainparams[2][9][8] = {
2533 { 2538 {
2534 { 0x000, 0, 0, 2, 0x69, 0x69, 0x69, 0x69 }, 2539 { 0x000, 0, 0, 2, 0x69, 0x69, 0x69, 0x69 },
@@ -2739,11 +2744,11 @@ const struct nphy_rf_control_override_rev3 tbl_rf_control_override_rev3[] = {
2739 { 0x0001, 0, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0002 (fls 2) */ 2744 { 0x0001, 0, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0002 (fls 2) */
2740 { 0x0002, 1, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0004 (fls 3) */ 2745 { 0x0002, 1, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0004 (fls 3) */
2741 { 0x0004, 2, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0008 (fls 4) */ 2746 { 0x0004, 2, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0008 (fls 4) */
2742 { 0x0016, 4, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0010 (fls 5) */ 2747 { 0x0010, 4, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0010 (fls 5) */
2743 { 0x0020, 5, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0020 (fls 6) */ 2748 { 0x0020, 5, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0020 (fls 6) */
2744 { 0x0040, 6, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0040 (fls 7) */ 2749 { 0x0040, 6, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0040 (fls 7) */
2745 { 0x0080, 6, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0080 (fls 8) */ 2750 { 0x0080, 7, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0080 (fls 8) */
2746 { 0x0100, 7, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0100 (fls 9) */ 2751 { 0x0100, 8, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0100 (fls 9) */
2747 { 0x0007, 0, 0xE7, 0xF8, 0xEC, 0xFA }, /* field == 0x0200 (fls 10) */ 2752 { 0x0007, 0, 0xE7, 0xF8, 0xEC, 0xFA }, /* field == 0x0200 (fls 10) */
2748 { 0x0070, 4, 0xE7, 0xF8, 0xEC, 0xFA }, /* field == 0x0400 (fls 11) */ 2753 { 0x0070, 4, 0xE7, 0xF8, 0xEC, 0xFA }, /* field == 0x0400 (fls 11) */
2749 { 0xE000, 13, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0800 (fls 12) */ 2754 { 0xE000, 13, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0800 (fls 12) */
@@ -3126,6 +3131,53 @@ void b43_nphy_rev3plus_tables_init(struct b43_wldev *dev)
3126 B43_WARN_ON(1); 3131 B43_WARN_ON(1);
3127} 3132}
3128 3133
3134/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetIpaGainTbl */
3135static const u32 *b43_nphy_get_ipa_gain_table(struct b43_wldev *dev)
3136{
3137 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
3138 if (dev->phy.rev >= 6) {
3139 if (dev->dev->chip_id == 47162)
3140 return txpwrctrl_tx_gain_ipa_rev5;
3141 return txpwrctrl_tx_gain_ipa_rev6;
3142 } else if (dev->phy.rev >= 5) {
3143 return txpwrctrl_tx_gain_ipa_rev5;
3144 } else {
3145 return txpwrctrl_tx_gain_ipa;
3146 }
3147 } else {
3148 return txpwrctrl_tx_gain_ipa_5g;
3149 }
3150}
3151
3152const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev)
3153{
3154 enum ieee80211_band band = b43_current_band(dev->wl);
3155 struct ssb_sprom *sprom = dev->dev->bus_sprom;
3156
3157 if (dev->phy.rev < 3)
3158 return b43_ntab_tx_gain_rev0_1_2;
3159
3160 /* rev 3+ */
3161 if ((dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) ||
3162 (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ)) {
3163 return b43_nphy_get_ipa_gain_table(dev);
3164 } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
3165 if (dev->phy.rev == 3)
3166 return b43_ntab_tx_gain_rev3_5ghz;
3167 if (dev->phy.rev == 4)
3168 return sprom->fem.ghz5.extpa_gain == 3 ?
3169 b43_ntab_tx_gain_rev4_5ghz :
3170 b43_ntab_tx_gain_rev4_5ghz; /* FIXME */
3171 else
3172 return b43_ntab_tx_gain_rev5plus_5ghz;
3173 } else {
3174 if (dev->phy.rev >= 5 && sprom->fem.ghz5.extpa_gain == 3)
3175 return b43_ntab_tx_gain_rev3plus_2ghz; /* FIXME */
3176 else
3177 return b43_ntab_tx_gain_rev3plus_2ghz;
3178 }
3179}
3180
3129struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent( 3181struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
3130 struct b43_wldev *dev, bool ghz5, bool ext_lna) 3182 struct b43_wldev *dev, bool ghz5, bool ext_lna)
3131{ 3183{
diff --git a/drivers/net/wireless/b43/tables_nphy.h b/drivers/net/wireless/b43/tables_nphy.h
index 97038c481930..f348953c0230 100644
--- a/drivers/net/wireless/b43/tables_nphy.h
+++ b/drivers/net/wireless/b43/tables_nphy.h
@@ -177,16 +177,10 @@ void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset,
177void b43_nphy_rev0_1_2_tables_init(struct b43_wldev *dev); 177void b43_nphy_rev0_1_2_tables_init(struct b43_wldev *dev);
178void b43_nphy_rev3plus_tables_init(struct b43_wldev *dev); 178void b43_nphy_rev3plus_tables_init(struct b43_wldev *dev);
179 179
180extern const u32 b43_ntab_tx_gain_rev0_1_2[]; 180const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev);
181extern const u32 b43_ntab_tx_gain_rev3plus_2ghz[]; 181
182extern const u32 b43_ntab_tx_gain_rev3_5ghz[]; 182extern const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[];
183extern const u32 b43_ntab_tx_gain_rev4_5ghz[]; 183
184extern const u32 b43_ntab_tx_gain_rev5plus_5ghz[];
185
186extern const u32 txpwrctrl_tx_gain_ipa[];
187extern const u32 txpwrctrl_tx_gain_ipa_rev5[];
188extern const u32 txpwrctrl_tx_gain_ipa_rev6[];
189extern const u32 txpwrctrl_tx_gain_ipa_5g[];
190extern const u16 tbl_iqcal_gainparams[2][9][8]; 184extern const u16 tbl_iqcal_gainparams[2][9][8];
191extern const struct nphy_txiqcal_ladder ladder_lo[]; 185extern const struct nphy_txiqcal_ladder ladder_lo[];
192extern const struct nphy_txiqcal_ladder ladder_iq[]; 186extern const struct nphy_txiqcal_ladder ladder_iq[];
diff --git a/drivers/net/wireless/brcm80211/Makefile b/drivers/net/wireless/brcm80211/Makefile
index f41c047eca82..b987920e982e 100644
--- a/drivers/net/wireless/brcm80211/Makefile
+++ b/drivers/net/wireless/brcm80211/Makefile
@@ -16,7 +16,7 @@
16# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 17
18# common flags 18# common flags
19subdir-ccflags-$(CONFIG_BRCMDBG) += -DBCMDBG 19subdir-ccflags-$(CONFIG_BRCMDBG) += -DDEBUG
20 20
21obj-$(CONFIG_BRCMUTIL) += brcmutil/ 21obj-$(CONFIG_BRCMUTIL) += brcmutil/
22obj-$(CONFIG_BRCMFMAC) += brcmfmac/ 22obj-$(CONFIG_BRCMFMAC) += brcmfmac/
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 4bc8d251acf8..e925290b432b 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -15,6 +15,8 @@
15 */ 15 */
16/* ****************** SDIO CARD Interface Functions **************************/ 16/* ****************** SDIO CARD Interface Functions **************************/
17 17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19
18#include <linux/types.h> 20#include <linux/types.h>
19#include <linux/netdevice.h> 21#include <linux/netdevice.h>
20#include <linux/export.h> 22#include <linux/export.h>
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 9b8c0ed833d4..ac71adeece51 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -13,6 +13,9 @@
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
16#include <linux/types.h> 19#include <linux/types.h>
17#include <linux/netdevice.h> 20#include <linux/netdevice.h>
18#include <linux/mmc/sdio.h> 21#include <linux/mmc/sdio.h>
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
index e58ea40a75b0..07686a748d3c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
@@ -644,9 +644,9 @@ extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
644extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, 644extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx,
645 uint cmd, void *buf, uint len); 645 uint cmd, void *buf, uint len);
646 646
647#ifdef BCMDBG 647#ifdef DEBUG
648extern int brcmf_write_to_file(struct brcmf_pub *drvr, const u8 *buf, int size); 648extern int brcmf_write_to_file(struct brcmf_pub *drvr, const u8 *buf, int size);
649#endif /* BCMDBG */ 649#endif /* DEBUG */
650 650
651extern int brcmf_ifname2idx(struct brcmf_pub *drvr, char *name); 651extern int brcmf_ifname2idx(struct brcmf_pub *drvr, char *name);
652extern int brcmf_c_host_event(struct brcmf_pub *drvr, int *idx, 652extern int brcmf_c_host_event(struct brcmf_pub *drvr, int *idx,
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
index ac8d1f437888..b3e3b7f25d82 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
@@ -19,6 +19,8 @@
19 * For certain dcmd codes, the dongle interprets string data from the host. 19 * For certain dcmd codes, the dongle interprets string data from the host.
20 ******************************************************************************/ 20 ******************************************************************************/
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#include <linux/types.h> 24#include <linux/types.h>
23#include <linux/netdevice.h> 25#include <linux/netdevice.h>
24#include <linux/sched.h> 26#include <linux/sched.h>
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
index a51d8f5d36fc..4187435220f3 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
@@ -13,6 +13,9 @@
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
16#include <linux/kernel.h> 19#include <linux/kernel.h>
17#include <linux/string.h> 20#include <linux/string.h>
18#include <linux/sched.h> 21#include <linux/sched.h>
@@ -38,7 +41,7 @@
38#define BRCMF_PKT_FILTER_PATTERN_FIXED_LEN \ 41#define BRCMF_PKT_FILTER_PATTERN_FIXED_LEN \
39 offsetof(struct brcmf_pkt_filter_pattern_le, mask_and_pattern) 42 offsetof(struct brcmf_pkt_filter_pattern_le, mask_and_pattern)
40 43
41#ifdef BCMDBG 44#ifdef DEBUG
42static const char brcmf_version[] = 45static const char brcmf_version[] =
43 "Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on " 46 "Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on "
44 __DATE__ " at " __TIME__; 47 __DATE__ " at " __TIME__;
@@ -133,7 +136,7 @@ bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
133 return p != NULL; 136 return p != NULL;
134} 137}
135 138
136#ifdef BCMDBG 139#ifdef DEBUG
137static void 140static void
138brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data) 141brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
139{ 142{
@@ -399,10 +402,10 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
399 p = (char *)&buf[sizeof(struct msgtrace_hdr)]; 402 p = (char *)&buf[sizeof(struct msgtrace_hdr)];
400 while ((s = strstr(p, "\n")) != NULL) { 403 while ((s = strstr(p, "\n")) != NULL) {
401 *s = '\0'; 404 *s = '\0';
402 printk(KERN_DEBUG"%s\n", p); 405 pr_debug("%s\n", p);
403 p = s + 1; 406 p = s + 1;
404 } 407 }
405 printk(KERN_DEBUG "%s\n", p); 408 pr_debug("%s\n", p);
406 409
407 /* Reset datalen to avoid display below */ 410 /* Reset datalen to avoid display below */
408 datalen = 0; 411 datalen = 0;
@@ -430,7 +433,7 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
430 brcmf_dbg(EVENT, "\n"); 433 brcmf_dbg(EVENT, "\n");
431 } 434 }
432} 435}
433#endif /* BCMDBG */ 436#endif /* DEBUG */
434 437
435int 438int
436brcmf_c_host_event(struct brcmf_pub *drvr, int *ifidx, void *pktdata, 439brcmf_c_host_event(struct brcmf_pub *drvr, int *ifidx, void *pktdata,
@@ -518,9 +521,9 @@ brcmf_c_host_event(struct brcmf_pub *drvr, int *ifidx, void *pktdata,
518 break; 521 break;
519 } 522 }
520 523
521#ifdef BCMDBG 524#ifdef DEBUG
522 brcmf_c_show_host_event(event, event_data); 525 brcmf_c_show_host_event(event, event_data);
523#endif /* BCMDBG */ 526#endif /* DEBUG */
524 527
525 return 0; 528 return 0;
526} 529}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h
index bb26ee36bc68..a2c4576cf9ff 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h
@@ -32,20 +32,20 @@
32#define BRCMF_BTA_VAL 0x1000 32#define BRCMF_BTA_VAL 0x1000
33#define BRCMF_ISCAN_VAL 0x2000 33#define BRCMF_ISCAN_VAL 0x2000
34 34
35#if defined(BCMDBG) 35#if defined(DEBUG)
36 36
37#define brcmf_dbg(level, fmt, ...) \ 37#define brcmf_dbg(level, fmt, ...) \
38do { \ 38do { \
39 if (BRCMF_ERROR_VAL == BRCMF_##level##_VAL) { \ 39 if (BRCMF_ERROR_VAL == BRCMF_##level##_VAL) { \
40 if (brcmf_msg_level & BRCMF_##level##_VAL) { \ 40 if (brcmf_msg_level & BRCMF_##level##_VAL) { \
41 if (net_ratelimit()) \ 41 if (net_ratelimit()) \
42 printk(KERN_DEBUG "%s: " fmt, \ 42 pr_debug("%s: " fmt, \
43 __func__, ##__VA_ARGS__); \ 43 __func__, ##__VA_ARGS__); \
44 } \ 44 } \
45 } else { \ 45 } else { \
46 if (brcmf_msg_level & BRCMF_##level##_VAL) { \ 46 if (brcmf_msg_level & BRCMF_##level##_VAL) { \
47 printk(KERN_DEBUG "%s: " fmt, \ 47 pr_debug("%s: " fmt, \
48 __func__, ##__VA_ARGS__); \ 48 __func__, ##__VA_ARGS__); \
49 } \ 49 } \
50 } \ 50 } \
51} while (0) 51} while (0)
@@ -56,7 +56,7 @@ do { \
56#define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL) 56#define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL)
57#define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL) 57#define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
58 58
59#else /* (defined BCMDBG) || (defined BCMDBG) */ 59#else /* (defined DEBUG) || (defined DEBUG) */
60 60
61#define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__) 61#define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
62 62
@@ -66,7 +66,13 @@ do { \
66#define BRCMF_BYTES_ON() 0 66#define BRCMF_BYTES_ON() 0
67#define BRCMF_GLOM_ON() 0 67#define BRCMF_GLOM_ON() 0
68 68
69#endif /* defined(BCMDBG) */ 69#endif /* defined(DEBUG) */
70
71#define brcmf_dbg_hex_dump(test, data, len, fmt, ...) \
72do { \
73 if (test) \
74 brcmu_dbg_hex_dump(data, len, fmt, ##__VA_ARGS__); \
75} while (0)
70 76
71extern int brcmf_msg_level; 77extern int brcmf_msg_level;
72 78
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index eb9eb766ac27..db2df1f1e6b2 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -14,6 +14,8 @@
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/init.h> 19#include <linux/init.h>
18#include <linux/kernel.h> 20#include <linux/kernel.h>
19#include <linux/kthread.h> 21#include <linux/kthread.h>
@@ -590,8 +592,8 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
590 sprintf(info->bus_info, "%s", dev_name(drvr->dev)); 592 sprintf(info->bus_info, "%s", dev_name(drvr->dev));
591} 593}
592 594
593static struct ethtool_ops brcmf_ethtool_ops = { 595static const struct ethtool_ops brcmf_ethtool_ops = {
594 .get_drvinfo = brcmf_ethtool_get_drvinfo 596 .get_drvinfo = brcmf_ethtool_get_drvinfo,
595}; 597};
596 598
597static int brcmf_ethtool(struct brcmf_pub *drvr, void __user *uaddr) 599static int brcmf_ethtool(struct brcmf_pub *drvr, void __user *uaddr)
@@ -1146,7 +1148,7 @@ int brcmf_netdev_wait_pend8021x(struct net_device *ndev)
1146 return pend; 1148 return pend;
1147} 1149}
1148 1150
1149#ifdef BCMDBG 1151#ifdef DEBUG
1150int brcmf_write_to_file(struct brcmf_pub *drvr, const u8 *buf, int size) 1152int brcmf_write_to_file(struct brcmf_pub *drvr, const u8 *buf, int size)
1151{ 1153{
1152 int ret = 0; 1154 int ret = 0;
@@ -1180,4 +1182,4 @@ exit:
1180 1182
1181 return ret; 1183 return ret;
1182} 1184}
1183#endif /* BCMDBG */ 1185#endif /* DEBUG */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index f7eeee1dcdb6..6e4b5e85a099 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -14,6 +14,8 @@
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/types.h> 19#include <linux/types.h>
18#include <linux/kernel.h> 20#include <linux/kernel.h>
19#include <linux/kthread.h> 21#include <linux/kthread.h>
@@ -40,7 +42,7 @@
40 42
41#define DCMD_RESP_TIMEOUT 2000 /* In milli second */ 43#define DCMD_RESP_TIMEOUT 2000 /* In milli second */
42 44
43#ifdef BCMDBG 45#ifdef DEBUG
44 46
45#define BRCMF_TRAP_INFO_SIZE 80 47#define BRCMF_TRAP_INFO_SIZE 80
46 48
@@ -84,7 +86,7 @@ struct rte_console {
84 char cbuf[CBUF_LEN]; 86 char cbuf[CBUF_LEN];
85}; 87};
86 88
87#endif /* BCMDBG */ 89#endif /* DEBUG */
88#include <chipcommon.h> 90#include <chipcommon.h>
89 91
90#include "dhd_bus.h" 92#include "dhd_bus.h"
@@ -416,7 +418,7 @@ struct sdpcmd_regs {
416 u16 PAD[0x80]; 418 u16 PAD[0x80];
417}; 419};
418 420
419#ifdef BCMDBG 421#ifdef DEBUG
420/* Device console log buffer state */ 422/* Device console log buffer state */
421struct brcmf_console { 423struct brcmf_console {
422 uint count; /* Poll interval msec counter */ 424 uint count; /* Poll interval msec counter */
@@ -426,7 +428,7 @@ struct brcmf_console {
426 u8 *buf; /* Log buffer (host copy) */ 428 u8 *buf; /* Log buffer (host copy) */
427 uint last; /* Last buffer read index */ 429 uint last; /* Last buffer read index */
428}; 430};
429#endif /* BCMDBG */ 431#endif /* DEBUG */
430 432
431struct sdpcm_shared { 433struct sdpcm_shared {
432 u32 flags; 434 u32 flags;
@@ -507,11 +509,11 @@ struct brcmf_sdio {
507 uint polltick; /* Tick counter */ 509 uint polltick; /* Tick counter */
508 uint pollcnt; /* Count of active polls */ 510 uint pollcnt; /* Count of active polls */
509 511
510#ifdef BCMDBG 512#ifdef DEBUG
511 uint console_interval; 513 uint console_interval;
512 struct brcmf_console console; /* Console output polling support */ 514 struct brcmf_console console; /* Console output polling support */
513 uint console_addr; /* Console address from shared struct */ 515 uint console_addr; /* Console address from shared struct */
514#endif /* BCMDBG */ 516#endif /* DEBUG */
515 517
516 uint regfails; /* Count of R_REG failures */ 518 uint regfails; /* Count of R_REG failures */
517 519
@@ -587,10 +589,10 @@ struct brcmf_sdio {
587#define CLK_PENDING 2 /* Not used yet */ 589#define CLK_PENDING 2 /* Not used yet */
588#define CLK_AVAIL 3 590#define CLK_AVAIL 3
589 591
590#ifdef BCMDBG 592#ifdef DEBUG
591static int qcount[NUMPRIO]; 593static int qcount[NUMPRIO];
592static int tx_packets[NUMPRIO]; 594static int tx_packets[NUMPRIO];
593#endif /* BCMDBG */ 595#endif /* DEBUG */
594 596
595#define SDIO_DRIVE_STRENGTH 6 /* in milliamps */ 597#define SDIO_DRIVE_STRENGTH 6 /* in milliamps */
596 598
@@ -764,12 +766,12 @@ static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok)
764 bus->clkstate = CLK_AVAIL; 766 bus->clkstate = CLK_AVAIL;
765 brcmf_dbg(INFO, "CLKCTL: turned ON\n"); 767 brcmf_dbg(INFO, "CLKCTL: turned ON\n");
766 768
767#if defined(BCMDBG) 769#if defined(DEBUG)
768 if (bus->alp_only != true) { 770 if (bus->alp_only != true) {
769 if (SBSDIO_ALPONLY(clkctl)) 771 if (SBSDIO_ALPONLY(clkctl))
770 brcmf_dbg(ERROR, "HT Clock should be on\n"); 772 brcmf_dbg(ERROR, "HT Clock should be on\n");
771 } 773 }
772#endif /* defined (BCMDBG) */ 774#endif /* defined (DEBUG) */
773 775
774 bus->activity = true; 776 bus->activity = true;
775 } else { 777 } else {
@@ -814,9 +816,9 @@ static int brcmf_sdbrcm_sdclk(struct brcmf_sdio *bus, bool on)
814/* Transition SD and backplane clock readiness */ 816/* Transition SD and backplane clock readiness */
815static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok) 817static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok)
816{ 818{
817#ifdef BCMDBG 819#ifdef DEBUG
818 uint oldstate = bus->clkstate; 820 uint oldstate = bus->clkstate;
819#endif /* BCMDBG */ 821#endif /* DEBUG */
820 822
821 brcmf_dbg(TRACE, "Enter\n"); 823 brcmf_dbg(TRACE, "Enter\n");
822 824
@@ -861,9 +863,9 @@ static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok)
861 brcmf_sdbrcm_wd_timer(bus, 0); 863 brcmf_sdbrcm_wd_timer(bus, 0);
862 break; 864 break;
863 } 865 }
864#ifdef BCMDBG 866#ifdef DEBUG
865 brcmf_dbg(INFO, "%d -> %d\n", oldstate, bus->clkstate); 867 brcmf_dbg(INFO, "%d -> %d\n", oldstate, bus->clkstate);
866#endif /* BCMDBG */ 868#endif /* DEBUG */
867 869
868 return 0; 870 return 0;
869} 871}
@@ -1279,13 +1281,10 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1279 } 1281 }
1280 return 0; 1282 return 0;
1281 } 1283 }
1282#ifdef BCMDBG 1284
1283 if (BRCMF_GLOM_ON()) { 1285 brcmf_dbg_hex_dump(BRCMF_GLOM_ON(),
1284 printk(KERN_DEBUG "SUPERFRAME:\n"); 1286 pfirst->data, min_t(int, pfirst->len, 48),
1285 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, 1287 "SUPERFRAME:\n");
1286 pfirst->data, min_t(int, pfirst->len, 48));
1287 }
1288#endif
1289 1288
1290 /* Validate the superframe header */ 1289 /* Validate the superframe header */
1291 dptr = (u8 *) (pfirst->data); 1290 dptr = (u8 *) (pfirst->data);
@@ -1362,13 +1361,8 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1362 check = get_unaligned_le16(dptr + sizeof(u16)); 1361 check = get_unaligned_le16(dptr + sizeof(u16));
1363 chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); 1362 chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]);
1364 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); 1363 doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]);
1365#ifdef BCMDBG 1364 brcmf_dbg_hex_dump(BRCMF_GLOM_ON(),
1366 if (BRCMF_GLOM_ON()) { 1365 dptr, 32, "subframe:\n");
1367 printk(KERN_DEBUG "subframe:\n");
1368 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
1369 dptr, 32);
1370 }
1371#endif
1372 1366
1373 if ((u16)~(sublen ^ check)) { 1367 if ((u16)~(sublen ^ check)) {
1374 brcmf_dbg(ERROR, "(subframe %d): HW hdr error: len/check 0x%04x/0x%04x\n", 1368 brcmf_dbg(ERROR, "(subframe %d): HW hdr error: len/check 0x%04x/0x%04x\n",
@@ -1433,13 +1427,8 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1433 } 1427 }
1434 rxseq++; 1428 rxseq++;
1435 1429
1436#ifdef BCMDBG 1430 brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(),
1437 if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) { 1431 dptr, dlen, "Rx Subframe Data:\n");
1438 printk(KERN_DEBUG "Rx Subframe Data:\n");
1439 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
1440 dptr, dlen);
1441 }
1442#endif
1443 1432
1444 __skb_trim(pfirst, sublen); 1433 __skb_trim(pfirst, sublen);
1445 skb_pull(pfirst, doff); 1434 skb_pull(pfirst, doff);
@@ -1457,17 +1446,13 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq)
1457 continue; 1446 continue;
1458 } 1447 }
1459 1448
1460#ifdef BCMDBG 1449 brcmf_dbg_hex_dump(BRCMF_GLOM_ON(),
1461 if (BRCMF_GLOM_ON()) { 1450 pfirst->data,
1462 brcmf_dbg(GLOM, "subframe %d to stack, %p (%p/%d) nxt/lnk %p/%p\n", 1451 min_t(int, pfirst->len, 32),
1463 bus->glom.qlen, pfirst, pfirst->data, 1452 "subframe %d to stack, %p (%p/%d) nxt/lnk %p/%p\n",
1464 pfirst->len, pfirst->next, 1453 bus->glom.qlen, pfirst, pfirst->data,
1465 pfirst->prev); 1454 pfirst->len, pfirst->next,
1466 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, 1455 pfirst->prev);
1467 pfirst->data,
1468 min_t(int, pfirst->len, 32));
1469 }
1470#endif /* BCMDBG */
1471 } 1456 }
1472 /* sent any remaining packets up */ 1457 /* sent any remaining packets up */
1473 if (bus->glom.qlen) { 1458 if (bus->glom.qlen) {
@@ -1584,12 +1569,8 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
1584 1569
1585gotpkt: 1570gotpkt:
1586 1571
1587#ifdef BCMDBG 1572 brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_CTL_ON(),
1588 if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) { 1573 bus->rxctl, len, "RxCtrl:\n");
1589 printk(KERN_DEBUG "RxCtrl:\n");
1590 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, bus->rxctl, len);
1591 }
1592#endif
1593 1574
1594 /* Point to valid data and indicate its length */ 1575 /* Point to valid data and indicate its length */
1595 bus->rxctl += doff; 1576 bus->rxctl += doff;
@@ -1818,17 +1799,13 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished)
1818 } 1799 }
1819 bus->tx_max = txmax; 1800 bus->tx_max = txmax;
1820 1801
1821#ifdef BCMDBG 1802 brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(),
1822 if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) { 1803 rxbuf, len, "Rx Data:\n");
1823 printk(KERN_DEBUG "Rx Data:\n"); 1804 brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() &&
1824 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, 1805 BRCMF_DATA_ON()) &&
1825 rxbuf, len); 1806 BRCMF_HDRS_ON(),
1826 } else if (BRCMF_HDRS_ON()) { 1807 bus->rxhdr, SDPCM_HDRLEN,
1827 printk(KERN_DEBUG "RxHdr:\n"); 1808 "RxHdr:\n");
1828 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
1829 bus->rxhdr, SDPCM_HDRLEN);
1830 }
1831#endif
1832 1809
1833 if (chan == SDPCM_CONTROL_CHANNEL) { 1810 if (chan == SDPCM_CONTROL_CHANNEL) {
1834 brcmf_dbg(ERROR, "(nextlen): readahead on control packet %d?\n", 1811 brcmf_dbg(ERROR, "(nextlen): readahead on control packet %d?\n",
@@ -1865,13 +1842,9 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished)
1865 brcmf_sdbrcm_rxfail(bus, true, true); 1842 brcmf_sdbrcm_rxfail(bus, true, true);
1866 continue; 1843 continue;
1867 } 1844 }
1868#ifdef BCMDBG 1845 brcmf_dbg_hex_dump(BRCMF_BYTES_ON() || BRCMF_HDRS_ON(),
1869 if (BRCMF_BYTES_ON() || BRCMF_HDRS_ON()) { 1846 bus->rxhdr, SDPCM_HDRLEN, "RxHdr:\n");
1870 printk(KERN_DEBUG "RxHdr:\n"); 1847
1871 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
1872 bus->rxhdr, SDPCM_HDRLEN);
1873 }
1874#endif
1875 1848
1876 /* Extract hardware header fields */ 1849 /* Extract hardware header fields */
1877 len = get_unaligned_le16(bus->rxhdr); 1850 len = get_unaligned_le16(bus->rxhdr);
@@ -2024,13 +1997,8 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished)
2024 skb_push(pkt, BRCMF_FIRSTREAD); 1997 skb_push(pkt, BRCMF_FIRSTREAD);
2025 memcpy(pkt->data, bus->rxhdr, BRCMF_FIRSTREAD); 1998 memcpy(pkt->data, bus->rxhdr, BRCMF_FIRSTREAD);
2026 1999
2027#ifdef BCMDBG 2000 brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(),
2028 if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) { 2001 pkt->data, len, "Rx Data:\n");
2029 printk(KERN_DEBUG "Rx Data:\n");
2030 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
2031 pkt->data, len);
2032 }
2033#endif
2034 2002
2035deliver: 2003deliver:
2036 /* Save superframe descriptor and allocate packet frame */ 2004 /* Save superframe descriptor and allocate packet frame */
@@ -2038,14 +2006,9 @@ deliver:
2038 if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_FRAMETAG_LEN])) { 2006 if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_FRAMETAG_LEN])) {
2039 brcmf_dbg(GLOM, "glom descriptor, %d bytes:\n", 2007 brcmf_dbg(GLOM, "glom descriptor, %d bytes:\n",
2040 len); 2008 len);
2041#ifdef BCMDBG 2009 brcmf_dbg_hex_dump(BRCMF_GLOM_ON(),
2042 if (BRCMF_GLOM_ON()) { 2010 pkt->data, len,
2043 printk(KERN_DEBUG "Glom Data:\n"); 2011 "Glom Data:\n");
2044 print_hex_dump_bytes("",
2045 DUMP_PREFIX_OFFSET,
2046 pkt->data, len);
2047 }
2048#endif
2049 __skb_trim(pkt, len); 2012 __skb_trim(pkt, len);
2050 skb_pull(pkt, SDPCM_HDRLEN); 2013 skb_pull(pkt, SDPCM_HDRLEN);
2051 bus->glomd = pkt; 2014 bus->glomd = pkt;
@@ -2078,13 +2041,11 @@ deliver:
2078 down(&bus->sdsem); 2041 down(&bus->sdsem);
2079 } 2042 }
2080 rxcount = maxframes - rxleft; 2043 rxcount = maxframes - rxleft;
2081#ifdef BCMDBG
2082 /* Message if we hit the limit */ 2044 /* Message if we hit the limit */
2083 if (!rxleft) 2045 if (!rxleft)
2084 brcmf_dbg(DATA, "hit rx limit of %d frames\n", 2046 brcmf_dbg(DATA, "hit rx limit of %d frames\n",
2085 maxframes); 2047 maxframes);
2086 else 2048 else
2087#endif /* BCMDBG */
2088 brcmf_dbg(DATA, "processed %d frames\n", rxcount); 2049 brcmf_dbg(DATA, "processed %d frames\n", rxcount);
2089 /* Back off rxseq if awaiting rtx, update rx_seq */ 2050 /* Back off rxseq if awaiting rtx, update rx_seq */
2090 if (bus->rxskip) 2051 if (bus->rxskip)
@@ -2176,20 +2137,22 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt,
2176 put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN); 2137 put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN);
2177 put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); 2138 put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader));
2178 2139
2179#ifdef BCMDBG 2140#ifdef DEBUG
2180 tx_packets[pkt->priority]++; 2141 tx_packets[pkt->priority]++;
2181 if (BRCMF_BYTES_ON() &&
2182 (((BRCMF_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) ||
2183 (BRCMF_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) {
2184 printk(KERN_DEBUG "Tx Frame:\n");
2185 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, frame, len);
2186 } else if (BRCMF_HDRS_ON()) {
2187 printk(KERN_DEBUG "TxHdr:\n");
2188 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
2189 frame, min_t(u16, len, 16));
2190 }
2191#endif 2142#endif
2192 2143
2144 brcmf_dbg_hex_dump(BRCMF_BYTES_ON() &&
2145 ((BRCMF_CTL_ON() && chan == SDPCM_CONTROL_CHANNEL) ||
2146 (BRCMF_DATA_ON() && chan != SDPCM_CONTROL_CHANNEL)),
2147 frame, len, "Tx Frame:\n");
2148 brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() &&
2149 ((BRCMF_CTL_ON() &&
2150 chan == SDPCM_CONTROL_CHANNEL) ||
2151 (BRCMF_DATA_ON() &&
2152 chan != SDPCM_CONTROL_CHANNEL))) &&
2153 BRCMF_HDRS_ON(),
2154 frame, min_t(u16, len, 16), "TxHdr:\n");
2155
2193 /* Raise len to next SDIO block to eliminate tail command */ 2156 /* Raise len to next SDIO block to eliminate tail command */
2194 if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { 2157 if (bus->roundup && bus->blocksize && (len > bus->blocksize)) {
2195 u16 pad = bus->blocksize - (len % bus->blocksize); 2158 u16 pad = bus->blocksize - (len % bus->blocksize);
@@ -2410,7 +2373,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2410 int err; 2373 int err;
2411 u8 clkctl, devctl = 0; 2374 u8 clkctl, devctl = 0;
2412 2375
2413#ifdef BCMDBG 2376#ifdef DEBUG
2414 /* Check for inconsistent device control */ 2377 /* Check for inconsistent device control */
2415 devctl = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1, 2378 devctl = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
2416 SBSDIO_DEVICE_CTL, &err); 2379 SBSDIO_DEVICE_CTL, &err);
@@ -2418,7 +2381,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus)
2418 brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", err); 2381 brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", err);
2419 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; 2382 bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN;
2420 } 2383 }
2421#endif /* BCMDBG */ 2384#endif /* DEBUG */
2422 2385
2423 /* Read CSR, if clock on switch to AVAIL, else ignore */ 2386 /* Read CSR, if clock on switch to AVAIL, else ignore */
2424 clkctl = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1, 2387 clkctl = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1,
@@ -2701,7 +2664,7 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt)
2701 brcmf_txflowcontrol(bus->sdiodev->dev, 0, ON); 2664 brcmf_txflowcontrol(bus->sdiodev->dev, 0, ON);
2702 } 2665 }
2703 2666
2704#ifdef BCMDBG 2667#ifdef DEBUG
2705 if (pktq_plen(&bus->txq, prec) > qcount[prec]) 2668 if (pktq_plen(&bus->txq, prec) > qcount[prec])
2706 qcount[prec] = pktq_plen(&bus->txq, prec); 2669 qcount[prec] = pktq_plen(&bus->txq, prec);
2707#endif 2670#endif
@@ -2774,7 +2737,7 @@ xfer_done:
2774 return bcmerror; 2737 return bcmerror;
2775} 2738}
2776 2739
2777#ifdef BCMDBG 2740#ifdef DEBUG
2778#define CONSOLE_LINE_MAX 192 2741#define CONSOLE_LINE_MAX 192
2779 2742
2780static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus) 2743static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus)
@@ -2845,14 +2808,14 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus)
2845 if (line[n - 1] == '\r') 2808 if (line[n - 1] == '\r')
2846 n--; 2809 n--;
2847 line[n] = 0; 2810 line[n] = 0;
2848 printk(KERN_DEBUG "CONSOLE: %s\n", line); 2811 pr_debug("CONSOLE: %s\n", line);
2849 } 2812 }
2850 } 2813 }
2851break2: 2814break2:
2852 2815
2853 return 0; 2816 return 0;
2854} 2817}
2855#endif /* BCMDBG */ 2818#endif /* DEBUG */
2856 2819
2857static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len) 2820static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len)
2858{ 2821{
@@ -2982,17 +2945,11 @@ brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen)
2982 } 2945 }
2983 2946
2984 if (ret == -1) { 2947 if (ret == -1) {
2985#ifdef BCMDBG 2948 brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_CTL_ON(),
2986 if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) { 2949 frame, len, "Tx Frame:\n");
2987 printk(KERN_DEBUG "Tx Frame:\n"); 2950 brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() && BRCMF_CTL_ON()) &&
2988 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, 2951 BRCMF_HDRS_ON(),
2989 frame, len); 2952 frame, min_t(u16, len, 16), "TxHdr:\n");
2990 } else if (BRCMF_HDRS_ON()) {
2991 printk(KERN_DEBUG "TxHdr:\n");
2992 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
2993 frame, min_t(u16, len, 16));
2994 }
2995#endif
2996 2953
2997 do { 2954 do {
2998 ret = brcmf_tx_frame(bus, frame, len); 2955 ret = brcmf_tx_frame(bus, frame, len);
@@ -3096,9 +3053,9 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus)
3096 u8 *vbuffer; 3053 u8 *vbuffer;
3097 u32 varsizew; 3054 u32 varsizew;
3098 __le32 varsizew_le; 3055 __le32 varsizew_le;
3099#ifdef BCMDBG 3056#ifdef DEBUG
3100 char *nvram_ularray; 3057 char *nvram_ularray;
3101#endif /* BCMDBG */ 3058#endif /* DEBUG */
3102 3059
3103 /* Even if there are no vars are to be written, we still 3060 /* Even if there are no vars are to be written, we still
3104 need to set the ramsize. */ 3061 need to set the ramsize. */
@@ -3115,7 +3072,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus)
3115 /* Write the vars list */ 3072 /* Write the vars list */
3116 bcmerror = 3073 bcmerror =
3117 brcmf_sdbrcm_membytes(bus, true, varaddr, vbuffer, varsize); 3074 brcmf_sdbrcm_membytes(bus, true, varaddr, vbuffer, varsize);
3118#ifdef BCMDBG 3075#ifdef DEBUG
3119 /* Verify NVRAM bytes */ 3076 /* Verify NVRAM bytes */
3120 brcmf_dbg(INFO, "Compare NVRAM dl & ul; varsize=%d\n", varsize); 3077 brcmf_dbg(INFO, "Compare NVRAM dl & ul; varsize=%d\n", varsize);
3121 nvram_ularray = kmalloc(varsize, GFP_ATOMIC); 3078 nvram_ularray = kmalloc(varsize, GFP_ATOMIC);
@@ -3142,7 +3099,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_sdio *bus)
3142 brcmf_dbg(ERROR, "Download/Upload/Compare of NVRAM ok\n"); 3099 brcmf_dbg(ERROR, "Download/Upload/Compare of NVRAM ok\n");
3143 3100
3144 kfree(nvram_ularray); 3101 kfree(nvram_ularray);
3145#endif /* BCMDBG */ 3102#endif /* DEBUG */
3146 3103
3147 kfree(vbuffer); 3104 kfree(vbuffer);
3148 } 3105 }
@@ -3569,9 +3526,9 @@ void brcmf_sdbrcm_isr(void *arg)
3569 3526
3570static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) 3527static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
3571{ 3528{
3572#ifdef BCMDBG 3529#ifdef DEBUG
3573 struct brcmf_bus *bus_if = dev_get_drvdata(bus->sdiodev->dev); 3530 struct brcmf_bus *bus_if = dev_get_drvdata(bus->sdiodev->dev);
3574#endif /* BCMDBG */ 3531#endif /* DEBUG */
3575 3532
3576 brcmf_dbg(TIMER, "Enter\n"); 3533 brcmf_dbg(TIMER, "Enter\n");
3577 3534
@@ -3616,7 +3573,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
3616 /* Update interrupt tracking */ 3573 /* Update interrupt tracking */
3617 bus->lastintrs = bus->intrcount; 3574 bus->lastintrs = bus->intrcount;
3618 } 3575 }
3619#ifdef BCMDBG 3576#ifdef DEBUG
3620 /* Poll for console output periodically */ 3577 /* Poll for console output periodically */
3621 if (bus_if->state == BRCMF_BUS_DATA && 3578 if (bus_if->state == BRCMF_BUS_DATA &&
3622 bus->console_interval != 0) { 3579 bus->console_interval != 0) {
@@ -3630,7 +3587,7 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus)
3630 bus->console_interval = 0; 3587 bus->console_interval = 0;
3631 } 3588 }
3632 } 3589 }
3633#endif /* BCMDBG */ 3590#endif /* DEBUG */
3634 3591
3635 /* On idle timeout clear activity flag and/or turn off clock */ 3592 /* On idle timeout clear activity flag and/or turn off clock */
3636 if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) { 3593 if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
@@ -3721,11 +3678,8 @@ brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus, u32 regsva)
3721 if (brcmf_sdcard_set_sbaddr_window(bus->sdiodev, SI_ENUM_BASE)) 3678 if (brcmf_sdcard_set_sbaddr_window(bus->sdiodev, SI_ENUM_BASE))
3722 brcmf_dbg(ERROR, "FAILED to return to SI_ENUM_BASE\n"); 3679 brcmf_dbg(ERROR, "FAILED to return to SI_ENUM_BASE\n");
3723 3680
3724#ifdef BCMDBG 3681 pr_debug("F1 signature read @0x18000000=0x%4x\n",
3725 printk(KERN_DEBUG "F1 signature read @0x18000000=0x%4x\n", 3682 brcmf_sdcard_reg_read(bus->sdiodev, SI_ENUM_BASE, 4));
3726 brcmf_sdcard_reg_read(bus->sdiodev, SI_ENUM_BASE, 4));
3727
3728#endif /* BCMDBG */
3729 3683
3730 /* 3684 /*
3731 * Force PLL off until brcmf_sdio_chip_attach() 3685 * Force PLL off until brcmf_sdio_chip_attach()
@@ -3944,8 +3898,7 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev)
3944 bus->watchdog_tsk = kthread_run(brcmf_sdbrcm_watchdog_thread, 3898 bus->watchdog_tsk = kthread_run(brcmf_sdbrcm_watchdog_thread,
3945 bus, "brcmf_watchdog"); 3899 bus, "brcmf_watchdog");
3946 if (IS_ERR(bus->watchdog_tsk)) { 3900 if (IS_ERR(bus->watchdog_tsk)) {
3947 printk(KERN_WARNING 3901 pr_warn("brcmf_watchdog thread failed to start\n");
3948 "brcmf_watchdog thread failed to start\n");
3949 bus->watchdog_tsk = NULL; 3902 bus->watchdog_tsk = NULL;
3950 } 3903 }
3951 /* Initialize DPC thread */ 3904 /* Initialize DPC thread */
@@ -3953,8 +3906,7 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev)
3953 bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, 3906 bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread,
3954 bus, "brcmf_dpc"); 3907 bus, "brcmf_dpc");
3955 if (IS_ERR(bus->dpc_tsk)) { 3908 if (IS_ERR(bus->dpc_tsk)) {
3956 printk(KERN_WARNING 3909 pr_warn("brcmf_dpc thread failed to start\n");
3957 "brcmf_dpc thread failed to start\n");
3958 bus->dpc_tsk = NULL; 3910 bus->dpc_tsk = NULL;
3959 } 3911 }
3960 3912
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
index 11b2d7c97ba2..1534efc21631 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
@@ -15,6 +15,8 @@
15 */ 15 */
16/* ***** SDIO interface chip backplane handle functions ***** */ 16/* ***** SDIO interface chip backplane handle functions ***** */
17 17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19
18#include <linux/types.h> 20#include <linux/types.h>
19#include <linux/netdevice.h> 21#include <linux/netdevice.h>
20#include <linux/mmc/card.h> 22#include <linux/mmc/card.h>
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index bf11850a20f1..74c95a597950 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -16,6 +16,8 @@
16 16
17/* Toplevel file. Relies on dhd_linux.c to send commands to the dongle. */ 17/* Toplevel file. Relies on dhd_linux.c to send commands to the dongle. */
18 18
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20
19#include <linux/kernel.h> 21#include <linux/kernel.h>
20#include <linux/if_arp.h> 22#include <linux/if_arp.h>
21#include <linux/sched.h> 23#include <linux/sched.h>
@@ -2783,7 +2785,7 @@ static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
2783 wiphy_new(&wl_cfg80211_ops, 2785 wiphy_new(&wl_cfg80211_ops,
2784 sizeof(struct brcmf_cfg80211_priv) + sizeof_iface); 2786 sizeof(struct brcmf_cfg80211_priv) + sizeof_iface);
2785 if (!wdev->wiphy) { 2787 if (!wdev->wiphy) {
2786 WL_ERR("Couldn not allocate wiphy device\n"); 2788 WL_ERR("Could not allocate wiphy device\n");
2787 err = -ENOMEM; 2789 err = -ENOMEM;
2788 goto wiphy_new_out; 2790 goto wiphy_new_out;
2789 } 2791 }
@@ -2809,7 +2811,7 @@ static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface,
2809 */ 2811 */
2810 err = wiphy_register(wdev->wiphy); 2812 err = wiphy_register(wdev->wiphy);
2811 if (err < 0) { 2813 if (err < 0) {
2812 WL_ERR("Couldn not register wiphy device (%d)\n", err); 2814 WL_ERR("Could not register wiphy device (%d)\n", err);
2813 goto wiphy_register_out; 2815 goto wiphy_register_out;
2814 } 2816 }
2815 return wdev; 2817 return wdev;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
index a613b49cb13f..b5d9b36df3d0 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
@@ -32,63 +32,63 @@ struct brcmf_cfg80211_ibss;
32#define WL_DBG_MASK ((WL_DBG_INFO | WL_DBG_ERR | WL_DBG_TRACE) | \ 32#define WL_DBG_MASK ((WL_DBG_INFO | WL_DBG_ERR | WL_DBG_TRACE) | \
33 (WL_DBG_SCAN) | (WL_DBG_CONN)) 33 (WL_DBG_SCAN) | (WL_DBG_CONN))
34 34
35#define WL_ERR(fmt, args...) \ 35#define WL_ERR(fmt, ...) \
36do { \ 36do { \
37 if (brcmf_dbg_level & WL_DBG_ERR) { \ 37 if (brcmf_dbg_level & WL_DBG_ERR) { \
38 if (net_ratelimit()) { \ 38 if (net_ratelimit()) { \
39 printk(KERN_ERR "ERROR @%s : " fmt, \ 39 pr_err("ERROR @%s : " fmt, \
40 __func__, ##args); \ 40 __func__, ##__VA_ARGS__); \
41 } \ 41 } \
42 } \ 42 } \
43} while (0) 43} while (0)
44 44
45#if (defined BCMDBG) 45#if (defined DEBUG)
46#define WL_INFO(fmt, args...) \ 46#define WL_INFO(fmt, ...) \
47do { \ 47do { \
48 if (brcmf_dbg_level & WL_DBG_INFO) { \ 48 if (brcmf_dbg_level & WL_DBG_INFO) { \
49 if (net_ratelimit()) { \ 49 if (net_ratelimit()) { \
50 printk(KERN_ERR "INFO @%s : " fmt, \ 50 pr_err("INFO @%s : " fmt, \
51 __func__, ##args); \ 51 __func__, ##__VA_ARGS__); \
52 } \ 52 } \
53 } \ 53 } \
54} while (0) 54} while (0)
55 55
56#define WL_TRACE(fmt, args...) \ 56#define WL_TRACE(fmt, ...) \
57do { \ 57do { \
58 if (brcmf_dbg_level & WL_DBG_TRACE) { \ 58 if (brcmf_dbg_level & WL_DBG_TRACE) { \
59 if (net_ratelimit()) { \ 59 if (net_ratelimit()) { \
60 printk(KERN_ERR "TRACE @%s : " fmt, \ 60 pr_err("TRACE @%s : " fmt, \
61 __func__, ##args); \ 61 __func__, ##__VA_ARGS__); \
62 } \ 62 } \
63 } \ 63 } \
64} while (0) 64} while (0)
65 65
66#define WL_SCAN(fmt, args...) \ 66#define WL_SCAN(fmt, ...) \
67do { \ 67do { \
68 if (brcmf_dbg_level & WL_DBG_SCAN) { \ 68 if (brcmf_dbg_level & WL_DBG_SCAN) { \
69 if (net_ratelimit()) { \ 69 if (net_ratelimit()) { \
70 printk(KERN_ERR "SCAN @%s : " fmt, \ 70 pr_err("SCAN @%s : " fmt, \
71 __func__, ##args); \ 71 __func__, ##__VA_ARGS__); \
72 } \ 72 } \
73 } \ 73 } \
74} while (0) 74} while (0)
75 75
76#define WL_CONN(fmt, args...) \ 76#define WL_CONN(fmt, ...) \
77do { \ 77do { \
78 if (brcmf_dbg_level & WL_DBG_CONN) { \ 78 if (brcmf_dbg_level & WL_DBG_CONN) { \
79 if (net_ratelimit()) { \ 79 if (net_ratelimit()) { \
80 printk(KERN_ERR "CONN @%s : " fmt, \ 80 pr_err("CONN @%s : " fmt, \
81 __func__, ##args); \ 81 __func__, ##__VA_ARGS__); \
82 } \ 82 } \
83 } \ 83 } \
84} while (0) 84} while (0)
85 85
86#else /* (defined BCMDBG) */ 86#else /* (defined DEBUG) */
87#define WL_INFO(fmt, args...) 87#define WL_INFO(fmt, args...)
88#define WL_TRACE(fmt, args...) 88#define WL_TRACE(fmt, args...)
89#define WL_SCAN(fmt, args...) 89#define WL_SCAN(fmt, args...)
90#define WL_CONN(fmt, args...) 90#define WL_CONN(fmt, args...)
91#endif /* (defined BCMDBG) */ 91#endif /* (defined DEBUG) */
92 92
93#define WL_NUM_SCAN_MAX 1 93#define WL_NUM_SCAN_MAX 1
94#define WL_NUM_PMKIDS_MAX MAXPMKID /* will be used 94#define WL_NUM_PMKIDS_MAX MAXPMKID /* will be used
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index ab9bb11abfbb..c93ea35bceec 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -326,11 +326,11 @@
326 326
327#define PCI_FORCEHT(sih) (PCIE(sih) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID)) 327#define PCI_FORCEHT(sih) (PCIE(sih) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID))
328 328
329#ifdef BCMDBG 329#ifdef DEBUG
330#define SI_MSG(fmt, ...) pr_debug(fmt, ##__VA_ARGS__) 330#define SI_MSG(fmt, ...) pr_debug(fmt, ##__VA_ARGS__)
331#else 331#else
332#define SI_MSG(fmt, ...) no_printk(fmt, ##__VA_ARGS__) 332#define SI_MSG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
333#endif /* BCMDBG */ 333#endif /* DEBUG */
334 334
335#define GOODCOREADDR(x, b) \ 335#define GOODCOREADDR(x, b) \
336 (((x) >= (b)) && ((x) < ((b) + SI_MAXCORES * SI_CORE_SIZE)) && \ 336 (((x) >= (b)) && ((x) < ((b) + SI_MAXCORES * SI_CORE_SIZE)) && \
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
index 90911eec0cf5..d89dcb14cb6d 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
@@ -915,7 +915,7 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
915 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p); 915 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p);
916 struct wiphy *wiphy = wlc->wiphy; 916 struct wiphy *wiphy = wlc->wiphy;
917 917
918#ifdef BCMDBG 918#ifdef DEBUG
919 u8 hole[AMPDU_MAX_MPDU]; 919 u8 hole[AMPDU_MAX_MPDU];
920 memset(hole, 0, sizeof(hole)); 920 memset(hole, 0, sizeof(hole));
921#endif 921#endif
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index 2e90a9a16ed6..11054ae9d4f6 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -177,7 +177,7 @@
177#define BCMEXTRAHDROOM 172 177#define BCMEXTRAHDROOM 172
178 178
179/* debug/trace */ 179/* debug/trace */
180#ifdef BCMDBG 180#ifdef DEBUG
181#define DMA_ERROR(fmt, ...) \ 181#define DMA_ERROR(fmt, ...) \
182do { \ 182do { \
183 if (*di->msg_level & 1) \ 183 if (*di->msg_level & 1) \
@@ -193,7 +193,7 @@ do { \
193 no_printk(fmt, ##__VA_ARGS__) 193 no_printk(fmt, ##__VA_ARGS__)
194#define DMA_TRACE(fmt, ...) \ 194#define DMA_TRACE(fmt, ...) \
195 no_printk(fmt, ##__VA_ARGS__) 195 no_printk(fmt, ##__VA_ARGS__)
196#endif /* BCMDBG */ 196#endif /* DEBUG */
197 197
198#define DMA_NONE(fmt, ...) \ 198#define DMA_NONE(fmt, ...) \
199 no_printk(fmt, ##__VA_ARGS__) 199 no_printk(fmt, ##__VA_ARGS__)
@@ -968,7 +968,7 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list)
968 pktcnt++; 968 pktcnt++;
969 } 969 }
970 970
971#ifdef BCMDBG 971#ifdef DEBUG
972 if (resid > 0) { 972 if (resid > 0) {
973 uint cur; 973 uint cur;
974 cur = 974 cur =
@@ -979,7 +979,7 @@ int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list)
979 DMA_ERROR("rxin %d rxout %d, hw_curr %d\n", 979 DMA_ERROR("rxin %d rxout %d, hw_curr %d\n",
980 di->rxin, di->rxout, cur); 980 di->rxin, di->rxout, cur);
981 } 981 }
982#endif /* BCMDBG */ 982#endif /* DEBUG */
983 983
984 if ((di->dma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) { 984 if ((di->dma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) {
985 DMA_ERROR("%s: bad frame length (%d)\n", 985 DMA_ERROR("%s: bad frame length (%d)\n",
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 448ab9c4eb47..c8427978d09e 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#define __UNDEF_NO_VERSION__ 17#define __UNDEF_NO_VERSION__
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18 19
19#include <linux/etherdevice.h> 20#include <linux/etherdevice.h>
20#include <linux/sched.h> 21#include <linux/sched.h>
@@ -96,10 +97,10 @@ static struct bcma_device_id brcms_coreid_table[] = {
96}; 97};
97MODULE_DEVICE_TABLE(bcma, brcms_coreid_table); 98MODULE_DEVICE_TABLE(bcma, brcms_coreid_table);
98 99
99#ifdef BCMDBG 100#ifdef DEBUG
100static int msglevel = 0xdeadbeef; 101static int msglevel = 0xdeadbeef;
101module_param(msglevel, int, 0); 102module_param(msglevel, int, 0);
102#endif /* BCMDBG */ 103#endif /* DEBUG */
103 104
104static struct ieee80211_channel brcms_2ghz_chantable[] = { 105static struct ieee80211_channel brcms_2ghz_chantable[] = {
105 CHAN2GHZ(1, 2412, IEEE80211_CHAN_NO_HT40MINUS), 106 CHAN2GHZ(1, 2412, IEEE80211_CHAN_NO_HT40MINUS),
@@ -857,7 +858,7 @@ static void brcms_free(struct brcms_info *wl)
857 /* free timers */ 858 /* free timers */
858 for (t = wl->timers; t; t = next) { 859 for (t = wl->timers; t; t = next) {
859 next = t->next; 860 next = t->next;
860#ifdef BCMDBG 861#ifdef DEBUG
861 kfree(t->name); 862 kfree(t->name);
862#endif 863#endif
863 kfree(t); 864 kfree(t);
@@ -1121,8 +1122,7 @@ static int __devinit brcms_bcma_probe(struct bcma_device *pdev)
1121 1122
1122 wl = brcms_attach(pdev); 1123 wl = brcms_attach(pdev);
1123 if (!wl) { 1124 if (!wl) {
1124 pr_err("%s: %s: brcms_attach failed!\n", KBUILD_MODNAME, 1125 pr_err("%s: brcms_attach failed!\n", __func__);
1125 __func__);
1126 return -ENODEV; 1126 return -ENODEV;
1127 } 1127 }
1128 return 0; 1128 return 0;
@@ -1177,13 +1177,13 @@ static int __init brcms_module_init(void)
1177{ 1177{
1178 int error = -ENODEV; 1178 int error = -ENODEV;
1179 1179
1180#ifdef BCMDBG 1180#ifdef DEBUG
1181 if (msglevel != 0xdeadbeef) 1181 if (msglevel != 0xdeadbeef)
1182 brcm_msg_level = msglevel; 1182 brcm_msg_level = msglevel;
1183#endif /* BCMDBG */ 1183#endif /* DEBUG */
1184 1184
1185 error = bcma_driver_register(&brcms_bcma_driver); 1185 error = bcma_driver_register(&brcms_bcma_driver);
1186 printk(KERN_ERR "%s: register returned %d\n", __func__, error); 1186 pr_err("%s: register returned %d\n", __func__, error);
1187 if (!error) 1187 if (!error)
1188 return 0; 1188 return 0;
1189 1189
@@ -1367,7 +1367,7 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
1367 t->next = wl->timers; 1367 t->next = wl->timers;
1368 wl->timers = t; 1368 wl->timers = t;
1369 1369
1370#ifdef BCMDBG 1370#ifdef DEBUG
1371 t->name = kmalloc(strlen(name) + 1, GFP_ATOMIC); 1371 t->name = kmalloc(strlen(name) + 1, GFP_ATOMIC);
1372 if (t->name) 1372 if (t->name)
1373 strcpy(t->name, name); 1373 strcpy(t->name, name);
@@ -1386,7 +1386,7 @@ void brcms_add_timer(struct brcms_timer *t, uint ms, int periodic)
1386{ 1386{
1387 struct ieee80211_hw *hw = t->wl->pub->ieee_hw; 1387 struct ieee80211_hw *hw = t->wl->pub->ieee_hw;
1388 1388
1389#ifdef BCMDBG 1389#ifdef DEBUG
1390 if (t->set) 1390 if (t->set)
1391 wiphy_err(hw->wiphy, "%s: Already set. Name: %s, per %d\n", 1391 wiphy_err(hw->wiphy, "%s: Already set. Name: %s, per %d\n",
1392 __func__, t->name, periodic); 1392 __func__, t->name, periodic);
@@ -1431,7 +1431,7 @@ void brcms_free_timer(struct brcms_timer *t)
1431 1431
1432 if (wl->timers == t) { 1432 if (wl->timers == t) {
1433 wl->timers = wl->timers->next; 1433 wl->timers = wl->timers->next;
1434#ifdef BCMDBG 1434#ifdef DEBUG
1435 kfree(t->name); 1435 kfree(t->name);
1436#endif 1436#endif
1437 kfree(t); 1437 kfree(t);
@@ -1443,7 +1443,7 @@ void brcms_free_timer(struct brcms_timer *t)
1443 while (tmp) { 1443 while (tmp) {
1444 if (tmp->next == t) { 1444 if (tmp->next == t) {
1445 tmp->next = t->next; 1445 tmp->next = t->next;
1446#ifdef BCMDBG 1446#ifdef DEBUG
1447 kfree(t->name); 1447 kfree(t->name);
1448#endif 1448#endif
1449 kfree(t); 1449 kfree(t);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h
index 8f60419c37bf..9358bd5ebd35 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h
@@ -40,7 +40,7 @@ struct brcms_timer {
40 bool periodic; 40 bool periodic;
41 bool set; /* indicates if timer is active */ 41 bool set; /* indicates if timer is active */
42 struct brcms_timer *next; /* for freeing on unload */ 42 struct brcms_timer *next; /* for freeing on unload */
43#ifdef BCMDBG 43#ifdef DEBUG
44 char *name; /* Description of the timer */ 44 char *name; /* Description of the timer */
45#endif 45#endif
46}; 46};
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index f6affc6fd12a..fb712cac9157 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -14,6 +14,8 @@
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/pci_ids.h> 19#include <linux/pci_ids.h>
18#include <linux/if_ether.h> 20#include <linux/if_ether.h>
19#include <net/mac80211.h> 21#include <net/mac80211.h>
@@ -293,11 +295,11 @@ const u8 prio2fifo[NUMPRIO] = {
293 295
294/* debug/trace */ 296/* debug/trace */
295uint brcm_msg_level = 297uint brcm_msg_level =
296#if defined(BCMDBG) 298#if defined(DEBUG)
297 LOG_ERROR_VAL; 299 LOG_ERROR_VAL;
298#else 300#else
299 0; 301 0;
300#endif /* BCMDBG */ 302#endif /* DEBUG */
301 303
302/* TX FIFO number to WME/802.1E Access Category */ 304/* TX FIFO number to WME/802.1E Access Category */
303static const u8 wme_fifo2ac[] = { 305static const u8 wme_fifo2ac[] = {
@@ -342,14 +344,14 @@ static const u16 xmtfifo_sz[][NFIFO] = {
342 {9, 58, 22, 14, 14, 5}, 344 {9, 58, 22, 14, 14, 5},
343}; 345};
344 346
345#ifdef BCMDBG 347#ifdef DEBUG
346static const char * const fifo_names[] = { 348static const char * const fifo_names[] = {
347 "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" }; 349 "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
348#else 350#else
349static const char fifo_names[6][0]; 351static const char fifo_names[6][0];
350#endif 352#endif
351 353
352#ifdef BCMDBG 354#ifdef DEBUG
353/* pointer to most recently allocated wl/wlc */ 355/* pointer to most recently allocated wl/wlc */
354static struct brcms_c_info *wlc_info_dbg = (struct brcms_c_info *) (NULL); 356static struct brcms_c_info *wlc_info_dbg = (struct brcms_c_info *) (NULL);
355#endif 357#endif
@@ -3075,30 +3077,30 @@ static void brcms_c_statsupd(struct brcms_c_info *wlc)
3075{ 3077{
3076 int i; 3078 int i;
3077 struct macstat macstats; 3079 struct macstat macstats;
3078#ifdef BCMDBG 3080#ifdef DEBUG
3079 u16 delta; 3081 u16 delta;
3080 u16 rxf0ovfl; 3082 u16 rxf0ovfl;
3081 u16 txfunfl[NFIFO]; 3083 u16 txfunfl[NFIFO];
3082#endif /* BCMDBG */ 3084#endif /* DEBUG */
3083 3085
3084 /* if driver down, make no sense to update stats */ 3086 /* if driver down, make no sense to update stats */
3085 if (!wlc->pub->up) 3087 if (!wlc->pub->up)
3086 return; 3088 return;
3087 3089
3088#ifdef BCMDBG 3090#ifdef DEBUG
3089 /* save last rx fifo 0 overflow count */ 3091 /* save last rx fifo 0 overflow count */
3090 rxf0ovfl = wlc->core->macstat_snapshot->rxf0ovfl; 3092 rxf0ovfl = wlc->core->macstat_snapshot->rxf0ovfl;
3091 3093
3092 /* save last tx fifo underflow count */ 3094 /* save last tx fifo underflow count */
3093 for (i = 0; i < NFIFO; i++) 3095 for (i = 0; i < NFIFO; i++)
3094 txfunfl[i] = wlc->core->macstat_snapshot->txfunfl[i]; 3096 txfunfl[i] = wlc->core->macstat_snapshot->txfunfl[i];
3095#endif /* BCMDBG */ 3097#endif /* DEBUG */
3096 3098
3097 /* Read mac stats from contiguous shared memory */ 3099 /* Read mac stats from contiguous shared memory */
3098 brcms_b_copyfrom_objmem(wlc->hw, M_UCODE_MACSTAT, &macstats, 3100 brcms_b_copyfrom_objmem(wlc->hw, M_UCODE_MACSTAT, &macstats,
3099 sizeof(struct macstat), OBJADDR_SHM_SEL); 3101 sizeof(struct macstat), OBJADDR_SHM_SEL);
3100 3102
3101#ifdef BCMDBG 3103#ifdef DEBUG
3102 /* check for rx fifo 0 overflow */ 3104 /* check for rx fifo 0 overflow */
3103 delta = (u16) (wlc->core->macstat_snapshot->rxf0ovfl - rxf0ovfl); 3105 delta = (u16) (wlc->core->macstat_snapshot->rxf0ovfl - rxf0ovfl);
3104 if (delta) 3106 if (delta)
@@ -3114,7 +3116,7 @@ static void brcms_c_statsupd(struct brcms_c_info *wlc)
3114 wiphy_err(wlc->wiphy, "wl%d: %u tx fifo %d underflows!" 3116 wiphy_err(wlc->wiphy, "wl%d: %u tx fifo %d underflows!"
3115 "\n", wlc->pub->unit, delta, i); 3117 "\n", wlc->pub->unit, delta, i);
3116 } 3118 }
3117#endif /* BCMDBG */ 3119#endif /* DEBUG */
3118 3120
3119 /* merge counters from dma module */ 3121 /* merge counters from dma module */
3120 for (i = 0; i < NFIFO; i++) { 3122 for (i = 0; i < NFIFO; i++) {
@@ -5765,62 +5767,49 @@ int brcms_c_module_unregister(struct brcms_pub *pub, const char *name,
5765 return -ENODATA; 5767 return -ENODATA;
5766} 5768}
5767 5769
5768#ifdef BCMDBG
5769static const char * const supr_reason[] = {
5770 "None", "PMQ Entry", "Flush request",
5771 "Previous frag failure", "Channel mismatch",
5772 "Lifetime Expiry", "Underflow"
5773};
5774
5775static void brcms_c_print_txs_status(u16 s)
5776{
5777 printk(KERN_DEBUG "[15:12] %d frame attempts\n",
5778 (s & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT);
5779 printk(KERN_DEBUG " [11:8] %d rts attempts\n",
5780 (s & TX_STATUS_RTS_RTX_MASK) >> TX_STATUS_RTS_RTX_SHIFT);
5781 printk(KERN_DEBUG " [7] %d PM mode indicated\n",
5782 ((s & TX_STATUS_PMINDCTD) ? 1 : 0));
5783 printk(KERN_DEBUG " [6] %d intermediate status\n",
5784 ((s & TX_STATUS_INTERMEDIATE) ? 1 : 0));
5785 printk(KERN_DEBUG " [5] %d AMPDU\n",
5786 (s & TX_STATUS_AMPDU) ? 1 : 0);
5787 printk(KERN_DEBUG " [4:2] %d Frame Suppressed Reason (%s)\n",
5788 ((s & TX_STATUS_SUPR_MASK) >> TX_STATUS_SUPR_SHIFT),
5789 supr_reason[(s & TX_STATUS_SUPR_MASK) >> TX_STATUS_SUPR_SHIFT]);
5790 printk(KERN_DEBUG " [1] %d acked\n",
5791 ((s & TX_STATUS_ACK_RCV) ? 1 : 0));
5792}
5793#endif /* BCMDBG */
5794
5795void brcms_c_print_txstatus(struct tx_status *txs) 5770void brcms_c_print_txstatus(struct tx_status *txs)
5796{ 5771{
5797#if defined(BCMDBG) 5772 pr_debug("\ntxpkt (MPDU) Complete\n");
5798 u16 s = txs->status; 5773
5799 u16 ackphyrxsh = txs->ackphyrxsh; 5774 pr_debug("FrameID: %04x TxStatus: %04x\n", txs->frameid, txs->status);
5800 5775
5801 printk(KERN_DEBUG "\ntxpkt (MPDU) Complete\n"); 5776 pr_debug("[15:12] %d frame attempts\n",
5802 5777 (txs->status & TX_STATUS_FRM_RTX_MASK) >>
5803 printk(KERN_DEBUG "FrameID: %04x ", txs->frameid); 5778 TX_STATUS_FRM_RTX_SHIFT);
5804 printk(KERN_DEBUG "TxStatus: %04x", s); 5779 pr_debug(" [11:8] %d rts attempts\n",
5805 printk(KERN_DEBUG "\n"); 5780 (txs->status & TX_STATUS_RTS_RTX_MASK) >>
5806 5781 TX_STATUS_RTS_RTX_SHIFT);
5807 brcms_c_print_txs_status(s); 5782 pr_debug(" [7] %d PM mode indicated\n",
5808 5783 txs->status & TX_STATUS_PMINDCTD ? 1 : 0);
5809 printk(KERN_DEBUG "LastTxTime: %04x ", txs->lasttxtime); 5784 pr_debug(" [6] %d intermediate status\n",
5810 printk(KERN_DEBUG "Seq: %04x ", txs->sequence); 5785 txs->status & TX_STATUS_INTERMEDIATE ? 1 : 0);
5811 printk(KERN_DEBUG "PHYTxStatus: %04x ", txs->phyerr); 5786 pr_debug(" [5] %d AMPDU\n",
5812 printk(KERN_DEBUG "RxAckRSSI: %04x ", 5787 txs->status & TX_STATUS_AMPDU ? 1 : 0);
5813 (ackphyrxsh & PRXS1_JSSI_MASK) >> PRXS1_JSSI_SHIFT); 5788 pr_debug(" [4:2] %d Frame Suppressed Reason (%s)\n",
5814 printk(KERN_DEBUG "RxAckSQ: %04x", 5789 (txs->status & TX_STATUS_SUPR_MASK) >> TX_STATUS_SUPR_SHIFT,
5815 (ackphyrxsh & PRXS1_SQ_MASK) >> PRXS1_SQ_SHIFT); 5790 (const char *[]) {
5816 printk(KERN_DEBUG "\n"); 5791 "None",
5817#endif /* defined(BCMDBG) */ 5792 "PMQ Entry",
5793 "Flush request",
5794 "Previous frag failure",
5795 "Channel mismatch",
5796 "Lifetime Expiry",
5797 "Underflow"
5798 } [(txs->status & TX_STATUS_SUPR_MASK) >>
5799 TX_STATUS_SUPR_SHIFT]);
5800 pr_debug(" [1] %d acked\n",
5801 txs->status & TX_STATUS_ACK_RCV ? 1 : 0);
5802
5803 pr_debug("LastTxTime: %04x Seq: %04x PHYTxStatus: %04x RxAckRSSI: %04x RxAckSQ: %04x\n",
5804 txs->lasttxtime, txs->sequence, txs->phyerr,
5805 (txs->ackphyrxsh & PRXS1_JSSI_MASK) >> PRXS1_JSSI_SHIFT,
5806 (txs->ackphyrxsh & PRXS1_SQ_MASK) >> PRXS1_SQ_SHIFT);
5818} 5807}
5819 5808
5820bool brcms_c_chipmatch(u16 vendor, u16 device) 5809bool brcms_c_chipmatch(u16 vendor, u16 device)
5821{ 5810{
5822 if (vendor != PCI_VENDOR_ID_BROADCOM) { 5811 if (vendor != PCI_VENDOR_ID_BROADCOM) {
5823 pr_err("chipmatch: unknown vendor id %04x\n", vendor); 5812 pr_err("unknown vendor id %04x\n", vendor);
5824 return false; 5813 return false;
5825 } 5814 }
5826 5815
@@ -5833,11 +5822,11 @@ bool brcms_c_chipmatch(u16 vendor, u16 device)
5833 if ((device == BCM43236_D11N_ID) || (device == BCM43236_D11N2G_ID)) 5822 if ((device == BCM43236_D11N_ID) || (device == BCM43236_D11N2G_ID))
5834 return true; 5823 return true;
5835 5824
5836 pr_err("chipmatch: unknown device id %04x\n", device); 5825 pr_err("unknown device id %04x\n", device);
5837 return false; 5826 return false;
5838} 5827}
5839 5828
5840#if defined(BCMDBG) 5829#if defined(DEBUG)
5841void brcms_c_print_txdesc(struct d11txh *txh) 5830void brcms_c_print_txdesc(struct d11txh *txh)
5842{ 5831{
5843 u16 mtcl = le16_to_cpu(txh->MacTxControlLow); 5832 u16 mtcl = le16_to_cpu(txh->MacTxControlLow);
@@ -5871,57 +5860,56 @@ void brcms_c_print_txdesc(struct d11txh *txh)
5871 struct ieee80211_rts rts = txh->rts_frame; 5860 struct ieee80211_rts rts = txh->rts_frame;
5872 5861
5873 /* add plcp header along with txh descriptor */ 5862 /* add plcp header along with txh descriptor */
5874 printk(KERN_DEBUG "Raw TxDesc + plcp header:\n"); 5863 brcmu_dbg_hex_dump(txh, sizeof(struct d11txh) + 48,
5875 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, 5864 "Raw TxDesc + plcp header:\n");
5876 txh, sizeof(struct d11txh) + 48); 5865
5877 5866 pr_debug("TxCtlLow: %04x ", mtcl);
5878 printk(KERN_DEBUG "TxCtlLow: %04x ", mtcl); 5867 pr_debug("TxCtlHigh: %04x ", mtch);
5879 printk(KERN_DEBUG "TxCtlHigh: %04x ", mtch); 5868 pr_debug("FC: %04x ", mfc);
5880 printk(KERN_DEBUG "FC: %04x ", mfc); 5869 pr_debug("FES Time: %04x\n", tfest);
5881 printk(KERN_DEBUG "FES Time: %04x\n", tfest); 5870 pr_debug("PhyCtl: %04x%s ", ptcw,
5882 printk(KERN_DEBUG "PhyCtl: %04x%s ", ptcw,
5883 (ptcw & PHY_TXC_SHORT_HDR) ? " short" : ""); 5871 (ptcw & PHY_TXC_SHORT_HDR) ? " short" : "");
5884 printk(KERN_DEBUG "PhyCtl_1: %04x ", ptcw_1); 5872 pr_debug("PhyCtl_1: %04x ", ptcw_1);
5885 printk(KERN_DEBUG "PhyCtl_1_Fbr: %04x\n", ptcw_1_Fbr); 5873 pr_debug("PhyCtl_1_Fbr: %04x\n", ptcw_1_Fbr);
5886 printk(KERN_DEBUG "PhyCtl_1_Rts: %04x ", ptcw_1_Rts); 5874 pr_debug("PhyCtl_1_Rts: %04x ", ptcw_1_Rts);
5887 printk(KERN_DEBUG "PhyCtl_1_Fbr_Rts: %04x\n", ptcw_1_FbrRts); 5875 pr_debug("PhyCtl_1_Fbr_Rts: %04x\n", ptcw_1_FbrRts);
5888 printk(KERN_DEBUG "MainRates: %04x ", mainrates); 5876 pr_debug("MainRates: %04x ", mainrates);
5889 printk(KERN_DEBUG "XtraFrameTypes: %04x ", xtraft); 5877 pr_debug("XtraFrameTypes: %04x ", xtraft);
5890 printk(KERN_DEBUG "\n"); 5878 pr_debug("\n");
5891 5879
5892 print_hex_dump_bytes("SecIV:", DUMP_PREFIX_OFFSET, iv, sizeof(txh->IV)); 5880 print_hex_dump_bytes("SecIV:", DUMP_PREFIX_OFFSET, iv, sizeof(txh->IV));
5893 print_hex_dump_bytes("RA:", DUMP_PREFIX_OFFSET, 5881 print_hex_dump_bytes("RA:", DUMP_PREFIX_OFFSET,
5894 ra, sizeof(txh->TxFrameRA)); 5882 ra, sizeof(txh->TxFrameRA));
5895 5883
5896 printk(KERN_DEBUG "Fb FES Time: %04x ", tfestfb); 5884 pr_debug("Fb FES Time: %04x ", tfestfb);
5897 print_hex_dump_bytes("Fb RTS PLCP:", DUMP_PREFIX_OFFSET, 5885 print_hex_dump_bytes("Fb RTS PLCP:", DUMP_PREFIX_OFFSET,
5898 rtspfb, sizeof(txh->RTSPLCPFallback)); 5886 rtspfb, sizeof(txh->RTSPLCPFallback));
5899 printk(KERN_DEBUG "RTS DUR: %04x ", rtsdfb); 5887 pr_debug("RTS DUR: %04x ", rtsdfb);
5900 print_hex_dump_bytes("PLCP:", DUMP_PREFIX_OFFSET, 5888 print_hex_dump_bytes("PLCP:", DUMP_PREFIX_OFFSET,
5901 fragpfb, sizeof(txh->FragPLCPFallback)); 5889 fragpfb, sizeof(txh->FragPLCPFallback));
5902 printk(KERN_DEBUG "DUR: %04x", fragdfb); 5890 pr_debug("DUR: %04x", fragdfb);
5903 printk(KERN_DEBUG "\n"); 5891 pr_debug("\n");
5904 5892
5905 printk(KERN_DEBUG "MModeLen: %04x ", mmodelen); 5893 pr_debug("MModeLen: %04x ", mmodelen);
5906 printk(KERN_DEBUG "MModeFbrLen: %04x\n", mmodefbrlen); 5894 pr_debug("MModeFbrLen: %04x\n", mmodefbrlen);
5907 5895
5908 printk(KERN_DEBUG "FrameID: %04x\n", tfid); 5896 pr_debug("FrameID: %04x\n", tfid);
5909 printk(KERN_DEBUG "TxStatus: %04x\n", txs); 5897 pr_debug("TxStatus: %04x\n", txs);
5910 5898
5911 printk(KERN_DEBUG "MaxNumMpdu: %04x\n", mnmpdu); 5899 pr_debug("MaxNumMpdu: %04x\n", mnmpdu);
5912 printk(KERN_DEBUG "MaxAggbyte: %04x\n", mabyte); 5900 pr_debug("MaxAggbyte: %04x\n", mabyte);
5913 printk(KERN_DEBUG "MaxAggbyte_fb: %04x\n", mabyte_f); 5901 pr_debug("MaxAggbyte_fb: %04x\n", mabyte_f);
5914 printk(KERN_DEBUG "MinByte: %04x\n", mmbyte); 5902 pr_debug("MinByte: %04x\n", mmbyte);
5915 5903
5916 print_hex_dump_bytes("RTS PLCP:", DUMP_PREFIX_OFFSET, 5904 print_hex_dump_bytes("RTS PLCP:", DUMP_PREFIX_OFFSET,
5917 rtsph, sizeof(txh->RTSPhyHeader)); 5905 rtsph, sizeof(txh->RTSPhyHeader));
5918 print_hex_dump_bytes("RTS Frame:", DUMP_PREFIX_OFFSET, 5906 print_hex_dump_bytes("RTS Frame:", DUMP_PREFIX_OFFSET,
5919 (u8 *)&rts, sizeof(txh->rts_frame)); 5907 (u8 *)&rts, sizeof(txh->rts_frame));
5920 printk(KERN_DEBUG "\n"); 5908 pr_debug("\n");
5921} 5909}
5922#endif /* defined(BCMDBG) */ 5910#endif /* defined(DEBUG) */
5923 5911
5924#if defined(BCMDBG) 5912#if defined(DEBUG)
5925static int 5913static int
5926brcms_c_format_flags(const struct brcms_c_bit_desc *bd, u32 flags, char *buf, 5914brcms_c_format_flags(const struct brcms_c_bit_desc *bd, u32 flags, char *buf,
5927 int len) 5915 int len)
@@ -5975,9 +5963,9 @@ brcms_c_format_flags(const struct brcms_c_bit_desc *bd, u32 flags, char *buf,
5975 5963
5976 return (int)(p - buf); 5964 return (int)(p - buf);
5977} 5965}
5978#endif /* defined(BCMDBG) */ 5966#endif /* defined(DEBUG) */
5979 5967
5980#if defined(BCMDBG) 5968#if defined(DEBUG)
5981void brcms_c_print_rxh(struct d11rxhdr *rxh) 5969void brcms_c_print_rxh(struct d11rxhdr *rxh)
5982{ 5970{
5983 u16 len = rxh->RxFrameSize; 5971 u16 len = rxh->RxFrameSize;
@@ -5999,24 +5987,22 @@ void brcms_c_print_rxh(struct d11rxhdr *rxh)
5999 {0, NULL} 5987 {0, NULL}
6000 }; 5988 };
6001 5989
6002 printk(KERN_DEBUG "Raw RxDesc:\n"); 5990 brcmu_dbg_hex_dump(rxh, sizeof(struct d11rxhdr), "Raw RxDesc:\n");
6003 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, rxh,
6004 sizeof(struct d11rxhdr));
6005 5991
6006 brcms_c_format_flags(macstat_flags, macstatus1, flagstr, 64); 5992 brcms_c_format_flags(macstat_flags, macstatus1, flagstr, 64);
6007 5993
6008 snprintf(lenbuf, sizeof(lenbuf), "0x%x", len); 5994 snprintf(lenbuf, sizeof(lenbuf), "0x%x", len);
6009 5995
6010 printk(KERN_DEBUG "RxFrameSize: %6s (%d)%s\n", lenbuf, len, 5996 pr_debug("RxFrameSize: %6s (%d)%s\n", lenbuf, len,
6011 (rxh->PhyRxStatus_0 & PRXS0_SHORTH) ? " short preamble" : ""); 5997 (rxh->PhyRxStatus_0 & PRXS0_SHORTH) ? " short preamble" : "");
6012 printk(KERN_DEBUG "RxPHYStatus: %04x %04x %04x %04x\n", 5998 pr_debug("RxPHYStatus: %04x %04x %04x %04x\n",
6013 phystatus_0, phystatus_1, phystatus_2, phystatus_3); 5999 phystatus_0, phystatus_1, phystatus_2, phystatus_3);
6014 printk(KERN_DEBUG "RxMACStatus: %x %s\n", macstatus1, flagstr); 6000 pr_debug("RxMACStatus: %x %s\n", macstatus1, flagstr);
6015 printk(KERN_DEBUG "RXMACaggtype: %x\n", 6001 pr_debug("RXMACaggtype: %x\n",
6016 (macstatus2 & RXS_AGGTYPE_MASK)); 6002 (macstatus2 & RXS_AGGTYPE_MASK));
6017 printk(KERN_DEBUG "RxTSFTime: %04x\n", rxh->RxTSFTime); 6003 pr_debug("RxTSFTime: %04x\n", rxh->RxTSFTime);
6018} 6004}
6019#endif /* defined(BCMDBG) */ 6005#endif /* defined(DEBUG) */
6020 6006
6021u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate) 6007u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate)
6022{ 6008{
@@ -8354,7 +8340,7 @@ brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit,
8354 wlc->wiphy = wl->wiphy; 8340 wlc->wiphy = wl->wiphy;
8355 pub = wlc->pub; 8341 pub = wlc->pub;
8356 8342
8357#if defined(BCMDBG) 8343#if defined(DEBUG)
8358 wlc_info_dbg = wlc; 8344 wlc_info_dbg = wlc;
8359#endif 8345#endif
8360 8346
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.h b/drivers/net/wireless/brcm80211/brcmsmac/main.h
index adb136ec1f04..8debc74c54e1 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.h
@@ -648,10 +648,12 @@ extern void brcms_c_print_txstatus(struct tx_status *txs);
648extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, 648extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
649 uint *blocks); 649 uint *blocks);
650 650
651#if defined(BCMDBG) 651#if defined(DEBUG)
652extern void brcms_c_print_txdesc(struct d11txh *txh); 652extern void brcms_c_print_txdesc(struct d11txh *txh);
653#else 653#else
654#define brcms_c_print_txdesc(a) 654static inline void brcms_c_print_txdesc(struct d11txh *txh)
655{
656}
655#endif 657#endif
656 658
657extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config); 659extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
index a16f1ab292fd..ec7450d2fbd6 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
@@ -14,6 +14,8 @@
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/kernel.h> 19#include <linux/kernel.h>
18#include <linux/delay.h> 20#include <linux/delay.h>
19#include <linux/cordic.h> 21#include <linux/cordic.h>
@@ -26434,8 +26436,7 @@ cal_try:
26434 } 26436 }
26435 26437
26436 if (bcmerror != 0) { 26438 if (bcmerror != 0) {
26437 printk(KERN_DEBUG "%s: Failed, cnt = %d\n", __func__, 26439 pr_debug("%s: Failed, cnt = %d\n", __func__, cal_retry);
26438 cal_retry);
26439 26440
26440 if (cal_retry < CAL_RETRY_CNT) { 26441 if (cal_retry < CAL_RETRY_CNT) {
26441 cal_retry++; 26442 cal_retry++;
diff --git a/drivers/net/wireless/brcm80211/brcmutil/utils.c b/drivers/net/wireless/brcm80211/brcmutil/utils.c
index b7537f70a795..b45ab34cdfdc 100644
--- a/drivers/net/wireless/brcm80211/brcmutil/utils.c
+++ b/drivers/net/wireless/brcm80211/brcmutil/utils.c
@@ -14,6 +14,8 @@
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/netdevice.h> 19#include <linux/netdevice.h>
18#include <linux/module.h> 20#include <linux/module.h>
19 21
@@ -240,17 +242,35 @@ struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp,
240} 242}
241EXPORT_SYMBOL(brcmu_pktq_mdeq); 243EXPORT_SYMBOL(brcmu_pktq_mdeq);
242 244
243#if defined(BCMDBG) 245#if defined(DEBUG)
244/* pretty hex print a pkt buffer chain */ 246/* pretty hex print a pkt buffer chain */
245void brcmu_prpkt(const char *msg, struct sk_buff *p0) 247void brcmu_prpkt(const char *msg, struct sk_buff *p0)
246{ 248{
247 struct sk_buff *p; 249 struct sk_buff *p;
248 250
249 if (msg && (msg[0] != '\0')) 251 if (msg && (msg[0] != '\0'))
250 printk(KERN_DEBUG "%s:\n", msg); 252 pr_debug("%s:\n", msg);
251 253
252 for (p = p0; p; p = p->next) 254 for (p = p0; p; p = p->next)
253 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, p->data, p->len); 255 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, p->data, p->len);
254} 256}
255EXPORT_SYMBOL(brcmu_prpkt); 257EXPORT_SYMBOL(brcmu_prpkt);
256#endif /* defined(BCMDBG) */ 258
259void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
260{
261 struct va_format vaf;
262 va_list args;
263
264 va_start(args, fmt);
265
266 vaf.fmt = fmt;
267 vaf.va = &args;
268
269 pr_debug("%pV", &vaf);
270
271 va_end(args);
272
273 print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, data, size);
274}
275EXPORT_SYMBOL(brcmu_dbg_hex_dump);
276#endif /* defined(DEBUG) */
diff --git a/drivers/net/wireless/brcm80211/include/brcmu_utils.h b/drivers/net/wireless/brcm80211/include/brcmu_utils.h
index ad249a0b4730..477b92ad3d62 100644
--- a/drivers/net/wireless/brcm80211/include/brcmu_utils.h
+++ b/drivers/net/wireless/brcm80211/include/brcmu_utils.h
@@ -176,10 +176,21 @@ struct ipv4_addr;
176 176
177/* externs */ 177/* externs */
178/* format/print */ 178/* format/print */
179#ifdef BCMDBG 179#ifdef DEBUG
180extern void brcmu_prpkt(const char *msg, struct sk_buff *p0); 180extern void brcmu_prpkt(const char *msg, struct sk_buff *p0);
181#else 181#else
182#define brcmu_prpkt(a, b) 182#define brcmu_prpkt(a, b)
183#endif /* BCMDBG */ 183#endif /* DEBUG */
184
185#ifdef DEBUG
186extern __printf(3, 4)
187void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...);
188#else
189__printf(3, 4)
190static inline
191void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...)
192{
193}
194#endif
184 195
185#endif /* _BRCMU_UTILS_H_ */ 196#endif /* _BRCMU_UTILS_H_ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 1ef7bfc2ab25..cc04cce11567 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index 094693328dbb..00db092d8cd0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index b3a365fea7bb..47fd98b3652c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 54b753399e6e..ab62c018fcdb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
index 50ff849c9f67..6aa009827865 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-calib.h b/drivers/net/wireless/iwlwifi/iwl-agn-calib.h
index 10275ce92bde..9ed6683314a7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-calib.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-calib.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h
index 123ef5e129d5..d0ec0abd3c89 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 64cf439035c3..a8f7689aaacf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as 8 * it under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 334b5ae8fdd4..b9ba404d15c1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h
index 6675b3c816d9..203b1c13c491 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index b22b2976f899..f127f913e5a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portionhelp of the ieee80211 subsystem header files. 6 * as portionhelp of the ieee80211 subsystem header files.
@@ -1172,20 +1172,22 @@ int iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb,
1172 wake_up_all(&priv->shrd->notif_waitq); 1172 wake_up_all(&priv->shrd->notif_waitq);
1173 } 1173 }
1174 1174
1175 if (priv->pre_rx_handler) 1175 if (priv->pre_rx_handler &&
1176 priv->shrd->ucode_owner == IWL_OWNERSHIP_TM)
1176 priv->pre_rx_handler(priv, rxb); 1177 priv->pre_rx_handler(priv, rxb);
1177 1178 else {
1178 /* Based on type of command response or notification, 1179 /* Based on type of command response or notification,
1179 * handle those that need handling via function in 1180 * handle those that need handling via function in
1180 * rx_handlers table. See iwl_setup_rx_handlers() */ 1181 * rx_handlers table. See iwl_setup_rx_handlers() */
1181 if (priv->rx_handlers[pkt->hdr.cmd]) { 1182 if (priv->rx_handlers[pkt->hdr.cmd]) {
1182 priv->rx_handlers_stats[pkt->hdr.cmd]++; 1183 priv->rx_handlers_stats[pkt->hdr.cmd]++;
1183 err = priv->rx_handlers[pkt->hdr.cmd] (priv, rxb, cmd); 1184 err = priv->rx_handlers[pkt->hdr.cmd] (priv, rxb, cmd);
1184 } else { 1185 } else {
1185 /* No handling needed */ 1186 /* No handling needed */
1186 IWL_DEBUG_RX(priv, 1187 IWL_DEBUG_RX(priv,
1187 "No handler needed for %s, 0x%02x\n", 1188 "No handler needed for %s, 0x%02x\n",
1188 get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); 1189 get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
1190 }
1189 } 1191 }
1190 return err; 1192 return err;
1191} 1193}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 1c6659416621..8ca9570ec365 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index 7353826095f1..d6aab00272b9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
@@ -35,9 +35,12 @@
35#include "iwl-trans.h" 35#include "iwl-trans.h"
36 36
37/* priv->shrd->sta_lock must be held */ 37/* priv->shrd->sta_lock must be held */
38static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) 38static int iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
39{ 39{
40 40 if (sta_id >= IWLAGN_STATION_COUNT) {
41 IWL_ERR(priv, "invalid sta_id %u", sta_id);
42 return -EINVAL;
43 }
41 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) 44 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE))
42 IWL_ERR(priv, "ACTIVATE a non DRIVER active station id %u " 45 IWL_ERR(priv, "ACTIVATE a non DRIVER active station id %u "
43 "addr %pM\n", 46 "addr %pM\n",
@@ -53,6 +56,7 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
53 IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", 56 IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n",
54 sta_id, priv->stations[sta_id].sta.sta.addr); 57 sta_id, priv->stations[sta_id].sta.sta.addr);
55 } 58 }
59 return 0;
56} 60}
57 61
58static int iwl_process_add_sta_resp(struct iwl_priv *priv, 62static int iwl_process_add_sta_resp(struct iwl_priv *priv,
@@ -77,8 +81,7 @@ static int iwl_process_add_sta_resp(struct iwl_priv *priv,
77 switch (pkt->u.add_sta.status) { 81 switch (pkt->u.add_sta.status) {
78 case ADD_STA_SUCCESS_MSK: 82 case ADD_STA_SUCCESS_MSK:
79 IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); 83 IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n");
80 iwl_sta_ucode_activate(priv, sta_id); 84 ret = iwl_sta_ucode_activate(priv, sta_id);
81 ret = 0;
82 break; 85 break;
83 case ADD_STA_NO_ROOM_IN_TABLE: 86 case ADD_STA_NO_ROOM_IN_TABLE:
84 IWL_ERR(priv, "Adding station %d failed, no room in table.\n", 87 IWL_ERR(priv, "Adding station %d failed, no room in table.\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
index b0dff7a753a5..56c6def015a4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.h b/drivers/net/wireless/iwlwifi/iwl-agn-tt.h
index 7282a23e8f1c..86bbf47501c1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 63bbc60be28e..64f8db685dc5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as 8 * it under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index b5c7c5f0a753..90315c69cdf6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
@@ -315,7 +315,7 @@ static void iwl_bg_statistics_periodic(unsigned long data)
315 315
316static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base, 316static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
317 u32 start_idx, u32 num_events, 317 u32 start_idx, u32 num_events,
318 u32 mode) 318 u32 capacity, u32 mode)
319{ 319{
320 u32 i; 320 u32 i;
321 u32 ptr; /* SRAM byte address of log data */ 321 u32 ptr; /* SRAM byte address of log data */
@@ -339,6 +339,15 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
339 rmb(); 339 rmb();
340 340
341 /* 341 /*
342 * Refuse to read more than would have fit into the log from
343 * the current start_idx. This used to happen due to the race
344 * described below, but now WARN because the code below should
345 * prevent it from happening here.
346 */
347 if (WARN_ON(num_events > capacity - start_idx))
348 num_events = capacity - start_idx;
349
350 /*
342 * "time" is actually "data" for mode 0 (no timestamp). 351 * "time" is actually "data" for mode 0 (no timestamp).
343 * place event id # at far right for easier visual parsing. 352 * place event id # at far right for easier visual parsing.
344 */ 353 */
@@ -346,12 +355,11 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
346 ev = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 355 ev = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT);
347 time = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 356 time = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT);
348 if (mode == 0) { 357 if (mode == 0) {
349 trace_iwlwifi_dev_ucode_cont_event(priv, 358 trace_iwlwifi_dev_ucode_cont_event(priv, 0, time, ev);
350 0, time, ev);
351 } else { 359 } else {
352 data = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT); 360 data = iwl_read32(bus(priv), HBUS_TARG_MEM_RDAT);
353 trace_iwlwifi_dev_ucode_cont_event(priv, 361 trace_iwlwifi_dev_ucode_cont_event(priv, time,
354 time, data, ev); 362 data, ev);
355 } 363 }
356 } 364 }
357 /* Allow device to power down */ 365 /* Allow device to power down */
@@ -362,53 +370,83 @@ static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base,
362static void iwl_continuous_event_trace(struct iwl_priv *priv) 370static void iwl_continuous_event_trace(struct iwl_priv *priv)
363{ 371{
364 u32 capacity; /* event log capacity in # entries */ 372 u32 capacity; /* event log capacity in # entries */
373 struct {
374 u32 capacity;
375 u32 mode;
376 u32 wrap_counter;
377 u32 write_counter;
378 } __packed read;
365 u32 base; /* SRAM byte address of event log header */ 379 u32 base; /* SRAM byte address of event log header */
366 u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */ 380 u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */
367 u32 num_wraps; /* # times uCode wrapped to top of log */ 381 u32 num_wraps; /* # times uCode wrapped to top of log */
368 u32 next_entry; /* index of next entry to be written by uCode */ 382 u32 next_entry; /* index of next entry to be written by uCode */
369 383
370 base = priv->shrd->device_pointers.error_event_table; 384 base = priv->shrd->device_pointers.log_event_table;
371 if (iwlagn_hw_valid_rtc_data_addr(base)) { 385 if (iwlagn_hw_valid_rtc_data_addr(base)) {
372 capacity = iwl_read_targ_mem(bus(priv), base); 386 iwl_read_targ_mem_words(bus(priv), base, &read, sizeof(read));
373 num_wraps = iwl_read_targ_mem(bus(priv), 387
374 base + (2 * sizeof(u32))); 388 capacity = read.capacity;
375 mode = iwl_read_targ_mem(bus(priv), base + (1 * sizeof(u32))); 389 mode = read.mode;
376 next_entry = iwl_read_targ_mem(bus(priv), 390 num_wraps = read.wrap_counter;
377 base + (3 * sizeof(u32))); 391 next_entry = read.write_counter;
378 } else 392 } else
379 return; 393 return;
380 394
395 /*
396 * Unfortunately, the uCode doesn't use temporary variables.
397 * Therefore, it can happen that we read next_entry == capacity,
398 * which really means next_entry == 0.
399 */
400 if (unlikely(next_entry == capacity))
401 next_entry = 0;
402 /*
403 * Additionally, the uCode increases the write pointer before
404 * the wraps counter, so if the write pointer is smaller than
405 * the old write pointer (wrap occurred) but we read that no
406 * wrap occurred, we actually read between the next_entry and
407 * num_wraps update (this does happen in practice!!) -- take
408 * that into account by increasing num_wraps.
409 */
410 if (unlikely(next_entry < priv->event_log.next_entry &&
411 num_wraps == priv->event_log.num_wraps))
412 num_wraps++;
413
381 if (num_wraps == priv->event_log.num_wraps) { 414 if (num_wraps == priv->event_log.num_wraps) {
382 iwl_print_cont_event_trace(priv, 415 iwl_print_cont_event_trace(
383 base, priv->event_log.next_entry, 416 priv, base, priv->event_log.next_entry,
384 next_entry - priv->event_log.next_entry, 417 next_entry - priv->event_log.next_entry,
385 mode); 418 capacity, mode);
419
386 priv->event_log.non_wraps_count++; 420 priv->event_log.non_wraps_count++;
387 } else { 421 } else {
388 if ((num_wraps - priv->event_log.num_wraps) > 1) 422 if (num_wraps - priv->event_log.num_wraps > 1)
389 priv->event_log.wraps_more_count++; 423 priv->event_log.wraps_more_count++;
390 else 424 else
391 priv->event_log.wraps_once_count++; 425 priv->event_log.wraps_once_count++;
426
392 trace_iwlwifi_dev_ucode_wrap_event(priv, 427 trace_iwlwifi_dev_ucode_wrap_event(priv,
393 num_wraps - priv->event_log.num_wraps, 428 num_wraps - priv->event_log.num_wraps,
394 next_entry, priv->event_log.next_entry); 429 next_entry, priv->event_log.next_entry);
430
395 if (next_entry < priv->event_log.next_entry) { 431 if (next_entry < priv->event_log.next_entry) {
396 iwl_print_cont_event_trace(priv, base, 432 iwl_print_cont_event_trace(
397 priv->event_log.next_entry, 433 priv, base, priv->event_log.next_entry,
398 capacity - priv->event_log.next_entry, 434 capacity - priv->event_log.next_entry,
399 mode); 435 capacity, mode);
400 436
401 iwl_print_cont_event_trace(priv, base, 0, 437 iwl_print_cont_event_trace(
402 next_entry, mode); 438 priv, base, 0, next_entry, capacity, mode);
403 } else { 439 } else {
404 iwl_print_cont_event_trace(priv, base, 440 iwl_print_cont_event_trace(
405 next_entry, capacity - next_entry, 441 priv, base, next_entry,
406 mode); 442 capacity - next_entry,
443 capacity, mode);
407 444
408 iwl_print_cont_event_trace(priv, base, 0, 445 iwl_print_cont_event_trace(
409 next_entry, mode); 446 priv, base, 0, next_entry, capacity, mode);
410 } 447 }
411 } 448 }
449
412 priv->event_log.num_wraps = num_wraps; 450 priv->event_log.num_wraps = num_wraps;
413 priv->event_log.next_entry = next_entry; 451 priv->event_log.next_entry = next_entry;
414} 452}
@@ -1219,6 +1257,11 @@ int iwl_alive_start(struct iwl_priv *priv)
1219 if (iwl_is_rfkill(priv->shrd)) 1257 if (iwl_is_rfkill(priv->shrd))
1220 return -ERFKILL; 1258 return -ERFKILL;
1221 1259
1260 if (priv->event_log.ucode_trace) {
1261 /* start collecting data now */
1262 mod_timer(&priv->ucode_trace, jiffies);
1263 }
1264
1222 /* download priority table before any calibration request */ 1265 /* download priority table before any calibration request */
1223 if (cfg(priv)->bt_params && 1266 if (cfg(priv)->bt_params &&
1224 cfg(priv)->bt_params->advanced_bt_coexist) { 1267 cfg(priv)->bt_params->advanced_bt_coexist) {
@@ -2054,7 +2097,7 @@ MODULE_PARM_DESC(bt_coex_active, "enable wifi/bt co-exist (default: enable)");
2054 2097
2055module_param_named(led_mode, iwlagn_mod_params.led_mode, int, S_IRUGO); 2098module_param_named(led_mode, iwlagn_mod_params.led_mode, int, S_IRUGO);
2056MODULE_PARM_DESC(led_mode, "0=system default, " 2099MODULE_PARM_DESC(led_mode, "0=system default, "
2057 "1=On(RF On)/Off(RF Off), 2=blinking (default: 0)"); 2100 "1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0)");
2058 2101
2059module_param_named(power_save, iwlagn_mod_params.power_save, 2102module_param_named(power_save, iwlagn_mod_params.power_save,
2060 bool, S_IRUGO); 2103 bool, S_IRUGO);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index f84fb3c53563..39cbe1a1577c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-bus.h b/drivers/net/wireless/iwlwifi/iwl-bus.h
index 940d5038b39c..941b9cb23442 100644
--- a/drivers/net/wireless/iwlwifi/iwl-bus.h
+++ b/drivers/net/wireless/iwlwifi/iwl-bus.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-cfg.h b/drivers/net/wireless/iwlwifi/iwl-cfg.h
index e1d78257e4a9..957bc00cdaf0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-cfg.h
+++ b/drivers/net/wireless/iwlwifi/iwl-cfg.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index f822ac447c3b..c20618d92268 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 7bcfa781e0b9..7d6eef96454a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as 8 * it under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 7bf76ab94dd2..63f29111da13 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h
index fbc3095c7b44..5f96ce105f08 100644
--- a/drivers/net/wireless/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/iwlwifi/iwl-csr.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index f8fc2393dd4c..6f7612781e03 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project. 5 * Portions of this file are derived from the ipw3945 project.
6 * 6 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 04a3343f4610..978a1d4c6a0a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as 8 * it under the terms of version 2 of the GNU General Public License as
@@ -2131,9 +2131,10 @@ static ssize_t iwl_dbgfs_ucode_tracing_write(struct file *file,
2131 2131
2132 if (trace) { 2132 if (trace) {
2133 priv->event_log.ucode_trace = true; 2133 priv->event_log.ucode_trace = true;
2134 /* schedule the ucode timer to occur in UCODE_TRACE_PERIOD */ 2134 if (iwl_is_alive(priv->shrd)) {
2135 mod_timer(&priv->ucode_trace, 2135 /* start collecting data now */
2136 jiffies + msecs_to_jiffies(UCODE_TRACE_PERIOD)); 2136 mod_timer(&priv->ucode_trace, jiffies);
2137 }
2137 } else { 2138 } else {
2138 priv->event_log.ucode_trace = false; 2139 priv->event_log.ucode_trace = false;
2139 del_timer_sync(&priv->ucode_trace); 2140 del_timer_sync(&priv->ucode_trace);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index e54a4d11e584..af846002150a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -661,7 +661,7 @@ struct traffic_stats {
661 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds 661 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
662 * to perform continuous uCode event logging operation if enabled 662 * to perform continuous uCode event logging operation if enabled
663 */ 663 */
664#define UCODE_TRACE_PERIOD (100) 664#define UCODE_TRACE_PERIOD (10)
665 665
666/* 666/*
667 * iwl_event_log: current uCode event log position 667 * iwl_event_log: current uCode event log position
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.c b/drivers/net/wireless/iwlwifi/iwl-devtrace.c
index 2a2c8de64a04..91f45e71e0a2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-devtrace.c
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2009 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
index 9b212a8f30bb..4d892211ce4c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2009 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index c1eda9724f42..e27d9f55267b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 9fa937ec35e3..13f2d3928ef8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
index 5bede9d7f955..90208094b8eb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index d57ea6484bbe..83fdff381150 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project. 5 * Portions of this file are derived from the ipw3945 project.
6 * 6 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index aae2eeb331a8..427d065435c8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project. 5 * Portions of this file are derived from the ipw3945 project.
6 * 6 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index 14dcbfcdc0fd..8761438f1532 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -177,6 +177,10 @@ void iwl_leds_init(struct iwl_priv *priv)
177 int mode = iwlagn_mod_params.led_mode; 177 int mode = iwlagn_mod_params.led_mode;
178 int ret; 178 int ret;
179 179
180 if (mode == IWL_LED_DISABLE) {
181 IWL_INFO(priv, "Led disabled\n");
182 return;
183 }
180 if (mode == IWL_LED_DEFAULT) 184 if (mode == IWL_LED_DEFAULT)
181 mode = cfg(priv)->led_mode; 185 mode = cfg(priv)->led_mode;
182 186
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.h b/drivers/net/wireless/iwlwifi/iwl-led.h
index 2550b3c7dcbf..b02a853103d3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.h
+++ b/drivers/net/wireless/iwlwifi/iwl-led.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index f980e574e1f9..965d0475affd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index fb30ea7ca96b..03702a2e913a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 2b188a6025b3..c7394ef2e490 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h
index 5f7b720cf1a4..07a19fce5fdc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.h
+++ b/drivers/net/wireless/iwlwifi/iwl-power.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
index bebdd828f324..a4d11016c3b4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index a6454726737e..7f2e3a1c80ef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as 8 * it under the terms of version 2 of the GNU General Public License as
@@ -414,10 +414,25 @@ static u16 iwl_limit_dwell(struct iwl_priv *priv, u16 dwell_time)
414 for_each_context(priv, ctx) { 414 for_each_context(priv, ctx) {
415 u16 value; 415 u16 value;
416 416
417 if (!iwl_is_associated_ctx(ctx)) 417 switch (ctx->staging.dev_type) {
418 continue; 418 case RXON_DEV_TYPE_P2P:
419 if (ctx->staging.dev_type == RXON_DEV_TYPE_P2P) 419 /* no timing constraints */
420 continue; 420 continue;
421 case RXON_DEV_TYPE_ESS:
422 default:
423 /* timing constraints if associated */
424 if (!iwl_is_associated_ctx(ctx))
425 continue;
426 break;
427 case RXON_DEV_TYPE_CP:
428 case RXON_DEV_TYPE_2STA:
429 /*
430 * These seem to always have timers for TBTT
431 * active in uCode even when not associated yet.
432 */
433 break;
434 }
435
421 value = ctx->beacon_int; 436 value = ctx->beacon_int;
422 if (!value) 437 if (!value)
423 value = IWL_PASSIVE_DWELL_BASE; 438 value = IWL_PASSIVE_DWELL_BASE;
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index dc55cc4a8108..04975b7b65b3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
@@ -102,7 +102,7 @@ struct iwl_trans_ops;
102 102
103#define DRV_NAME "iwlwifi" 103#define DRV_NAME "iwlwifi"
104#define IWLWIFI_VERSION "in-tree:" 104#define IWLWIFI_VERSION "in-tree:"
105#define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" 105#define DRV_COPYRIGHT "Copyright(c) 2003-2012 Intel Corporation"
106#define DRV_AUTHOR "<ilw@linux.intel.com>" 106#define DRV_AUTHOR "<ilw@linux.intel.com>"
107 107
108extern struct iwl_mod_params iwlagn_mod_params; 108extern struct iwl_mod_params iwlagn_mod_params;
@@ -264,11 +264,13 @@ enum iwl_pa_type {
264 * LED ON = RF ON 264 * LED ON = RF ON
265 * LED OFF = RF OFF 265 * LED OFF = RF OFF
266 * IWL_LED_BLINK: adjust led blink rate based on blink table 266 * IWL_LED_BLINK: adjust led blink rate based on blink table
267 * IWL_LED_DISABLE: led disabled
267 */ 268 */
268enum iwl_led_mode { 269enum iwl_led_mode {
269 IWL_LED_DEFAULT, 270 IWL_LED_DEFAULT,
270 IWL_LED_RF_STATE, 271 IWL_LED_RF_STATE,
271 IWL_LED_BLINK, 272 IWL_LED_BLINK,
273 IWL_LED_DISABLE,
272}; 274};
273 275
274/** 276/**
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c
index 4a5cddd2d56b..a56a77b8f926 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2010 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2010 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
@@ -115,6 +115,9 @@ struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = {
115 115
116 [IWL_TM_ATTR_FW_VERSION] = { .type = NLA_U32, }, 116 [IWL_TM_ATTR_FW_VERSION] = { .type = NLA_U32, },
117 [IWL_TM_ATTR_DEVICE_ID] = { .type = NLA_U32, }, 117 [IWL_TM_ATTR_DEVICE_ID] = { .type = NLA_U32, },
118 [IWL_TM_ATTR_FW_TYPE] = { .type = NLA_U32, },
119 [IWL_TM_ATTR_FW_INST_SIZE] = { .type = NLA_U32, },
120 [IWL_TM_ATTR_FW_DATA_SIZE] = { .type = NLA_U32, },
118}; 121};
119 122
120/* 123/*
@@ -299,7 +302,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)
299 302
300 switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { 303 switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
301 case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32: 304 case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32:
302 val32 = iwl_read32(bus(priv), ofs); 305 val32 = iwl_read_direct32(bus(priv), ofs);
303 IWL_INFO(priv, "32bit value to read 0x%x\n", val32); 306 IWL_INFO(priv, "32bit value to read 0x%x\n", val32);
304 307
305 skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20); 308 skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20);
@@ -321,7 +324,7 @@ static int iwl_testmode_reg(struct ieee80211_hw *hw, struct nlattr **tb)
321 } else { 324 } else {
322 val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]); 325 val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]);
323 IWL_INFO(priv, "32bit value to write 0x%x\n", val32); 326 IWL_INFO(priv, "32bit value to write 0x%x\n", val32);
324 iwl_write32(bus(priv), ofs, val32); 327 iwl_write_direct32(bus(priv), ofs, val32);
325 } 328 }
326 break; 329 break;
327 case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8: 330 case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8:
@@ -422,7 +425,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
422 struct sk_buff *skb; 425 struct sk_buff *skb;
423 unsigned char *rsp_data_ptr = NULL; 426 unsigned char *rsp_data_ptr = NULL;
424 int status = 0, rsp_data_len = 0; 427 int status = 0, rsp_data_len = 0;
425 u32 devid; 428 u32 devid, inst_size = 0, data_size = 0;
426 429
427 switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { 430 switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) {
428 case IWL_TM_CMD_APP2DEV_GET_DEVICENAME: 431 case IWL_TM_CMD_APP2DEV_GET_DEVICENAME:
@@ -548,6 +551,41 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb)
548 "Error sending msg : %d\n", status); 551 "Error sending msg : %d\n", status);
549 break; 552 break;
550 553
554 case IWL_TM_CMD_APP2DEV_GET_FW_INFO:
555 skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20 + 8);
556 if (!skb) {
557 IWL_DEBUG_INFO(priv, "Error allocating memory\n");
558 return -ENOMEM;
559 }
560 switch (priv->shrd->ucode_type) {
561 case IWL_UCODE_REGULAR:
562 inst_size = trans(priv)->ucode_rt.code.len;
563 data_size = trans(priv)->ucode_rt.data.len;
564 break;
565 case IWL_UCODE_INIT:
566 inst_size = trans(priv)->ucode_init.code.len;
567 data_size = trans(priv)->ucode_init.data.len;
568 break;
569 case IWL_UCODE_WOWLAN:
570 inst_size = trans(priv)->ucode_wowlan.code.len;
571 data_size = trans(priv)->ucode_wowlan.data.len;
572 break;
573 case IWL_UCODE_NONE:
574 IWL_DEBUG_INFO(priv, "The uCode has not been loaded\n");
575 break;
576 default:
577 IWL_DEBUG_INFO(priv, "Unsupported uCode type\n");
578 break;
579 }
580 NLA_PUT_U32(skb, IWL_TM_ATTR_FW_TYPE, priv->shrd->ucode_type);
581 NLA_PUT_U32(skb, IWL_TM_ATTR_FW_INST_SIZE, inst_size);
582 NLA_PUT_U32(skb, IWL_TM_ATTR_FW_DATA_SIZE, data_size);
583 status = cfg80211_testmode_reply(skb);
584 if (status < 0)
585 IWL_DEBUG_INFO(priv,
586 "Error sending msg : %d\n", status);
587 break;
588
551 default: 589 default:
552 IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n"); 590 IWL_DEBUG_INFO(priv, "Unknown testmode driver command ID\n");
553 return -ENOSYS; 591 return -ENOSYS;
@@ -733,7 +771,7 @@ static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb)
733static int iwl_testmode_sram(struct ieee80211_hw *hw, struct nlattr **tb) 771static int iwl_testmode_sram(struct ieee80211_hw *hw, struct nlattr **tb)
734{ 772{
735 struct iwl_priv *priv = hw->priv; 773 struct iwl_priv *priv = hw->priv;
736 u32 base, ofs, size, maxsize; 774 u32 ofs, size, maxsize;
737 775
738 if (priv->testmode_sram.sram_readed) 776 if (priv->testmode_sram.sram_readed)
739 return -EBUSY; 777 return -EBUSY;
@@ -759,25 +797,24 @@ static int iwl_testmode_sram(struct ieee80211_hw *hw, struct nlattr **tb)
759 maxsize = trans(priv)->ucode_wowlan.data.len; 797 maxsize = trans(priv)->ucode_wowlan.data.len;
760 break; 798 break;
761 case IWL_UCODE_NONE: 799 case IWL_UCODE_NONE:
762 IWL_DEBUG_INFO(priv, "Error, uCode does not been loaded\n"); 800 IWL_ERR(priv, "Error, uCode does not been loaded\n");
763 return -ENOSYS; 801 return -ENOSYS;
764 default: 802 default:
765 IWL_DEBUG_INFO(priv, "Error, unsupported uCode type\n"); 803 IWL_ERR(priv, "Error, unsupported uCode type\n");
766 return -ENOSYS; 804 return -ENOSYS;
767 } 805 }
768 if ((ofs + size) > maxsize) { 806 if ((ofs + size) > (maxsize + SRAM_DATA_SEG_OFFSET)) {
769 IWL_DEBUG_INFO(priv, "Invalid offset/size: out of range\n"); 807 IWL_ERR(priv, "Invalid offset/size: out of range\n");
770 return -EINVAL; 808 return -EINVAL;
771 } 809 }
772 priv->testmode_sram.buff_size = (size / 4) * 4; 810 priv->testmode_sram.buff_size = (size / 4) * 4;
773 priv->testmode_sram.buff_addr = 811 priv->testmode_sram.buff_addr =
774 kmalloc(priv->testmode_sram.buff_size, GFP_KERNEL); 812 kmalloc(priv->testmode_sram.buff_size, GFP_KERNEL);
775 if (priv->testmode_sram.buff_addr == NULL) { 813 if (priv->testmode_sram.buff_addr == NULL) {
776 IWL_DEBUG_INFO(priv, "Error allocating memory\n"); 814 IWL_ERR(priv, "Error allocating memory\n");
777 return -ENOMEM; 815 return -ENOMEM;
778 } 816 }
779 base = 0x800000; 817 _iwl_read_targ_mem_words(bus(priv), ofs,
780 _iwl_read_targ_mem_words(bus(priv), base + ofs,
781 priv->testmode_sram.buff_addr, 818 priv->testmode_sram.buff_addr,
782 priv->testmode_sram.buff_size / 4); 819 priv->testmode_sram.buff_size / 4);
783 priv->testmode_sram.num_chunks = 820 priv->testmode_sram.num_chunks =
@@ -882,6 +919,7 @@ int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len)
882 case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: 919 case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW:
883 case IWL_TM_CMD_APP2DEV_GET_FW_VERSION: 920 case IWL_TM_CMD_APP2DEV_GET_FW_VERSION:
884 case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: 921 case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID:
922 case IWL_TM_CMD_APP2DEV_GET_FW_INFO:
885 IWL_DEBUG_INFO(priv, "testmode cmd to driver\n"); 923 IWL_DEBUG_INFO(priv, "testmode cmd to driver\n");
886 result = iwl_testmode_driver(hw, tb); 924 result = iwl_testmode_driver(hw, tb);
887 break; 925 break;
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.h b/drivers/net/wireless/iwlwifi/iwl-testmode.h
index 26138f110340..f97d06169b45 100644
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.h
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2010 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2010 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
@@ -111,15 +111,17 @@
111 * 111 *
112 * @IWL_TM_CMD_APP2DEV_INDIRECT_REG_READ32: 112 * @IWL_TM_CMD_APP2DEV_INDIRECT_REG_READ32:
113 * @IWL_TM_CMD_APP2DEV_INDIRECT_REG_WRITE32: 113 * @IWL_TM_CMD_APP2DEV_INDIRECT_REG_WRITE32:
114 * commands from user applicaiton to indirectly access peripheral register 114 * commands from user application to indirectly access peripheral register
115 * 115 *
116 * @IWL_TM_CMD_APP2DEV_READ_SRAM: 116 * @IWL_TM_CMD_APP2DEV_READ_SRAM:
117 * @IWL_TM_CMD_APP2DEV_DUMP_SRAM: 117 * @IWL_TM_CMD_APP2DEV_DUMP_SRAM:
118 * commands from user applicaiton to read data in sram 118 * commands from user application to read data in sram
119 * 119 *
120 * @IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: load Weak On Wireless LAN uCode image 120 * @IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: load Wake On Wireless LAN uCode image
121 * @IWL_TM_CMD_APP2DEV_GET_FW_VERSION: retrieve uCode version 121 * @IWL_TM_CMD_APP2DEV_GET_FW_VERSION: retrieve uCode version
122 * @IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: retrieve ID information in device 122 * @IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: retrieve ID information in device
123 * @IWL_TM_CMD_APP2DEV_GET_FW_INFO:
124 * retrieve information of existing loaded uCode image
123 * 125 *
124 */ 126 */
125enum iwl_tm_cmd_t { 127enum iwl_tm_cmd_t {
@@ -147,7 +149,8 @@ enum iwl_tm_cmd_t {
147 IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW = 22, 149 IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW = 22,
148 IWL_TM_CMD_APP2DEV_GET_FW_VERSION = 23, 150 IWL_TM_CMD_APP2DEV_GET_FW_VERSION = 23,
149 IWL_TM_CMD_APP2DEV_GET_DEVICE_ID = 24, 151 IWL_TM_CMD_APP2DEV_GET_DEVICE_ID = 24,
150 IWL_TM_CMD_MAX = 25, 152 IWL_TM_CMD_APP2DEV_GET_FW_INFO = 25,
153 IWL_TM_CMD_MAX = 26,
151}; 154};
152 155
153/* 156/*
@@ -237,6 +240,15 @@ enum iwl_tm_cmd_t {
237 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_DEVICE_ID, 240 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_DEVICE_ID,
238 * IWL_TM_ATTR_DEVICE_ID for the device ID information 241 * IWL_TM_ATTR_DEVICE_ID for the device ID information
239 * 242 *
243 * @IWL_TM_ATTR_FW_TYPE:
244 * @IWL_TM_ATTR_FW_INST_SIZE:
245 * @IWL_TM_ATTR_FW_DATA_SIZE:
246 * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_FW_INFO,
247 * The mandatory fields are:
248 * IWL_TM_ATTR_FW_TYPE for the uCode type (INIT/RUNTIME/...)
249 * IWL_TM_ATTR_FW_INST_SIZE for the size of instruction section
250 * IWL_TM_ATTR_FW_DATA_SIZE for the size of data section
251 *
240 */ 252 */
241enum iwl_tm_attr_t { 253enum iwl_tm_attr_t {
242 IWL_TM_ATTR_NOT_APPLICABLE = 0, 254 IWL_TM_ATTR_NOT_APPLICABLE = 0,
@@ -259,7 +271,10 @@ enum iwl_tm_attr_t {
259 IWL_TM_ATTR_SRAM_DUMP = 17, 271 IWL_TM_ATTR_SRAM_DUMP = 17,
260 IWL_TM_ATTR_FW_VERSION = 18, 272 IWL_TM_ATTR_FW_VERSION = 18,
261 IWL_TM_ATTR_DEVICE_ID = 19, 273 IWL_TM_ATTR_DEVICE_ID = 19,
262 IWL_TM_ATTR_MAX = 20, 274 IWL_TM_ATTR_FW_TYPE = 20,
275 IWL_TM_ATTR_FW_INST_SIZE = 21,
276 IWL_TM_ATTR_FW_DATA_SIZE = 22,
277 IWL_TM_ATTR_MAX = 23,
263}; 278};
264 279
265/* uCode trace buffer */ 280/* uCode trace buffer */
@@ -271,4 +286,7 @@ enum iwl_tm_attr_t {
271/* Maximum data size of each dump it packet */ 286/* Maximum data size of each dump it packet */
272#define DUMP_CHUNK_SIZE (PAGE_SIZE - 1024) 287#define DUMP_CHUNK_SIZE (PAGE_SIZE - 1024)
273 288
289/* Address offset of data segment in SRAM */
290#define SRAM_DATA_SEG_OFFSET 0x800000
291
274#endif 292#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index f6debf91d7b5..0ac9b4d30271 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 65d1f05007be..2900db973aaa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
index bd29568177e6..30814b55705e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions of this file are derived from the ipw3945 project, as well 5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files. 6 * as portions of the ieee80211 subsystem header files.
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 324d06dfb690..3c64c4e5885b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index 1b20c4fb791b..506c062343b2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index e6bf3f554772..42a9f303f543 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c
index 36a1b5b25858..2edf0ef65a5b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as 8 * it under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/iwlwifi/iwl-wifi.h b/drivers/net/wireless/iwlwifi/iwl-wifi.h
index 18501101a530..7e6eb20823cf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-wifi.h
+++ b/drivers/net/wireless/iwlwifi/iwl-wifi.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 11 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
30 * 30 *
31 * BSD LICENSE 31 * BSD LICENSE
32 * 32 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. 33 * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
34 * All rights reserved. 34 * All rights reserved.
35 * 35 *
36 * Redistribution and use in source and binary forms, with or without 36 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c
index 079e5532e686..ea6832dc6677 100644
--- a/drivers/net/wireless/mwifiex/11n_aggr.c
+++ b/drivers/net/wireless/mwifiex/11n_aggr.c
@@ -182,7 +182,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
182 skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); 182 skb_reserve(skb_aggr, headroom + sizeof(struct txpd));
183 tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); 183 tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr);
184 184
185 tx_info_aggr->bss_index = tx_info_src->bss_index; 185 tx_info_aggr->bss_type = tx_info_src->bss_type;
186 tx_info_aggr->bss_num = tx_info_src->bss_num;
186 skb_aggr->priority = skb_src->priority; 187 skb_aggr->priority = skb_src->priority;
187 188
188 do { 189 do {
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index c3b6c4652cd6..6fef4925d13a 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -79,7 +79,7 @@ static int
79mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, 79mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
80 u8 key_index, bool pairwise, const u8 *mac_addr) 80 u8 key_index, bool pairwise, const u8 *mac_addr)
81{ 81{
82 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 82 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev);
83 83
84 if (mwifiex_set_encode(priv, NULL, 0, key_index, 1)) { 84 if (mwifiex_set_encode(priv, NULL, 0, key_index, 1)) {
85 wiphy_err(wiphy, "deleting the crypto keys\n"); 85 wiphy_err(wiphy, "deleting the crypto keys\n");
@@ -122,7 +122,7 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
122 struct net_device *dev, 122 struct net_device *dev,
123 bool enabled, int timeout) 123 bool enabled, int timeout)
124{ 124{
125 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 125 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
126 u32 ps_mode; 126 u32 ps_mode;
127 127
128 if (timeout) 128 if (timeout)
@@ -143,7 +143,7 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev,
143 u8 key_index, bool unicast, 143 u8 key_index, bool unicast,
144 bool multicast) 144 bool multicast)
145{ 145{
146 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 146 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev);
147 147
148 /* Return if WEP key not configured */ 148 /* Return if WEP key not configured */
149 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED) 149 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED)
@@ -165,7 +165,7 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
165 u8 key_index, bool pairwise, const u8 *mac_addr, 165 u8 key_index, bool pairwise, const u8 *mac_addr,
166 struct key_params *params) 166 struct key_params *params)
167{ 167{
168 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 168 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev);
169 169
170 if (mwifiex_set_encode(priv, params->key, params->key_len, 170 if (mwifiex_set_encode(priv, params->key, params->key_len,
171 key_index, 0)) { 171 key_index, 0)) {
@@ -376,7 +376,7 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
376 struct ieee80211_channel *chan, 376 struct ieee80211_channel *chan,
377 enum nl80211_channel_type channel_type) 377 enum nl80211_channel_type channel_type)
378{ 378{
379 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 379 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
380 380
381 if (priv->media_connected) { 381 if (priv->media_connected) {
382 wiphy_err(wiphy, "This setting is valid only when station " 382 wiphy_err(wiphy, "This setting is valid only when station "
@@ -557,6 +557,23 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
557 /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */ 557 /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */
558 sinfo->txrate.legacy = rate.rate * 5; 558 sinfo->txrate.legacy = rate.rate * 5;
559 559
560 if (priv->bss_mode == NL80211_IFTYPE_STATION) {
561 sinfo->filled |= STATION_INFO_BSS_PARAM;
562 sinfo->bss_param.flags = 0;
563 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap &
564 WLAN_CAPABILITY_SHORT_PREAMBLE)
565 sinfo->bss_param.flags |=
566 BSS_PARAM_FLAGS_SHORT_PREAMBLE;
567 if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap &
568 WLAN_CAPABILITY_SHORT_SLOT_TIME)
569 sinfo->bss_param.flags |=
570 BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
571 sinfo->bss_param.dtim_period =
572 priv->curr_bss_params.bss_descriptor.dtim_period;
573 sinfo->bss_param.beacon_interval =
574 priv->curr_bss_params.bss_descriptor.beacon_period;
575 }
576
560 return ret; 577 return ret;
561} 578}
562 579
@@ -1004,7 +1021,7 @@ static int
1004mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, 1021mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1005 struct cfg80211_ibss_params *params) 1022 struct cfg80211_ibss_params *params)
1006{ 1023{
1007 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 1024 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1008 int ret = 0; 1025 int ret = 0;
1009 1026
1010 if (priv->bss_mode != NL80211_IFTYPE_ADHOC) { 1027 if (priv->bss_mode != NL80211_IFTYPE_ADHOC) {
@@ -1042,7 +1059,7 @@ done:
1042static int 1059static int
1043mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) 1060mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1044{ 1061{
1045 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 1062 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1046 1063
1047 wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n", 1064 wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n",
1048 priv->cfg_bssid); 1065 priv->cfg_bssid);
@@ -1217,7 +1234,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
1217 priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; 1234 priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II;
1218 priv->bss_priority = 0; 1235 priv->bss_priority = 0;
1219 priv->bss_role = MWIFIEX_BSS_ROLE_STA; 1236 priv->bss_role = MWIFIEX_BSS_ROLE_STA;
1220 priv->bss_index = 0;
1221 priv->bss_num = 0; 1237 priv->bss_num = 0;
1222 1238
1223 break; 1239 break;
@@ -1281,10 +1297,7 @@ EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf);
1281 */ 1297 */
1282int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev) 1298int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev)
1283{ 1299{
1284 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 1300 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1285
1286 if (!priv || !dev)
1287 return 0;
1288 1301
1289#ifdef CONFIG_DEBUG_FS 1302#ifdef CONFIG_DEBUG_FS
1290 mwifiex_dev_debugfs_remove(priv); 1303 mwifiex_dev_debugfs_remove(priv);
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 6e0a3eaecf70..6623db69e157 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -391,7 +391,8 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
391 391
392 if (skb) { 392 if (skb) {
393 rx_info = MWIFIEX_SKB_RXCB(skb); 393 rx_info = MWIFIEX_SKB_RXCB(skb);
394 rx_info->bss_index = priv->bss_index; 394 rx_info->bss_num = priv->bss_num;
395 rx_info->bss_type = priv->bss_type;
395 } 396 }
396 397
397 if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE) { 398 if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE) {
diff --git a/drivers/net/wireless/mwifiex/decl.h b/drivers/net/wireless/mwifiex/decl.h
index ae17ce02a3d0..3735c775495c 100644
--- a/drivers/net/wireless/mwifiex/decl.h
+++ b/drivers/net/wireless/mwifiex/decl.h
@@ -102,7 +102,8 @@ struct mwifiex_wait_queue {
102}; 102};
103 103
104struct mwifiex_rxinfo { 104struct mwifiex_rxinfo {
105 u8 bss_index; 105 u8 bss_num;
106 u8 bss_type;
106 struct sk_buff *parent; 107 struct sk_buff *parent;
107 u8 use_count; 108 u8 use_count;
108}; 109};
@@ -110,7 +111,8 @@ struct mwifiex_rxinfo {
110struct mwifiex_txinfo { 111struct mwifiex_txinfo {
111 u32 status_code; 112 u32 status_code;
112 u8 flags; 113 u8 flags;
113 u8 bss_index; 114 u8 bss_num;
115 u8 bss_type;
114}; 116};
115 117
116enum mwifiex_wmm_ac_e { 118enum mwifiex_wmm_ac_e {
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index e05b417a3fae..e13b6d99171a 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -526,8 +526,9 @@ static void mwifiex_delete_bss_prio_tbl(struct mwifiex_private *priv)
526 cur = &adapter->bss_prio_tbl[i].bss_prio_cur; 526 cur = &adapter->bss_prio_tbl[i].bss_prio_cur;
527 lock = &adapter->bss_prio_tbl[i].bss_prio_lock; 527 lock = &adapter->bss_prio_tbl[i].bss_prio_lock;
528 dev_dbg(adapter->dev, "info: delete BSS priority table," 528 dev_dbg(adapter->dev, "info: delete BSS priority table,"
529 " index = %d, i = %d, head = %p, cur = %p\n", 529 " bss_type = %d, bss_num = %d, i = %d,"
530 priv->bss_index, i, head, *cur); 530 " head = %p, cur = %p\n",
531 priv->bss_type, priv->bss_num, i, head, *cur);
531 if (*cur) { 532 if (*cur) {
532 spin_lock_irqsave(lock, flags); 533 spin_lock_irqsave(lock, flags);
533 if (list_empty(head)) { 534 if (list_empty(head)) {
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 84be196188cc..80e44566bf6e 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -424,8 +424,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
424 struct sk_buff *new_skb; 424 struct sk_buff *new_skb;
425 struct mwifiex_txinfo *tx_info; 425 struct mwifiex_txinfo *tx_info;
426 426
427 dev_dbg(priv->adapter->dev, "data: %lu BSS(%d): Data <= kernel\n", 427 dev_dbg(priv->adapter->dev, "data: %lu BSS(%d-%d): Data <= kernel\n",
428 jiffies, priv->bss_index); 428 jiffies, priv->bss_type, priv->bss_num);
429 429
430 if (priv->adapter->surprise_removed) { 430 if (priv->adapter->surprise_removed) {
431 kfree_skb(skb); 431 kfree_skb(skb);
@@ -458,10 +458,11 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
458 } 458 }
459 459
460 tx_info = MWIFIEX_SKB_TXCB(skb); 460 tx_info = MWIFIEX_SKB_TXCB(skb);
461 tx_info->bss_index = priv->bss_index; 461 tx_info->bss_num = priv->bss_num;
462 tx_info->bss_type = priv->bss_type;
462 mwifiex_fill_buffer(skb); 463 mwifiex_fill_buffer(skb);
463 464
464 mwifiex_wmm_add_buf_txqueue(priv->adapter, skb); 465 mwifiex_wmm_add_buf_txqueue(priv, skb);
465 atomic_inc(&priv->adapter->tx_pending); 466 atomic_inc(&priv->adapter->tx_pending);
466 467
467 if (atomic_read(&priv->adapter->tx_pending) >= MAX_TX_PENDING) { 468 if (atomic_read(&priv->adapter->tx_pending) >= MAX_TX_PENDING) {
@@ -531,8 +532,8 @@ mwifiex_tx_timeout(struct net_device *dev)
531{ 532{
532 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 533 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
533 534
534 dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_index=%d\n", 535 dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_type-num = %d-%d\n",
535 jiffies, priv->bss_index); 536 jiffies, priv->bss_type, priv->bss_num);
536 mwifiex_set_trans_start(dev); 537 mwifiex_set_trans_start(dev);
537 priv->num_tx_timeout++; 538 priv->num_tx_timeout++;
538} 539}
@@ -605,18 +606,6 @@ int is_command_pending(struct mwifiex_adapter *adapter)
605} 606}
606 607
607/* 608/*
608 * This function returns the correct private structure pointer based
609 * upon the BSS number.
610 */
611struct mwifiex_private *
612mwifiex_bss_index_to_priv(struct mwifiex_adapter *adapter, u8 bss_index)
613{
614 if (!adapter || (bss_index >= adapter->priv_num))
615 return NULL;
616 return adapter->priv[bss_index];
617}
618
619/*
620 * This is the main work queue function. 609 * This is the main work queue function.
621 * 610 *
622 * It handles the main process, which in turn handles the complete 611 * It handles the main process, which in turn handles the complete
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 3186aa437f42..3dc0f721c1db 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -249,6 +249,7 @@ struct mwifiex_bssdescriptor {
249 u32 channel; 249 u32 channel;
250 u32 freq; 250 u32 freq;
251 u16 beacon_period; 251 u16 beacon_period;
252 u8 dtim_period;
252 u8 erp_flags; 253 u8 erp_flags;
253 u32 bss_mode; 254 u32 bss_mode;
254 u8 supported_rates[MWIFIEX_SUPPORTED_RATES]; 255 u8 supported_rates[MWIFIEX_SUPPORTED_RATES];
@@ -352,7 +353,6 @@ struct mwifiex_private;
352 353
353struct mwifiex_private { 354struct mwifiex_private {
354 struct mwifiex_adapter *adapter; 355 struct mwifiex_adapter *adapter;
355 u8 bss_index;
356 u8 bss_type; 356 u8 bss_type;
357 u8 bss_role; 357 u8 bss_role;
358 u8 bss_priority; 358 u8 bss_priority;
@@ -884,8 +884,6 @@ mwifiex_netdev_get_priv(struct net_device *dev)
884 return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev)); 884 return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
885} 885}
886 886
887struct mwifiex_private *mwifiex_bss_index_to_priv(struct mwifiex_adapter
888 *adapter, u8 bss_index);
889int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, 887int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
890 u32 func_init_shutdown); 888 u32 func_init_shutdown);
891int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8); 889int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8);
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 6396d3318ead..135208596aff 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1086,6 +1086,7 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1086 struct ieee_types_vendor_specific *vendor_ie; 1086 struct ieee_types_vendor_specific *vendor_ie;
1087 const u8 wpa_oui[4] = { 0x00, 0x50, 0xf2, 0x01 }; 1087 const u8 wpa_oui[4] = { 0x00, 0x50, 0xf2, 0x01 };
1088 const u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; 1088 const u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 };
1089 struct ieee80211_tim_ie *tim_ie;
1089 1090
1090 found_data_rate_ie = false; 1091 found_data_rate_ie = false;
1091 rate_size = 0; 1092 rate_size = 0;
@@ -1258,6 +1259,11 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1258 sizeof(struct ieee_types_header) - 1259 sizeof(struct ieee_types_header) -
1259 bss_entry->beacon_buf); 1260 bss_entry->beacon_buf);
1260 break; 1261 break;
1262 case WLAN_EID_TIM:
1263 tim_ie = (void *) (current_ptr +
1264 sizeof(struct ieee_types_header));
1265 bss_entry->dtim_period = tim_ie->dtim_period;
1266 break;
1261 default: 1267 default:
1262 break; 1268 break;
1263 } 1269 }
@@ -2001,7 +2007,7 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
2001 2007
2002 kfree(priv->curr_bcn_buf); 2008 kfree(priv->curr_bcn_buf);
2003 priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size, 2009 priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size,
2004 GFP_KERNEL); 2010 GFP_ATOMIC);
2005 if (!priv->curr_bcn_buf) { 2011 if (!priv->curr_bcn_buf) {
2006 dev_err(priv->adapter->dev, 2012 dev_err(priv->adapter->dev,
2007 "failed to alloc curr_bcn_buf\n"); 2013 "failed to alloc curr_bcn_buf\n");
diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c
index 5e1ef7e5da4f..d7a5d7616f22 100644
--- a/drivers/net/wireless/mwifiex/sta_rx.c
+++ b/drivers/net/wireless/mwifiex/sta_rx.c
@@ -43,7 +43,8 @@ int mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
43{ 43{
44 int ret; 44 int ret;
45 struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); 45 struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
46 struct mwifiex_private *priv = adapter->priv[rx_info->bss_index]; 46 struct mwifiex_private *priv = mwifiex_get_priv_by_id(adapter,
47 rx_info->bss_num, rx_info->bss_type);
47 struct rx_packet_hdr *rx_pkt_hdr; 48 struct rx_packet_hdr *rx_pkt_hdr;
48 struct rxpd *local_rx_pd; 49 struct rxpd *local_rx_pd;
49 int hdr_chop; 50 int hdr_chop;
@@ -124,7 +125,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
124 struct rx_packet_hdr *rx_pkt_hdr; 125 struct rx_packet_hdr *rx_pkt_hdr;
125 u8 ta[ETH_ALEN]; 126 u8 ta[ETH_ALEN];
126 u16 rx_pkt_type; 127 u16 rx_pkt_type;
127 struct mwifiex_private *priv = adapter->priv[rx_info->bss_index]; 128 struct mwifiex_private *priv = mwifiex_get_priv_by_id(adapter,
129 rx_info->bss_num, rx_info->bss_type);
128 130
129 if (!priv) 131 if (!priv)
130 return -1; 132 return -1;
diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c
index d97facd70e88..94d31a94620a 100644
--- a/drivers/net/wireless/mwifiex/sta_tx.c
+++ b/drivers/net/wireless/mwifiex/sta_tx.c
@@ -136,7 +136,8 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
136 return -1; 136 return -1;
137 137
138 tx_info = MWIFIEX_SKB_TXCB(skb); 138 tx_info = MWIFIEX_SKB_TXCB(skb);
139 tx_info->bss_index = priv->bss_index; 139 tx_info->bss_num = priv->bss_num;
140 tx_info->bss_type = priv->bss_type;
140 skb_reserve(skb, sizeof(struct txpd) + INTF_HEADER_LEN); 141 skb_reserve(skb, sizeof(struct txpd) + INTF_HEADER_LEN);
141 skb_push(skb, sizeof(struct txpd)); 142 skb_push(skb, sizeof(struct txpd));
142 143
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c
index d9274a1b77ac..9a6eacc9d6f9 100644
--- a/drivers/net/wireless/mwifiex/txrx.c
+++ b/drivers/net/wireless/mwifiex/txrx.c
@@ -48,7 +48,8 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
48 if (!priv) 48 if (!priv)
49 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); 49 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
50 50
51 rx_info->bss_index = priv->bss_index; 51 rx_info->bss_num = priv->bss_num;
52 rx_info->bss_type = priv->bss_type;
52 53
53 return mwifiex_process_sta_rx_packet(adapter, skb); 54 return mwifiex_process_sta_rx_packet(adapter, skb);
54} 55}
@@ -130,7 +131,8 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
130 return 0; 131 return 0;
131 132
132 tx_info = MWIFIEX_SKB_TXCB(skb); 133 tx_info = MWIFIEX_SKB_TXCB(skb);
133 priv = mwifiex_bss_index_to_priv(adapter, tx_info->bss_index); 134 priv = mwifiex_get_priv_by_id(adapter, tx_info->bss_num,
135 tx_info->bss_type);
134 if (!priv) 136 if (!priv)
135 goto done; 137 goto done;
136 138
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
index 06976f517f66..9c48f37069f7 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -159,7 +159,8 @@ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb)
159 return -1; 159 return -1;
160 160
161 rx_info = MWIFIEX_SKB_RXCB(skb); 161 rx_info = MWIFIEX_SKB_RXCB(skb);
162 priv = mwifiex_bss_index_to_priv(adapter, rx_info->bss_index); 162 priv = mwifiex_get_priv_by_id(adapter, rx_info->bss_num,
163 rx_info->bss_type);
163 if (!priv) 164 if (!priv)
164 return -1; 165 return -1;
165 166
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 6c239c3c8249..75f79ef9f6cf 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -599,11 +599,10 @@ mwifiex_is_ralist_valid(struct mwifiex_private *priv,
599 * is queued at the list tail. 599 * is queued at the list tail.
600 */ 600 */
601void 601void
602mwifiex_wmm_add_buf_txqueue(struct mwifiex_adapter *adapter, 602mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
603 struct sk_buff *skb) 603 struct sk_buff *skb)
604{ 604{
605 struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb); 605 struct mwifiex_adapter *adapter = priv->adapter;
606 struct mwifiex_private *priv = adapter->priv[tx_info->bss_index];
607 u32 tid; 606 u32 tid;
608 struct mwifiex_ra_list_tbl *ra_list; 607 struct mwifiex_ra_list_tbl *ra_list;
609 u8 ra[ETH_ALEN], tid_down; 608 u8 ra[ETH_ALEN], tid_down;
diff --git a/drivers/net/wireless/mwifiex/wmm.h b/drivers/net/wireless/mwifiex/wmm.h
index fcea1f68792f..ec839952d2e7 100644
--- a/drivers/net/wireless/mwifiex/wmm.h
+++ b/drivers/net/wireless/mwifiex/wmm.h
@@ -80,8 +80,8 @@ mwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead)
80 return true; 80 return true;
81} 81}
82 82
83void mwifiex_wmm_add_buf_txqueue(struct mwifiex_adapter *adapter, 83void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
84 struct sk_buff *skb); 84 struct sk_buff *skb);
85void mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra); 85void mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra);
86 86
87int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter); 87int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter);
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index dd5aeaff44ba..fd125473be7a 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -4093,7 +4093,7 @@ static int mwl8k_set_key(struct ieee80211_hw *hw,
4093 return -EOPNOTSUPP; 4093 return -EOPNOTSUPP;
4094 4094
4095 if (sta == NULL) 4095 if (sta == NULL)
4096 addr = hw->wiphy->perm_addr; 4096 addr = vif->addr;
4097 else 4097 else
4098 addr = sta->addr; 4098 addr = sta->addr;
4099 4099
diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c
index ae8ce56670b6..f634d4582bfe 100644
--- a/drivers/net/wireless/orinoco/orinoco_usb.c
+++ b/drivers/net/wireless/orinoco/orinoco_usb.c
@@ -1754,11 +1754,6 @@ static struct usb_driver orinoco_driver = {
1754 .id_table = ezusb_table, 1754 .id_table = ezusb_table,
1755}; 1755};
1756 1756
1757/* Can't be declared "const" or the whole __initdata section will
1758 * become const */
1759static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
1760 " (Manuel Estrada Sainz)";
1761
1762module_usb_driver(orinoco_driver); 1757module_usb_driver(orinoco_driver);
1763 1758
1764MODULE_AUTHOR("Manuel Estrada Sainz"); 1759MODULE_AUTHOR("Manuel Estrada Sainz");
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c
index af2ca1a9c7d3..40f4eb7da7b2 100644
--- a/drivers/net/wireless/p54/main.c
+++ b/drivers/net/wireless/p54/main.c
@@ -228,6 +228,8 @@ static int p54_add_interface(struct ieee80211_hw *dev,
228{ 228{
229 struct p54_common *priv = dev->priv; 229 struct p54_common *priv = dev->priv;
230 230
231 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
232
231 mutex_lock(&priv->conf_mutex); 233 mutex_lock(&priv->conf_mutex);
232 if (priv->mode != NL80211_IFTYPE_MONITOR) { 234 if (priv->mode != NL80211_IFTYPE_MONITOR) {
233 mutex_unlock(&priv->conf_mutex); 235 mutex_unlock(&priv->conf_mutex);
@@ -734,7 +736,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
734 IEEE80211_HW_SIGNAL_DBM | 736 IEEE80211_HW_SIGNAL_DBM |
735 IEEE80211_HW_SUPPORTS_PS | 737 IEEE80211_HW_SUPPORTS_PS |
736 IEEE80211_HW_PS_NULLFUNC_STACK | 738 IEEE80211_HW_PS_NULLFUNC_STACK |
737 IEEE80211_HW_BEACON_FILTER |
738 IEEE80211_HW_REPORTS_TX_ACK_STATUS; 739 IEEE80211_HW_REPORTS_TX_ACK_STATUS;
739 740
740 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | 741 dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 7bef66def10c..dbe7ece862f2 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -412,18 +412,6 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
412 } 412 }
413 413
414 /* 414 /*
415 * Disable DMA, will be reenabled later when enabling
416 * the radio.
417 */
418 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
419 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
420 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_DMA_BUSY, 0);
421 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
422 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_RX_DMA_BUSY, 0);
423 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
424 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
425
426 /*
427 * Write firmware to the device. 415 * Write firmware to the device.
428 */ 416 */
429 rt2800_drv_write_firmware(rt2x00dev, data, len); 417 rt2800_drv_write_firmware(rt2x00dev, data, len);
@@ -444,10 +432,21 @@ int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
444 } 432 }
445 433
446 /* 434 /*
435 * Disable DMA, will be reenabled later when enabling
436 * the radio.
437 */
438 rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
439 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
440 rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
441 rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
442
443 /*
447 * Initialize firmware. 444 * Initialize firmware.
448 */ 445 */
449 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); 446 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
450 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); 447 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
448 if (rt2x00_is_usb(rt2x00dev))
449 rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0);
451 msleep(1); 450 msleep(1);
452 451
453 return 0; 452 return 0;
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index dc88baefa72e..4e985026985c 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -489,7 +489,7 @@ static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev)
489 489
490 rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 490 rt2x00pci_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003);
491 491
492 rt2x00pci_register_read(rt2x00dev, MAC_SYS_CTRL, &reg); 492 reg = 0;
493 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1); 493 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
494 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1); 494 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
495 rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 495 rt2x00pci_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 262ee9eefb6f..f0074bcee7c9 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -226,9 +226,7 @@ static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)
226 rt2x00usb_register_read(rt2x00dev, PBF_SYS_CTRL, &reg); 226 rt2x00usb_register_read(rt2x00dev, PBF_SYS_CTRL, &reg);
227 rt2x00usb_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000); 227 rt2x00usb_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000);
228 228
229 rt2x00usb_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); 229 reg = 0;
230
231 rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, &reg);
232 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1); 230 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
233 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1); 231 rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_BBP, 1);
234 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg); 232 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig
index d6c42e69bdbd..44b9c0a57702 100644
--- a/drivers/net/wireless/rtlwifi/Kconfig
+++ b/drivers/net/wireless/rtlwifi/Kconfig
@@ -49,6 +49,11 @@ config RTLWIFI
49 depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE 49 depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE
50 default m 50 default m
51 51
52config RTLWIFI_DEBUG
53 tristate "Additional debugging output"
54 depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE
55 default y
56
52config RTL8192C_COMMON 57config RTL8192C_COMMON
53 tristate 58 tristate
54 depends on RTL8192CE || RTL8192CU 59 depends on RTL8192CE || RTL8192CU
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 8d6eb0f56c03..df5655cc55c0 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,10 +27,6 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include <linux/ip.h>
33#include <linux/module.h>
34#include "wifi.h" 30#include "wifi.h"
35#include "rc.h" 31#include "rc.h"
36#include "base.h" 32#include "base.h"
@@ -39,6 +35,9 @@
39#include "ps.h" 35#include "ps.h"
40#include "regd.h" 36#include "regd.h"
41 37
38#include <linux/ip.h>
39#include <linux/module.h>
40
42/* 41/*
43 *NOTICE!!!: This file will be very big, we hsould 42 *NOTICE!!!: This file will be very big, we hsould
44 *keep it clear under follwing roles: 43 *keep it clear under follwing roles:
@@ -211,7 +210,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
211 */ 210 */
212 if (get_rf_type(rtlphy) == RF_1T2R || get_rf_type(rtlphy) == RF_2T2R) { 211 if (get_rf_type(rtlphy) == RF_1T2R || get_rf_type(rtlphy) == RF_2T2R) {
213 212
214 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("1T2R or 2T2R\n")); 213 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "1T2R or 2T2R\n");
215 214
216 ht_cap->mcs.rx_mask[0] = 0xFF; 215 ht_cap->mcs.rx_mask[0] = 0xFF;
217 ht_cap->mcs.rx_mask[1] = 0xFF; 216 ht_cap->mcs.rx_mask[1] = 0xFF;
@@ -220,7 +219,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
220 ht_cap->mcs.rx_highest = cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS15); 219 ht_cap->mcs.rx_highest = cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS15);
221 } else if (get_rf_type(rtlphy) == RF_1T1R) { 220 } else if (get_rf_type(rtlphy) == RF_1T1R) {
222 221
223 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("1T1R\n")); 222 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "1T1R\n");
224 223
225 ht_cap->mcs.rx_mask[0] = 0xFF; 224 ht_cap->mcs.rx_mask[0] = 0xFF;
226 ht_cap->mcs.rx_mask[1] = 0x00; 225 ht_cap->mcs.rx_mask[1] = 0x00;
@@ -302,15 +301,13 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
302 /* <4> set mac->sband to wiphy->sband */ 301 /* <4> set mac->sband to wiphy->sband */
303 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband; 302 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
304 } else { 303 } else {
305 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 304 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Err BAND %d\n",
306 ("Err BAND %d\n", 305 rtlhal->current_bandtype);
307 rtlhal->current_bandtype));
308 } 306 }
309 } 307 }
310 /* <5> set hw caps */ 308 /* <5> set hw caps */
311 hw->flags = IEEE80211_HW_SIGNAL_DBM | 309 hw->flags = IEEE80211_HW_SIGNAL_DBM |
312 IEEE80211_HW_RX_INCLUDES_FCS | 310 IEEE80211_HW_RX_INCLUDES_FCS |
313 IEEE80211_HW_BEACON_FILTER |
314 IEEE80211_HW_AMPDU_AGGREGATION | 311 IEEE80211_HW_AMPDU_AGGREGATION |
315 IEEE80211_HW_CONNECTION_MONITOR | 312 IEEE80211_HW_CONNECTION_MONITOR |
316 /* IEEE80211_HW_SUPPORTS_CQM_RSSI | */ 313 /* IEEE80211_HW_SUPPORTS_CQM_RSSI | */
@@ -413,6 +410,7 @@ void rtl_init_rfkill(struct ieee80211_hw *hw)
413 410
414 wiphy_rfkill_start_polling(hw->wiphy); 411 wiphy_rfkill_start_polling(hw->wiphy);
415} 412}
413EXPORT_SYMBOL(rtl_init_rfkill);
416 414
417void rtl_deinit_rfkill(struct ieee80211_hw *hw) 415void rtl_deinit_rfkill(struct ieee80211_hw *hw)
418{ 416{
@@ -436,13 +434,13 @@ int rtl_init_core(struct ieee80211_hw *hw)
436 * mac80211 hw in _rtl_init_mac80211. 434 * mac80211 hw in _rtl_init_mac80211.
437 */ 435 */
438 if (rtl_regd_init(hw, rtl_reg_notifier)) { 436 if (rtl_regd_init(hw, rtl_reg_notifier)) {
439 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("REGD init failed\n")); 437 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "REGD init failed\n");
440 return 1; 438 return 1;
441 } else { 439 } else {
442 /* CRDA regd hint must after init CRDA */ 440 /* CRDA regd hint must after init CRDA */
443 if (regulatory_hint(hw->wiphy, rtlpriv->regd.alpha2)) { 441 if (regulatory_hint(hw->wiphy, rtlpriv->regd.alpha2)) {
444 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 442 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
445 ("regulatory_hint fail\n")); 443 "regulatory_hint fail\n");
446 } 444 }
447 } 445 }
448 446
@@ -922,17 +920,17 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
922 return false; 920 return false;
923 921
924 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, 922 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
925 ("%s ACT_ADDBAREQ From :%pM\n", 923 "%s ACT_ADDBAREQ From :%pM\n",
926 is_tx ? "Tx" : "Rx", hdr->addr2)); 924 is_tx ? "Tx" : "Rx", hdr->addr2);
927 break; 925 break;
928 case ACT_ADDBARSP: 926 case ACT_ADDBARSP:
929 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, 927 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
930 ("%s ACT_ADDBARSP From :%pM\n", 928 "%s ACT_ADDBARSP From :%pM\n",
931 is_tx ? "Tx" : "Rx", hdr->addr2)); 929 is_tx ? "Tx" : "Rx", hdr->addr2);
932 break; 930 break;
933 case ACT_DELBA: 931 case ACT_DELBA:
934 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, 932 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
935 ("ACT_ADDBADEL From :%pM\n", hdr->addr2)); 933 "ACT_ADDBADEL From :%pM\n", hdr->addr2);
936 break; 934 break;
937 } 935 }
938 break; 936 break;
@@ -975,8 +973,8 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
975 * 67 : UDP BOOTP server 973 * 67 : UDP BOOTP server
976 */ 974 */
977 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), 975 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV),
978 DBG_DMESG, ("dhcp %s !!\n", 976 DBG_DMESG, "dhcp %s !!\n",
979 (is_tx) ? "Tx" : "Rx")); 977 is_tx ? "Tx" : "Rx");
980 978
981 if (is_tx) { 979 if (is_tx) {
982 rtl_lps_leave(hw); 980 rtl_lps_leave(hw);
@@ -996,7 +994,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
996 return true; 994 return true;
997 } else if (ETH_P_PAE == ether_type) { 995 } else if (ETH_P_PAE == ether_type) {
998 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, 996 RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
999 ("802.1X %s EAPOL pkt!!\n", (is_tx) ? "Tx" : "Rx")); 997 "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx");
1000 998
1001 if (is_tx) { 999 if (is_tx) {
1002 rtl_lps_leave(hw); 1000 rtl_lps_leave(hw);
@@ -1036,9 +1034,8 @@ int rtl_tx_agg_start(struct ieee80211_hw *hw,
1036 return -ENXIO; 1034 return -ENXIO;
1037 tid_data = &sta_entry->tids[tid]; 1035 tid_data = &sta_entry->tids[tid];
1038 1036
1039 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, 1037 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d seq:%d\n",
1040 ("on ra = %pM tid = %d seq:%d\n", sta->addr, tid, 1038 sta->addr, tid, tid_data->seq_number);
1041 tid_data->seq_number));
1042 1039
1043 *ssn = tid_data->seq_number; 1040 *ssn = tid_data->seq_number;
1044 tid_data->agg.agg_state = RTL_AGG_START; 1041 tid_data->agg.agg_state = RTL_AGG_START;
@@ -1059,12 +1056,12 @@ int rtl_tx_agg_stop(struct ieee80211_hw *hw,
1059 return -EINVAL; 1056 return -EINVAL;
1060 1057
1061 if (!sta->addr) { 1058 if (!sta->addr) {
1062 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("ra = NULL\n")); 1059 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "ra = NULL\n");
1063 return -EINVAL; 1060 return -EINVAL;
1064 } 1061 }
1065 1062
1066 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, 1063 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d\n",
1067 ("on ra = %pM tid = %d\n", sta->addr, tid)); 1064 sta->addr, tid);
1068 1065
1069 if (unlikely(tid >= MAX_TID_COUNT)) 1066 if (unlikely(tid >= MAX_TID_COUNT))
1070 return -EINVAL; 1067 return -EINVAL;
@@ -1087,12 +1084,12 @@ int rtl_tx_agg_oper(struct ieee80211_hw *hw,
1087 return -EINVAL; 1084 return -EINVAL;
1088 1085
1089 if (!sta->addr) { 1086 if (!sta->addr) {
1090 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("ra = NULL\n")); 1087 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "ra = NULL\n");
1091 return -EINVAL; 1088 return -EINVAL;
1092 } 1089 }
1093 1090
1094 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, 1091 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d\n",
1095 ("on ra = %pM tid = %d\n", sta->addr, tid)); 1092 sta->addr, tid);
1096 1093
1097 if (unlikely(tid >= MAX_TID_COUNT)) 1094 if (unlikely(tid >= MAX_TID_COUNT))
1098 return -EINVAL; 1095 return -EINVAL;
@@ -1474,29 +1471,29 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len)
1474 (memcmp(mac->bssid, ap5_6, 3) == 0) || 1471 (memcmp(mac->bssid, ap5_6, 3) == 0) ||
1475 vendor == PEER_ATH) { 1472 vendor == PEER_ATH) {
1476 vendor = PEER_ATH; 1473 vendor = PEER_ATH;
1477 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, ("=>ath find\n")); 1474 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>ath find\n");
1478 } else if ((memcmp(mac->bssid, ap4_4, 3) == 0) || 1475 } else if ((memcmp(mac->bssid, ap4_4, 3) == 0) ||
1479 (memcmp(mac->bssid, ap4_5, 3) == 0) || 1476 (memcmp(mac->bssid, ap4_5, 3) == 0) ||
1480 (memcmp(mac->bssid, ap4_1, 3) == 0) || 1477 (memcmp(mac->bssid, ap4_1, 3) == 0) ||
1481 (memcmp(mac->bssid, ap4_2, 3) == 0) || 1478 (memcmp(mac->bssid, ap4_2, 3) == 0) ||
1482 (memcmp(mac->bssid, ap4_3, 3) == 0) || 1479 (memcmp(mac->bssid, ap4_3, 3) == 0) ||
1483 vendor == PEER_RAL) { 1480 vendor == PEER_RAL) {
1484 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, ("=>ral findn\n")); 1481 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>ral find\n");
1485 vendor = PEER_RAL; 1482 vendor = PEER_RAL;
1486 } else if (memcmp(mac->bssid, ap6_1, 3) == 0 || 1483 } else if (memcmp(mac->bssid, ap6_1, 3) == 0 ||
1487 vendor == PEER_CISCO) { 1484 vendor == PEER_CISCO) {
1488 vendor = PEER_CISCO; 1485 vendor = PEER_CISCO;
1489 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, ("=>cisco find\n")); 1486 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>cisco find\n");
1490 } else if ((memcmp(mac->bssid, ap3_1, 3) == 0) || 1487 } else if ((memcmp(mac->bssid, ap3_1, 3) == 0) ||
1491 (memcmp(mac->bssid, ap3_2, 3) == 0) || 1488 (memcmp(mac->bssid, ap3_2, 3) == 0) ||
1492 (memcmp(mac->bssid, ap3_3, 3) == 0) || 1489 (memcmp(mac->bssid, ap3_3, 3) == 0) ||
1493 vendor == PEER_BROAD) { 1490 vendor == PEER_BROAD) {
1494 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, ("=>broad find\n")); 1491 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>broad find\n");
1495 vendor = PEER_BROAD; 1492 vendor = PEER_BROAD;
1496 } else if (memcmp(mac->bssid, ap7_1, 3) == 0 || 1493 } else if (memcmp(mac->bssid, ap7_1, 3) == 0 ||
1497 vendor == PEER_MARV) { 1494 vendor == PEER_MARV) {
1498 vendor = PEER_MARV; 1495 vendor = PEER_MARV;
1499 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, ("=>marv find\n")); 1496 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>marv find\n");
1500 } 1497 }
1501 1498
1502 mac->vendor = vendor; 1499 mac->vendor = vendor;
diff --git a/drivers/net/wireless/rtlwifi/base.h b/drivers/net/wireless/rtlwifi/base.h
index f66b5757f6b9..5a23a6d0f49d 100644
--- a/drivers/net/wireless/rtlwifi/base.h
+++ b/drivers/net/wireless/rtlwifi/base.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c
index dc36d7461caa..5c7d57947d23 100644
--- a/drivers/net/wireless/rtlwifi/cam.c
+++ b/drivers/net/wireless/rtlwifi/cam.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,8 +27,6 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include <linux/export.h> 30#include <linux/export.h>
33#include "wifi.h" 31#include "wifi.h"
34#include "cam.h" 32#include "cam.h"
@@ -55,10 +53,10 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
55 u8 entry_i; 53 u8 entry_i;
56 54
57 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 55 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
58 ("key_cont_128:\n %x:%x:%x:%x:%x:%x\n", 56 "key_cont_128:\n %x:%x:%x:%x:%x:%x\n",
59 key_cont_128[0], key_cont_128[1], 57 key_cont_128[0], key_cont_128[1],
60 key_cont_128[2], key_cont_128[3], 58 key_cont_128[2], key_cont_128[3],
61 key_cont_128[4], key_cont_128[5])); 59 key_cont_128[4], key_cont_128[5]);
62 60
63 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) { 61 for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
64 target_command = entry_i + CAM_CONTENT_COUNT * entry_no; 62 target_command = entry_i + CAM_CONTENT_COUNT * entry_no;
@@ -73,14 +71,12 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
73 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], 71 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
74 target_command); 72 target_command);
75 73
74 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE %x: %x\n",
75 rtlpriv->cfg->maps[WCAMI], target_content);
76 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 76 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
77 ("WRITE %x: %x\n", 77 "The Key ID is %d\n", entry_no);
78 rtlpriv->cfg->maps[WCAMI], target_content)); 78 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE %x: %x\n",
79 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 79 rtlpriv->cfg->maps[RWCAM], target_command);
80 ("The Key ID is %d\n", entry_no));
81 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
82 ("WRITE %x: %x\n",
83 rtlpriv->cfg->maps[RWCAM], target_command));
84 80
85 } else if (entry_i == 1) { 81 } else if (entry_i == 1) {
86 82
@@ -94,10 +90,10 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
94 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], 90 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
95 target_command); 91 target_command);
96 92
97 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 93 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A4: %x\n",
98 ("WRITE A4: %x\n", target_content)); 94 target_content);
99 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 95 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A0: %x\n",
100 ("WRITE A0: %x\n", target_command)); 96 target_command);
101 97
102 } else { 98 } else {
103 99
@@ -114,15 +110,15 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
114 target_command); 110 target_command);
115 udelay(100); 111 udelay(100);
116 112
117 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 113 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A4: %x\n",
118 ("WRITE A4: %x\n", target_content)); 114 target_content);
119 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 115 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A0: %x\n",
120 ("WRITE A0: %x\n", target_command)); 116 target_command);
121 } 117 }
122 } 118 }
123 119
124 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 120 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "after set key, usconfig:%x\n",
125 ("after set key, usconfig:%x\n", us_config)); 121 us_config);
126} 122}
127 123
128u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, 124u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
@@ -133,14 +129,13 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
133 struct rtl_priv *rtlpriv = rtl_priv(hw); 129 struct rtl_priv *rtlpriv = rtl_priv(hw);
134 130
135 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 131 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
136 ("EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, " 132 "EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n",
137 "ulUseDK=%x MacAddr %pM\n", 133 ul_entry_idx, ul_key_id, ul_enc_alg,
138 ul_entry_idx, ul_key_id, ul_enc_alg, 134 ul_default_key, mac_addr);
139 ul_default_key, mac_addr));
140 135
141 if (ul_key_id == TOTAL_CAM_ENTRY) { 136 if (ul_key_id == TOTAL_CAM_ENTRY) {
142 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 137 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
143 ("<=== ulKeyId exceed!\n")); 138 "<=== ulKeyId exceed!\n");
144 return 0; 139 return 0;
145 } 140 }
146 141
@@ -153,7 +148,7 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
153 rtl_cam_program_entry(hw, ul_entry_idx, mac_addr, 148 rtl_cam_program_entry(hw, ul_entry_idx, mac_addr,
154 (u8 *) key_content, us_config); 149 (u8 *) key_content, us_config);
155 150
156 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("<===\n")); 151 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "<===\n");
157 152
158 return 1; 153 return 1;
159 154
@@ -166,7 +161,7 @@ int rtl_cam_delete_one_entry(struct ieee80211_hw *hw,
166 u32 ul_command; 161 u32 ul_command;
167 struct rtl_priv *rtlpriv = rtl_priv(hw); 162 struct rtl_priv *rtlpriv = rtl_priv(hw);
168 163
169 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("key_idx:%d\n", ul_key_id)); 164 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "key_idx:%d\n", ul_key_id);
170 165
171 ul_command = ul_key_id * CAM_CONTENT_COUNT; 166 ul_command = ul_key_id * CAM_CONTENT_COUNT;
172 ul_command = ul_command | BIT(31) | BIT(16); 167 ul_command = ul_command | BIT(31) | BIT(16);
@@ -175,9 +170,9 @@ int rtl_cam_delete_one_entry(struct ieee80211_hw *hw,
175 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command); 170 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);
176 171
177 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 172 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
178 ("rtl_cam_delete_one_entry(): WRITE A4: %x\n", 0)); 173 "rtl_cam_delete_one_entry(): WRITE A4: %x\n", 0);
179 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 174 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
180 ("rtl_cam_delete_one_entry(): WRITE A0: %x\n", ul_command)); 175 "rtl_cam_delete_one_entry(): WRITE A0: %x\n", ul_command);
181 176
182 return 0; 177 return 0;
183 178
@@ -229,9 +224,9 @@ void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index)
229 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command); 224 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);
230 225
231 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 226 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
232 ("rtl_cam_mark_invalid(): WRITE A4: %x\n", ul_content)); 227 "rtl_cam_mark_invalid(): WRITE A4: %x\n", ul_content);
233 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 228 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
234 ("rtl_cam_mark_invalid(): WRITE A0: %x\n", ul_command)); 229 "rtl_cam_mark_invalid(): WRITE A0: %x\n", ul_command);
235} 230}
236EXPORT_SYMBOL(rtl_cam_mark_invalid); 231EXPORT_SYMBOL(rtl_cam_mark_invalid);
237 232
@@ -279,11 +274,11 @@ void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index)
279 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command); 274 rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);
280 275
281 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 276 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
282 ("rtl_cam_empty_entry(): WRITE A4: %x\n", 277 "rtl_cam_empty_entry(): WRITE A4: %x\n",
283 ul_content)); 278 ul_content);
284 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 279 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
285 ("rtl_cam_empty_entry(): WRITE A0: %x\n", 280 "rtl_cam_empty_entry(): WRITE A0: %x\n",
286 ul_command)); 281 ul_command);
287 } 282 }
288 283
289} 284}
@@ -297,8 +292,7 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr)
297 u8 i, *addr; 292 u8 i, *addr;
298 293
299 if (NULL == sta_addr) { 294 if (NULL == sta_addr) {
300 RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, 295 RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, "sta_addr is NULL\n");
301 ("sta_addr is NULL.\n"));
302 return TOTAL_CAM_ENTRY; 296 return TOTAL_CAM_ENTRY;
303 } 297 }
304 /* Does STA already exist? */ 298 /* Does STA already exist? */
@@ -311,8 +305,8 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr)
311 for (entry_idx = 4; entry_idx < TOTAL_CAM_ENTRY; entry_idx++) { 305 for (entry_idx = 4; entry_idx < TOTAL_CAM_ENTRY; entry_idx++) {
312 if ((bitmap & BIT(0)) == 0) { 306 if ((bitmap & BIT(0)) == 0) {
313 RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, 307 RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG,
314 ("-----hwsec_cam_bitmap: 0x%x entry_idx=%d\n", 308 "-----hwsec_cam_bitmap: 0x%x entry_idx=%d\n",
315 rtlpriv->sec.hwsec_cam_bitmap, entry_idx)); 309 rtlpriv->sec.hwsec_cam_bitmap, entry_idx);
316 rtlpriv->sec.hwsec_cam_bitmap |= BIT(0) << entry_idx; 310 rtlpriv->sec.hwsec_cam_bitmap |= BIT(0) << entry_idx;
317 memcpy(rtlpriv->sec.hwsec_cam_sta_addr[entry_idx], 311 memcpy(rtlpriv->sec.hwsec_cam_sta_addr[entry_idx],
318 sta_addr, ETH_ALEN); 312 sta_addr, ETH_ALEN);
@@ -331,14 +325,13 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
331 u8 i, *addr; 325 u8 i, *addr;
332 326
333 if (NULL == sta_addr) { 327 if (NULL == sta_addr) {
334 RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, 328 RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, "sta_addr is NULL\n");
335 ("sta_addr is NULL.\n"));
336 } 329 }
337 330
338 if ((sta_addr[0]|sta_addr[1]|sta_addr[2]|sta_addr[3]|\ 331 if ((sta_addr[0]|sta_addr[1]|sta_addr[2]|sta_addr[3]|\
339 sta_addr[4]|sta_addr[5]) == 0) { 332 sta_addr[4]|sta_addr[5]) == 0) {
340 RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, 333 RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG,
341 ("sta_addr is 00:00:00:00:00:00.\n")); 334 "sta_addr is 00:00:00:00:00:00\n");
342 return; 335 return;
343 } 336 }
344 /* Does STA already exist? */ 337 /* Does STA already exist? */
diff --git a/drivers/net/wireless/rtlwifi/cam.h b/drivers/net/wireless/rtlwifi/cam.h
index c62da4eefc75..35e00086a520 100644
--- a/drivers/net/wireless/rtlwifi/cam.h
+++ b/drivers/net/wireless/rtlwifi/cam.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index 3f0f056fae9c..f231b9180436 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -31,8 +31,50 @@
31#include "core.h" 31#include "core.h"
32#include "cam.h" 32#include "cam.h"
33#include "base.h" 33#include "base.h"
34#include "pci.h"
34#include "ps.h" 35#include "ps.h"
35 36
37#include <linux/export.h>
38
39void rtl_fw_cb(const struct firmware *firmware, void *context)
40{
41 struct ieee80211_hw *hw = context;
42 struct rtl_priv *rtlpriv = rtl_priv(hw);
43 int err;
44
45 RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
46 "Firmware callback routine entered!\n");
47 complete(&rtlpriv->firmware_loading_complete);
48 if (!firmware) {
49 pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
50 rtlpriv->max_fw_size = 0;
51 return;
52 }
53 if (firmware->size > rtlpriv->max_fw_size) {
54 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
55 "Firmware is too big!\n");
56 release_firmware(firmware);
57 return;
58 }
59 memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size);
60 rtlpriv->rtlhal.fwsize = firmware->size;
61 release_firmware(firmware);
62
63 err = ieee80211_register_hw(hw);
64 if (err) {
65 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
66 "Can't register mac80211 hw\n");
67 return;
68 } else {
69 rtlpriv->mac80211.mac80211_registered = 1;
70 }
71 set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
72
73 /*init rfkill */
74 rtl_init_rfkill(hw);
75}
76EXPORT_SYMBOL(rtl_fw_cb);
77
36/*mutex for start & stop is must here. */ 78/*mutex for start & stop is must here. */
37static int rtl_op_start(struct ieee80211_hw *hw) 79static int rtl_op_start(struct ieee80211_hw *hw)
38{ 80{
@@ -112,9 +154,11 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
112 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 154 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
113 int err = 0; 155 int err = 0;
114 156
157 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
158
115 if (mac->vif) { 159 if (mac->vif) {
116 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 160 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
117 ("vif has been set!! mac->vif = 0x%p\n", mac->vif)); 161 "vif has been set!! mac->vif = 0x%p\n", mac->vif);
118 return -EOPNOTSUPP; 162 return -EOPNOTSUPP;
119 } 163 }
120 164
@@ -125,7 +169,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
125 case NL80211_IFTYPE_STATION: 169 case NL80211_IFTYPE_STATION:
126 if (mac->beacon_enabled == 1) { 170 if (mac->beacon_enabled == 1) {
127 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 171 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
128 ("NL80211_IFTYPE_STATION\n")); 172 "NL80211_IFTYPE_STATION\n");
129 mac->beacon_enabled = 0; 173 mac->beacon_enabled = 0;
130 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0, 174 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
131 rtlpriv->cfg->maps 175 rtlpriv->cfg->maps
@@ -134,7 +178,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
134 break; 178 break;
135 case NL80211_IFTYPE_ADHOC: 179 case NL80211_IFTYPE_ADHOC:
136 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 180 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
137 ("NL80211_IFTYPE_ADHOC\n")); 181 "NL80211_IFTYPE_ADHOC\n");
138 182
139 mac->link_state = MAC80211_LINKED; 183 mac->link_state = MAC80211_LINKED;
140 rtlpriv->cfg->ops->set_bcn_reg(hw); 184 rtlpriv->cfg->ops->set_bcn_reg(hw);
@@ -148,7 +192,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
148 break; 192 break;
149 case NL80211_IFTYPE_AP: 193 case NL80211_IFTYPE_AP:
150 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 194 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
151 ("NL80211_IFTYPE_AP\n")); 195 "NL80211_IFTYPE_AP\n");
152 196
153 mac->link_state = MAC80211_LINKED; 197 mac->link_state = MAC80211_LINKED;
154 rtlpriv->cfg->ops->set_bcn_reg(hw); 198 rtlpriv->cfg->ops->set_bcn_reg(hw);
@@ -161,7 +205,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
161 break; 205 break;
162 default: 206 default:
163 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 207 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
164 ("operation mode %d is not support!\n", vif->type)); 208 "operation mode %d is not supported!\n", vif->type);
165 err = -EOPNOTSUPP; 209 err = -EOPNOTSUPP;
166 goto out; 210 goto out;
167 } 211 }
@@ -221,7 +265,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
221 mutex_lock(&rtlpriv->locks.conf_mutex); 265 mutex_lock(&rtlpriv->locks.conf_mutex);
222 if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /*BIT(2)*/ 266 if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /*BIT(2)*/
223 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 267 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
224 ("IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n")); 268 "IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n");
225 } 269 }
226 270
227 /*For IPS */ 271 /*For IPS */
@@ -252,10 +296,12 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
252 * because that will cause nullfunc send by mac80211 296 * because that will cause nullfunc send by mac80211
253 * fail, and cause pkt loss, we have tested that 5mA 297 * fail, and cause pkt loss, we have tested that 5mA
254 * is worked very well */ 298 * is worked very well */
255 if (!rtlpriv->psc.multi_buffered) 299 if (!rtlpriv->psc.multi_buffered) {
256 queue_delayed_work(rtlpriv->works.rtl_wq, 300 queue_delayed_work(rtlpriv->works.rtl_wq,
257 &rtlpriv->works.ps_work, 301 &rtlpriv->works.ps_work,
258 MSECS(5)); 302 MSECS(5));
303 pr_info("In section\n");
304 }
259 } else { 305 } else {
260 rtl_swlps_rf_awake(hw); 306 rtl_swlps_rf_awake(hw);
261 rtlpriv->psc.sw_ps_enabled = false; 307 rtlpriv->psc.sw_ps_enabled = false;
@@ -264,8 +310,8 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
264 310
265 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) { 311 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
266 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 312 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
267 ("IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n", 313 "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n",
268 hw->conf.long_frame_max_tx_count)); 314 hw->conf.long_frame_max_tx_count);
269 mac->retry_long = hw->conf.long_frame_max_tx_count; 315 mac->retry_long = hw->conf.long_frame_max_tx_count;
270 mac->retry_short = hw->conf.long_frame_max_tx_count; 316 mac->retry_short = hw->conf.long_frame_max_tx_count;
271 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT, 317 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
@@ -320,7 +366,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
320 default: 366 default:
321 mac->bw_40 = false; 367 mac->bw_40 = false;
322 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 368 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
323 ("switch case not processed\n")); 369 "switch case not processed\n");
324 break; 370 break;
325 } 371 }
326 372
@@ -369,12 +415,12 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
369 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AM] | 415 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AM] |
370 rtlpriv->cfg->maps[MAC_RCR_AB]; 416 rtlpriv->cfg->maps[MAC_RCR_AB];
371 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 417 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
372 ("Enable receive multicast frame.\n")); 418 "Enable receive multicast frame\n");
373 } else { 419 } else {
374 mac->rx_conf &= ~(rtlpriv->cfg->maps[MAC_RCR_AM] | 420 mac->rx_conf &= ~(rtlpriv->cfg->maps[MAC_RCR_AM] |
375 rtlpriv->cfg->maps[MAC_RCR_AB]); 421 rtlpriv->cfg->maps[MAC_RCR_AB]);
376 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 422 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
377 ("Disable receive multicast frame.\n")); 423 "Disable receive multicast frame\n");
378 } 424 }
379 } 425 }
380 426
@@ -382,11 +428,11 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
382 if (*new_flags & FIF_FCSFAIL) { 428 if (*new_flags & FIF_FCSFAIL) {
383 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACRC32]; 429 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACRC32];
384 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 430 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
385 ("Enable receive FCS error frame.\n")); 431 "Enable receive FCS error frame\n");
386 } else { 432 } else {
387 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACRC32]; 433 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACRC32];
388 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 434 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
389 ("Disable receive FCS error frame.\n")); 435 "Disable receive FCS error frame\n");
390 } 436 }
391 } 437 }
392 438
@@ -409,11 +455,11 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
409 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACF]; 455 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACF];
410 456
411 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 457 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
412 ("Enable receive control frame.\n")); 458 "Enable receive control frame\n");
413 } else { 459 } else {
414 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACF]; 460 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACF];
415 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 461 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
416 ("Disable receive control frame.\n")); 462 "Disable receive control frame\n");
417 } 463 }
418 } 464 }
419 465
@@ -421,11 +467,11 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
421 if (*new_flags & FIF_OTHER_BSS) { 467 if (*new_flags & FIF_OTHER_BSS) {
422 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AAP]; 468 mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AAP];
423 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 469 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
424 ("Enable receive other BSS's frame.\n")); 470 "Enable receive other BSS's frame\n");
425 } else { 471 } else {
426 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_AAP]; 472 mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_AAP];
427 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 473 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
428 ("Disable receive other BSS's frame.\n")); 474 "Disable receive other BSS's frame\n");
429 } 475 }
430 } 476 }
431} 477}
@@ -456,7 +502,7 @@ static int rtl_op_sta_add(struct ieee80211_hw *hw,
456 sta_entry->wireless_mode = WIRELESS_MODE_G; 502 sta_entry->wireless_mode = WIRELESS_MODE_G;
457 503
458 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 504 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
459 ("Add sta addr is %pM\n", sta->addr)); 505 "Add sta addr is %pM\n", sta->addr);
460 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); 506 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0);
461 } 507 }
462 return 0; 508 return 0;
@@ -469,7 +515,7 @@ static int rtl_op_sta_remove(struct ieee80211_hw *hw,
469 struct rtl_sta_info *sta_entry; 515 struct rtl_sta_info *sta_entry;
470 if (sta) { 516 if (sta) {
471 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 517 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
472 ("Remove sta addr is %pM\n", sta->addr)); 518 "Remove sta addr is %pM\n", sta->addr);
473 sta_entry = (struct rtl_sta_info *) sta->drv_priv; 519 sta_entry = (struct rtl_sta_info *) sta->drv_priv;
474 sta_entry->wireless_mode = 0; 520 sta_entry->wireless_mode = 0;
475 sta_entry->ratr_index = 0; 521 sta_entry->ratr_index = 0;
@@ -514,7 +560,7 @@ static int rtl_op_conf_tx(struct ieee80211_hw *hw,
514 560
515 if (queue >= AC_MAX) { 561 if (queue >= AC_MAX) {
516 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 562 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
517 ("queue number %d is incorrect!\n", queue)); 563 "queue number %d is incorrect!\n", queue);
518 return -EINVAL; 564 return -EINVAL;
519 } 565 }
520 566
@@ -547,7 +593,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
547 bss_conf->enable_beacon)) { 593 bss_conf->enable_beacon)) {
548 if (mac->beacon_enabled == 0) { 594 if (mac->beacon_enabled == 0) {
549 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 595 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
550 ("BSS_CHANGED_BEACON_ENABLED\n")); 596 "BSS_CHANGED_BEACON_ENABLED\n");
551 597
552 /*start hw beacon interrupt. */ 598 /*start hw beacon interrupt. */
553 /*rtlpriv->cfg->ops->set_bcn_reg(hw); */ 599 /*rtlpriv->cfg->ops->set_bcn_reg(hw); */
@@ -565,7 +611,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
565 !bss_conf->enable_beacon)) { 611 !bss_conf->enable_beacon)) {
566 if (mac->beacon_enabled == 1) { 612 if (mac->beacon_enabled == 1) {
567 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 613 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
568 ("ADHOC DISABLE BEACON\n")); 614 "ADHOC DISABLE BEACON\n");
569 615
570 mac->beacon_enabled = 0; 616 mac->beacon_enabled = 0;
571 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0, 617 rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
@@ -575,7 +621,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
575 } 621 }
576 if (changed & BSS_CHANGED_BEACON_INT) { 622 if (changed & BSS_CHANGED_BEACON_INT) {
577 RT_TRACE(rtlpriv, COMP_BEACON, DBG_TRACE, 623 RT_TRACE(rtlpriv, COMP_BEACON, DBG_TRACE,
578 ("BSS_CHANGED_BEACON_INT\n")); 624 "BSS_CHANGED_BEACON_INT\n");
579 mac->beacon_interval = bss_conf->beacon_int; 625 mac->beacon_interval = bss_conf->beacon_int;
580 rtlpriv->cfg->ops->set_bcn_intv(hw); 626 rtlpriv->cfg->ops->set_bcn_intv(hw);
581 } 627 }
@@ -604,7 +650,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
604 if (mac->opmode == NL80211_IFTYPE_STATION && sta) 650 if (mac->opmode == NL80211_IFTYPE_STATION && sta)
605 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); 651 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0);
606 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 652 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
607 ("BSS_CHANGED_ASSOC\n")); 653 "BSS_CHANGED_ASSOC\n");
608 } else { 654 } else {
609 if (mac->link_state == MAC80211_LINKED) 655 if (mac->link_state == MAC80211_LINKED)
610 rtl_lps_leave(hw); 656 rtl_lps_leave(hw);
@@ -619,20 +665,20 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
619 mac->vendor = PEER_UNKNOWN; 665 mac->vendor = PEER_UNKNOWN;
620 666
621 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 667 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
622 ("BSS_CHANGED_UN_ASSOC\n")); 668 "BSS_CHANGED_UN_ASSOC\n");
623 } 669 }
624 } 670 }
625 671
626 if (changed & BSS_CHANGED_ERP_CTS_PROT) { 672 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
627 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 673 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
628 ("BSS_CHANGED_ERP_CTS_PROT\n")); 674 "BSS_CHANGED_ERP_CTS_PROT\n");
629 mac->use_cts_protect = bss_conf->use_cts_prot; 675 mac->use_cts_protect = bss_conf->use_cts_prot;
630 } 676 }
631 677
632 if (changed & BSS_CHANGED_ERP_PREAMBLE) { 678 if (changed & BSS_CHANGED_ERP_PREAMBLE) {
633 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, 679 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
634 ("BSS_CHANGED_ERP_PREAMBLE use short preamble:%x\n", 680 "BSS_CHANGED_ERP_PREAMBLE use short preamble:%x\n",
635 bss_conf->use_short_preamble)); 681 bss_conf->use_short_preamble);
636 682
637 mac->short_preamble = bss_conf->use_short_preamble; 683 mac->short_preamble = bss_conf->use_short_preamble;
638 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACK_PREAMBLE, 684 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACK_PREAMBLE,
@@ -641,7 +687,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
641 687
642 if (changed & BSS_CHANGED_ERP_SLOT) { 688 if (changed & BSS_CHANGED_ERP_SLOT) {
643 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 689 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
644 ("BSS_CHANGED_ERP_SLOT\n")); 690 "BSS_CHANGED_ERP_SLOT\n");
645 691
646 if (bss_conf->use_short_slot) 692 if (bss_conf->use_short_slot)
647 mac->slot_time = RTL_SLOT_TIME_9; 693 mac->slot_time = RTL_SLOT_TIME_9;
@@ -653,8 +699,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
653 } 699 }
654 700
655 if (changed & BSS_CHANGED_HT) { 701 if (changed & BSS_CHANGED_HT) {
656 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 702 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, "BSS_CHANGED_HT\n");
657 ("BSS_CHANGED_HT\n"));
658 rcu_read_lock(); 703 rcu_read_lock();
659 sta = get_sta(hw, vif, bss_conf->bssid); 704 sta = get_sta(hw, vif, bss_conf->bssid);
660 if (sta) { 705 if (sta) {
@@ -683,8 +728,8 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
683 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BSSID, 728 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BSSID,
684 (u8 *) bss_conf->bssid); 729 (u8 *) bss_conf->bssid);
685 730
686 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, 731 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, "%pM\n",
687 ("%pM\n", bss_conf->bssid)); 732 bss_conf->bssid);
688 733
689 mac->vendor = PEER_UNKNOWN; 734 mac->vendor = PEER_UNKNOWN;
690 memcpy(mac->bssid, bss_conf->bssid, 6); 735 memcpy(mac->bssid, bss_conf->bssid, 6);
@@ -831,30 +876,30 @@ static int rtl_op_ampdu_action(struct ieee80211_hw *hw,
831 switch (action) { 876 switch (action) {
832 case IEEE80211_AMPDU_TX_START: 877 case IEEE80211_AMPDU_TX_START:
833 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 878 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
834 ("IEEE80211_AMPDU_TX_START: TID:%d\n", tid)); 879 "IEEE80211_AMPDU_TX_START: TID:%d\n", tid);
835 return rtl_tx_agg_start(hw, sta, tid, ssn); 880 return rtl_tx_agg_start(hw, sta, tid, ssn);
836 break; 881 break;
837 case IEEE80211_AMPDU_TX_STOP: 882 case IEEE80211_AMPDU_TX_STOP:
838 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 883 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
839 ("IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid)); 884 "IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid);
840 return rtl_tx_agg_stop(hw, sta, tid); 885 return rtl_tx_agg_stop(hw, sta, tid);
841 break; 886 break;
842 case IEEE80211_AMPDU_TX_OPERATIONAL: 887 case IEEE80211_AMPDU_TX_OPERATIONAL:
843 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 888 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
844 ("IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid)); 889 "IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid);
845 rtl_tx_agg_oper(hw, sta, tid); 890 rtl_tx_agg_oper(hw, sta, tid);
846 break; 891 break;
847 case IEEE80211_AMPDU_RX_START: 892 case IEEE80211_AMPDU_RX_START:
848 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 893 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
849 ("IEEE80211_AMPDU_RX_START:TID:%d\n", tid)); 894 "IEEE80211_AMPDU_RX_START:TID:%d\n", tid);
850 break; 895 break;
851 case IEEE80211_AMPDU_RX_STOP: 896 case IEEE80211_AMPDU_RX_STOP:
852 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, 897 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE,
853 ("IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid)); 898 "IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid);
854 break; 899 break;
855 default: 900 default:
856 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 901 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
857 ("IEEE80211_AMPDU_ERR!!!!:\n")); 902 "IEEE80211_AMPDU_ERR!!!!:\n");
858 return -EOPNOTSUPP; 903 return -EOPNOTSUPP;
859 } 904 }
860 return 0; 905 return 0;
@@ -867,7 +912,7 @@ static void rtl_op_sw_scan_start(struct ieee80211_hw *hw)
867 912
868 mac->act_scanning = true; 913 mac->act_scanning = true;
869 914
870 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, ("\n")); 915 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "\n");
871 916
872 if (mac->link_state == MAC80211_LINKED) { 917 if (mac->link_state == MAC80211_LINKED) {
873 rtl_lps_leave(hw); 918 rtl_lps_leave(hw);
@@ -888,7 +933,7 @@ static void rtl_op_sw_scan_complete(struct ieee80211_hw *hw)
888 struct rtl_priv *rtlpriv = rtl_priv(hw); 933 struct rtl_priv *rtlpriv = rtl_priv(hw);
889 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 934 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
890 935
891 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, ("\n")); 936 RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "\n");
892 mac->act_scanning = false; 937 mac->act_scanning = false;
893 /* Dual mac */ 938 /* Dual mac */
894 rtlpriv->rtlhal.load_imrandiqk_setting_for2g = false; 939 rtlpriv->rtlhal.load_imrandiqk_setting_for2g = false;
@@ -921,13 +966,13 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
921 966
922 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { 967 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
923 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 968 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
924 ("not open hw encryption\n")); 969 "not open hw encryption\n");
925 return -ENOSPC; /*User disabled HW-crypto */ 970 return -ENOSPC; /*User disabled HW-crypto */
926 } 971 }
927 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 972 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
928 ("%s hardware based encryption for keyidx: %d, mac: %pM\n", 973 "%s hardware based encryption for keyidx: %d, mac: %pM\n",
929 cmd == SET_KEY ? "Using" : "Disabling", key->keyidx, 974 cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
930 sta ? sta->addr : bcast_addr)); 975 sta ? sta->addr : bcast_addr);
931 rtlpriv->sec.being_setkey = true; 976 rtlpriv->sec.being_setkey = true;
932 rtl_ips_nic_on(hw); 977 rtl_ips_nic_on(hw);
933 mutex_lock(&rtlpriv->locks.conf_mutex); 978 mutex_lock(&rtlpriv->locks.conf_mutex);
@@ -936,24 +981,23 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
936 switch (key->cipher) { 981 switch (key->cipher) {
937 case WLAN_CIPHER_SUITE_WEP40: 982 case WLAN_CIPHER_SUITE_WEP40:
938 key_type = WEP40_ENCRYPTION; 983 key_type = WEP40_ENCRYPTION;
939 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("alg:WEP40\n")); 984 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:WEP40\n");
940 break; 985 break;
941 case WLAN_CIPHER_SUITE_WEP104: 986 case WLAN_CIPHER_SUITE_WEP104:
942 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 987 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:WEP104\n");
943 ("alg:WEP104\n"));
944 key_type = WEP104_ENCRYPTION; 988 key_type = WEP104_ENCRYPTION;
945 break; 989 break;
946 case WLAN_CIPHER_SUITE_TKIP: 990 case WLAN_CIPHER_SUITE_TKIP:
947 key_type = TKIP_ENCRYPTION; 991 key_type = TKIP_ENCRYPTION;
948 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("alg:TKIP\n")); 992 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:TKIP\n");
949 break; 993 break;
950 case WLAN_CIPHER_SUITE_CCMP: 994 case WLAN_CIPHER_SUITE_CCMP:
951 key_type = AESCCMP_ENCRYPTION; 995 key_type = AESCCMP_ENCRYPTION;
952 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("alg:CCMP\n")); 996 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:CCMP\n");
953 break; 997 break;
954 default: 998 default:
955 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 999 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "alg_err:%x!!!!\n",
956 ("alg_err:%x!!!!:\n", key->cipher)); 1000 key->cipher);
957 goto out_unlock; 1001 goto out_unlock;
958 } 1002 }
959 if (key_type == WEP40_ENCRYPTION || 1003 if (key_type == WEP40_ENCRYPTION ||
@@ -995,8 +1039,8 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
995 wep_only = true; 1039 wep_only = true;
996 rtlpriv->sec.pairwise_enc_algorithm = key_type; 1040 rtlpriv->sec.pairwise_enc_algorithm = key_type;
997 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 1041 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
998 ("set enable_hw_sec, key_type:%x(OPEN:0 WEP40:1" 1042 "set enable_hw_sec, key_type:%x(OPEN:0 WEP40:1 TKIP:2 AES:4 WEP104:5)\n",
999 " TKIP:2 AES:4 WEP104:5)\n", key_type)); 1043 key_type);
1000 rtlpriv->cfg->ops->enable_hw_sec(hw); 1044 rtlpriv->cfg->ops->enable_hw_sec(hw);
1001 } 1045 }
1002 } 1046 }
@@ -1005,7 +1049,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1005 case SET_KEY: 1049 case SET_KEY:
1006 if (wep_only) { 1050 if (wep_only) {
1007 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 1051 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
1008 ("set WEP(group/pairwise) key\n")); 1052 "set WEP(group/pairwise) key\n");
1009 /* Pairwise key with an assigned MAC address. */ 1053 /* Pairwise key with an assigned MAC address. */
1010 rtlpriv->sec.pairwise_enc_algorithm = key_type; 1054 rtlpriv->sec.pairwise_enc_algorithm = key_type;
1011 rtlpriv->sec.group_enc_algorithm = key_type; 1055 rtlpriv->sec.group_enc_algorithm = key_type;
@@ -1016,7 +1060,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1016 memcpy(mac_addr, zero_addr, ETH_ALEN); 1060 memcpy(mac_addr, zero_addr, ETH_ALEN);
1017 } else if (group_key) { /* group key */ 1061 } else if (group_key) { /* group key */
1018 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 1062 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
1019 ("set group key\n")); 1063 "set group key\n");
1020 /* group key */ 1064 /* group key */
1021 rtlpriv->sec.group_enc_algorithm = key_type; 1065 rtlpriv->sec.group_enc_algorithm = key_type;
1022 /*set local buf about group key. */ 1066 /*set local buf about group key. */
@@ -1026,10 +1070,10 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1026 memcpy(mac_addr, bcast_addr, ETH_ALEN); 1070 memcpy(mac_addr, bcast_addr, ETH_ALEN);
1027 } else { /* pairwise key */ 1071 } else { /* pairwise key */
1028 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 1072 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
1029 ("set pairwise key\n")); 1073 "set pairwise key\n");
1030 if (!sta) { 1074 if (!sta) {
1031 RT_ASSERT(false, ("pairwise key withnot" 1075 RT_ASSERT(false,
1032 "mac_addr\n")); 1076 "pairwise key without mac_addr\n");
1033 1077
1034 err = -EOPNOTSUPP; 1078 err = -EOPNOTSUPP;
1035 goto out_unlock; 1079 goto out_unlock;
@@ -1056,7 +1100,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1056 break; 1100 break;
1057 case DISABLE_KEY: 1101 case DISABLE_KEY:
1058 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 1102 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
1059 ("disable key delete one entry\n")); 1103 "disable key delete one entry\n");
1060 /*set local buf about wep key. */ 1104 /*set local buf about wep key. */
1061 if (mac->opmode == NL80211_IFTYPE_AP) { 1105 if (mac->opmode == NL80211_IFTYPE_AP) {
1062 if (sta) 1106 if (sta)
@@ -1077,7 +1121,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1077 break; 1121 break;
1078 default: 1122 default:
1079 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1123 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1080 ("cmd_err:%x!!!!:\n", cmd)); 1124 "cmd_err:%x!!!!\n", cmd);
1081 } 1125 }
1082out_unlock: 1126out_unlock:
1083 mutex_unlock(&rtlpriv->locks.conf_mutex); 1127 mutex_unlock(&rtlpriv->locks.conf_mutex);
@@ -1106,8 +1150,8 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw)
1106 rtlpriv->rfkill.rfkill_state = radio_state; 1150 rtlpriv->rfkill.rfkill_state = radio_state;
1107 1151
1108 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 1152 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
1109 (KERN_INFO "wireless radio switch turned %s\n", 1153 "wireless radio switch turned %s\n",
1110 radio_state ? "on" : "off")); 1154 radio_state ? "on" : "off");
1111 1155
1112 blocked = (rtlpriv->rfkill.rfkill_state == 1) ? 0 : 1; 1156 blocked = (rtlpriv->rfkill.rfkill_state == 1) ? 0 : 1;
1113 wiphy_rfkill_set_hw_state(hw->wiphy, blocked); 1157 wiphy_rfkill_set_hw_state(hw->wiphy, blocked);
diff --git a/drivers/net/wireless/rtlwifi/core.h b/drivers/net/wireless/rtlwifi/core.h
index f02824a3b747..2fe46a1b4f1f 100644
--- a/drivers/net/wireless/rtlwifi/core.h
+++ b/drivers/net/wireless/rtlwifi/core.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * Tmis program is free software; you can redistribute it and/or modify it 5 * Tmis program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -30,8 +30,6 @@
30#ifndef __RTL_CORE_H__ 30#ifndef __RTL_CORE_H__
31#define __RTL_CORE_H__ 31#define __RTL_CORE_H__
32 32
33#include <net/mac80211.h>
34
35#define RTL_SUPPORTED_FILTERS \ 33#define RTL_SUPPORTED_FILTERS \
36 (FIF_PROMISC_IN_BSS | \ 34 (FIF_PROMISC_IN_BSS | \
37 FIF_ALLMULTI | FIF_CONTROL | \ 35 FIF_ALLMULTI | FIF_CONTROL | \
@@ -42,4 +40,6 @@
42#define RTL_SUPPORTED_CTRL_FILTER 0xFF 40#define RTL_SUPPORTED_CTRL_FILTER 0xFF
43 41
44extern const struct ieee80211_ops rtl_ops; 42extern const struct ieee80211_ops rtl_ops;
43void rtl_fw_cb(const struct firmware *firmware, void *context);
44
45#endif 45#endif
diff --git a/drivers/net/wireless/rtlwifi/debug.c b/drivers/net/wireless/rtlwifi/debug.c
index 1b5cb7153a52..bdda9b2fffe1 100644
--- a/drivers/net/wireless/rtlwifi/debug.c
+++ b/drivers/net/wireless/rtlwifi/debug.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * Tmis program is free software; you can redistribute it and/or modify it 5 * Tmis program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -28,6 +28,8 @@
28 28
29#include "wifi.h" 29#include "wifi.h"
30 30
31#include <linux/moduleparam.h>
32
31void rtl_dbgp_flag_init(struct ieee80211_hw *hw) 33void rtl_dbgp_flag_init(struct ieee80211_hw *hw)
32{ 34{
33 struct rtl_priv *rtlpriv = rtl_priv(hw); 35 struct rtl_priv *rtlpriv = rtl_priv(hw);
diff --git a/drivers/net/wireless/rtlwifi/debug.h b/drivers/net/wireless/rtlwifi/debug.h
index 160dd0685213..07493d2957f2 100644
--- a/drivers/net/wireless/rtlwifi/debug.h
+++ b/drivers/net/wireless/rtlwifi/debug.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * Tmis program is free software; you can redistribute it and/or modify it 5 * Tmis program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -156,53 +156,78 @@ enum dbgp_flag_e {
156 DBGP_TYPE_MAX 156 DBGP_TYPE_MAX
157}; 157};
158 158
159#define RT_ASSERT(_exp, fmt) \ 159#ifdef CONFIG_RTLWIFI_DEBUG
160 do { \ 160
161 if (!(_exp)) { \ 161#define RT_ASSERT(_exp, fmt, ...) \
162 printk(KERN_DEBUG "%s:%s(): ", KBUILD_MODNAME, \ 162do { \
163 __func__); \ 163 if (!(_exp)) { \
164 printk fmt; \ 164 printk(KERN_DEBUG KBUILD_MODNAME ":%s(): " fmt, \
165 } \ 165 __func__, ##__VA_ARGS__); \
166 } while (0); 166 } \
167 167} while (0)
168#define RT_TRACE(rtlpriv, comp, level, fmt)\ 168
169 do { \ 169#define RT_TRACE(rtlpriv, comp, level, fmt, ...) \
170 if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \ 170do { \
171 ((level) <= rtlpriv->dbg.global_debuglevel))) {\ 171 if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \
172 printk(KERN_DEBUG "%s:%s():<%lx-%x> ", KBUILD_MODNAME, \ 172 ((level) <= rtlpriv->dbg.global_debuglevel))) { \
173 __func__, in_interrupt(), in_atomic()); \ 173 printk(KERN_DEBUG KBUILD_MODNAME ":%s():<%lx-%x> " fmt, \
174 printk fmt; \ 174 __func__, in_interrupt(), in_atomic(), \
175 } \ 175 ##__VA_ARGS__); \
176 } while (0); 176 } \
177 177} while (0)
178#define RTPRINT(rtlpriv, dbgtype, dbgflag, printstr) \ 178
179 do { \ 179#define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...) \
180 if (unlikely(rtlpriv->dbg.dbgp_type[dbgtype] & dbgflag)) { \ 180do { \
181 printk(KERN_DEBUG "%s: ", KBUILD_MODNAME); \ 181 if (unlikely(rtlpriv->dbg.dbgp_type[dbgtype] & dbgflag)) { \
182 printk printstr; \ 182 printk(KERN_DEBUG KBUILD_MODNAME ": " fmt, \
183 } \ 183 ##__VA_ARGS__); \
184 } while (0); 184 } \
185 185} while (0)
186#define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata, \ 186
187 _hexdatalen) \ 187#define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata, \
188 do {\ 188 _hexdatalen) \
189 if (unlikely(((_comp) & rtlpriv->dbg.global_debugcomponents) &&\ 189do { \
190 (_level <= rtlpriv->dbg.global_debuglevel))) { \ 190 if (unlikely(((_comp) & rtlpriv->dbg.global_debugcomponents) && \
191 int __i; \ 191 (_level <= rtlpriv->dbg.global_debuglevel))) { \
192 u8* ptr = (u8 *)_hexdata; \ 192 printk(KERN_DEBUG "%s: In process \"%s\" (pid %i): %s\n", \
193 printk(KERN_DEBUG "%s: ", KBUILD_MODNAME); \ 193 KBUILD_MODNAME, current->comm, current->pid, \
194 printk("In process \"%s\" (pid %i):", current->comm,\ 194 _titlestring); \
195 current->pid); \ 195 print_hex_dump_bytes("", DUMP_PREFIX_NONE, \
196 printk(_titlestring); \ 196 _hexdata, _hexdatalen); \
197 for (__i = 0; __i < (int)_hexdatalen; __i++) { \ 197 } \
198 printk("%02X%s", ptr[__i], (((__i + 1) % 4)\ 198} while (0)
199 == 0) ? " " : " ");\ 199
200 if (((__i + 1) % 16) == 0) \ 200#else
201 printk("\n"); \ 201
202 } \ 202struct rtl_priv;
203 printk(KERN_DEBUG "\n"); \ 203
204 } \ 204__printf(2, 3)
205 } while (0); 205static inline void RT_ASSERT(int exp, const char *fmt, ...)
206{
207}
208
209__printf(4, 5)
210static inline void RT_TRACE(struct rtl_priv *rtlpriv,
211 int comp, int level,
212 const char *fmt, ...)
213{
214}
215
216__printf(4, 5)
217static inline void RTPRINT(struct rtl_priv *rtlpriv,
218 int dbgtype, int dbgflag,
219 const char *fmt, ...)
220{
221}
222
223static inline void RT_PRINT_DATA(struct rtl_priv *rtlpriv,
224 int comp, int level,
225 const char *titlestring,
226 const void *hexdata, size_t hexdatalen)
227{
228}
229
230#endif
206 231
207void rtl_dbgp_flag_init(struct ieee80211_hw *hw); 232void rtl_dbgp_flag_init(struct ieee80211_hw *hw);
208#endif 233#endif
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index ed1058b71587..b24cbe6e16d8 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * Tmis program is free software; you can redistribute it and/or modify it 5 * Tmis program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -162,8 +162,8 @@ void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value)
162 const u32 efuse_len = 162 const u32 efuse_len =
163 rtlpriv->cfg->maps[EFUSE_REAL_CONTENT_SIZE]; 163 rtlpriv->cfg->maps[EFUSE_REAL_CONTENT_SIZE];
164 164
165 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, 165 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "Addr=%x Data =%x\n",
166 ("Addr=%x Data =%x\n", address, value)); 166 address, value);
167 167
168 if (address < efuse_len) { 168 if (address < efuse_len) {
169 rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL], value); 169 rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL], value);
@@ -252,8 +252,8 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
252 252
253 if ((_offset + _size_byte) > rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]) { 253 if ((_offset + _size_byte) > rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]) {
254 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, 254 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD,
255 ("read_efuse(): Invalid offset(%#x) with read " 255 "read_efuse(): Invalid offset(%#x) with read bytes(%#x)!!\n",
256 "bytes(%#x)!!\n", _offset, _size_byte)); 256 _offset, _size_byte);
257 return; 257 return;
258 } 258 }
259 259
@@ -280,7 +280,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
280 if (*rtemp8 != 0xFF) { 280 if (*rtemp8 != 0xFF) {
281 efuse_utilized++; 281 efuse_utilized++;
282 RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL, 282 RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL,
283 ("Addr=%d\n", efuse_addr)); 283 "Addr=%d\n", efuse_addr);
284 efuse_addr++; 284 efuse_addr++;
285 } 285 }
286 286
@@ -290,13 +290,13 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
290 if (offset < efuse_max_section) { 290 if (offset < efuse_max_section) {
291 wren = (*rtemp8 & 0x0f); 291 wren = (*rtemp8 & 0x0f);
292 RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL, 292 RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL,
293 ("offset-%d Worden=%x\n", offset, wren)); 293 "offset-%d Worden=%x\n", offset, wren);
294 294
295 for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { 295 for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) {
296 if (!(wren & 0x01)) { 296 if (!(wren & 0x01)) {
297 RTPRINT(rtlpriv, FEEPROM, 297 RTPRINT(rtlpriv, FEEPROM,
298 EFUSE_READ_ALL, ("Addr=%d\n", 298 EFUSE_READ_ALL,
299 efuse_addr)); 299 "Addr=%d\n", efuse_addr);
300 300
301 read_efuse_byte(hw, efuse_addr, rtemp8); 301 read_efuse_byte(hw, efuse_addr, rtemp8);
302 efuse_addr++; 302 efuse_addr++;
@@ -308,8 +308,8 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
308 break; 308 break;
309 309
310 RTPRINT(rtlpriv, FEEPROM, 310 RTPRINT(rtlpriv, FEEPROM,
311 EFUSE_READ_ALL, ("Addr=%d\n", 311 EFUSE_READ_ALL,
312 efuse_addr)); 312 "Addr=%d\n", efuse_addr);
313 313
314 read_efuse_byte(hw, efuse_addr, rtemp8); 314 read_efuse_byte(hw, efuse_addr, rtemp8);
315 efuse_addr++; 315 efuse_addr++;
@@ -326,7 +326,7 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
326 } 326 }
327 327
328 RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL, 328 RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL,
329 ("Addr=%d\n", efuse_addr)); 329 "Addr=%d\n", efuse_addr);
330 read_efuse_byte(hw, efuse_addr, rtemp8); 330 read_efuse_byte(hw, efuse_addr, rtemp8);
331 if (*rtemp8 != 0xFF && (efuse_addr < efuse_len)) { 331 if (*rtemp8 != 0xFF && (efuse_addr < efuse_len)) {
332 efuse_utilized++; 332 efuse_utilized++;
@@ -395,9 +395,8 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw)
395 result = false; 395 result = false;
396 396
397 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, 397 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD,
398 ("efuse_shadow_update_chk(): totalbytes(%#x), " 398 "efuse_shadow_update_chk(): totalbytes(%#x), hdr_num(%#x), words_need(%#x), efuse_used(%d)\n",
399 "hdr_num(%#x), words_need(%#x), efuse_used(%d)\n", 399 totalbytes, hdr_num, words_need, efuse_used);
400 totalbytes, hdr_num, words_need, efuse_used));
401 400
402 return result; 401 return result;
403} 402}
@@ -434,7 +433,7 @@ bool efuse_shadow_update(struct ieee80211_hw *hw)
434 u8 word_en = 0x0F; 433 u8 word_en = 0x0F;
435 u8 first_pg = false; 434 u8 first_pg = false;
436 435
437 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, ("--->\n")); 436 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "--->\n");
438 437
439 if (!efuse_shadow_update_chk(hw)) { 438 if (!efuse_shadow_update_chk(hw)) {
440 efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]); 439 efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]);
@@ -443,7 +442,7 @@ bool efuse_shadow_update(struct ieee80211_hw *hw)
443 rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); 442 rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]);
444 443
445 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, 444 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD,
446 ("<---efuse out of capacity!!\n")); 445 "<---efuse out of capacity!!\n");
447 return false; 446 return false;
448 } 447 }
449 efuse_power_switch(hw, true, true); 448 efuse_power_switch(hw, true, true);
@@ -478,12 +477,12 @@ bool efuse_shadow_update(struct ieee80211_hw *hw)
478 &rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base], 477 &rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base],
479 8); 478 8);
480 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD, 479 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD,
481 ("U-efuse\n"), tmpdata, 8); 480 "U-efuse", tmpdata, 8);
482 481
483 if (!efuse_pg_packet_write(hw, (u8) offset, word_en, 482 if (!efuse_pg_packet_write(hw, (u8) offset, word_en,
484 tmpdata)) { 483 tmpdata)) {
485 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 484 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
486 ("PG section(%#x) fail!!\n", offset)); 485 "PG section(%#x) fail!!\n", offset);
487 break; 486 break;
488 } 487 }
489 } 488 }
@@ -497,7 +496,7 @@ bool efuse_shadow_update(struct ieee80211_hw *hw)
497 &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], 496 &rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
498 rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); 497 rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]);
499 498
500 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, ("<---\n")); 499 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "<---\n");
501 return true; 500 return true;
502} 501}
503 502
@@ -634,8 +633,8 @@ static int efuse_one_byte_write(struct ieee80211_hw *hw, u16 addr, u8 data)
634 struct rtl_priv *rtlpriv = rtl_priv(hw); 633 struct rtl_priv *rtlpriv = rtl_priv(hw);
635 u8 tmpidx = 0; 634 u8 tmpidx = 0;
636 635
637 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, 636 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "Addr = %x Data=%x\n",
638 ("Addr = %x Data=%x\n", addr, data)); 637 addr, data);
639 638
640 rtl_write_byte(rtlpriv, 639 rtl_write_byte(rtlpriv,
641 rtlpriv->cfg->maps[EFUSE_CTRL] + 1, (u8) (addr & 0xff)); 640 rtlpriv->cfg->maps[EFUSE_CTRL] + 1, (u8) (addr & 0xff));
@@ -851,7 +850,7 @@ static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
851 } 850 }
852 } 851 }
853 } 852 }
854 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, ("efuse PG_STATE_HEADER-1\n")); 853 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, "efuse PG_STATE_HEADER-1\n");
855} 854}
856 855
857static void efuse_write_data_case2(struct ieee80211_hw *hw, u16 *efuse_addr, 856static void efuse_write_data_case2(struct ieee80211_hw *hw, u16 *efuse_addr,
@@ -916,7 +915,7 @@ static void efuse_write_data_case2(struct ieee80211_hw *hw, u16 *efuse_addr,
916 } 915 }
917 916
918 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, 917 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG,
919 ("efuse PG_STATE_HEADER-2\n")); 918 "efuse PG_STATE_HEADER-2\n");
920 } 919 }
921} 920}
922 921
@@ -936,7 +935,7 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
936 if (efuse_get_current_size(hw) >= 935 if (efuse_get_current_size(hw) >=
937 (EFUSE_MAX_SIZE - EFUSE_OOB_PROTECT_BYTES)) { 936 (EFUSE_MAX_SIZE - EFUSE_OOB_PROTECT_BYTES)) {
938 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, 937 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG,
939 ("efuse_pg_packet_write error\n")); 938 "efuse_pg_packet_write error\n");
940 return false; 939 return false;
941 } 940 }
942 941
@@ -948,7 +947,7 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
948 efuse_word_enable_data_read(word_en, data, target_pkt.data); 947 efuse_word_enable_data_read(word_en, data, target_pkt.data);
949 target_word_cnts = efuse_calculate_word_cnts(target_pkt.word_en); 948 target_word_cnts = efuse_calculate_word_cnts(target_pkt.word_en);
950 949
951 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, ("efuse Power ON\n")); 950 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, "efuse Power ON\n");
952 951
953 while (continual && (efuse_addr < 952 while (continual && (efuse_addr <
954 (EFUSE_MAX_SIZE - EFUSE_OOB_PROTECT_BYTES))) { 953 (EFUSE_MAX_SIZE - EFUSE_OOB_PROTECT_BYTES))) {
@@ -956,7 +955,7 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
956 if (write_state == PG_STATE_HEADER) { 955 if (write_state == PG_STATE_HEADER) {
957 badworden = 0x0F; 956 badworden = 0x0F;
958 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, 957 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG,
959 ("efuse PG_STATE_HEADER\n")); 958 "efuse PG_STATE_HEADER\n");
960 959
961 if (efuse_one_byte_read(hw, efuse_addr, &efuse_data) && 960 if (efuse_one_byte_read(hw, efuse_addr, &efuse_data) &&
962 (efuse_data != 0xFF)) 961 (efuse_data != 0xFF))
@@ -976,7 +975,7 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
976 975
977 } else if (write_state == PG_STATE_DATA) { 976 } else if (write_state == PG_STATE_DATA) {
978 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, 977 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG,
979 ("efuse PG_STATE_DATA\n")); 978 "efuse PG_STATE_DATA\n");
980 badworden = 979 badworden =
981 efuse_word_enable_data_write(hw, efuse_addr + 1, 980 efuse_word_enable_data_write(hw, efuse_addr + 1,
982 target_pkt.word_en, 981 target_pkt.word_en,
@@ -999,14 +998,14 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
999 result = false; 998 result = false;
1000 } 999 }
1001 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, 1000 RTPRINT(rtlpriv, FEEPROM, EFUSE_PG,
1002 ("efuse PG_STATE_HEADER-3\n")); 1001 "efuse PG_STATE_HEADER-3\n");
1003 } 1002 }
1004 } 1003 }
1005 } 1004 }
1006 1005
1007 if (efuse_addr >= (EFUSE_MAX_SIZE - EFUSE_OOB_PROTECT_BYTES)) { 1006 if (efuse_addr >= (EFUSE_MAX_SIZE - EFUSE_OOB_PROTECT_BYTES)) {
1008 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, 1007 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD,
1009 ("efuse_addr(%#x) Out of size!!\n", efuse_addr)); 1008 "efuse_addr(%#x) Out of size!!\n", efuse_addr);
1010 } 1009 }
1011 1010
1012 return true; 1011 return true;
@@ -1046,8 +1045,8 @@ static u8 efuse_word_enable_data_write(struct ieee80211_hw *hw,
1046 u8 tmpdata[8]; 1045 u8 tmpdata[8];
1047 1046
1048 memset(tmpdata, 0xff, PGPKT_DATA_SIZE); 1047 memset(tmpdata, 0xff, PGPKT_DATA_SIZE);
1049 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, 1048 RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "word_en = %x efuse_addr=%x\n",
1050 ("word_en = %x efuse_addr=%x\n", word_en, efuse_addr)); 1049 word_en, efuse_addr);
1051 1050
1052 if (!(word_en & BIT(0))) { 1051 if (!(word_en & BIT(0))) {
1053 tmpaddr = start_addr; 1052 tmpaddr = start_addr;
diff --git a/drivers/net/wireless/rtlwifi/efuse.h b/drivers/net/wireless/rtlwifi/efuse.h
index 164dabaa7615..2bdea9a8699e 100644
--- a/drivers/net/wireless/rtlwifi/efuse.h
+++ b/drivers/net/wireless/rtlwifi/efuse.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 39e0907a3c4e..5cb2199435d2 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,13 +27,13 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/export.h>
31#include "core.h"
32#include "wifi.h" 30#include "wifi.h"
31#include "core.h"
33#include "pci.h" 32#include "pci.h"
34#include "base.h" 33#include "base.h"
35#include "ps.h" 34#include "ps.h"
36#include "efuse.h" 35#include "efuse.h"
36#include <linux/export.h>
37 37
38static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = { 38static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = {
39 PCI_VENDOR_ID_INTEL, 39 PCI_VENDOR_ID_INTEL,
@@ -170,7 +170,7 @@ static void _rtl_pci_update_default_setting(struct ieee80211_hw *hw)
170 break; 170 break;
171 default: 171 default:
172 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 172 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
173 ("switch case not process\n")); 173 "switch case not processed\n");
174 break; 174 break;
175 } 175 }
176 176
@@ -232,7 +232,7 @@ static void rtl_pci_disable_aspm(struct ieee80211_hw *hw)
232 232
233 if (pcibridge_vendor == PCI_BRIDGE_VENDOR_UNKNOWN) { 233 if (pcibridge_vendor == PCI_BRIDGE_VENDOR_UNKNOWN) {
234 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 234 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
235 ("PCI(Bridge) UNKNOWN.\n")); 235 "PCI(Bridge) UNKNOWN\n");
236 236
237 return; 237 return;
238 } 238 }
@@ -286,7 +286,7 @@ static void rtl_pci_enable_aspm(struct ieee80211_hw *hw)
286 286
287 if (pcibridge_vendor == PCI_BRIDGE_VENDOR_UNKNOWN) { 287 if (pcibridge_vendor == PCI_BRIDGE_VENDOR_UNKNOWN) {
288 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 288 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
289 ("PCI(Bridge) UNKNOWN.\n")); 289 "PCI(Bridge) UNKNOWN\n");
290 return; 290 return;
291 } 291 }
292 292
@@ -303,11 +303,10 @@ static void rtl_pci_enable_aspm(struct ieee80211_hw *hw)
303 u_pcibridge_aspmsetting); 303 u_pcibridge_aspmsetting);
304 304
305 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 305 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
306 ("PlatformEnableASPM():PciBridge busnumber[%x], " 306 "PlatformEnableASPM():PciBridge busnumber[%x], DevNumbe[%x], funcnumber[%x], Write reg[%x] = %x\n",
307 "DevNumbe[%x], funcnumber[%x], Write reg[%x] = %x\n", 307 pcibridge_busnum, pcibridge_devnum, pcibridge_funcnum,
308 pcibridge_busnum, pcibridge_devnum, pcibridge_funcnum, 308 (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10),
309 (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10), 309 u_pcibridge_aspmsetting);
310 u_pcibridge_aspmsetting));
311 310
312 udelay(50); 311 udelay(50);
313 312
@@ -382,9 +381,8 @@ static void rtl_pci_parse_configuration(struct pci_dev *pdev,
382 pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &linkctrl_reg); 381 pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &linkctrl_reg);
383 pcipriv->ndis_adapter.linkctrl_reg = linkctrl_reg; 382 pcipriv->ndis_adapter.linkctrl_reg = linkctrl_reg;
384 383
385 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 384 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Link Control Register =%x\n",
386 ("Link Control Register =%x\n", 385 pcipriv->ndis_adapter.linkctrl_reg);
387 pcipriv->ndis_adapter.linkctrl_reg));
388 386
389 pci_read_config_byte(pdev, 0x98, &tmp); 387 pci_read_config_byte(pdev, 0x98, &tmp);
390 tmp |= BIT(4); 388 tmp |= BIT(4);
@@ -551,11 +549,10 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
551 skb_pull(skb, EM_HDR_LEN); 549 skb_pull(skb, EM_HDR_LEN);
552 550
553 RT_TRACE(rtlpriv, (COMP_INTR | COMP_SEND), DBG_TRACE, 551 RT_TRACE(rtlpriv, (COMP_INTR | COMP_SEND), DBG_TRACE,
554 ("new ring->idx:%d, " 552 "new ring->idx:%d, free: skb_queue_len:%d, free: seq:%x\n",
555 "free: skb_queue_len:%d, free: seq:%x\n", 553 ring->idx,
556 ring->idx, 554 skb_queue_len(&ring->queue),
557 skb_queue_len(&ring->queue), 555 *(u16 *) (skb->data + 22));
558 *(u16 *) (skb->data + 22)));
559 556
560 if (prio == TXCMD_QUEUE) { 557 if (prio == TXCMD_QUEUE) {
561 dev_kfree_skb(skb); 558 dev_kfree_skb(skb);
@@ -593,11 +590,9 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
593 == 2) { 590 == 2) {
594 591
595 RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, 592 RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
596 ("more desc left, wake" 593 "more desc left, wake skb_queue@%d, ring->idx = %d, skb_queue_len = 0x%d\n",
597 "skb_queue@%d,ring->idx = %d," 594 prio, ring->idx,
598 "skb_queue_len = 0x%d\n", 595 skb_queue_len(&ring->queue));
599 prio, ring->idx,
600 skb_queue_len(&ring->queue)));
601 596
602 ieee80211_wake_queue(hw, 597 ieee80211_wake_queue(hw,
603 skb_get_queue_mapping 598 skb_get_queue_mapping
@@ -657,6 +652,8 @@ static void _rtl_receive_one(struct ieee80211_hw *hw, struct sk_buff *skb,
657 return; 652 return;
658 653
659 uskb = dev_alloc_skb(skb->len + 128); 654 uskb = dev_alloc_skb(skb->len + 128);
655 if (!uskb)
656 return; /* exit if allocation failed */
660 memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status)); 657 memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status));
661 pdata = (u8 *)skb_put(uskb, skb->len); 658 pdata = (u8 *)skb_put(uskb, skb->len);
662 memcpy(pdata, skb->data, skb->len); 659 memcpy(pdata, skb->data, skb->len);
@@ -709,9 +706,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
709 706
710 new_skb = dev_alloc_skb(rtlpci->rxbuffersize); 707 new_skb = dev_alloc_skb(rtlpci->rxbuffersize);
711 if (unlikely(!new_skb)) { 708 if (unlikely(!new_skb)) {
712 RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), 709 RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), DBG_DMESG,
713 DBG_DMESG, 710 "can't alloc skb for rx\n");
714 ("can't alloc skb for rx\n"));
715 goto done; 711 goto done;
716 } 712 }
717 713
@@ -796,38 +792,37 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
796 /*<1> beacon related */ 792 /*<1> beacon related */
797 if (inta & rtlpriv->cfg->maps[RTL_IMR_TBDOK]) { 793 if (inta & rtlpriv->cfg->maps[RTL_IMR_TBDOK]) {
798 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 794 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
799 ("beacon ok interrupt!\n")); 795 "beacon ok interrupt!\n");
800 } 796 }
801 797
802 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TBDER])) { 798 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TBDER])) {
803 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 799 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
804 ("beacon err interrupt!\n")); 800 "beacon err interrupt!\n");
805 } 801 }
806 802
807 if (inta & rtlpriv->cfg->maps[RTL_IMR_BDOK]) { 803 if (inta & rtlpriv->cfg->maps[RTL_IMR_BDOK]) {
808 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 804 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, "beacon interrupt!\n");
809 ("beacon interrupt!\n"));
810 } 805 }
811 806
812 if (inta & rtlpriv->cfg->maps[RTL_IMR_BcnInt]) { 807 if (inta & rtlpriv->cfg->maps[RTL_IMR_BcnInt]) {
813 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 808 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
814 ("prepare beacon for interrupt!\n")); 809 "prepare beacon for interrupt!\n");
815 tasklet_schedule(&rtlpriv->works.irq_prepare_bcn_tasklet); 810 tasklet_schedule(&rtlpriv->works.irq_prepare_bcn_tasklet);
816 } 811 }
817 812
818 /*<3> Tx related */ 813 /*<3> Tx related */
819 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TXFOVW])) 814 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TXFOVW]))
820 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, ("IMR_TXFOVW!\n")); 815 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, "IMR_TXFOVW!\n");
821 816
822 if (inta & rtlpriv->cfg->maps[RTL_IMR_MGNTDOK]) { 817 if (inta & rtlpriv->cfg->maps[RTL_IMR_MGNTDOK]) {
823 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 818 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
824 ("Manage ok interrupt!\n")); 819 "Manage ok interrupt!\n");
825 _rtl_pci_tx_isr(hw, MGNT_QUEUE); 820 _rtl_pci_tx_isr(hw, MGNT_QUEUE);
826 } 821 }
827 822
828 if (inta & rtlpriv->cfg->maps[RTL_IMR_HIGHDOK]) { 823 if (inta & rtlpriv->cfg->maps[RTL_IMR_HIGHDOK]) {
829 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 824 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
830 ("HIGH_QUEUE ok interrupt!\n")); 825 "HIGH_QUEUE ok interrupt!\n");
831 _rtl_pci_tx_isr(hw, HIGH_QUEUE); 826 _rtl_pci_tx_isr(hw, HIGH_QUEUE);
832 } 827 }
833 828
@@ -835,7 +830,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
835 rtlpriv->link_info.num_tx_inperiod++; 830 rtlpriv->link_info.num_tx_inperiod++;
836 831
837 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 832 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
838 ("BK Tx OK interrupt!\n")); 833 "BK Tx OK interrupt!\n");
839 _rtl_pci_tx_isr(hw, BK_QUEUE); 834 _rtl_pci_tx_isr(hw, BK_QUEUE);
840 } 835 }
841 836
@@ -843,7 +838,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
843 rtlpriv->link_info.num_tx_inperiod++; 838 rtlpriv->link_info.num_tx_inperiod++;
844 839
845 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 840 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
846 ("BE TX OK interrupt!\n")); 841 "BE TX OK interrupt!\n");
847 _rtl_pci_tx_isr(hw, BE_QUEUE); 842 _rtl_pci_tx_isr(hw, BE_QUEUE);
848 } 843 }
849 844
@@ -851,7 +846,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
851 rtlpriv->link_info.num_tx_inperiod++; 846 rtlpriv->link_info.num_tx_inperiod++;
852 847
853 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 848 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
854 ("VI TX OK interrupt!\n")); 849 "VI TX OK interrupt!\n");
855 _rtl_pci_tx_isr(hw, VI_QUEUE); 850 _rtl_pci_tx_isr(hw, VI_QUEUE);
856 } 851 }
857 852
@@ -859,7 +854,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
859 rtlpriv->link_info.num_tx_inperiod++; 854 rtlpriv->link_info.num_tx_inperiod++;
860 855
861 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 856 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
862 ("Vo TX OK interrupt!\n")); 857 "Vo TX OK interrupt!\n");
863 _rtl_pci_tx_isr(hw, VO_QUEUE); 858 _rtl_pci_tx_isr(hw, VO_QUEUE);
864 } 859 }
865 860
@@ -868,25 +863,25 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
868 rtlpriv->link_info.num_tx_inperiod++; 863 rtlpriv->link_info.num_tx_inperiod++;
869 864
870 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, 865 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE,
871 ("CMD TX OK interrupt!\n")); 866 "CMD TX OK interrupt!\n");
872 _rtl_pci_tx_isr(hw, TXCMD_QUEUE); 867 _rtl_pci_tx_isr(hw, TXCMD_QUEUE);
873 } 868 }
874 } 869 }
875 870
876 /*<2> Rx related */ 871 /*<2> Rx related */
877 if (inta & rtlpriv->cfg->maps[RTL_IMR_ROK]) { 872 if (inta & rtlpriv->cfg->maps[RTL_IMR_ROK]) {
878 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, ("Rx ok interrupt!\n")); 873 RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, "Rx ok interrupt!\n");
879 _rtl_pci_rx_interrupt(hw); 874 _rtl_pci_rx_interrupt(hw);
880 } 875 }
881 876
882 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_RDU])) { 877 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_RDU])) {
883 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 878 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
884 ("rx descriptor unavailable!\n")); 879 "rx descriptor unavailable!\n");
885 _rtl_pci_rx_interrupt(hw); 880 _rtl_pci_rx_interrupt(hw);
886 } 881 }
887 882
888 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_RXFOVW])) { 883 if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_RXFOVW])) {
889 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, ("rx overflow !\n")); 884 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, "rx overflow !\n");
890 _rtl_pci_rx_interrupt(hw); 885 _rtl_pci_rx_interrupt(hw);
891 } 886 }
892 887
@@ -1028,7 +1023,7 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
1028 1023
1029 if (!ring || (unsigned long)ring & 0xFF) { 1024 if (!ring || (unsigned long)ring & 0xFF) {
1030 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1025 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1031 ("Cannot allocate TX ring (prio = %d)\n", prio)); 1026 "Cannot allocate TX ring (prio = %d)\n", prio);
1032 return -ENOMEM; 1027 return -ENOMEM;
1033 } 1028 }
1034 1029
@@ -1039,8 +1034,8 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
1039 rtlpci->tx_ring[prio].entries = entries; 1034 rtlpci->tx_ring[prio].entries = entries;
1040 skb_queue_head_init(&rtlpci->tx_ring[prio].queue); 1035 skb_queue_head_init(&rtlpci->tx_ring[prio].queue);
1041 1036
1042 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1037 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "queue:%d, ring_addr:%p\n",
1043 ("queue:%d, ring_addr:%p\n", prio, ring)); 1038 prio, ring);
1044 1039
1045 for (i = 0; i < entries; i++) { 1040 for (i = 0; i < entries; i++) {
1046 nextdescaddress = (u32) dma + 1041 nextdescaddress = (u32) dma +
@@ -1078,7 +1073,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw)
1078 if (!rtlpci->rx_ring[rx_queue_idx].desc || 1073 if (!rtlpci->rx_ring[rx_queue_idx].desc ||
1079 (unsigned long)rtlpci->rx_ring[rx_queue_idx].desc & 0xFF) { 1074 (unsigned long)rtlpci->rx_ring[rx_queue_idx].desc & 0xFF) {
1080 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1075 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1081 ("Cannot allocate RX ring\n")); 1076 "Cannot allocate RX ring\n");
1082 return -ENOMEM; 1077 return -ENOMEM;
1083 } 1078 }
1084 1079
@@ -1355,7 +1350,7 @@ static int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
1355 u8 temp_one = 1; 1350 u8 temp_one = 1;
1356 1351
1357 if (ieee80211_is_auth(fc)) { 1352 if (ieee80211_is_auth(fc)) {
1358 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, ("MAC80211_LINKING\n")); 1353 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "MAC80211_LINKING\n");
1359 rtl_ips_nic_on(hw); 1354 rtl_ips_nic_on(hw);
1360 } 1355 }
1361 1356
@@ -1388,10 +1383,9 @@ static int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
1388 1383
1389 if ((own == 1) && (hw_queue != BEACON_QUEUE)) { 1384 if ((own == 1) && (hw_queue != BEACON_QUEUE)) {
1390 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1385 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1391 ("No more TX desc@%d, ring->idx = %d," 1386 "No more TX desc@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%d\n",
1392 "idx = %d, skb_queue_len = 0x%d\n", 1387 hw_queue, ring->idx, idx,
1393 hw_queue, ring->idx, idx, 1388 skb_queue_len(&ring->queue));
1394 skb_queue_len(&ring->queue)));
1395 1389
1396 spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); 1390 spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
1397 return skb->len; 1391 return skb->len;
@@ -1426,11 +1420,9 @@ static int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
1426 hw_queue != BEACON_QUEUE) { 1420 hw_queue != BEACON_QUEUE) {
1427 1421
1428 RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, 1422 RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
1429 ("less desc left, stop skb_queue@%d, " 1423 "less desc left, stop skb_queue@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%d\n",
1430 "ring->idx = %d," 1424 hw_queue, ring->idx, idx,
1431 "idx = %d, skb_queue_len = 0x%d\n", 1425 skb_queue_len(&ring->queue));
1432 hw_queue, ring->idx, idx,
1433 skb_queue_len(&ring->queue)));
1434 1426
1435 ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); 1427 ieee80211_stop_queue(hw, skb_get_queue_mapping(skb));
1436 } 1428 }
@@ -1497,7 +1489,7 @@ static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
1497 err = _rtl_pci_init_trx_ring(hw); 1489 err = _rtl_pci_init_trx_ring(hw);
1498 if (err) { 1490 if (err) {
1499 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1491 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1500 ("tx ring initialization failed")); 1492 "tx ring initialization failed\n");
1501 return err; 1493 return err;
1502 } 1494 }
1503 1495
@@ -1519,12 +1511,12 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
1519 err = rtlpriv->cfg->ops->hw_init(hw); 1511 err = rtlpriv->cfg->ops->hw_init(hw);
1520 if (err) { 1512 if (err) {
1521 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1513 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1522 ("Failed to config hardware!\n")); 1514 "Failed to config hardware!\n");
1523 return err; 1515 return err;
1524 } 1516 }
1525 1517
1526 rtlpriv->cfg->ops->enable_interrupt(hw); 1518 rtlpriv->cfg->ops->enable_interrupt(hw);
1527 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("enable_interrupt OK\n")); 1519 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "enable_interrupt OK\n");
1528 1520
1529 rtl_init_rx_config(hw); 1521 rtl_init_rx_config(hw);
1530 1522
@@ -1535,7 +1527,7 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
1535 1527
1536 rtlpci->up_first_time = false; 1528 rtlpci->up_first_time = false;
1537 1529
1538 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("OK\n")); 1530 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "OK\n");
1539 return 0; 1531 return 0;
1540} 1532}
1541 1533
@@ -1573,6 +1565,9 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
1573 1565
1574 rtlpci->driver_is_goingto_unload = true; 1566 rtlpci->driver_is_goingto_unload = true;
1575 rtlpriv->cfg->ops->hw_disable(hw); 1567 rtlpriv->cfg->ops->hw_disable(hw);
1568 /* some things are not needed if firmware not available */
1569 if (!rtlpriv->max_fw_size)
1570 return;
1576 rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); 1571 rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF);
1577 1572
1578 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); 1573 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
@@ -1622,20 +1617,20 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1622 switch (revisionid) { 1617 switch (revisionid) {
1623 case RTL_PCI_REVISION_ID_8192PCIE: 1618 case RTL_PCI_REVISION_ID_8192PCIE:
1624 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1619 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1625 ("8192 PCI-E is found - " 1620 "8192 PCI-E is found - vid/did=%x/%x\n",
1626 "vid/did=%x/%x\n", venderid, deviceid)); 1621 venderid, deviceid);
1627 rtlhal->hw_type = HARDWARE_TYPE_RTL8192E; 1622 rtlhal->hw_type = HARDWARE_TYPE_RTL8192E;
1628 break; 1623 break;
1629 case RTL_PCI_REVISION_ID_8192SE: 1624 case RTL_PCI_REVISION_ID_8192SE:
1630 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1625 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1631 ("8192SE is found - " 1626 "8192SE is found - vid/did=%x/%x\n",
1632 "vid/did=%x/%x\n", venderid, deviceid)); 1627 venderid, deviceid);
1633 rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE; 1628 rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE;
1634 break; 1629 break;
1635 default: 1630 default:
1636 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1631 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1637 ("Err: Unknown device - " 1632 "Err: Unknown device - vid/did=%x/%x\n",
1638 "vid/did=%x/%x\n", venderid, deviceid)); 1633 venderid, deviceid);
1639 rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE; 1634 rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE;
1640 break; 1635 break;
1641 1636
@@ -1646,18 +1641,18 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1646 deviceid == RTL_PCI_8188CE_DID) { 1641 deviceid == RTL_PCI_8188CE_DID) {
1647 rtlhal->hw_type = HARDWARE_TYPE_RTL8192CE; 1642 rtlhal->hw_type = HARDWARE_TYPE_RTL8192CE;
1648 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1643 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1649 ("8192C PCI-E is found - " 1644 "8192C PCI-E is found - vid/did=%x/%x\n",
1650 "vid/did=%x/%x\n", venderid, deviceid)); 1645 venderid, deviceid);
1651 } else if (deviceid == RTL_PCI_8192DE_DID || 1646 } else if (deviceid == RTL_PCI_8192DE_DID ||
1652 deviceid == RTL_PCI_8192DE_DID2) { 1647 deviceid == RTL_PCI_8192DE_DID2) {
1653 rtlhal->hw_type = HARDWARE_TYPE_RTL8192DE; 1648 rtlhal->hw_type = HARDWARE_TYPE_RTL8192DE;
1654 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1649 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1655 ("8192D PCI-E is found - " 1650 "8192D PCI-E is found - vid/did=%x/%x\n",
1656 "vid/did=%x/%x\n", venderid, deviceid)); 1651 venderid, deviceid);
1657 } else { 1652 } else {
1658 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1653 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1659 ("Err: Unknown device -" 1654 "Err: Unknown device - vid/did=%x/%x\n",
1660 " vid/did=%x/%x\n", venderid, deviceid)); 1655 venderid, deviceid);
1661 1656
1662 rtlhal->hw_type = RTL_DEFAULT_HARDWARE_TYPE; 1657 rtlhal->hw_type = RTL_DEFAULT_HARDWARE_TYPE;
1663 } 1658 }
@@ -1665,19 +1660,18 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1665 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE) { 1660 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE) {
1666 if (revisionid == 0 || revisionid == 1) { 1661 if (revisionid == 0 || revisionid == 1) {
1667 if (revisionid == 0) { 1662 if (revisionid == 0) {
1668 RT_TRACE(rtlpriv, COMP_INIT, 1663 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1669 DBG_LOUD, ("Find 92DE MAC0.\n")); 1664 "Find 92DE MAC0\n");
1670 rtlhal->interfaceindex = 0; 1665 rtlhal->interfaceindex = 0;
1671 } else if (revisionid == 1) { 1666 } else if (revisionid == 1) {
1672 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1667 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1673 ("Find 92DE MAC1.\n")); 1668 "Find 92DE MAC1\n");
1674 rtlhal->interfaceindex = 1; 1669 rtlhal->interfaceindex = 1;
1675 } 1670 }
1676 } else { 1671 } else {
1677 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1672 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1678 ("Unknown device - " 1673 "Unknown device - VendorID/DeviceID=%x/%x, Revision=%x\n",
1679 "VendorID/DeviceID=%x/%x, Revision=%x\n", 1674 venderid, deviceid, revisionid);
1680 venderid, deviceid, revisionid));
1681 rtlhal->interfaceindex = 0; 1675 rtlhal->interfaceindex = 0;
1682 } 1676 }
1683 } 1677 }
@@ -1693,8 +1687,8 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1693 if (bridge_pdev->vendor == pcibridge_vendors[tmp]) { 1687 if (bridge_pdev->vendor == pcibridge_vendors[tmp]) {
1694 pcipriv->ndis_adapter.pcibridge_vendor = tmp; 1688 pcipriv->ndis_adapter.pcibridge_vendor = tmp;
1695 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1689 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1696 ("Pci Bridge Vendor is found index:" 1690 "Pci Bridge Vendor is found index: %d\n",
1697 " %d\n", tmp)); 1691 tmp);
1698 break; 1692 break;
1699 } 1693 }
1700 } 1694 }
@@ -1723,23 +1717,21 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
1723 } 1717 }
1724 1718
1725 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1719 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1726 ("pcidev busnumber:devnumber:funcnumber:" 1720 "pcidev busnumber:devnumber:funcnumber:vendor:link_ctl %d:%d:%d:%x:%x\n",
1727 "vendor:link_ctl %d:%d:%d:%x:%x\n", 1721 pcipriv->ndis_adapter.busnumber,
1728 pcipriv->ndis_adapter.busnumber, 1722 pcipriv->ndis_adapter.devnumber,
1729 pcipriv->ndis_adapter.devnumber, 1723 pcipriv->ndis_adapter.funcnumber,
1730 pcipriv->ndis_adapter.funcnumber, 1724 pdev->vendor, pcipriv->ndis_adapter.linkctrl_reg);
1731 pdev->vendor, pcipriv->ndis_adapter.linkctrl_reg));
1732 1725
1733 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1726 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1734 ("pci_bridge busnumber:devnumber:funcnumber:vendor:" 1727 "pci_bridge busnumber:devnumber:funcnumber:vendor:pcie_cap:link_ctl_reg:amd %d:%d:%d:%x:%x:%x:%x\n",
1735 "pcie_cap:link_ctl_reg:amd %d:%d:%d:%x:%x:%x:%x\n", 1728 pcipriv->ndis_adapter.pcibridge_busnum,
1736 pcipriv->ndis_adapter.pcibridge_busnum, 1729 pcipriv->ndis_adapter.pcibridge_devnum,
1737 pcipriv->ndis_adapter.pcibridge_devnum, 1730 pcipriv->ndis_adapter.pcibridge_funcnum,
1738 pcipriv->ndis_adapter.pcibridge_funcnum, 1731 pcibridge_vendors[pcipriv->ndis_adapter.pcibridge_vendor],
1739 pcibridge_vendors[pcipriv->ndis_adapter.pcibridge_vendor], 1732 pcipriv->ndis_adapter.pcibridge_pciehdr_offset,
1740 pcipriv->ndis_adapter.pcibridge_pciehdr_offset, 1733 pcipriv->ndis_adapter.pcibridge_linkctrlreg,
1741 pcipriv->ndis_adapter.pcibridge_linkctrlreg, 1734 pcipriv->ndis_adapter.amd_l1_patch);
1742 pcipriv->ndis_adapter.amd_l1_patch));
1743 1735
1744 rtl_pci_parse_configuration(pdev, hw); 1736 rtl_pci_parse_configuration(pdev, hw);
1745 1737
@@ -1759,16 +1751,15 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1759 1751
1760 err = pci_enable_device(pdev); 1752 err = pci_enable_device(pdev);
1761 if (err) { 1753 if (err) {
1762 RT_ASSERT(false, 1754 RT_ASSERT(false, "%s : Cannot enable new PCI device\n",
1763 ("%s : Cannot enable new PCI device\n", 1755 pci_name(pdev));
1764 pci_name(pdev)));
1765 return err; 1756 return err;
1766 } 1757 }
1767 1758
1768 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { 1759 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
1769 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { 1760 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
1770 RT_ASSERT(false, ("Unable to obtain 32bit DMA " 1761 RT_ASSERT(false,
1771 "for consistent allocations\n")); 1762 "Unable to obtain 32bit DMA for consistent allocations\n");
1772 pci_disable_device(pdev); 1763 pci_disable_device(pdev);
1773 return -ENOMEM; 1764 return -ENOMEM;
1774 } 1765 }
@@ -1780,7 +1771,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1780 sizeof(struct rtl_priv), &rtl_ops); 1771 sizeof(struct rtl_priv), &rtl_ops);
1781 if (!hw) { 1772 if (!hw) {
1782 RT_ASSERT(false, 1773 RT_ASSERT(false,
1783 ("%s : ieee80211 alloc failed\n", pci_name(pdev))); 1774 "%s : ieee80211 alloc failed\n", pci_name(pdev));
1784 err = -ENOMEM; 1775 err = -ENOMEM;
1785 goto fail1; 1776 goto fail1;
1786 } 1777 }
@@ -1791,6 +1782,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1791 rtlpriv = hw->priv; 1782 rtlpriv = hw->priv;
1792 pcipriv = (void *)rtlpriv->priv; 1783 pcipriv = (void *)rtlpriv->priv;
1793 pcipriv->dev.pdev = pdev; 1784 pcipriv->dev.pdev = pdev;
1785 init_completion(&rtlpriv->firmware_loading_complete);
1794 1786
1795 /* init cfg & intf_ops */ 1787 /* init cfg & intf_ops */
1796 rtlpriv->rtlhal.interface = INTF_PCI; 1788 rtlpriv->rtlhal.interface = INTF_PCI;
@@ -1810,8 +1802,8 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1810 /* MEM map */ 1802 /* MEM map */
1811 err = pci_request_regions(pdev, KBUILD_MODNAME); 1803 err = pci_request_regions(pdev, KBUILD_MODNAME);
1812 if (err) { 1804 if (err) {
1813 RT_ASSERT(false, ("Can't obtain PCI resources\n")); 1805 RT_ASSERT(false, "Can't obtain PCI resources\n");
1814 return err; 1806 goto fail2;
1815 } 1807 }
1816 1808
1817 pmem_start = pci_resource_start(pdev, rtlpriv->cfg->bar_id); 1809 pmem_start = pci_resource_start(pdev, rtlpriv->cfg->bar_id);
@@ -1823,15 +1815,14 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1823 (unsigned long)pci_iomap(pdev, 1815 (unsigned long)pci_iomap(pdev,
1824 rtlpriv->cfg->bar_id, pmem_len); 1816 rtlpriv->cfg->bar_id, pmem_len);
1825 if (rtlpriv->io.pci_mem_start == 0) { 1817 if (rtlpriv->io.pci_mem_start == 0) {
1826 RT_ASSERT(false, ("Can't map PCI mem\n")); 1818 RT_ASSERT(false, "Can't map PCI mem\n");
1827 goto fail2; 1819 goto fail2;
1828 } 1820 }
1829 1821
1830 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1822 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1831 ("mem mapped space: start: 0x%08lx len:%08lx " 1823 "mem mapped space: start: 0x%08lx len:%08lx flags:%08lx, after map:0x%08lx\n",
1832 "flags:%08lx, after map:0x%08lx\n", 1824 pmem_start, pmem_len, pmem_flags,
1833 pmem_start, pmem_len, pmem_flags, 1825 rtlpriv->io.pci_mem_start);
1834 rtlpriv->io.pci_mem_start));
1835 1826
1836 /* Disable Clk Request */ 1827 /* Disable Clk Request */
1837 pci_write_config_byte(pdev, 0x81, 0); 1828 pci_write_config_byte(pdev, 0x81, 0);
@@ -1851,8 +1842,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1851 rtlpriv->cfg->ops->read_eeprom_info(hw); 1842 rtlpriv->cfg->ops->read_eeprom_info(hw);
1852 1843
1853 if (rtlpriv->cfg->ops->init_sw_vars(hw)) { 1844 if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
1854 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1845 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
1855 ("Can't init_sw_vars.\n"));
1856 goto fail3; 1846 goto fail3;
1857 } 1847 }
1858 1848
@@ -1865,63 +1855,48 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1865 err = rtl_init_core(hw); 1855 err = rtl_init_core(hw);
1866 if (err) { 1856 if (err) {
1867 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1857 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1868 ("Can't allocate sw for mac80211.\n")); 1858 "Can't allocate sw for mac80211\n");
1869 goto fail3; 1859 goto fail3;
1870 } 1860 }
1871 1861
1872 /* Init PCI sw */ 1862 /* Init PCI sw */
1873 err = !rtl_pci_init(hw, pdev); 1863 err = !rtl_pci_init(hw, pdev);
1874 if (err) { 1864 if (err) {
1875 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1865 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Failed to init PCI\n");
1876 ("Failed to init PCI.\n"));
1877 goto fail3; 1866 goto fail3;
1878 } 1867 }
1879 1868
1880 err = ieee80211_register_hw(hw);
1881 if (err) {
1882 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1883 ("Can't register mac80211 hw.\n"));
1884 goto fail3;
1885 } else {
1886 rtlpriv->mac80211.mac80211_registered = 1;
1887 }
1888
1889 err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group); 1869 err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group);
1890 if (err) { 1870 if (err) {
1891 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1871 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1892 ("failed to create sysfs device attributes\n")); 1872 "failed to create sysfs device attributes\n");
1893 goto fail3; 1873 goto fail3;
1894 } 1874 }
1895 1875
1896 /*init rfkill */
1897 rtl_init_rfkill(hw);
1898
1899 rtlpci = rtl_pcidev(pcipriv); 1876 rtlpci = rtl_pcidev(pcipriv);
1900 err = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt, 1877 err = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt,
1901 IRQF_SHARED, KBUILD_MODNAME, hw); 1878 IRQF_SHARED, KBUILD_MODNAME, hw);
1902 if (err) { 1879 if (err) {
1903 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1880 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1904 ("%s: failed to register IRQ handler\n", 1881 "%s: failed to register IRQ handler\n",
1905 wiphy_name(hw->wiphy))); 1882 wiphy_name(hw->wiphy));
1906 goto fail3; 1883 goto fail3;
1907 } else {
1908 rtlpci->irq_alloc = 1;
1909 } 1884 }
1885 rtlpci->irq_alloc = 1;
1910 1886
1911 set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
1912 return 0; 1887 return 0;
1913 1888
1914fail3: 1889fail3:
1915 pci_set_drvdata(pdev, NULL); 1890 pci_set_drvdata(pdev, NULL);
1916 rtl_deinit_core(hw); 1891 rtl_deinit_core(hw);
1917 _rtl_pci_io_handler_release(hw); 1892 _rtl_pci_io_handler_release(hw);
1918 ieee80211_free_hw(hw);
1919 1893
1920 if (rtlpriv->io.pci_mem_start != 0) 1894 if (rtlpriv->io.pci_mem_start != 0)
1921 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); 1895 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
1922 1896
1923fail2: 1897fail2:
1924 pci_release_regions(pdev); 1898 pci_release_regions(pdev);
1899 complete(&rtlpriv->firmware_loading_complete);
1925 1900
1926fail1: 1901fail1:
1927 1902
@@ -1940,6 +1915,8 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
1940 struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); 1915 struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
1941 struct rtl_mac *rtlmac = rtl_mac(rtlpriv); 1916 struct rtl_mac *rtlmac = rtl_mac(rtlpriv);
1942 1917
1918 /* just in case driver is removed before firmware callback */
1919 wait_for_completion(&rtlpriv->firmware_loading_complete);
1943 clear_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); 1920 clear_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
1944 1921
1945 sysfs_remove_group(&pdev->dev.kobj, &rtl_attribute_group); 1922 sysfs_remove_group(&pdev->dev.kobj, &rtl_attribute_group);
diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h
index ebe0b42c0518..241448fc9ed5 100644
--- a/drivers/net/wireless/rtlwifi/pci.h
+++ b/drivers/net/wireless/rtlwifi/pci.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -239,7 +239,6 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
239void rtl_pci_disconnect(struct pci_dev *pdev); 239void rtl_pci_disconnect(struct pci_dev *pdev);
240int rtl_pci_suspend(struct device *dev); 240int rtl_pci_suspend(struct device *dev);
241int rtl_pci_resume(struct device *dev); 241int rtl_pci_resume(struct device *dev);
242
243static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr) 242static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr)
244{ 243{
245 return readb((u8 __iomem *) rtlpriv->io.pci_mem_start + addr); 244 return readb((u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c
index 130fdd99d573..15f86eaa1cd6 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers/net/wireless/rtlwifi/ps.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -44,10 +44,11 @@ bool rtl_ps_enable_nic(struct ieee80211_hw *hw)
44 44
45 if (is_hal_stop(rtlhal)) 45 if (is_hal_stop(rtlhal))
46 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 46 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
47 ("Driver is already down!\n")); 47 "Driver is already down!\n");
48 48
49 /*<2> Enable Adapter */ 49 /*<2> Enable Adapter */
50 rtlpriv->cfg->ops->hw_init(hw); 50 if (rtlpriv->cfg->ops->hw_init(hw))
51 return 1;
51 RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); 52 RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
52 53
53 /*<3> Enable Interrupt */ 54 /*<3> Enable Interrupt */
@@ -120,7 +121,7 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
120 121
121 default: 122 default:
122 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 123 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
123 ("switch case not process\n")); 124 "switch case not processed\n");
124 break; 125 break;
125 } 126 }
126 127
@@ -176,7 +177,7 @@ void rtl_ips_nic_off_wq_callback(void *data)
176 177
177 if (mac->opmode != NL80211_IFTYPE_STATION) { 178 if (mac->opmode != NL80211_IFTYPE_STATION) {
178 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 179 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
179 ("not station return\n")); 180 "not station return\n");
180 return; 181 return;
181 } 182 }
182 183
@@ -207,7 +208,7 @@ void rtl_ips_nic_off_wq_callback(void *data)
207 (mac->link_state == MAC80211_NOLINK) && 208 (mac->link_state == MAC80211_NOLINK) &&
208 !mac->act_scanning) { 209 !mac->act_scanning) {
209 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 210 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
210 ("IPSEnter(): Turn off RF.\n")); 211 "IPSEnter(): Turn off RF\n");
211 212
212 ppsc->inactive_pwrstate = ERFOFF; 213 ppsc->inactive_pwrstate = ERFOFF;
213 ppsc->in_powersavemode = true; 214 ppsc->in_powersavemode = true;
@@ -280,8 +281,7 @@ static bool rtl_get_fwlps_doze(struct ieee80211_hw *hw)
280 281
281 if (ps_timediff < 2000) { 282 if (ps_timediff < 2000) {
282 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 283 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
283 ("Delay enter Fw LPS for DHCP, ARP," 284 "Delay enter Fw LPS for DHCP, ARP, or EAPOL exchanging state\n");
284 " or EAPOL exchanging state.\n"));
285 return false; 285 return false;
286 } 286 }
287 287
@@ -328,8 +328,8 @@ static void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode)
328 bool fw_current_inps; 328 bool fw_current_inps;
329 if (ppsc->dot11_psmode == EACTIVE) { 329 if (ppsc->dot11_psmode == EACTIVE) {
330 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 330 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
331 ("FW LPS leave ps_mode:%x\n", 331 "FW LPS leave ps_mode:%x\n",
332 FW_PS_ACTIVE_MODE)); 332 FW_PS_ACTIVE_MODE);
333 333
334 rpwm_val = 0x0C; /* RF on */ 334 rpwm_val = 0x0C; /* RF on */
335 fw_pwrmode = FW_PS_ACTIVE_MODE; 335 fw_pwrmode = FW_PS_ACTIVE_MODE;
@@ -347,8 +347,8 @@ static void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode)
347 } else { 347 } else {
348 if (rtl_get_fwlps_doze(hw)) { 348 if (rtl_get_fwlps_doze(hw)) {
349 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 349 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
350 ("FW LPS enter ps_mode:%x\n", 350 "FW LPS enter ps_mode:%x\n",
351 ppsc->fwctrl_psmode)); 351 ppsc->fwctrl_psmode);
352 352
353 rpwm_val = 0x02; /* RF off */ 353 rpwm_val = 0x02; /* RF off */
354 fw_current_inps = true; 354 fw_current_inps = true;
@@ -402,7 +402,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
402 if (mac->cnt_after_linked >= 2) { 402 if (mac->cnt_after_linked >= 2) {
403 if (ppsc->dot11_psmode == EACTIVE) { 403 if (ppsc->dot11_psmode == EACTIVE) {
404 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 404 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
405 ("Enter 802.11 power save mode...\n")); 405 "Enter 802.11 power save mode...\n");
406 406
407 rtl_lps_set_psmode(hw, EAUTOPS); 407 rtl_lps_set_psmode(hw, EAUTOPS);
408 } 408 }
@@ -434,7 +434,7 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
434 } 434 }
435 435
436 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 436 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
437 ("Busy Traffic,Leave 802.11 power save..\n")); 437 "Busy Traffic,Leave 802.11 power save..\n");
438 438
439 rtl_lps_set_psmode(hw, EACTIVE); 439 rtl_lps_set_psmode(hw, EACTIVE);
440 } 440 }
@@ -518,8 +518,8 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len)
518 queue_delayed_work(rtlpriv->works.rtl_wq, 518 queue_delayed_work(rtlpriv->works.rtl_wq,
519 &rtlpriv->works.ps_work, MSECS(5)); 519 &rtlpriv->works.ps_work, MSECS(5));
520 } else { 520 } else {
521 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, ("u_bufferd: %x, " 521 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
522 "m_buffered: %x\n", u_buffed, m_buffed)); 522 "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed);
523 } 523 }
524} 524}
525 525
@@ -607,8 +607,8 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
607 * sleep = dtim_period, that meaons, we should 607 * sleep = dtim_period, that meaons, we should
608 * awake before every dtim */ 608 * awake before every dtim */
609 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 609 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
610 ("dtim_counter:%x will sleep :%d" 610 "dtim_counter:%x will sleep :%d beacon_intv\n",
611 " beacon_intv\n", rtlpriv->psc.dtim_counter, sleep_intv)); 611 rtlpriv->psc.dtim_counter, sleep_intv);
612 612
613 /* we tested that 40ms is enough for sw & hw sw delay */ 613 /* we tested that 40ms is enough for sw & hw sw delay */
614 queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq, 614 queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq,
diff --git a/drivers/net/wireless/rtlwifi/ps.h b/drivers/net/wireless/rtlwifi/ps.h
index 84628e6041c7..1357856998c2 100644
--- a/drivers/net/wireless/rtlwifi/ps.h
+++ b/drivers/net/wireless/rtlwifi/ps.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rc.c b/drivers/net/wireless/rtlwifi/rc.c
index 539df66dce0a..c66f08a0524a 100644
--- a/drivers/net/wireless/rtlwifi/rc.c
+++ b/drivers/net/wireless/rtlwifi/rc.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -251,7 +251,7 @@ static void *rtl_rate_alloc_sta(void *ppriv,
251 rate_priv = kzalloc(sizeof(struct rtl_rate_priv), gfp); 251 rate_priv = kzalloc(sizeof(struct rtl_rate_priv), gfp);
252 if (!rate_priv) { 252 if (!rate_priv) {
253 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 253 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
254 ("Unable to allocate private rc structure\n")); 254 "Unable to allocate private rc structure\n");
255 return NULL; 255 return NULL;
256 } 256 }
257 257
diff --git a/drivers/net/wireless/rtlwifi/rc.h b/drivers/net/wireless/rtlwifi/rc.h
index 4afa2c20adcf..4d6176160610 100644
--- a/drivers/net/wireless/rtlwifi/rc.h
+++ b/drivers/net/wireless/rtlwifi/rc.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/regd.c b/drivers/net/wireless/rtlwifi/regd.c
index 9fedb1f70919..c1608cddc529 100644
--- a/drivers/net/wireless/rtlwifi/regd.c
+++ b/drivers/net/wireless/rtlwifi/regd.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -398,13 +398,11 @@ int rtl_regd_init(struct ieee80211_hw *hw,
398 rtlpriv->regd.country_code = rtlpriv->efuse.channel_plan; 398 rtlpriv->regd.country_code = rtlpriv->efuse.channel_plan;
399 399
400 RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE, 400 RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE,
401 (KERN_DEBUG "rtl: EEPROM regdomain: 0x%0x\n", 401 "rtl: EEPROM regdomain: 0x%0x\n", rtlpriv->regd.country_code);
402 rtlpriv->regd.country_code));
403 402
404 if (rtlpriv->regd.country_code >= COUNTRY_CODE_MAX) { 403 if (rtlpriv->regd.country_code >= COUNTRY_CODE_MAX) {
405 RT_TRACE(rtlpriv, COMP_REGD, DBG_DMESG, 404 RT_TRACE(rtlpriv, COMP_REGD, DBG_DMESG,
406 (KERN_DEBUG "rtl: EEPROM indicates invalid contry code" 405 "rtl: EEPROM indicates invalid contry code, world wide 13 should be used\n");
407 "world wide 13 should be used\n"));
408 406
409 rtlpriv->regd.country_code = COUNTRY_CODE_WORLD_WIDE_13; 407 rtlpriv->regd.country_code = COUNTRY_CODE_WORLD_WIDE_13;
410 } 408 }
@@ -420,8 +418,8 @@ int rtl_regd_init(struct ieee80211_hw *hw,
420 } 418 }
421 419
422 RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE, 420 RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE,
423 (KERN_DEBUG "rtl: Country alpha2 being used: %c%c\n", 421 "rtl: Country alpha2 being used: %c%c\n",
424 rtlpriv->regd.alpha2[0], rtlpriv->regd.alpha2[1])); 422 rtlpriv->regd.alpha2[0], rtlpriv->regd.alpha2[1]);
425 423
426 _rtl_regd_init_wiphy(&rtlpriv->regd, wiphy, reg_notifier); 424 _rtl_regd_init_wiphy(&rtlpriv->regd, wiphy, reg_notifier);
427 425
@@ -433,7 +431,7 @@ int rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
433 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 431 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
434 struct rtl_priv *rtlpriv = rtl_priv(hw); 432 struct rtl_priv *rtlpriv = rtl_priv(hw);
435 433
436 RT_TRACE(rtlpriv, COMP_REGD, DBG_LOUD, ("\n")); 434 RT_TRACE(rtlpriv, COMP_REGD, DBG_LOUD, "\n");
437 435
438 return _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd); 436 return _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd);
439} 437}
diff --git a/drivers/net/wireless/rtlwifi/regd.h b/drivers/net/wireless/rtlwifi/regd.h
index d23118938fac..70ef2f418a44 100644
--- a/drivers/net/wireless/rtlwifi/regd.h
+++ b/drivers/net/wireless/rtlwifi/regd.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
index 72a98cab6f69..cb5535cf3ae2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -246,16 +246,15 @@ static void rtl92c_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw)
246 rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 2); 246 rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 2);
247 247
248 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, 248 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE,
249 ("cnt_parity_fail = %d, cnt_rate_illegal = %d, " 249 "cnt_parity_fail = %d, cnt_rate_illegal = %d, cnt_crc8_fail = %d, cnt_mcs_fail = %d\n",
250 "cnt_crc8_fail = %d, cnt_mcs_fail = %d\n", 250 falsealm_cnt->cnt_parity_fail,
251 falsealm_cnt->cnt_parity_fail, 251 falsealm_cnt->cnt_rate_illegal,
252 falsealm_cnt->cnt_rate_illegal, 252 falsealm_cnt->cnt_crc8_fail, falsealm_cnt->cnt_mcs_fail);
253 falsealm_cnt->cnt_crc8_fail, falsealm_cnt->cnt_mcs_fail));
254 253
255 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, 254 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE,
256 ("cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n", 255 "cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n",
257 falsealm_cnt->cnt_ofdm_fail, 256 falsealm_cnt->cnt_ofdm_fail,
258 falsealm_cnt->cnt_cck_fail, falsealm_cnt->cnt_all)); 257 falsealm_cnt->cnt_cck_fail, falsealm_cnt->cnt_all);
259} 258}
260 259
261static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) 260static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw)
@@ -313,8 +312,8 @@ static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw)
313 dm_digtable.backoff_val; 312 dm_digtable.backoff_val;
314 313
315 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, 314 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE,
316 ("rssi_val_min = %x backoff_val %x\n", 315 "rssi_val_min = %x backoff_val %x\n",
317 dm_digtable.rssi_val_min, dm_digtable.backoff_val)); 316 dm_digtable.rssi_val_min, dm_digtable.backoff_val);
318 317
319 rtl92c_dm_write_dig(hw); 318 rtl92c_dm_write_dig(hw);
320} 319}
@@ -364,10 +363,9 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw)
364 } 363 }
365 364
366 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, 365 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE,
367 ("curmultista_connectstate = " 366 "curmultista_connectstate = %x dig_ext_port_stage %x\n",
368 "%x dig_ext_port_stage %x\n", 367 dm_digtable.curmultista_connectstate,
369 dm_digtable.curmultista_connectstate, 368 dm_digtable.dig_ext_port_stage);
370 dm_digtable.dig_ext_port_stage));
371} 369}
372 370
373static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) 371static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw)
@@ -375,10 +373,9 @@ static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw)
375 struct rtl_priv *rtlpriv = rtl_priv(hw); 373 struct rtl_priv *rtlpriv = rtl_priv(hw);
376 374
377 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, 375 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE,
378 ("presta_connectstate = %x," 376 "presta_connectstate = %x, cursta_connectctate = %x\n",
379 " cursta_connectctate = %x\n", 377 dm_digtable.presta_connectstate,
380 dm_digtable.presta_connectstate, 378 dm_digtable.cursta_connectctate);
381 dm_digtable.cursta_connectctate));
382 379
383 if (dm_digtable.presta_connectstate == dm_digtable.cursta_connectctate 380 if (dm_digtable.presta_connectstate == dm_digtable.cursta_connectctate
384 || dm_digtable.cursta_connectctate == DIG_STA_BEFORE_CONNECT 381 || dm_digtable.cursta_connectctate == DIG_STA_BEFORE_CONNECT
@@ -464,11 +461,11 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
464 dm_digtable.pre_cck_pd_state = dm_digtable.cur_cck_pd_state; 461 dm_digtable.pre_cck_pd_state = dm_digtable.cur_cck_pd_state;
465 } 462 }
466 463
467 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, 464 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n",
468 ("CCKPDStage=%x\n", dm_digtable.cur_cck_pd_state)); 465 dm_digtable.cur_cck_pd_state);
469 466
470 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, 467 RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n",
471 ("is92C=%x\n", IS_92C_SERIAL(rtlhal->version))); 468 IS_92C_SERIAL(rtlhal->version));
472} 469}
473 470
474static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) 471static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw)
@@ -519,10 +516,9 @@ void rtl92c_dm_write_dig(struct ieee80211_hw *hw)
519 struct rtl_priv *rtlpriv = rtl_priv(hw); 516 struct rtl_priv *rtlpriv = rtl_priv(hw);
520 517
521 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 518 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
522 ("cur_igvalue = 0x%x, " 519 "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n",
523 "pre_igvalue = 0x%x, backoff_val = %d\n", 520 dm_digtable.cur_igvalue, dm_digtable.pre_igvalue,
524 dm_digtable.cur_igvalue, dm_digtable.pre_igvalue, 521 dm_digtable.backoff_val);
525 dm_digtable.backoff_val));
526 522
527 if (dm_digtable.pre_igvalue != dm_digtable.cur_igvalue) { 523 if (dm_digtable.pre_igvalue != dm_digtable.cur_igvalue) {
528 rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, 524 rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f,
@@ -676,15 +672,14 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
676 672
677 rtlpriv->dm.txpower_trackinginit = true; 673 rtlpriv->dm.txpower_trackinginit = true;
678 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 674 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
679 ("rtl92c_dm_txpower_tracking_callback_thermalmeter\n")); 675 "rtl92c_dm_txpower_tracking_callback_thermalmeter\n");
680 676
681 thermalvalue = (u8) rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0x1f); 677 thermalvalue = (u8) rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0x1f);
682 678
683 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 679 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
684 ("Readback Thermal Meter = 0x%x pre thermal meter 0x%x " 680 "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x\n",
685 "eeprom_thermalmeter 0x%x\n", 681 thermalvalue, rtlpriv->dm.thermalvalue,
686 thermalvalue, rtlpriv->dm.thermalvalue, 682 rtlefuse->eeprom_thermalmeter);
687 rtlefuse->eeprom_thermalmeter));
688 683
689 rtl92c_phy_ap_calibrate(hw, (thermalvalue - 684 rtl92c_phy_ap_calibrate(hw, (thermalvalue -
690 rtlefuse->eeprom_thermalmeter)); 685 rtlefuse->eeprom_thermalmeter));
@@ -702,10 +697,9 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
702 ofdm_index_old[0] = (u8) i; 697 ofdm_index_old[0] = (u8) i;
703 698
704 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 699 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
705 ("Initial pathA ele_d reg0x%x = 0x%lx, " 700 "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n",
706 "ofdm_index=0x%x\n",
707 ROFDM0_XATXIQIMBALANCE, 701 ROFDM0_XATXIQIMBALANCE,
708 ele_d, ofdm_index_old[0])); 702 ele_d, ofdm_index_old[0]);
709 break; 703 break;
710 } 704 }
711 } 705 }
@@ -719,11 +713,10 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
719 MASKOFDM_D)) { 713 MASKOFDM_D)) {
720 714
721 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, 715 RT_TRACE(rtlpriv, COMP_POWER_TRACKING,
722 DBG_LOUD, 716 DBG_LOUD,
723 ("Initial pathB ele_d reg0x%x = " 717 "Initial pathB ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n",
724 "0x%lx, ofdm_index=0x%x\n", 718 ROFDM0_XBTXIQIMBALANCE, ele_d,
725 ROFDM0_XBTXIQIMBALANCE, ele_d, 719 ofdm_index_old[1]);
726 ofdm_index_old[1]));
727 break; 720 break;
728 } 721 }
729 } 722 }
@@ -741,11 +734,10 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
741 734
742 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, 735 RT_TRACE(rtlpriv, COMP_POWER_TRACKING,
743 DBG_LOUD, 736 DBG_LOUD,
744 ("Initial reg0x%x = 0x%lx, " 737 "Initial reg0x%x = 0x%lx, cck_index=0x%x, ch 14 %d\n",
745 "cck_index=0x%x, ch 14 %d\n", 738 RCCK0_TXFILTER2, temp_cck,
746 RCCK0_TXFILTER2, temp_cck, 739 cck_index_old,
747 cck_index_old, 740 rtlpriv->dm.cck_inch14);
748 rtlpriv->dm.cck_inch14));
749 break; 741 break;
750 } 742 }
751 } else { 743 } else {
@@ -757,11 +749,10 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
757 749
758 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, 750 RT_TRACE(rtlpriv, COMP_POWER_TRACKING,
759 DBG_LOUD, 751 DBG_LOUD,
760 ("Initial reg0x%x = 0x%lx, " 752 "Initial reg0x%x = 0x%lx, cck_index=0x%x, ch14 %d\n",
761 "cck_index=0x%x, ch14 %d\n", 753 RCCK0_TXFILTER2, temp_cck,
762 RCCK0_TXFILTER2, temp_cck, 754 cck_index_old,
763 cck_index_old, 755 rtlpriv->dm.cck_inch14);
764 rtlpriv->dm.cck_inch14));
765 break; 756 break;
766 } 757 }
767 } 758 }
@@ -790,12 +781,10 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
790 (rtlpriv->dm.thermalvalue_iqk - thermalvalue); 781 (rtlpriv->dm.thermalvalue_iqk - thermalvalue);
791 782
792 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 783 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
793 ("Readback Thermal Meter = 0x%x pre thermal meter 0x%x " 784 "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x delta 0x%x delta_lck 0x%x delta_iqk 0x%x\n",
794 "eeprom_thermalmeter 0x%x delta 0x%x "
795 "delta_lck 0x%x delta_iqk 0x%x\n",
796 thermalvalue, rtlpriv->dm.thermalvalue, 785 thermalvalue, rtlpriv->dm.thermalvalue,
797 rtlefuse->eeprom_thermalmeter, delta, delta_lck, 786 rtlefuse->eeprom_thermalmeter, delta, delta_lck,
798 delta_iqk)); 787 delta_iqk);
799 788
800 if (delta_lck > 1) { 789 if (delta_lck > 1) {
801 rtlpriv->dm.thermalvalue_lck = thermalvalue; 790 rtlpriv->dm.thermalvalue_lck = thermalvalue;
@@ -815,18 +804,15 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
815 804
816 if (is2t) { 805 if (is2t) {
817 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 806 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
818 ("temp OFDM_A_index=0x%x, " 807 "temp OFDM_A_index=0x%x, OFDM_B_index=0x%x, cck_index=0x%x\n",
819 "OFDM_B_index=0x%x," 808 rtlpriv->dm.ofdm_index[0],
820 "cck_index=0x%x\n", 809 rtlpriv->dm.ofdm_index[1],
821 rtlpriv->dm.ofdm_index[0], 810 rtlpriv->dm.cck_index);
822 rtlpriv->dm.ofdm_index[1],
823 rtlpriv->dm.cck_index));
824 } else { 811 } else {
825 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 812 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
826 ("temp OFDM_A_index=0x%x," 813 "temp OFDM_A_index=0x%x, cck_index=0x%x\n",
827 "cck_index=0x%x\n", 814 rtlpriv->dm.ofdm_index[0],
828 rtlpriv->dm.ofdm_index[0], 815 rtlpriv->dm.cck_index);
829 rtlpriv->dm.cck_index));
830 } 816 }
831 817
832 if (thermalvalue > rtlefuse->eeprom_thermalmeter) { 818 if (thermalvalue > rtlefuse->eeprom_thermalmeter) {
@@ -918,16 +904,13 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
918 904
919 if (is2t) { 905 if (is2t) {
920 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 906 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
921 ("new OFDM_A_index=0x%x, " 907 "new OFDM_A_index=0x%x, OFDM_B_index=0x%x, cck_index=0x%x\n",
922 "OFDM_B_index=0x%x," 908 ofdm_index[0], ofdm_index[1],
923 "cck_index=0x%x\n", 909 cck_index);
924 ofdm_index[0], ofdm_index[1],
925 cck_index));
926 } else { 910 } else {
927 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 911 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
928 ("new OFDM_A_index=0x%x," 912 "new OFDM_A_index=0x%x, cck_index=0x%x\n",
929 "cck_index=0x%x\n", 913 ofdm_index[0], cck_index);
930 ofdm_index[0], cck_index));
931 } 914 }
932 } 915 }
933 916
@@ -1085,7 +1068,7 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
1085 rtlpriv->dm.thermalvalue = thermalvalue; 1068 rtlpriv->dm.thermalvalue = thermalvalue;
1086 } 1069 }
1087 1070
1088 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, ("<===\n")); 1071 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<===\n");
1089 1072
1090} 1073}
1091 1074
@@ -1098,8 +1081,8 @@ static void rtl92c_dm_initialize_txpower_tracking_thermalmeter(
1098 rtlpriv->dm.txpower_trackinginit = false; 1081 rtlpriv->dm.txpower_trackinginit = false;
1099 1082
1100 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1083 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1101 ("pMgntInfo->txpower_tracking = %d\n", 1084 "pMgntInfo->txpower_tracking = %d\n",
1102 rtlpriv->dm.txpower_tracking)); 1085 rtlpriv->dm.txpower_tracking);
1103} 1086}
1104 1087
1105static void rtl92c_dm_initialize_txpower_tracking(struct ieee80211_hw *hw) 1088static void rtl92c_dm_initialize_txpower_tracking(struct ieee80211_hw *hw)
@@ -1125,12 +1108,12 @@ static void rtl92c_dm_check_txpower_tracking_thermal_meter(
1125 rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, RFREG_OFFSET_MASK, 1108 rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, RFREG_OFFSET_MASK,
1126 0x60); 1109 0x60);
1127 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1110 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1128 ("Trigger 92S Thermal Meter!!\n")); 1111 "Trigger 92S Thermal Meter!!\n");
1129 tm_trigger = 1; 1112 tm_trigger = 1;
1130 return; 1113 return;
1131 } else { 1114 } else {
1132 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1115 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1133 ("Schedule TxPowerTracking direct call!!\n")); 1116 "Schedule TxPowerTracking direct call!!\n");
1134 rtl92c_dm_txpower_tracking_directcall(hw); 1117 rtl92c_dm_txpower_tracking_directcall(hw);
1135 tm_trigger = 0; 1118 tm_trigger = 0;
1136 } 1119 }
@@ -1169,13 +1152,13 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw)
1169 1152
1170 if (is_hal_stop(rtlhal)) { 1153 if (is_hal_stop(rtlhal)) {
1171 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, 1154 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD,
1172 ("<---- driver is going to unload\n")); 1155 "<---- driver is going to unload\n");
1173 return; 1156 return;
1174 } 1157 }
1175 1158
1176 if (!rtlpriv->dm.useramask) { 1159 if (!rtlpriv->dm.useramask) {
1177 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, 1160 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD,
1178 ("<---- driver does not control rate adaptive mask\n")); 1161 "<---- driver does not control rate adaptive mask\n");
1179 return; 1162 return;
1180 } 1163 }
1181 1164
@@ -1210,14 +1193,13 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw)
1210 p_ra->ratr_state = DM_RATR_STA_LOW; 1193 p_ra->ratr_state = DM_RATR_STA_LOW;
1211 1194
1212 if (p_ra->pre_ratr_state != p_ra->ratr_state) { 1195 if (p_ra->pre_ratr_state != p_ra->ratr_state) {
1196 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, "RSSI = %ld\n",
1197 rtlpriv->dm.undecorated_smoothed_pwdb);
1213 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, 1198 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD,
1214 ("RSSI = %ld\n", 1199 "RSSI_LEVEL = %d\n", p_ra->ratr_state);
1215 rtlpriv->dm.undecorated_smoothed_pwdb));
1216 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, 1200 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD,
1217 ("RSSI_LEVEL = %d\n", p_ra->ratr_state)); 1201 "PreState = %d, CurState = %d\n",
1218 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, 1202 p_ra->pre_ratr_state, p_ra->ratr_state);
1219 ("PreState = %d, CurState = %d\n",
1220 p_ra->pre_ratr_state, p_ra->ratr_state));
1221 1203
1222 rcu_read_lock(); 1204 rcu_read_lock();
1223 sta = ieee80211_find_sta(mac->vif, mac->bssid); 1205 sta = ieee80211_find_sta(mac->vif, mac->bssid);
@@ -1316,8 +1298,7 @@ static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw)
1316 if (((mac->link_state == MAC80211_NOLINK)) && 1298 if (((mac->link_state == MAC80211_NOLINK)) &&
1317 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { 1299 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) {
1318 dm_pstable.rssi_val_min = 0; 1300 dm_pstable.rssi_val_min = 0;
1319 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, 1301 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, "Not connected to any\n");
1320 ("Not connected to any\n"));
1321 } 1302 }
1322 1303
1323 if (mac->link_state == MAC80211_LINKED) { 1304 if (mac->link_state == MAC80211_LINKED) {
@@ -1325,22 +1306,22 @@ static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw)
1325 dm_pstable.rssi_val_min = 1306 dm_pstable.rssi_val_min =
1326 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 1307 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
1327 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, 1308 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
1328 ("AP Client PWDB = 0x%lx\n", 1309 "AP Client PWDB = 0x%lx\n",
1329 dm_pstable.rssi_val_min)); 1310 dm_pstable.rssi_val_min);
1330 } else { 1311 } else {
1331 dm_pstable.rssi_val_min = 1312 dm_pstable.rssi_val_min =
1332 rtlpriv->dm.undecorated_smoothed_pwdb; 1313 rtlpriv->dm.undecorated_smoothed_pwdb;
1333 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, 1314 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
1334 ("STA Default Port PWDB = 0x%lx\n", 1315 "STA Default Port PWDB = 0x%lx\n",
1335 dm_pstable.rssi_val_min)); 1316 dm_pstable.rssi_val_min);
1336 } 1317 }
1337 } else { 1318 } else {
1338 dm_pstable.rssi_val_min = 1319 dm_pstable.rssi_val_min =
1339 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 1320 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
1340 1321
1341 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, 1322 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
1342 ("AP Ext Port PWDB = 0x%lx\n", 1323 "AP Ext Port PWDB = 0x%lx\n",
1343 dm_pstable.rssi_val_min)); 1324 dm_pstable.rssi_val_min);
1344 } 1325 }
1345 1326
1346 if (IS_92C_SERIAL(rtlhal->version)) 1327 if (IS_92C_SERIAL(rtlhal->version))
@@ -1381,7 +1362,7 @@ void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw)
1381 if ((mac->link_state < MAC80211_LINKED) && 1362 if ((mac->link_state < MAC80211_LINKED) &&
1382 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { 1363 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) {
1383 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 1364 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
1384 ("Not connected to any\n")); 1365 "Not connected to any\n");
1385 1366
1386 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; 1367 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
1387 1368
@@ -1394,28 +1375,28 @@ void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw)
1394 undecorated_smoothed_pwdb = 1375 undecorated_smoothed_pwdb =
1395 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 1376 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
1396 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1377 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1397 ("AP Client PWDB = 0x%lx\n", 1378 "AP Client PWDB = 0x%lx\n",
1398 undecorated_smoothed_pwdb)); 1379 undecorated_smoothed_pwdb);
1399 } else { 1380 } else {
1400 undecorated_smoothed_pwdb = 1381 undecorated_smoothed_pwdb =
1401 rtlpriv->dm.undecorated_smoothed_pwdb; 1382 rtlpriv->dm.undecorated_smoothed_pwdb;
1402 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1383 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1403 ("STA Default Port PWDB = 0x%lx\n", 1384 "STA Default Port PWDB = 0x%lx\n",
1404 undecorated_smoothed_pwdb)); 1385 undecorated_smoothed_pwdb);
1405 } 1386 }
1406 } else { 1387 } else {
1407 undecorated_smoothed_pwdb = 1388 undecorated_smoothed_pwdb =
1408 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 1389 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
1409 1390
1410 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1391 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1411 ("AP Ext Port PWDB = 0x%lx\n", 1392 "AP Ext Port PWDB = 0x%lx\n",
1412 undecorated_smoothed_pwdb)); 1393 undecorated_smoothed_pwdb);
1413 } 1394 }
1414 1395
1415 if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { 1396 if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) {
1416 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; 1397 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1;
1417 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1398 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1418 ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n")); 1399 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n");
1419 } else if ((undecorated_smoothed_pwdb < 1400 } else if ((undecorated_smoothed_pwdb <
1420 (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && 1401 (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) &&
1421 (undecorated_smoothed_pwdb >= 1402 (undecorated_smoothed_pwdb >=
@@ -1423,18 +1404,18 @@ void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw)
1423 1404
1424 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; 1405 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1;
1425 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1406 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1426 ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n")); 1407 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n");
1427 } else if (undecorated_smoothed_pwdb < 1408 } else if (undecorated_smoothed_pwdb <
1428 (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { 1409 (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) {
1429 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; 1410 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
1430 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1411 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1431 ("TXHIGHPWRLEVEL_NORMAL\n")); 1412 "TXHIGHPWRLEVEL_NORMAL\n");
1432 } 1413 }
1433 1414
1434 if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { 1415 if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) {
1435 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1416 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1436 ("PHY_SetTxPowerLevel8192S() Channel = %d\n", 1417 "PHY_SetTxPowerLevel8192S() Channel = %d\n",
1437 rtlphy->current_channel)); 1418 rtlphy->current_channel);
1438 rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); 1419 rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel);
1439 } 1420 }
1440 1421
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h
index b9736d3e9a39..2178e3761883 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
index 931d97979b04..c20b3c30f62e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,16 +27,13 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include <linux/firmware.h>
33#include <linux/export.h>
34#include "../wifi.h" 30#include "../wifi.h"
35#include "../pci.h" 31#include "../pci.h"
36#include "../base.h" 32#include "../base.h"
37#include "../rtl8192ce/reg.h" 33#include "../rtl8192ce/reg.h"
38#include "../rtl8192ce/def.h" 34#include "../rtl8192ce/def.h"
39#include "fw_common.h" 35#include "fw_common.h"
36#include <linux/export.h>
40 37
41static void _rtl92c_enable_fw_download(struct ieee80211_hw *hw, bool enable) 38static void _rtl92c_enable_fw_download(struct ieee80211_hw *hw, bool enable)
42{ 39{
@@ -172,7 +169,7 @@ static void _rtl92c_write_fw(struct ieee80211_hw *hw,
172 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 169 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
173 u8 *bufferPtr = (u8 *) buffer; 170 u8 *bufferPtr = (u8 *) buffer;
174 171
175 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, ("FW size is %d bytes,\n", size)); 172 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "FW size is %d bytes\n", size);
176 173
177 if (IS_CHIP_VER_B(version)) { 174 if (IS_CHIP_VER_B(version)) {
178 u32 pageNums, remainSize; 175 u32 pageNums, remainSize;
@@ -186,7 +183,7 @@ static void _rtl92c_write_fw(struct ieee80211_hw *hw,
186 183
187 if (pageNums > 4) { 184 if (pageNums > 4) {
188 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 185 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
189 ("Page numbers should not greater then 4\n")); 186 "Page numbers should not greater then 4\n");
190 } 187 }
191 188
192 for (page = 0; page < pageNums; page++) { 189 for (page = 0; page < pageNums; page++) {
@@ -219,13 +216,12 @@ static int _rtl92c_fw_free_to_go(struct ieee80211_hw *hw)
219 216
220 if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) { 217 if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) {
221 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 218 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
222 ("chksum report faill ! REG_MCUFWDL:0x%08x .\n", 219 "chksum report faill ! REG_MCUFWDL:0x%08x\n", value32);
223 value32));
224 return -EIO; 220 return -EIO;
225 } 221 }
226 222
227 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, 223 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
228 ("Checksum report OK ! REG_MCUFWDL:0x%08x .\n", value32)); 224 "Checksum report OK ! REG_MCUFWDL:0x%08x\n", value32);
229 225
230 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); 226 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
231 value32 |= MCUFWDL_RDY; 227 value32 |= MCUFWDL_RDY;
@@ -238,9 +234,8 @@ static int _rtl92c_fw_free_to_go(struct ieee80211_hw *hw)
238 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); 234 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
239 if (value32 & WINTINI_RDY) { 235 if (value32 & WINTINI_RDY) {
240 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, 236 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
241 ("Polling FW ready success!!" 237 "Polling FW ready success!! REG_MCUFWDL:0x%08x\n",
242 " REG_MCUFWDL:0x%08x .\n", 238 value32);
243 value32));
244 return 0; 239 return 0;
245 } 240 }
246 241
@@ -249,7 +244,7 @@ static int _rtl92c_fw_free_to_go(struct ieee80211_hw *hw)
249 } while (counter++ < FW_8192C_POLLING_TIMEOUT_COUNT); 244 } while (counter++ < FW_8192C_POLLING_TIMEOUT_COUNT);
250 245
251 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 246 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
252 ("Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n", value32)); 247 "Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", value32);
253 return -EIO; 248 return -EIO;
254} 249}
255 250
@@ -262,20 +257,19 @@ int rtl92c_download_fw(struct ieee80211_hw *hw)
262 u32 fwsize; 257 u32 fwsize;
263 enum version_8192c version = rtlhal->version; 258 enum version_8192c version = rtlhal->version;
264 259
265 if (!rtlhal->pfirmware) 260 if (rtlpriv->max_fw_size == 0 || !rtlhal->pfirmware)
266 return 1; 261 return 1;
267 262
268 pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name);
269 pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware; 263 pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware;
270 pfwdata = (u8 *) rtlhal->pfirmware; 264 pfwdata = (u8 *) rtlhal->pfirmware;
271 fwsize = rtlhal->fwsize; 265 fwsize = rtlhal->fwsize;
272 266
273 if (IS_FW_HEADER_EXIST(pfwheader)) { 267 if (IS_FW_HEADER_EXIST(pfwheader)) {
274 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, 268 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
275 ("Firmware Version(%d), Signature(%#x),Size(%d)\n", 269 "Firmware Version(%d), Signature(%#x),Size(%d)\n",
276 le16_to_cpu(pfwheader->version), 270 le16_to_cpu(pfwheader->version),
277 le16_to_cpu(pfwheader->signature), 271 le16_to_cpu(pfwheader->signature),
278 (uint)sizeof(struct rtl92c_firmware_header))); 272 (uint)sizeof(struct rtl92c_firmware_header));
279 273
280 pfwdata = pfwdata + sizeof(struct rtl92c_firmware_header); 274 pfwdata = pfwdata + sizeof(struct rtl92c_firmware_header);
281 fwsize = fwsize - sizeof(struct rtl92c_firmware_header); 275 fwsize = fwsize - sizeof(struct rtl92c_firmware_header);
@@ -287,10 +281,10 @@ int rtl92c_download_fw(struct ieee80211_hw *hw)
287 281
288 if (_rtl92c_fw_free_to_go(hw)) { 282 if (_rtl92c_fw_free_to_go(hw)) {
289 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 283 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
290 ("Firmware is not ready to run!\n")); 284 "Firmware is not ready to run!\n");
291 } else { 285 } else {
292 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, 286 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
293 ("Firmware is ready to run!\n")); 287 "Firmware is ready to run!\n");
294 } 288 }
295 289
296 return 0; 290 return 0;
@@ -328,22 +322,22 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
328 unsigned long flag; 322 unsigned long flag;
329 u8 idx; 323 u8 idx;
330 324
331 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("come in\n")); 325 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n");
332 326
333 while (true) { 327 while (true) {
334 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); 328 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
335 if (rtlhal->h2c_setinprogress) { 329 if (rtlhal->h2c_setinprogress) {
336 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 330 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
337 ("H2C set in progress! Wait to set.." 331 "H2C set in progress! Wait to set..element_id(%d)\n",
338 "element_id(%d).\n", element_id)); 332 element_id);
339 333
340 while (rtlhal->h2c_setinprogress) { 334 while (rtlhal->h2c_setinprogress) {
341 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, 335 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock,
342 flag); 336 flag);
343 h2c_waitcounter++; 337 h2c_waitcounter++;
344 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 338 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
345 ("Wait 100 us (%d times)...\n", 339 "Wait 100 us (%d times)...\n",
346 h2c_waitcounter)); 340 h2c_waitcounter);
347 udelay(100); 341 udelay(100);
348 342
349 if (h2c_waitcounter > 1000) 343 if (h2c_waitcounter > 1000)
@@ -363,8 +357,7 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
363 wait_writeh2c_limmit--; 357 wait_writeh2c_limmit--;
364 if (wait_writeh2c_limmit == 0) { 358 if (wait_writeh2c_limmit == 0) {
365 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 359 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
366 ("Write H2C fail because no trigger " 360 "Write H2C fail because no trigger for FW INT!\n");
367 "for FW INT!\n"));
368 break; 361 break;
369 } 362 }
370 363
@@ -388,7 +381,7 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
388 break; 381 break;
389 default: 382 default:
390 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 383 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
391 ("switch case not process\n")); 384 "switch case not processed\n");
392 break; 385 break;
393 } 386 }
394 387
@@ -398,8 +391,8 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
398 wait_h2c_limmit--; 391 wait_h2c_limmit--;
399 if (wait_h2c_limmit == 0) { 392 if (wait_h2c_limmit == 0) {
400 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 393 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
401 ("Wating too long for FW read " 394 "Waiting too long for FW read clear HMEBox(%d)!\n",
402 "clear HMEBox(%d)!\n", boxnum)); 395 boxnum);
403 break; 396 break;
404 } 397 }
405 398
@@ -408,14 +401,14 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
408 isfw_read = _rtl92c_check_fw_read_last_h2c(hw, boxnum); 401 isfw_read = _rtl92c_check_fw_read_last_h2c(hw, boxnum);
409 u1b_tmp = rtl_read_byte(rtlpriv, 0x1BF); 402 u1b_tmp = rtl_read_byte(rtlpriv, 0x1BF);
410 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 403 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
411 ("Wating for FW read clear HMEBox(%d)!!! " 404 "Waiting for FW read clear HMEBox(%d)!!! 0x1BF = %2x\n",
412 "0x1BF = %2x\n", boxnum, u1b_tmp)); 405 boxnum, u1b_tmp);
413 } 406 }
414 407
415 if (!isfw_read) { 408 if (!isfw_read) {
416 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 409 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
417 ("Write H2C register BOX[%d] fail!!!!! " 410 "Write H2C register BOX[%d] fail!!!!! Fw do not read\n",
418 "Fw do not read.\n", boxnum)); 411 boxnum);
419 break; 412 break;
420 } 413 }
421 414
@@ -423,8 +416,8 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
423 memset(boxextcontent, 0, sizeof(boxextcontent)); 416 memset(boxextcontent, 0, sizeof(boxextcontent));
424 boxcontent[0] = element_id; 417 boxcontent[0] = element_id;
425 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 418 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
426 ("Write element_id box_reg(%4x) = %2x\n", 419 "Write element_id box_reg(%4x) = %2x\n",
427 box_reg, element_id)); 420 box_reg, element_id);
428 421
429 switch (cmd_len) { 422 switch (cmd_len) {
430 case 1: 423 case 1:
@@ -493,7 +486,7 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
493 break; 486 break;
494 default: 487 default:
495 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 488 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
496 ("switch case not process\n")); 489 "switch case not processed\n");
497 break; 490 break;
498 } 491 }
499 492
@@ -504,29 +497,22 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw,
504 rtlhal->last_hmeboxnum = 0; 497 rtlhal->last_hmeboxnum = 0;
505 498
506 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 499 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
507 ("pHalData->last_hmeboxnum = %d\n", 500 "pHalData->last_hmeboxnum = %d\n",
508 rtlhal->last_hmeboxnum)); 501 rtlhal->last_hmeboxnum);
509 } 502 }
510 503
511 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); 504 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
512 rtlhal->h2c_setinprogress = false; 505 rtlhal->h2c_setinprogress = false;
513 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); 506 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
514 507
515 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("go out\n")); 508 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n");
516} 509}
517 510
518void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, 511void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw,
519 u8 element_id, u32 cmd_len, u8 *p_cmdbuffer) 512 u8 element_id, u32 cmd_len, u8 *p_cmdbuffer)
520{ 513{
521 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
522 u32 tmp_cmdbuf[2]; 514 u32 tmp_cmdbuf[2];
523 515
524 if (rtlhal->fw_ready == false) {
525 RT_ASSERT(false, ("return H2C cmd because of Fw "
526 "download fail!!!\n"));
527 return;
528 }
529
530 memset(tmp_cmdbuf, 0, 8); 516 memset(tmp_cmdbuf, 0, 8);
531 memcpy(tmp_cmdbuf, p_cmdbuffer, cmd_len); 517 memcpy(tmp_cmdbuf, p_cmdbuffer, cmd_len);
532 _rtl92c_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf); 518 _rtl92c_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf);
@@ -547,7 +533,7 @@ void rtl92c_firmware_selfreset(struct ieee80211_hw *hw)
547 while (u1b_tmp & BIT(2)) { 533 while (u1b_tmp & BIT(2)) {
548 delay--; 534 delay--;
549 if (delay == 0) { 535 if (delay == 0) {
550 RT_ASSERT(false, ("8051 reset fail.\n")); 536 RT_ASSERT(false, "8051 reset fail\n");
551 break; 537 break;
552 } 538 }
553 udelay(50); 539 udelay(50);
@@ -562,7 +548,7 @@ void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
562 u8 u1_h2c_set_pwrmode[3] = {0}; 548 u8 u1_h2c_set_pwrmode[3] = {0};
563 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 549 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
564 550
565 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, ("FW LPS mode = %d\n", mode)); 551 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode);
566 552
567 SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, mode); 553 SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, mode);
568 SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, 1); 554 SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, 1);
@@ -570,7 +556,7 @@ void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
570 ppsc->reg_max_lps_awakeintvl); 556 ppsc->reg_max_lps_awakeintvl);
571 557
572 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 558 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
573 "rtl92c_set_fw_rsvdpagepkt(): u1_h2c_set_pwrmode\n", 559 "rtl92c_set_fw_rsvdpagepkt(): u1_h2c_set_pwrmode",
574 u1_h2c_set_pwrmode, 3); 560 u1_h2c_set_pwrmode, 3);
575 rtl92c_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode); 561 rtl92c_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode);
576 562
@@ -780,14 +766,16 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
780 totalpacketlen = TOTAL_RESERVED_PKT_LEN; 766 totalpacketlen = TOTAL_RESERVED_PKT_LEN;
781 767
782 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, 768 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
783 "rtl92c_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", 769 "rtl92c_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
784 &reserved_page_packet[0], totalpacketlen); 770 &reserved_page_packet[0], totalpacketlen);
785 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 771 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
786 "rtl92c_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", 772 "rtl92c_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
787 u1RsvdPageLoc, 3); 773 u1RsvdPageLoc, 3);
788 774
789 775
790 skb = dev_alloc_skb(totalpacketlen); 776 skb = dev_alloc_skb(totalpacketlen);
777 if (!skb)
778 return;
791 memcpy((u8 *) skb_put(skb, totalpacketlen), 779 memcpy((u8 *) skb_put(skb, totalpacketlen),
792 &reserved_page_packet, totalpacketlen); 780 &reserved_page_packet, totalpacketlen);
793 781
@@ -798,15 +786,14 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
798 786
799 if (dlok) { 787 if (dlok) {
800 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 788 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
801 ("Set RSVD page location to Fw.\n")); 789 "Set RSVD page location to Fw\n");
802 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 790 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
803 "H2C_RSVDPAGE:\n", 791 "H2C_RSVDPAGE", u1RsvdPageLoc, 3);
804 u1RsvdPageLoc, 3);
805 rtl92c_fill_h2c_cmd(hw, H2C_RSVDPAGE, 792 rtl92c_fill_h2c_cmd(hw, H2C_RSVDPAGE,
806 sizeof(u1RsvdPageLoc), u1RsvdPageLoc); 793 sizeof(u1RsvdPageLoc), u1RsvdPageLoc);
807 } else 794 } else
808 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 795 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
809 ("Set RSVD page location to Fw FAIL!!!!!!.\n")); 796 "Set RSVD page location to Fw FAIL!!!!!!\n");
810} 797}
811EXPORT_SYMBOL(rtl92c_set_fw_rsvdpagepkt); 798EXPORT_SYMBOL(rtl92c_set_fw_rsvdpagepkt);
812 799
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
index cec5a3a1cc53..780ea5b1e24c 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/main.c b/drivers/net/wireless/rtlwifi/rtl8192c/main.c
index 605ff191aeb7..918b1d129e77 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/main.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/main.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,8 +27,8 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/module.h>
31#include "../wifi.h" 30#include "../wifi.h"
31#include <linux/module.h>
32 32
33 33
34MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); 34MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>");
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
index 1f07558debf2..22e998dd2f32 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -42,16 +42,15 @@ u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
42 struct rtl_priv *rtlpriv = rtl_priv(hw); 42 struct rtl_priv *rtlpriv = rtl_priv(hw);
43 u32 returnvalue, originalvalue, bitshift; 43 u32 returnvalue, originalvalue, bitshift;
44 44
45 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 45 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n",
46 "bitmask(%#x)\n", regaddr, 46 regaddr, bitmask);
47 bitmask));
48 originalvalue = rtl_read_dword(rtlpriv, regaddr); 47 originalvalue = rtl_read_dword(rtlpriv, regaddr);
49 bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); 48 bitshift = _rtl92c_phy_calculate_bit_shift(bitmask);
50 returnvalue = (originalvalue & bitmask) >> bitshift; 49 returnvalue = (originalvalue & bitmask) >> bitshift;
51 50
52 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("BBR MASK=0x%x " 51 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
53 "Addr[0x%x]=0x%x\n", bitmask, 52 "BBR MASK=0x%x Addr[0x%x]=0x%x\n",
54 regaddr, originalvalue)); 53 bitmask, regaddr, originalvalue);
55 54
56 return returnvalue; 55 return returnvalue;
57 56
@@ -64,9 +63,9 @@ void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw,
64 struct rtl_priv *rtlpriv = rtl_priv(hw); 63 struct rtl_priv *rtlpriv = rtl_priv(hw);
65 u32 originalvalue, bitshift; 64 u32 originalvalue, bitshift;
66 65
67 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 66 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
68 " data(%#x)\n", regaddr, bitmask, 67 "regaddr(%#x), bitmask(%#x), data(%#x)\n",
69 data)); 68 regaddr, bitmask, data);
70 69
71 if (bitmask != MASKDWORD) { 70 if (bitmask != MASKDWORD) {
72 originalvalue = rtl_read_dword(rtlpriv, regaddr); 71 originalvalue = rtl_read_dword(rtlpriv, regaddr);
@@ -76,9 +75,9 @@ void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw,
76 75
77 rtl_write_dword(rtlpriv, regaddr, data); 76 rtl_write_dword(rtlpriv, regaddr, data);
78 77
79 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 78 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
80 " data(%#x)\n", regaddr, bitmask, 79 "regaddr(%#x), bitmask(%#x), data(%#x)\n",
81 data)); 80 regaddr, bitmask, data);
82 81
83} 82}
84EXPORT_SYMBOL(rtl92c_phy_set_bb_reg); 83EXPORT_SYMBOL(rtl92c_phy_set_bb_reg);
@@ -86,7 +85,7 @@ EXPORT_SYMBOL(rtl92c_phy_set_bb_reg);
86u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, 85u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
87 enum radio_path rfpath, u32 offset) 86 enum radio_path rfpath, u32 offset)
88{ 87{
89 RT_ASSERT(false, ("deprecated!\n")); 88 RT_ASSERT(false, "deprecated!\n");
90 return 0; 89 return 0;
91 90
92} 91}
@@ -96,7 +95,7 @@ void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
96 enum radio_path rfpath, u32 offset, 95 enum radio_path rfpath, u32 offset,
97 u32 data) 96 u32 data)
98{ 97{
99 RT_ASSERT(false, ("deprecated!\n")); 98 RT_ASSERT(false, "deprecated!\n");
100} 99}
101EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_write); 100EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_write);
102 101
@@ -114,7 +113,7 @@ u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
114 offset &= 0x3f; 113 offset &= 0x3f;
115 newoffset = offset; 114 newoffset = offset;
116 if (RT_CANNOT_IO(hw)) { 115 if (RT_CANNOT_IO(hw)) {
117 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("return all one\n")); 116 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "return all one\n");
118 return 0xFFFFFFFF; 117 return 0xFFFFFFFF;
119 } 118 }
120 tmplong = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD); 119 tmplong = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD);
@@ -144,9 +143,8 @@ u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw,
144 else 143 else
145 retvalue = rtl_get_bbreg(hw, pphyreg->rflssi_readback, 144 retvalue = rtl_get_bbreg(hw, pphyreg->rflssi_readback,
146 BLSSIREADBACKDATA); 145 BLSSIREADBACKDATA);
147 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("RFR-%d Addr[0x%x]=0x%x\n", 146 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]=0x%x\n",
148 rfpath, pphyreg->rflssi_readback, 147 rfpath, pphyreg->rflssi_readback, retvalue);
149 retvalue));
150 return retvalue; 148 return retvalue;
151} 149}
152EXPORT_SYMBOL(_rtl92c_phy_rf_serial_read); 150EXPORT_SYMBOL(_rtl92c_phy_rf_serial_read);
@@ -162,16 +160,15 @@ void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
162 struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; 160 struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath];
163 161
164 if (RT_CANNOT_IO(hw)) { 162 if (RT_CANNOT_IO(hw)) {
165 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("stop\n")); 163 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "stop\n");
166 return; 164 return;
167 } 165 }
168 offset &= 0x3f; 166 offset &= 0x3f;
169 newoffset = offset; 167 newoffset = offset;
170 data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff; 168 data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff;
171 rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr); 169 rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr);
172 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("RFW-%d Addr[0x%x]=0x%x\n", 170 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]=0x%x\n",
173 rfpath, pphyreg->rf3wire_offset, 171 rfpath, pphyreg->rf3wire_offset, data_and_addr);
174 data_and_addr));
175} 172}
176EXPORT_SYMBOL(_rtl92c_phy_rf_serial_write); 173EXPORT_SYMBOL(_rtl92c_phy_rf_serial_write);
177 174
@@ -216,16 +213,16 @@ bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw)
216 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 213 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
217 bool rtstatus; 214 bool rtstatus;
218 215
219 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("==>\n")); 216 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "==>\n");
220 rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw, 217 rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw,
221 BASEBAND_CONFIG_PHY_REG); 218 BASEBAND_CONFIG_PHY_REG);
222 if (rtstatus != true) { 219 if (rtstatus != true) {
223 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Write BB Reg Fail!!")); 220 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n");
224 return false; 221 return false;
225 } 222 }
226 if (rtlphy->rf_type == RF_1T2R) { 223 if (rtlphy->rf_type == RF_1T2R) {
227 _rtl92c_phy_bb_config_1t(hw); 224 _rtl92c_phy_bb_config_1t(hw);
228 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Config to 1T!!\n")); 225 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Config to 1T!!\n");
229 } 226 }
230 if (rtlefuse->autoload_failflag == false) { 227 if (rtlefuse->autoload_failflag == false) {
231 rtlphy->pwrgroup_cnt = 0; 228 rtlphy->pwrgroup_cnt = 0;
@@ -233,13 +230,13 @@ bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw)
233 BASEBAND_CONFIG_PHY_REG); 230 BASEBAND_CONFIG_PHY_REG);
234 } 231 }
235 if (rtstatus != true) { 232 if (rtstatus != true) {
236 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("BB_PG Reg Fail!!")); 233 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n");
237 return false; 234 return false;
238 } 235 }
239 rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw, 236 rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw,
240 BASEBAND_CONFIG_AGC_TAB); 237 BASEBAND_CONFIG_AGC_TAB);
241 if (rtstatus != true) { 238 if (rtstatus != true) {
242 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("AGC Table Fail\n")); 239 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "AGC Table Fail\n");
243 return false; 240 return false;
244 } 241 }
245 rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw, 242 rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw,
@@ -260,114 +257,114 @@ void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
260 if (regaddr == RTXAGC_A_RATE18_06) { 257 if (regaddr == RTXAGC_A_RATE18_06) {
261 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][0] = data; 258 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][0] = data;
262 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 259 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
263 ("MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n", 260 "MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n",
264 rtlphy->pwrgroup_cnt, 261 rtlphy->pwrgroup_cnt,
265 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][0])); 262 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][0]);
266 } 263 }
267 if (regaddr == RTXAGC_A_RATE54_24) { 264 if (regaddr == RTXAGC_A_RATE54_24) {
268 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][1] = data; 265 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][1] = data;
269 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 266 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
270 ("MCSTxPowerLevelOriginalOffset[%d][1] = 0x%x\n", 267 "MCSTxPowerLevelOriginalOffset[%d][1] = 0x%x\n",
271 rtlphy->pwrgroup_cnt, 268 rtlphy->pwrgroup_cnt,
272 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][1])); 269 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][1]);
273 } 270 }
274 if (regaddr == RTXAGC_A_CCK1_MCS32) { 271 if (regaddr == RTXAGC_A_CCK1_MCS32) {
275 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][6] = data; 272 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][6] = data;
276 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 273 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
277 ("MCSTxPowerLevelOriginalOffset[%d][6] = 0x%x\n", 274 "MCSTxPowerLevelOriginalOffset[%d][6] = 0x%x\n",
278 rtlphy->pwrgroup_cnt, 275 rtlphy->pwrgroup_cnt,
279 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][6])); 276 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][6]);
280 } 277 }
281 if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) { 278 if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) {
282 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][7] = data; 279 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][7] = data;
283 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 280 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
284 ("MCSTxPowerLevelOriginalOffset[%d][7] = 0x%x\n", 281 "MCSTxPowerLevelOriginalOffset[%d][7] = 0x%x\n",
285 rtlphy->pwrgroup_cnt, 282 rtlphy->pwrgroup_cnt,
286 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][7])); 283 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][7]);
287 } 284 }
288 if (regaddr == RTXAGC_A_MCS03_MCS00) { 285 if (regaddr == RTXAGC_A_MCS03_MCS00) {
289 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][2] = data; 286 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][2] = data;
290 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 287 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
291 ("MCSTxPowerLevelOriginalOffset[%d][2] = 0x%x\n", 288 "MCSTxPowerLevelOriginalOffset[%d][2] = 0x%x\n",
292 rtlphy->pwrgroup_cnt, 289 rtlphy->pwrgroup_cnt,
293 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][2])); 290 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][2]);
294 } 291 }
295 if (regaddr == RTXAGC_A_MCS07_MCS04) { 292 if (regaddr == RTXAGC_A_MCS07_MCS04) {
296 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][3] = data; 293 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][3] = data;
297 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 294 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
298 ("MCSTxPowerLevelOriginalOffset[%d][3] = 0x%x\n", 295 "MCSTxPowerLevelOriginalOffset[%d][3] = 0x%x\n",
299 rtlphy->pwrgroup_cnt, 296 rtlphy->pwrgroup_cnt,
300 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][3])); 297 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][3]);
301 } 298 }
302 if (regaddr == RTXAGC_A_MCS11_MCS08) { 299 if (regaddr == RTXAGC_A_MCS11_MCS08) {
303 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][4] = data; 300 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][4] = data;
304 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 301 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
305 ("MCSTxPowerLevelOriginalOffset[%d][4] = 0x%x\n", 302 "MCSTxPowerLevelOriginalOffset[%d][4] = 0x%x\n",
306 rtlphy->pwrgroup_cnt, 303 rtlphy->pwrgroup_cnt,
307 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][4])); 304 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][4]);
308 } 305 }
309 if (regaddr == RTXAGC_A_MCS15_MCS12) { 306 if (regaddr == RTXAGC_A_MCS15_MCS12) {
310 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][5] = data; 307 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][5] = data;
311 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 308 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
312 ("MCSTxPowerLevelOriginalOffset[%d][5] = 0x%x\n", 309 "MCSTxPowerLevelOriginalOffset[%d][5] = 0x%x\n",
313 rtlphy->pwrgroup_cnt, 310 rtlphy->pwrgroup_cnt,
314 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][5])); 311 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][5]);
315 } 312 }
316 if (regaddr == RTXAGC_B_RATE18_06) { 313 if (regaddr == RTXAGC_B_RATE18_06) {
317 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][8] = data; 314 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][8] = data;
318 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 315 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
319 ("MCSTxPowerLevelOriginalOffset[%d][8] = 0x%x\n", 316 "MCSTxPowerLevelOriginalOffset[%d][8] = 0x%x\n",
320 rtlphy->pwrgroup_cnt, 317 rtlphy->pwrgroup_cnt,
321 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][8])); 318 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][8]);
322 } 319 }
323 if (regaddr == RTXAGC_B_RATE54_24) { 320 if (regaddr == RTXAGC_B_RATE54_24) {
324 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9] = data; 321 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9] = data;
325 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 322 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
326 ("MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n", 323 "MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n",
327 rtlphy->pwrgroup_cnt, 324 rtlphy->pwrgroup_cnt,
328 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9])); 325 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9]);
329 } 326 }
330 if (regaddr == RTXAGC_B_CCK1_55_MCS32) { 327 if (regaddr == RTXAGC_B_CCK1_55_MCS32) {
331 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14] = data; 328 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14] = data;
332 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 329 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
333 ("MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n", 330 "MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n",
334 rtlphy->pwrgroup_cnt, 331 rtlphy->pwrgroup_cnt,
335 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14])); 332 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14]);
336 } 333 }
337 if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) { 334 if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) {
338 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15] = data; 335 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15] = data;
339 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 336 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
340 ("MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n", 337 "MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n",
341 rtlphy->pwrgroup_cnt, 338 rtlphy->pwrgroup_cnt,
342 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15])); 339 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15]);
343 } 340 }
344 if (regaddr == RTXAGC_B_MCS03_MCS00) { 341 if (regaddr == RTXAGC_B_MCS03_MCS00) {
345 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10] = data; 342 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10] = data;
346 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 343 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
347 ("MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n", 344 "MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n",
348 rtlphy->pwrgroup_cnt, 345 rtlphy->pwrgroup_cnt,
349 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10])); 346 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10]);
350 } 347 }
351 if (regaddr == RTXAGC_B_MCS07_MCS04) { 348 if (regaddr == RTXAGC_B_MCS07_MCS04) {
352 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11] = data; 349 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11] = data;
353 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 350 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
354 ("MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n", 351 "MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n",
355 rtlphy->pwrgroup_cnt, 352 rtlphy->pwrgroup_cnt,
356 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11])); 353 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11]);
357 } 354 }
358 if (regaddr == RTXAGC_B_MCS11_MCS08) { 355 if (regaddr == RTXAGC_B_MCS11_MCS08) {
359 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12] = data; 356 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12] = data;
360 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 357 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
361 ("MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n", 358 "MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n",
362 rtlphy->pwrgroup_cnt, 359 rtlphy->pwrgroup_cnt,
363 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12])); 360 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12]);
364 } 361 }
365 if (regaddr == RTXAGC_B_MCS15_MCS12) { 362 if (regaddr == RTXAGC_B_MCS15_MCS12) {
366 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13] = data; 363 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13] = data;
367 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 364 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
368 ("MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n", 365 "MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n",
369 rtlphy->pwrgroup_cnt, 366 rtlphy->pwrgroup_cnt,
370 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13])); 367 rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13]);
371 368
372 rtlphy->pwrgroup_cnt++; 369 rtlphy->pwrgroup_cnt++;
373 } 370 }
@@ -389,12 +386,11 @@ void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
389 (u8) rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, MASKBYTE0); 386 (u8) rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, MASKBYTE0);
390 387
391 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 388 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
392 ("Default initial gain (c50=0x%x, " 389 "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x\n",
393 "c58=0x%x, c60=0x%x, c68=0x%x\n", 390 rtlphy->default_initialgain[0],
394 rtlphy->default_initialgain[0], 391 rtlphy->default_initialgain[1],
395 rtlphy->default_initialgain[1], 392 rtlphy->default_initialgain[2],
396 rtlphy->default_initialgain[2], 393 rtlphy->default_initialgain[3]);
397 rtlphy->default_initialgain[3]));
398 394
399 rtlphy->framesync = (u8) rtl_get_bbreg(hw, 395 rtlphy->framesync = (u8) rtl_get_bbreg(hw,
400 ROFDM0_RXDETECTOR3, MASKBYTE0); 396 ROFDM0_RXDETECTOR3, MASKBYTE0);
@@ -402,8 +398,8 @@ void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
402 ROFDM0_RXDETECTOR2, MASKDWORD); 398 ROFDM0_RXDETECTOR2, MASKDWORD);
403 399
404 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 400 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
405 ("Default framesync (0x%x) = 0x%x\n", 401 "Default framesync (0x%x) = 0x%x\n",
406 ROFDM0_RXDETECTOR3, rtlphy->framesync)); 402 ROFDM0_RXDETECTOR3, rtlphy->framesync);
407} 403}
408 404
409void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw) 405void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw)
@@ -615,8 +611,8 @@ bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm)
615 else 611 else
616 ofdmtxpwridx = 0; 612 ofdmtxpwridx = 0;
617 RT_TRACE(rtlpriv, COMP_TXAGC, DBG_TRACE, 613 RT_TRACE(rtlpriv, COMP_TXAGC, DBG_TRACE,
618 ("%lx dBm, ccktxpwridx = %d, ofdmtxpwridx = %d\n", 614 "%lx dBm, ccktxpwridx = %d, ofdmtxpwridx = %d\n",
619 power_indbm, ccktxpwridx, ofdmtxpwridx)); 615 power_indbm, ccktxpwridx, ofdmtxpwridx);
620 for (idx = 0; idx < 14; idx++) { 616 for (idx = 0; idx < 14; idx++) {
621 for (rf_path = 0; rf_path < 2; rf_path++) { 617 for (rf_path = 0; rf_path < 2; rf_path++) {
622 rtlefuse->txpwrlevel_cck[rf_path][idx] = ccktxpwridx; 618 rtlefuse->txpwrlevel_cck[rf_path][idx] = ccktxpwridx;
@@ -710,7 +706,7 @@ void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
710 break; 706 break;
711 default: 707 default:
712 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 708 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
713 ("Unknown Scan Backup operation.\n")); 709 "Unknown Scan Backup operation\n");
714 break; 710 break;
715 } 711 }
716 } 712 }
@@ -732,7 +728,7 @@ void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
732 rtlpriv->cfg->ops->phy_set_bw_mode_callback(hw); 728 rtlpriv->cfg->ops->phy_set_bw_mode_callback(hw);
733 } else { 729 } else {
734 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 730 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
735 ("FALSE driver sleep or unload\n")); 731 "FALSE driver sleep or unload\n");
736 rtlphy->set_bwmode_inprogress = false; 732 rtlphy->set_bwmode_inprogress = false;
737 rtlphy->current_chan_bw = tmp_bw; 733 rtlphy->current_chan_bw = tmp_bw;
738 } 734 }
@@ -747,7 +743,7 @@ void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw)
747 u32 delay; 743 u32 delay;
748 744
749 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, 745 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE,
750 ("switch to channel%d\n", rtlphy->current_channel)); 746 "switch to channel%d\n", rtlphy->current_channel);
751 if (is_hal_stop(rtlhal)) 747 if (is_hal_stop(rtlhal))
752 return; 748 return;
753 do { 749 do {
@@ -765,7 +761,7 @@ void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw)
765 } 761 }
766 break; 762 break;
767 } while (true); 763 } while (true);
768 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 764 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n");
769} 765}
770EXPORT_SYMBOL(rtl92c_phy_sw_chnl_callback); 766EXPORT_SYMBOL(rtl92c_phy_sw_chnl_callback);
771 767
@@ -780,19 +776,18 @@ u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw)
780 if (rtlphy->set_bwmode_inprogress) 776 if (rtlphy->set_bwmode_inprogress)
781 return 0; 777 return 0;
782 RT_ASSERT((rtlphy->current_channel <= 14), 778 RT_ASSERT((rtlphy->current_channel <= 14),
783 ("WIRELESS_MODE_G but channel>14")); 779 "WIRELESS_MODE_G but channel>14\n");
784 rtlphy->sw_chnl_inprogress = true; 780 rtlphy->sw_chnl_inprogress = true;
785 rtlphy->sw_chnl_stage = 0; 781 rtlphy->sw_chnl_stage = 0;
786 rtlphy->sw_chnl_step = 0; 782 rtlphy->sw_chnl_step = 0;
787 if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { 783 if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) {
788 rtl92c_phy_sw_chnl_callback(hw); 784 rtl92c_phy_sw_chnl_callback(hw);
789 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, 785 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD,
790 ("sw_chnl_inprogress false schdule workitem\n")); 786 "sw_chnl_inprogress false schdule workitem\n");
791 rtlphy->sw_chnl_inprogress = false; 787 rtlphy->sw_chnl_inprogress = false;
792 } else { 788 } else {
793 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, 789 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD,
794 ("sw_chnl_inprogress false driver sleep or" 790 "sw_chnl_inprogress false driver sleep or unload\n");
795 " unload\n"));
796 rtlphy->sw_chnl_inprogress = false; 791 rtlphy->sw_chnl_inprogress = false;
797 } 792 }
798 return 1; 793 return 1;
@@ -807,7 +802,7 @@ static bool _rtl92c_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
807 struct swchnlcmd *pcmd; 802 struct swchnlcmd *pcmd;
808 803
809 if (cmdtable == NULL) { 804 if (cmdtable == NULL) {
810 RT_ASSERT(false, ("cmdtable cannot be NULL.\n")); 805 RT_ASSERT(false, "cmdtable cannot be NULL\n");
811 return false; 806 return false;
812 } 807 }
813 808
@@ -853,7 +848,7 @@ bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
853 rfdependcmdcnt = 0; 848 rfdependcmdcnt = 0;
854 849
855 RT_ASSERT((channel >= 1 && channel <= 14), 850 RT_ASSERT((channel >= 1 && channel <= 14),
856 ("illegal channel for Zebra: %d\n", channel)); 851 "invalid channel for Zebra: %d\n", channel);
857 852
858 _rtl92c_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, 853 _rtl92c_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++,
859 MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG, 854 MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG,
@@ -916,7 +911,7 @@ bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
916 break; 911 break;
917 default: 912 default:
918 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 913 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
919 ("switch case not process\n")); 914 "switch case not processed\n");
920 break; 915 break;
921 } 916 }
922 917
@@ -1920,23 +1915,23 @@ bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
1920 bool postprocessing = false; 1915 bool postprocessing = false;
1921 1916
1922 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 1917 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
1923 ("-->IO Cmd(%#x), set_io_inprogress(%d)\n", 1918 "-->IO Cmd(%#x), set_io_inprogress(%d)\n",
1924 iotype, rtlphy->set_io_inprogress)); 1919 iotype, rtlphy->set_io_inprogress);
1925 do { 1920 do {
1926 switch (iotype) { 1921 switch (iotype) {
1927 case IO_CMD_RESUME_DM_BY_SCAN: 1922 case IO_CMD_RESUME_DM_BY_SCAN:
1928 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 1923 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
1929 ("[IO CMD] Resume DM after scan.\n")); 1924 "[IO CMD] Resume DM after scan\n");
1930 postprocessing = true; 1925 postprocessing = true;
1931 break; 1926 break;
1932 case IO_CMD_PAUSE_DM_BY_SCAN: 1927 case IO_CMD_PAUSE_DM_BY_SCAN:
1933 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 1928 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
1934 ("[IO CMD] Pause DM before scan.\n")); 1929 "[IO CMD] Pause DM before scan\n");
1935 postprocessing = true; 1930 postprocessing = true;
1936 break; 1931 break;
1937 default: 1932 default:
1938 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1933 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1939 ("switch case not process\n")); 1934 "switch case not processed\n");
1940 break; 1935 break;
1941 } 1936 }
1942 } while (false); 1937 } while (false);
@@ -1947,7 +1942,7 @@ bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
1947 return false; 1942 return false;
1948 } 1943 }
1949 rtl92c_phy_set_io(hw); 1944 rtl92c_phy_set_io(hw);
1950 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, ("<--IO Type(%#x)\n", iotype)); 1945 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<--IO Type(%#x)\n", iotype);
1951 return true; 1946 return true;
1952} 1947}
1953EXPORT_SYMBOL(rtl92c_phy_set_io_cmd); 1948EXPORT_SYMBOL(rtl92c_phy_set_io_cmd);
@@ -1958,8 +1953,8 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw)
1958 struct rtl_phy *rtlphy = &(rtlpriv->phy); 1953 struct rtl_phy *rtlphy = &(rtlpriv->phy);
1959 1954
1960 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 1955 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
1961 ("--->Cmd(%#x), set_io_inprogress(%d)\n", 1956 "--->Cmd(%#x), set_io_inprogress(%d)\n",
1962 rtlphy->current_io_type, rtlphy->set_io_inprogress)); 1957 rtlphy->current_io_type, rtlphy->set_io_inprogress);
1963 switch (rtlphy->current_io_type) { 1958 switch (rtlphy->current_io_type) {
1964 case IO_CMD_RESUME_DM_BY_SCAN: 1959 case IO_CMD_RESUME_DM_BY_SCAN:
1965 dm_digtable.cur_igvalue = rtlphy->initgain_backup.xaagccore1; 1960 dm_digtable.cur_igvalue = rtlphy->initgain_backup.xaagccore1;
@@ -1973,12 +1968,12 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw)
1973 break; 1968 break;
1974 default: 1969 default:
1975 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1970 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1976 ("switch case not process\n")); 1971 "switch case not processed\n");
1977 break; 1972 break;
1978 } 1973 }
1979 rtlphy->set_io_inprogress = false; 1974 rtlphy->set_io_inprogress = false;
1980 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 1975 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<---(%#x)\n",
1981 ("<---(%#x)\n", rtlphy->current_io_type)); 1976 rtlphy->current_io_type);
1982} 1977}
1983EXPORT_SYMBOL(rtl92c_phy_set_io); 1978EXPORT_SYMBOL(rtl92c_phy_set_io);
1984 1979
@@ -2018,7 +2013,7 @@ void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw)
2018 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); 2013 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3);
2019 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); 2014 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00);
2020 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 2015 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
2021 ("Switch RF timeout !!!.\n")); 2016 "Switch RF timeout !!!\n");
2022 return; 2017 return;
2023 } 2018 }
2024 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); 2019 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
index 9a264c0d6127..cec10d696492 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
index 9fc804d89d65..04c3aef8a4f6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c
index 2df33e53e15a..27b3af880d96 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -54,7 +54,7 @@ void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw)
54 if ((mac->link_state < MAC80211_LINKED) && 54 if ((mac->link_state < MAC80211_LINKED) &&
55 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { 55 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) {
56 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 56 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
57 ("Not connected to any\n")); 57 "Not connected to any\n");
58 58
59 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; 59 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
60 60
@@ -67,28 +67,28 @@ void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw)
67 undecorated_smoothed_pwdb = 67 undecorated_smoothed_pwdb =
68 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 68 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
69 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 69 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
70 ("AP Client PWDB = 0x%lx\n", 70 "AP Client PWDB = 0x%lx\n",
71 undecorated_smoothed_pwdb)); 71 undecorated_smoothed_pwdb);
72 } else { 72 } else {
73 undecorated_smoothed_pwdb = 73 undecorated_smoothed_pwdb =
74 rtlpriv->dm.undecorated_smoothed_pwdb; 74 rtlpriv->dm.undecorated_smoothed_pwdb;
75 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 75 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
76 ("STA Default Port PWDB = 0x%lx\n", 76 "STA Default Port PWDB = 0x%lx\n",
77 undecorated_smoothed_pwdb)); 77 undecorated_smoothed_pwdb);
78 } 78 }
79 } else { 79 } else {
80 undecorated_smoothed_pwdb = 80 undecorated_smoothed_pwdb =
81 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 81 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
82 82
83 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 83 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
84 ("AP Ext Port PWDB = 0x%lx\n", 84 "AP Ext Port PWDB = 0x%lx\n",
85 undecorated_smoothed_pwdb)); 85 undecorated_smoothed_pwdb);
86 } 86 }
87 87
88 if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { 88 if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) {
89 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; 89 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1;
90 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 90 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
91 ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n")); 91 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n");
92 } else if ((undecorated_smoothed_pwdb < 92 } else if ((undecorated_smoothed_pwdb <
93 (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && 93 (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) &&
94 (undecorated_smoothed_pwdb >= 94 (undecorated_smoothed_pwdb >=
@@ -96,18 +96,18 @@ void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw)
96 96
97 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; 97 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1;
98 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 98 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
99 ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n")); 99 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n");
100 } else if (undecorated_smoothed_pwdb < 100 } else if (undecorated_smoothed_pwdb <
101 (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { 101 (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) {
102 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; 102 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
103 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 103 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
104 ("TXHIGHPWRLEVEL_NORMAL\n")); 104 "TXHIGHPWRLEVEL_NORMAL\n");
105 } 105 }
106 106
107 if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { 107 if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) {
108 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 108 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
109 ("PHY_SetTxPowerLevel8192S() Channel = %d\n", 109 "PHY_SetTxPowerLevel8192S() Channel = %d\n",
110 rtlphy->current_channel)); 110 rtlphy->current_channel);
111 rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); 111 rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel);
112 } 112 }
113 113
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h
index 07dd9552e82f..26747fa86005 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
index a3deaefa788c..48c7b5d3fc5b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -141,7 +141,7 @@ void rtl92ce_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
141 } 141 }
142 default: 142 default:
143 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 143 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
144 ("switch case not process\n")); 144 "switch case not processed\n");
145 break; 145 break;
146 } 146 }
147} 147}
@@ -207,7 +207,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
207 u8 e_aci; 207 u8 e_aci;
208 208
209 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 209 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
210 ("HW_VAR_SLOT_TIME %x\n", val[0])); 210 "HW_VAR_SLOT_TIME %x\n", val[0]);
211 211
212 rtl_write_byte(rtlpriv, REG_SLOT, val[0]); 212 rtl_write_byte(rtlpriv, REG_SLOT, val[0]);
213 213
@@ -246,8 +246,8 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
246 *val = min_spacing_to_set; 246 *val = min_spacing_to_set;
247 247
248 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 248 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
249 ("Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", 249 "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n",
250 mac->min_space_cfg)); 250 mac->min_space_cfg);
251 251
252 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 252 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE,
253 mac->min_space_cfg); 253 mac->min_space_cfg);
@@ -261,8 +261,8 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
261 mac->min_space_cfg |= (density_to_set << 3); 261 mac->min_space_cfg |= (density_to_set << 3);
262 262
263 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 263 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
264 ("Set HW_VAR_SHORTGI_DENSITY: %#x\n", 264 "Set HW_VAR_SHORTGI_DENSITY: %#x\n",
265 mac->min_space_cfg)); 265 mac->min_space_cfg);
266 266
267 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 267 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE,
268 mac->min_space_cfg); 268 mac->min_space_cfg);
@@ -310,8 +310,8 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
310 } 310 }
311 311
312 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 312 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
313 ("Set HW_VAR_AMPDU_FACTOR: %#x\n", 313 "Set HW_VAR_AMPDU_FACTOR: %#x\n",
314 factor_toset)); 314 factor_toset);
315 } 315 }
316 break; 316 break;
317 } 317 }
@@ -348,8 +348,8 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
348 break; 348 break;
349 default: 349 default:
350 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 350 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
351 ("HW_VAR_ACM_CTRL acm set " 351 "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n",
352 "failed: eACI is %d\n", acm)); 352 acm);
353 break; 353 break;
354 } 354 }
355 } else { 355 } else {
@@ -365,14 +365,14 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
365 break; 365 break;
366 default: 366 default:
367 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 367 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
368 ("switch case not process\n")); 368 "switch case not processed\n");
369 break; 369 break;
370 } 370 }
371 } 371 }
372 372
373 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, 373 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE,
374 ("SetHwReg8190pci(): [HW_VAR_ACM_CTRL] " 374 "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n",
375 "Write 0x%X\n", acm_ctrl)); 375 acm_ctrl);
376 rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); 376 rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl);
377 break; 377 break;
378 } 378 }
@@ -507,8 +507,8 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
507 507
508 } 508 }
509 default: 509 default:
510 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("switch case " 510 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
511 "not process\n")); 511 "switch case not processed\n");
512 break; 512 break;
513 } 513 }
514} 514}
@@ -530,8 +530,8 @@ static bool _rtl92ce_llt_write(struct ieee80211_hw *hw, u32 address, u32 data)
530 530
531 if (count > POLLING_LLT_THRESHOLD) { 531 if (count > POLLING_LLT_THRESHOLD) {
532 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 532 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
533 ("Failed to polling write LLT done at " 533 "Failed to polling write LLT done at address %d!\n",
534 "address %d!\n", address)); 534 address);
535 status = false; 535 status = false;
536 break; 536 break;
537 } 537 }
@@ -669,18 +669,15 @@ static bool _rtl92ce_init_mac(struct ieee80211_hw *hw)
669 udelay(2); 669 udelay(2);
670 670
671 retry = 0; 671 retry = 0;
672 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("reg0xec:%x:%x\n", 672 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "reg0xec:%x:%x\n",
673 rtl_read_dword(rtlpriv, 0xEC), 673 rtl_read_dword(rtlpriv, 0xEC), bytetmp);
674 bytetmp));
675 674
676 while ((bytetmp & BIT(0)) && retry < 1000) { 675 while ((bytetmp & BIT(0)) && retry < 1000) {
677 retry++; 676 retry++;
678 udelay(50); 677 udelay(50);
679 bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1); 678 bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1);
680 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("reg0xec:%x:%x\n", 679 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "reg0xec:%x:%x\n",
681 rtl_read_dword(rtlpriv, 680 rtl_read_dword(rtlpriv, 0xEC), bytetmp);
682 0xEC),
683 bytetmp));
684 udelay(50); 681 udelay(50);
685 } 682 }
686 683
@@ -864,13 +861,13 @@ void rtl92ce_enable_hw_security_config(struct ieee80211_hw *hw)
864 u8 sec_reg_value; 861 u8 sec_reg_value;
865 862
866 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 863 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
867 ("PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", 864 "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
868 rtlpriv->sec.pairwise_enc_algorithm, 865 rtlpriv->sec.pairwise_enc_algorithm,
869 rtlpriv->sec.group_enc_algorithm)); 866 rtlpriv->sec.group_enc_algorithm);
870 867
871 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { 868 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
872 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("not open " 869 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
873 "hw encryption\n")); 870 "not open hw encryption\n");
874 return; 871 return;
875 } 872 }
876 873
@@ -886,7 +883,7 @@ void rtl92ce_enable_hw_security_config(struct ieee80211_hw *hw)
886 rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); 883 rtl_write_byte(rtlpriv, REG_CR + 1, 0x02);
887 884
888 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 885 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
889 ("The SECR-value %x\n", sec_reg_value)); 886 "The SECR-value %x\n", sec_reg_value);
890 887
891 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); 888 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value);
892 889
@@ -910,7 +907,7 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
910 rtlpriv->intf_ops->disable_aspm(hw); 907 rtlpriv->intf_ops->disable_aspm(hw);
911 rtstatus = _rtl92ce_init_mac(hw); 908 rtstatus = _rtl92ce_init_mac(hw);
912 if (rtstatus != true) { 909 if (rtstatus != true) {
913 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Init MAC failed\n")); 910 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n");
914 err = 1; 911 err = 1;
915 return err; 912 return err;
916 } 913 }
@@ -918,13 +915,9 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
918 err = rtl92c_download_fw(hw); 915 err = rtl92c_download_fw(hw);
919 if (err) { 916 if (err) {
920 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 917 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
921 ("Failed to download FW. Init HW " 918 "Failed to download FW. Init HW without FW now..\n");
922 "without FW now..\n"));
923 err = 1; 919 err = 1;
924 rtlhal->fw_ready = false;
925 return err; 920 return err;
926 } else {
927 rtlhal->fw_ready = true;
928 } 921 }
929 922
930 rtlhal->last_hmeboxnum = 0; 923 rtlhal->last_hmeboxnum = 0;
@@ -968,12 +961,12 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
968 tmp_u1b = efuse_read_1byte(hw, 0x1FA); 961 tmp_u1b = efuse_read_1byte(hw, 0x1FA);
969 if (!(tmp_u1b & BIT(0))) { 962 if (!(tmp_u1b & BIT(0))) {
970 rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0F, 0x05); 963 rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0F, 0x05);
971 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("PA BIAS path A\n")); 964 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "PA BIAS path A\n");
972 } 965 }
973 966
974 if (!(tmp_u1b & BIT(1)) && is92c) { 967 if (!(tmp_u1b & BIT(1)) && is92c) {
975 rtl_set_rfreg(hw, RF90_PATH_B, 0x15, 0x0F, 0x05); 968 rtl_set_rfreg(hw, RF90_PATH_B, 0x15, 0x0F, 0x05);
976 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("PA BIAS path B\n")); 969 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "PA BIAS path B\n");
977 } 970 }
978 971
979 if (!(tmp_u1b & BIT(4))) { 972 if (!(tmp_u1b & BIT(4))) {
@@ -982,7 +975,7 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
982 rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x80); 975 rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x80);
983 udelay(10); 976 udelay(10);
984 rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x90); 977 rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x90);
985 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("under 1.5V\n")); 978 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "under 1.5V\n");
986 } 979 }
987 rtl92c_dm_init(hw); 980 rtl92c_dm_init(hw);
988 rtlpci->being_init_adapter = false; 981 rtlpci->being_init_adapter = false;
@@ -995,6 +988,7 @@ static enum version_8192c _rtl92ce_read_chip_version(struct ieee80211_hw *hw)
995 struct rtl_phy *rtlphy = &(rtlpriv->phy); 988 struct rtl_phy *rtlphy = &(rtlpriv->phy);
996 enum version_8192c version = VERSION_UNKNOWN; 989 enum version_8192c version = VERSION_UNKNOWN;
997 u32 value32; 990 u32 value32;
991 const char *versionid;
998 992
999 value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG); 993 value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG);
1000 if (value32 & TRP_VAUX_EN) { 994 if (value32 & TRP_VAUX_EN) {
@@ -1007,27 +1001,25 @@ static enum version_8192c _rtl92ce_read_chip_version(struct ieee80211_hw *hw)
1007 1001
1008 switch (version) { 1002 switch (version) {
1009 case VERSION_B_CHIP_92C: 1003 case VERSION_B_CHIP_92C:
1010 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1004 versionid = "B_CHIP_92C";
1011 ("Chip Version ID: VERSION_B_CHIP_92C.\n"));
1012 break; 1005 break;
1013 case VERSION_B_CHIP_88C: 1006 case VERSION_B_CHIP_88C:
1014 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1007 versionid = "B_CHIP_88C";
1015 ("Chip Version ID: VERSION_B_CHIP_88C.\n"));
1016 break; 1008 break;
1017 case VERSION_A_CHIP_92C: 1009 case VERSION_A_CHIP_92C:
1018 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1010 versionid = "A_CHIP_92C";
1019 ("Chip Version ID: VERSION_A_CHIP_92C.\n"));
1020 break; 1011 break;
1021 case VERSION_A_CHIP_88C: 1012 case VERSION_A_CHIP_88C:
1022 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1013 versionid = "A_CHIP_88C";
1023 ("Chip Version ID: VERSION_A_CHIP_88C.\n"));
1024 break; 1014 break;
1025 default: 1015 default:
1026 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1016 versionid = "Unknown. Bug?";
1027 ("Chip Version ID: Unknown. Bug?\n"));
1028 break; 1017 break;
1029 } 1018 }
1030 1019
1020 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1021 "Chip Version ID: %s\n", versionid);
1022
1031 switch (version & 0x3) { 1023 switch (version & 0x3) {
1032 case CHIP_88C: 1024 case CHIP_88C:
1033 rtlphy->rf_type = RF_1T1R; 1025 rtlphy->rf_type = RF_1T1R;
@@ -1041,13 +1033,12 @@ static enum version_8192c _rtl92ce_read_chip_version(struct ieee80211_hw *hw)
1041 default: 1033 default:
1042 rtlphy->rf_type = RF_1T1R; 1034 rtlphy->rf_type = RF_1T1R;
1043 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1035 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1044 ("ERROR RF_Type is set!!")); 1036 "ERROR RF_Type is set!!\n");
1045 break; 1037 break;
1046 } 1038 }
1047 1039
1048 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1040 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Chip RF Type: %s\n",
1049 ("Chip RF Type: %s\n", (rtlphy->rf_type == RF_2T2R) ? 1041 rtlphy->rf_type == RF_2T2R ? "RF_2T2R" : "RF_1T1R");
1050 "RF_2T2R" : "RF_1T1R"));
1051 1042
1052 return version; 1043 return version;
1053} 1044}
@@ -1069,8 +1060,8 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw,
1069 _rtl92ce_disable_bcn_sub_func(hw); 1060 _rtl92ce_disable_bcn_sub_func(hw);
1070 } else { 1061 } else {
1071 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1062 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1072 ("Set HW_VAR_MEDIA_STATUS: " 1063 "Set HW_VAR_MEDIA_STATUS: No such media status(%x)\n",
1073 "No such media status(%x).\n", type)); 1064 type);
1074 } 1065 }
1075 1066
1076 switch (type) { 1067 switch (type) {
@@ -1078,27 +1069,27 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw,
1078 bt_msr |= MSR_NOLINK; 1069 bt_msr |= MSR_NOLINK;
1079 ledaction = LED_CTL_LINK; 1070 ledaction = LED_CTL_LINK;
1080 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1071 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1081 ("Set Network type to NO LINK!\n")); 1072 "Set Network type to NO LINK!\n");
1082 break; 1073 break;
1083 case NL80211_IFTYPE_ADHOC: 1074 case NL80211_IFTYPE_ADHOC:
1084 bt_msr |= MSR_ADHOC; 1075 bt_msr |= MSR_ADHOC;
1085 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1076 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1086 ("Set Network type to Ad Hoc!\n")); 1077 "Set Network type to Ad Hoc!\n");
1087 break; 1078 break;
1088 case NL80211_IFTYPE_STATION: 1079 case NL80211_IFTYPE_STATION:
1089 bt_msr |= MSR_INFRA; 1080 bt_msr |= MSR_INFRA;
1090 ledaction = LED_CTL_LINK; 1081 ledaction = LED_CTL_LINK;
1091 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1082 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1092 ("Set Network type to STA!\n")); 1083 "Set Network type to STA!\n");
1093 break; 1084 break;
1094 case NL80211_IFTYPE_AP: 1085 case NL80211_IFTYPE_AP:
1095 bt_msr |= MSR_AP; 1086 bt_msr |= MSR_AP;
1096 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1087 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1097 ("Set Network type to AP!\n")); 1088 "Set Network type to AP!\n");
1098 break; 1089 break;
1099 default: 1090 default:
1100 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1091 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1101 ("Network type %d not support!\n", type)); 1092 "Network type %d not supported!\n", type);
1102 return 1; 1093 return 1;
1103 break; 1094 break;
1104 1095
@@ -1171,7 +1162,7 @@ void rtl92ce_set_qos(struct ieee80211_hw *hw, int aci)
1171 rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222); 1162 rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222);
1172 break; 1163 break;
1173 default: 1164 default:
1174 RT_ASSERT(false, ("invalid aci: %d !\n", aci)); 1165 RT_ASSERT(false, "invalid aci: %d !\n", aci);
1175 break; 1166 break;
1176 } 1167 }
1177} 1168}
@@ -1199,7 +1190,6 @@ static void _rtl92ce_poweroff_adapter(struct ieee80211_hw *hw)
1199{ 1190{
1200 struct rtl_priv *rtlpriv = rtl_priv(hw); 1191 struct rtl_priv *rtlpriv = rtl_priv(hw);
1201 struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); 1192 struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw);
1202 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1203 u8 u1b_tmp; 1193 u8 u1b_tmp;
1204 u32 u4b_tmp; 1194 u32 u4b_tmp;
1205 1195
@@ -1210,7 +1200,7 @@ static void _rtl92ce_poweroff_adapter(struct ieee80211_hw *hw)
1210 rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); 1200 rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40);
1211 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); 1201 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2);
1212 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE0); 1202 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE0);
1213 if ((rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) && rtlhal->fw_ready) 1203 if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7))
1214 rtl92c_firmware_selfreset(hw); 1204 rtl92c_firmware_selfreset(hw);
1215 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, 0x51); 1205 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, 0x51);
1216 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); 1206 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00);
@@ -1300,7 +1290,7 @@ void rtl92ce_set_beacon_interval(struct ieee80211_hw *hw)
1300 u16 bcn_interval = mac->beacon_interval; 1290 u16 bcn_interval = mac->beacon_interval;
1301 1291
1302 RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, 1292 RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG,
1303 ("beacon_interval:%d\n", bcn_interval)); 1293 "beacon_interval:%d\n", bcn_interval);
1304 rtl92ce_disable_interrupt(hw); 1294 rtl92ce_disable_interrupt(hw);
1305 rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); 1295 rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval);
1306 rtl92ce_enable_interrupt(hw); 1296 rtl92ce_enable_interrupt(hw);
@@ -1312,8 +1302,8 @@ void rtl92ce_update_interrupt_mask(struct ieee80211_hw *hw,
1312 struct rtl_priv *rtlpriv = rtl_priv(hw); 1302 struct rtl_priv *rtlpriv = rtl_priv(hw);
1313 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1303 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
1314 1304
1315 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, 1305 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, "add_msr:%x, rm_msr:%x\n",
1316 ("add_msr:%x, rm_msr:%x\n", add_msr, rm_msr)); 1306 add_msr, rm_msr);
1317 1307
1318 if (add_msr) 1308 if (add_msr)
1319 rtlpci->irq_mask[0] |= add_msr; 1309 rtlpci->irq_mask[0] |= add_msr;
@@ -1367,25 +1357,24 @@ static void _rtl92ce_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
1367 for (rf_path = 0; rf_path < 2; rf_path++) 1357 for (rf_path = 0; rf_path < 2; rf_path++)
1368 for (i = 0; i < 3; i++) 1358 for (i = 0; i < 3; i++)
1369 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 1359 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
1370 ("RF(%d) EEPROM CCK Area(%d) = 0x%x\n", rf_path, 1360 "RF(%d) EEPROM CCK Area(%d) = 0x%x\n",
1371 i, 1361 rf_path, i,
1372 rtlefuse-> 1362 rtlefuse->
1373 eeprom_chnlarea_txpwr_cck[rf_path][i])); 1363 eeprom_chnlarea_txpwr_cck[rf_path][i]);
1374 for (rf_path = 0; rf_path < 2; rf_path++) 1364 for (rf_path = 0; rf_path < 2; rf_path++)
1375 for (i = 0; i < 3; i++) 1365 for (i = 0; i < 3; i++)
1376 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 1366 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
1377 ("RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n", 1367 "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n",
1378 rf_path, i, 1368 rf_path, i,
1379 rtlefuse-> 1369 rtlefuse->
1380 eeprom_chnlarea_txpwr_ht40_1s[rf_path][i])); 1370 eeprom_chnlarea_txpwr_ht40_1s[rf_path][i]);
1381 for (rf_path = 0; rf_path < 2; rf_path++) 1371 for (rf_path = 0; rf_path < 2; rf_path++)
1382 for (i = 0; i < 3; i++) 1372 for (i = 0; i < 3; i++)
1383 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 1373 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
1384 ("RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n", 1374 "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n",
1385 rf_path, i, 1375 rf_path, i,
1386 rtlefuse-> 1376 rtlefuse->
1387 eeprom_chnlarea_txpwr_ht40_2sdiif[rf_path] 1377 eeprom_chnlarea_txpwr_ht40_2sdiif[rf_path][i]);
1388 [i]));
1389 1378
1390 for (rf_path = 0; rf_path < 2; rf_path++) { 1379 for (rf_path = 0; rf_path < 2; rf_path++) {
1391 for (i = 0; i < 14; i++) { 1380 for (i = 0; i < 14; i++) {
@@ -1416,11 +1405,11 @@ static void _rtl92ce_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
1416 1405
1417 for (i = 0; i < 14; i++) { 1406 for (i = 0; i < 14; i++) {
1418 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1407 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1419 ("RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = " 1408 "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n",
1420 "[0x%x / 0x%x / 0x%x]\n", rf_path, i, 1409 rf_path, i,
1421 rtlefuse->txpwrlevel_cck[rf_path][i], 1410 rtlefuse->txpwrlevel_cck[rf_path][i],
1422 rtlefuse->txpwrlevel_ht40_1s[rf_path][i], 1411 rtlefuse->txpwrlevel_ht40_1s[rf_path][i],
1423 rtlefuse->txpwrlevel_ht40_2s[rf_path][i])); 1412 rtlefuse->txpwrlevel_ht40_2s[rf_path][i]);
1424 } 1413 }
1425 } 1414 }
1426 1415
@@ -1457,13 +1446,13 @@ static void _rtl92ce_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
1457 } 1446 }
1458 1447
1459 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1448 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1460 ("RF-%d pwrgroup_ht20[%d] = 0x%x\n", 1449 "RF-%d pwrgroup_ht20[%d] = 0x%x\n",
1461 rf_path, i, 1450 rf_path, i,
1462 rtlefuse->pwrgroup_ht20[rf_path][i])); 1451 rtlefuse->pwrgroup_ht20[rf_path][i]);
1463 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1452 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1464 ("RF-%d pwrgroup_ht40[%d] = 0x%x\n", 1453 "RF-%d pwrgroup_ht40[%d] = 0x%x\n",
1465 rf_path, i, 1454 rf_path, i,
1466 rtlefuse->pwrgroup_ht40[rf_path][i])); 1455 rtlefuse->pwrgroup_ht40[rf_path][i]);
1467 } 1456 }
1468 } 1457 }
1469 1458
@@ -1502,27 +1491,27 @@ static void _rtl92ce_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
1502 1491
1503 for (i = 0; i < 14; i++) 1492 for (i = 0; i < 14; i++)
1504 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1493 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1505 ("RF-A Ht20 to HT40 Diff[%d] = 0x%x\n", i, 1494 "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n",
1506 rtlefuse->txpwr_ht20diff[RF90_PATH_A][i])); 1495 i, rtlefuse->txpwr_ht20diff[RF90_PATH_A][i]);
1507 for (i = 0; i < 14; i++) 1496 for (i = 0; i < 14; i++)
1508 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1497 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1509 ("RF-A Legacy to Ht40 Diff[%d] = 0x%x\n", i, 1498 "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n",
1510 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i])); 1499 i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i]);
1511 for (i = 0; i < 14; i++) 1500 for (i = 0; i < 14; i++)
1512 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1501 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1513 ("RF-B Ht20 to HT40 Diff[%d] = 0x%x\n", i, 1502 "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n",
1514 rtlefuse->txpwr_ht20diff[RF90_PATH_B][i])); 1503 i, rtlefuse->txpwr_ht20diff[RF90_PATH_B][i]);
1515 for (i = 0; i < 14; i++) 1504 for (i = 0; i < 14; i++)
1516 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1505 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1517 ("RF-B Legacy to HT40 Diff[%d] = 0x%x\n", i, 1506 "RF-B Legacy to HT40 Diff[%d] = 0x%x\n",
1518 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i])); 1507 i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i]);
1519 1508
1520 if (!autoload_fail) 1509 if (!autoload_fail)
1521 rtlefuse->eeprom_regulatory = (hwinfo[RF_OPTION1] & 0x7); 1510 rtlefuse->eeprom_regulatory = (hwinfo[RF_OPTION1] & 0x7);
1522 else 1511 else
1523 rtlefuse->eeprom_regulatory = 0; 1512 rtlefuse->eeprom_regulatory = 0;
1524 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1513 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1525 ("eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory)); 1514 "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory);
1526 1515
1527 if (!autoload_fail) { 1516 if (!autoload_fail) {
1528 rtlefuse->eeprom_tssi[RF90_PATH_A] = hwinfo[EEPROM_TSSI_A]; 1517 rtlefuse->eeprom_tssi[RF90_PATH_A] = hwinfo[EEPROM_TSSI_A];
@@ -1531,10 +1520,9 @@ static void _rtl92ce_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
1531 rtlefuse->eeprom_tssi[RF90_PATH_A] = EEPROM_DEFAULT_TSSI; 1520 rtlefuse->eeprom_tssi[RF90_PATH_A] = EEPROM_DEFAULT_TSSI;
1532 rtlefuse->eeprom_tssi[RF90_PATH_B] = EEPROM_DEFAULT_TSSI; 1521 rtlefuse->eeprom_tssi[RF90_PATH_B] = EEPROM_DEFAULT_TSSI;
1533 } 1522 }
1534 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1523 RTPRINT(rtlpriv, FINIT, INIT_TxPower, "TSSI_A = 0x%x, TSSI_B = 0x%x\n",
1535 ("TSSI_A = 0x%x, TSSI_B = 0x%x\n", 1524 rtlefuse->eeprom_tssi[RF90_PATH_A],
1536 rtlefuse->eeprom_tssi[RF90_PATH_A], 1525 rtlefuse->eeprom_tssi[RF90_PATH_B]);
1537 rtlefuse->eeprom_tssi[RF90_PATH_B]));
1538 1526
1539 if (!autoload_fail) 1527 if (!autoload_fail)
1540 tempval = hwinfo[EEPROM_THERMAL_METER]; 1528 tempval = hwinfo[EEPROM_THERMAL_METER];
@@ -1547,7 +1535,7 @@ static void _rtl92ce_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
1547 1535
1548 rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; 1536 rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter;
1549 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1537 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1550 ("thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter)); 1538 "thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter);
1551} 1539}
1552 1540
1553static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) 1541static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw)
@@ -1567,19 +1555,19 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw)
1567 HWSET_MAX_SIZE); 1555 HWSET_MAX_SIZE);
1568 } else if (rtlefuse->epromtype == EEPROM_93C46) { 1556 } else if (rtlefuse->epromtype == EEPROM_93C46) {
1569 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1557 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1570 ("RTL819X Not boot from eeprom, check it !!")); 1558 "RTL819X Not boot from eeprom, check it !!");
1571 } 1559 }
1572 1560
1573 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP\n"), 1561 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP",
1574 hwinfo, HWSET_MAX_SIZE); 1562 hwinfo, HWSET_MAX_SIZE);
1575 1563
1576 eeprom_id = *((u16 *)&hwinfo[0]); 1564 eeprom_id = *((u16 *)&hwinfo[0]);
1577 if (eeprom_id != RTL8190_EEPROM_ID) { 1565 if (eeprom_id != RTL8190_EEPROM_ID) {
1578 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1566 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1579 ("EEPROM ID(%#x) is invalid!!\n", eeprom_id)); 1567 "EEPROM ID(%#x) is invalid!!\n", eeprom_id);
1580 rtlefuse->autoload_failflag = true; 1568 rtlefuse->autoload_failflag = true;
1581 } else { 1569 } else {
1582 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); 1570 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
1583 rtlefuse->autoload_failflag = false; 1571 rtlefuse->autoload_failflag = false;
1584 } 1572 }
1585 1573
@@ -1591,8 +1579,7 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw)
1591 *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; 1579 *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue;
1592 } 1580 }
1593 1581
1594 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1582 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr);
1595 ("%pM\n", rtlefuse->dev_addr));
1596 1583
1597 _rtl92ce_read_txpower_info_from_hwpg(hw, 1584 _rtl92ce_read_txpower_info_from_hwpg(hw,
1598 rtlefuse->autoload_failflag, 1585 rtlefuse->autoload_failflag,
@@ -1608,7 +1595,7 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw)
1608 rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID]; 1595 rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID];
1609 1596
1610 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1597 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1611 ("EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid)); 1598 "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
1612 1599
1613 /* set channel paln to world wide 13 */ 1600 /* set channel paln to world wide 13 */
1614 rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; 1601 rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13;
@@ -1662,7 +1649,7 @@ static void _rtl92ce_hal_customized_behavior(struct ieee80211_hw *hw)
1662 break; 1649 break;
1663 } 1650 }
1664 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1651 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1665 ("RT Customized ID: 0x%02X\n", rtlhal->oem_id)); 1652 "RT Customized ID: 0x%02X\n", rtlhal->oem_id);
1666} 1653}
1667 1654
1668void rtl92ce_read_eeprom_info(struct ieee80211_hw *hw) 1655void rtl92ce_read_eeprom_info(struct ieee80211_hw *hw)
@@ -1679,22 +1666,22 @@ void rtl92ce_read_eeprom_info(struct ieee80211_hw *hw)
1679 else 1666 else
1680 rtlpriv->dm.rfpath_rxenable[0] = 1667 rtlpriv->dm.rfpath_rxenable[0] =
1681 rtlpriv->dm.rfpath_rxenable[1] = true; 1668 rtlpriv->dm.rfpath_rxenable[1] = true;
1682 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("VersionID = 0x%4x\n", 1669 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "VersionID = 0x%4x\n",
1683 rtlhal->version)); 1670 rtlhal->version);
1684 tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); 1671 tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR);
1685 if (tmp_u1b & BIT(4)) { 1672 if (tmp_u1b & BIT(4)) {
1686 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from EEPROM\n")); 1673 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EEPROM\n");
1687 rtlefuse->epromtype = EEPROM_93C46; 1674 rtlefuse->epromtype = EEPROM_93C46;
1688 } else { 1675 } else {
1689 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from EFUSE\n")); 1676 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EFUSE\n");
1690 rtlefuse->epromtype = EEPROM_BOOT_EFUSE; 1677 rtlefuse->epromtype = EEPROM_BOOT_EFUSE;
1691 } 1678 }
1692 if (tmp_u1b & BIT(5)) { 1679 if (tmp_u1b & BIT(5)) {
1693 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); 1680 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
1694 rtlefuse->autoload_failflag = false; 1681 rtlefuse->autoload_failflag = false;
1695 _rtl92ce_read_adapter_info(hw); 1682 _rtl92ce_read_adapter_info(hw);
1696 } else { 1683 } else {
1697 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Autoload ERR!!\n")); 1684 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Autoload ERR!!\n");
1698 } 1685 }
1699 _rtl92ce_hal_customized_behavior(hw); 1686 _rtl92ce_hal_customized_behavior(hw);
1700} 1687}
@@ -1790,8 +1777,8 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw,
1790 1777
1791 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); 1778 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value);
1792 1779
1793 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, 1780 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n",
1794 ("%x\n", rtl_read_dword(rtlpriv, REG_ARFR0))); 1781 rtl_read_dword(rtlpriv, REG_ARFR0));
1795} 1782}
1796 1783
1797static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw, 1784static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
@@ -1919,16 +1906,15 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
1919 break; 1906 break;
1920 } 1907 }
1921 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, 1908 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
1922 ("ratr_bitmap :%x\n", ratr_bitmap)); 1909 "ratr_bitmap :%x\n", ratr_bitmap);
1923 *(u32 *)&rate_mask = EF4BYTE((ratr_bitmap & 0x0fffffff) | 1910 *(u32 *)&rate_mask = EF4BYTE((ratr_bitmap & 0x0fffffff) |
1924 (ratr_index << 28)); 1911 (ratr_index << 28));
1925 rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; 1912 rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80;
1926 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, ("Rate_index:%x, " 1913 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
1927 "ratr_val:%x, %x:%x:%x:%x:%x\n", 1914 "Rate_index:%x, ratr_val:%x, %x:%x:%x:%x:%x\n",
1928 ratr_index, ratr_bitmap, 1915 ratr_index, ratr_bitmap,
1929 rate_mask[0], rate_mask[1], 1916 rate_mask[0], rate_mask[1], rate_mask[2], rate_mask[3],
1930 rate_mask[2], rate_mask[3], 1917 rate_mask[4]);
1931 rate_mask[4]));
1932 rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); 1918 rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask);
1933 1919
1934 if (macid != 0) 1920 if (macid != 0)
@@ -1994,7 +1980,7 @@ bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
1994 1980
1995 if ((ppsc->hwradiooff) && (e_rfpowerstate_toset == ERFON)) { 1981 if ((ppsc->hwradiooff) && (e_rfpowerstate_toset == ERFON)) {
1996 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 1982 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
1997 ("GPIOChangeRF - HW Radio ON, RF ON\n")); 1983 "GPIOChangeRF - HW Radio ON, RF ON\n");
1998 1984
1999 e_rfpowerstate_toset = ERFON; 1985 e_rfpowerstate_toset = ERFON;
2000 ppsc->hwradiooff = false; 1986 ppsc->hwradiooff = false;
@@ -2002,7 +1988,7 @@ bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
2002 } else if ((ppsc->hwradiooff == false) 1988 } else if ((ppsc->hwradiooff == false)
2003 && (e_rfpowerstate_toset == ERFOFF)) { 1989 && (e_rfpowerstate_toset == ERFOFF)) {
2004 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 1990 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
2005 ("GPIOChangeRF - HW Radio OFF, RF OFF\n")); 1991 "GPIOChangeRF - HW Radio OFF, RF OFF\n");
2006 1992
2007 e_rfpowerstate_toset = ERFOFF; 1993 e_rfpowerstate_toset = ERFOFF;
2008 ppsc->hwradiooff = true; 1994 ppsc->hwradiooff = true;
@@ -2053,7 +2039,7 @@ void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index,
2053 u8 cam_offset = 0; 2039 u8 cam_offset = 0;
2054 u8 clear_number = 5; 2040 u8 clear_number = 5;
2055 2041
2056 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("clear_all\n")); 2042 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n");
2057 2043
2058 for (idx = 0; idx < clear_number; idx++) { 2044 for (idx = 0; idx < clear_number; idx++) {
2059 rtl_cam_mark_invalid(hw, cam_offset + idx); 2045 rtl_cam_mark_invalid(hw, cam_offset + idx);
@@ -2081,8 +2067,8 @@ void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index,
2081 enc_algo = CAM_AES; 2067 enc_algo = CAM_AES;
2082 break; 2068 break;
2083 default: 2069 default:
2084 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("switch case " 2070 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
2085 "not process\n")); 2071 "switch case not processed\n");
2086 enc_algo = CAM_TKIP; 2072 enc_algo = CAM_TKIP;
2087 break; 2073 break;
2088 } 2074 }
@@ -2100,9 +2086,8 @@ void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index,
2100 p_macaddr); 2086 p_macaddr);
2101 if (entry_id >= TOTAL_CAM_ENTRY) { 2087 if (entry_id >= TOTAL_CAM_ENTRY) {
2102 RT_TRACE(rtlpriv, COMP_SEC, 2088 RT_TRACE(rtlpriv, COMP_SEC,
2103 DBG_EMERG, 2089 DBG_EMERG,
2104 ("Can not find free hw" 2090 "Can not find free hw security cam entry\n");
2105 " security cam entry\n"));
2106 return; 2091 return;
2107 } 2092 }
2108 } else { 2093 } else {
@@ -2116,31 +2101,31 @@ void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index,
2116 2101
2117 if (rtlpriv->sec.key_len[key_index] == 0) { 2102 if (rtlpriv->sec.key_len[key_index] == 0) {
2118 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2103 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2119 ("delete one entry, entry_id is %d\n", 2104 "delete one entry, entry_id is %d\n",
2120 entry_id)); 2105 entry_id);
2121 if (mac->opmode == NL80211_IFTYPE_AP) 2106 if (mac->opmode == NL80211_IFTYPE_AP)
2122 rtl_cam_del_entry(hw, p_macaddr); 2107 rtl_cam_del_entry(hw, p_macaddr);
2123 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); 2108 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id);
2124 } else { 2109 } else {
2125 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 2110 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
2126 ("The insert KEY length is %d\n", 2111 "The insert KEY length is %d\n",
2127 rtlpriv->sec.key_len[PAIRWISE_KEYIDX])); 2112 rtlpriv->sec.key_len[PAIRWISE_KEYIDX]);
2128 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 2113 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
2129 ("The insert KEY is %x %x\n", 2114 "The insert KEY is %x %x\n",
2130 rtlpriv->sec.key_buf[0][0], 2115 rtlpriv->sec.key_buf[0][0],
2131 rtlpriv->sec.key_buf[0][1])); 2116 rtlpriv->sec.key_buf[0][1]);
2132 2117
2133 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2118 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2134 ("add one entry\n")); 2119 "add one entry\n");
2135 if (is_pairwise) { 2120 if (is_pairwise) {
2136 RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD, 2121 RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD,
2137 "Pairwiase Key content :", 2122 "Pairwise Key content",
2138 rtlpriv->sec.pairwise_key, 2123 rtlpriv->sec.pairwise_key,
2139 rtlpriv->sec. 2124 rtlpriv->sec.
2140 key_len[PAIRWISE_KEYIDX]); 2125 key_len[PAIRWISE_KEYIDX]);
2141 2126
2142 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2127 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2143 ("set Pairwiase key\n")); 2128 "set Pairwise key\n");
2144 2129
2145 rtl_cam_add_one_entry(hw, macaddr, key_index, 2130 rtl_cam_add_one_entry(hw, macaddr, key_index,
2146 entry_id, enc_algo, 2131 entry_id, enc_algo,
@@ -2149,7 +2134,7 @@ void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index,
2149 key_buf[key_index]); 2134 key_buf[key_index]);
2150 } else { 2135 } else {
2151 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2136 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2152 ("set group key\n")); 2137 "set group key\n");
2153 2138
2154 if (mac->opmode == NL80211_IFTYPE_ADHOC) { 2139 if (mac->opmode == NL80211_IFTYPE_ADHOC) {
2155 rtl_cam_add_one_entry(hw, 2140 rtl_cam_add_one_entry(hw,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
index 07dbe3e340a5..52a3aea9b3de 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/led.c b/drivers/net/wireless/rtlwifi/rtl8192ce/led.c
index 28a1a707d09c..8283e9b27639 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/led.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/led.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -45,8 +45,8 @@ void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
45 u8 ledcfg; 45 u8 ledcfg;
46 struct rtl_priv *rtlpriv = rtl_priv(hw); 46 struct rtl_priv *rtlpriv = rtl_priv(hw);
47 47
48 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, 48 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
49 ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); 49 REG_LEDCFG2, pled->ledpin);
50 50
51 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); 51 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
52 52
@@ -62,7 +62,7 @@ void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
62 break; 62 break;
63 default: 63 default:
64 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 64 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
65 ("switch case not process\n")); 65 "switch case not processed\n");
66 break; 66 break;
67 } 67 }
68 pled->ledon = true; 68 pled->ledon = true;
@@ -74,8 +74,8 @@ void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
74 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); 74 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
75 u8 ledcfg; 75 u8 ledcfg;
76 76
77 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, 77 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
78 ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); 78 REG_LEDCFG2, pled->ledpin);
79 79
80 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); 80 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
81 81
@@ -97,7 +97,7 @@ void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
97 break; 97 break;
98 default: 98 default:
99 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 99 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
100 ("switch case not process\n")); 100 "switch case not processed\n");
101 break; 101 break;
102 } 102 }
103 pled->ledon = false; 103 pled->ledon = false;
@@ -145,7 +145,7 @@ void rtl92ce_led_control(struct ieee80211_hw *hw,
145 ledaction == LED_CTL_POWER_ON)) { 145 ledaction == LED_CTL_POWER_ON)) {
146 return; 146 return;
147 } 147 }
148 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, ("ledaction %d.\n", 148 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d\n",
149 ledaction)); 149 ledaction);
150 _rtl92ce_sw_led_control(hw, ledaction); 150 _rtl92ce_sw_led_control(hw, ledaction);
151} 151}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/led.h b/drivers/net/wireless/rtlwifi/rtl8192ce/led.h
index 7dfccea2095b..c5761066d383 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/led.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/led.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
index 3b585aadabfc..c64daf25566a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -47,9 +47,9 @@ u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
47 u32 original_value, readback_value, bitshift; 47 u32 original_value, readback_value, bitshift;
48 struct rtl_phy *rtlphy = &(rtlpriv->phy); 48 struct rtl_phy *rtlphy = &(rtlpriv->phy);
49 49
50 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 50 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
51 "rfpath(%#x), bitmask(%#x)\n", 51 "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
52 regaddr, rfpath, bitmask)); 52 regaddr, rfpath, bitmask);
53 53
54 spin_lock(&rtlpriv->locks.rf_lock); 54 spin_lock(&rtlpriv->locks.rf_lock);
55 55
@@ -67,9 +67,8 @@ u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
67 spin_unlock(&rtlpriv->locks.rf_lock); 67 spin_unlock(&rtlpriv->locks.rf_lock);
68 68
69 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 69 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
70 ("regaddr(%#x), rfpath(%#x), " 70 "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
71 "bitmask(%#x), original_value(%#x)\n", 71 regaddr, rfpath, bitmask, original_value);
72 regaddr, rfpath, bitmask, original_value));
73 72
74 return readback_value; 73 return readback_value;
75} 74}
@@ -121,8 +120,8 @@ void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
121 u32 original_value, bitshift; 120 u32 original_value, bitshift;
122 121
123 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 122 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
124 ("regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", 123 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
125 regaddr, bitmask, data, rfpath)); 124 regaddr, bitmask, data, rfpath);
126 125
127 spin_lock(&rtlpriv->locks.rf_lock); 126 spin_lock(&rtlpriv->locks.rf_lock);
128 127
@@ -153,10 +152,9 @@ void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
153 152
154 spin_unlock(&rtlpriv->locks.rf_lock); 153 spin_unlock(&rtlpriv->locks.rf_lock);
155 154
156 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 155 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
157 "bitmask(%#x), data(%#x), " 156 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
158 "rfpath(%#x)\n", regaddr, 157 regaddr, bitmask, data, rfpath);
159 bitmask, data, rfpath));
160} 158}
161 159
162static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw) 160static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
@@ -166,11 +164,10 @@ static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
166 u32 arraylength; 164 u32 arraylength;
167 u32 *ptrarray; 165 u32 *ptrarray;
168 166
169 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Read Rtl819XMACPHY_Array\n")); 167 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n");
170 arraylength = MAC_2T_ARRAYLENGTH; 168 arraylength = MAC_2T_ARRAYLENGTH;
171 ptrarray = RTL8192CEMAC_2T_ARRAY; 169 ptrarray = RTL8192CEMAC_2T_ARRAY;
172 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 170 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CEMAC_2T_ARRAY\n");
173 ("Img:RTL8192CEMAC_2T_ARRAY\n"));
174 for (i = 0; i < arraylength; i = i + 2) 171 for (i = 0; i < arraylength; i = i + 2)
175 rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); 172 rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]);
176 return true; 173 return true;
@@ -215,10 +212,9 @@ bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
215 phy_regarray_table[i + 1]); 212 phy_regarray_table[i + 1]);
216 udelay(1); 213 udelay(1);
217 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 214 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
218 ("The phy_regarray_table[0] is %x" 215 "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
219 " Rtl819XPHY_REGArray[1] is %x\n", 216 phy_regarray_table[i],
220 phy_regarray_table[i], 217 phy_regarray_table[i + 1]);
221 phy_regarray_table[i + 1]));
222 } 218 }
223 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { 219 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) {
224 for (i = 0; i < agctab_arraylen; i = i + 2) { 220 for (i = 0; i < agctab_arraylen; i = i + 2) {
@@ -226,10 +222,9 @@ bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
226 agctab_array_table[i + 1]); 222 agctab_array_table[i + 1]);
227 udelay(1); 223 udelay(1);
228 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 224 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
229 ("The agctab_array_table[0] is " 225 "The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
230 "%x Rtl819XPHY_REGArray[1] is %x\n", 226 agctab_array_table[i],
231 agctab_array_table[i], 227 agctab_array_table[i + 1]);
232 agctab_array_table[i + 1]));
233 } 228 }
234 } 229 }
235 return true; 230 return true;
@@ -269,7 +264,7 @@ bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
269 } else { 264 } else {
270 265
271 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 266 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
272 ("configtype != BaseBand_Config_PHY_REG\n")); 267 "configtype != BaseBand_Config_PHY_REG\n");
273 } 268 }
274 return true; 269 return true;
275} 270}
@@ -291,20 +286,20 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
291 radiob_arraylen = RADIOB_2TARRAYLENGTH; 286 radiob_arraylen = RADIOB_2TARRAYLENGTH;
292 radiob_array_table = RTL8192CE_RADIOB_2TARRAY; 287 radiob_array_table = RTL8192CE_RADIOB_2TARRAY;
293 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 288 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
294 ("Radio_A:RTL8192CERADIOA_2TARRAY\n")); 289 "Radio_A:RTL8192CERADIOA_2TARRAY\n");
295 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 290 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
296 ("Radio_B:RTL8192CE_RADIOB_2TARRAY\n")); 291 "Radio_B:RTL8192CE_RADIOB_2TARRAY\n");
297 } else { 292 } else {
298 radioa_arraylen = RADIOA_1TARRAYLENGTH; 293 radioa_arraylen = RADIOA_1TARRAYLENGTH;
299 radioa_array_table = RTL8192CE_RADIOA_1TARRAY; 294 radioa_array_table = RTL8192CE_RADIOA_1TARRAY;
300 radiob_arraylen = RADIOB_1TARRAYLENGTH; 295 radiob_arraylen = RADIOB_1TARRAYLENGTH;
301 radiob_array_table = RTL8192CE_RADIOB_1TARRAY; 296 radiob_array_table = RTL8192CE_RADIOB_1TARRAY;
302 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 297 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
303 ("Radio_A:RTL8192CE_RADIOA_1TARRAY\n")); 298 "Radio_A:RTL8192CE_RADIOA_1TARRAY\n");
304 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 299 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
305 ("Radio_B:RTL8192CE_RADIOB_1TARRAY\n")); 300 "Radio_B:RTL8192CE_RADIOB_1TARRAY\n");
306 } 301 }
307 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Radio No %x\n", rfpath)); 302 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath);
308 switch (rfpath) { 303 switch (rfpath) {
309 case RF90_PATH_A: 304 case RF90_PATH_A:
310 for (i = 0; i < radioa_arraylen; i = i + 2) { 305 for (i = 0; i < radioa_arraylen; i = i + 2) {
@@ -352,11 +347,11 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
352 break; 347 break;
353 case RF90_PATH_C: 348 case RF90_PATH_C:
354 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 349 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
355 ("switch case not process\n")); 350 "switch case not processed\n");
356 break; 351 break;
357 case RF90_PATH_D: 352 case RF90_PATH_D:
358 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 353 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
359 ("switch case not process\n")); 354 "switch case not processed\n");
360 break; 355 break;
361 } 356 }
362 return true; 357 return true;
@@ -371,10 +366,9 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
371 u8 reg_bw_opmode; 366 u8 reg_bw_opmode;
372 u8 reg_prsr_rsc; 367 u8 reg_prsr_rsc;
373 368
374 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, 369 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n",
375 ("Switch to %s bandwidth\n", 370 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
376 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? 371 "20MHz" : "40MHz");
377 "20MHz" : "40MHz"))
378 372
379 if (is_hal_stop(rtlhal)) { 373 if (is_hal_stop(rtlhal)) {
380 rtlphy->set_bwmode_inprogress = false; 374 rtlphy->set_bwmode_inprogress = false;
@@ -398,7 +392,7 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
398 break; 392 break;
399 default: 393 default:
400 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 394 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
401 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 395 "unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
402 break; 396 break;
403 } 397 }
404 398
@@ -423,12 +417,12 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
423 break; 417 break;
424 default: 418 default:
425 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 419 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
426 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 420 "unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
427 break; 421 break;
428 } 422 }
429 rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); 423 rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
430 rtlphy->set_bwmode_inprogress = false; 424 rtlphy->set_bwmode_inprogress = false;
431 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 425 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n");
432} 426}
433 427
434void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) 428void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
@@ -499,7 +493,7 @@ static void _rtl92ce_phy_set_rf_sleep(struct ieee80211_hw *hw)
499 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); 493 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3);
500 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); 494 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00);
501 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 495 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
502 ("Switch RF timeout !!!.\n")); 496 "Switch RF timeout !!!\n");
503 return; 497 return;
504 } 498 }
505 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); 499 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2);
@@ -526,7 +520,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
526 do { 520 do {
527 InitializeCount++; 521 InitializeCount++;
528 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 522 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
529 ("IPS Set eRf nic enable\n")); 523 "IPS Set eRf nic enable\n");
530 rtstatus = rtl_ps_enable_nic(hw); 524 rtstatus = rtl_ps_enable_nic(hw);
531 } while ((rtstatus != true) 525 } while ((rtstatus != true)
532 && (InitializeCount < 10)); 526 && (InitializeCount < 10));
@@ -534,10 +528,10 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
534 RT_RF_OFF_LEVL_HALT_NIC); 528 RT_RF_OFF_LEVL_HALT_NIC);
535 } else { 529 } else {
536 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 530 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
537 ("Set ERFON sleeped:%d ms\n", 531 "Set ERFON sleeped:%d ms\n",
538 jiffies_to_msecs(jiffies - 532 jiffies_to_msecs(jiffies -
539 ppsc-> 533 ppsc->
540 last_sleep_jiffies))); 534 last_sleep_jiffies));
541 ppsc->last_awake_jiffies = jiffies; 535 ppsc->last_awake_jiffies = jiffies;
542 rtl92ce_phy_set_rf_on(hw); 536 rtl92ce_phy_set_rf_on(hw);
543 } 537 }
@@ -553,7 +547,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
553 case ERFOFF:{ 547 case ERFOFF:{
554 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { 548 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) {
555 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 549 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
556 ("IPS Set eRf nic disable\n")); 550 "IPS Set eRf nic disable\n");
557 rtl_ps_disable_nic(hw); 551 rtl_ps_disable_nic(hw);
558 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); 552 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
559 } else { 553 } else {
@@ -578,35 +572,33 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
578 continue; 572 continue;
579 } else { 573 } else {
580 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 574 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
581 ("eRf Off/Sleep: %d times " 575 "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
582 "TcbBusyQueue[%d] =%d before " 576 i + 1, queue_id,
583 "doze!\n", (i + 1), queue_id, 577 skb_queue_len(&ring->queue));
584 skb_queue_len(&ring->queue)));
585 578
586 udelay(10); 579 udelay(10);
587 i++; 580 i++;
588 } 581 }
589 if (i >= MAX_DOZE_WAITING_TIMES_9x) { 582 if (i >= MAX_DOZE_WAITING_TIMES_9x) {
590 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 583 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
591 ("\n ERFSLEEP: %d times " 584 "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
592 "TcbBusyQueue[%d] = %d !\n", 585 MAX_DOZE_WAITING_TIMES_9x,
593 MAX_DOZE_WAITING_TIMES_9x, 586 queue_id,
594 queue_id, 587 skb_queue_len(&ring->queue));
595 skb_queue_len(&ring->queue)));
596 break; 588 break;
597 } 589 }
598 } 590 }
599 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 591 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
600 ("Set ERFSLEEP awaked:%d ms\n", 592 "Set ERFSLEEP awaked:%d ms\n",
601 jiffies_to_msecs(jiffies - 593 jiffies_to_msecs(jiffies -
602 ppsc->last_awake_jiffies))); 594 ppsc->last_awake_jiffies));
603 ppsc->last_sleep_jiffies = jiffies; 595 ppsc->last_sleep_jiffies = jiffies;
604 _rtl92ce_phy_set_rf_sleep(hw); 596 _rtl92ce_phy_set_rf_sleep(hw);
605 break; 597 break;
606 } 598 }
607 default: 599 default:
608 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 600 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
609 ("switch case not process\n")); 601 "switch case not processed\n");
610 bresult = false; 602 bresult = false;
611 break; 603 break;
612 } 604 }
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
index be2c92adef33..d5e3b704f930 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
index ba5ff0411f0a..43806d9d1e13 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
index d3b01e6023ba..69d720dd9c38 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -56,7 +56,7 @@ void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
56 break; 56 break;
57 default: 57 default:
58 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 58 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
59 ("unknown bandwidth: %#X\n", bandwidth)); 59 "unknown bandwidth: %#X\n", bandwidth);
60 break; 60 break;
61 } 61 }
62} 62}
@@ -123,8 +123,8 @@ void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
123 rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval); 123 rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval);
124 124
125 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 125 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
126 ("CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, 126 "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n",
127 RTXAGC_A_CCK1_MCS32)); 127 tmpval, RTXAGC_A_CCK1_MCS32);
128 128
129 tmpval = tx_agc[RF90_PATH_A] >> 8; 129 tmpval = tx_agc[RF90_PATH_A] >> 8;
130 130
@@ -133,22 +133,22 @@ void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
133 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); 133 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval);
134 134
135 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 135 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
136 ("CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, 136 "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n",
137 RTXAGC_B_CCK11_A_CCK2_11)); 137 tmpval, RTXAGC_B_CCK11_A_CCK2_11);
138 138
139 tmpval = tx_agc[RF90_PATH_B] >> 24; 139 tmpval = tx_agc[RF90_PATH_B] >> 24;
140 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval); 140 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval);
141 141
142 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 142 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
143 ("CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, 143 "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n",
144 RTXAGC_B_CCK11_A_CCK2_11)); 144 tmpval, RTXAGC_B_CCK11_A_CCK2_11);
145 145
146 tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff; 146 tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff;
147 rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval); 147 rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval);
148 148
149 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 149 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
150 ("CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, 150 "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n",
151 RTXAGC_B_CCK1_55_MCS32)); 151 tmpval, RTXAGC_B_CCK1_55_MCS32);
152} 152}
153 153
154static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw, 154static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
@@ -171,8 +171,8 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
171 (powerBase0 << 8) | powerBase0; 171 (powerBase0 << 8) | powerBase0;
172 *(ofdmbase + i) = powerBase0; 172 *(ofdmbase + i) = powerBase0;
173 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 173 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
174 (" [OFDM power base index rf(%c) = 0x%x]\n", 174 " [OFDM power base index rf(%c) = 0x%x]\n",
175 ((i == 0) ? 'A' : 'B'), *(ofdmbase + i))); 175 i == 0 ? 'A' : 'B', *(ofdmbase + i));
176 } 176 }
177 177
178 for (i = 0; i < 2; i++) { 178 for (i = 0; i < 2; i++) {
@@ -187,8 +187,8 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
187 *(mcsbase + i) = powerBase1; 187 *(mcsbase + i) = powerBase1;
188 188
189 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 189 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
190 (" [MCS power base index rf(%c) = 0x%x]\n", 190 " [MCS power base index rf(%c) = 0x%x]\n",
191 ((i == 0) ? 'A' : 'B'), *(mcsbase + i))); 191 i == 0 ? 'A' : 'B', *(mcsbase + i));
192 } 192 }
193} 193}
194 194
@@ -215,9 +215,8 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
215 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 215 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]);
216 216
217 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 217 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
218 ("RTK better performance, " 218 "RTK better performance, writeVal(%c) = 0x%x\n",
219 "writeVal(%c) = 0x%x\n", 219 rf == 0 ? 'A' : 'B', writeVal);
220 ((rf == 0) ? 'A' : 'B'), writeVal));
221 break; 220 break;
222 case 1: 221 case 1:
223 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { 222 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
@@ -225,9 +224,8 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
225 powerBase1[rf]); 224 powerBase1[rf]);
226 225
227 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 226 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
228 ("Realtek regulatory, 40MHz, " 227 "Realtek regulatory, 40MHz, writeVal(%c) = 0x%x\n",
229 "writeVal(%c) = 0x%x\n", 228 rf == 0 ? 'A' : 'B', writeVal);
230 ((rf == 0) ? 'A' : 'B'), writeVal));
231 } else { 229 } else {
232 if (rtlphy->pwrgroup_cnt == 1) 230 if (rtlphy->pwrgroup_cnt == 1)
233 chnlgroup = 0; 231 chnlgroup = 0;
@@ -249,9 +247,8 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
249 powerBase1[rf]); 247 powerBase1[rf]);
250 248
251 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 249 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
252 ("Realtek regulatory, 20MHz, " 250 "Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n",
253 "writeVal(%c) = 0x%x\n", 251 rf == 0 ? 'A' : 'B', writeVal);
254 ((rf == 0) ? 'A' : 'B'), writeVal));
255 } 252 }
256 break; 253 break;
257 case 2: 254 case 2:
@@ -259,27 +256,24 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
259 ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 256 ((index < 2) ? powerBase0[rf] : powerBase1[rf]);
260 257
261 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 258 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
262 ("Better regulatory, " 259 "Better regulatory, writeVal(%c) = 0x%x\n",
263 "writeVal(%c) = 0x%x\n", 260 rf == 0 ? 'A' : 'B', writeVal);
264 ((rf == 0) ? 'A' : 'B'), writeVal));
265 break; 261 break;
266 case 3: 262 case 3:
267 chnlgroup = 0; 263 chnlgroup = 0;
268 264
269 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { 265 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
270 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 266 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
271 ("customer's limit, 40MHz " 267 "customer's limit, 40MHz rf(%c) = 0x%x\n",
272 "rf(%c) = 0x%x\n", 268 rf == 0 ? 'A' : 'B',
273 ((rf == 0) ? 'A' : 'B'), 269 rtlefuse->pwrgroup_ht40[rf][channel -
274 rtlefuse->pwrgroup_ht40[rf][channel - 270 1]);
275 1]));
276 } else { 271 } else {
277 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 272 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
278 ("customer's limit, 20MHz " 273 "customer's limit, 20MHz rf(%c) = 0x%x\n",
279 "rf(%c) = 0x%x\n", 274 rf == 0 ? 'A' : 'B',
280 ((rf == 0) ? 'A' : 'B'), 275 rtlefuse->pwrgroup_ht20[rf][channel -
281 rtlefuse->pwrgroup_ht20[rf][channel - 276 1]);
282 1]));
283 } 277 }
284 for (i = 0; i < 4; i++) { 278 for (i = 0; i < 4; i++) {
285 pwr_diff_limit[i] = 279 pwr_diff_limit[i] =
@@ -311,15 +305,15 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
311 (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]); 305 (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]);
312 306
313 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 307 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
314 ("Customer's limit rf(%c) = 0x%x\n", 308 "Customer's limit rf(%c) = 0x%x\n",
315 ((rf == 0) ? 'A' : 'B'), customer_limit)); 309 rf == 0 ? 'A' : 'B', customer_limit);
316 310
317 writeVal = customer_limit + 311 writeVal = customer_limit +
318 ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 312 ((index < 2) ? powerBase0[rf] : powerBase1[rf]);
319 313
320 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 314 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
321 ("Customer, writeVal rf(%c)= 0x%x\n", 315 "Customer, writeVal rf(%c)= 0x%x\n",
322 ((rf == 0) ? 'A' : 'B'), writeVal)); 316 rf == 0 ? 'A' : 'B', writeVal);
323 break; 317 break;
324 default: 318 default:
325 chnlgroup = 0; 319 chnlgroup = 0;
@@ -329,9 +323,8 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
329 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 323 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]);
330 324
331 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 325 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
332 ("RTK better performance, writeVal " 326 "RTK better performance, writeVal rf(%c) = 0x%x\n",
333 "rf(%c) = 0x%x\n", 327 rf == 0 ? 'A' : 'B', writeVal);
334 ((rf == 0) ? 'A' : 'B'), writeVal));
335 break; 328 break;
336 } 329 }
337 330
@@ -383,7 +376,7 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
383 rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal); 376 rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal);
384 377
385 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 378 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
386 ("Set 0x%x = %08x\n", regoffset, writeVal)); 379 "Set 0x%x = %08x\n", regoffset, writeVal);
387 380
388 if (((get_rf_type(rtlphy) == RF_2T2R) && 381 if (((get_rf_type(rtlphy) == RF_2T2R) &&
389 (regoffset == RTXAGC_A_MCS15_MCS12 || 382 (regoffset == RTXAGC_A_MCS15_MCS12 ||
@@ -512,12 +505,12 @@ static bool _rtl92ce_phy_rf6052_config_parafile(struct ieee80211_hw *hw)
512 505
513 if (rtstatus != true) { 506 if (rtstatus != true) {
514 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 507 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
515 ("Radio[%d] Fail!!", rfpath)); 508 "Radio[%d] Fail!!\n", rfpath);
516 return false; 509 return false;
517 } 510 }
518 511
519 } 512 }
520 513
521 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("<---\n")); 514 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n");
522 return rtstatus; 515 return rtstatus;
523} 516}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
index 39ff03685986..6c8d56efceae 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
index 89ef6982ce50..2c3b73366cd2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,9 +27,6 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include <linux/vmalloc.h>
31#include <linux/module.h>
32
33#include "../wifi.h" 30#include "../wifi.h"
34#include "../core.h" 31#include "../core.h"
35#include "../pci.h" 32#include "../pci.h"
@@ -43,6 +40,8 @@
43#include "trx.h" 40#include "trx.h"
44#include "led.h" 41#include "led.h"
45 42
43#include <linux/module.h>
44
46static void rtl92c_init_aspm_vars(struct ieee80211_hw *hw) 45static void rtl92c_init_aspm_vars(struct ieee80211_hw *hw)
47{ 46{
48 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 47 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -92,9 +91,7 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw)
92 int err; 91 int err;
93 struct rtl_priv *rtlpriv = rtl_priv(hw); 92 struct rtl_priv *rtlpriv = rtl_priv(hw);
94 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 93 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
95 const struct firmware *firmware;
96 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 94 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
97 char *fw_name = NULL;
98 95
99 rtl8192ce_bt_reg_init(hw); 96 rtl8192ce_bt_reg_init(hw);
100 97
@@ -159,33 +156,27 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw)
159 rtlpriv->rtlhal.pfirmware = vzalloc(0x4000); 156 rtlpriv->rtlhal.pfirmware = vzalloc(0x4000);
160 if (!rtlpriv->rtlhal.pfirmware) { 157 if (!rtlpriv->rtlhal.pfirmware) {
161 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 158 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
162 ("Can't alloc buffer for fw.\n")); 159 "Can't alloc buffer for fw\n");
163 return 1; 160 return 1;
164 } 161 }
165 162
166 /* request fw */ 163 /* request fw */
167 if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && 164 if (IS_VENDOR_UMC_A_CUT(rtlhal->version) &&
168 !IS_92C_SERIAL(rtlhal->version)) 165 !IS_92C_SERIAL(rtlhal->version))
169 fw_name = "rtlwifi/rtl8192cfwU.bin"; 166 rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin";
170 else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) 167 else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version))
171 fw_name = "rtlwifi/rtl8192cfwU_B.bin"; 168 rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin";
172 else 169
173 fw_name = rtlpriv->cfg->fw_name; 170 rtlpriv->max_fw_size = 0x4000;
174 err = request_firmware(&firmware, fw_name, rtlpriv->io.dev); 171 pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name);
172 err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
173 rtlpriv->io.dev, GFP_KERNEL, hw,
174 rtl_fw_cb);
175 if (err) { 175 if (err) {
176 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 176 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
177 ("Failed to request firmware!\n")); 177 "Failed to request firmware!\n");
178 return 1;
179 }
180 if (firmware->size > 0x4000) {
181 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
182 ("Firmware is too big!\n"));
183 release_firmware(firmware);
184 return 1; 178 return 1;
185 } 179 }
186 memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size);
187 rtlpriv->rtlhal.fwsize = firmware->size;
188 release_firmware(firmware);
189 180
190 return 0; 181 return 0;
191} 182}
@@ -404,7 +395,7 @@ static int __init rtl92ce_module_init(void)
404 395
405 ret = pci_register_driver(&rtl92ce_driver); 396 ret = pci_register_driver(&rtl92ce_driver);
406 if (ret) 397 if (ret)
407 RT_ASSERT(false, (": No device found\n")); 398 RT_ASSERT(false, "No device found\n");
408 399
409 return ret; 400 return ret;
410} 401}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h
index b7dc3263e433..d2367a5d0cf5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/table.c b/drivers/net/wireless/rtlwifi/rtl8192ce/table.c
index ba938b91aa6f..752f943a84ae 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/table.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/table.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/table.h b/drivers/net/wireless/rtlwifi/rtl8192ce/table.h
index 3a6e8b6aeee0..8b79161f71be 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/table.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/table.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
index 4fb5ae24dee0..37b13636a778 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -725,7 +725,7 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
725 if (ieee80211_is_data_qos(fc)) { 725 if (ieee80211_is_data_qos(fc)) {
726 if (mac->rdg_en) { 726 if (mac->rdg_en) {
727 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 727 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
728 ("Enable RDG function.\n")); 728 "Enable RDG function\n");
729 SET_TX_DESC_RDG_ENABLE(pdesc, 1); 729 SET_TX_DESC_RDG_ENABLE(pdesc, 1);
730 SET_TX_DESC_HTC(pdesc, 1); 730 SET_TX_DESC_HTC(pdesc, 1);
731 } 731 }
@@ -763,7 +763,7 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
763 SET_TX_DESC_BMC(pdesc, 1); 763 SET_TX_DESC_BMC(pdesc, 1);
764 } 764 }
765 765
766 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, ("\n")); 766 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n");
767} 767}
768 768
769void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, 769void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw,
@@ -821,8 +821,7 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw,
821 } 821 }
822 822
823 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, 823 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
824 "H2C Tx Cmd Content\n", 824 "H2C Tx Cmd Content", pdesc, TX_DESC_SIZE);
825 pdesc, TX_DESC_SIZE);
826} 825}
827 826
828void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) 827void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
@@ -837,8 +836,8 @@ void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
837 SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val); 836 SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val);
838 break; 837 break;
839 default: 838 default:
840 RT_ASSERT(false, ("ERR txdesc :%d" 839 RT_ASSERT(false, "ERR txdesc :%d not process\n",
841 " not process\n", desc_name)); 840 desc_name);
842 break; 841 break;
843 } 842 }
844 } else { 843 } else {
@@ -857,8 +856,8 @@ void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
857 SET_RX_DESC_EOR(pdesc, 1); 856 SET_RX_DESC_EOR(pdesc, 1);
858 break; 857 break;
859 default: 858 default:
860 RT_ASSERT(false, ("ERR rxdesc :%d " 859 RT_ASSERT(false, "ERR rxdesc :%d not process\n",
861 "not process\n", desc_name)); 860 desc_name);
862 break; 861 break;
863 } 862 }
864 } 863 }
@@ -877,8 +876,8 @@ u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name)
877 ret = GET_TX_DESC_TX_BUFFER_ADDRESS(p_desc); 876 ret = GET_TX_DESC_TX_BUFFER_ADDRESS(p_desc);
878 break; 877 break;
879 default: 878 default:
880 RT_ASSERT(false, ("ERR txdesc :%d " 879 RT_ASSERT(false, "ERR txdesc :%d not process\n",
881 "not process\n", desc_name)); 880 desc_name);
882 break; 881 break;
883 } 882 }
884 } else { 883 } else {
@@ -891,8 +890,8 @@ u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name)
891 ret = GET_RX_DESC_PKT_LEN(pdesc); 890 ret = GET_RX_DESC_PKT_LEN(pdesc);
892 break; 891 break;
893 default: 892 default:
894 RT_ASSERT(false, ("ERR rxdesc :%d " 893 RT_ASSERT(false, "ERR rxdesc :%d not process\n",
895 "not process\n", desc_name)); 894 desc_name);
896 break; 895 break;
897 } 896 }
898 } 897 }
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
index c8977a50ca36..efb9ab270403 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/def.h b/drivers/net/wireless/rtlwifi/rtl8192cu/def.h
index d097efb1e717..f916555e6311 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/def.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/def.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c
index f311baee668d..6fd39eaf361e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -52,7 +52,7 @@ void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw)
52 if ((mac->link_state < MAC80211_LINKED) && 52 if ((mac->link_state < MAC80211_LINKED) &&
53 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { 53 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) {
54 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 54 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
55 ("Not connected to any\n")); 55 "Not connected to any\n");
56 56
57 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; 57 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
58 58
@@ -65,28 +65,28 @@ void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw)
65 undecorated_smoothed_pwdb = 65 undecorated_smoothed_pwdb =
66 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 66 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
67 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 67 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
68 ("AP Client PWDB = 0x%lx\n", 68 "AP Client PWDB = 0x%lx\n",
69 undecorated_smoothed_pwdb)); 69 undecorated_smoothed_pwdb);
70 } else { 70 } else {
71 undecorated_smoothed_pwdb = 71 undecorated_smoothed_pwdb =
72 rtlpriv->dm.undecorated_smoothed_pwdb; 72 rtlpriv->dm.undecorated_smoothed_pwdb;
73 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 73 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
74 ("STA Default Port PWDB = 0x%lx\n", 74 "STA Default Port PWDB = 0x%lx\n",
75 undecorated_smoothed_pwdb)); 75 undecorated_smoothed_pwdb);
76 } 76 }
77 } else { 77 } else {
78 undecorated_smoothed_pwdb = 78 undecorated_smoothed_pwdb =
79 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 79 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
80 80
81 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 81 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
82 ("AP Ext Port PWDB = 0x%lx\n", 82 "AP Ext Port PWDB = 0x%lx\n",
83 undecorated_smoothed_pwdb)); 83 undecorated_smoothed_pwdb);
84 } 84 }
85 85
86 if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { 86 if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) {
87 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; 87 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1;
88 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 88 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
89 ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n")); 89 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n");
90 } else if ((undecorated_smoothed_pwdb < 90 } else if ((undecorated_smoothed_pwdb <
91 (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && 91 (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) &&
92 (undecorated_smoothed_pwdb >= 92 (undecorated_smoothed_pwdb >=
@@ -94,18 +94,18 @@ void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw)
94 94
95 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; 95 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1;
96 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 96 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
97 ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n")); 97 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n");
98 } else if (undecorated_smoothed_pwdb < 98 } else if (undecorated_smoothed_pwdb <
99 (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { 99 (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) {
100 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; 100 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
101 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 101 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
102 ("TXHIGHPWRLEVEL_NORMAL\n")); 102 "TXHIGHPWRLEVEL_NORMAL\n");
103 } 103 }
104 104
105 if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { 105 if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) {
106 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 106 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
107 ("PHY_SetTxPowerLevel8192S() Channel = %d\n", 107 "PHY_SetTxPowerLevel8192S() Channel = %d\n",
108 rtlphy->current_channel)); 108 rtlphy->current_channel);
109 rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); 109 rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel);
110 } 110 }
111 111
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h
index 7f966c666b5a..d947e7d350bb 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index 124cf633861c..0c74d4f2eeb4 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,8 +27,6 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include "../wifi.h" 30#include "../wifi.h"
33#include "../efuse.h" 31#include "../efuse.h"
34#include "../base.h" 32#include "../base.h"
@@ -162,24 +160,24 @@ static void _rtl92cu_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
162 for (rf_path = 0; rf_path < 2; rf_path++) 160 for (rf_path = 0; rf_path < 2; rf_path++)
163 for (i = 0; i < 3; i++) 161 for (i = 0; i < 3; i++)
164 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 162 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
165 ("RF(%d) EEPROM CCK Area(%d) = 0x%x\n", rf_path, 163 "RF(%d) EEPROM CCK Area(%d) = 0x%x\n",
166 i, rtlefuse-> 164 rf_path, i,
167 eeprom_chnlarea_txpwr_cck[rf_path][i])); 165 rtlefuse->
166 eeprom_chnlarea_txpwr_cck[rf_path][i]);
168 for (rf_path = 0; rf_path < 2; rf_path++) 167 for (rf_path = 0; rf_path < 2; rf_path++)
169 for (i = 0; i < 3; i++) 168 for (i = 0; i < 3; i++)
170 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 169 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
171 ("RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n", 170 "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n",
172 rf_path, i, 171 rf_path, i,
173 rtlefuse-> 172 rtlefuse->
174 eeprom_chnlarea_txpwr_ht40_1s[rf_path][i])); 173 eeprom_chnlarea_txpwr_ht40_1s[rf_path][i]);
175 for (rf_path = 0; rf_path < 2; rf_path++) 174 for (rf_path = 0; rf_path < 2; rf_path++)
176 for (i = 0; i < 3; i++) 175 for (i = 0; i < 3; i++)
177 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 176 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
178 ("RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n", 177 "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n",
179 rf_path, i, 178 rf_path, i,
180 rtlefuse-> 179 rtlefuse->
181 eeprom_chnlarea_txpwr_ht40_2sdiif[rf_path] 180 eeprom_chnlarea_txpwr_ht40_2sdiif[rf_path][i]);
182 [i]));
183 for (rf_path = 0; rf_path < 2; rf_path++) { 181 for (rf_path = 0; rf_path < 2; rf_path++) {
184 for (i = 0; i < 14; i++) { 182 for (i = 0; i < 14; i++) {
185 index = _rtl92c_get_chnl_group((u8) i); 183 index = _rtl92c_get_chnl_group((u8) i);
@@ -205,11 +203,10 @@ static void _rtl92cu_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
205 } 203 }
206 for (i = 0; i < 14; i++) { 204 for (i = 0; i < 14; i++) {
207 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 205 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
208 ("RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = " 206 "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n", rf_path, i,
209 "[0x%x / 0x%x / 0x%x]\n", rf_path, i, 207 rtlefuse->txpwrlevel_cck[rf_path][i],
210 rtlefuse->txpwrlevel_cck[rf_path][i], 208 rtlefuse->txpwrlevel_ht40_1s[rf_path][i],
211 rtlefuse->txpwrlevel_ht40_1s[rf_path][i], 209 rtlefuse->txpwrlevel_ht40_2s[rf_path][i]);
212 rtlefuse->txpwrlevel_ht40_2s[rf_path][i]));
213 } 210 }
214 } 211 }
215 for (i = 0; i < 3; i++) { 212 for (i = 0; i < 3; i++) {
@@ -242,13 +239,13 @@ static void _rtl92cu_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
242 & 0xf0) >> 4); 239 & 0xf0) >> 4);
243 } 240 }
244 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 241 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
245 ("RF-%d pwrgroup_ht20[%d] = 0x%x\n", 242 "RF-%d pwrgroup_ht20[%d] = 0x%x\n",
246 rf_path, i, 243 rf_path, i,
247 rtlefuse->pwrgroup_ht20[rf_path][i])); 244 rtlefuse->pwrgroup_ht20[rf_path][i]);
248 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 245 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
249 ("RF-%d pwrgroup_ht40[%d] = 0x%x\n", 246 "RF-%d pwrgroup_ht40[%d] = 0x%x\n",
250 rf_path, i, 247 rf_path, i,
251 rtlefuse->pwrgroup_ht40[rf_path][i])); 248 rtlefuse->pwrgroup_ht40[rf_path][i]);
252 } 249 }
253 } 250 }
254 for (i = 0; i < 14; i++) { 251 for (i = 0; i < 14; i++) {
@@ -277,26 +274,26 @@ static void _rtl92cu_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
277 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][7]; 274 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][7];
278 for (i = 0; i < 14; i++) 275 for (i = 0; i < 14; i++)
279 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 276 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
280 ("RF-A Ht20 to HT40 Diff[%d] = 0x%x\n", i, 277 "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n",
281 rtlefuse->txpwr_ht20diff[RF90_PATH_A][i])); 278 i, rtlefuse->txpwr_ht20diff[RF90_PATH_A][i]);
282 for (i = 0; i < 14; i++) 279 for (i = 0; i < 14; i++)
283 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 280 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
284 ("RF-A Legacy to Ht40 Diff[%d] = 0x%x\n", i, 281 "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n",
285 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i])); 282 i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i]);
286 for (i = 0; i < 14; i++) 283 for (i = 0; i < 14; i++)
287 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 284 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
288 ("RF-B Ht20 to HT40 Diff[%d] = 0x%x\n", i, 285 "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n",
289 rtlefuse->txpwr_ht20diff[RF90_PATH_B][i])); 286 i, rtlefuse->txpwr_ht20diff[RF90_PATH_B][i]);
290 for (i = 0; i < 14; i++) 287 for (i = 0; i < 14; i++)
291 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 288 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
292 ("RF-B Legacy to HT40 Diff[%d] = 0x%x\n", i, 289 "RF-B Legacy to HT40 Diff[%d] = 0x%x\n",
293 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i])); 290 i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i]);
294 if (!autoload_fail) 291 if (!autoload_fail)
295 rtlefuse->eeprom_regulatory = (hwinfo[RF_OPTION1] & 0x7); 292 rtlefuse->eeprom_regulatory = (hwinfo[RF_OPTION1] & 0x7);
296 else 293 else
297 rtlefuse->eeprom_regulatory = 0; 294 rtlefuse->eeprom_regulatory = 0;
298 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 295 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
299 ("eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory)); 296 "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory);
300 if (!autoload_fail) { 297 if (!autoload_fail) {
301 rtlefuse->eeprom_tssi[RF90_PATH_A] = hwinfo[EEPROM_TSSI_A]; 298 rtlefuse->eeprom_tssi[RF90_PATH_A] = hwinfo[EEPROM_TSSI_A];
302 rtlefuse->eeprom_tssi[RF90_PATH_B] = hwinfo[EEPROM_TSSI_B]; 299 rtlefuse->eeprom_tssi[RF90_PATH_B] = hwinfo[EEPROM_TSSI_B];
@@ -305,9 +302,9 @@ static void _rtl92cu_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
305 rtlefuse->eeprom_tssi[RF90_PATH_B] = EEPROM_DEFAULT_TSSI; 302 rtlefuse->eeprom_tssi[RF90_PATH_B] = EEPROM_DEFAULT_TSSI;
306 } 303 }
307 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 304 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
308 ("TSSI_A = 0x%x, TSSI_B = 0x%x\n", 305 "TSSI_A = 0x%x, TSSI_B = 0x%x\n",
309 rtlefuse->eeprom_tssi[RF90_PATH_A], 306 rtlefuse->eeprom_tssi[RF90_PATH_A],
310 rtlefuse->eeprom_tssi[RF90_PATH_B])); 307 rtlefuse->eeprom_tssi[RF90_PATH_B]);
311 if (!autoload_fail) 308 if (!autoload_fail)
312 tempval = hwinfo[EEPROM_THERMAL_METER]; 309 tempval = hwinfo[EEPROM_THERMAL_METER];
313 else 310 else
@@ -320,7 +317,7 @@ static void _rtl92cu_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
320 rtlefuse->apk_thermalmeterignore = true; 317 rtlefuse->apk_thermalmeterignore = true;
321 rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; 318 rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter;
322 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 319 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
323 ("thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter)); 320 "thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter);
324} 321}
325 322
326static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents) 323static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents)
@@ -340,144 +337,8 @@ static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents)
340 if (IS_HIGHT_PA(rtlefuse->board_type)) 337 if (IS_HIGHT_PA(rtlefuse->board_type))
341 rtlefuse->external_pa = 1; 338 rtlefuse->external_pa = 1;
342 pr_info("Board Type %x\n", rtlefuse->board_type); 339 pr_info("Board Type %x\n", rtlefuse->board_type);
343
344#ifdef CONFIG_ANTENNA_DIVERSITY
345 /* Antenna Diversity setting. */
346 if (registry_par->antdiv_cfg == 2) /* 2: From Efuse */
347 rtl_efuse->antenna_cfg = (contents[EEPROM_RF_OPT1]&0x18)>>3;
348 else
349 rtl_efuse->antenna_cfg = registry_par->antdiv_cfg; /* 0:OFF, */
350
351 pr_info("Antenna Config %x\n", rtl_efuse->antenna_cfg);
352#endif
353}
354
355#ifdef CONFIG_BT_COEXIST
356static void _update_bt_param(_adapter *padapter)
357{
358 struct btcoexist_priv *pbtpriv = &(padapter->halpriv.bt_coexist);
359 struct registry_priv *registry_par = &padapter->registrypriv;
360 if (2 != registry_par->bt_iso) {
361 /* 0:Low, 1:High, 2:From Efuse */
362 pbtpriv->BT_Ant_isolation = registry_par->bt_iso;
363 }
364 if (registry_par->bt_sco == 1) {
365 /* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter, 4.Busy,
366 * 5.OtherBusy */
367 pbtpriv->BT_Service = BT_OtherAction;
368 } else if (registry_par->bt_sco == 2) {
369 pbtpriv->BT_Service = BT_SCO;
370 } else if (registry_par->bt_sco == 4) {
371 pbtpriv->BT_Service = BT_Busy;
372 } else if (registry_par->bt_sco == 5) {
373 pbtpriv->BT_Service = BT_OtherBusy;
374 } else {
375 pbtpriv->BT_Service = BT_Idle;
376 }
377 pbtpriv->BT_Ampdu = registry_par->bt_ampdu;
378 pbtpriv->bCOBT = _TRUE;
379 pbtpriv->BtEdcaUL = 0;
380 pbtpriv->BtEdcaDL = 0;
381 pbtpriv->BtRssiState = 0xff;
382 pbtpriv->bInitSet = _FALSE;
383 pbtpriv->bBTBusyTraffic = _FALSE;
384 pbtpriv->bBTTrafficModeSet = _FALSE;
385 pbtpriv->bBTNonTrafficModeSet = _FALSE;
386 pbtpriv->CurrentState = 0;
387 pbtpriv->PreviousState = 0;
388 pr_info("BT Coexistance = %s\n",
389 (pbtpriv->BT_Coexist == _TRUE) ? "enable" : "disable");
390 if (pbtpriv->BT_Coexist) {
391 if (pbtpriv->BT_Ant_Num == Ant_x2)
392 pr_info("BlueTooth BT_Ant_Num = Antx2\n");
393 else if (pbtpriv->BT_Ant_Num == Ant_x1)
394 pr_info("BlueTooth BT_Ant_Num = Antx1\n");
395 switch (pbtpriv->BT_CoexistType) {
396 case BT_2Wire:
397 pr_info("BlueTooth BT_CoexistType = BT_2Wire\n");
398 break;
399 case BT_ISSC_3Wire:
400 pr_info("BlueTooth BT_CoexistType = BT_ISSC_3Wire\n");
401 break;
402 case BT_Accel:
403 pr_info("BlueTooth BT_CoexistType = BT_Accel\n");
404 break;
405 case BT_CSR_BC4:
406 pr_info("BlueTooth BT_CoexistType = BT_CSR_BC4\n");
407 break;
408 case BT_CSR_BC8:
409 pr_info("BlueTooth BT_CoexistType = BT_CSR_BC8\n");
410 break;
411 case BT_RTL8756:
412 pr_info("BlueTooth BT_CoexistType = BT_RTL8756\n");
413 break;
414 default:
415 pr_info("BlueTooth BT_CoexistType = Unknown\n");
416 break;
417 }
418 pr_info("BlueTooth BT_Ant_isolation = %d\n",
419 pbtpriv->BT_Ant_isolation);
420 switch (pbtpriv->BT_Service) {
421 case BT_OtherAction:
422 pr_info("BlueTooth BT_Service = BT_OtherAction\n");
423 break;
424 case BT_SCO:
425 pr_info("BlueTooth BT_Service = BT_SCO\n");
426 break;
427 case BT_Busy:
428 pr_info("BlueTooth BT_Service = BT_Busy\n");
429 break;
430 case BT_OtherBusy:
431 pr_info("BlueTooth BT_Service = BT_OtherBusy\n");
432 break;
433 default:
434 pr_info("BlueTooth BT_Service = BT_Idle\n");
435 break;
436 }
437 pr_info("BT_RadioSharedType = 0x%x\n",
438 pbtpriv->BT_RadioSharedType);
439 }
440} 340}
441 341
442#define GET_BT_COEXIST(priv) (&priv->bt_coexist)
443
444static void _rtl92cu_read_bluetooth_coexistInfo(struct ieee80211_hw *hw,
445 u8 *contents,
446 bool bautoloadfailed);
447{
448 HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
449 bool isNormal = IS_NORMAL_CHIP(pHalData->VersionID);
450 struct btcoexist_priv *pbtpriv = &pHalData->bt_coexist;
451 u8 rf_opt4;
452
453 _rtw_memset(pbtpriv, 0, sizeof(struct btcoexist_priv));
454 if (AutoloadFail) {
455 pbtpriv->BT_Coexist = _FALSE;
456 pbtpriv->BT_CoexistType = BT_2Wire;
457 pbtpriv->BT_Ant_Num = Ant_x2;
458 pbtpriv->BT_Ant_isolation = 0;
459 pbtpriv->BT_RadioSharedType = BT_Radio_Shared;
460 return;
461 }
462 if (isNormal) {
463 if (pHalData->BoardType == BOARD_USB_COMBO)
464 pbtpriv->BT_Coexist = _TRUE;
465 else
466 pbtpriv->BT_Coexist = ((PROMContent[EEPROM_RF_OPT3] &
467 0x20) >> 5); /* bit[5] */
468 rf_opt4 = PROMContent[EEPROM_RF_OPT4];
469 pbtpriv->BT_CoexistType = ((rf_opt4&0xe)>>1); /* bit [3:1] */
470 pbtpriv->BT_Ant_Num = (rf_opt4&0x1); /* bit [0] */
471 pbtpriv->BT_Ant_isolation = ((rf_opt4&0x10)>>4); /* bit [4] */
472 pbtpriv->BT_RadioSharedType = ((rf_opt4&0x20)>>5); /* bit [5] */
473 } else {
474 pbtpriv->BT_Coexist = (PROMContent[EEPROM_RF_OPT4] >> 4) ?
475 _TRUE : _FALSE;
476 }
477 _update_bt_param(Adapter);
478}
479#endif
480
481static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) 342static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw)
482{ 343{
483 struct rtl_priv *rtlpriv = rtl_priv(hw); 344 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -494,17 +355,17 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw)
494 HWSET_MAX_SIZE); 355 HWSET_MAX_SIZE);
495 } else if (rtlefuse->epromtype == EEPROM_93C46) { 356 } else if (rtlefuse->epromtype == EEPROM_93C46) {
496 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 357 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
497 ("RTL819X Not boot from eeprom, check it !!")); 358 "RTL819X Not boot from eeprom, check it !!\n");
498 } 359 }
499 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD, ("MAP\n"), 360 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD, "MAP",
500 hwinfo, HWSET_MAX_SIZE); 361 hwinfo, HWSET_MAX_SIZE);
501 eeprom_id = le16_to_cpu(*((__le16 *)&hwinfo[0])); 362 eeprom_id = le16_to_cpu(*((__le16 *)&hwinfo[0]));
502 if (eeprom_id != RTL8190_EEPROM_ID) { 363 if (eeprom_id != RTL8190_EEPROM_ID) {
503 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 364 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
504 ("EEPROM ID(%#x) is invalid!!\n", eeprom_id)); 365 "EEPROM ID(%#x) is invalid!!\n", eeprom_id);
505 rtlefuse->autoload_failflag = true; 366 rtlefuse->autoload_failflag = true;
506 } else { 367 } else {
507 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); 368 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
508 rtlefuse->autoload_failflag = false; 369 rtlefuse->autoload_failflag = false;
509 } 370 }
510 if (rtlefuse->autoload_failflag) 371 if (rtlefuse->autoload_failflag)
@@ -518,16 +379,15 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw)
518 rtlefuse->autoload_failflag, hwinfo); 379 rtlefuse->autoload_failflag, hwinfo);
519 rtlefuse->eeprom_vid = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VID]); 380 rtlefuse->eeprom_vid = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VID]);
520 rtlefuse->eeprom_did = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_DID]); 381 rtlefuse->eeprom_did = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_DID]);
521 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 382 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, " VID = 0x%02x PID = 0x%02x\n",
522 (" VID = 0x%02x PID = 0x%02x\n", 383 rtlefuse->eeprom_vid, rtlefuse->eeprom_did);
523 rtlefuse->eeprom_vid, rtlefuse->eeprom_did));
524 rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN]; 384 rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN];
525 rtlefuse->eeprom_version = 385 rtlefuse->eeprom_version =
526 le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VERSION]); 386 le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VERSION]);
527 rtlefuse->txpwr_fromeprom = true; 387 rtlefuse->txpwr_fromeprom = true;
528 rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID]; 388 rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID];
529 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 389 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n",
530 ("EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid)); 390 rtlefuse->eeprom_oemid);
531 if (rtlhal->oem_id == RT_CID_DEFAULT) { 391 if (rtlhal->oem_id == RT_CID_DEFAULT) {
532 switch (rtlefuse->eeprom_oemid) { 392 switch (rtlefuse->eeprom_oemid) {
533 case EEPROM_CID_DEFAULT: 393 case EEPROM_CID_DEFAULT:
@@ -554,10 +414,6 @@ static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw)
554 } 414 }
555 } 415 }
556 _rtl92cu_read_board_type(hw, hwinfo); 416 _rtl92cu_read_board_type(hw, hwinfo);
557#ifdef CONFIG_BT_COEXIST
558 _rtl92cu_read_bluetooth_coexistInfo(hw, hwinfo,
559 rtlefuse->autoload_failflag);
560#endif
561} 417}
562 418
563static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw) 419static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw)
@@ -579,8 +435,8 @@ static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw)
579 default: 435 default:
580 break; 436 break;
581 } 437 }
582 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 438 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "RT Customized ID: 0x%02X\n",
583 ("RT Customized ID: 0x%02X\n", rtlhal->oem_id)); 439 rtlhal->oem_id);
584} 440}
585 441
586void rtl92cu_read_eeprom_info(struct ieee80211_hw *hw) 442void rtl92cu_read_eeprom_info(struct ieee80211_hw *hw)
@@ -596,11 +452,11 @@ void rtl92cu_read_eeprom_info(struct ieee80211_hw *hw)
596 tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); 452 tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR);
597 rtlefuse->epromtype = (tmp_u1b & BOOT_FROM_EEPROM) ? 453 rtlefuse->epromtype = (tmp_u1b & BOOT_FROM_EEPROM) ?
598 EEPROM_93C46 : EEPROM_BOOT_EFUSE; 454 EEPROM_93C46 : EEPROM_BOOT_EFUSE;
599 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from %s\n", 455 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from %s\n",
600 (tmp_u1b & BOOT_FROM_EEPROM) ? "EERROM" : "EFUSE")); 456 tmp_u1b & BOOT_FROM_EEPROM ? "EERROM" : "EFUSE");
601 rtlefuse->autoload_failflag = (tmp_u1b & EEPROM_EN) ? false : true; 457 rtlefuse->autoload_failflag = (tmp_u1b & EEPROM_EN) ? false : true;
602 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload %s\n", 458 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload %s\n",
603 (tmp_u1b & EEPROM_EN) ? "OK!!" : "ERR!!")); 459 tmp_u1b & EEPROM_EN ? "OK!!" : "ERR!!");
604 _rtl92cu_read_adapter_info(hw); 460 _rtl92cu_read_adapter_info(hw);
605 _rtl92cu_hal_customized_behavior(hw); 461 _rtl92cu_hal_customized_behavior(hw);
606 return; 462 return;
@@ -618,13 +474,12 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
618 do { 474 do {
619 if (rtl_read_byte(rtlpriv, REG_APS_FSMCO) & PFM_ALDN) { 475 if (rtl_read_byte(rtlpriv, REG_APS_FSMCO) & PFM_ALDN) {
620 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 476 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
621 ("Autoload Done!\n")); 477 "Autoload Done!\n");
622 break; 478 break;
623 } 479 }
624 if (pollingCount++ > 100) { 480 if (pollingCount++ > 100) {
625 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 481 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
626 ("Failed to polling REG_APS_FSMCO[PFM_ALDN]" 482 "Failed to polling REG_APS_FSMCO[PFM_ALDN] done!\n");
627 " done!\n"));
628 return -ENODEV; 483 return -ENODEV;
629 } 484 }
630 } while (true); 485 } while (true);
@@ -639,8 +494,8 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
639 value8 |= LDV12_EN; 494 value8 |= LDV12_EN;
640 rtl_write_byte(rtlpriv, REG_LDOV12D_CTRL, value8); 495 rtl_write_byte(rtlpriv, REG_LDOV12D_CTRL, value8);
641 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 496 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
642 (" power-on :REG_LDOV12D_CTRL Reg0x21:0x%02x.\n", 497 " power-on :REG_LDOV12D_CTRL Reg0x21:0x%02x\n",
643 value8)); 498 value8);
644 udelay(100); 499 udelay(100);
645 value8 = rtl_read_byte(rtlpriv, REG_SYS_ISO_CTRL); 500 value8 = rtl_read_byte(rtlpriv, REG_SYS_ISO_CTRL);
646 value8 &= ~ISO_MD2PP; 501 value8 &= ~ISO_MD2PP;
@@ -658,8 +513,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
658 } 513 }
659 if (pollingCount++ > 100) { 514 if (pollingCount++ > 100) {
660 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 515 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
661 ("Failed to polling REG_APS_FSMCO[APFM_ONMAC]" 516 "Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n");
662 " done!\n"));
663 return -ENODEV; 517 return -ENODEV;
664 } 518 }
665 } while (true); 519 } while (true);
@@ -877,8 +731,8 @@ static void _rtl92cu_init_chipN_three_out_ep_priority(struct ieee80211_hw *hw,
877 hiQ = QUEUE_HIGH; 731 hiQ = QUEUE_HIGH;
878 } 732 }
879 _rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ); 733 _rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ);
880 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 734 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Tx queue select :0x%02x..\n",
881 ("Tx queue select :0x%02x..\n", queue_sel)); 735 queue_sel);
882} 736}
883 737
884static void _rtl92cu_init_chipN_queue_priority(struct ieee80211_hw *hw, 738static void _rtl92cu_init_chipN_queue_priority(struct ieee80211_hw *hw,
@@ -937,8 +791,8 @@ static void _rtl92cu_init_chipT_queue_priority(struct ieee80211_hw *hw,
937 break; 791 break;
938 } 792 }
939 rtl_write_byte(rtlpriv, (REG_TRXDMA_CTRL+1), hq_sele); 793 rtl_write_byte(rtlpriv, (REG_TRXDMA_CTRL+1), hq_sele);
940 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 794 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Tx queue select :0x%02x..\n",
941 ("Tx queue select :0x%02x..\n", hq_sele)); 795 hq_sele);
942} 796}
943 797
944static void _rtl92cu_init_queue_priority(struct ieee80211_hw *hw, 798static void _rtl92cu_init_queue_priority(struct ieee80211_hw *hw,
@@ -998,7 +852,7 @@ static int _rtl92cu_init_mac(struct ieee80211_hw *hw)
998 852
999 if (err) { 853 if (err) {
1000 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 854 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1001 ("Failed to init power on!\n")); 855 "Failed to init power on!\n");
1002 return err; 856 return err;
1003 } 857 }
1004 if (!wmm_enable) { 858 if (!wmm_enable) {
@@ -1010,7 +864,7 @@ static int _rtl92cu_init_mac(struct ieee80211_hw *hw)
1010 } 864 }
1011 if (false == rtl92c_init_llt_table(hw, boundary)) { 865 if (false == rtl92c_init_llt_table(hw, boundary)) {
1012 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 866 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1013 ("Failed to init LLT Table!\n")); 867 "Failed to init LLT Table!\n");
1014 return -EINVAL; 868 return -EINVAL;
1015 } 869 }
1016 _rtl92cu_init_queue_reserved_page(hw, wmm_enable, out_ep_nums, 870 _rtl92cu_init_queue_reserved_page(hw, wmm_enable, out_ep_nums,
@@ -1043,12 +897,12 @@ void rtl92cu_enable_hw_security_config(struct ieee80211_hw *hw)
1043 struct rtl_hal *rtlhal = rtl_hal(rtlpriv); 897 struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
1044 898
1045 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 899 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1046 ("PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", 900 "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
1047 rtlpriv->sec.pairwise_enc_algorithm, 901 rtlpriv->sec.pairwise_enc_algorithm,
1048 rtlpriv->sec.group_enc_algorithm)); 902 rtlpriv->sec.group_enc_algorithm);
1049 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { 903 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
1050 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 904 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
1051 ("not open sw encryption\n")); 905 "not open sw encryption\n");
1052 return; 906 return;
1053 } 907 }
1054 sec_reg_value = SCR_TxEncEnable | SCR_RxDecEnable; 908 sec_reg_value = SCR_TxEncEnable | SCR_RxDecEnable;
@@ -1059,8 +913,8 @@ void rtl92cu_enable_hw_security_config(struct ieee80211_hw *hw)
1059 if (IS_NORMAL_CHIP(rtlhal->version)) 913 if (IS_NORMAL_CHIP(rtlhal->version))
1060 sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); 914 sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK);
1061 rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); 915 rtl_write_byte(rtlpriv, REG_CR + 1, 0x02);
1062 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 916 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "The SECR-value %x\n",
1063 ("The SECR-value %x\n", sec_reg_value)); 917 sec_reg_value);
1064 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); 918 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value);
1065} 919}
1066 920
@@ -1111,34 +965,6 @@ static void _InitPABias(struct ieee80211_hw *hw)
1111 } 965 }
1112} 966}
1113 967
1114static void _InitAntenna_Selection(struct ieee80211_hw *hw)
1115{
1116#ifdef CONFIG_ANTENNA_DIVERSITY
1117 struct rtl_priv *rtlpriv = rtl_priv(hw);
1118 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1119 struct rtl_phy *rtlphy = &(rtlpriv->phy);
1120
1121 if (pHalData->AntDivCfg == 0)
1122 return;
1123
1124 if (rtlphy->rf_type == RF_1T1R) {
1125 rtl_write_dword(rtlpriv, REG_LEDCFG0,
1126 rtl_read_dword(rtlpriv,
1127 REG_LEDCFG0)|BIT(23));
1128 rtl_set_bbreg(hw, rFPGA0_XAB_RFPARAMETER, BIT(13), 0x01);
1129 if (rtl_get_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, 0x300) ==
1130 Antenna_A)
1131 pHalData->CurAntenna = Antenna_A;
1132 else
1133 pHalData->CurAntenna = Antenna_B;
1134 }
1135#endif
1136}
1137
1138static void _dump_registers(struct ieee80211_hw *hw)
1139{
1140}
1141
1142static void _update_mac_setting(struct ieee80211_hw *hw) 968static void _update_mac_setting(struct ieee80211_hw *hw)
1143{ 969{
1144 struct rtl_priv *rtlpriv = rtl_priv(hw); 970 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -1163,18 +989,15 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw)
1163 rtlhal->hw_type = HARDWARE_TYPE_RTL8192CU; 989 rtlhal->hw_type = HARDWARE_TYPE_RTL8192CU;
1164 err = _rtl92cu_init_mac(hw); 990 err = _rtl92cu_init_mac(hw);
1165 if (err) { 991 if (err) {
1166 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("init mac failed!\n")); 992 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "init mac failed!\n");
1167 return err; 993 return err;
1168 } 994 }
1169 err = rtl92c_download_fw(hw); 995 err = rtl92c_download_fw(hw);
1170 if (err) { 996 if (err) {
1171 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 997 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1172 ("Failed to download FW. Init HW without FW now..\n")); 998 "Failed to download FW. Init HW without FW now..\n");
1173 err = 1; 999 err = 1;
1174 rtlhal->fw_ready = false;
1175 return err; 1000 return err;
1176 } else {
1177 rtlhal->fw_ready = true;
1178 } 1001 }
1179 rtlhal->last_hmeboxnum = 0; /* h2c */ 1002 rtlhal->last_hmeboxnum = 0; /* h2c */
1180 _rtl92cu_phy_param_tab_init(hw); 1003 _rtl92cu_phy_param_tab_init(hw);
@@ -1209,10 +1032,8 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw)
1209 } 1032 }
1210 _rtl92cu_hw_configure(hw); 1033 _rtl92cu_hw_configure(hw);
1211 _InitPABias(hw); 1034 _InitPABias(hw);
1212 _InitAntenna_Selection(hw);
1213 _update_mac_setting(hw); 1035 _update_mac_setting(hw);
1214 rtl92c_dm_init(hw); 1036 rtl92c_dm_init(hw);
1215 _dump_registers(hw);
1216 return err; 1037 return err;
1217} 1038}
1218 1039
@@ -1270,24 +1091,21 @@ static void _ResetDigitalProcedure1(struct ieee80211_hw *hw, bool bWithoutHWSM)
1270 if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(1)) { 1091 if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(1)) {
1271 /* reset MCU ready status */ 1092 /* reset MCU ready status */
1272 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0); 1093 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0);
1273 if (rtlhal->fw_ready) { 1094 /* 8051 reset by self */
1274 /* 8051 reset by self */ 1095 rtl_write_byte(rtlpriv, REG_HMETFR+3, 0x20);
1275 rtl_write_byte(rtlpriv, REG_HMETFR+3, 0x20); 1096 while ((retry_cnts++ < 100) &&
1276 while ((retry_cnts++ < 100) && 1097 (FEN_CPUEN & rtl_read_word(rtlpriv,
1277 (FEN_CPUEN & rtl_read_word(rtlpriv, 1098 REG_SYS_FUNC_EN))) {
1278 REG_SYS_FUNC_EN))) { 1099 udelay(50);
1279 udelay(50); 1100 }
1280 } 1101 if (retry_cnts >= 100) {
1281 if (retry_cnts >= 100) { 1102 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1282 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1103 "#####=> 8051 reset failed!.........................\n");
1283 ("#####=> 8051 reset failed!.." 1104 /* if 8051 reset fail, reset MAC. */
1284 ".......................\n");); 1105 rtl_write_byte(rtlpriv,
1285 /* if 8051 reset fail, reset MAC. */ 1106 REG_SYS_FUNC_EN + 1,
1286 rtl_write_byte(rtlpriv, 1107 0x50);
1287 REG_SYS_FUNC_EN + 1, 1108 udelay(100);
1288 0x50);
1289 udelay(100);
1290 }
1291 } 1109 }
1292 } 1110 }
1293 /* Reset MAC and Enable 8051 */ 1111 /* Reset MAC and Enable 8051 */
@@ -1495,35 +1313,36 @@ static int _rtl92cu_set_media_status(struct ieee80211_hw *hw,
1495 _rtl92cu_resume_tx_beacon(hw); 1313 _rtl92cu_resume_tx_beacon(hw);
1496 _rtl92cu_disable_bcn_sub_func(hw); 1314 _rtl92cu_disable_bcn_sub_func(hw);
1497 } else { 1315 } else {
1498 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, ("Set HW_VAR_MEDIA_" 1316 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1499 "STATUS:No such media status(%x).\n", type)); 1317 "Set HW_VAR_MEDIA_STATUS:No such media status(%x)\n",
1318 type);
1500 } 1319 }
1501 switch (type) { 1320 switch (type) {
1502 case NL80211_IFTYPE_UNSPECIFIED: 1321 case NL80211_IFTYPE_UNSPECIFIED:
1503 bt_msr |= MSR_NOLINK; 1322 bt_msr |= MSR_NOLINK;
1504 ledaction = LED_CTL_LINK; 1323 ledaction = LED_CTL_LINK;
1505 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1324 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1506 ("Set Network type to NO LINK!\n")); 1325 "Set Network type to NO LINK!\n");
1507 break; 1326 break;
1508 case NL80211_IFTYPE_ADHOC: 1327 case NL80211_IFTYPE_ADHOC:
1509 bt_msr |= MSR_ADHOC; 1328 bt_msr |= MSR_ADHOC;
1510 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1329 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1511 ("Set Network type to Ad Hoc!\n")); 1330 "Set Network type to Ad Hoc!\n");
1512 break; 1331 break;
1513 case NL80211_IFTYPE_STATION: 1332 case NL80211_IFTYPE_STATION:
1514 bt_msr |= MSR_INFRA; 1333 bt_msr |= MSR_INFRA;
1515 ledaction = LED_CTL_LINK; 1334 ledaction = LED_CTL_LINK;
1516 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1335 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1517 ("Set Network type to STA!\n")); 1336 "Set Network type to STA!\n");
1518 break; 1337 break;
1519 case NL80211_IFTYPE_AP: 1338 case NL80211_IFTYPE_AP:
1520 bt_msr |= MSR_AP; 1339 bt_msr |= MSR_AP;
1521 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1340 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1522 ("Set Network type to AP!\n")); 1341 "Set Network type to AP!\n");
1523 break; 1342 break;
1524 default: 1343 default:
1525 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1344 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1526 ("Network type %d not support!\n", type)); 1345 "Network type %d not supported!\n", type);
1527 goto error_out; 1346 goto error_out;
1528 } 1347 }
1529 rtl_write_byte(rtlpriv, (MSR), bt_msr); 1348 rtl_write_byte(rtlpriv, (MSR), bt_msr);
@@ -1684,8 +1503,8 @@ void rtl92cu_set_beacon_related_registers(struct ieee80211_hw *hw)
1684 value32 |= TSFRST; 1503 value32 |= TSFRST;
1685 rtl_write_dword(rtlpriv, REG_TCR, value32); 1504 rtl_write_dword(rtlpriv, REG_TCR, value32);
1686 RT_TRACE(rtlpriv, COMP_INIT|COMP_BEACON, DBG_LOUD, 1505 RT_TRACE(rtlpriv, COMP_INIT|COMP_BEACON, DBG_LOUD,
1687 ("SetBeaconRelatedRegisters8192CUsb(): Set TCR(%x)\n", 1506 "SetBeaconRelatedRegisters8192CUsb(): Set TCR(%x)\n",
1688 value32)); 1507 value32);
1689 /* TODO: Modify later (Find the right parameters) 1508 /* TODO: Modify later (Find the right parameters)
1690 * NOTE: Fix test chip's bug (about contention windows's randomness) */ 1509 * NOTE: Fix test chip's bug (about contention windows's randomness) */
1691 if ((mac->opmode == NL80211_IFTYPE_ADHOC) || 1510 if ((mac->opmode == NL80211_IFTYPE_ADHOC) ||
@@ -1702,8 +1521,8 @@ void rtl92cu_set_beacon_interval(struct ieee80211_hw *hw)
1702 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 1521 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1703 u16 bcn_interval = mac->beacon_interval; 1522 u16 bcn_interval = mac->beacon_interval;
1704 1523
1705 RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, 1524 RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, "beacon_interval:%d\n",
1706 ("beacon_interval:%d\n", bcn_interval)); 1525 bcn_interval);
1707 rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); 1526 rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval);
1708} 1527}
1709 1528
@@ -1767,7 +1586,7 @@ void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1767 break; 1586 break;
1768 default: 1587 default:
1769 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1588 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1770 ("switch case not process\n")); 1589 "switch case not processed\n");
1771 break; 1590 break;
1772 } 1591 }
1773} 1592}
@@ -1827,8 +1646,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1827 rtl_write_byte(rtlpriv, REG_MAC_SPEC_SIFS + 1, val[0]); 1646 rtl_write_byte(rtlpriv, REG_MAC_SPEC_SIFS + 1, val[0]);
1828 rtl_write_byte(rtlpriv, REG_R2T_SIFS+1, val[0]); 1647 rtl_write_byte(rtlpriv, REG_R2T_SIFS+1, val[0]);
1829 rtl_write_byte(rtlpriv, REG_T2T_SIFS+1, val[0]); 1648 rtl_write_byte(rtlpriv, REG_T2T_SIFS+1, val[0]);
1830 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 1649 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, "HW_VAR_SIFS\n");
1831 ("HW_VAR_SIFS\n"));
1832 break; 1650 break;
1833 } 1651 }
1834 case HW_VAR_SLOT_TIME:{ 1652 case HW_VAR_SLOT_TIME:{
@@ -1837,7 +1655,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1837 1655
1838 rtl_write_byte(rtlpriv, REG_SLOT, val[0]); 1656 rtl_write_byte(rtlpriv, REG_SLOT, val[0]);
1839 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 1657 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
1840 ("HW_VAR_SLOT_TIME %x\n", val[0])); 1658 "HW_VAR_SLOT_TIME %x\n", val[0]);
1841 if (QOS_MODE) { 1659 if (QOS_MODE) {
1842 for (e_aci = 0; e_aci < AC_MAX; e_aci++) 1660 for (e_aci = 0; e_aci < AC_MAX; e_aci++)
1843 rtlpriv->cfg->ops->set_hw_reg(hw, 1661 rtlpriv->cfg->ops->set_hw_reg(hw,
@@ -1901,8 +1719,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1901 min_spacing_to_set); 1719 min_spacing_to_set);
1902 *val = min_spacing_to_set; 1720 *val = min_spacing_to_set;
1903 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 1721 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
1904 ("Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", 1722 "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n",
1905 mac->min_space_cfg)); 1723 mac->min_space_cfg);
1906 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 1724 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE,
1907 mac->min_space_cfg); 1725 mac->min_space_cfg);
1908 } 1726 }
@@ -1916,8 +1734,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1916 mac->min_space_cfg &= 0x07; 1734 mac->min_space_cfg &= 0x07;
1917 mac->min_space_cfg |= (density_to_set << 3); 1735 mac->min_space_cfg |= (density_to_set << 3);
1918 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 1736 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
1919 ("Set HW_VAR_SHORTGI_DENSITY: %#x\n", 1737 "Set HW_VAR_SHORTGI_DENSITY: %#x\n",
1920 mac->min_space_cfg)); 1738 mac->min_space_cfg);
1921 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 1739 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE,
1922 mac->min_space_cfg); 1740 mac->min_space_cfg);
1923 break; 1741 break;
@@ -1950,8 +1768,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1950 p_regtoset[index]); 1768 p_regtoset[index]);
1951 } 1769 }
1952 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 1770 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
1953 ("Set HW_VAR_AMPDU_FACTOR: %#x\n", 1771 "Set HW_VAR_AMPDU_FACTOR: %#x\n",
1954 factor_toset)); 1772 factor_toset);
1955 } 1773 }
1956 break; 1774 break;
1957 } 1775 }
@@ -1969,8 +1787,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1969 AC_PARAM_ECW_MAX_OFFSET); 1787 AC_PARAM_ECW_MAX_OFFSET);
1970 u4b_ac_param |= (u32) tx_op << AC_PARAM_TXOP_OFFSET; 1788 u4b_ac_param |= (u32) tx_op << AC_PARAM_TXOP_OFFSET;
1971 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 1789 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
1972 ("queue:%x, ac_param:%x\n", e_aci, 1790 "queue:%x, ac_param:%x\n",
1973 u4b_ac_param)); 1791 e_aci, u4b_ac_param);
1974 switch (e_aci) { 1792 switch (e_aci) {
1975 case AC1_BK: 1793 case AC1_BK:
1976 rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 1794 rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM,
@@ -1989,8 +1807,9 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1989 u4b_ac_param); 1807 u4b_ac_param);
1990 break; 1808 break;
1991 default: 1809 default:
1992 RT_ASSERT(false, ("SetHwReg8185(): invalid" 1810 RT_ASSERT(false,
1993 " aci: %d !\n", e_aci)); 1811 "SetHwReg8185(): invalid aci: %d !\n",
1812 e_aci);
1994 break; 1813 break;
1995 } 1814 }
1996 if (rtlusb->acm_method != eAcmWay2_SW) 1815 if (rtlusb->acm_method != eAcmWay2_SW)
@@ -2020,8 +1839,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
2020 break; 1839 break;
2021 default: 1840 default:
2022 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1841 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
2023 ("HW_VAR_ACM_CTRL acm set " 1842 "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n",
2024 "failed: eACI is %d\n", acm)); 1843 acm);
2025 break; 1844 break;
2026 } 1845 }
2027 } else { 1846 } else {
@@ -2037,13 +1856,13 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
2037 break; 1856 break;
2038 default: 1857 default:
2039 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1858 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
2040 ("switch case not process\n")); 1859 "switch case not processed\n");
2041 break; 1860 break;
2042 } 1861 }
2043 } 1862 }
2044 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, 1863 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE,
2045 ("SetHwReg8190pci(): [HW_VAR_ACM_CTRL] " 1864 "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n",
2046 "Write 0x%X\n", acm_ctrl)); 1865 acm_ctrl);
2047 rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); 1866 rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl);
2048 break; 1867 break;
2049 } 1868 }
@@ -2051,7 +1870,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
2051 rtl_write_dword(rtlpriv, REG_RCR, ((u32 *) (val))[0]); 1870 rtl_write_dword(rtlpriv, REG_RCR, ((u32 *) (val))[0]);
2052 mac->rx_conf = ((u32 *) (val))[0]; 1871 mac->rx_conf = ((u32 *) (val))[0];
2053 RT_TRACE(rtlpriv, COMP_RECV, DBG_DMESG, 1872 RT_TRACE(rtlpriv, COMP_RECV, DBG_DMESG,
2054 ("### Set RCR(0x%08x) ###\n", mac->rx_conf)); 1873 "### Set RCR(0x%08x) ###\n", mac->rx_conf);
2055 break; 1874 break;
2056 } 1875 }
2057 case HW_VAR_RETRY_LIMIT:{ 1876 case HW_VAR_RETRY_LIMIT:{
@@ -2060,8 +1879,9 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
2060 rtl_write_word(rtlpriv, REG_RL, 1879 rtl_write_word(rtlpriv, REG_RL,
2061 retry_limit << RETRY_LIMIT_SHORT_SHIFT | 1880 retry_limit << RETRY_LIMIT_SHORT_SHIFT |
2062 retry_limit << RETRY_LIMIT_LONG_SHIFT); 1881 retry_limit << RETRY_LIMIT_LONG_SHIFT);
2063 RT_TRACE(rtlpriv, COMP_MLME, DBG_DMESG, ("Set HW_VAR_R" 1882 RT_TRACE(rtlpriv, COMP_MLME, DBG_DMESG,
2064 "ETRY_LIMIT(0x%08x)\n", retry_limit)); 1883 "Set HW_VAR_RETRY_LIMIT(0x%08x)\n",
1884 retry_limit);
2065 break; 1885 break;
2066 } 1886 }
2067 case HW_VAR_DUAL_TSF_RST: 1887 case HW_VAR_DUAL_TSF_RST:
@@ -2165,8 +1985,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
2165 rtl_write_word(rtlpriv, REG_RXFLTMAP2, *(u16 *)val); 1985 rtl_write_word(rtlpriv, REG_RXFLTMAP2, *(u16 *)val);
2166 break; 1986 break;
2167 default: 1987 default:
2168 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("switch case " 1988 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
2169 "not process\n")); 1989 "switch case not processed\n");
2170 break; 1990 break;
2171 } 1991 }
2172} 1992}
@@ -2239,8 +2059,8 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
2239 (shortgi_rate << 4) | (shortgi_rate); 2059 (shortgi_rate << 4) | (shortgi_rate);
2240 } 2060 }
2241 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); 2061 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value);
2242 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, ("%x\n", rtl_read_dword(rtlpriv, 2062 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n",
2243 REG_ARFR0))); 2063 rtl_read_dword(rtlpriv, REG_ARFR0));
2244} 2064}
2245 2065
2246void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) 2066void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level)
@@ -2344,17 +2164,16 @@ void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level)
2344 ratr_bitmap &= 0x0f0ff0ff; 2164 ratr_bitmap &= 0x0f0ff0ff;
2345 break; 2165 break;
2346 } 2166 }
2347 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, ("ratr_bitmap :%x\n", 2167 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "ratr_bitmap :%x\n",
2348 ratr_bitmap)); 2168 ratr_bitmap);
2349 *(u32 *)&rate_mask = ((ratr_bitmap & 0x0fffffff) | 2169 *(u32 *)&rate_mask = ((ratr_bitmap & 0x0fffffff) |
2350 ratr_index << 28); 2170 ratr_index << 28);
2351 rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; 2171 rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80;
2352 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, ("Rate_index:%x, " 2172 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
2353 "ratr_val:%x, %x:%x:%x:%x:%x\n", 2173 "Rate_index:%x, ratr_val:%x, %x:%x:%x:%x:%x\n",
2354 ratr_index, ratr_bitmap, 2174 ratr_index, ratr_bitmap,
2355 rate_mask[0], rate_mask[1], 2175 rate_mask[0], rate_mask[1], rate_mask[2], rate_mask[3],
2356 rate_mask[2], rate_mask[3], 2176 rate_mask[4]);
2357 rate_mask[4]));
2358 rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); 2177 rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask);
2359} 2178}
2360 2179
@@ -2404,7 +2223,7 @@ bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid)
2404 e_rfpowerstate_toset = (u1tmp & BIT(7)) ? 2223 e_rfpowerstate_toset = (u1tmp & BIT(7)) ?
2405 ERFOFF : ERFON; 2224 ERFOFF : ERFON;
2406 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 2225 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
2407 ("pwrdown, 0x5c(BIT7)=%02x\n", u1tmp)); 2226 "pwrdown, 0x5c(BIT7)=%02x\n", u1tmp);
2408 } else { 2227 } else {
2409 rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, 2228 rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG,
2410 rtl_read_byte(rtlpriv, 2229 rtl_read_byte(rtlpriv,
@@ -2413,27 +2232,26 @@ bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid)
2413 e_rfpowerstate_toset = (u1tmp & BIT(3)) ? 2232 e_rfpowerstate_toset = (u1tmp & BIT(3)) ?
2414 ERFON : ERFOFF; 2233 ERFON : ERFOFF;
2415 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 2234 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
2416 ("GPIO_IN=%02x\n", u1tmp)); 2235 "GPIO_IN=%02x\n", u1tmp);
2417 } 2236 }
2418 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, ("N-SS RF =%x\n", 2237 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "N-SS RF =%x\n",
2419 e_rfpowerstate_toset)); 2238 e_rfpowerstate_toset);
2420 } 2239 }
2421 if ((ppsc->hwradiooff) && (e_rfpowerstate_toset == ERFON)) { 2240 if ((ppsc->hwradiooff) && (e_rfpowerstate_toset == ERFON)) {
2422 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, ("GPIOChangeRF - HW " 2241 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
2423 "Radio ON, RF ON\n")); 2242 "GPIOChangeRF - HW Radio ON, RF ON\n");
2424 ppsc->hwradiooff = false; 2243 ppsc->hwradiooff = false;
2425 actuallyset = true; 2244 actuallyset = true;
2426 } else if ((!ppsc->hwradiooff) && (e_rfpowerstate_toset == 2245 } else if ((!ppsc->hwradiooff) && (e_rfpowerstate_toset ==
2427 ERFOFF)) { 2246 ERFOFF)) {
2428 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, ("GPIOChangeRF - HW" 2247 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
2429 " Radio OFF\n")); 2248 "GPIOChangeRF - HW Radio OFF\n");
2430 ppsc->hwradiooff = true; 2249 ppsc->hwradiooff = true;
2431 actuallyset = true; 2250 actuallyset = true;
2432 } else { 2251 } else {
2433 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD , 2252 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
2434 ("pHalData->bHwRadioOff and eRfPowerStateToSet do not" 2253 "pHalData->bHwRadioOff and eRfPowerStateToSet do not match: pHalData->bHwRadioOff %x, eRfPowerStateToSet %x\n",
2435 " match: pHalData->bHwRadioOff %x, eRfPowerStateToSet " 2254 ppsc->hwradiooff, e_rfpowerstate_toset);
2436 "%x\n", ppsc->hwradiooff, e_rfpowerstate_toset));
2437 } 2255 }
2438 if (actuallyset) { 2256 if (actuallyset) {
2439 ppsc->hwradiooff = true; 2257 ppsc->hwradiooff = true;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
index 32f85cba106a..f41a3aa4a26f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c
index 2ff9d8314e7b..75a2deb23af1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -47,8 +47,8 @@ void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
47 u8 ledcfg; 47 u8 ledcfg;
48 struct rtl_priv *rtlpriv = rtl_priv(hw); 48 struct rtl_priv *rtlpriv = rtl_priv(hw);
49 49
50 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, 50 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
51 ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); 51 REG_LEDCFG2, pled->ledpin);
52 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); 52 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
53 switch (pled->ledpin) { 53 switch (pled->ledpin) {
54 case LED_PIN_GPIO0: 54 case LED_PIN_GPIO0:
@@ -62,7 +62,7 @@ void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
62 break; 62 break;
63 default: 63 default:
64 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 64 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
65 ("switch case not process\n")); 65 "switch case not processed\n");
66 break; 66 break;
67 } 67 }
68 pled->ledon = true; 68 pled->ledon = true;
@@ -74,8 +74,8 @@ void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
74 struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); 74 struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw);
75 u8 ledcfg; 75 u8 ledcfg;
76 76
77 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, 77 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
78 ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); 78 REG_LEDCFG2, pled->ledpin);
79 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); 79 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
80 switch (pled->ledpin) { 80 switch (pled->ledpin) {
81 case LED_PIN_GPIO0: 81 case LED_PIN_GPIO0:
@@ -95,7 +95,7 @@ void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
95 break; 95 break;
96 default: 96 default:
97 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 97 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
98 ("switch case not process\n")); 98 "switch case not processed\n");
99 break; 99 break;
100 } 100 }
101 pled->ledon = false; 101 pled->ledon = false;
@@ -136,7 +136,6 @@ void rtl92cu_led_control(struct ieee80211_hw *hw,
136 ledaction == LED_CTL_POWER_ON)) { 136 ledaction == LED_CTL_POWER_ON)) {
137 return; 137 return;
138 } 138 }
139 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, ("ledaction %d,\n", 139 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d\n", ledaction);
140 ledaction));
141 _rtl92cu_sw_led_control(hw, ledaction); 140 _rtl92cu_sw_led_control(hw, ledaction);
142} 141}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/led.h b/drivers/net/wireless/rtlwifi/rtl8192cu/led.h
index decaee4d1eb1..0f372278b7af 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/led.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/led.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
index 9e0c8fcdf90f..025bdc2eba44 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,10 +27,6 @@
27 * 27 *
28****************************************************************************/ 28****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include <linux/module.h>
33
34#include "../wifi.h" 30#include "../wifi.h"
35#include "../pci.h" 31#include "../pci.h"
36#include "../usb.h" 32#include "../usb.h"
@@ -44,6 +40,8 @@
44#include "mac.h" 40#include "mac.h"
45#include "trx.h" 41#include "trx.h"
46 42
43#include <linux/module.h>
44
47/* macro to shorten lines */ 45/* macro to shorten lines */
48 46
49#define LINK_Q ui_link_quality 47#define LINK_Q ui_link_quality
@@ -57,6 +55,7 @@ void rtl92c_read_chip_version(struct ieee80211_hw *hw)
57 struct rtl_phy *rtlphy = &(rtlpriv->phy); 55 struct rtl_phy *rtlphy = &(rtlpriv->phy);
58 struct rtl_hal *rtlhal = rtl_hal(rtlpriv); 56 struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
59 enum version_8192c chip_version = VERSION_UNKNOWN; 57 enum version_8192c chip_version = VERSION_UNKNOWN;
58 const char *versionid;
60 u32 value32; 59 u32 value32;
61 60
62 value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG); 61 value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG);
@@ -84,88 +83,69 @@ void rtl92c_read_chip_version(struct ieee80211_hw *hw)
84 } 83 }
85 } 84 }
86 rtlhal->version = (enum version_8192c)chip_version; 85 rtlhal->version = (enum version_8192c)chip_version;
87 pr_info("rtl8192cu: Chip version 0x%x\n", chip_version); 86 pr_info("Chip version 0x%x\n", chip_version);
88 switch (rtlhal->version) { 87 switch (rtlhal->version) {
89 case VERSION_NORMAL_TSMC_CHIP_92C_1T2R: 88 case VERSION_NORMAL_TSMC_CHIP_92C_1T2R:
90 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 89 versionid = "NORMAL_B_CHIP_92C";
91 ("Chip Version ID: VERSION_B_CHIP_92C.\n"));
92 break; 90 break;
93 case VERSION_NORMAL_TSMC_CHIP_92C: 91 case VERSION_NORMAL_TSMC_CHIP_92C:
94 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 92 versionid = "NORMAL_TSMC_CHIP_92C";
95 ("Chip Version ID: VERSION_NORMAL_TSMC_CHIP_92C.\n"));
96 break; 93 break;
97 case VERSION_NORMAL_TSMC_CHIP_88C: 94 case VERSION_NORMAL_TSMC_CHIP_88C:
98 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 95 versionid = "NORMAL_TSMC_CHIP_88C";
99 ("Chip Version ID: VERSION_NORMAL_TSMC_CHIP_88C.\n"));
100 break; 96 break;
101 case VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT: 97 case VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT:
102 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 98 versionid = "NORMAL_UMC_CHIP_i92C_1T2R_A_CUT";
103 ("Chip Version ID: VERSION_NORMAL_UMC_CHIP_i"
104 "92C_1T2R_A_CUT.\n"));
105 break; 99 break;
106 case VERSION_NORMAL_UMC_CHIP_92C_A_CUT: 100 case VERSION_NORMAL_UMC_CHIP_92C_A_CUT:
107 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 101 versionid = "NORMAL_UMC_CHIP_92C_A_CUT";
108 ("Chip Version ID: VERSION_NORMAL_UMC_CHIP_"
109 "92C_A_CUT.\n"));
110 break; 102 break;
111 case VERSION_NORMAL_UMC_CHIP_88C_A_CUT: 103 case VERSION_NORMAL_UMC_CHIP_88C_A_CUT:
112 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 104 versionid = "NORMAL_UMC_CHIP_88C_A_CUT";
113 ("Chip Version ID: VERSION_NORMAL_UMC_CHIP"
114 "_88C_A_CUT.\n"));
115 break; 105 break;
116 case VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT: 106 case VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT:
117 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 107 versionid = "NORMAL_UMC_CHIP_92C_1T2R_B_CUT";
118 ("Chip Version ID: VERSION_NORMAL_UMC_CHIP"
119 "_92C_1T2R_B_CUT.\n"));
120 break; 108 break;
121 case VERSION_NORMAL_UMC_CHIP_92C_B_CUT: 109 case VERSION_NORMAL_UMC_CHIP_92C_B_CUT:
122 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 110 versionid = "NORMAL_UMC_CHIP_92C_B_CUT";
123 ("Chip Version ID: VERSION_NORMAL_UMC_CHIP"
124 "_92C_B_CUT.\n"));
125 break; 111 break;
126 case VERSION_NORMAL_UMC_CHIP_88C_B_CUT: 112 case VERSION_NORMAL_UMC_CHIP_88C_B_CUT:
127 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 113 versionid = "NORMAL_UMC_CHIP_88C_B_CUT";
128 ("Chip Version ID: VERSION_NORMAL_UMC_CHIP"
129 "_88C_B_CUT.\n"));
130 break; 114 break;
131 case VERSION_NORMA_UMC_CHIP_8723_1T1R_A_CUT: 115 case VERSION_NORMA_UMC_CHIP_8723_1T1R_A_CUT:
132 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 116 versionid = "NORMAL_UMC_CHIP_8723_1T1R_A_CUT";
133 ("Chip Version ID: VERSION_NORMA_UMC_CHIP"
134 "_8723_1T1R_A_CUT.\n"));
135 break; 117 break;
136 case VERSION_NORMA_UMC_CHIP_8723_1T1R_B_CUT: 118 case VERSION_NORMA_UMC_CHIP_8723_1T1R_B_CUT:
137 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 119 versionid = "NORMAL_UMC_CHIP_8723_1T1R_B_CUT";
138 ("Chip Version ID: VERSION_NORMA_UMC_CHIP"
139 "_8723_1T1R_B_CUT.\n"));
140 break; 120 break;
141 case VERSION_TEST_CHIP_92C: 121 case VERSION_TEST_CHIP_92C:
142 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 122 versionid = "TEST_CHIP_92C";
143 ("Chip Version ID: VERSION_TEST_CHIP_92C.\n"));
144 break; 123 break;
145 case VERSION_TEST_CHIP_88C: 124 case VERSION_TEST_CHIP_88C:
146 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 125 versionid = "TEST_CHIP_88C";
147 ("Chip Version ID: VERSION_TEST_CHIP_88C.\n"));
148 break; 126 break;
149 default: 127 default:
150 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 128 versionid = "UNKNOWN";
151 ("Chip Version ID: ???????????????.\n"));
152 break; 129 break;
153 } 130 }
131 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
132 "Chip Version ID: %s\n", versionid);
133
154 if (IS_92C_SERIAL(rtlhal->version)) 134 if (IS_92C_SERIAL(rtlhal->version))
155 rtlphy->rf_type = 135 rtlphy->rf_type =
156 (IS_92C_1T2R(rtlhal->version)) ? RF_1T2R : RF_2T2R; 136 (IS_92C_1T2R(rtlhal->version)) ? RF_1T2R : RF_2T2R;
157 else 137 else
158 rtlphy->rf_type = RF_1T1R; 138 rtlphy->rf_type = RF_1T1R;
159 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 139 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
160 ("Chip RF Type: %s\n", (rtlphy->rf_type == RF_2T2R) ? 140 "Chip RF Type: %s\n",
161 "RF_2T2R" : "RF_1T1R")); 141 rtlphy->rf_type == RF_2T2R ? "RF_2T2R" : "RF_1T1R");
162 if (get_rf_type(rtlphy) == RF_1T1R) 142 if (get_rf_type(rtlphy) == RF_1T1R)
163 rtlpriv->dm.rfpath_rxenable[0] = true; 143 rtlpriv->dm.rfpath_rxenable[0] = true;
164 else 144 else
165 rtlpriv->dm.rfpath_rxenable[0] = 145 rtlpriv->dm.rfpath_rxenable[0] =
166 rtlpriv->dm.rfpath_rxenable[1] = true; 146 rtlpriv->dm.rfpath_rxenable[1] = true;
167 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("VersionID = 0x%4x\n", 147 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "VersionID = 0x%4x\n",
168 rtlhal->version)); 148 rtlhal->version);
169} 149}
170 150
171/** 151/**
@@ -192,9 +172,8 @@ bool rtl92c_llt_write(struct ieee80211_hw *hw, u32 address, u32 data)
192 break; 172 break;
193 if (count > POLLING_LLT_THRESHOLD) { 173 if (count > POLLING_LLT_THRESHOLD) {
194 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 174 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
195 ("Failed to polling write LLT done at" 175 "Failed to polling write LLT done at address %d! _LLT_OP_VALUE(%x)\n",
196 " address %d! _LLT_OP_VALUE(%x)\n", 176 address, _LLT_OP_VALUE(value));
197 address, _LLT_OP_VALUE(value)));
198 status = false; 177 status = false;
199 break; 178 break;
200 } 179 }
@@ -272,7 +251,7 @@ void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index,
272 u8 cam_offset = 0; 251 u8 cam_offset = 0;
273 u8 clear_number = 5; 252 u8 clear_number = 5;
274 253
275 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("clear_all\n")); 254 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n");
276 for (idx = 0; idx < clear_number; idx++) { 255 for (idx = 0; idx < clear_number; idx++) {
277 rtl_cam_mark_invalid(hw, cam_offset + idx); 256 rtl_cam_mark_invalid(hw, cam_offset + idx);
278 rtl_cam_empty_entry(hw, cam_offset + idx); 257 rtl_cam_empty_entry(hw, cam_offset + idx);
@@ -298,7 +277,7 @@ void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index,
298 break; 277 break;
299 default: 278 default:
300 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 279 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
301 ("iillegal switch case\n")); 280 "illegal switch case\n");
302 enc_algo = CAM_TKIP; 281 enc_algo = CAM_TKIP;
303 break; 282 break;
304 } 283 }
@@ -317,26 +296,26 @@ void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index,
317 } 296 }
318 if (rtlpriv->sec.key_len[key_index] == 0) { 297 if (rtlpriv->sec.key_len[key_index] == 0) {
319 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 298 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
320 ("delete one entry\n")); 299 "delete one entry\n");
321 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); 300 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id);
322 } else { 301 } else {
323 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 302 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
324 ("The insert KEY length is %d\n", 303 "The insert KEY length is %d\n",
325 rtlpriv->sec.key_len[PAIRWISE_KEYIDX])); 304 rtlpriv->sec.key_len[PAIRWISE_KEYIDX]);
326 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 305 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
327 ("The insert KEY is %x %x\n", 306 "The insert KEY is %x %x\n",
328 rtlpriv->sec.key_buf[0][0], 307 rtlpriv->sec.key_buf[0][0],
329 rtlpriv->sec.key_buf[0][1])); 308 rtlpriv->sec.key_buf[0][1]);
330 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 309 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
331 ("add one entry\n")); 310 "add one entry\n");
332 if (is_pairwise) { 311 if (is_pairwise) {
333 RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD, 312 RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD,
334 "Pairwiase Key content :", 313 "Pairwise Key content",
335 rtlpriv->sec.pairwise_key, 314 rtlpriv->sec.pairwise_key,
336 rtlpriv->sec. 315 rtlpriv->sec.
337 key_len[PAIRWISE_KEYIDX]); 316 key_len[PAIRWISE_KEYIDX]);
338 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 317 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
339 ("set Pairwiase key\n")); 318 "set Pairwise key\n");
340 319
341 rtl_cam_add_one_entry(hw, macaddr, key_index, 320 rtl_cam_add_one_entry(hw, macaddr, key_index,
342 entry_id, enc_algo, 321 entry_id, enc_algo,
@@ -345,7 +324,7 @@ void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index,
345 key_buf[key_index]); 324 key_buf[key_index]);
346 } else { 325 } else {
347 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 326 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
348 ("set group key\n")); 327 "set group key\n");
349 if (mac->opmode == NL80211_IFTYPE_ADHOC) { 328 if (mac->opmode == NL80211_IFTYPE_ADHOC) {
350 rtl_cam_add_one_entry(hw, 329 rtl_cam_add_one_entry(hw,
351 rtlefuse->dev_addr, 330 rtlefuse->dev_addr,
@@ -421,8 +400,8 @@ void rtl92c_set_qos(struct ieee80211_hw *hw, int aci)
421 AC_PARAM_ECW_MAX_OFFSET; 400 AC_PARAM_ECW_MAX_OFFSET;
422 u4b_ac_param |= (u32) le16_to_cpu(mac->ac[aci].tx_op) << 401 u4b_ac_param |= (u32) le16_to_cpu(mac->ac[aci].tx_op) <<
423 AC_PARAM_TXOP_OFFSET; 402 AC_PARAM_TXOP_OFFSET;
424 RT_TRACE(rtlpriv, COMP_QOS, DBG_LOUD, 403 RT_TRACE(rtlpriv, COMP_QOS, DBG_LOUD, "queue:%x, ac_param:%x\n",
425 ("queue:%x, ac_param:%x\n", aci, u4b_ac_param)); 404 aci, u4b_ac_param);
426 switch (aci) { 405 switch (aci) {
427 case AC1_BK: 406 case AC1_BK:
428 rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, u4b_ac_param); 407 rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, u4b_ac_param);
@@ -437,7 +416,7 @@ void rtl92c_set_qos(struct ieee80211_hw *hw, int aci)
437 rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, u4b_ac_param); 416 rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, u4b_ac_param);
438 break; 417 break;
439 default: 418 default:
440 RT_ASSERT(false, ("invalid aci: %d !\n", aci)); 419 RT_ASSERT(false, "invalid aci: %d !\n", aci);
441 break; 420 break;
442 } 421 }
443} 422}
@@ -453,14 +432,14 @@ void rtl92c_set_mac_addr(struct ieee80211_hw *hw, const u8 *addr)
453 for (i = 0 ; i < ETH_ALEN ; i++) 432 for (i = 0 ; i < ETH_ALEN ; i++)
454 rtl_write_byte(rtlpriv, (REG_MACID + i), *(addr+i)); 433 rtl_write_byte(rtlpriv, (REG_MACID + i), *(addr+i));
455 434
456 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, ("MAC Address: %02X-%02X-%02X-" 435 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG,
457 "%02X-%02X-%02X\n", 436 "MAC Address: %02X-%02X-%02X-%02X-%02X-%02X\n",
458 rtl_read_byte(rtlpriv, REG_MACID), 437 rtl_read_byte(rtlpriv, REG_MACID),
459 rtl_read_byte(rtlpriv, REG_MACID+1), 438 rtl_read_byte(rtlpriv, REG_MACID+1),
460 rtl_read_byte(rtlpriv, REG_MACID+2), 439 rtl_read_byte(rtlpriv, REG_MACID+2),
461 rtl_read_byte(rtlpriv, REG_MACID+3), 440 rtl_read_byte(rtlpriv, REG_MACID+3),
462 rtl_read_byte(rtlpriv, REG_MACID+4), 441 rtl_read_byte(rtlpriv, REG_MACID+4),
463 rtl_read_byte(rtlpriv, REG_MACID+5))); 442 rtl_read_byte(rtlpriv, REG_MACID+5));
464} 443}
465 444
466void rtl92c_init_driver_info_size(struct ieee80211_hw *hw, u8 size) 445void rtl92c_init_driver_info_size(struct ieee80211_hw *hw, u8 size)
@@ -478,26 +457,26 @@ int rtl92c_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type)
478 case NL80211_IFTYPE_UNSPECIFIED: 457 case NL80211_IFTYPE_UNSPECIFIED:
479 value = NT_NO_LINK; 458 value = NT_NO_LINK;
480 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 459 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
481 ("Set Network type to NO LINK!\n")); 460 "Set Network type to NO LINK!\n");
482 break; 461 break;
483 case NL80211_IFTYPE_ADHOC: 462 case NL80211_IFTYPE_ADHOC:
484 value = NT_LINK_AD_HOC; 463 value = NT_LINK_AD_HOC;
485 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 464 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
486 ("Set Network type to Ad Hoc!\n")); 465 "Set Network type to Ad Hoc!\n");
487 break; 466 break;
488 case NL80211_IFTYPE_STATION: 467 case NL80211_IFTYPE_STATION:
489 value = NT_LINK_AP; 468 value = NT_LINK_AP;
490 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 469 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
491 ("Set Network type to STA!\n")); 470 "Set Network type to STA!\n");
492 break; 471 break;
493 case NL80211_IFTYPE_AP: 472 case NL80211_IFTYPE_AP:
494 value = NT_AS_AP; 473 value = NT_AS_AP;
495 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 474 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
496 ("Set Network type to AP!\n")); 475 "Set Network type to AP!\n");
497 break; 476 break;
498 default: 477 default:
499 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 478 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
500 ("Network type %d not support!\n", type)); 479 "Network type %d not supported!\n", type);
501 return -EOPNOTSUPP; 480 return -EOPNOTSUPP;
502 } 481 }
503 rtl_write_byte(rtlpriv, (REG_CR + 2), value); 482 rtl_write_byte(rtlpriv, (REG_CR + 2), value);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.h b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.h
index 626d88e88e26..bf53652e4edd 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
index e49cf2244c75..8ac3bcca4d41 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -44,9 +44,9 @@ u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw,
44 u32 original_value, readback_value, bitshift; 44 u32 original_value, readback_value, bitshift;
45 struct rtl_phy *rtlphy = &(rtlpriv->phy); 45 struct rtl_phy *rtlphy = &(rtlpriv->phy);
46 46
47 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 47 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
48 "rfpath(%#x), bitmask(%#x)\n", 48 "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
49 regaddr, rfpath, bitmask)); 49 regaddr, rfpath, bitmask);
50 if (rtlphy->rf_mode != RF_OP_BY_FW) { 50 if (rtlphy->rf_mode != RF_OP_BY_FW) {
51 original_value = _rtl92c_phy_rf_serial_read(hw, 51 original_value = _rtl92c_phy_rf_serial_read(hw,
52 rfpath, regaddr); 52 rfpath, regaddr);
@@ -57,9 +57,8 @@ u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw,
57 bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); 57 bitshift = _rtl92c_phy_calculate_bit_shift(bitmask);
58 readback_value = (original_value & bitmask) >> bitshift; 58 readback_value = (original_value & bitmask) >> bitshift;
59 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 59 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
60 ("regaddr(%#x), rfpath(%#x), " 60 "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
61 "bitmask(%#x), original_value(%#x)\n", 61 regaddr, rfpath, bitmask, original_value);
62 regaddr, rfpath, bitmask, original_value));
63 return readback_value; 62 return readback_value;
64} 63}
65 64
@@ -72,8 +71,8 @@ void rtl92cu_phy_set_rf_reg(struct ieee80211_hw *hw,
72 u32 original_value, bitshift; 71 u32 original_value, bitshift;
73 72
74 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 73 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
75 ("regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", 74 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
76 regaddr, bitmask, data, rfpath)); 75 regaddr, bitmask, data, rfpath);
77 if (rtlphy->rf_mode != RF_OP_BY_FW) { 76 if (rtlphy->rf_mode != RF_OP_BY_FW) {
78 if (bitmask != RFREG_OFFSET_MASK) { 77 if (bitmask != RFREG_OFFSET_MASK) {
79 original_value = _rtl92c_phy_rf_serial_read(hw, 78 original_value = _rtl92c_phy_rf_serial_read(hw,
@@ -97,9 +96,9 @@ void rtl92cu_phy_set_rf_reg(struct ieee80211_hw *hw,
97 } 96 }
98 _rtl92c_phy_fw_rf_serial_write(hw, rfpath, regaddr, data); 97 _rtl92c_phy_fw_rf_serial_write(hw, rfpath, regaddr, data);
99 } 98 }
100 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 99 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
101 "bitmask(%#x), data(%#x), rfpath(%#x)\n", 100 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
102 regaddr, bitmask, data, rfpath)); 101 regaddr, bitmask, data, rfpath);
103} 102}
104 103
105bool rtl92cu_phy_mac_config(struct ieee80211_hw *hw) 104bool rtl92cu_phy_mac_config(struct ieee80211_hw *hw)
@@ -152,11 +151,10 @@ bool _rtl92cu_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
152 u32 arraylength; 151 u32 arraylength;
153 u32 *ptrarray; 152 u32 *ptrarray;
154 153
155 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Read Rtl819XMACPHY_Array\n")); 154 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n");
156 arraylength = rtlphy->hwparam_tables[MAC_REG].length ; 155 arraylength = rtlphy->hwparam_tables[MAC_REG].length ;
157 ptrarray = rtlphy->hwparam_tables[MAC_REG].pdata; 156 ptrarray = rtlphy->hwparam_tables[MAC_REG].pdata;
158 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 157 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CEMAC_2T_ARRAY\n");
159 ("Img:RTL8192CEMAC_2T_ARRAY\n"));
160 for (i = 0; i < arraylength; i = i + 2) 158 for (i = 0; i < arraylength; i = i + 2)
161 rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); 159 rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]);
162 return true; 160 return true;
@@ -202,10 +200,9 @@ bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
202 phy_regarray_table[i + 1]); 200 phy_regarray_table[i + 1]);
203 udelay(1); 201 udelay(1);
204 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 202 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
205 ("The phy_regarray_table[0] is %x" 203 "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
206 " Rtl819XPHY_REGArray[1] is %x\n", 204 phy_regarray_table[i],
207 phy_regarray_table[i], 205 phy_regarray_table[i + 1]);
208 phy_regarray_table[i + 1]));
209 } 206 }
210 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { 207 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) {
211 for (i = 0; i < agctab_arraylen; i = i + 2) { 208 for (i = 0; i < agctab_arraylen; i = i + 2) {
@@ -213,10 +210,9 @@ bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
213 agctab_array_table[i + 1]); 210 agctab_array_table[i + 1]);
214 udelay(1); 211 udelay(1);
215 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 212 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
216 ("The agctab_array_table[0] is " 213 "The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
217 "%x Rtl819XPHY_REGArray[1] is %x\n", 214 agctab_array_table[i],
218 agctab_array_table[i], 215 agctab_array_table[i + 1]);
219 agctab_array_table[i + 1]));
220 } 216 }
221 } 217 }
222 return true; 218 return true;
@@ -255,7 +251,7 @@ bool _rtl92cu_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
255 } 251 }
256 } else { 252 } else {
257 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 253 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
258 ("configtype != BaseBand_Config_PHY_REG\n")); 254 "configtype != BaseBand_Config_PHY_REG\n");
259 } 255 }
260 return true; 256 return true;
261} 257}
@@ -277,20 +273,20 @@ bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
277 radiob_arraylen = rtlphy->hwparam_tables[RADIOB_2T].length; 273 radiob_arraylen = rtlphy->hwparam_tables[RADIOB_2T].length;
278 radiob_array_table = rtlphy->hwparam_tables[RADIOB_2T].pdata; 274 radiob_array_table = rtlphy->hwparam_tables[RADIOB_2T].pdata;
279 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 275 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
280 ("Radio_A:RTL8192CERADIOA_2TARRAY\n")); 276 "Radio_A:RTL8192CERADIOA_2TARRAY\n");
281 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 277 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
282 ("Radio_B:RTL8192CE_RADIOB_2TARRAY\n")); 278 "Radio_B:RTL8192CE_RADIOB_2TARRAY\n");
283 } else { 279 } else {
284 radioa_arraylen = rtlphy->hwparam_tables[RADIOA_1T].length; 280 radioa_arraylen = rtlphy->hwparam_tables[RADIOA_1T].length;
285 radioa_array_table = rtlphy->hwparam_tables[RADIOA_1T].pdata; 281 radioa_array_table = rtlphy->hwparam_tables[RADIOA_1T].pdata;
286 radiob_arraylen = rtlphy->hwparam_tables[RADIOB_1T].length; 282 radiob_arraylen = rtlphy->hwparam_tables[RADIOB_1T].length;
287 radiob_array_table = rtlphy->hwparam_tables[RADIOB_1T].pdata; 283 radiob_array_table = rtlphy->hwparam_tables[RADIOB_1T].pdata;
288 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 284 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
289 ("Radio_A:RTL8192CE_RADIOA_1TARRAY\n")); 285 "Radio_A:RTL8192CE_RADIOA_1TARRAY\n");
290 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 286 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
291 ("Radio_B:RTL8192CE_RADIOB_1TARRAY\n")); 287 "Radio_B:RTL8192CE_RADIOB_1TARRAY\n");
292 } 288 }
293 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Radio No %x\n", rfpath)); 289 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath);
294 switch (rfpath) { 290 switch (rfpath) {
295 case RF90_PATH_A: 291 case RF90_PATH_A:
296 for (i = 0; i < radioa_arraylen; i = i + 2) { 292 for (i = 0; i < radioa_arraylen; i = i + 2) {
@@ -338,11 +334,11 @@ bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
338 break; 334 break;
339 case RF90_PATH_C: 335 case RF90_PATH_C:
340 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 336 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
341 ("switch case not process\n")); 337 "switch case not processed\n");
342 break; 338 break;
343 case RF90_PATH_D: 339 case RF90_PATH_D:
344 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 340 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
345 ("switch case not process\n")); 341 "switch case not processed\n");
346 break; 342 break;
347 } 343 }
348 return true; 344 return true;
@@ -357,10 +353,9 @@ void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
357 u8 reg_bw_opmode; 353 u8 reg_bw_opmode;
358 u8 reg_prsr_rsc; 354 u8 reg_prsr_rsc;
359 355
360 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, 356 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n",
361 ("Switch to %s bandwidth\n", 357 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
362 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? 358 "20MHz" : "40MHz");
363 "20MHz" : "40MHz"))
364 if (is_hal_stop(rtlhal)) { 359 if (is_hal_stop(rtlhal)) {
365 rtlphy->set_bwmode_inprogress = false; 360 rtlphy->set_bwmode_inprogress = false;
366 return; 361 return;
@@ -381,7 +376,7 @@ void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
381 break; 376 break;
382 default: 377 default:
383 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 378 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
384 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 379 "unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
385 break; 380 break;
386 } 381 }
387 switch (rtlphy->current_chan_bw) { 382 switch (rtlphy->current_chan_bw) {
@@ -403,12 +398,12 @@ void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
403 break; 398 break;
404 default: 399 default:
405 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 400 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
406 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 401 "unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
407 break; 402 break;
408 } 403 }
409 rtl92cu_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); 404 rtl92cu_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
410 rtlphy->set_bwmode_inprogress = false; 405 rtlphy->set_bwmode_inprogress = false;
411 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 406 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n");
412} 407}
413 408
414void rtl92cu_bb_block_on(struct ieee80211_hw *hw) 409void rtl92cu_bb_block_on(struct ieee80211_hw *hw)
@@ -480,7 +475,7 @@ static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
480 do { 475 do {
481 InitializeCount++; 476 InitializeCount++;
482 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 477 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
483 ("IPS Set eRf nic enable\n")); 478 "IPS Set eRf nic enable\n");
484 rtstatus = rtl_ps_enable_nic(hw); 479 rtstatus = rtl_ps_enable_nic(hw);
485 } while ((rtstatus != true) 480 } while ((rtstatus != true)
486 && (InitializeCount < 10)); 481 && (InitializeCount < 10));
@@ -488,10 +483,9 @@ static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
488 RT_RF_OFF_LEVL_HALT_NIC); 483 RT_RF_OFF_LEVL_HALT_NIC);
489 } else { 484 } else {
490 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 485 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
491 ("Set ERFON sleeped:%d ms\n", 486 "Set ERFON sleeped:%d ms\n",
492 jiffies_to_msecs(jiffies - 487 jiffies_to_msecs(jiffies -
493 ppsc-> 488 ppsc->last_sleep_jiffies));
494 last_sleep_jiffies)));
495 ppsc->last_awake_jiffies = jiffies; 489 ppsc->last_awake_jiffies = jiffies;
496 rtl92ce_phy_set_rf_on(hw); 490 rtl92ce_phy_set_rf_on(hw);
497 } 491 }
@@ -513,27 +507,25 @@ static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
513 continue; 507 continue;
514 } else { 508 } else {
515 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 509 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
516 ("eRf Off/Sleep: %d times " 510 "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
517 "TcbBusyQueue[%d] " 511 i + 1,
518 "=%d before doze!\n", (i + 1), 512 queue_id,
519 queue_id, 513 skb_queue_len(&ring->queue));
520 skb_queue_len(&ring->queue)));
521 udelay(10); 514 udelay(10);
522 i++; 515 i++;
523 } 516 }
524 if (i >= MAX_DOZE_WAITING_TIMES_9x) { 517 if (i >= MAX_DOZE_WAITING_TIMES_9x) {
525 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 518 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
526 ("\nERFOFF: %d times " 519 "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n",
527 "TcbBusyQueue[%d] = %d !\n", 520 MAX_DOZE_WAITING_TIMES_9x,
528 MAX_DOZE_WAITING_TIMES_9x, 521 queue_id,
529 queue_id, 522 skb_queue_len(&ring->queue));
530 skb_queue_len(&ring->queue)));
531 break; 523 break;
532 } 524 }
533 } 525 }
534 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { 526 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) {
535 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 527 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
536 ("IPS Set eRf nic disable\n")); 528 "IPS Set eRf nic disable\n");
537 rtl_ps_disable_nic(hw); 529 rtl_ps_disable_nic(hw);
538 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); 530 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
539 } else { 531 } else {
@@ -557,33 +549,30 @@ static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
557 continue; 549 continue;
558 } else { 550 } else {
559 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 551 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
560 ("eRf Off/Sleep: %d times " 552 "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
561 "TcbBusyQueue[%d] =%d before " 553 i + 1, queue_id,
562 "doze!\n", (i + 1), queue_id, 554 skb_queue_len(&ring->queue));
563 skb_queue_len(&ring->queue)));
564 udelay(10); 555 udelay(10);
565 i++; 556 i++;
566 } 557 }
567 if (i >= MAX_DOZE_WAITING_TIMES_9x) { 558 if (i >= MAX_DOZE_WAITING_TIMES_9x) {
568 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 559 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
569 ("\n ERFSLEEP: %d times " 560 "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
570 "TcbBusyQueue[%d] = %d !\n", 561 MAX_DOZE_WAITING_TIMES_9x,
571 MAX_DOZE_WAITING_TIMES_9x, 562 queue_id,
572 queue_id, 563 skb_queue_len(&ring->queue));
573 skb_queue_len(&ring->queue)));
574 break; 564 break;
575 } 565 }
576 } 566 }
577 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 567 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
578 ("Set ERFSLEEP awaked:%d ms\n", 568 "Set ERFSLEEP awaked:%d ms\n",
579 jiffies_to_msecs(jiffies - 569 jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies));
580 ppsc->last_awake_jiffies)));
581 ppsc->last_sleep_jiffies = jiffies; 570 ppsc->last_sleep_jiffies = jiffies;
582 _rtl92c_phy_set_rf_sleep(hw); 571 _rtl92c_phy_set_rf_sleep(hw);
583 break; 572 break;
584 default: 573 default:
585 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 574 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
586 ("switch case not process\n")); 575 "switch case not processed\n");
587 bresult = false; 576 bresult = false;
588 break; 577 break;
589 } 578 }
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h
index ff81a61729d7..42b068660483 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/reg.h b/drivers/net/wireless/rtlwifi/rtl8192cu/reg.h
index 7f1be614c998..8b81465c629b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/reg.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
index 1e851aae58db..780c0d98a836 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -56,7 +56,7 @@ void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
56 break; 56 break;
57 default: 57 default:
58 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 58 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
59 ("unknown bandwidth: %#X\n", bandwidth)); 59 "unknown bandwidth: %#X\n", bandwidth);
60 break; 60 break;
61 } 61 }
62} 62}
@@ -140,26 +140,26 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
140 rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval); 140 rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval);
141 141
142 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 142 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
143 ("CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, 143 "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n",
144 RTXAGC_A_CCK1_MCS32)); 144 tmpval, RTXAGC_A_CCK1_MCS32);
145 145
146 tmpval = tx_agc[RF90_PATH_A] >> 8; 146 tmpval = tx_agc[RF90_PATH_A] >> 8;
147 if (mac->mode == WIRELESS_MODE_B) 147 if (mac->mode == WIRELESS_MODE_B)
148 tmpval = tmpval & 0xff00ffff; 148 tmpval = tmpval & 0xff00ffff;
149 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); 149 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval);
150 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 150 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
151 ("CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, 151 "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n",
152 RTXAGC_B_CCK11_A_CCK2_11)); 152 tmpval, RTXAGC_B_CCK11_A_CCK2_11);
153 tmpval = tx_agc[RF90_PATH_B] >> 24; 153 tmpval = tx_agc[RF90_PATH_B] >> 24;
154 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval); 154 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval);
155 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 155 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
156 ("CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, 156 "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n",
157 RTXAGC_B_CCK11_A_CCK2_11)); 157 tmpval, RTXAGC_B_CCK11_A_CCK2_11);
158 tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff; 158 tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff;
159 rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval); 159 rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval);
160 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 160 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
161 ("CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, 161 "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n",
162 RTXAGC_B_CCK1_55_MCS32)); 162 tmpval, RTXAGC_B_CCK1_55_MCS32);
163} 163}
164 164
165static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw, 165static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
@@ -181,8 +181,8 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
181 (powerBase0 << 8) | powerBase0; 181 (powerBase0 << 8) | powerBase0;
182 *(ofdmbase + i) = powerBase0; 182 *(ofdmbase + i) = powerBase0;
183 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 183 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
184 (" [OFDM power base index rf(%c) = 0x%x]\n", 184 " [OFDM power base index rf(%c) = 0x%x]\n",
185 ((i == 0) ? 'A' : 'B'), *(ofdmbase + i))); 185 i == 0 ? 'A' : 'B', *(ofdmbase + i));
186 } 186 }
187 for (i = 0; i < 2; i++) { 187 for (i = 0; i < 2; i++) {
188 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) { 188 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) {
@@ -194,8 +194,8 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
194 (powerBase1 << 16) | (powerBase1 << 8) | powerBase1; 194 (powerBase1 << 16) | (powerBase1 << 8) | powerBase1;
195 *(mcsbase + i) = powerBase1; 195 *(mcsbase + i) = powerBase1;
196 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 196 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
197 (" [MCS power base index rf(%c) = 0x%x]\n", 197 " [MCS power base index rf(%c) = 0x%x]\n",
198 ((i == 0) ? 'A' : 'B'), *(mcsbase + i))); 198 i == 0 ? 'A' : 'B', *(mcsbase + i));
199 } 199 }
200} 200}
201 201
@@ -219,8 +219,8 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
219 [chnlgroup][index + (rf ? 8 : 0)] 219 [chnlgroup][index + (rf ? 8 : 0)]
220 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 220 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]);
221 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 221 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
222 ("RTK better performance,writeVal(%c) = 0x%x\n", 222 "RTK better performance,writeVal(%c) = 0x%x\n",
223 ((rf == 0) ? 'A' : 'B'), writeVal)); 223 rf == 0 ? 'A' : 'B', writeVal);
224 break; 224 break;
225 case 1: 225 case 1:
226 if (rtlphy->pwrgroup_cnt == 1) 226 if (rtlphy->pwrgroup_cnt == 1)
@@ -244,32 +244,31 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
244 ((index < 2) ? powerBase0[rf] : 244 ((index < 2) ? powerBase0[rf] :
245 powerBase1[rf]); 245 powerBase1[rf]);
246 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 246 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
247 ("Realtek regulatory, 20MHz, " 247 "Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n",
248 "writeVal(%c) = 0x%x\n", 248 rf == 0 ? 'A' : 'B', writeVal);
249 ((rf == 0) ? 'A' : 'B'), writeVal));
250 break; 249 break;
251 case 2: 250 case 2:
252 writeVal = ((index < 2) ? powerBase0[rf] : 251 writeVal = ((index < 2) ? powerBase0[rf] :
253 powerBase1[rf]); 252 powerBase1[rf]);
254 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 253 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
255 ("Better regulatory,writeVal(%c) = 0x%x\n", 254 "Better regulatory,writeVal(%c) = 0x%x\n",
256 ((rf == 0) ? 'A' : 'B'), writeVal)); 255 rf == 0 ? 'A' : 'B', writeVal);
257 break; 256 break;
258 case 3: 257 case 3:
259 chnlgroup = 0; 258 chnlgroup = 0;
260 if (rtlphy->current_chan_bw == 259 if (rtlphy->current_chan_bw ==
261 HT_CHANNEL_WIDTH_20_40) { 260 HT_CHANNEL_WIDTH_20_40) {
262 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 261 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
263 ("customer's limit, 40MHzrf(%c) = " 262 "customer's limit, 40MHzrf(%c) = 0x%x\n",
264 "0x%x\n", ((rf == 0) ? 'A' : 'B'), 263 rf == 0 ? 'A' : 'B',
265 rtlefuse->pwrgroup_ht40[rf] 264 rtlefuse->pwrgroup_ht40[rf]
266 [channel - 1])); 265 [channel - 1]);
267 } else { 266 } else {
268 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 267 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
269 ("customer's limit, 20MHz rf(%c) = " 268 "customer's limit, 20MHz rf(%c) = 0x%x\n",
270 "0x%x\n", ((rf == 0) ? 'A' : 'B'), 269 rf == 0 ? 'A' : 'B',
271 rtlefuse->pwrgroup_ht20[rf] 270 rtlefuse->pwrgroup_ht20[rf]
272 [channel - 1])); 271 [channel - 1]);
273 } 272 }
274 for (i = 0; i < 4; i++) { 273 for (i = 0; i < 4; i++) {
275 pwr_diff_limit[i] = 274 pwr_diff_limit[i] =
@@ -297,22 +296,22 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
297 (pwr_diff_limit[2] << 16) | 296 (pwr_diff_limit[2] << 16) |
298 (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]); 297 (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]);
299 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 298 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
300 ("Customer's limit rf(%c) = 0x%x\n", 299 "Customer's limit rf(%c) = 0x%x\n",
301 ((rf == 0) ? 'A' : 'B'), customer_limit)); 300 rf == 0 ? 'A' : 'B', customer_limit);
302 writeVal = customer_limit + ((index < 2) ? 301 writeVal = customer_limit + ((index < 2) ?
303 powerBase0[rf] : powerBase1[rf]); 302 powerBase0[rf] : powerBase1[rf]);
304 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 303 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
305 ("Customer, writeVal rf(%c)= 0x%x\n", 304 "Customer, writeVal rf(%c)= 0x%x\n",
306 ((rf == 0) ? 'A' : 'B'), writeVal)); 305 rf == 0 ? 'A' : 'B', writeVal);
307 break; 306 break;
308 default: 307 default:
309 chnlgroup = 0; 308 chnlgroup = 0;
310 writeVal = rtlphy->mcs_txpwrlevel_origoffset[chnlgroup] 309 writeVal = rtlphy->mcs_txpwrlevel_origoffset[chnlgroup]
311 [index + (rf ? 8 : 0)] + ((index < 2) ? 310 [index + (rf ? 8 : 0)] + ((index < 2) ?
312 powerBase0[rf] : powerBase1[rf]); 311 powerBase0[rf] : powerBase1[rf]);
313 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, ("RTK better " 312 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
314 "performance, writeValrf(%c) = 0x%x\n", 313 "RTK better performance, writeValrf(%c) = 0x%x\n",
315 ((rf == 0) ? 'A' : 'B'), writeVal)); 314 rf == 0 ? 'A' : 'B', writeVal);
316 break; 315 break;
317 } 316 }
318 if (rtlpriv->dm.dynamic_txhighpower_lvl == 317 if (rtlpriv->dm.dynamic_txhighpower_lvl ==
@@ -365,7 +364,7 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
365 regoffset = regoffset_b[index]; 364 regoffset = regoffset_b[index];
366 rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal); 365 rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal);
367 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 366 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
368 ("Set 0x%x = %08x\n", regoffset, writeVal)); 367 "Set 0x%x = %08x\n", regoffset, writeVal);
369 if (((get_rf_type(rtlphy) == RF_2T2R) && 368 if (((get_rf_type(rtlphy) == RF_2T2R) &&
370 (regoffset == RTXAGC_A_MCS15_MCS12 || 369 (regoffset == RTXAGC_A_MCS15_MCS12 ||
371 regoffset == RTXAGC_B_MCS15_MCS12)) || 370 regoffset == RTXAGC_B_MCS15_MCS12)) ||
@@ -482,11 +481,11 @@ static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw)
482 } 481 }
483 if (rtstatus != true) { 482 if (rtstatus != true) {
484 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 483 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
485 ("Radio[%d] Fail!!", rfpath)); 484 "Radio[%d] Fail!!", rfpath);
486 goto phy_rf_cfg_fail; 485 goto phy_rf_cfg_fail;
487 } 486 }
488 } 487 }
489 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("<---\n")); 488 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n");
490 return rtstatus; 489 return rtstatus;
491phy_rf_cfg_fail: 490phy_rf_cfg_fail:
492 return rtstatus; 491 return rtstatus;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
index 500a2094b6bb..090fd33a158d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 6d2ca773bbc7..82c85286ab2e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -41,7 +41,6 @@
41#include "trx.h" 41#include "trx.h"
42#include "led.h" 42#include "led.h"
43#include "hw.h" 43#include "hw.h"
44#include <linux/vmalloc.h>
45#include <linux/module.h> 44#include <linux/module.h>
46 45
47MODULE_AUTHOR("Georgia <georgia@realtek.com>"); 46MODULE_AUTHOR("Georgia <georgia@realtek.com>");
@@ -54,7 +53,6 @@ MODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin");
54static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) 53static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
55{ 54{
56 struct rtl_priv *rtlpriv = rtl_priv(hw); 55 struct rtl_priv *rtlpriv = rtl_priv(hw);
57 const struct firmware *firmware;
58 int err; 56 int err;
59 57
60 rtlpriv->dm.dm_initialgain_enable = true; 58 rtlpriv->dm.dm_initialgain_enable = true;
@@ -62,29 +60,21 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
62 rtlpriv->dm.disable_framebursting = false; 60 rtlpriv->dm.disable_framebursting = false;
63 rtlpriv->dm.thermalvalue = 0; 61 rtlpriv->dm.thermalvalue = 0;
64 rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; 62 rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug;
65 rtlpriv->rtlhal.pfirmware = vmalloc(0x4000); 63
64 /* for firmware buf */
65 rtlpriv->rtlhal.pfirmware = vzalloc(0x4000);
66 if (!rtlpriv->rtlhal.pfirmware) { 66 if (!rtlpriv->rtlhal.pfirmware) {
67 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 67 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
68 ("Can't alloc buffer for fw.\n")); 68 "Can't alloc buffer for fw\n");
69 return 1; 69 return 1;
70 } 70 }
71 /* request fw */ 71
72 err = request_firmware(&firmware, rtlpriv->cfg->fw_name, 72 pr_info("Loading firmware %s\n", rtlpriv->cfg->fw_name);
73 rtlpriv->io.dev); 73 rtlpriv->max_fw_size = 0x4000;
74 if (err) { 74 err = request_firmware_nowait(THIS_MODULE, 1,
75 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 75 rtlpriv->cfg->fw_name, rtlpriv->io.dev,
76 ("Failed to request firmware!\n")); 76 GFP_KERNEL, hw, rtl_fw_cb);
77 return 1; 77
78 }
79 if (firmware->size > 0x4000) {
80 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
81 ("Firmware is too big!\n"));
82 release_firmware(firmware);
83 return 1;
84 }
85 memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size);
86 rtlpriv->rtlhal.fwsize = firmware->size;
87 release_firmware(firmware);
88 78
89 return 0; 79 return 0;
90} 80}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
index 43b1177924ab..a1310abd0d54 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/table.c b/drivers/net/wireless/rtlwifi/rtl8192cu/table.c
index d57ef5e88a9e..966be519edb8 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/table.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/table.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/table.h b/drivers/net/wireless/rtlwifi/rtl8192cu/table.h
index c3d5cd826cfa..4b020e9e30b1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/table.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/table.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
index b3cc7b949992..21bc827c5fa6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -108,7 +108,7 @@ static void _TwoOutEpMapping(struct ieee80211_hw *hw, bool bIsChipB,
108 108
109 if (bwificfg) { /* for WMM */ 109 if (bwificfg) { /* for WMM */
110 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 110 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
111 ("USB Chip-B & WMM Setting.....\n")); 111 "USB Chip-B & WMM Setting.....\n");
112 ep_map->ep_mapping[RTL_TXQ_BE] = 2; 112 ep_map->ep_mapping[RTL_TXQ_BE] = 2;
113 ep_map->ep_mapping[RTL_TXQ_BK] = 3; 113 ep_map->ep_mapping[RTL_TXQ_BK] = 3;
114 ep_map->ep_mapping[RTL_TXQ_VI] = 3; 114 ep_map->ep_mapping[RTL_TXQ_VI] = 3;
@@ -118,7 +118,7 @@ static void _TwoOutEpMapping(struct ieee80211_hw *hw, bool bIsChipB,
118 ep_map->ep_mapping[RTL_TXQ_HI] = 2; 118 ep_map->ep_mapping[RTL_TXQ_HI] = 2;
119 } else { /* typical setting */ 119 } else { /* typical setting */
120 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 120 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
121 ("USB typical Setting.....\n")); 121 "USB typical Setting.....\n");
122 ep_map->ep_mapping[RTL_TXQ_BE] = 3; 122 ep_map->ep_mapping[RTL_TXQ_BE] = 3;
123 ep_map->ep_mapping[RTL_TXQ_BK] = 3; 123 ep_map->ep_mapping[RTL_TXQ_BK] = 3;
124 ep_map->ep_mapping[RTL_TXQ_VI] = 2; 124 ep_map->ep_mapping[RTL_TXQ_VI] = 2;
@@ -135,7 +135,7 @@ static void _ThreeOutEpMapping(struct ieee80211_hw *hw, bool bwificfg,
135 struct rtl_priv *rtlpriv = rtl_priv(hw); 135 struct rtl_priv *rtlpriv = rtl_priv(hw);
136 if (bwificfg) { /* for WMM */ 136 if (bwificfg) { /* for WMM */
137 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 137 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
138 ("USB 3EP Setting for WMM.....\n")); 138 "USB 3EP Setting for WMM.....\n");
139 ep_map->ep_mapping[RTL_TXQ_BE] = 5; 139 ep_map->ep_mapping[RTL_TXQ_BE] = 5;
140 ep_map->ep_mapping[RTL_TXQ_BK] = 3; 140 ep_map->ep_mapping[RTL_TXQ_BK] = 3;
141 ep_map->ep_mapping[RTL_TXQ_VI] = 3; 141 ep_map->ep_mapping[RTL_TXQ_VI] = 3;
@@ -145,7 +145,7 @@ static void _ThreeOutEpMapping(struct ieee80211_hw *hw, bool bwificfg,
145 ep_map->ep_mapping[RTL_TXQ_HI] = 2; 145 ep_map->ep_mapping[RTL_TXQ_HI] = 2;
146 } else { /* typical setting */ 146 } else { /* typical setting */
147 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 147 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
148 ("USB 3EP Setting for typical.....\n")); 148 "USB 3EP Setting for typical.....\n");
149 ep_map->ep_mapping[RTL_TXQ_BE] = 5; 149 ep_map->ep_mapping[RTL_TXQ_BE] = 5;
150 ep_map->ep_mapping[RTL_TXQ_BK] = 5; 150 ep_map->ep_mapping[RTL_TXQ_BK] = 5;
151 ep_map->ep_mapping[RTL_TXQ_VI] = 3; 151 ep_map->ep_mapping[RTL_TXQ_VI] = 3;
@@ -244,8 +244,8 @@ u16 rtl8192cu_mq_to_hwq(__le16 fc, u16 mac80211_queue_index)
244 break; 244 break;
245 default: 245 default:
246 hw_queue_index = RTL_TXQ_BE; 246 hw_queue_index = RTL_TXQ_BE;
247 RT_ASSERT(false, ("QSLT_BE queue, skb_queue:%d\n", 247 RT_ASSERT(false, "QSLT_BE queue, skb_queue:%d\n",
248 mac80211_queue_index)); 248 mac80211_queue_index);
249 break; 249 break;
250 } 250 }
251out: 251out:
@@ -270,23 +270,23 @@ static enum rtl_desc_qsel _rtl8192cu_mq_to_descq(struct ieee80211_hw *hw,
270 case 0: /* VO */ 270 case 0: /* VO */
271 qsel = QSLT_VO; 271 qsel = QSLT_VO;
272 RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG, 272 RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG,
273 ("VO queue, set qsel = 0x%x\n", QSLT_VO)); 273 "VO queue, set qsel = 0x%x\n", QSLT_VO);
274 break; 274 break;
275 case 1: /* VI */ 275 case 1: /* VI */
276 qsel = QSLT_VI; 276 qsel = QSLT_VI;
277 RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG, 277 RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG,
278 ("VI queue, set qsel = 0x%x\n", QSLT_VI)); 278 "VI queue, set qsel = 0x%x\n", QSLT_VI);
279 break; 279 break;
280 case 3: /* BK */ 280 case 3: /* BK */
281 qsel = QSLT_BK; 281 qsel = QSLT_BK;
282 RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG, 282 RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG,
283 ("BK queue, set qsel = 0x%x\n", QSLT_BK)); 283 "BK queue, set qsel = 0x%x\n", QSLT_BK);
284 break; 284 break;
285 case 2: /* BE */ 285 case 2: /* BE */
286 default: 286 default:
287 qsel = QSLT_BE; 287 qsel = QSLT_BE;
288 RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG, 288 RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG,
289 ("BE queue, set qsel = 0x%x\n", QSLT_BE)); 289 "BE queue, set qsel = 0x%x\n", QSLT_BE);
290 break; 290 break;
291 } 291 }
292out: 292out:
@@ -422,17 +422,17 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)
422 bv = ieee80211_is_probe_resp(fc); 422 bv = ieee80211_is_probe_resp(fc);
423 if (bv) 423 if (bv)
424 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 424 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
425 ("Got probe response frame.\n")); 425 "Got probe response frame\n");
426 if (ieee80211_is_beacon(fc)) 426 if (ieee80211_is_beacon(fc))
427 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 427 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Got beacon frame\n");
428 ("Got beacon frame.\n"));
429 if (ieee80211_is_data(fc)) 428 if (ieee80211_is_data(fc))
430 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Got data frame.\n")); 429 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Got data frame\n");
431 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 430 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
432 ("Fram: fc = 0x%X addr1 = 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:" 431 "Fram: fc = 0x%X addr1 = 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n",
433 "0x%02X\n", fc, (u32)hdr->addr1[0], (u32)hdr->addr1[1], 432 fc,
434 (u32)hdr->addr1[2], (u32)hdr->addr1[3], (u32)hdr->addr1[4], 433 (u32)hdr->addr1[0], (u32)hdr->addr1[1],
435 (u32)hdr->addr1[5])); 434 (u32)hdr->addr1[2], (u32)hdr->addr1[3],
435 (u32)hdr->addr1[4], (u32)hdr->addr1[5]);
436 memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status)); 436 memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status));
437 ieee80211_rx_irqsafe(hw, skb); 437 ieee80211_rx_irqsafe(hw, skb);
438} 438}
@@ -594,7 +594,7 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
594 if (ieee80211_is_data_qos(fc)) { 594 if (ieee80211_is_data_qos(fc)) {
595 if (mac->rdg_en) { 595 if (mac->rdg_en) {
596 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 596 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
597 ("Enable RDG function.\n")); 597 "Enable RDG function\n");
598 SET_TX_DESC_RDG_ENABLE(txdesc, 1); 598 SET_TX_DESC_RDG_ENABLE(txdesc, 1);
599 SET_TX_DESC_HTC(txdesc, 1); 599 SET_TX_DESC_HTC(txdesc, 1);
600 } 600 }
@@ -620,7 +620,7 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
620 SET_TX_DESC_BMC(txdesc, 1); 620 SET_TX_DESC_BMC(txdesc, 1);
621 _rtl_fill_usb_tx_desc(txdesc); 621 _rtl_fill_usb_tx_desc(txdesc);
622 _rtl_tx_desc_checksum(txdesc); 622 _rtl_tx_desc_checksum(txdesc);
623 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, (" %s ==>\n", __func__)); 623 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "==>\n");
624} 624}
625 625
626void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, 626void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc,
@@ -677,7 +677,7 @@ void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
677 SET_TX_DESC_HWSEQ_EN(pdesc, 1); 677 SET_TX_DESC_HWSEQ_EN(pdesc, 1);
678 SET_TX_DESC_PKT_ID(pdesc, 8); 678 SET_TX_DESC_PKT_ID(pdesc, 8);
679 } 679 }
680 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, "H2C Tx Cmd Content\n", 680 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, "H2C Tx Cmd Content",
681 pdesc, RTL_TX_DESC_SIZE); 681 pdesc, RTL_TX_DESC_SIZE);
682} 682}
683 683
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
index 53de5f66e242..332b06e78b00 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/def.h b/drivers/net/wireless/rtlwifi/rtl8192de/def.h
index 946304771748..eafdf76ed64d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/def.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/def.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
index 3cd0736fe8e1..181ed6fc90e6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -246,23 +246,21 @@ static void rtl92d_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw)
246 rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 2); 246 rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 2);
247 rtl92d_release_cckandrw_pagea_ctl(hw, &flag); 247 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
248 } 248 }
249 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("Cnt_Fast_Fsync_fail = %x, " 249 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
250 "Cnt_SB_Search_fail = %x\n", 250 "Cnt_Fast_Fsync_fail = %x, Cnt_SB_Search_fail = %x\n",
251 falsealm_cnt->cnt_fast_fsync_fail, 251 falsealm_cnt->cnt_fast_fsync_fail,
252 falsealm_cnt->cnt_sb_search_fail)); 252 falsealm_cnt->cnt_sb_search_fail);
253 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("Cnt_Parity_Fail = %x, " 253 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
254 "Cnt_Rate_Illegal = %x, Cnt_Crc8_fail = %x, " 254 "Cnt_Parity_Fail = %x, Cnt_Rate_Illegal = %x, Cnt_Crc8_fail = %x, Cnt_Mcs_fail = %x\n",
255 "Cnt_Mcs_fail = %x\n",
256 falsealm_cnt->cnt_parity_fail, 255 falsealm_cnt->cnt_parity_fail,
257 falsealm_cnt->cnt_rate_illegal, 256 falsealm_cnt->cnt_rate_illegal,
258 falsealm_cnt->cnt_crc8_fail, 257 falsealm_cnt->cnt_crc8_fail,
259 falsealm_cnt->cnt_mcs_fail)); 258 falsealm_cnt->cnt_mcs_fail);
260 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 259 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
261 ("Cnt_Ofdm_fail = %x, " "Cnt_Cck_fail = %x, " 260 "Cnt_Ofdm_fail = %x, Cnt_Cck_fail = %x, Cnt_all = %x\n",
262 "Cnt_all = %x\n",
263 falsealm_cnt->cnt_ofdm_fail, 261 falsealm_cnt->cnt_ofdm_fail,
264 falsealm_cnt->cnt_cck_fail, 262 falsealm_cnt->cnt_cck_fail,
265 falsealm_cnt->cnt_all)); 263 falsealm_cnt->cnt_all);
266} 264}
267 265
268static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw) 266static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw)
@@ -275,7 +273,7 @@ static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw)
275 (rtlpriv->dm.UNDEC_SM_PWDB == 0)) { 273 (rtlpriv->dm.UNDEC_SM_PWDB == 0)) {
276 de_digtable.min_undecorated_pwdb_for_dm = 0; 274 de_digtable.min_undecorated_pwdb_for_dm = 0;
277 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, 275 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
278 ("Not connected to any\n")); 276 "Not connected to any\n");
279 } 277 }
280 if (mac->link_state >= MAC80211_LINKED) { 278 if (mac->link_state >= MAC80211_LINKED) {
281 if (mac->opmode == NL80211_IFTYPE_AP || 279 if (mac->opmode == NL80211_IFTYPE_AP ||
@@ -283,25 +281,25 @@ static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw)
283 de_digtable.min_undecorated_pwdb_for_dm = 281 de_digtable.min_undecorated_pwdb_for_dm =
284 rtlpriv->dm.UNDEC_SM_PWDB; 282 rtlpriv->dm.UNDEC_SM_PWDB;
285 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, 283 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
286 ("AP Client PWDB = 0x%lx\n", 284 "AP Client PWDB = 0x%lx\n",
287 rtlpriv->dm.UNDEC_SM_PWDB)); 285 rtlpriv->dm.UNDEC_SM_PWDB);
288 } else { 286 } else {
289 de_digtable.min_undecorated_pwdb_for_dm = 287 de_digtable.min_undecorated_pwdb_for_dm =
290 rtlpriv->dm.undecorated_smoothed_pwdb; 288 rtlpriv->dm.undecorated_smoothed_pwdb;
291 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, 289 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
292 ("STA Default Port PWDB = 0x%x\n", 290 "STA Default Port PWDB = 0x%x\n",
293 de_digtable.min_undecorated_pwdb_for_dm)); 291 de_digtable.min_undecorated_pwdb_for_dm);
294 } 292 }
295 } else { 293 } else {
296 de_digtable.min_undecorated_pwdb_for_dm = 294 de_digtable.min_undecorated_pwdb_for_dm =
297 rtlpriv->dm.UNDEC_SM_PWDB; 295 rtlpriv->dm.UNDEC_SM_PWDB;
298 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, 296 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
299 ("AP Ext Port or disconnet PWDB = 0x%x\n", 297 "AP Ext Port or disconnet PWDB = 0x%x\n",
300 de_digtable.min_undecorated_pwdb_for_dm)); 298 de_digtable.min_undecorated_pwdb_for_dm);
301 } 299 }
302 300
303 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n", 301 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n",
304 de_digtable.min_undecorated_pwdb_for_dm)); 302 de_digtable.min_undecorated_pwdb_for_dm);
305} 303}
306 304
307static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) 305static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
@@ -340,14 +338,14 @@ static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
340 } 338 }
341 de_digtable.pre_cck_pd_state = de_digtable.cur_cck_pd_state; 339 de_digtable.pre_cck_pd_state = de_digtable.cur_cck_pd_state;
342 } 340 }
343 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("CurSTAConnectState=%s\n", 341 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CurSTAConnectState=%s\n",
344 (de_digtable.cursta_connectctate == DIG_STA_CONNECT ? 342 de_digtable.cursta_connectctate == DIG_STA_CONNECT ?
345 "DIG_STA_CONNECT " : "DIG_STA_DISCONNECT"))); 343 "DIG_STA_CONNECT " : "DIG_STA_DISCONNECT");
346 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("CCKPDStage=%s\n", 344 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CCKPDStage=%s\n",
347 (de_digtable.cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI ? 345 de_digtable.cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI ?
348 "Low RSSI " : "High RSSI "))); 346 "Low RSSI " : "High RSSI ");
349 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("is92d single phy =%x\n", 347 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "is92d single phy =%x\n",
350 IS_92D_SINGLEPHY(rtlpriv->rtlhal.version))); 348 IS_92D_SINGLEPHY(rtlpriv->rtlhal.version));
351 349
352} 350}
353 351
@@ -355,12 +353,12 @@ void rtl92d_dm_write_dig(struct ieee80211_hw *hw)
355{ 353{
356 struct rtl_priv *rtlpriv = rtl_priv(hw); 354 struct rtl_priv *rtlpriv = rtl_priv(hw);
357 355
358 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("cur_igvalue = 0x%x, " 356 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
359 "pre_igvalue = 0x%x, backoff_val = %d\n", 357 "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n",
360 de_digtable.cur_igvalue, de_digtable.pre_igvalue, 358 de_digtable.cur_igvalue, de_digtable.pre_igvalue,
361 de_digtable.backoff_val)); 359 de_digtable.backoff_val);
362 if (de_digtable.dig_enable_flag == false) { 360 if (de_digtable.dig_enable_flag == false) {
363 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("DIG is disabled\n")); 361 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "DIG is disabled\n");
364 de_digtable.pre_igvalue = 0x17; 362 de_digtable.pre_igvalue = 0x17;
365 return; 363 return;
366 } 364 }
@@ -377,22 +375,21 @@ static void rtl92d_early_mode_enabled(struct rtl_priv *rtlpriv)
377{ 375{
378 if ((rtlpriv->mac80211.link_state >= MAC80211_LINKED) && 376 if ((rtlpriv->mac80211.link_state >= MAC80211_LINKED) &&
379 (rtlpriv->mac80211.vendor == PEER_CISCO)) { 377 (rtlpriv->mac80211.vendor == PEER_CISCO)) {
380 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 378 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "IOT_PEER = CISCO\n");
381 ("IOT_PEER = CISCO\n"));
382 if (de_digtable.last_min_undecorated_pwdb_for_dm >= 50 379 if (de_digtable.last_min_undecorated_pwdb_for_dm >= 50
383 && de_digtable.min_undecorated_pwdb_for_dm < 50) { 380 && de_digtable.min_undecorated_pwdb_for_dm < 50) {
384 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x00); 381 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x00);
385 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 382 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
386 ("Early Mode Off\n")); 383 "Early Mode Off\n");
387 } else if (de_digtable.last_min_undecorated_pwdb_for_dm <= 55 && 384 } else if (de_digtable.last_min_undecorated_pwdb_for_dm <= 55 &&
388 de_digtable.min_undecorated_pwdb_for_dm > 55) { 385 de_digtable.min_undecorated_pwdb_for_dm > 55) {
389 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f); 386 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f);
390 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 387 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
391 ("Early Mode On\n")); 388 "Early Mode On\n");
392 } 389 }
393 } else if (!(rtl_read_byte(rtlpriv, REG_EARLY_MODE_CONTROL) & 0xf)) { 390 } else if (!(rtl_read_byte(rtlpriv, REG_EARLY_MODE_CONTROL) & 0xf)) {
394 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f); 391 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f);
395 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("Early Mode On\n")); 392 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "Early Mode On\n");
396 } 393 }
397} 394}
398 395
@@ -402,7 +399,7 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw)
402 u8 value_igi = de_digtable.cur_igvalue; 399 u8 value_igi = de_digtable.cur_igvalue;
403 struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); 400 struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt);
404 401
405 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("==>\n")); 402 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "==>\n");
406 if (rtlpriv->rtlhal.earlymode_enable) { 403 if (rtlpriv->rtlhal.earlymode_enable) {
407 rtl92d_early_mode_enabled(rtlpriv); 404 rtl92d_early_mode_enabled(rtlpriv);
408 de_digtable.last_min_undecorated_pwdb_for_dm = 405 de_digtable.last_min_undecorated_pwdb_for_dm =
@@ -421,7 +418,7 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw)
421 /* Not STA mode return tmp */ 418 /* Not STA mode return tmp */
422 if (rtlpriv->mac80211.opmode != NL80211_IFTYPE_STATION) 419 if (rtlpriv->mac80211.opmode != NL80211_IFTYPE_STATION)
423 return; 420 return;
424 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("progress\n")); 421 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "progress\n");
425 /* Decide the current status and if modify initial gain or not */ 422 /* Decide the current status and if modify initial gain or not */
426 if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) 423 if (rtlpriv->mac80211.link_state >= MAC80211_LINKED)
427 de_digtable.cursta_connectctate = DIG_STA_CONNECT; 424 de_digtable.cursta_connectctate = DIG_STA_CONNECT;
@@ -438,16 +435,16 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw)
438 else if (falsealm_cnt->cnt_all >= DM_DIG_FA_TH2) 435 else if (falsealm_cnt->cnt_all >= DM_DIG_FA_TH2)
439 value_igi += 2; 436 value_igi += 2;
440 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 437 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
441 ("dm_DIG() Before: large_fa_hit=%d, forbidden_igi=%x\n", 438 "dm_DIG() Before: large_fa_hit=%d, forbidden_igi=%x\n",
442 de_digtable.large_fa_hit, de_digtable.forbidden_igi)); 439 de_digtable.large_fa_hit, de_digtable.forbidden_igi);
443 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 440 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
444 ("dm_DIG() Before: Recover_cnt=%d, rx_gain_range_min=%x\n", 441 "dm_DIG() Before: Recover_cnt=%d, rx_gain_range_min=%x\n",
445 de_digtable.recover_cnt, de_digtable.rx_gain_range_min)); 442 de_digtable.recover_cnt, de_digtable.rx_gain_range_min);
446 443
447 /* deal with abnorally large false alarm */ 444 /* deal with abnorally large false alarm */
448 if (falsealm_cnt->cnt_all > 10000) { 445 if (falsealm_cnt->cnt_all > 10000) {
449 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 446 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
450 ("dm_DIG(): Abnornally false alarm case.\n")); 447 "dm_DIG(): Abnormally false alarm case\n");
451 448
452 de_digtable.large_fa_hit++; 449 de_digtable.large_fa_hit++;
453 if (de_digtable.forbidden_igi < de_digtable.cur_igvalue) { 450 if (de_digtable.forbidden_igi < de_digtable.cur_igvalue) {
@@ -486,11 +483,11 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw)
486 } 483 }
487 } 484 }
488 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 485 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
489 ("dm_DIG() After: large_fa_hit=%d, forbidden_igi=%x\n", 486 "dm_DIG() After: large_fa_hit=%d, forbidden_igi=%x\n",
490 de_digtable.large_fa_hit, de_digtable.forbidden_igi)); 487 de_digtable.large_fa_hit, de_digtable.forbidden_igi);
491 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 488 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
492 ("dm_DIG() After: recover_cnt=%d, rx_gain_range_min=%x\n", 489 "dm_DIG() After: recover_cnt=%d, rx_gain_range_min=%x\n",
493 de_digtable.recover_cnt, de_digtable.rx_gain_range_min)); 490 de_digtable.recover_cnt, de_digtable.rx_gain_range_min);
494 491
495 if (value_igi > DM_DIG_MAX) 492 if (value_igi > DM_DIG_MAX)
496 value_igi = DM_DIG_MAX; 493 value_igi = DM_DIG_MAX;
@@ -500,7 +497,7 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw)
500 rtl92d_dm_write_dig(hw); 497 rtl92d_dm_write_dig(hw);
501 if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G) 498 if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G)
502 rtl92d_dm_cck_packet_detection_thresh(hw); 499 rtl92d_dm_cck_packet_detection_thresh(hw);
503 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, ("<<==\n")); 500 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "<<==\n");
504} 501}
505 502
506static void rtl92d_dm_init_dynamic_txpower(struct ieee80211_hw *hw) 503static void rtl92d_dm_init_dynamic_txpower(struct ieee80211_hw *hw)
@@ -528,7 +525,7 @@ static void rtl92d_dm_dynamic_txpower(struct ieee80211_hw *hw)
528 if ((mac->link_state < MAC80211_LINKED) && 525 if ((mac->link_state < MAC80211_LINKED) &&
529 (rtlpriv->dm.UNDEC_SM_PWDB == 0)) { 526 (rtlpriv->dm.UNDEC_SM_PWDB == 0)) {
530 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 527 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
531 ("Not connected to any\n")); 528 "Not connected to any\n");
532 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; 529 rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL;
533 rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; 530 rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL;
534 return; 531 return;
@@ -538,40 +535,40 @@ static void rtl92d_dm_dynamic_txpower(struct ieee80211_hw *hw)
538 undecorated_smoothed_pwdb = 535 undecorated_smoothed_pwdb =
539 rtlpriv->dm.UNDEC_SM_PWDB; 536 rtlpriv->dm.UNDEC_SM_PWDB;
540 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 537 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
541 ("IBSS Client PWDB = 0x%lx\n", 538 "IBSS Client PWDB = 0x%lx\n",
542 undecorated_smoothed_pwdb)); 539 undecorated_smoothed_pwdb);
543 } else { 540 } else {
544 undecorated_smoothed_pwdb = 541 undecorated_smoothed_pwdb =
545 rtlpriv->dm.undecorated_smoothed_pwdb; 542 rtlpriv->dm.undecorated_smoothed_pwdb;
546 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 543 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
547 ("STA Default Port PWDB = 0x%lx\n", 544 "STA Default Port PWDB = 0x%lx\n",
548 undecorated_smoothed_pwdb)); 545 undecorated_smoothed_pwdb);
549 } 546 }
550 } else { 547 } else {
551 undecorated_smoothed_pwdb = 548 undecorated_smoothed_pwdb =
552 rtlpriv->dm.UNDEC_SM_PWDB; 549 rtlpriv->dm.UNDEC_SM_PWDB;
553 550
554 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 551 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
555 ("AP Ext Port PWDB = 0x%lx\n", 552 "AP Ext Port PWDB = 0x%lx\n",
556 undecorated_smoothed_pwdb)); 553 undecorated_smoothed_pwdb);
557 } 554 }
558 if (rtlhal->current_bandtype == BAND_ON_5G) { 555 if (rtlhal->current_bandtype == BAND_ON_5G) {
559 if (undecorated_smoothed_pwdb >= 0x33) { 556 if (undecorated_smoothed_pwdb >= 0x33) {
560 rtlpriv->dm.dynamic_txhighpower_lvl = 557 rtlpriv->dm.dynamic_txhighpower_lvl =
561 TXHIGHPWRLEVEL_LEVEL2; 558 TXHIGHPWRLEVEL_LEVEL2;
562 RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD, 559 RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD,
563 ("5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n")); 560 "5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n");
564 } else if ((undecorated_smoothed_pwdb < 0x33) 561 } else if ((undecorated_smoothed_pwdb < 0x33)
565 && (undecorated_smoothed_pwdb >= 0x2b)) { 562 && (undecorated_smoothed_pwdb >= 0x2b)) {
566 rtlpriv->dm.dynamic_txhighpower_lvl = 563 rtlpriv->dm.dynamic_txhighpower_lvl =
567 TXHIGHPWRLEVEL_LEVEL1; 564 TXHIGHPWRLEVEL_LEVEL1;
568 RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD, 565 RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD,
569 ("5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n")); 566 "5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n");
570 } else if (undecorated_smoothed_pwdb < 0x2b) { 567 } else if (undecorated_smoothed_pwdb < 0x2b) {
571 rtlpriv->dm.dynamic_txhighpower_lvl = 568 rtlpriv->dm.dynamic_txhighpower_lvl =
572 TXHIGHPWRLEVEL_NORMAL; 569 TXHIGHPWRLEVEL_NORMAL;
573 RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD, 570 RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD,
574 ("5G:TxHighPwrLevel_Normal\n")); 571 "5G:TxHighPwrLevel_Normal\n");
575 } 572 }
576 } else { 573 } else {
577 if (undecorated_smoothed_pwdb >= 574 if (undecorated_smoothed_pwdb >=
@@ -579,7 +576,7 @@ static void rtl92d_dm_dynamic_txpower(struct ieee80211_hw *hw)
579 rtlpriv->dm.dynamic_txhighpower_lvl = 576 rtlpriv->dm.dynamic_txhighpower_lvl =
580 TXHIGHPWRLEVEL_LEVEL2; 577 TXHIGHPWRLEVEL_LEVEL2;
581 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 578 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
582 ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n")); 579 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n");
583 } else 580 } else
584 if ((undecorated_smoothed_pwdb < 581 if ((undecorated_smoothed_pwdb <
585 (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) 582 (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3))
@@ -589,19 +586,19 @@ static void rtl92d_dm_dynamic_txpower(struct ieee80211_hw *hw)
589 rtlpriv->dm.dynamic_txhighpower_lvl = 586 rtlpriv->dm.dynamic_txhighpower_lvl =
590 TXHIGHPWRLEVEL_LEVEL1; 587 TXHIGHPWRLEVEL_LEVEL1;
591 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 588 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
592 ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n")); 589 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n");
593 } else if (undecorated_smoothed_pwdb < 590 } else if (undecorated_smoothed_pwdb <
594 (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { 591 (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) {
595 rtlpriv->dm.dynamic_txhighpower_lvl = 592 rtlpriv->dm.dynamic_txhighpower_lvl =
596 TXHIGHPWRLEVEL_NORMAL; 593 TXHIGHPWRLEVEL_NORMAL;
597 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 594 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
598 ("TXHIGHPWRLEVEL_NORMAL\n")); 595 "TXHIGHPWRLEVEL_NORMAL\n");
599 } 596 }
600 } 597 }
601 if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { 598 if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) {
602 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 599 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
603 ("PHY_SetTxPowerLevel8192S() Channel = %d\n", 600 "PHY_SetTxPowerLevel8192S() Channel = %d\n",
604 rtlphy->current_channel)); 601 rtlphy->current_channel);
605 rtl92d_phy_set_txpower_level(hw, rtlphy->current_channel); 602 rtl92d_phy_set_txpower_level(hw, rtlphy->current_channel);
606 } 603 }
607 rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; 604 rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl;
@@ -717,7 +714,7 @@ static void rtl92d_dm_rxgain_tracking_thermalmeter(struct ieee80211_hw *hw)
717 u4tmp = (index_mapping[(rtlpriv->efuse.eeprom_thermalmeter - 714 u4tmp = (index_mapping[(rtlpriv->efuse.eeprom_thermalmeter -
718 rtlpriv->dm.thermalvalue_rxgain)]) << 12; 715 rtlpriv->dm.thermalvalue_rxgain)]) << 12;
719 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 716 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
720 ("===> Rx Gain %x\n", u4tmp)); 717 "===> Rx Gain %x\n", u4tmp);
721 for (i = RF90_PATH_A; i < rtlpriv->phy.num_total_rfpath; i++) 718 for (i = RF90_PATH_A; i < rtlpriv->phy.num_total_rfpath; i++)
722 rtl_set_rfreg(hw, i, 0x3C, BRFREGOFFSETMASK, 719 rtl_set_rfreg(hw, i, 0x3C, BRFREGOFFSETMASK,
723 (rtlpriv->phy.reg_rf3c[i] & (~(0xF000))) | u4tmp); 720 (rtlpriv->phy.reg_rf3c[i] & (~(0xF000))) | u4tmp);
@@ -741,27 +738,22 @@ static void rtl92d_bandtype_2_4G(struct ieee80211_hw *hw, long *temp_cckg,
741 if (!memcmp((void *)&temp_cck, 738 if (!memcmp((void *)&temp_cck,
742 (void *)&cckswing_table_ch14[i][2], 4)) { 739 (void *)&cckswing_table_ch14[i][2], 4)) {
743 *cck_index_old = (u8) i; 740 *cck_index_old = (u8) i;
744 RT_TRACE(rtlpriv, 741 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
745 COMP_POWER_TRACKING, 742 "Initial reg0x%x = 0x%lx, cck_index=0x%x, ch 14 %d\n",
746 DBG_LOUD, 743 RCCK0_TXFILTER2, temp_cck,
747 ("Initial reg0x%x = 0x%lx, " 744 *cck_index_old,
748 "cck_index=0x%x, ch 14 %d\n", 745 rtlpriv->dm.cck_inch14);
749 RCCK0_TXFILTER2,
750 temp_cck, *cck_index_old,
751 rtlpriv->dm.cck_inch14));
752 break; 746 break;
753 } 747 }
754 } else { 748 } else {
755 if (!memcmp((void *) &temp_cck, 749 if (!memcmp((void *) &temp_cck,
756 &cckswing_table_ch1ch13[i][2], 4)) { 750 &cckswing_table_ch1ch13[i][2], 4)) {
757 *cck_index_old = (u8) i; 751 *cck_index_old = (u8) i;
758 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, 752 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
759 DBG_LOUD, 753 "Initial reg0x%x = 0x%lx, cck_index = 0x%x, ch14 %d\n",
760 ("Initial reg0x%x = 0x%lx, " 754 RCCK0_TXFILTER2, temp_cck,
761 "cck_index = 0x%x, ch14 %d\n", 755 *cck_index_old,
762 RCCK0_TXFILTER2, 756 rtlpriv->dm.cck_inch14);
763 temp_cck, *cck_index_old,
764 rtlpriv->dm.cck_inch14));
765 break; 757 break;
766 } 758 }
767 } 759 }
@@ -884,12 +876,12 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
884 }; 876 };
885 877
886 rtlpriv->dm.txpower_trackinginit = true; 878 rtlpriv->dm.txpower_trackinginit = true;
887 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, ("\n")); 879 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "\n");
888 thermalvalue = (u8) rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0xf800); 880 thermalvalue = (u8) rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0xf800);
889 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 881 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
890 ("Readback Thermal Meter = 0x%x pre thermal meter 0x%x " 882 "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x\n",
891 "eeprom_thermalmeter 0x%x\n", thermalvalue, 883 thermalvalue,
892 rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter)); 884 rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter);
893 rtl92d_phy_ap_calibrate(hw, (thermalvalue - 885 rtl92d_phy_ap_calibrate(hw, (thermalvalue -
894 rtlefuse->eeprom_thermalmeter)); 886 rtlefuse->eeprom_thermalmeter));
895 if (is2t) 887 if (is2t)
@@ -904,10 +896,9 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
904 ofdm_index_old[0] = (u8) i; 896 ofdm_index_old[0] = (u8) i;
905 897
906 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 898 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
907 ("Initial pathA ele_d reg0x%x = 0x%lx," 899 "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n",
908 " ofdm_index=0x%x\n",
909 ROFDM0_XATxIQIMBALANCE, 900 ROFDM0_XATxIQIMBALANCE,
910 ele_d, ofdm_index_old[0])); 901 ele_d, ofdm_index_old[0]);
911 break; 902 break;
912 } 903 }
913 } 904 }
@@ -920,11 +911,9 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
920 ofdm_index_old[1] = (u8) i; 911 ofdm_index_old[1] = (u8) i;
921 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, 912 RT_TRACE(rtlpriv, COMP_POWER_TRACKING,
922 DBG_LOUD, 913 DBG_LOUD,
923 ("Initial pathB ele_d reg " 914 "Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n",
924 "0x%x = 0x%lx, ofdm_index "
925 "= 0x%x\n",
926 ROFDM0_XBTxIQIMBALANCE, ele_d, 915 ROFDM0_XBTxIQIMBALANCE, ele_d,
927 ofdm_index_old[1])); 916 ofdm_index_old[1]);
928 break; 917 break;
929 } 918 }
930 } 919 }
@@ -952,7 +941,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
952 rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i]; 941 rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i];
953 rtlpriv->dm.cck_index = cck_index_old; 942 rtlpriv->dm.cck_index = cck_index_old;
954 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 943 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
955 ("reload ofdm index for band switch\n")); 944 "reload ofdm index for band switch\n");
956 } 945 }
957 rtlpriv->dm.thermalvalue_avg 946 rtlpriv->dm.thermalvalue_avg
958 [rtlpriv->dm.thermalvalue_avg_index] = thermalvalue; 947 [rtlpriv->dm.thermalvalue_avg_index] = thermalvalue;
@@ -995,12 +984,10 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
995 (thermalvalue - rtlpriv->dm.thermalvalue_rxgain) : 984 (thermalvalue - rtlpriv->dm.thermalvalue_rxgain) :
996 (rtlpriv->dm.thermalvalue_rxgain - thermalvalue); 985 (rtlpriv->dm.thermalvalue_rxgain - thermalvalue);
997 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 986 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
998 ("Readback Thermal Meter = 0x%x pre thermal meter 0x%x" 987 "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x delta 0x%x delta_lck 0x%x delta_iqk 0x%x\n",
999 " eeprom_thermalmeter 0x%x delta 0x%x " 988 thermalvalue, rtlpriv->dm.thermalvalue,
1000 "delta_lck 0x%x delta_iqk 0x%x\n", 989 rtlefuse->eeprom_thermalmeter, delta, delta_lck,
1001 thermalvalue, rtlpriv->dm.thermalvalue, 990 delta_iqk);
1002 rtlefuse->eeprom_thermalmeter, delta, delta_lck,
1003 delta_iqk));
1004 if ((delta_lck > rtlefuse->delta_lck) && 991 if ((delta_lck > rtlefuse->delta_lck) &&
1005 (rtlefuse->delta_lck != 0)) { 992 (rtlefuse->delta_lck != 0)) {
1006 rtlpriv->dm.thermalvalue_lck = thermalvalue; 993 rtlpriv->dm.thermalvalue_lck = thermalvalue;
@@ -1036,17 +1023,15 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1036 } 1023 }
1037 if (is2t) { 1024 if (is2t) {
1038 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1025 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1039 ("temp OFDM_A_index=0x%x, OFDM_B_index" 1026 "temp OFDM_A_index=0x%x, OFDM_B_index = 0x%x,cck_index=0x%x\n",
1040 " = 0x%x,cck_index=0x%x\n", 1027 rtlpriv->dm.ofdm_index[0],
1041 rtlpriv->dm.ofdm_index[0], 1028 rtlpriv->dm.ofdm_index[1],
1042 rtlpriv->dm.ofdm_index[1], 1029 rtlpriv->dm.cck_index);
1043 rtlpriv->dm.cck_index));
1044 } else { 1030 } else {
1045 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1031 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1046 ("temp OFDM_A_index=0x%x,cck_index = " 1032 "temp OFDM_A_index=0x%x,cck_index = 0x%x\n",
1047 "0x%x\n", 1033 rtlpriv->dm.ofdm_index[0],
1048 rtlpriv->dm.ofdm_index[0], 1034 rtlpriv->dm.cck_index);
1049 rtlpriv->dm.cck_index));
1050 } 1035 }
1051 for (i = 0; i < rf; i++) { 1036 for (i = 0; i < rf; i++) {
1052 if (ofdm_index[i] > OFDM_TABLE_SIZE_92D - 1) 1037 if (ofdm_index[i] > OFDM_TABLE_SIZE_92D - 1)
@@ -1070,15 +1055,13 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1070 } 1055 }
1071 if (is2t) { 1056 if (is2t) {
1072 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1057 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1073 ("new OFDM_A_index=0x%x, OFDM_B_index " 1058 "new OFDM_A_index=0x%x, OFDM_B_index = 0x%x, cck_index=0x%x\n",
1074 "= 0x%x, cck_index=0x%x\n",
1075 ofdm_index[0], ofdm_index[1], 1059 ofdm_index[0], ofdm_index[1],
1076 cck_index)); 1060 cck_index);
1077 } else { 1061 } else {
1078 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1062 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1079 ("new OFDM_A_index=0x%x,cck_index = " 1063 "new OFDM_A_index=0x%x,cck_index = 0x%x\n",
1080 "0x%x\n", 1064 ofdm_index[0], cck_index);
1081 ofdm_index[0], cck_index));
1082 } 1065 }
1083 ele_d = (ofdmswing_table[(u8) ofdm_index[0]] & 1066 ele_d = (ofdmswing_table[(u8) ofdm_index[0]] &
1084 0xFFC00000) >> 22; 1067 0xFFC00000) >> 22;
@@ -1124,12 +1107,10 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1124 } 1107 }
1125 1108
1126 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1109 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1127 ("TxPwrTracking for interface %d path A: X =" 1110 "TxPwrTracking for interface %d path A: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xe94 = 0x%lx 0xe9c = 0x%lx\n",
1128 " 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = " 1111 rtlhal->interfaceindex,
1129 "0x%lx ele_D = 0x%lx 0xe94 = 0x%lx 0xe9c = "
1130 "0x%lx\n", rtlhal->interfaceindex,
1131 val_x, val_y, ele_a, ele_c, ele_d, 1112 val_x, val_y, ele_a, ele_c, ele_d,
1132 val_x, val_y)); 1113 val_x, val_y);
1133 1114
1134 if (rtlhal->current_bandtype == BAND_ON_2_4G) { 1115 if (rtlhal->current_bandtype == BAND_ON_2_4G) {
1135 /* Adjust CCK according to IQK result */ 1116 /* Adjust CCK according to IQK result */
@@ -1232,20 +1213,16 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1232 BIT(28), 0x00); 1213 BIT(28), 0x00);
1233 } 1214 }
1234 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1215 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1235 ("TxPwrTracking path B: X = 0x%lx, " 1216 "TxPwrTracking path B: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xeb4 = 0x%lx 0xebc = 0x%lx\n",
1236 "Y = 0x%lx ele_A = 0x%lx ele_C = 0x" 1217 val_x, val_y, ele_a, ele_c,
1237 "%lx ele_D = 0x%lx 0xeb4 = 0x%lx " 1218 ele_d, val_x, val_y);
1238 "0xebc = 0x%lx\n",
1239 val_x, val_y, ele_a, ele_c,
1240 ele_d, val_x, val_y));
1241 } 1219 }
1242 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1220 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1243 ("TxPwrTracking 0xc80 = 0x%x, 0xc94 = " 1221 "TxPwrTracking 0xc80 = 0x%x, 0xc94 = 0x%x RF 0x24 = 0x%x\n",
1244 "0x%x RF 0x24 = 0x%x\n",
1245 rtl_get_bbreg(hw, 0xc80, BMASKDWORD), 1222 rtl_get_bbreg(hw, 0xc80, BMASKDWORD),
1246 rtl_get_bbreg(hw, 0xc94, BMASKDWORD), 1223 rtl_get_bbreg(hw, 0xc94, BMASKDWORD),
1247 rtl_get_rfreg(hw, RF90_PATH_A, 0x24, 1224 rtl_get_rfreg(hw, RF90_PATH_A, 0x24,
1248 BRFREGOFFSETMASK))); 1225 BRFREGOFFSETMASK));
1249 } 1226 }
1250 if ((delta_iqk > rtlefuse->delta_iqk) && 1227 if ((delta_iqk > rtlefuse->delta_iqk) &&
1251 (rtlefuse->delta_iqk != 0)) { 1228 (rtlefuse->delta_iqk != 0)) {
@@ -1262,7 +1239,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1262 rtlpriv->dm.thermalvalue = thermalvalue; 1239 rtlpriv->dm.thermalvalue = thermalvalue;
1263 } 1240 }
1264 1241
1265 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, ("<===\n")); 1242 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<===\n");
1266} 1243}
1267 1244
1268static void rtl92d_dm_initialize_txpower_tracking(struct ieee80211_hw *hw) 1245static void rtl92d_dm_initialize_txpower_tracking(struct ieee80211_hw *hw)
@@ -1273,8 +1250,8 @@ static void rtl92d_dm_initialize_txpower_tracking(struct ieee80211_hw *hw)
1273 rtlpriv->dm.txpower_trackinginit = false; 1250 rtlpriv->dm.txpower_trackinginit = false;
1274 rtlpriv->dm.txpower_track_control = true; 1251 rtlpriv->dm.txpower_track_control = true;
1275 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1252 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1276 ("pMgntInfo->txpower_tracking = %d\n", 1253 "pMgntInfo->txpower_tracking = %d\n",
1277 rtlpriv->dm.txpower_tracking)); 1254 rtlpriv->dm.txpower_tracking);
1278} 1255}
1279 1256
1280void rtl92d_dm_check_txpower_tracking_thermal_meter(struct ieee80211_hw *hw) 1257void rtl92d_dm_check_txpower_tracking_thermal_meter(struct ieee80211_hw *hw)
@@ -1289,12 +1266,12 @@ void rtl92d_dm_check_txpower_tracking_thermal_meter(struct ieee80211_hw *hw)
1289 rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, BIT(17) | 1266 rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, BIT(17) |
1290 BIT(16), 0x03); 1267 BIT(16), 0x03);
1291 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1268 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1292 ("Trigger 92S Thermal Meter!!\n")); 1269 "Trigger 92S Thermal Meter!!\n");
1293 tm_trigger = 1; 1270 tm_trigger = 1;
1294 return; 1271 return;
1295 } else { 1272 } else {
1296 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 1273 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
1297 ("Schedule TxPowerTracking direct call!!\n")); 1274 "Schedule TxPowerTracking direct call!!\n");
1298 rtl92d_dm_txpower_tracking_callback_thermalmeter(hw); 1275 rtl92d_dm_txpower_tracking_callback_thermalmeter(hw);
1299 tm_trigger = 0; 1276 tm_trigger = 0;
1300 } 1277 }
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/dm.h b/drivers/net/wireless/rtlwifi/rtl8192de/dm.h
index 69354657f0f5..91030ec8ac3e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/dm.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/dm.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/fw.c b/drivers/net/wireless/rtlwifi/rtl8192de/fw.c
index 82f060bdbc0b..f548a8d0068d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/fw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/fw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -124,14 +124,14 @@ static void _rtl92d_write_fw(struct ieee80211_hw *hw,
124 u32 pagenums, remainSize; 124 u32 pagenums, remainSize;
125 u32 page, offset; 125 u32 page, offset;
126 126
127 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, ("FW size is %d bytes,\n", size)); 127 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "FW size is %d bytes,\n", size);
128 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE) 128 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE)
129 _rtl92d_fill_dummy(bufferPtr, &size); 129 _rtl92d_fill_dummy(bufferPtr, &size);
130 pagenums = size / FW_8192D_PAGE_SIZE; 130 pagenums = size / FW_8192D_PAGE_SIZE;
131 remainSize = size % FW_8192D_PAGE_SIZE; 131 remainSize = size % FW_8192D_PAGE_SIZE;
132 if (pagenums > 8) { 132 if (pagenums > 8) {
133 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 133 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
134 ("Page numbers should not greater then 8\n")); 134 "Page numbers should not greater then 8\n");
135 } 135 }
136 for (page = 0; page < pagenums; page++) { 136 for (page = 0; page < pagenums; page++) {
137 offset = page * FW_8192D_PAGE_SIZE; 137 offset = page * FW_8192D_PAGE_SIZE;
@@ -158,12 +158,12 @@ static int _rtl92d_fw_free_to_go(struct ieee80211_hw *hw)
158 (!(value32 & FWDL_ChkSum_rpt))); 158 (!(value32 & FWDL_ChkSum_rpt)));
159 if (counter >= FW_8192D_POLLING_TIMEOUT_COUNT) { 159 if (counter >= FW_8192D_POLLING_TIMEOUT_COUNT) {
160 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 160 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
161 ("chksum report faill ! REG_MCUFWDL:0x%08x .\n", 161 "chksum report faill ! REG_MCUFWDL:0x%08x\n",
162 value32)); 162 value32);
163 return -EIO; 163 return -EIO;
164 } 164 }
165 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, 165 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE,
166 ("Checksum report OK ! REG_MCUFWDL:0x%08x .\n", value32)); 166 "Checksum report OK ! REG_MCUFWDL:0x%08x\n", value32);
167 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); 167 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
168 value32 |= MCUFWDL_RDY; 168 value32 |= MCUFWDL_RDY;
169 rtl_write_dword(rtlpriv, REG_MCUFWDL, value32); 169 rtl_write_dword(rtlpriv, REG_MCUFWDL, value32);
@@ -186,9 +186,9 @@ void rtl92d_firmware_selfreset(struct ieee80211_hw *hw)
186 udelay(50); 186 udelay(50);
187 u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); 187 u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
188 } 188 }
189 RT_ASSERT((delay > 0), ("8051 reset failed!\n")); 189 RT_ASSERT((delay > 0), "8051 reset failed!\n");
190 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, 190 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
191 ("=====> 8051 reset success (%d) .\n", delay)); 191 "=====> 8051 reset success (%d)\n", delay);
192} 192}
193 193
194static int _rtl92d_fw_init(struct ieee80211_hw *hw) 194static int _rtl92d_fw_init(struct ieee80211_hw *hw)
@@ -197,7 +197,7 @@ static int _rtl92d_fw_init(struct ieee80211_hw *hw)
197 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 197 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
198 u32 counter; 198 u32 counter;
199 199
200 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, ("FW already have download\n")); 200 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, "FW already have download\n");
201 /* polling for FW ready */ 201 /* polling for FW ready */
202 counter = 0; 202 counter = 0;
203 do { 203 do {
@@ -205,10 +205,9 @@ static int _rtl92d_fw_init(struct ieee80211_hw *hw)
205 if (rtl_read_byte(rtlpriv, FW_MAC0_READY) & 205 if (rtl_read_byte(rtlpriv, FW_MAC0_READY) &
206 MAC0_READY) { 206 MAC0_READY) {
207 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, 207 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
208 ("Polling FW ready success!! " 208 "Polling FW ready success!! REG_MCUFWDL: 0x%x\n",
209 "REG_MCUFWDL: 0x%x .\n",
210 rtl_read_byte(rtlpriv, 209 rtl_read_byte(rtlpriv,
211 FW_MAC0_READY))); 210 FW_MAC0_READY));
212 return 0; 211 return 0;
213 } 212 }
214 udelay(5); 213 udelay(5);
@@ -216,10 +215,9 @@ static int _rtl92d_fw_init(struct ieee80211_hw *hw)
216 if (rtl_read_byte(rtlpriv, FW_MAC1_READY) & 215 if (rtl_read_byte(rtlpriv, FW_MAC1_READY) &
217 MAC1_READY) { 216 MAC1_READY) {
218 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, 217 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
219 ("Polling FW ready success!! " 218 "Polling FW ready success!! REG_MCUFWDL: 0x%x\n",
220 "REG_MCUFWDL: 0x%x .\n",
221 rtl_read_byte(rtlpriv, 219 rtl_read_byte(rtlpriv,
222 FW_MAC1_READY))); 220 FW_MAC1_READY));
223 return 0; 221 return 0;
224 } 222 }
225 udelay(5); 223 udelay(5);
@@ -228,18 +226,16 @@ static int _rtl92d_fw_init(struct ieee80211_hw *hw)
228 226
229 if (rtlhal->interfaceindex == 0) { 227 if (rtlhal->interfaceindex == 0) {
230 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, 228 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
231 ("Polling FW ready fail!! MAC0 FW init not ready: " 229 "Polling FW ready fail!! MAC0 FW init not ready: 0x%x\n",
232 "0x%x .\n", 230 rtl_read_byte(rtlpriv, FW_MAC0_READY));
233 rtl_read_byte(rtlpriv, FW_MAC0_READY)));
234 } else { 231 } else {
235 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, 232 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
236 ("Polling FW ready fail!! MAC1 FW init not ready: " 233 "Polling FW ready fail!! MAC1 FW init not ready: 0x%x\n",
237 "0x%x .\n", 234 rtl_read_byte(rtlpriv, FW_MAC1_READY));
238 rtl_read_byte(rtlpriv, FW_MAC1_READY)));
239 } 235 }
240 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, 236 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
241 ("Polling FW ready fail!! REG_MCUFWDL:0x%08ul .\n", 237 "Polling FW ready fail!! REG_MCUFWDL:0x%08ul\n",
242 rtl_read_dword(rtlpriv, REG_MCUFWDL))); 238 rtl_read_dword(rtlpriv, REG_MCUFWDL));
243 return -1; 239 return -1;
244} 240}
245 241
@@ -257,20 +253,20 @@ int rtl92d_download_fw(struct ieee80211_hw *hw)
257 bool fw_downloaded = false, fwdl_in_process = false; 253 bool fw_downloaded = false, fwdl_in_process = false;
258 unsigned long flags; 254 unsigned long flags;
259 255
260 if (!rtlhal->pfirmware) 256 if (rtlpriv->max_fw_size == 0 || !rtlhal->pfirmware)
261 return 1; 257 return 1;
262 fwsize = rtlhal->fwsize; 258 fwsize = rtlhal->fwsize;
263 pfwheader = (u8 *) rtlhal->pfirmware; 259 pfwheader = (u8 *) rtlhal->pfirmware;
264 pfwdata = (u8 *) rtlhal->pfirmware; 260 pfwdata = (u8 *) rtlhal->pfirmware;
265 rtlhal->fw_version = (u16) GET_FIRMWARE_HDR_VERSION(pfwheader); 261 rtlhal->fw_version = (u16) GET_FIRMWARE_HDR_VERSION(pfwheader);
266 rtlhal->fw_subversion = (u16) GET_FIRMWARE_HDR_SUB_VER(pfwheader); 262 rtlhal->fw_subversion = (u16) GET_FIRMWARE_HDR_SUB_VER(pfwheader);
267 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, (" FirmwareVersion(%d)," 263 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
268 "FirmwareSubVersion(%d), Signature(%#x)\n", 264 "FirmwareVersion(%d), FirmwareSubVersion(%d), Signature(%#x)\n",
269 rtlhal->fw_version, rtlhal->fw_subversion, 265 rtlhal->fw_version, rtlhal->fw_subversion,
270 GET_FIRMWARE_HDR_SIGNATURE(pfwheader))); 266 GET_FIRMWARE_HDR_SIGNATURE(pfwheader));
271 if (IS_FW_HEADER_EXIST(pfwheader)) { 267 if (IS_FW_HEADER_EXIST(pfwheader)) {
272 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 268 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
273 ("Shift 32 bytes for FW header!!\n")); 269 "Shift 32 bytes for FW header!!\n");
274 pfwdata = pfwdata + 32; 270 pfwdata = pfwdata + 32;
275 fwsize = fwsize - 32; 271 fwsize = fwsize - 32;
276 } 272 }
@@ -302,8 +298,7 @@ int rtl92d_download_fw(struct ieee80211_hw *hw)
302 break; 298 break;
303 else 299 else
304 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, 300 RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG,
305 ("Wait for another mac " 301 "Wait for another mac download fw\n");
306 "download fw\n"));
307 } 302 }
308 spin_lock_irqsave(&globalmutex_for_fwdownload, flags); 303 spin_lock_irqsave(&globalmutex_for_fwdownload, flags);
309 value = rtl_read_byte(rtlpriv, 0x1f); 304 value = rtl_read_byte(rtlpriv, 0x1f);
@@ -337,11 +332,10 @@ int rtl92d_download_fw(struct ieee80211_hw *hw)
337 spin_unlock_irqrestore(&globalmutex_for_fwdownload, flags); 332 spin_unlock_irqrestore(&globalmutex_for_fwdownload, flags);
338 if (err) { 333 if (err) {
339 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 334 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
340 ("fw is not ready to run!\n")); 335 "fw is not ready to run!\n");
341 goto exit; 336 goto exit;
342 } else { 337 } else {
343 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, 338 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "fw is ready to run!\n");
344 ("fw is ready to run!\n"));
345 } 339 }
346exit: 340exit:
347 err = _rtl92d_fw_init(hw); 341 err = _rtl92d_fw_init(hw);
@@ -381,24 +375,24 @@ static void _rtl92d_fill_h2c_command(struct ieee80211_hw *hw,
381 375
382 if (ppsc->rfpwr_state == ERFOFF || ppsc->inactive_pwrstate == ERFOFF) { 376 if (ppsc->rfpwr_state == ERFOFF || ppsc->inactive_pwrstate == ERFOFF) {
383 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 377 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
384 ("Return as RF is off!!!\n")); 378 "Return as RF is off!!!\n");
385 return; 379 return;
386 } 380 }
387 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("come in\n")); 381 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n");
388 while (true) { 382 while (true) {
389 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); 383 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
390 if (rtlhal->h2c_setinprogress) { 384 if (rtlhal->h2c_setinprogress) {
391 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 385 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
392 ("H2C set in progress! Wait to set.." 386 "H2C set in progress! Wait to set..element_id(%d)\n",
393 "element_id(%d).\n", element_id)); 387 element_id);
394 388
395 while (rtlhal->h2c_setinprogress) { 389 while (rtlhal->h2c_setinprogress) {
396 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, 390 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock,
397 flag); 391 flag);
398 h2c_waitcounter++; 392 h2c_waitcounter++;
399 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 393 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
400 ("Wait 100 us (%d times)...\n", 394 "Wait 100 us (%d times)...\n",
401 h2c_waitcounter)); 395 h2c_waitcounter);
402 udelay(100); 396 udelay(100);
403 397
404 if (h2c_waitcounter > 1000) 398 if (h2c_waitcounter > 1000)
@@ -418,8 +412,7 @@ static void _rtl92d_fill_h2c_command(struct ieee80211_hw *hw,
418 wait_writeh2c_limmit--; 412 wait_writeh2c_limmit--;
419 if (wait_writeh2c_limmit == 0) { 413 if (wait_writeh2c_limmit == 0) {
420 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 414 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
421 ("Write H2C fail because no trigger " 415 "Write H2C fail because no trigger for FW INT!\n");
422 "for FW INT!\n"));
423 break; 416 break;
424 } 417 }
425 boxnum = rtlhal->last_hmeboxnum; 418 boxnum = rtlhal->last_hmeboxnum;
@@ -442,7 +435,7 @@ static void _rtl92d_fill_h2c_command(struct ieee80211_hw *hw,
442 break; 435 break;
443 default: 436 default:
444 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 437 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
445 ("switch case not process\n")); 438 "switch case not processed\n");
446 break; 439 break;
447 } 440 }
448 isfw_read = _rtl92d_check_fw_read_last_h2c(hw, boxnum); 441 isfw_read = _rtl92d_check_fw_read_last_h2c(hw, boxnum);
@@ -450,29 +443,29 @@ static void _rtl92d_fill_h2c_command(struct ieee80211_hw *hw,
450 wait_h2c_limmit--; 443 wait_h2c_limmit--;
451 if (wait_h2c_limmit == 0) { 444 if (wait_h2c_limmit == 0) {
452 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 445 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
453 ("Wating too long for FW read " 446 "Waiting too long for FW read clear HMEBox(%d)!\n",
454 "clear HMEBox(%d)!\n", boxnum)); 447 boxnum);
455 break; 448 break;
456 } 449 }
457 udelay(10); 450 udelay(10);
458 isfw_read = _rtl92d_check_fw_read_last_h2c(hw, boxnum); 451 isfw_read = _rtl92d_check_fw_read_last_h2c(hw, boxnum);
459 u1b_tmp = rtl_read_byte(rtlpriv, 0x1BF); 452 u1b_tmp = rtl_read_byte(rtlpriv, 0x1BF);
460 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 453 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
461 ("Wating for FW read clear HMEBox(%d)!!! " 454 "Waiting for FW read clear HMEBox(%d)!!! 0x1BF = %2x\n",
462 "0x1BF = %2x\n", boxnum, u1b_tmp)); 455 boxnum, u1b_tmp);
463 } 456 }
464 if (!isfw_read) { 457 if (!isfw_read) {
465 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 458 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
466 ("Write H2C register BOX[%d] fail!!!!! " 459 "Write H2C register BOX[%d] fail!!!!! Fw do not read.\n",
467 "Fw do not read.\n", boxnum)); 460 boxnum);
468 break; 461 break;
469 } 462 }
470 memset(boxcontent, 0, sizeof(boxcontent)); 463 memset(boxcontent, 0, sizeof(boxcontent));
471 memset(boxextcontent, 0, sizeof(boxextcontent)); 464 memset(boxextcontent, 0, sizeof(boxextcontent));
472 boxcontent[0] = element_id; 465 boxcontent[0] = element_id;
473 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 466 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
474 ("Write element_id box_reg(%4x) = %2x\n", 467 "Write element_id box_reg(%4x) = %2x\n",
475 box_reg, element_id)); 468 box_reg, element_id);
476 switch (cmd_len) { 469 switch (cmd_len) {
477 case 1: 470 case 1:
478 boxcontent[0] &= ~(BIT(7)); 471 boxcontent[0] &= ~(BIT(7));
@@ -519,7 +512,7 @@ static void _rtl92d_fill_h2c_command(struct ieee80211_hw *hw,
519 break; 512 break;
520 default: 513 default:
521 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 514 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
522 ("switch case not process\n")); 515 "switch case not processed\n");
523 break; 516 break;
524 } 517 }
525 bwrite_sucess = true; 518 bwrite_sucess = true;
@@ -527,26 +520,20 @@ static void _rtl92d_fill_h2c_command(struct ieee80211_hw *hw,
527 if (rtlhal->last_hmeboxnum == 4) 520 if (rtlhal->last_hmeboxnum == 4)
528 rtlhal->last_hmeboxnum = 0; 521 rtlhal->last_hmeboxnum = 0;
529 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 522 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
530 ("pHalData->last_hmeboxnum = %d\n", 523 "pHalData->last_hmeboxnum = %d\n",
531 rtlhal->last_hmeboxnum)); 524 rtlhal->last_hmeboxnum);
532 } 525 }
533 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); 526 spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
534 rtlhal->h2c_setinprogress = false; 527 rtlhal->h2c_setinprogress = false;
535 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); 528 spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
536 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("go out\n")); 529 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n");
537} 530}
538 531
539void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw, 532void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw,
540 u8 element_id, u32 cmd_len, u8 *cmdbuffer) 533 u8 element_id, u32 cmd_len, u8 *cmdbuffer)
541{ 534{
542 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
543 u32 tmp_cmdbuf[2]; 535 u32 tmp_cmdbuf[2];
544 536
545 if (rtlhal->fw_ready == false) {
546 RT_ASSERT(false, ("return H2C cmd because of Fw "
547 "download fail!!!\n"));
548 return;
549 }
550 memset(tmp_cmdbuf, 0, 8); 537 memset(tmp_cmdbuf, 0, 8);
551 memcpy(tmp_cmdbuf, cmdbuffer, cmd_len); 538 memcpy(tmp_cmdbuf, cmdbuffer, cmd_len);
552 _rtl92d_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf); 539 _rtl92d_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf);
@@ -559,13 +546,13 @@ void rtl92d_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
559 u8 u1_h2c_set_pwrmode[3] = { 0 }; 546 u8 u1_h2c_set_pwrmode[3] = { 0 };
560 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 547 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
561 548
562 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, ("FW LPS mode = %d\n", mode)); 549 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode);
563 SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, mode); 550 SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, mode);
564 SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, 1); 551 SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, 1);
565 SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(u1_h2c_set_pwrmode, 552 SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(u1_h2c_set_pwrmode,
566 ppsc->reg_max_lps_awakeintvl); 553 ppsc->reg_max_lps_awakeintvl);
567 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 554 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
568 "rtl92d_set_fw_rsvdpagepkt(): u1_h2c_set_pwrmode\n", 555 "rtl92d_set_fw_rsvdpagepkt(): u1_h2c_set_pwrmode",
569 u1_h2c_set_pwrmode, 3); 556 u1_h2c_set_pwrmode, 3);
570 rtl92d_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode); 557 rtl92d_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode);
571} 558}
@@ -757,28 +744,32 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
757 SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG); 744 SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG);
758 totalpacketlen = TOTAL_RESERVED_PKT_LEN; 745 totalpacketlen = TOTAL_RESERVED_PKT_LEN;
759 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, 746 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
760 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", 747 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
761 &reserved_page_packet[0], totalpacketlen); 748 &reserved_page_packet[0], totalpacketlen);
762 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 749 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
763 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", 750 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
764 u1RsvdPageLoc, 3); 751 u1RsvdPageLoc, 3);
765 skb = dev_alloc_skb(totalpacketlen); 752 skb = dev_alloc_skb(totalpacketlen);
766 memcpy((u8 *) skb_put(skb, totalpacketlen), &reserved_page_packet, 753 if (!skb) {
767 totalpacketlen); 754 dlok = false;
768 rtstatus = _rtl92d_cmd_send_packet(hw, skb); 755 } else {
756 memcpy((u8 *) skb_put(skb, totalpacketlen),
757 &reserved_page_packet, totalpacketlen);
758 rtstatus = _rtl92d_cmd_send_packet(hw, skb);
769 759
770 if (rtstatus) 760 if (rtstatus)
771 dlok = true; 761 dlok = true;
762 }
772 if (dlok) { 763 if (dlok) {
773 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 764 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
774 ("Set RSVD page location to Fw.\n")); 765 "Set RSVD page location to Fw\n");
775 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 766 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
776 "H2C_RSVDPAGE:\n", u1RsvdPageLoc, 3); 767 "H2C_RSVDPAGE", u1RsvdPageLoc, 3);
777 rtl92d_fill_h2c_cmd(hw, H2C_RSVDPAGE, 768 rtl92d_fill_h2c_cmd(hw, H2C_RSVDPAGE,
778 sizeof(u1RsvdPageLoc), u1RsvdPageLoc); 769 sizeof(u1RsvdPageLoc), u1RsvdPageLoc);
779 } else 770 } else
780 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 771 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
781 ("Set RSVD page location to Fw FAIL!!!!!!.\n")); 772 "Set RSVD page location to Fw FAIL!!!!!!\n");
782} 773}
783 774
784void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus) 775void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/fw.h b/drivers/net/wireless/rtlwifi/rtl8192de/fw.h
index 0c4d489eaa48..1ffacdda734c 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/fw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/fw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
index 9d89d7ccdafb..7d877125db29 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -166,7 +166,7 @@ void rtl92de_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
166 break; 166 break;
167 default: 167 default:
168 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 168 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
169 ("switch case not process\n")); 169 "switch case not processed\n");
170 break; 170 break;
171 } 171 }
172} 172}
@@ -230,7 +230,7 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
230 u8 e_aci; 230 u8 e_aci;
231 231
232 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 232 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
233 ("HW_VAR_SLOT_TIME %x\n", val[0])); 233 "HW_VAR_SLOT_TIME %x\n", val[0]);
234 rtl_write_byte(rtlpriv, REG_SLOT, val[0]); 234 rtl_write_byte(rtlpriv, REG_SLOT, val[0]);
235 for (e_aci = 0; e_aci < AC_MAX; e_aci++) 235 for (e_aci = 0; e_aci < AC_MAX; e_aci++)
236 rtlpriv->cfg->ops->set_hw_reg(hw, 236 rtlpriv->cfg->ops->set_hw_reg(hw,
@@ -261,8 +261,8 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
261 min_spacing_to_set); 261 min_spacing_to_set);
262 *val = min_spacing_to_set; 262 *val = min_spacing_to_set;
263 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 263 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
264 ("Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", 264 "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n",
265 mac->min_space_cfg)); 265 mac->min_space_cfg);
266 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 266 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE,
267 mac->min_space_cfg); 267 mac->min_space_cfg);
268 } 268 }
@@ -275,8 +275,8 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
275 mac->min_space_cfg = rtlpriv->rtlhal.minspace_cfg; 275 mac->min_space_cfg = rtlpriv->rtlhal.minspace_cfg;
276 mac->min_space_cfg |= (density_to_set << 3); 276 mac->min_space_cfg |= (density_to_set << 3);
277 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 277 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
278 ("Set HW_VAR_SHORTGI_DENSITY: %#x\n", 278 "Set HW_VAR_SHORTGI_DENSITY: %#x\n",
279 mac->min_space_cfg)); 279 mac->min_space_cfg);
280 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 280 rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE,
281 mac->min_space_cfg); 281 mac->min_space_cfg);
282 break; 282 break;
@@ -310,8 +310,8 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
310 } 310 }
311 rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, regtoSet); 311 rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, regtoSet);
312 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 312 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
313 ("Set HW_VAR_AMPDU_FACTOR: %#x\n", 313 "Set HW_VAR_AMPDU_FACTOR: %#x\n",
314 factor_toset)); 314 factor_toset);
315 } 315 }
316 break; 316 break;
317 } 317 }
@@ -344,8 +344,8 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
344 break; 344 break;
345 default: 345 default:
346 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 346 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
347 ("HW_VAR_ACM_CTRL acm set " 347 "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n",
348 "failed: eACI is %d\n", acm)); 348 acm);
349 break; 349 break;
350 } 350 }
351 } else { 351 } else {
@@ -361,13 +361,13 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
361 break; 361 break;
362 default: 362 default:
363 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 363 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
364 ("switch case not process\n")); 364 "switch case not processed\n");
365 break; 365 break;
366 } 366 }
367 } 367 }
368 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, 368 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE,
369 ("SetHwReg8190pci(): [HW_VAR_ACM_CTRL] " 369 "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n",
370 "Write 0x%X\n", acm_ctrl)); 370 acm_ctrl);
371 rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); 371 rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl);
372 break; 372 break;
373 } 373 }
@@ -502,7 +502,7 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
502 } 502 }
503 default: 503 default:
504 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 504 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
505 ("switch case not process\n")); 505 "switch case not processed\n");
506 break; 506 break;
507 } 507 }
508} 508}
@@ -522,8 +522,8 @@ static bool _rtl92de_llt_write(struct ieee80211_hw *hw, u32 address, u32 data)
522 break; 522 break;
523 if (count > POLLING_LLT_THRESHOLD) { 523 if (count > POLLING_LLT_THRESHOLD) {
524 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 524 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
525 ("Failed to polling write LLT done at " 525 "Failed to polling write LLT done at address %d!\n",
526 "address %d!\n", address)); 526 address);
527 status = false; 527 status = false;
528 break; 528 break;
529 } 529 }
@@ -879,12 +879,12 @@ void rtl92de_enable_hw_security_config(struct ieee80211_hw *hw)
879 u8 sec_reg_value; 879 u8 sec_reg_value;
880 880
881 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 881 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
882 ("PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", 882 "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
883 rtlpriv->sec.pairwise_enc_algorithm, 883 rtlpriv->sec.pairwise_enc_algorithm,
884 rtlpriv->sec.group_enc_algorithm)); 884 rtlpriv->sec.group_enc_algorithm);
885 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { 885 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
886 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 886 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
887 ("not open hw encryption\n")); 887 "not open hw encryption\n");
888 return; 888 return;
889 } 889 }
890 sec_reg_value = SCR_TXENCENABLE | SCR_RXENCENABLE; 890 sec_reg_value = SCR_TXENCENABLE | SCR_RXENCENABLE;
@@ -895,7 +895,7 @@ void rtl92de_enable_hw_security_config(struct ieee80211_hw *hw)
895 sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); 895 sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK);
896 rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); 896 rtl_write_byte(rtlpriv, REG_CR + 1, 0x02);
897 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 897 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
898 ("The SECR-value %x\n", sec_reg_value)); 898 "The SECR-value %x\n", sec_reg_value);
899 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); 899 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value);
900} 900}
901 901
@@ -921,7 +921,7 @@ int rtl92de_hw_init(struct ieee80211_hw *hw)
921 /* rtlpriv->intf_ops->disable_aspm(hw); */ 921 /* rtlpriv->intf_ops->disable_aspm(hw); */
922 rtstatus = _rtl92de_init_mac(hw); 922 rtstatus = _rtl92de_init_mac(hw);
923 if (rtstatus != true) { 923 if (rtstatus != true) {
924 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Init MAC failed\n")); 924 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n");
925 err = 1; 925 err = 1;
926 spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags); 926 spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags);
927 return err; 927 return err;
@@ -930,12 +930,8 @@ int rtl92de_hw_init(struct ieee80211_hw *hw)
930 spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags); 930 spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags);
931 if (err) { 931 if (err) {
932 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 932 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
933 ("Failed to download FW. Init HW " 933 "Failed to download FW. Init HW without FW..\n");
934 "without FW..\n"));
935 rtlhal->fw_ready = false;
936 return 1; 934 return 1;
937 } else {
938 rtlhal->fw_ready = true;
939 } 935 }
940 rtlhal->last_hmeboxnum = 0; 936 rtlhal->last_hmeboxnum = 0;
941 rtlpriv->psc.fw_current_inpsmode = false; 937 rtlpriv->psc.fw_current_inpsmode = false;
@@ -946,7 +942,7 @@ int rtl92de_hw_init(struct ieee80211_hw *hw)
946 942
947 if (rtlhal->earlymode_enable) { 943 if (rtlhal->earlymode_enable) {
948 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 944 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
949 ("EarlyMode Enabled!!!\n")); 945 "EarlyMode Enabled!!!\n");
950 946
951 tmp_u1b = rtl_read_byte(rtlpriv, 0x4d0); 947 tmp_u1b = rtl_read_byte(rtlpriv, 0x4d0);
952 tmp_u1b = tmp_u1b | 0x1f; 948 tmp_u1b = tmp_u1b | 0x1f;
@@ -1064,10 +1060,10 @@ static enum version_8192d _rtl92de_read_chip_version(struct ieee80211_hw *hw)
1064 value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG); 1060 value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG);
1065 if (!(value32 & 0x000f0000)) { 1061 if (!(value32 & 0x000f0000)) {
1066 version = VERSION_TEST_CHIP_92D_SINGLEPHY; 1062 version = VERSION_TEST_CHIP_92D_SINGLEPHY;
1067 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("TEST CHIP!!!\n")); 1063 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "TEST CHIP!!!\n");
1068 } else { 1064 } else {
1069 version = VERSION_NORMAL_CHIP_92D_SINGLEPHY; 1065 version = VERSION_NORMAL_CHIP_92D_SINGLEPHY;
1070 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Normal CHIP!!!\n")); 1066 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Normal CHIP!!!\n");
1071 } 1067 }
1072 return version; 1068 return version;
1073} 1069}
@@ -1092,8 +1088,8 @@ static int _rtl92de_set_media_status(struct ieee80211_hw *hw,
1092 _rtl92de_disable_bcn_sub_func(hw); 1088 _rtl92de_disable_bcn_sub_func(hw);
1093 } else { 1089 } else {
1094 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1090 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1095 ("Set HW_VAR_MEDIA_STATUS: No such media " 1091 "Set HW_VAR_MEDIA_STATUS: No such media status(%x)\n",
1096 "status(%x).\n", type)); 1092 type);
1097 } 1093 }
1098 bcnfunc_enable = rtl_read_byte(rtlpriv, REG_BCN_CTRL); 1094 bcnfunc_enable = rtl_read_byte(rtlpriv, REG_BCN_CTRL);
1099 switch (type) { 1095 switch (type) {
@@ -1102,30 +1098,30 @@ static int _rtl92de_set_media_status(struct ieee80211_hw *hw,
1102 ledaction = LED_CTL_LINK; 1098 ledaction = LED_CTL_LINK;
1103 bcnfunc_enable &= 0xF7; 1099 bcnfunc_enable &= 0xF7;
1104 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1100 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1105 ("Set Network type to NO LINK!\n")); 1101 "Set Network type to NO LINK!\n");
1106 break; 1102 break;
1107 case NL80211_IFTYPE_ADHOC: 1103 case NL80211_IFTYPE_ADHOC:
1108 bt_msr |= MSR_ADHOC; 1104 bt_msr |= MSR_ADHOC;
1109 bcnfunc_enable |= 0x08; 1105 bcnfunc_enable |= 0x08;
1110 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1106 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1111 ("Set Network type to Ad Hoc!\n")); 1107 "Set Network type to Ad Hoc!\n");
1112 break; 1108 break;
1113 case NL80211_IFTYPE_STATION: 1109 case NL80211_IFTYPE_STATION:
1114 bt_msr |= MSR_INFRA; 1110 bt_msr |= MSR_INFRA;
1115 ledaction = LED_CTL_LINK; 1111 ledaction = LED_CTL_LINK;
1116 bcnfunc_enable &= 0xF7; 1112 bcnfunc_enable &= 0xF7;
1117 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1113 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1118 ("Set Network type to STA!\n")); 1114 "Set Network type to STA!\n");
1119 break; 1115 break;
1120 case NL80211_IFTYPE_AP: 1116 case NL80211_IFTYPE_AP:
1121 bt_msr |= MSR_AP; 1117 bt_msr |= MSR_AP;
1122 bcnfunc_enable |= 0x08; 1118 bcnfunc_enable |= 0x08;
1123 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1119 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1124 ("Set Network type to AP!\n")); 1120 "Set Network type to AP!\n");
1125 break; 1121 break;
1126 default: 1122 default:
1127 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1123 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1128 ("Network type %d not support!\n", type)); 1124 "Network type %d not supported!\n", type);
1129 return 1; 1125 return 1;
1130 break; 1126 break;
1131 1127
@@ -1189,7 +1185,7 @@ void rtl92d_linked_set_reg(struct ieee80211_hw *hw)
1189 indexforchannel = rtl92d_get_rightchnlplace_for_iqk(channel); 1185 indexforchannel = rtl92d_get_rightchnlplace_for_iqk(channel);
1190 if (!rtlphy->iqk_matrix_regsetting[indexforchannel].iqk_done) { 1186 if (!rtlphy->iqk_matrix_regsetting[indexforchannel].iqk_done) {
1191 RT_TRACE(rtlpriv, COMP_SCAN | COMP_INIT, DBG_DMESG, 1187 RT_TRACE(rtlpriv, COMP_SCAN | COMP_INIT, DBG_DMESG,
1192 ("Do IQK for channel:%d.\n", channel)); 1188 "Do IQK for channel:%d\n", channel);
1193 rtl92d_phy_iq_calibrate(hw); 1189 rtl92d_phy_iq_calibrate(hw);
1194 } 1190 }
1195} 1191}
@@ -1214,7 +1210,7 @@ void rtl92de_set_qos(struct ieee80211_hw *hw, int aci)
1214 rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222); 1210 rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222);
1215 break; 1211 break;
1216 default: 1212 default:
1217 RT_ASSERT(false, ("invalid aci: %d !\n", aci)); 1213 RT_ASSERT(false, "invalid aci: %d !\n", aci);
1218 break; 1214 break;
1219 } 1215 }
1220} 1216}
@@ -1305,8 +1301,8 @@ static void _rtl92de_poweroff_adapter(struct ieee80211_hw *hw)
1305 rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, 0x10); 1301 rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, 0x10);
1306 1302
1307 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1303 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1308 ("In PowerOff,reg0x%x=%X\n", REG_SPS0_CTRL, 1304 "In PowerOff,reg0x%x=%X\n",
1309 rtl_read_byte(rtlpriv, REG_SPS0_CTRL))); 1305 REG_SPS0_CTRL, rtl_read_byte(rtlpriv, REG_SPS0_CTRL));
1310 /* r. Note: for PCIe interface, PON will not turn */ 1306 /* r. Note: for PCIe interface, PON will not turn */
1311 /* off m-bias and BandGap in PCIe suspend mode. */ 1307 /* off m-bias and BandGap in PCIe suspend mode. */
1312 1308
@@ -1319,7 +1315,7 @@ static void _rtl92de_poweroff_adapter(struct ieee80211_hw *hw)
1319 spin_unlock_irqrestore(&globalmutex_power, flags); 1315 spin_unlock_irqrestore(&globalmutex_power, flags);
1320 } 1316 }
1321 1317
1322 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("<=======\n")); 1318 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "<=======\n");
1323} 1319}
1324 1320
1325void rtl92de_card_disable(struct ieee80211_hw *hw) 1321void rtl92de_card_disable(struct ieee80211_hw *hw)
@@ -1377,7 +1373,7 @@ void rtl92de_card_disable(struct ieee80211_hw *hw)
1377 rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1, 0xff); 1373 rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1, 0xff);
1378 udelay(50); 1374 udelay(50);
1379 rtl_write_byte(rtlpriv, REG_CR, 0x0); 1375 rtl_write_byte(rtlpriv, REG_CR, 0x0);
1380 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("==> Do power off.......\n")); 1376 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "==> Do power off.......\n");
1381 if (rtl92d_phy_check_poweroff(hw)) 1377 if (rtl92d_phy_check_poweroff(hw))
1382 _rtl92de_poweroff_adapter(hw); 1378 _rtl92de_poweroff_adapter(hw);
1383 return; 1379 return;
@@ -1425,7 +1421,7 @@ void rtl92de_set_beacon_interval(struct ieee80211_hw *hw)
1425 u16 bcn_interval = mac->beacon_interval; 1421 u16 bcn_interval = mac->beacon_interval;
1426 1422
1427 RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, 1423 RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG,
1428 ("beacon_interval:%d\n", bcn_interval)); 1424 "beacon_interval:%d\n", bcn_interval);
1429 /* rtl92de_disable_interrupt(hw); */ 1425 /* rtl92de_disable_interrupt(hw); */
1430 rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); 1426 rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval);
1431 /* rtl92de_enable_interrupt(hw); */ 1427 /* rtl92de_enable_interrupt(hw); */
@@ -1437,8 +1433,8 @@ void rtl92de_update_interrupt_mask(struct ieee80211_hw *hw,
1437 struct rtl_priv *rtlpriv = rtl_priv(hw); 1433 struct rtl_priv *rtlpriv = rtl_priv(hw);
1438 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1434 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
1439 1435
1440 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, 1436 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, "add_msr:%x, rm_msr:%x\n",
1441 ("add_msr:%x, rm_msr:%x\n", add_msr, rm_msr)); 1437 add_msr, rm_msr);
1442 if (add_msr) 1438 if (add_msr)
1443 rtlpci->irq_mask[0] |= add_msr; 1439 rtlpci->irq_mask[0] |= add_msr;
1444 if (rm_msr) 1440 if (rm_msr)
@@ -1615,9 +1611,9 @@ static void _rtl92de_read_txpower_info(struct ieee80211_hw *hw,
1615 rtlefuse->internal_pa_5g[1] = 1611 rtlefuse->internal_pa_5g[1] =
1616 !((hwinfo[EEPROM_TSSI_B_5G] & BIT(6)) >> 6); 1612 !((hwinfo[EEPROM_TSSI_B_5G] & BIT(6)) >> 6);
1617 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1613 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
1618 ("Is D cut,Internal PA0 %d Internal PA1 %d\n", 1614 "Is D cut,Internal PA0 %d Internal PA1 %d\n",
1619 rtlefuse->internal_pa_5g[0], 1615 rtlefuse->internal_pa_5g[0],
1620 rtlefuse->internal_pa_5g[1])) 1616 rtlefuse->internal_pa_5g[1]);
1621 } 1617 }
1622 rtlefuse->eeprom_c9 = hwinfo[EEPROM_RF_OPT6]; 1618 rtlefuse->eeprom_c9 = hwinfo[EEPROM_RF_OPT6];
1623 rtlefuse->eeprom_cc = hwinfo[EEPROM_RF_OPT7]; 1619 rtlefuse->eeprom_cc = hwinfo[EEPROM_RF_OPT7];
@@ -1667,14 +1663,14 @@ static void _rtl92de_read_txpower_info(struct ieee80211_hw *hw,
1667 if (rtlefuse->eeprom_c9 == 0xFF) 1663 if (rtlefuse->eeprom_c9 == 0xFF)
1668 rtlefuse->eeprom_c9 = 0x00; 1664 rtlefuse->eeprom_c9 = 0x00;
1669 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, 1665 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD,
1670 ("EEPROMRegulatory = 0x%x\n", rtlefuse->eeprom_regulatory)); 1666 "EEPROMRegulatory = 0x%x\n", rtlefuse->eeprom_regulatory);
1671 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, 1667 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD,
1672 ("ThermalMeter = 0x%x\n", rtlefuse->eeprom_thermalmeter)); 1668 "ThermalMeter = 0x%x\n", rtlefuse->eeprom_thermalmeter);
1673 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, 1669 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD,
1674 ("CrystalCap = 0x%x\n", rtlefuse->crystalcap)); 1670 "CrystalCap = 0x%x\n", rtlefuse->crystalcap);
1675 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, 1671 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD,
1676 ("Delta_IQK = 0x%x Delta_LCK = 0x%x\n", rtlefuse->delta_iqk, 1672 "Delta_IQK = 0x%x Delta_LCK = 0x%x\n",
1677 rtlefuse->delta_lck)); 1673 rtlefuse->delta_iqk, rtlefuse->delta_lck);
1678 1674
1679 for (rfPath = 0; rfPath < RF6052_MAX_PATH; rfPath++) { 1675 for (rfPath = 0; rfPath < RF6052_MAX_PATH; rfPath++) {
1680 for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) { 1676 for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) {
@@ -1710,11 +1706,11 @@ static void _rtl92de_read_macphymode_from_prom(struct ieee80211_hw *hw,
1710 if (macphy_crvalue & BIT(3)) { 1706 if (macphy_crvalue & BIT(3)) {
1711 rtlhal->macphymode = SINGLEMAC_SINGLEPHY; 1707 rtlhal->macphymode = SINGLEMAC_SINGLEPHY;
1712 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1708 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1713 ("MacPhyMode SINGLEMAC_SINGLEPHY\n")); 1709 "MacPhyMode SINGLEMAC_SINGLEPHY\n");
1714 } else { 1710 } else {
1715 rtlhal->macphymode = DUALMAC_DUALPHY; 1711 rtlhal->macphymode = DUALMAC_DUALPHY;
1716 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1712 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1717 ("MacPhyMode DUALMAC_DUALPHY\n")); 1713 "MacPhyMode DUALMAC_DUALPHY\n");
1718 } 1714 }
1719} 1715}
1720 1716
@@ -1741,15 +1737,15 @@ static void _rtl92de_efuse_update_chip_version(struct ieee80211_hw *hw)
1741 switch (chipvalue) { 1737 switch (chipvalue) {
1742 case 0xAA55: 1738 case 0xAA55:
1743 chipver |= CHIP_92D_C_CUT; 1739 chipver |= CHIP_92D_C_CUT;
1744 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("C-CUT!!!\n")); 1740 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "C-CUT!!!\n");
1745 break; 1741 break;
1746 case 0x9966: 1742 case 0x9966:
1747 chipver |= CHIP_92D_D_CUT; 1743 chipver |= CHIP_92D_D_CUT;
1748 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("D-CUT!!!\n")); 1744 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "D-CUT!!!\n");
1749 break; 1745 break;
1750 default: 1746 default:
1751 chipver |= CHIP_92D_D_CUT; 1747 chipver |= CHIP_92D_D_CUT;
1752 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, ("Unkown CUT!\n")); 1748 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Unkown CUT!\n");
1753 break; 1749 break;
1754 } 1750 }
1755 rtlpriv->rtlhal.version = chipver; 1751 rtlpriv->rtlhal.version = chipver;
@@ -1775,23 +1771,23 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw)
1775 HWSET_MAX_SIZE); 1771 HWSET_MAX_SIZE);
1776 } else if (rtlefuse->epromtype == EEPROM_93C46) { 1772 } else if (rtlefuse->epromtype == EEPROM_93C46) {
1777 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1773 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1778 ("RTL819X Not boot from eeprom, check it !!")); 1774 "RTL819X Not boot from eeprom, check it !!\n");
1779 } 1775 }
1780 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP\n"), 1776 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP",
1781 hwinfo, HWSET_MAX_SIZE); 1777 hwinfo, HWSET_MAX_SIZE);
1782 1778
1783 eeprom_id = *((u16 *)&hwinfo[0]); 1779 eeprom_id = *((u16 *)&hwinfo[0]);
1784 if (eeprom_id != RTL8190_EEPROM_ID) { 1780 if (eeprom_id != RTL8190_EEPROM_ID) {
1785 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1781 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1786 ("EEPROM ID(%#x) is invalid!!\n", eeprom_id)); 1782 "EEPROM ID(%#x) is invalid!!\n", eeprom_id);
1787 rtlefuse->autoload_failflag = true; 1783 rtlefuse->autoload_failflag = true;
1788 } else { 1784 } else {
1789 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); 1785 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
1790 rtlefuse->autoload_failflag = false; 1786 rtlefuse->autoload_failflag = false;
1791 } 1787 }
1792 if (rtlefuse->autoload_failflag) { 1788 if (rtlefuse->autoload_failflag) {
1793 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1789 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1794 ("RTL819X Not boot from eeprom, check it !!")); 1790 "RTL819X Not boot from eeprom, check it !!\n");
1795 return; 1791 return;
1796 } 1792 }
1797 rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID]; 1793 rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID];
@@ -1802,16 +1798,15 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw)
1802 rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; 1798 rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID];
1803 rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; 1799 rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID];
1804 rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; 1800 rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID];
1801 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id);
1805 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1802 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1806 ("EEPROMId = 0x%4x\n", eeprom_id)); 1803 "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
1807 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1808 ("EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid));
1809 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1804 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1810 ("EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did)); 1805 "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
1811 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1806 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1812 ("EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid)); 1807 "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
1813 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1808 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1814 ("EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid)); 1809 "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
1815 1810
1816 /* Read Permanent MAC address */ 1811 /* Read Permanent MAC address */
1817 if (rtlhal->interfaceindex == 0) { 1812 if (rtlhal->interfaceindex == 0) {
@@ -1827,8 +1822,7 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw)
1827 } 1822 }
1828 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, 1823 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR,
1829 rtlefuse->dev_addr); 1824 rtlefuse->dev_addr);
1830 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1825 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr);
1831 ("%pM\n", rtlefuse->dev_addr));
1832 _rtl92de_read_txpower_info(hw, rtlefuse->autoload_failflag, hwinfo); 1826 _rtl92de_read_txpower_info(hw, rtlefuse->autoload_failflag, hwinfo);
1833 1827
1834 /* Read Channel Plan */ 1828 /* Read Channel Plan */
@@ -1849,7 +1843,7 @@ static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw)
1849 rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; 1843 rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION];
1850 rtlefuse->txpwr_fromeprom = true; 1844 rtlefuse->txpwr_fromeprom = true;
1851 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1845 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1852 ("EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid)); 1846 "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
1853} 1847}
1854 1848
1855void rtl92de_read_eeprom_info(struct ieee80211_hw *hw) 1849void rtl92de_read_eeprom_info(struct ieee80211_hw *hw)
@@ -1863,19 +1857,19 @@ void rtl92de_read_eeprom_info(struct ieee80211_hw *hw)
1863 tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); 1857 tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR);
1864 rtlefuse->autoload_status = tmp_u1b; 1858 rtlefuse->autoload_status = tmp_u1b;
1865 if (tmp_u1b & BIT(4)) { 1859 if (tmp_u1b & BIT(4)) {
1866 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from EEPROM\n")); 1860 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EEPROM\n");
1867 rtlefuse->epromtype = EEPROM_93C46; 1861 rtlefuse->epromtype = EEPROM_93C46;
1868 } else { 1862 } else {
1869 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from EFUSE\n")); 1863 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EFUSE\n");
1870 rtlefuse->epromtype = EEPROM_BOOT_EFUSE; 1864 rtlefuse->epromtype = EEPROM_BOOT_EFUSE;
1871 } 1865 }
1872 if (tmp_u1b & BIT(5)) { 1866 if (tmp_u1b & BIT(5)) {
1873 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); 1867 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
1874 1868
1875 rtlefuse->autoload_failflag = false; 1869 rtlefuse->autoload_failflag = false;
1876 _rtl92de_read_adapter_info(hw); 1870 _rtl92de_read_adapter_info(hw);
1877 } else { 1871 } else {
1878 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Autoload ERR!!\n")); 1872 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Autoload ERR!!\n");
1879 } 1873 }
1880 return; 1874 return;
1881} 1875}
@@ -1958,8 +1952,8 @@ static void rtl92de_update_hal_rate_table(struct ieee80211_hw *hw,
1958 (shortgi_rate << 4) | (shortgi_rate); 1952 (shortgi_rate << 4) | (shortgi_rate);
1959 } 1953 }
1960 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); 1954 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value);
1961 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, 1955 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n",
1962 ("%x\n", rtl_read_dword(rtlpriv, REG_ARFR0))); 1956 rtl_read_dword(rtlpriv, REG_ARFR0));
1963} 1957}
1964 1958
1965static void rtl92de_update_hal_rate_mask(struct ieee80211_hw *hw, 1959static void rtl92de_update_hal_rate_mask(struct ieee80211_hw *hw,
@@ -2092,8 +2086,8 @@ static void rtl92de_update_hal_rate_mask(struct ieee80211_hw *hw,
2092 value[0] = (ratr_bitmap & 0x0fffffff) | (ratr_index << 28); 2086 value[0] = (ratr_bitmap & 0x0fffffff) | (ratr_index << 28);
2093 value[1] = macid | (shortgi ? 0x20 : 0x00) | 0x80; 2087 value[1] = macid | (shortgi ? 0x20 : 0x00) | 0x80;
2094 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, 2088 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
2095 ("ratr_bitmap :%x value0:%x value1:%x\n", 2089 "ratr_bitmap :%x value0:%x value1:%x\n",
2096 ratr_bitmap, value[0], value[1])); 2090 ratr_bitmap, value[0], value[1]);
2097 rtl92d_fill_h2c_cmd(hw, H2C_RA_MASK, 5, (u8 *) value); 2091 rtl92d_fill_h2c_cmd(hw, H2C_RA_MASK, 5, (u8 *) value);
2098 if (macid != 0) 2092 if (macid != 0)
2099 sta_entry->ratr_index = ratr_index; 2093 sta_entry->ratr_index = ratr_index;
@@ -2153,14 +2147,14 @@ bool rtl92de_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
2153 e_rfpowerstate_toset = (u1tmp & BIT(3)) ? ERFON : ERFOFF; 2147 e_rfpowerstate_toset = (u1tmp & BIT(3)) ? ERFON : ERFOFF;
2154 if (ppsc->hwradiooff && (e_rfpowerstate_toset == ERFON)) { 2148 if (ppsc->hwradiooff && (e_rfpowerstate_toset == ERFON)) {
2155 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 2149 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
2156 ("GPIOChangeRF - HW Radio ON, RF ON\n")); 2150 "GPIOChangeRF - HW Radio ON, RF ON\n");
2157 e_rfpowerstate_toset = ERFON; 2151 e_rfpowerstate_toset = ERFON;
2158 ppsc->hwradiooff = false; 2152 ppsc->hwradiooff = false;
2159 actuallyset = true; 2153 actuallyset = true;
2160 } else if ((ppsc->hwradiooff == false) 2154 } else if ((ppsc->hwradiooff == false)
2161 && (e_rfpowerstate_toset == ERFOFF)) { 2155 && (e_rfpowerstate_toset == ERFOFF)) {
2162 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 2156 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
2163 ("GPIOChangeRF - HW Radio OFF, RF OFF\n")); 2157 "GPIOChangeRF - HW Radio OFF, RF OFF\n");
2164 e_rfpowerstate_toset = ERFOFF; 2158 e_rfpowerstate_toset = ERFOFF;
2165 ppsc->hwradiooff = true; 2159 ppsc->hwradiooff = true;
2166 actuallyset = true; 2160 actuallyset = true;
@@ -2204,7 +2198,7 @@ void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index,
2204 u8 idx; 2198 u8 idx;
2205 u8 cam_offset = 0; 2199 u8 cam_offset = 0;
2206 u8 clear_number = 5; 2200 u8 clear_number = 5;
2207 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("clear_all\n")); 2201 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n");
2208 for (idx = 0; idx < clear_number; idx++) { 2202 for (idx = 0; idx < clear_number; idx++) {
2209 rtl_cam_mark_invalid(hw, cam_offset + idx); 2203 rtl_cam_mark_invalid(hw, cam_offset + idx);
2210 rtl_cam_empty_entry(hw, cam_offset + idx); 2204 rtl_cam_empty_entry(hw, cam_offset + idx);
@@ -2230,8 +2224,8 @@ void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index,
2230 enc_algo = CAM_AES; 2224 enc_algo = CAM_AES;
2231 break; 2225 break;
2232 default: 2226 default:
2233 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("switch case " 2227 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
2234 "not process\n")); 2228 "switch case not processed\n");
2235 enc_algo = CAM_TKIP; 2229 enc_algo = CAM_TKIP;
2236 break; 2230 break;
2237 } 2231 }
@@ -2248,9 +2242,8 @@ void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index,
2248 p_macaddr); 2242 p_macaddr);
2249 if (entry_id >= TOTAL_CAM_ENTRY) { 2243 if (entry_id >= TOTAL_CAM_ENTRY) {
2250 RT_TRACE(rtlpriv, COMP_SEC, 2244 RT_TRACE(rtlpriv, COMP_SEC,
2251 DBG_EMERG, ("Can not " 2245 DBG_EMERG,
2252 "find free hw security" 2246 "Can not find free hw security cam entry\n");
2253 " cam entry\n"));
2254 return; 2247 return;
2255 } 2248 }
2256 } else { 2249 } else {
@@ -2262,29 +2255,29 @@ void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index,
2262 } 2255 }
2263 if (rtlpriv->sec.key_len[key_index] == 0) { 2256 if (rtlpriv->sec.key_len[key_index] == 0) {
2264 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2257 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2265 ("delete one entry, entry_id is %d\n", 2258 "delete one entry, entry_id is %d\n",
2266 entry_id)); 2259 entry_id);
2267 if (mac->opmode == NL80211_IFTYPE_AP) 2260 if (mac->opmode == NL80211_IFTYPE_AP)
2268 rtl_cam_del_entry(hw, p_macaddr); 2261 rtl_cam_del_entry(hw, p_macaddr);
2269 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); 2262 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id);
2270 } else { 2263 } else {
2271 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 2264 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
2272 ("The insert KEY length is %d\n", 2265 "The insert KEY length is %d\n",
2273 rtlpriv->sec.key_len[PAIRWISE_KEYIDX])); 2266 rtlpriv->sec.key_len[PAIRWISE_KEYIDX]);
2274 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 2267 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
2275 ("The insert KEY is %x %x\n", 2268 "The insert KEY is %x %x\n",
2276 rtlpriv->sec.key_buf[0][0], 2269 rtlpriv->sec.key_buf[0][0],
2277 rtlpriv->sec.key_buf[0][1])); 2270 rtlpriv->sec.key_buf[0][1]);
2278 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2271 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2279 ("add one entry\n")); 2272 "add one entry\n");
2280 if (is_pairwise) { 2273 if (is_pairwise) {
2281 RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD, 2274 RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD,
2282 "Pairwiase Key content :", 2275 "Pairwise Key content",
2283 rtlpriv->sec.pairwise_key, 2276 rtlpriv->sec.pairwise_key,
2284 rtlpriv-> 2277 rtlpriv->
2285 sec.key_len[PAIRWISE_KEYIDX]); 2278 sec.key_len[PAIRWISE_KEYIDX]);
2286 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2279 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2287 ("set Pairwiase key\n")); 2280 "set Pairwise key\n");
2288 rtl_cam_add_one_entry(hw, macaddr, key_index, 2281 rtl_cam_add_one_entry(hw, macaddr, key_index,
2289 entry_id, enc_algo, 2282 entry_id, enc_algo,
2290 CAM_CONFIG_NO_USEDK, 2283 CAM_CONFIG_NO_USEDK,
@@ -2292,7 +2285,7 @@ void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index,
2292 sec.key_buf[key_index]); 2285 sec.key_buf[key_index]);
2293 } else { 2286 } else {
2294 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2287 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2295 ("set group key\n")); 2288 "set group key\n");
2296 if (mac->opmode == NL80211_IFTYPE_ADHOC) { 2289 if (mac->opmode == NL80211_IFTYPE_ADHOC) {
2297 rtl_cam_add_one_entry(hw, 2290 rtl_cam_add_one_entry(hw,
2298 rtlefuse->dev_addr, 2291 rtlefuse->dev_addr,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.h b/drivers/net/wireless/rtlwifi/rtl8192de/hw.h
index ad44ffa520e6..7c9f7a2f1e42 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/led.c b/drivers/net/wireless/rtlwifi/rtl8192de/led.c
index f1552f4df658..76a57ae4af3e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/led.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/led.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -45,8 +45,8 @@ void rtl92de_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
45 u8 ledcfg; 45 u8 ledcfg;
46 struct rtl_priv *rtlpriv = rtl_priv(hw); 46 struct rtl_priv *rtlpriv = rtl_priv(hw);
47 47
48 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, 48 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
49 ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); 49 REG_LEDCFG2, pled->ledpin);
50 50
51 switch (pled->ledpin) { 51 switch (pled->ledpin) {
52 case LED_PIN_GPIO0: 52 case LED_PIN_GPIO0:
@@ -71,7 +71,7 @@ void rtl92de_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
71 break; 71 break;
72 default: 72 default:
73 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 73 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
74 ("switch case not process\n")); 74 "switch case not processed\n");
75 break; 75 break;
76 } 76 }
77 pled->ledon = true; 77 pled->ledon = true;
@@ -83,8 +83,8 @@ void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
83 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); 83 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
84 u8 ledcfg; 84 u8 ledcfg;
85 85
86 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, 86 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
87 ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); 87 REG_LEDCFG2, pled->ledpin);
88 88
89 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); 89 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
90 90
@@ -106,7 +106,7 @@ void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
106 break; 106 break;
107 default: 107 default:
108 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 108 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
109 ("switch case not process\n")); 109 "switch case not processed\n");
110 break; 110 break;
111 } 111 }
112 pled->ledon = false; 112 pled->ledon = false;
@@ -153,7 +153,7 @@ void rtl92de_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction)
153 ledaction == LED_CTL_POWER_ON)) { 153 ledaction == LED_CTL_POWER_ON)) {
154 return; 154 return;
155 } 155 }
156 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, ("ledaction %d,\n", ledaction)); 156 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d,\n", ledaction);
157 157
158 _rtl92ce_sw_led_control(hw, ledaction); 158 _rtl92ce_sw_led_control(hw, ledaction);
159} 159}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/led.h b/drivers/net/wireless/rtlwifi/rtl8192de/led.h
index 57f4a3c583d4..a29df30c3025 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/led.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/led.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
index 0883349e1c83..9581a19c2548 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -204,8 +204,8 @@ u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
204 u32 returnvalue, originalvalue, bitshift; 204 u32 returnvalue, originalvalue, bitshift;
205 u8 dbi_direct; 205 u8 dbi_direct;
206 206
207 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 207 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n",
208 "bitmask(%#x)\n", regaddr, bitmask)); 208 regaddr, bitmask);
209 if (rtlhal->during_mac1init_radioa || rtlhal->during_mac0init_radiob) { 209 if (rtlhal->during_mac1init_radioa || rtlhal->during_mac0init_radiob) {
210 /* mac1 use phy0 read radio_b. */ 210 /* mac1 use phy0 read radio_b. */
211 /* mac0 use phy1 read radio_b. */ 211 /* mac0 use phy1 read radio_b. */
@@ -220,8 +220,9 @@ u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
220 } 220 }
221 bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); 221 bitshift = _rtl92d_phy_calculate_bit_shift(bitmask);
222 returnvalue = (originalvalue & bitmask) >> bitshift; 222 returnvalue = (originalvalue & bitmask) >> bitshift;
223 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("BBR MASK=0x%x " 223 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
224 "Addr[0x%x]=0x%x\n", bitmask, regaddr, originalvalue)); 224 "BBR MASK=0x%x Addr[0x%x]=0x%x\n",
225 bitmask, regaddr, originalvalue);
225 return returnvalue; 226 return returnvalue;
226} 227}
227 228
@@ -233,8 +234,9 @@ void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw,
233 u8 dbi_direct = 0; 234 u8 dbi_direct = 0;
234 u32 originalvalue, bitshift; 235 u32 originalvalue, bitshift;
235 236
236 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 237 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
237 " data(%#x)\n", regaddr, bitmask, data)); 238 "regaddr(%#x), bitmask(%#x), data(%#x)\n",
239 regaddr, bitmask, data);
238 if (rtlhal->during_mac1init_radioa) 240 if (rtlhal->during_mac1init_radioa)
239 dbi_direct = BIT(3); 241 dbi_direct = BIT(3);
240 else if (rtlhal->during_mac0init_radiob) 242 else if (rtlhal->during_mac0init_radiob)
@@ -255,8 +257,9 @@ void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw,
255 rtl92de_write_dword_dbi(hw, (u16) regaddr, data, dbi_direct); 257 rtl92de_write_dword_dbi(hw, (u16) regaddr, data, dbi_direct);
256 else 258 else
257 rtl_write_dword(rtlpriv, regaddr, data); 259 rtl_write_dword(rtlpriv, regaddr, data);
258 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 260 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
259 " data(%#x)\n", regaddr, bitmask, data)); 261 "regaddr(%#x), bitmask(%#x), data(%#x)\n",
262 regaddr, bitmask, data);
260} 263}
261 264
262static u32 _rtl92d_phy_rf_serial_read(struct ieee80211_hw *hw, 265static u32 _rtl92d_phy_rf_serial_read(struct ieee80211_hw *hw,
@@ -300,8 +303,8 @@ static u32 _rtl92d_phy_rf_serial_read(struct ieee80211_hw *hw,
300 else 303 else
301 retvalue = rtl_get_bbreg(hw, pphyreg->rflssi_readback, 304 retvalue = rtl_get_bbreg(hw, pphyreg->rflssi_readback,
302 BLSSIREADBACKDATA); 305 BLSSIREADBACKDATA);
303 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("RFR-%d Addr[0x%x] = 0x%x\n", 306 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x] = 0x%x\n",
304 rfpath, pphyreg->rflssi_readback, retvalue)); 307 rfpath, pphyreg->rflssi_readback, retvalue);
305 return retvalue; 308 return retvalue;
306} 309}
307 310
@@ -319,8 +322,8 @@ static void _rtl92d_phy_rf_serial_write(struct ieee80211_hw *hw,
319 /* T65 RF */ 322 /* T65 RF */
320 data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff; 323 data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff;
321 rtl_set_bbreg(hw, pphyreg->rf3wire_offset, BMASKDWORD, data_and_addr); 324 rtl_set_bbreg(hw, pphyreg->rf3wire_offset, BMASKDWORD, data_and_addr);
322 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("RFW-%d Addr[0x%x]=0x%x\n", 325 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]=0x%x\n",
323 rfpath, pphyreg->rf3wire_offset, data_and_addr)); 326 rfpath, pphyreg->rf3wire_offset, data_and_addr);
324} 327}
325 328
326u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw, 329u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw,
@@ -330,17 +333,17 @@ u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw,
330 u32 original_value, readback_value, bitshift; 333 u32 original_value, readback_value, bitshift;
331 unsigned long flags; 334 unsigned long flags;
332 335
333 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 336 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
334 "rfpath(%#x), bitmask(%#x)\n", 337 "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
335 regaddr, rfpath, bitmask)); 338 regaddr, rfpath, bitmask);
336 spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); 339 spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
337 original_value = _rtl92d_phy_rf_serial_read(hw, rfpath, regaddr); 340 original_value = _rtl92d_phy_rf_serial_read(hw, rfpath, regaddr);
338 bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); 341 bitshift = _rtl92d_phy_calculate_bit_shift(bitmask);
339 readback_value = (original_value & bitmask) >> bitshift; 342 readback_value = (original_value & bitmask) >> bitshift;
340 spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); 343 spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
341 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), rfpath(%#x), " 344 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
342 "bitmask(%#x), original_value(%#x)\n", 345 "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
343 regaddr, rfpath, bitmask, original_value)); 346 regaddr, rfpath, bitmask, original_value);
344 return readback_value; 347 return readback_value;
345} 348}
346 349
@@ -353,8 +356,8 @@ void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
353 unsigned long flags; 356 unsigned long flags;
354 357
355 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 358 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
356 ("regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", 359 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
357 regaddr, bitmask, data, rfpath)); 360 regaddr, bitmask, data, rfpath);
358 if (bitmask == 0) 361 if (bitmask == 0)
359 return; 362 return;
360 spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); 363 spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
@@ -369,9 +372,9 @@ void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
369 _rtl92d_phy_rf_serial_write(hw, rfpath, regaddr, data); 372 _rtl92d_phy_rf_serial_write(hw, rfpath, regaddr, data);
370 } 373 }
371 spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); 374 spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
372 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), " 375 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
373 "bitmask(%#x), data(%#x), rfpath(%#x)\n", 376 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
374 regaddr, bitmask, data, rfpath)); 377 regaddr, bitmask, data, rfpath);
375} 378}
376 379
377bool rtl92d_phy_mac_config(struct ieee80211_hw *hw) 380bool rtl92d_phy_mac_config(struct ieee80211_hw *hw)
@@ -381,10 +384,10 @@ bool rtl92d_phy_mac_config(struct ieee80211_hw *hw)
381 u32 arraylength; 384 u32 arraylength;
382 u32 *ptrarray; 385 u32 *ptrarray;
383 386
384 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Read Rtl819XMACPHY_Array\n")); 387 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n");
385 arraylength = MAC_2T_ARRAYLENGTH; 388 arraylength = MAC_2T_ARRAYLENGTH;
386 ptrarray = rtl8192de_mac_2tarray; 389 ptrarray = rtl8192de_mac_2tarray;
387 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Img:Rtl819XMAC_Array\n")); 390 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:Rtl819XMAC_Array\n");
388 for (i = 0; i < arraylength; i = i + 2) 391 for (i = 0; i < arraylength; i = i + 2)
389 rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); 392 rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]);
390 if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) { 393 if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) {
@@ -561,25 +564,25 @@ static bool _rtl92d_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
561 agctab_arraylen = AGCTAB_ARRAYLENGTH; 564 agctab_arraylen = AGCTAB_ARRAYLENGTH;
562 agctab_array_table = rtl8192de_agctab_array; 565 agctab_array_table = rtl8192de_agctab_array;
563 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 566 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
564 (" ===> phy:MAC0, Rtl819XAGCTAB_Array\n")); 567 " ===> phy:MAC0, Rtl819XAGCTAB_Array\n");
565 } else { 568 } else {
566 if (rtlhal->current_bandtype == BAND_ON_2_4G) { 569 if (rtlhal->current_bandtype == BAND_ON_2_4G) {
567 agctab_arraylen = AGCTAB_2G_ARRAYLENGTH; 570 agctab_arraylen = AGCTAB_2G_ARRAYLENGTH;
568 agctab_array_table = rtl8192de_agctab_2garray; 571 agctab_array_table = rtl8192de_agctab_2garray;
569 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 572 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
570 (" ===> phy:MAC1, Rtl819XAGCTAB_2GArray\n")); 573 " ===> phy:MAC1, Rtl819XAGCTAB_2GArray\n");
571 } else { 574 } else {
572 agctab_5garraylen = AGCTAB_5G_ARRAYLENGTH; 575 agctab_5garraylen = AGCTAB_5G_ARRAYLENGTH;
573 agctab_5garray_table = rtl8192de_agctab_5garray; 576 agctab_5garray_table = rtl8192de_agctab_5garray;
574 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 577 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
575 (" ===> phy:MAC1, Rtl819XAGCTAB_5GArray\n")); 578 " ===> phy:MAC1, Rtl819XAGCTAB_5GArray\n");
576 579
577 } 580 }
578 } 581 }
579 phy_reg_arraylen = PHY_REG_2T_ARRAYLENGTH; 582 phy_reg_arraylen = PHY_REG_2T_ARRAYLENGTH;
580 phy_regarray_table = rtl8192de_phy_reg_2tarray; 583 phy_regarray_table = rtl8192de_phy_reg_2tarray;
581 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 584 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
582 (" ===> phy:Rtl819XPHY_REG_Array_PG\n")); 585 " ===> phy:Rtl819XPHY_REG_Array_PG\n");
583 if (configtype == BASEBAND_CONFIG_PHY_REG) { 586 if (configtype == BASEBAND_CONFIG_PHY_REG) {
584 for (i = 0; i < phy_reg_arraylen; i = i + 2) { 587 for (i = 0; i < phy_reg_arraylen; i = i + 2) {
585 if (phy_regarray_table[i] == 0xfe) 588 if (phy_regarray_table[i] == 0xfe)
@@ -598,10 +601,9 @@ static bool _rtl92d_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
598 phy_regarray_table[i + 1]); 601 phy_regarray_table[i + 1]);
599 udelay(1); 602 udelay(1);
600 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 603 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
601 ("The phy_regarray_table[0] is %x" 604 "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n",
602 " Rtl819XPHY_REGArray[1] is %x\n", 605 phy_regarray_table[i],
603 phy_regarray_table[i], 606 phy_regarray_table[i + 1]);
604 phy_regarray_table[i + 1]));
605 } 607 }
606 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { 608 } else if (configtype == BASEBAND_CONFIG_AGC_TAB) {
607 if (rtlhal->interfaceindex == 0) { 609 if (rtlhal->interfaceindex == 0) {
@@ -613,15 +615,12 @@ static bool _rtl92d_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
613 * setting. */ 615 * setting. */
614 udelay(1); 616 udelay(1);
615 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 617 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
616 ("The Rtl819XAGCTAB_Array_" 618 "The Rtl819XAGCTAB_Array_Table[0] is %ul Rtl819XPHY_REGArray[1] is %ul\n",
617 "Table[0] is %ul "
618 "Rtl819XPHY_REGArray[1] is %ul\n",
619 agctab_array_table[i], 619 agctab_array_table[i],
620 agctab_array_table[i + 1])); 620 agctab_array_table[i + 1]);
621 } 621 }
622 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 622 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
623 ("Normal Chip, MAC0, load " 623 "Normal Chip, MAC0, load Rtl819XAGCTAB_Array\n");
624 "Rtl819XAGCTAB_Array\n"));
625 } else { 624 } else {
626 if (rtlhal->current_bandtype == BAND_ON_2_4G) { 625 if (rtlhal->current_bandtype == BAND_ON_2_4G) {
627 for (i = 0; i < agctab_arraylen; i = i + 2) { 626 for (i = 0; i < agctab_arraylen; i = i + 2) {
@@ -632,14 +631,12 @@ static bool _rtl92d_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
632 * setting. */ 631 * setting. */
633 udelay(1); 632 udelay(1);
634 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 633 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
635 ("The Rtl819XAGCTAB_Array_" 634 "The Rtl819XAGCTAB_Array_Table[0] is %ul Rtl819XPHY_REGArray[1] is %ul\n",
636 "Table[0] is %ul Rtl819XPHY_"
637 "REGArray[1] is %ul\n",
638 agctab_array_table[i], 635 agctab_array_table[i],
639 agctab_array_table[i + 1])); 636 agctab_array_table[i + 1]);
640 } 637 }
641 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 638 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
642 ("Load Rtl819XAGCTAB_2GArray\n")); 639 "Load Rtl819XAGCTAB_2GArray\n");
643 } else { 640 } else {
644 for (i = 0; i < agctab_5garraylen; i = i + 2) { 641 for (i = 0; i < agctab_5garraylen; i = i + 2) {
645 rtl_set_bbreg(hw, 642 rtl_set_bbreg(hw,
@@ -650,14 +647,12 @@ static bool _rtl92d_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
650 * setting. */ 647 * setting. */
651 udelay(1); 648 udelay(1);
652 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 649 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
653 ("The Rtl819XAGCTAB_5GArray_" 650 "The Rtl819XAGCTAB_5GArray_Table[0] is %ul Rtl819XPHY_REGArray[1] is %ul\n",
654 "Table[0] is %ul Rtl819XPHY_"
655 "REGArray[1] is %ul\n",
656 agctab_5garray_table[i], 651 agctab_5garray_table[i],
657 agctab_5garray_table[i + 1])); 652 agctab_5garray_table[i + 1]);
658 } 653 }
659 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 654 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
660 ("Load Rtl819XAGCTAB_5GArray\n")); 655 "Load Rtl819XAGCTAB_5GArray\n");
661 } 656 }
662 } 657 }
663 } 658 }
@@ -675,145 +670,145 @@ static void _rtl92d_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw,
675 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][0] = 670 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][0] =
676 data; 671 data;
677 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 672 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
678 ("MCSTxPowerLevelOriginalOffset[%d][0] = 0x%ulx\n", 673 "MCSTxPowerLevelOriginalOffset[%d][0] = 0x%ulx\n",
679 rtlphy->pwrgroup_cnt, 674 rtlphy->pwrgroup_cnt,
680 rtlphy->mcs_txpwrlevel_origoffset 675 rtlphy->mcs_txpwrlevel_origoffset
681 [rtlphy->pwrgroup_cnt][0])); 676 [rtlphy->pwrgroup_cnt][0]);
682 } 677 }
683 if (regaddr == RTXAGC_A_RATE54_24) { 678 if (regaddr == RTXAGC_A_RATE54_24) {
684 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][1] = 679 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][1] =
685 data; 680 data;
686 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 681 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
687 ("MCSTxPowerLevelOriginalOffset[%d][1] = 0x%ulx\n", 682 "MCSTxPowerLevelOriginalOffset[%d][1] = 0x%ulx\n",
688 rtlphy->pwrgroup_cnt, 683 rtlphy->pwrgroup_cnt,
689 rtlphy->mcs_txpwrlevel_origoffset 684 rtlphy->mcs_txpwrlevel_origoffset
690 [rtlphy->pwrgroup_cnt][1])); 685 [rtlphy->pwrgroup_cnt][1]);
691 } 686 }
692 if (regaddr == RTXAGC_A_CCK1_MCS32) { 687 if (regaddr == RTXAGC_A_CCK1_MCS32) {
693 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][6] = 688 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][6] =
694 data; 689 data;
695 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 690 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
696 ("MCSTxPowerLevelOriginalOffset[%d][6] = 0x%ulx\n", 691 "MCSTxPowerLevelOriginalOffset[%d][6] = 0x%ulx\n",
697 rtlphy->pwrgroup_cnt, 692 rtlphy->pwrgroup_cnt,
698 rtlphy->mcs_txpwrlevel_origoffset 693 rtlphy->mcs_txpwrlevel_origoffset
699 [rtlphy->pwrgroup_cnt][6])); 694 [rtlphy->pwrgroup_cnt][6]);
700 } 695 }
701 if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) { 696 if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) {
702 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][7] = 697 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][7] =
703 data; 698 data;
704 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 699 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
705 ("MCSTxPowerLevelOriginalOffset[%d][7] = 0x%ulx\n", 700 "MCSTxPowerLevelOriginalOffset[%d][7] = 0x%ulx\n",
706 rtlphy->pwrgroup_cnt, 701 rtlphy->pwrgroup_cnt,
707 rtlphy->mcs_txpwrlevel_origoffset 702 rtlphy->mcs_txpwrlevel_origoffset
708 [rtlphy->pwrgroup_cnt][7])); 703 [rtlphy->pwrgroup_cnt][7]);
709 } 704 }
710 if (regaddr == RTXAGC_A_MCS03_MCS00) { 705 if (regaddr == RTXAGC_A_MCS03_MCS00) {
711 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][2] = 706 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][2] =
712 data; 707 data;
713 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 708 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
714 ("MCSTxPowerLevelOriginalOffset[%d][2] = 0x%ulx\n", 709 "MCSTxPowerLevelOriginalOffset[%d][2] = 0x%ulx\n",
715 rtlphy->pwrgroup_cnt, 710 rtlphy->pwrgroup_cnt,
716 rtlphy->mcs_txpwrlevel_origoffset 711 rtlphy->mcs_txpwrlevel_origoffset
717 [rtlphy->pwrgroup_cnt][2])); 712 [rtlphy->pwrgroup_cnt][2]);
718 } 713 }
719 if (regaddr == RTXAGC_A_MCS07_MCS04) { 714 if (regaddr == RTXAGC_A_MCS07_MCS04) {
720 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][3] = 715 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][3] =
721 data; 716 data;
722 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 717 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
723 ("MCSTxPowerLevelOriginalOffset[%d][3] = 0x%ulx\n", 718 "MCSTxPowerLevelOriginalOffset[%d][3] = 0x%ulx\n",
724 rtlphy->pwrgroup_cnt, 719 rtlphy->pwrgroup_cnt,
725 rtlphy->mcs_txpwrlevel_origoffset 720 rtlphy->mcs_txpwrlevel_origoffset
726 [rtlphy->pwrgroup_cnt][3])); 721 [rtlphy->pwrgroup_cnt][3]);
727 } 722 }
728 if (regaddr == RTXAGC_A_MCS11_MCS08) { 723 if (regaddr == RTXAGC_A_MCS11_MCS08) {
729 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][4] = 724 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][4] =
730 data; 725 data;
731 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 726 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
732 ("MCSTxPowerLevelOriginalOffset[%d][4] = 0x%ulx\n", 727 "MCSTxPowerLevelOriginalOffset[%d][4] = 0x%ulx\n",
733 rtlphy->pwrgroup_cnt, 728 rtlphy->pwrgroup_cnt,
734 rtlphy->mcs_txpwrlevel_origoffset 729 rtlphy->mcs_txpwrlevel_origoffset
735 [rtlphy->pwrgroup_cnt][4])); 730 [rtlphy->pwrgroup_cnt][4]);
736 } 731 }
737 if (regaddr == RTXAGC_A_MCS15_MCS12) { 732 if (regaddr == RTXAGC_A_MCS15_MCS12) {
738 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][5] = 733 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][5] =
739 data; 734 data;
740 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 735 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
741 ("MCSTxPowerLevelOriginalOffset[%d][5] = 0x%ulx\n", 736 "MCSTxPowerLevelOriginalOffset[%d][5] = 0x%ulx\n",
742 rtlphy->pwrgroup_cnt, 737 rtlphy->pwrgroup_cnt,
743 rtlphy->mcs_txpwrlevel_origoffset 738 rtlphy->mcs_txpwrlevel_origoffset
744 [rtlphy->pwrgroup_cnt][5])); 739 [rtlphy->pwrgroup_cnt][5]);
745 } 740 }
746 if (regaddr == RTXAGC_B_RATE18_06) { 741 if (regaddr == RTXAGC_B_RATE18_06) {
747 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][8] = 742 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][8] =
748 data; 743 data;
749 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 744 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
750 ("MCSTxPowerLevelOriginalOffset[%d][8] = 0x%ulx\n", 745 "MCSTxPowerLevelOriginalOffset[%d][8] = 0x%ulx\n",
751 rtlphy->pwrgroup_cnt, 746 rtlphy->pwrgroup_cnt,
752 rtlphy->mcs_txpwrlevel_origoffset 747 rtlphy->mcs_txpwrlevel_origoffset
753 [rtlphy->pwrgroup_cnt][8])); 748 [rtlphy->pwrgroup_cnt][8]);
754 } 749 }
755 if (regaddr == RTXAGC_B_RATE54_24) { 750 if (regaddr == RTXAGC_B_RATE54_24) {
756 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][9] = 751 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][9] =
757 data; 752 data;
758 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 753 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
759 ("MCSTxPowerLevelOriginalOffset[%d][9] = 0x%ulx\n", 754 "MCSTxPowerLevelOriginalOffset[%d][9] = 0x%ulx\n",
760 rtlphy->pwrgroup_cnt, 755 rtlphy->pwrgroup_cnt,
761 rtlphy->mcs_txpwrlevel_origoffset 756 rtlphy->mcs_txpwrlevel_origoffset
762 [rtlphy->pwrgroup_cnt][9])); 757 [rtlphy->pwrgroup_cnt][9]);
763 } 758 }
764 if (regaddr == RTXAGC_B_CCK1_55_MCS32) { 759 if (regaddr == RTXAGC_B_CCK1_55_MCS32) {
765 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][14] = 760 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][14] =
766 data; 761 data;
767 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 762 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
768 ("MCSTxPowerLevelOriginalOffset[%d][14] = 0x%ulx\n", 763 "MCSTxPowerLevelOriginalOffset[%d][14] = 0x%ulx\n",
769 rtlphy->pwrgroup_cnt, 764 rtlphy->pwrgroup_cnt,
770 rtlphy->mcs_txpwrlevel_origoffset 765 rtlphy->mcs_txpwrlevel_origoffset
771 [rtlphy->pwrgroup_cnt][14])); 766 [rtlphy->pwrgroup_cnt][14]);
772 } 767 }
773 if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) { 768 if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) {
774 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][15] = 769 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][15] =
775 data; 770 data;
776 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 771 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
777 ("MCSTxPowerLevelOriginalOffset[%d][15] = 0x%ulx\n", 772 "MCSTxPowerLevelOriginalOffset[%d][15] = 0x%ulx\n",
778 rtlphy->pwrgroup_cnt, 773 rtlphy->pwrgroup_cnt,
779 rtlphy->mcs_txpwrlevel_origoffset 774 rtlphy->mcs_txpwrlevel_origoffset
780 [rtlphy->pwrgroup_cnt][15])); 775 [rtlphy->pwrgroup_cnt][15]);
781 } 776 }
782 if (regaddr == RTXAGC_B_MCS03_MCS00) { 777 if (regaddr == RTXAGC_B_MCS03_MCS00) {
783 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][10] = 778 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][10] =
784 data; 779 data;
785 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 780 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
786 ("MCSTxPowerLevelOriginalOffset[%d][10] = 0x%ulx\n", 781 "MCSTxPowerLevelOriginalOffset[%d][10] = 0x%ulx\n",
787 rtlphy->pwrgroup_cnt, 782 rtlphy->pwrgroup_cnt,
788 rtlphy->mcs_txpwrlevel_origoffset 783 rtlphy->mcs_txpwrlevel_origoffset
789 [rtlphy->pwrgroup_cnt][10])); 784 [rtlphy->pwrgroup_cnt][10]);
790 } 785 }
791 if (regaddr == RTXAGC_B_MCS07_MCS04) { 786 if (regaddr == RTXAGC_B_MCS07_MCS04) {
792 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][11] = 787 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][11] =
793 data; 788 data;
794 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 789 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
795 ("MCSTxPowerLevelOriginalOffset[%d][11] = 0x%ulx\n", 790 "MCSTxPowerLevelOriginalOffset[%d][11] = 0x%ulx\n",
796 rtlphy->pwrgroup_cnt, 791 rtlphy->pwrgroup_cnt,
797 rtlphy->mcs_txpwrlevel_origoffset 792 rtlphy->mcs_txpwrlevel_origoffset
798 [rtlphy->pwrgroup_cnt][11])); 793 [rtlphy->pwrgroup_cnt][11]);
799 } 794 }
800 if (regaddr == RTXAGC_B_MCS11_MCS08) { 795 if (regaddr == RTXAGC_B_MCS11_MCS08) {
801 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][12] = 796 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][12] =
802 data; 797 data;
803 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 798 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
804 ("MCSTxPowerLevelOriginalOffset[%d][12] = 0x%ulx\n", 799 "MCSTxPowerLevelOriginalOffset[%d][12] = 0x%ulx\n",
805 rtlphy->pwrgroup_cnt, 800 rtlphy->pwrgroup_cnt,
806 rtlphy->mcs_txpwrlevel_origoffset 801 rtlphy->mcs_txpwrlevel_origoffset
807 [rtlphy->pwrgroup_cnt][12])); 802 [rtlphy->pwrgroup_cnt][12]);
808 } 803 }
809 if (regaddr == RTXAGC_B_MCS15_MCS12) { 804 if (regaddr == RTXAGC_B_MCS15_MCS12) {
810 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][13] = 805 rtlphy->mcs_txpwrlevel_origoffset[rtlphy->pwrgroup_cnt][13] =
811 data; 806 data;
812 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 807 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
813 ("MCSTxPowerLevelOriginalOffset[%d][13] = 0x%ulx\n", 808 "MCSTxPowerLevelOriginalOffset[%d][13] = 0x%ulx\n",
814 rtlphy->pwrgroup_cnt, 809 rtlphy->pwrgroup_cnt,
815 rtlphy->mcs_txpwrlevel_origoffset 810 rtlphy->mcs_txpwrlevel_origoffset
816 [rtlphy->pwrgroup_cnt][13])); 811 [rtlphy->pwrgroup_cnt][13]);
817 rtlphy->pwrgroup_cnt++; 812 rtlphy->pwrgroup_cnt++;
818 } 813 }
819} 814}
@@ -849,7 +844,7 @@ static bool _rtl92d_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
849 } 844 }
850 } else { 845 } else {
851 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 846 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
852 ("configtype != BaseBand_Config_PHY_REG\n")); 847 "configtype != BaseBand_Config_PHY_REG\n");
853 } 848 }
854 return true; 849 return true;
855} 850}
@@ -861,17 +856,17 @@ static bool _rtl92d_phy_bb_config(struct ieee80211_hw *hw)
861 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 856 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
862 bool rtstatus = true; 857 bool rtstatus = true;
863 858
864 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("==>\n")); 859 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "==>\n");
865 rtstatus = _rtl92d_phy_config_bb_with_headerfile(hw, 860 rtstatus = _rtl92d_phy_config_bb_with_headerfile(hw,
866 BASEBAND_CONFIG_PHY_REG); 861 BASEBAND_CONFIG_PHY_REG);
867 if (rtstatus != true) { 862 if (rtstatus != true) {
868 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Write BB Reg Fail!!")); 863 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n");
869 return false; 864 return false;
870 } 865 }
871 866
872 /* if (rtlphy->rf_type == RF_1T2R) { 867 /* if (rtlphy->rf_type == RF_1T2R) {
873 * _rtl92c_phy_bb_config_1t(hw); 868 * _rtl92c_phy_bb_config_1t(hw);
874 * RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Config to 1T!!\n")); 869 * RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Config to 1T!!\n");
875 *} */ 870 *} */
876 871
877 if (rtlefuse->autoload_failflag == false) { 872 if (rtlefuse->autoload_failflag == false) {
@@ -880,13 +875,13 @@ static bool _rtl92d_phy_bb_config(struct ieee80211_hw *hw)
880 BASEBAND_CONFIG_PHY_REG); 875 BASEBAND_CONFIG_PHY_REG);
881 } 876 }
882 if (rtstatus != true) { 877 if (rtstatus != true) {
883 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("BB_PG Reg Fail!!")); 878 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n");
884 return false; 879 return false;
885 } 880 }
886 rtstatus = _rtl92d_phy_config_bb_with_headerfile(hw, 881 rtstatus = _rtl92d_phy_config_bb_with_headerfile(hw,
887 BASEBAND_CONFIG_AGC_TAB); 882 BASEBAND_CONFIG_AGC_TAB);
888 if (rtstatus != true) { 883 if (rtstatus != true) {
889 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("AGC Table Fail\n")); 884 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "AGC Table Fail\n");
890 return false; 885 return false;
891 } 886 }
892 rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw, 887 rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw,
@@ -951,19 +946,17 @@ bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
951 radiob_array_table = rtl8192de_radiob_2t_int_paarray; 946 radiob_array_table = rtl8192de_radiob_2t_int_paarray;
952 } 947 }
953 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 948 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
954 ("PHY_ConfigRFWithHeaderFile() " 949 "PHY_ConfigRFWithHeaderFile() Radio_A:Rtl819XRadioA_1TArray\n");
955 "Radio_A:Rtl819XRadioA_1TArray\n"));
956 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 950 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
957 ("PHY_ConfigRFWithHeaderFile() " 951 "PHY_ConfigRFWithHeaderFile() Radio_B:Rtl819XRadioB_1TArray\n");
958 "Radio_B:Rtl819XRadioB_1TArray\n")); 952 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath);
959 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("Radio No %x\n", rfpath));
960 953
961 /* this only happens when DMDP, mac0 start on 2.4G, 954 /* this only happens when DMDP, mac0 start on 2.4G,
962 * mac1 start on 5G, mac 0 has to set phy0&phy1 955 * mac1 start on 5G, mac 0 has to set phy0&phy1
963 * pathA or mac1 has to set phy0&phy1 pathA */ 956 * pathA or mac1 has to set phy0&phy1 pathA */
964 if ((content == radiob_txt) && (rfpath == RF90_PATH_A)) { 957 if ((content == radiob_txt) && (rfpath == RF90_PATH_A)) {
965 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 958 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
966 (" ===> althougth Path A, we load radiob.txt\n")); 959 " ===> althougth Path A, we load radiob.txt\n");
967 radioa_arraylen = radiob_arraylen; 960 radioa_arraylen = radiob_arraylen;
968 radioa_array_table = radiob_array_table; 961 radioa_array_table = radiob_array_table;
969 } 962 }
@@ -1022,11 +1015,11 @@ bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
1022 break; 1015 break;
1023 case RF90_PATH_C: 1016 case RF90_PATH_C:
1024 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1017 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1025 ("switch case not process\n")); 1018 "switch case not processed\n");
1026 break; 1019 break;
1027 case RF90_PATH_D: 1020 case RF90_PATH_D:
1028 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1021 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1029 ("switch case not process\n")); 1022 "switch case not processed\n");
1030 break; 1023 break;
1031 } 1024 }
1032 return true; 1025 return true;
@@ -1046,19 +1039,18 @@ void rtl92d_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
1046 rtlphy->default_initialgain[3] = 1039 rtlphy->default_initialgain[3] =
1047 (u8) rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, BMASKBYTE0); 1040 (u8) rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, BMASKBYTE0);
1048 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1041 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1049 ("Default initial gain (c50=0x%x, " 1042 "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x\n",
1050 "c58=0x%x, c60=0x%x, c68=0x%x\n", 1043 rtlphy->default_initialgain[0],
1051 rtlphy->default_initialgain[0], 1044 rtlphy->default_initialgain[1],
1052 rtlphy->default_initialgain[1], 1045 rtlphy->default_initialgain[2],
1053 rtlphy->default_initialgain[2], 1046 rtlphy->default_initialgain[3]);
1054 rtlphy->default_initialgain[3]));
1055 rtlphy->framesync = (u8)rtl_get_bbreg(hw, ROFDM0_RXDETECTOR3, 1047 rtlphy->framesync = (u8)rtl_get_bbreg(hw, ROFDM0_RXDETECTOR3,
1056 BMASKBYTE0); 1048 BMASKBYTE0);
1057 rtlphy->framesync_c34 = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR2, 1049 rtlphy->framesync_c34 = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR2,
1058 BMASKDWORD); 1050 BMASKDWORD);
1059 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1051 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1060 ("Default framesync (0x%x) = 0x%x\n", 1052 "Default framesync (0x%x) = 0x%x\n",
1061 ROFDM0_RXDETECTOR3, rtlphy->framesync)); 1053 ROFDM0_RXDETECTOR3, rtlphy->framesync);
1062} 1054}
1063 1055
1064static void _rtl92d_get_txpower_index(struct ieee80211_hw *hw, u8 channel, 1056static void _rtl92d_get_txpower_index(struct ieee80211_hw *hw, u8 channel,
@@ -1172,7 +1164,7 @@ void rtl92d_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
1172 break; 1164 break;
1173 default: 1165 default:
1174 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1166 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1175 ("Unknown Scan Backup operation.\n")); 1167 "Unknown Scan Backup operation\n");
1176 break; 1168 break;
1177 } 1169 }
1178 } 1170 }
@@ -1193,14 +1185,13 @@ void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw,
1193 return; 1185 return;
1194 if ((is_hal_stop(rtlhal)) || (RT_CANNOT_IO(hw))) { 1186 if ((is_hal_stop(rtlhal)) || (RT_CANNOT_IO(hw))) {
1195 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1187 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1196 ("FALSE driver sleep or unload\n")); 1188 "FALSE driver sleep or unload\n");
1197 return; 1189 return;
1198 } 1190 }
1199 rtlphy->set_bwmode_inprogress = true; 1191 rtlphy->set_bwmode_inprogress = true;
1200 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, 1192 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n",
1201 ("Switch to %s bandwidth\n", 1193 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
1202 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? 1194 "20MHz" : "40MHz");
1203 "20MHz" : "40MHz"));
1204 reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); 1195 reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE);
1205 reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); 1196 reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2);
1206 switch (rtlphy->current_chan_bw) { 1197 switch (rtlphy->current_chan_bw) {
@@ -1218,7 +1209,7 @@ void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw,
1218 break; 1209 break;
1219 default: 1210 default:
1220 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1211 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1221 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 1212 "unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
1222 break; 1213 break;
1223 } 1214 }
1224 switch (rtlphy->current_chan_bw) { 1215 switch (rtlphy->current_chan_bw) {
@@ -1250,13 +1241,13 @@ void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw,
1250 break; 1241 break;
1251 default: 1242 default:
1252 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1243 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1253 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 1244 "unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
1254 break; 1245 break;
1255 1246
1256 } 1247 }
1257 rtl92d_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); 1248 rtl92d_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
1258 rtlphy->set_bwmode_inprogress = false; 1249 rtlphy->set_bwmode_inprogress = false;
1259 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 1250 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n");
1260} 1251}
1261 1252
1262static void _rtl92d_phy_stop_trx_before_changeband(struct ieee80211_hw *hw) 1253static void _rtl92d_phy_stop_trx_before_changeband(struct ieee80211_hw *hw)
@@ -1273,7 +1264,7 @@ static void rtl92d_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band)
1273 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1264 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1274 u8 value8; 1265 u8 value8;
1275 1266
1276 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("==>\n")); 1267 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "==>\n");
1277 rtlhal->bandset = band; 1268 rtlhal->bandset = band;
1278 rtlhal->current_bandtype = band; 1269 rtlhal->current_bandtype = band;
1279 if (IS_92D_SINGLEPHY(rtlhal->version)) 1270 if (IS_92D_SINGLEPHY(rtlhal->version))
@@ -1283,13 +1274,13 @@ static void rtl92d_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band)
1283 /* reconfig BB/RF according to wireless mode */ 1274 /* reconfig BB/RF according to wireless mode */
1284 if (rtlhal->current_bandtype == BAND_ON_2_4G) { 1275 if (rtlhal->current_bandtype == BAND_ON_2_4G) {
1285 /* BB & RF Config */ 1276 /* BB & RF Config */
1286 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, ("====>2.4G\n")); 1277 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "====>2.4G\n");
1287 if (rtlhal->interfaceindex == 1) 1278 if (rtlhal->interfaceindex == 1)
1288 _rtl92d_phy_config_bb_with_headerfile(hw, 1279 _rtl92d_phy_config_bb_with_headerfile(hw,
1289 BASEBAND_CONFIG_AGC_TAB); 1280 BASEBAND_CONFIG_AGC_TAB);
1290 } else { 1281 } else {
1291 /* 5G band */ 1282 /* 5G band */
1292 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, ("====>5G\n")); 1283 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "====>5G\n");
1293 if (rtlhal->interfaceindex == 1) 1284 if (rtlhal->interfaceindex == 1)
1294 _rtl92d_phy_config_bb_with_headerfile(hw, 1285 _rtl92d_phy_config_bb_with_headerfile(hw,
1295 BASEBAND_CONFIG_AGC_TAB); 1286 BASEBAND_CONFIG_AGC_TAB);
@@ -1317,7 +1308,7 @@ static void rtl92d_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band)
1317 0 ? REG_MAC0 : REG_MAC1), value8); 1308 0 ? REG_MAC0 : REG_MAC1), value8);
1318 } 1309 }
1319 mdelay(1); 1310 mdelay(1);
1320 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("<==Switch Band OK.\n")); 1311 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "<==Switch Band OK\n");
1321} 1312}
1322 1313
1323static void _rtl92d_phy_reload_imr_setting(struct ieee80211_hw *hw, 1314static void _rtl92d_phy_reload_imr_setting(struct ieee80211_hw *hw,
@@ -1329,9 +1320,9 @@ static void _rtl92d_phy_reload_imr_setting(struct ieee80211_hw *hw,
1329 u8 group, i; 1320 u8 group, i;
1330 unsigned long flag = 0; 1321 unsigned long flag = 0;
1331 1322
1332 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("====>path %d\n", rfpath)); 1323 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>path %d\n", rfpath);
1333 if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G) { 1324 if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G) {
1334 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("====>5G\n")); 1325 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>5G\n");
1335 rtl_set_bbreg(hw, RFPGA0_RFMOD, BIT(25) | BIT(24), 0); 1326 rtl_set_bbreg(hw, RFPGA0_RFMOD, BIT(25) | BIT(24), 0);
1336 rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0xf); 1327 rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0xf);
1337 /* fc area 0xd2c */ 1328 /* fc area 0xd2c */
@@ -1353,14 +1344,13 @@ static void _rtl92d_phy_reload_imr_setting(struct ieee80211_hw *hw,
1353 } else { 1344 } else {
1354 /* G band. */ 1345 /* G band. */
1355 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, 1346 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
1356 ("Load RF IMR parameters for G band. IMR already " 1347 "Load RF IMR parameters for G band. IMR already setting %d\n",
1357 "setting %d\n", 1348 rtlpriv->rtlhal.load_imrandiqk_setting_for2g);
1358 rtlpriv->rtlhal.load_imrandiqk_setting_for2g)); 1349 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>2.4G\n");
1359 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("====>2.4G\n"));
1360 if (!rtlpriv->rtlhal.load_imrandiqk_setting_for2g) { 1350 if (!rtlpriv->rtlhal.load_imrandiqk_setting_for2g) {
1361 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, 1351 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
1362 ("Load RF IMR parameters " 1352 "Load RF IMR parameters for G band. %d\n",
1363 "for G band. %d\n", rfpath)); 1353 rfpath);
1364 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); 1354 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag);
1365 rtl_set_bbreg(hw, RFPGA0_RFMOD, BIT(25) | BIT(24), 0); 1355 rtl_set_bbreg(hw, RFPGA0_RFMOD, BIT(25) | BIT(24), 0);
1366 rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 1356 rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4,
@@ -1378,7 +1368,7 @@ static void _rtl92d_phy_reload_imr_setting(struct ieee80211_hw *hw,
1378 rtl92d_release_cckandrw_pagea_ctl(hw, &flag); 1368 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
1379 } 1369 }
1380 } 1370 }
1381 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("<====\n")); 1371 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "<====\n");
1382} 1372}
1383 1373
1384static void _rtl92d_phy_enable_rf_env(struct ieee80211_hw *hw, 1374static void _rtl92d_phy_enable_rf_env(struct ieee80211_hw *hw,
@@ -1388,7 +1378,7 @@ static void _rtl92d_phy_enable_rf_env(struct ieee80211_hw *hw,
1388 struct rtl_phy *rtlphy = &(rtlpriv->phy); 1378 struct rtl_phy *rtlphy = &(rtlpriv->phy);
1389 struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; 1379 struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath];
1390 1380
1391 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("====>\n")); 1381 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "====>\n");
1392 /*----Store original RFENV control type----*/ 1382 /*----Store original RFENV control type----*/
1393 switch (rfpath) { 1383 switch (rfpath) {
1394 case RF90_PATH_A: 1384 case RF90_PATH_A:
@@ -1414,7 +1404,7 @@ static void _rtl92d_phy_enable_rf_env(struct ieee80211_hw *hw,
1414 /*Set 0 to 12 bits for 8255 */ 1404 /*Set 0 to 12 bits for 8255 */
1415 rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0); 1405 rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0);
1416 udelay(1); 1406 udelay(1);
1417 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("<====\n")); 1407 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "<====\n");
1418} 1408}
1419 1409
1420static void _rtl92d_phy_restore_rf_env(struct ieee80211_hw *hw, u8 rfpath, 1410static void _rtl92d_phy_restore_rf_env(struct ieee80211_hw *hw, u8 rfpath,
@@ -1424,7 +1414,7 @@ static void _rtl92d_phy_restore_rf_env(struct ieee80211_hw *hw, u8 rfpath,
1424 struct rtl_phy *rtlphy = &(rtlpriv->phy); 1414 struct rtl_phy *rtlphy = &(rtlpriv->phy);
1425 struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; 1415 struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath];
1426 1416
1427 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("=====>\n")); 1417 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "=====>\n");
1428 /*----Restore RFENV control type----*/ ; 1418 /*----Restore RFENV control type----*/ ;
1429 switch (rfpath) { 1419 switch (rfpath) {
1430 case RF90_PATH_A: 1420 case RF90_PATH_A:
@@ -1437,7 +1427,7 @@ static void _rtl92d_phy_restore_rf_env(struct ieee80211_hw *hw, u8 rfpath,
1437 *pu4_regval); 1427 *pu4_regval);
1438 break; 1428 break;
1439 } 1429 }
1440 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("<=====\n")); 1430 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "<=====\n");
1441} 1431}
1442 1432
1443static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel) 1433static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel)
@@ -1451,13 +1441,13 @@ static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel)
1451 bool need_pwr_down = false, internal_pa = false; 1441 bool need_pwr_down = false, internal_pa = false;
1452 u32 u4regvalue, mask = 0x1C000, value = 0, u4tmp, u4tmp2; 1442 u32 u4regvalue, mask = 0x1C000, value = 0, u4tmp, u4tmp2;
1453 1443
1454 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("====>\n")); 1444 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>\n");
1455 /* config path A for 5G */ 1445 /* config path A for 5G */
1456 if (rtlhal->current_bandtype == BAND_ON_5G) { 1446 if (rtlhal->current_bandtype == BAND_ON_5G) {
1457 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("====>5G\n")); 1447 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>5G\n");
1458 u4tmp = curveindex_5g[channel - 1]; 1448 u4tmp = curveindex_5g[channel - 1];
1459 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("ver 1 set RF-A, 5G, " 1449 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1460 "0x28 = 0x%x !!\n", u4tmp)); 1450 "ver 1 set RF-A, 5G, 0x28 = 0x%x !!\n", u4tmp);
1461 for (i = 0; i < RF_CHNL_NUM_5G; i++) { 1451 for (i = 0; i < RF_CHNL_NUM_5G; i++) {
1462 if (channel == rf_chnl_5g[i] && channel <= 140) 1452 if (channel == rf_chnl_5g[i] && channel <= 140)
1463 index = 0; 1453 index = 0;
@@ -1503,12 +1493,13 @@ static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel)
1503 rf_reg_pram_c_5g[index][i]); 1493 rf_reg_pram_c_5g[index][i]);
1504 } 1494 }
1505 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 1495 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
1506 ("offset 0x%x value 0x%x " 1496 "offset 0x%x value 0x%x path %d index %d readback 0x%x\n",
1507 "path %d index %d readback 0x%x\n", 1497 rf_reg_for_c_cut_5g[i],
1508 rf_reg_for_c_cut_5g[i], 1498 rf_reg_pram_c_5g[index][i],
1509 rf_reg_pram_c_5g[index][i], path, 1499 path, index,
1510 index, rtl_get_rfreg(hw, (enum radio_path)path, 1500 rtl_get_rfreg(hw, (enum radio_path)path,
1511 rf_reg_for_c_cut_5g[i], BRFREGOFFSETMASK))); 1501 rf_reg_for_c_cut_5g[i],
1502 BRFREGOFFSETMASK));
1512 } 1503 }
1513 if (need_pwr_down) 1504 if (need_pwr_down)
1514 _rtl92d_phy_restore_rf_env(hw, path, &u4regvalue); 1505 _rtl92d_phy_restore_rf_env(hw, path, &u4regvalue);
@@ -1541,11 +1532,10 @@ static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel)
1541 BRFREGOFFSETMASK, 1532 BRFREGOFFSETMASK,
1542 rf_pram_c_5g_int_pa[index][i]); 1533 rf_pram_c_5g_int_pa[index][i]);
1543 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, 1534 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD,
1544 ("offset 0x%x value 0x%x " 1535 "offset 0x%x value 0x%x path %d index %d\n",
1545 "path %d index %d\n",
1546 rf_for_c_cut_5g_internal_pa[i], 1536 rf_for_c_cut_5g_internal_pa[i],
1547 rf_pram_c_5g_int_pa[index][i], 1537 rf_pram_c_5g_int_pa[index][i],
1548 rfpath, index)); 1538 rfpath, index);
1549 } 1539 }
1550 } else { 1540 } else {
1551 rtl_set_rfreg(hw, (enum radio_path)rfpath, 0x0B, 1541 rtl_set_rfreg(hw, (enum radio_path)rfpath, 0x0B,
@@ -1553,10 +1543,10 @@ static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel)
1553 } 1543 }
1554 } 1544 }
1555 } else if (rtlhal->current_bandtype == BAND_ON_2_4G) { 1545 } else if (rtlhal->current_bandtype == BAND_ON_2_4G) {
1556 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("====>2.4G\n")); 1546 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>2.4G\n");
1557 u4tmp = curveindex_2g[channel - 1]; 1547 u4tmp = curveindex_2g[channel - 1];
1558 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("ver 3 set RF-B, 2G, " 1548 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1559 "0x28 = 0x%x !!\n", u4tmp)); 1549 "ver 3 set RF-B, 2G, 0x28 = 0x%x !!\n", u4tmp);
1560 if (channel == 1 || channel == 2 || channel == 4 || channel == 9 1550 if (channel == 1 || channel == 2 || channel == 4 || channel == 9
1561 || channel == 10 || channel == 11 || channel == 12) 1551 || channel == 10 || channel == 11 || channel == 12)
1562 index = 0; 1552 index = 0;
@@ -1590,18 +1580,17 @@ static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel)
1590 rf_reg_param_for_c_cut_2g 1580 rf_reg_param_for_c_cut_2g
1591 [index][i]); 1581 [index][i]);
1592 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 1582 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
1593 ("offset 0x%x value 0x%x mak 0x%x path %d " 1583 "offset 0x%x value 0x%x mak 0x%x path %d index %d readback 0x%x\n",
1594 "index %d readback 0x%x\n", 1584 rf_reg_for_c_cut_2g[i],
1595 rf_reg_for_c_cut_2g[i], 1585 rf_reg_param_for_c_cut_2g[index][i],
1596 rf_reg_param_for_c_cut_2g[index][i], 1586 rf_reg_mask_for_c_cut_2g[i], path, index,
1597 rf_reg_mask_for_c_cut_2g[i], path, index, 1587 rtl_get_rfreg(hw, (enum radio_path)path,
1598 rtl_get_rfreg(hw, (enum radio_path)path, 1588 rf_reg_for_c_cut_2g[i],
1599 rf_reg_for_c_cut_2g[i], 1589 BRFREGOFFSETMASK));
1600 BRFREGOFFSETMASK)));
1601 } 1590 }
1602 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1591 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1603 ("cosa ver 3 set RF-B, 2G, 0x28 = 0x%x !!\n", 1592 "cosa ver 3 set RF-B, 2G, 0x28 = 0x%x !!\n",
1604 rf_syn_g4_for_c_cut_2g | (u4tmp << 11))); 1593 rf_syn_g4_for_c_cut_2g | (u4tmp << 11));
1605 1594
1606 rtl_set_rfreg(hw, (enum radio_path)path, RF_SYN_G4, 1595 rtl_set_rfreg(hw, (enum radio_path)path, RF_SYN_G4,
1607 BRFREGOFFSETMASK, 1596 BRFREGOFFSETMASK,
@@ -1611,7 +1600,7 @@ static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel)
1611 if (rtlhal->during_mac0init_radiob) 1600 if (rtlhal->during_mac0init_radiob)
1612 rtl92d_phy_powerdown_anotherphy(hw, true); 1601 rtl92d_phy_powerdown_anotherphy(hw, true);
1613 } 1602 }
1614 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("<====\n")); 1603 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "<====\n");
1615} 1604}
1616 1605
1617u8 rtl92d_get_rightchnlplace_for_iqk(u8 chnl) 1606u8 rtl92d_get_rightchnlplace_for_iqk(u8 chnl)
@@ -1648,9 +1637,9 @@ static u8 _rtl92d_phy_patha_iqk(struct ieee80211_hw *hw, bool configpathb)
1648 u32 regeac, rege94, rege9c, regea4; 1637 u32 regeac, rege94, rege9c, regea4;
1649 u8 result = 0; 1638 u8 result = 0;
1650 1639
1651 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path A IQK!\n")); 1640 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK!\n");
1652 /* path-A IQK setting */ 1641 /* path-A IQK setting */
1653 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path-A IQK setting!\n")); 1642 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path-A IQK setting!\n");
1654 if (rtlhal->interfaceindex == 0) { 1643 if (rtlhal->interfaceindex == 0) {
1655 rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x10008c1f); 1644 rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x10008c1f);
1656 rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x10008c1f); 1645 rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x10008c1f);
@@ -1668,26 +1657,26 @@ static u8 _rtl92d_phy_patha_iqk(struct ieee80211_hw *hw, bool configpathb)
1668 rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x28160206); 1657 rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x28160206);
1669 } 1658 }
1670 /* LO calibration setting */ 1659 /* LO calibration setting */
1671 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("LO calibration setting!\n")); 1660 RTPRINT(rtlpriv, FINIT, INIT_IQK, "LO calibration setting!\n");
1672 rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911); 1661 rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911);
1673 /* One shot, path A LOK & IQK */ 1662 /* One shot, path A LOK & IQK */
1674 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("One shot, path A LOK & IQK!\n")); 1663 RTPRINT(rtlpriv, FINIT, INIT_IQK, "One shot, path A LOK & IQK!\n");
1675 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf9000000); 1664 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf9000000);
1676 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000); 1665 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000);
1677 /* delay x ms */ 1666 /* delay x ms */
1678 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1667 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1679 ("Delay %d ms for One shot, path A LOK & IQK.\n", 1668 "Delay %d ms for One shot, path A LOK & IQK\n",
1680 IQK_DELAY_TIME)); 1669 IQK_DELAY_TIME);
1681 mdelay(IQK_DELAY_TIME); 1670 mdelay(IQK_DELAY_TIME);
1682 /* Check failed */ 1671 /* Check failed */
1683 regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD); 1672 regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD);
1684 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xeac = 0x%x\n", regeac)); 1673 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeac = 0x%x\n", regeac);
1685 rege94 = rtl_get_bbreg(hw, 0xe94, BMASKDWORD); 1674 rege94 = rtl_get_bbreg(hw, 0xe94, BMASKDWORD);
1686 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xe94 = 0x%x\n", rege94)); 1675 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe94 = 0x%x\n", rege94);
1687 rege9c = rtl_get_bbreg(hw, 0xe9c, BMASKDWORD); 1676 rege9c = rtl_get_bbreg(hw, 0xe9c, BMASKDWORD);
1688 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xe9c = 0x%x\n", rege9c)); 1677 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe9c = 0x%x\n", rege9c);
1689 regea4 = rtl_get_bbreg(hw, 0xea4, BMASKDWORD); 1678 regea4 = rtl_get_bbreg(hw, 0xea4, BMASKDWORD);
1690 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xea4 = 0x%x\n", regea4)); 1679 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xea4 = 0x%x\n", regea4);
1691 if (!(regeac & BIT(28)) && (((rege94 & 0x03FF0000) >> 16) != 0x142) && 1680 if (!(regeac & BIT(28)) && (((rege94 & 0x03FF0000) >> 16) != 0x142) &&
1692 (((rege9c & 0x03FF0000) >> 16) != 0x42)) 1681 (((rege9c & 0x03FF0000) >> 16) != 0x42))
1693 result |= 0x01; 1682 result |= 0x01;
@@ -1698,7 +1687,7 @@ static u8 _rtl92d_phy_patha_iqk(struct ieee80211_hw *hw, bool configpathb)
1698 (((regeac & 0x03FF0000) >> 16) != 0x36)) 1687 (((regeac & 0x03FF0000) >> 16) != 0x36))
1699 result |= 0x02; 1688 result |= 0x02;
1700 else 1689 else
1701 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path A Rx IQK fail!!\n")); 1690 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A Rx IQK fail!!\n");
1702 return result; 1691 return result;
1703} 1692}
1704 1693
@@ -1719,9 +1708,9 @@ static u8 _rtl92d_phy_patha_iqk_5g_normal(struct ieee80211_hw *hw,
1719 TxOKBit = BIT(31); 1708 TxOKBit = BIT(31);
1720 RxOKBit = BIT(30); 1709 RxOKBit = BIT(30);
1721 } 1710 }
1722 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path A IQK!\n")); 1711 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK!\n");
1723 /* path-A IQK setting */ 1712 /* path-A IQK setting */
1724 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path-A IQK setting!\n")); 1713 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path-A IQK setting!\n");
1725 rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x18008c1f); 1714 rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x18008c1f);
1726 rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x18008c1f); 1715 rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x18008c1f);
1727 rtl_set_bbreg(hw, 0xe38, BMASKDWORD, 0x82140307); 1716 rtl_set_bbreg(hw, 0xe38, BMASKDWORD, 0x82140307);
@@ -1734,7 +1723,7 @@ static u8 _rtl92d_phy_patha_iqk_5g_normal(struct ieee80211_hw *hw,
1734 rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x68110000); 1723 rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x68110000);
1735 } 1724 }
1736 /* LO calibration setting */ 1725 /* LO calibration setting */
1737 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("LO calibration setting!\n")); 1726 RTPRINT(rtlpriv, FINIT, INIT_IQK, "LO calibration setting!\n");
1738 rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911); 1727 rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911);
1739 /* path-A PA on */ 1728 /* path-A PA on */
1740 rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, BMASKDWORD, 0x07000f60); 1729 rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, BMASKDWORD, 0x07000f60);
@@ -1742,29 +1731,29 @@ static u8 _rtl92d_phy_patha_iqk_5g_normal(struct ieee80211_hw *hw,
1742 for (i = 0; i < retrycount; i++) { 1731 for (i = 0; i < retrycount; i++) {
1743 /* One shot, path A LOK & IQK */ 1732 /* One shot, path A LOK & IQK */
1744 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1733 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1745 ("One shot, path A LOK & IQK!\n")); 1734 "One shot, path A LOK & IQK!\n");
1746 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf9000000); 1735 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf9000000);
1747 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000); 1736 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000);
1748 /* delay x ms */ 1737 /* delay x ms */
1749 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1738 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1750 ("Delay %d ms for One shot, path A LOK & IQK.\n", 1739 "Delay %d ms for One shot, path A LOK & IQK.\n",
1751 IQK_DELAY_TIME)); 1740 IQK_DELAY_TIME);
1752 mdelay(IQK_DELAY_TIME * 10); 1741 mdelay(IQK_DELAY_TIME * 10);
1753 /* Check failed */ 1742 /* Check failed */
1754 regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD); 1743 regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD);
1755 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xeac = 0x%x\n", regeac)); 1744 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeac = 0x%x\n", regeac);
1756 rege94 = rtl_get_bbreg(hw, 0xe94, BMASKDWORD); 1745 rege94 = rtl_get_bbreg(hw, 0xe94, BMASKDWORD);
1757 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xe94 = 0x%x\n", rege94)); 1746 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe94 = 0x%x\n", rege94);
1758 rege9c = rtl_get_bbreg(hw, 0xe9c, BMASKDWORD); 1747 rege9c = rtl_get_bbreg(hw, 0xe9c, BMASKDWORD);
1759 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xe9c = 0x%x\n", rege9c)); 1748 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe9c = 0x%x\n", rege9c);
1760 regea4 = rtl_get_bbreg(hw, 0xea4, BMASKDWORD); 1749 regea4 = rtl_get_bbreg(hw, 0xea4, BMASKDWORD);
1761 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xea4 = 0x%x\n", regea4)); 1750 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xea4 = 0x%x\n", regea4);
1762 if (!(regeac & TxOKBit) && 1751 if (!(regeac & TxOKBit) &&
1763 (((rege94 & 0x03FF0000) >> 16) != 0x142)) { 1752 (((rege94 & 0x03FF0000) >> 16) != 0x142)) {
1764 result |= 0x01; 1753 result |= 0x01;
1765 } else { /* if Tx not OK, ignore Rx */ 1754 } else { /* if Tx not OK, ignore Rx */
1766 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1755 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1767 ("Path A Tx IQK fail!!\n")); 1756 "Path A Tx IQK fail!!\n");
1768 continue; 1757 continue;
1769 } 1758 }
1770 1759
@@ -1775,7 +1764,7 @@ static u8 _rtl92d_phy_patha_iqk_5g_normal(struct ieee80211_hw *hw,
1775 break; 1764 break;
1776 } else { 1765 } else {
1777 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1766 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1778 ("Path A Rx IQK fail!!\n")); 1767 "Path A Rx IQK fail!!\n");
1779 } 1768 }
1780 } 1769 }
1781 /* path A PA off */ 1770 /* path A PA off */
@@ -1793,27 +1782,26 @@ static u8 _rtl92d_phy_pathb_iqk(struct ieee80211_hw *hw)
1793 u32 regeac, regeb4, regebc, regec4, regecc; 1782 u32 regeac, regeb4, regebc, regec4, regecc;
1794 u8 result = 0; 1783 u8 result = 0;
1795 1784
1796 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path B IQK!\n")); 1785 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path B IQK!\n");
1797 /* One shot, path B LOK & IQK */ 1786 /* One shot, path B LOK & IQK */
1798 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("One shot, path A LOK & IQK!\n")); 1787 RTPRINT(rtlpriv, FINIT, INIT_IQK, "One shot, path A LOK & IQK!\n");
1799 rtl_set_bbreg(hw, 0xe60, BMASKDWORD, 0x00000002); 1788 rtl_set_bbreg(hw, 0xe60, BMASKDWORD, 0x00000002);
1800 rtl_set_bbreg(hw, 0xe60, BMASKDWORD, 0x00000000); 1789 rtl_set_bbreg(hw, 0xe60, BMASKDWORD, 0x00000000);
1801 /* delay x ms */ 1790 /* delay x ms */
1802 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1791 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1803 ("Delay %d ms for One shot, path B LOK & IQK.\n", 1792 "Delay %d ms for One shot, path B LOK & IQK\n", IQK_DELAY_TIME);
1804 IQK_DELAY_TIME));
1805 mdelay(IQK_DELAY_TIME); 1793 mdelay(IQK_DELAY_TIME);
1806 /* Check failed */ 1794 /* Check failed */
1807 regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD); 1795 regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD);
1808 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xeac = 0x%x\n", regeac)); 1796 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeac = 0x%x\n", regeac);
1809 regeb4 = rtl_get_bbreg(hw, 0xeb4, BMASKDWORD); 1797 regeb4 = rtl_get_bbreg(hw, 0xeb4, BMASKDWORD);
1810 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xeb4 = 0x%x\n", regeb4)); 1798 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeb4 = 0x%x\n", regeb4);
1811 regebc = rtl_get_bbreg(hw, 0xebc, BMASKDWORD); 1799 regebc = rtl_get_bbreg(hw, 0xebc, BMASKDWORD);
1812 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xebc = 0x%x\n", regebc)); 1800 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xebc = 0x%x\n", regebc);
1813 regec4 = rtl_get_bbreg(hw, 0xec4, BMASKDWORD); 1801 regec4 = rtl_get_bbreg(hw, 0xec4, BMASKDWORD);
1814 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xec4 = 0x%x\n", regec4)); 1802 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xec4 = 0x%x\n", regec4);
1815 regecc = rtl_get_bbreg(hw, 0xecc, BMASKDWORD); 1803 regecc = rtl_get_bbreg(hw, 0xecc, BMASKDWORD);
1816 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xecc = 0x%x\n", regecc)); 1804 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xecc = 0x%x\n", regecc);
1817 if (!(regeac & BIT(31)) && (((regeb4 & 0x03FF0000) >> 16) != 0x142) && 1805 if (!(regeac & BIT(31)) && (((regeb4 & 0x03FF0000) >> 16) != 0x142) &&
1818 (((regebc & 0x03FF0000) >> 16) != 0x42)) 1806 (((regebc & 0x03FF0000) >> 16) != 0x42))
1819 result |= 0x01; 1807 result |= 0x01;
@@ -1823,7 +1811,7 @@ static u8 _rtl92d_phy_pathb_iqk(struct ieee80211_hw *hw)
1823 (((regecc & 0x03FF0000) >> 16) != 0x36)) 1811 (((regecc & 0x03FF0000) >> 16) != 0x36))
1824 result |= 0x02; 1812 result |= 0x02;
1825 else 1813 else
1826 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path B Rx IQK fail!!\n")); 1814 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path B Rx IQK fail!!\n");
1827 return result; 1815 return result;
1828} 1816}
1829 1817
@@ -1837,9 +1825,9 @@ static u8 _rtl92d_phy_pathb_iqk_5g_normal(struct ieee80211_hw *hw)
1837 u8 i; 1825 u8 i;
1838 u8 retrycount = 2; 1826 u8 retrycount = 2;
1839 1827
1840 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path B IQK!\n")); 1828 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path B IQK!\n");
1841 /* path-A IQK setting */ 1829 /* path-A IQK setting */
1842 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path-A IQK setting!\n")); 1830 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path-A IQK setting!\n");
1843 rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x18008c1f); 1831 rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x18008c1f);
1844 rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x18008c1f); 1832 rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x18008c1f);
1845 rtl_set_bbreg(hw, 0xe38, BMASKDWORD, 0x82110000); 1833 rtl_set_bbreg(hw, 0xe38, BMASKDWORD, 0x82110000);
@@ -1852,7 +1840,7 @@ static u8 _rtl92d_phy_pathb_iqk_5g_normal(struct ieee80211_hw *hw)
1852 rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x68160960); 1840 rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x68160960);
1853 1841
1854 /* LO calibration setting */ 1842 /* LO calibration setting */
1855 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("LO calibration setting!\n")); 1843 RTPRINT(rtlpriv, FINIT, INIT_IQK, "LO calibration setting!\n");
1856 rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911); 1844 rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911);
1857 1845
1858 /* path-B PA on */ 1846 /* path-B PA on */
@@ -1862,26 +1850,26 @@ static u8 _rtl92d_phy_pathb_iqk_5g_normal(struct ieee80211_hw *hw)
1862 for (i = 0; i < retrycount; i++) { 1850 for (i = 0; i < retrycount; i++) {
1863 /* One shot, path B LOK & IQK */ 1851 /* One shot, path B LOK & IQK */
1864 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1852 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1865 ("One shot, path A LOK & IQK!\n")); 1853 "One shot, path A LOK & IQK!\n");
1866 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xfa000000); 1854 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xfa000000);
1867 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000); 1855 rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000);
1868 1856
1869 /* delay x ms */ 1857 /* delay x ms */
1870 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1858 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1871 ("Delay %d ms for One shot, path B LOK & IQK.\n", 10)); 1859 "Delay %d ms for One shot, path B LOK & IQK.\n", 10);
1872 mdelay(IQK_DELAY_TIME * 10); 1860 mdelay(IQK_DELAY_TIME * 10);
1873 1861
1874 /* Check failed */ 1862 /* Check failed */
1875 regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD); 1863 regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD);
1876 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xeac = 0x%x\n", regeac)); 1864 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeac = 0x%x\n", regeac);
1877 regeb4 = rtl_get_bbreg(hw, 0xeb4, BMASKDWORD); 1865 regeb4 = rtl_get_bbreg(hw, 0xeb4, BMASKDWORD);
1878 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xeb4 = 0x%x\n", regeb4)); 1866 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeb4 = 0x%x\n", regeb4);
1879 regebc = rtl_get_bbreg(hw, 0xebc, BMASKDWORD); 1867 regebc = rtl_get_bbreg(hw, 0xebc, BMASKDWORD);
1880 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xebc = 0x%x\n", regebc)); 1868 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xebc = 0x%x\n", regebc);
1881 regec4 = rtl_get_bbreg(hw, 0xec4, BMASKDWORD); 1869 regec4 = rtl_get_bbreg(hw, 0xec4, BMASKDWORD);
1882 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xec4 = 0x%x\n", regec4)); 1870 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xec4 = 0x%x\n", regec4);
1883 regecc = rtl_get_bbreg(hw, 0xecc, BMASKDWORD); 1871 regecc = rtl_get_bbreg(hw, 0xecc, BMASKDWORD);
1884 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xecc = 0x%x\n", regecc)); 1872 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xecc = 0x%x\n", regecc);
1885 if (!(regeac & BIT(31)) && 1873 if (!(regeac & BIT(31)) &&
1886 (((regeb4 & 0x03FF0000) >> 16) != 0x142)) 1874 (((regeb4 & 0x03FF0000) >> 16) != 0x142))
1887 result |= 0x01; 1875 result |= 0x01;
@@ -1893,7 +1881,7 @@ static u8 _rtl92d_phy_pathb_iqk_5g_normal(struct ieee80211_hw *hw)
1893 break; 1881 break;
1894 } else { 1882 } else {
1895 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1883 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1896 ("Path B Rx IQK fail!!\n")); 1884 "Path B Rx IQK fail!!\n");
1897 } 1885 }
1898 } 1886 }
1899 1887
@@ -1912,7 +1900,7 @@ static void _rtl92d_phy_save_adda_registers(struct ieee80211_hw *hw,
1912 struct rtl_priv *rtlpriv = rtl_priv(hw); 1900 struct rtl_priv *rtlpriv = rtl_priv(hw);
1913 u32 i; 1901 u32 i;
1914 1902
1915 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Save ADDA parameters.\n")); 1903 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Save ADDA parameters.\n");
1916 for (i = 0; i < regnum; i++) 1904 for (i = 0; i < regnum; i++)
1917 adda_backup[i] = rtl_get_bbreg(hw, adda_reg[i], BMASKDWORD); 1905 adda_backup[i] = rtl_get_bbreg(hw, adda_reg[i], BMASKDWORD);
1918} 1906}
@@ -1923,7 +1911,7 @@ static void _rtl92d_phy_save_mac_registers(struct ieee80211_hw *hw,
1923 struct rtl_priv *rtlpriv = rtl_priv(hw); 1911 struct rtl_priv *rtlpriv = rtl_priv(hw);
1924 u32 i; 1912 u32 i;
1925 1913
1926 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Save MAC parameters.\n")); 1914 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Save MAC parameters.\n");
1927 for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) 1915 for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++)
1928 macbackup[i] = rtl_read_byte(rtlpriv, macreg[i]); 1916 macbackup[i] = rtl_read_byte(rtlpriv, macreg[i]);
1929 macbackup[i] = rtl_read_dword(rtlpriv, macreg[i]); 1917 macbackup[i] = rtl_read_dword(rtlpriv, macreg[i]);
@@ -1937,7 +1925,7 @@ static void _rtl92d_phy_reload_adda_registers(struct ieee80211_hw *hw,
1937 u32 i; 1925 u32 i;
1938 1926
1939 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1927 RTPRINT(rtlpriv, FINIT, INIT_IQK,
1940 ("Reload ADDA power saving parameters !\n")); 1928 "Reload ADDA power saving parameters !\n");
1941 for (i = 0; i < regnum; i++) 1929 for (i = 0; i < regnum; i++)
1942 rtl_set_bbreg(hw, adda_reg[i], BMASKDWORD, adda_backup[i]); 1930 rtl_set_bbreg(hw, adda_reg[i], BMASKDWORD, adda_backup[i]);
1943} 1931}
@@ -1948,7 +1936,7 @@ static void _rtl92d_phy_reload_mac_registers(struct ieee80211_hw *hw,
1948 struct rtl_priv *rtlpriv = rtl_priv(hw); 1936 struct rtl_priv *rtlpriv = rtl_priv(hw);
1949 u32 i; 1937 u32 i;
1950 1938
1951 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Reload MAC parameters !\n")); 1939 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Reload MAC parameters !\n");
1952 for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) 1940 for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++)
1953 rtl_write_byte(rtlpriv, macreg[i], (u8) macbackup[i]); 1941 rtl_write_byte(rtlpriv, macreg[i], (u8) macbackup[i]);
1954 rtl_write_byte(rtlpriv, macreg[i], macbackup[i]); 1942 rtl_write_byte(rtlpriv, macreg[i], macbackup[i]);
@@ -1961,7 +1949,7 @@ static void _rtl92d_phy_path_adda_on(struct ieee80211_hw *hw,
1961 u32 pathon; 1949 u32 pathon;
1962 u32 i; 1950 u32 i;
1963 1951
1964 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("ADDA ON.\n")); 1952 RTPRINT(rtlpriv, FINIT, INIT_IQK, "ADDA ON.\n");
1965 pathon = patha_on ? 0x04db25a4 : 0x0b1b25a4; 1953 pathon = patha_on ? 0x04db25a4 : 0x0b1b25a4;
1966 if (patha_on) 1954 if (patha_on)
1967 pathon = rtlpriv->rtlhal.interfaceindex == 0 ? 1955 pathon = rtlpriv->rtlhal.interfaceindex == 0 ?
@@ -1976,7 +1964,7 @@ static void _rtl92d_phy_mac_setting_calibration(struct ieee80211_hw *hw,
1976 struct rtl_priv *rtlpriv = rtl_priv(hw); 1964 struct rtl_priv *rtlpriv = rtl_priv(hw);
1977 u32 i; 1965 u32 i;
1978 1966
1979 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("MAC settings for Calibration.\n")); 1967 RTPRINT(rtlpriv, FINIT, INIT_IQK, "MAC settings for Calibration.\n");
1980 rtl_write_byte(rtlpriv, macreg[0], 0x3F); 1968 rtl_write_byte(rtlpriv, macreg[0], 0x3F);
1981 1969
1982 for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++) 1970 for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++)
@@ -1988,7 +1976,7 @@ static void _rtl92d_phy_mac_setting_calibration(struct ieee80211_hw *hw,
1988static void _rtl92d_phy_patha_standby(struct ieee80211_hw *hw) 1976static void _rtl92d_phy_patha_standby(struct ieee80211_hw *hw)
1989{ 1977{
1990 struct rtl_priv *rtlpriv = rtl_priv(hw); 1978 struct rtl_priv *rtlpriv = rtl_priv(hw);
1991 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path-A standby mode!\n")); 1979 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path-A standby mode!\n");
1992 1980
1993 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x0); 1981 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x0);
1994 rtl_set_bbreg(hw, RFPGA0_XA_LSSIPARAMETER, BMASKDWORD, 0x00010000); 1982 rtl_set_bbreg(hw, RFPGA0_XA_LSSIPARAMETER, BMASKDWORD, 0x00010000);
@@ -2001,7 +1989,7 @@ static void _rtl92d_phy_pimode_switch(struct ieee80211_hw *hw, bool pi_mode)
2001 u32 mode; 1989 u32 mode;
2002 1990
2003 RTPRINT(rtlpriv, FINIT, INIT_IQK, 1991 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2004 ("BB Switch to %s mode!\n", (pi_mode ? "PI" : "SI"))); 1992 "BB Switch to %s mode!\n", pi_mode ? "PI" : "SI");
2005 mode = pi_mode ? 0x01000100 : 0x01000000; 1993 mode = pi_mode ? 0x01000100 : 0x01000000;
2006 rtl_set_bbreg(hw, 0x820, BMASKDWORD, mode); 1994 rtl_set_bbreg(hw, 0x820, BMASKDWORD, mode);
2007 rtl_set_bbreg(hw, 0x828, BMASKDWORD, mode); 1995 rtl_set_bbreg(hw, 0x828, BMASKDWORD, mode);
@@ -2033,12 +2021,12 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2033 const u32 retrycount = 2; 2021 const u32 retrycount = 2;
2034 u32 bbvalue; 2022 u32 bbvalue;
2035 2023
2036 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("IQK for 2.4G :Start!!!\n")); 2024 RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQK for 2.4G :Start!!!\n");
2037 if (t == 0) { 2025 if (t == 0) {
2038 bbvalue = rtl_get_bbreg(hw, RFPGA0_RFMOD, BMASKDWORD); 2026 bbvalue = rtl_get_bbreg(hw, RFPGA0_RFMOD, BMASKDWORD);
2039 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("==>0x%08x\n", bbvalue)); 2027 RTPRINT(rtlpriv, FINIT, INIT_IQK, "==>0x%08x\n", bbvalue);
2040 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("IQ Calibration for %s\n", 2028 RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQ Calibration for %s\n",
2041 (is2t ? "2T2R" : "1T1R"))); 2029 is2t ? "2T2R" : "1T1R");
2042 2030
2043 /* Save ADDA parameters, turn Path A ADDA on */ 2031 /* Save ADDA parameters, turn Path A ADDA on */
2044 _rtl92d_phy_save_adda_registers(hw, adda_reg, 2032 _rtl92d_phy_save_adda_registers(hw, adda_reg,
@@ -2076,7 +2064,7 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2076 if (is2t) 2064 if (is2t)
2077 rtl_set_bbreg(hw, 0xb6c, BMASKDWORD, 0x0f600000); 2065 rtl_set_bbreg(hw, 0xb6c, BMASKDWORD, 0x0f600000);
2078 /* IQ calibration setting */ 2066 /* IQ calibration setting */
2079 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("IQK setting!\n")); 2067 RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQK setting!\n");
2080 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x80800000); 2068 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x80800000);
2081 rtl_set_bbreg(hw, 0xe40, BMASKDWORD, 0x01007c00); 2069 rtl_set_bbreg(hw, 0xe40, BMASKDWORD, 0x01007c00);
2082 rtl_set_bbreg(hw, 0xe44, BMASKDWORD, 0x01004800); 2070 rtl_set_bbreg(hw, 0xe44, BMASKDWORD, 0x01004800);
@@ -2084,7 +2072,7 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2084 patha_ok = _rtl92d_phy_patha_iqk(hw, is2t); 2072 patha_ok = _rtl92d_phy_patha_iqk(hw, is2t);
2085 if (patha_ok == 0x03) { 2073 if (patha_ok == 0x03) {
2086 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2074 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2087 ("Path A IQK Success!!\n")); 2075 "Path A IQK Success!!\n");
2088 result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) & 2076 result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) &
2089 0x3FF0000) >> 16; 2077 0x3FF0000) >> 16;
2090 result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) & 2078 result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) &
@@ -2097,7 +2085,7 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2097 } else if (i == (retrycount - 1) && patha_ok == 0x01) { 2085 } else if (i == (retrycount - 1) && patha_ok == 0x01) {
2098 /* Tx IQK OK */ 2086 /* Tx IQK OK */
2099 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2087 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2100 ("Path A IQK Only Tx Success!!\n")); 2088 "Path A IQK Only Tx Success!!\n");
2101 2089
2102 result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) & 2090 result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) &
2103 0x3FF0000) >> 16; 2091 0x3FF0000) >> 16;
@@ -2106,7 +2094,7 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2106 } 2094 }
2107 } 2095 }
2108 if (0x00 == patha_ok) 2096 if (0x00 == patha_ok)
2109 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path A IQK failed!!\n")); 2097 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK failed!!\n");
2110 if (is2t) { 2098 if (is2t) {
2111 _rtl92d_phy_patha_standby(hw); 2099 _rtl92d_phy_patha_standby(hw);
2112 /* Turn Path B ADDA on */ 2100 /* Turn Path B ADDA on */
@@ -2115,7 +2103,7 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2115 pathb_ok = _rtl92d_phy_pathb_iqk(hw); 2103 pathb_ok = _rtl92d_phy_pathb_iqk(hw);
2116 if (pathb_ok == 0x03) { 2104 if (pathb_ok == 0x03) {
2117 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2105 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2118 ("Path B IQK Success!!\n")); 2106 "Path B IQK Success!!\n");
2119 result[t][4] = (rtl_get_bbreg(hw, 0xeb4, 2107 result[t][4] = (rtl_get_bbreg(hw, 0xeb4,
2120 BMASKDWORD) & 0x3FF0000) >> 16; 2108 BMASKDWORD) & 0x3FF0000) >> 16;
2121 result[t][5] = (rtl_get_bbreg(hw, 0xebc, 2109 result[t][5] = (rtl_get_bbreg(hw, 0xebc,
@@ -2128,7 +2116,7 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2128 } else if (i == (retrycount - 1) && pathb_ok == 0x01) { 2116 } else if (i == (retrycount - 1) && pathb_ok == 0x01) {
2129 /* Tx IQK OK */ 2117 /* Tx IQK OK */
2130 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2118 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2131 ("Path B Only Tx IQK Success!!\n")); 2119 "Path B Only Tx IQK Success!!\n");
2132 result[t][4] = (rtl_get_bbreg(hw, 0xeb4, 2120 result[t][4] = (rtl_get_bbreg(hw, 0xeb4,
2133 BMASKDWORD) & 0x3FF0000) >> 16; 2121 BMASKDWORD) & 0x3FF0000) >> 16;
2134 result[t][5] = (rtl_get_bbreg(hw, 0xebc, 2122 result[t][5] = (rtl_get_bbreg(hw, 0xebc,
@@ -2137,12 +2125,12 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2137 } 2125 }
2138 if (0x00 == pathb_ok) 2126 if (0x00 == pathb_ok)
2139 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2127 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2140 ("Path B IQK failed!!\n")); 2128 "Path B IQK failed!!\n");
2141 } 2129 }
2142 2130
2143 /* Back to BB mode, load original value */ 2131 /* Back to BB mode, load original value */
2144 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2132 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2145 ("IQK:Back to BB mode, load original value!\n")); 2133 "IQK:Back to BB mode, load original value!\n");
2146 2134
2147 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0); 2135 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0);
2148 if (t != 0) { 2136 if (t != 0) {
@@ -2167,7 +2155,7 @@ static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8],
2167 rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x01008c00); 2155 rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x01008c00);
2168 rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x01008c00); 2156 rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x01008c00);
2169 } 2157 }
2170 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("<==\n")); 2158 RTPRINT(rtlpriv, FINIT, INIT_IQK, "<==\n");
2171} 2159}
2172 2160
2173static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw, 2161static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw,
@@ -2199,13 +2187,13 @@ static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw,
2199 /* Note: IQ calibration must be performed after loading 2187 /* Note: IQ calibration must be performed after loading
2200 * PHY_REG.txt , and radio_a, radio_b.txt */ 2188 * PHY_REG.txt , and radio_a, radio_b.txt */
2201 2189
2202 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("IQK for 5G NORMAL:Start!!!\n")); 2190 RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQK for 5G NORMAL:Start!!!\n");
2203 mdelay(IQK_DELAY_TIME * 20); 2191 mdelay(IQK_DELAY_TIME * 20);
2204 if (t == 0) { 2192 if (t == 0) {
2205 bbvalue = rtl_get_bbreg(hw, RFPGA0_RFMOD, BMASKDWORD); 2193 bbvalue = rtl_get_bbreg(hw, RFPGA0_RFMOD, BMASKDWORD);
2206 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("==>0x%08x\n", bbvalue)); 2194 RTPRINT(rtlpriv, FINIT, INIT_IQK, "==>0x%08x\n", bbvalue);
2207 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("IQ Calibration for %s\n", 2195 RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQ Calibration for %s\n",
2208 (is2t ? "2T2R" : "1T1R"))); 2196 is2t ? "2T2R" : "1T1R");
2209 /* Save ADDA parameters, turn Path A ADDA on */ 2197 /* Save ADDA parameters, turn Path A ADDA on */
2210 _rtl92d_phy_save_adda_registers(hw, adda_reg, 2198 _rtl92d_phy_save_adda_registers(hw, adda_reg,
2211 rtlphy->adda_backup, 2199 rtlphy->adda_backup,
@@ -2242,13 +2230,13 @@ static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw,
2242 if (is2t) 2230 if (is2t)
2243 rtl_set_bbreg(hw, 0xb6c, BMASKDWORD, 0x0f600000); 2231 rtl_set_bbreg(hw, 0xb6c, BMASKDWORD, 0x0f600000);
2244 /* IQ calibration setting */ 2232 /* IQ calibration setting */
2245 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("IQK setting!\n")); 2233 RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQK setting!\n");
2246 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x80800000); 2234 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x80800000);
2247 rtl_set_bbreg(hw, 0xe40, BMASKDWORD, 0x10007c00); 2235 rtl_set_bbreg(hw, 0xe40, BMASKDWORD, 0x10007c00);
2248 rtl_set_bbreg(hw, 0xe44, BMASKDWORD, 0x01004800); 2236 rtl_set_bbreg(hw, 0xe44, BMASKDWORD, 0x01004800);
2249 patha_ok = _rtl92d_phy_patha_iqk_5g_normal(hw, is2t); 2237 patha_ok = _rtl92d_phy_patha_iqk_5g_normal(hw, is2t);
2250 if (patha_ok == 0x03) { 2238 if (patha_ok == 0x03) {
2251 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path A IQK Success!!\n")); 2239 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK Success!!\n");
2252 result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) & 2240 result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) &
2253 0x3FF0000) >> 16; 2241 0x3FF0000) >> 16;
2254 result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) & 2242 result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) &
@@ -2259,14 +2247,14 @@ static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw,
2259 0x3FF0000) >> 16; 2247 0x3FF0000) >> 16;
2260 } else if (patha_ok == 0x01) { /* Tx IQK OK */ 2248 } else if (patha_ok == 0x01) { /* Tx IQK OK */
2261 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2249 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2262 ("Path A IQK Only Tx Success!!\n")); 2250 "Path A IQK Only Tx Success!!\n");
2263 2251
2264 result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) & 2252 result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) &
2265 0x3FF0000) >> 16; 2253 0x3FF0000) >> 16;
2266 result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) & 2254 result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) &
2267 0x3FF0000) >> 16; 2255 0x3FF0000) >> 16;
2268 } else { 2256 } else {
2269 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path A IQK Fail!!\n")); 2257 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK Fail!!\n");
2270 } 2258 }
2271 if (is2t) { 2259 if (is2t) {
2272 /* _rtl92d_phy_patha_standby(hw); */ 2260 /* _rtl92d_phy_patha_standby(hw); */
@@ -2275,7 +2263,7 @@ static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw,
2275 pathb_ok = _rtl92d_phy_pathb_iqk_5g_normal(hw); 2263 pathb_ok = _rtl92d_phy_pathb_iqk_5g_normal(hw);
2276 if (pathb_ok == 0x03) { 2264 if (pathb_ok == 0x03) {
2277 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2265 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2278 ("Path B IQK Success!!\n")); 2266 "Path B IQK Success!!\n");
2279 result[t][4] = (rtl_get_bbreg(hw, 0xeb4, BMASKDWORD) & 2267 result[t][4] = (rtl_get_bbreg(hw, 0xeb4, BMASKDWORD) &
2280 0x3FF0000) >> 16; 2268 0x3FF0000) >> 16;
2281 result[t][5] = (rtl_get_bbreg(hw, 0xebc, BMASKDWORD) & 2269 result[t][5] = (rtl_get_bbreg(hw, 0xebc, BMASKDWORD) &
@@ -2286,20 +2274,20 @@ static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw,
2286 0x3FF0000) >> 16; 2274 0x3FF0000) >> 16;
2287 } else if (pathb_ok == 0x01) { /* Tx IQK OK */ 2275 } else if (pathb_ok == 0x01) { /* Tx IQK OK */
2288 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2276 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2289 ("Path B Only Tx IQK Success!!\n")); 2277 "Path B Only Tx IQK Success!!\n");
2290 result[t][4] = (rtl_get_bbreg(hw, 0xeb4, BMASKDWORD) & 2278 result[t][4] = (rtl_get_bbreg(hw, 0xeb4, BMASKDWORD) &
2291 0x3FF0000) >> 16; 2279 0x3FF0000) >> 16;
2292 result[t][5] = (rtl_get_bbreg(hw, 0xebc, BMASKDWORD) & 2280 result[t][5] = (rtl_get_bbreg(hw, 0xebc, BMASKDWORD) &
2293 0x3FF0000) >> 16; 2281 0x3FF0000) >> 16;
2294 } else { 2282 } else {
2295 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2283 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2296 ("Path B IQK failed!!\n")); 2284 "Path B IQK failed!!\n");
2297 } 2285 }
2298 } 2286 }
2299 2287
2300 /* Back to BB mode, load original value */ 2288 /* Back to BB mode, load original value */
2301 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2289 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2302 ("IQK:Back to BB mode, load original value!\n")); 2290 "IQK:Back to BB mode, load original value!\n");
2303 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0); 2291 rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0);
2304 if (t != 0) { 2292 if (t != 0) {
2305 if (is2t) 2293 if (is2t)
@@ -2321,7 +2309,7 @@ static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw,
2321 rtlphy->adda_backup, 2309 rtlphy->adda_backup,
2322 IQK_ADDA_REG_NUM); 2310 IQK_ADDA_REG_NUM);
2323 } 2311 }
2324 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("<==\n")); 2312 RTPRINT(rtlpriv, FINIT, INIT_IQK, "<==\n");
2325} 2313}
2326 2314
2327static bool _rtl92d_phy_simularity_compare(struct ieee80211_hw *hw, 2315static bool _rtl92d_phy_simularity_compare(struct ieee80211_hw *hw,
@@ -2395,8 +2383,7 @@ static void _rtl92d_phy_patha_fill_iqk_matrix(struct ieee80211_hw *hw,
2395 rtlhal->macphymode == DUALMAC_DUALPHY; 2383 rtlhal->macphymode == DUALMAC_DUALPHY;
2396 2384
2397 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2385 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2398 ("Path A IQ Calibration %s !\n", 2386 "Path A IQ Calibration %s !\n", iqk_ok ? "Success" : "Failed");
2399 (iqk_ok) ? "Success" : "Failed"));
2400 if (final_candidate == 0xFF) { 2387 if (final_candidate == 0xFF) {
2401 return; 2388 return;
2402 } else if (iqk_ok) { 2389 } else if (iqk_ok) {
@@ -2406,8 +2393,9 @@ static void _rtl92d_phy_patha_fill_iqk_matrix(struct ieee80211_hw *hw,
2406 if ((val_x & 0x00000200) != 0) 2393 if ((val_x & 0x00000200) != 0)
2407 val_x = val_x | 0xFFFFFC00; 2394 val_x = val_x | 0xFFFFFC00;
2408 tx0_a = (val_x * oldval_0) >> 8; 2395 tx0_a = (val_x * oldval_0) >> 8;
2409 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("X = 0x%x, tx0_a = 0x%x," 2396 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2410 " oldval_0 0x%x\n", val_x, tx0_a, oldval_0)); 2397 "X = 0x%x, tx0_a = 0x%x, oldval_0 0x%x\n",
2398 val_x, tx0_a, oldval_0);
2411 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 0x3FF, tx0_a); 2399 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 0x3FF, tx0_a);
2412 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(24), 2400 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(24),
2413 ((val_x * oldval_0 >> 7) & 0x1)); 2401 ((val_x * oldval_0 >> 7) & 0x1));
@@ -2419,8 +2407,9 @@ static void _rtl92d_phy_patha_fill_iqk_matrix(struct ieee80211_hw *hw,
2419 rtlhal->current_bandtype == BAND_ON_5G) 2407 rtlhal->current_bandtype == BAND_ON_5G)
2420 val_y += 3; 2408 val_y += 3;
2421 tx0_c = (val_y * oldval_0) >> 8; 2409 tx0_c = (val_y * oldval_0) >> 8;
2422 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Y = 0x%lx, tx0_c = 0x%lx\n", 2410 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2423 val_y, tx0_c)); 2411 "Y = 0x%lx, tx0_c = 0x%lx\n",
2412 val_y, tx0_c);
2424 rtl_set_bbreg(hw, ROFDM0_XCTxAFE, 0xF0000000, 2413 rtl_set_bbreg(hw, ROFDM0_XCTxAFE, 0xF0000000,
2425 ((tx0_c & 0x3C0) >> 6)); 2414 ((tx0_c & 0x3C0) >> 6));
2426 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 0x003F0000, 2415 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 0x003F0000,
@@ -2428,11 +2417,11 @@ static void _rtl92d_phy_patha_fill_iqk_matrix(struct ieee80211_hw *hw,
2428 if (is2t) 2417 if (is2t)
2429 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(26), 2418 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(26),
2430 ((val_y * oldval_0 >> 7) & 0x1)); 2419 ((val_y * oldval_0 >> 7) & 0x1));
2431 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("0xC80 = 0x%x\n", 2420 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xC80 = 0x%x\n",
2432 rtl_get_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 2421 rtl_get_bbreg(hw, ROFDM0_XATxIQIMBALANCE,
2433 BMASKDWORD))); 2422 BMASKDWORD));
2434 if (txonly) { 2423 if (txonly) {
2435 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("only Tx OK\n")); 2424 RTPRINT(rtlpriv, FINIT, INIT_IQK, "only Tx OK\n");
2436 return; 2425 return;
2437 } 2426 }
2438 reg = result[final_candidate][2]; 2427 reg = result[final_candidate][2];
@@ -2452,8 +2441,8 @@ static void _rtl92d_phy_pathb_fill_iqk_matrix(struct ieee80211_hw *hw,
2452 u32 oldval_1, val_x, tx1_a, reg; 2441 u32 oldval_1, val_x, tx1_a, reg;
2453 long val_y, tx1_c; 2442 long val_y, tx1_c;
2454 2443
2455 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Path B IQ Calibration %s !\n", 2444 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path B IQ Calibration %s !\n",
2456 (iqk_ok) ? "Success" : "Failed")); 2445 iqk_ok ? "Success" : "Failed");
2457 if (final_candidate == 0xFF) { 2446 if (final_candidate == 0xFF) {
2458 return; 2447 return;
2459 } else if (iqk_ok) { 2448 } else if (iqk_ok) {
@@ -2463,8 +2452,8 @@ static void _rtl92d_phy_pathb_fill_iqk_matrix(struct ieee80211_hw *hw,
2463 if ((val_x & 0x00000200) != 0) 2452 if ((val_x & 0x00000200) != 0)
2464 val_x = val_x | 0xFFFFFC00; 2453 val_x = val_x | 0xFFFFFC00;
2465 tx1_a = (val_x * oldval_1) >> 8; 2454 tx1_a = (val_x * oldval_1) >> 8;
2466 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("X = 0x%x, tx1_a = 0x%x\n", 2455 RTPRINT(rtlpriv, FINIT, INIT_IQK, "X = 0x%x, tx1_a = 0x%x\n",
2467 val_x, tx1_a)); 2456 val_x, tx1_a);
2468 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 0x3FF, tx1_a); 2457 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 0x3FF, tx1_a);
2469 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(28), 2458 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(28),
2470 ((val_x * oldval_1 >> 7) & 0x1)); 2459 ((val_x * oldval_1 >> 7) & 0x1));
@@ -2474,8 +2463,8 @@ static void _rtl92d_phy_pathb_fill_iqk_matrix(struct ieee80211_hw *hw,
2474 if (rtlhal->current_bandtype == BAND_ON_5G) 2463 if (rtlhal->current_bandtype == BAND_ON_5G)
2475 val_y += 3; 2464 val_y += 3;
2476 tx1_c = (val_y * oldval_1) >> 8; 2465 tx1_c = (val_y * oldval_1) >> 8;
2477 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("Y = 0x%lx, tx1_c = 0x%lx\n", 2466 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Y = 0x%lx, tx1_c = 0x%lx\n",
2478 val_y, tx1_c)); 2467 val_y, tx1_c);
2479 rtl_set_bbreg(hw, ROFDM0_XDTxAFE, 0xF0000000, 2468 rtl_set_bbreg(hw, ROFDM0_XDTxAFE, 0xF0000000,
2480 ((tx1_c & 0x3C0) >> 6)); 2469 ((tx1_c & 0x3C0) >> 6));
2481 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 0x003F0000, 2470 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 0x003F0000,
@@ -2507,7 +2496,7 @@ void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw)
2507 unsigned long flag = 0; 2496 unsigned long flag = 0;
2508 2497
2509 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2498 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2510 ("IQK:Start!!!channel %d\n", rtlphy->current_channel)); 2499 "IQK:Start!!!channel %d\n", rtlphy->current_channel);
2511 for (i = 0; i < 8; i++) { 2500 for (i = 0; i < 8; i++) {
2512 result[0][i] = 0; 2501 result[0][i] = 0;
2513 result[1][i] = 0; 2502 result[1][i] = 0;
@@ -2521,7 +2510,7 @@ void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw)
2521 is23simular = false; 2510 is23simular = false;
2522 is13simular = false; 2511 is13simular = false;
2523 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2512 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2524 ("IQK !!!currentband %d\n", rtlhal->current_bandtype)); 2513 "IQK !!!currentband %d\n", rtlhal->current_bandtype);
2525 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); 2514 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag);
2526 for (i = 0; i < 3; i++) { 2515 for (i = 0; i < 3; i++) {
2527 if (rtlhal->current_bandtype == BAND_ON_5G) { 2516 if (rtlhal->current_bandtype == BAND_ON_5G) {
@@ -2573,10 +2562,9 @@ void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw)
2573 regec4 = result[i][6]; 2562 regec4 = result[i][6];
2574 regecc = result[i][7]; 2563 regecc = result[i][7];
2575 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2564 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2576 ("IQK: rege94=%lx rege9c=%lx regea4=%lx regeac=%lx " 2565 "IQK: rege94=%lx rege9c=%lx regea4=%lx regeac=%lx regeb4=%lx regebc=%lx regec4=%lx regecc=%lx\n",
2577 "regeb4=%lx regebc=%lx regec4=%lx regecc=%lx\n ",
2578 rege94, rege9c, regea4, regeac, regeb4, regebc, regec4, 2566 rege94, rege9c, regea4, regeac, regeb4, regebc, regec4,
2579 regecc)); 2567 regecc);
2580 } 2568 }
2581 if (final_candidate != 0xff) { 2569 if (final_candidate != 0xff) {
2582 rtlphy->reg_e94 = rege94 = result[final_candidate][0]; 2570 rtlphy->reg_e94 = rege94 = result[final_candidate][0];
@@ -2588,12 +2576,11 @@ void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw)
2588 regec4 = result[final_candidate][6]; 2576 regec4 = result[final_candidate][6];
2589 regecc = result[final_candidate][7]; 2577 regecc = result[final_candidate][7];
2590 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2578 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2591 ("IQK: final_candidate is %x\n", final_candidate)); 2579 "IQK: final_candidate is %x\n", final_candidate);
2592 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2580 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2593 ("IQK: rege94=%lx rege9c=%lx regea4=%lx regeac=%lx " 2581 "IQK: rege94=%lx rege9c=%lx regea4=%lx regeac=%lx regeb4=%lx regebc=%lx regec4=%lx regecc=%lx\n",
2594 "regeb4=%lx regebc=%lx regec4=%lx regecc=%lx\n ",
2595 rege94, rege9c, regea4, regeac, regeb4, regebc, regec4, 2582 rege94, rege9c, regea4, regeac, regeb4, regebc, regec4,
2596 regecc)); 2583 regecc);
2597 patha_ok = pathb_ok = true; 2584 patha_ok = pathb_ok = true;
2598 } else { 2585 } else {
2599 rtlphy->reg_e94 = rtlphy->reg_eb4 = 0x100; /* X default value */ 2586 rtlphy->reg_e94 = rtlphy->reg_eb4 = 0x100; /* X default value */
@@ -2618,7 +2605,7 @@ void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw)
2618 true; 2605 true;
2619 2606
2620 RT_TRACE(rtlpriv, COMP_SCAN | COMP_MLME, DBG_LOUD, 2607 RT_TRACE(rtlpriv, COMP_SCAN | COMP_MLME, DBG_LOUD,
2621 ("\nIQK OK indexforchannel %d.\n", indexforchannel)); 2608 "IQK OK indexforchannel %d\n", indexforchannel);
2622 } 2609 }
2623} 2610}
2624 2611
@@ -2629,17 +2616,17 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel)
2629 struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); 2616 struct rtl_hal *rtlhal = &(rtlpriv->rtlhal);
2630 u8 indexforchannel; 2617 u8 indexforchannel;
2631 2618
2632 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("channel %d\n", channel)); 2619 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "channel %d\n", channel);
2633 /*------Do IQK for normal chip and test chip 5G band------- */ 2620 /*------Do IQK for normal chip and test chip 5G band------- */
2634 indexforchannel = rtl92d_get_rightchnlplace_for_iqk(channel); 2621 indexforchannel = rtl92d_get_rightchnlplace_for_iqk(channel);
2635 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 2622 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "indexforchannel %d done %d\n",
2636 ("indexforchannel %d done %d\n", indexforchannel, 2623 indexforchannel,
2637 rtlphy->iqk_matrix_regsetting[indexforchannel].iqk_done)); 2624 rtlphy->iqk_matrix_regsetting[indexforchannel].iqk_done);
2638 if (0 && !rtlphy->iqk_matrix_regsetting[indexforchannel].iqk_done && 2625 if (0 && !rtlphy->iqk_matrix_regsetting[indexforchannel].iqk_done &&
2639 rtlphy->need_iqk) { 2626 rtlphy->need_iqk) {
2640 /* Re Do IQK. */ 2627 /* Re Do IQK. */
2641 RT_TRACE(rtlpriv, COMP_SCAN | COMP_INIT, DBG_LOUD, 2628 RT_TRACE(rtlpriv, COMP_SCAN | COMP_INIT, DBG_LOUD,
2642 ("Do IQK Matrix reg for channel:%d....\n", channel)); 2629 "Do IQK Matrix reg for channel:%d....\n", channel);
2643 rtl92d_phy_iq_calibrate(hw); 2630 rtl92d_phy_iq_calibrate(hw);
2644 } else { 2631 } else {
2645 /* Just load the value. */ 2632 /* Just load the value. */
@@ -2647,8 +2634,8 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel)
2647 if (((!rtlhal->load_imrandiqk_setting_for2g) && 2634 if (((!rtlhal->load_imrandiqk_setting_for2g) &&
2648 indexforchannel == 0) || indexforchannel > 0) { 2635 indexforchannel == 0) || indexforchannel > 0) {
2649 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, 2636 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
2650 ("Just Read IQK Matrix reg for channel:%d" 2637 "Just Read IQK Matrix reg for channel:%d....\n",
2651 "....\n", channel)); 2638 channel);
2652 if ((rtlphy->iqk_matrix_regsetting[indexforchannel]. 2639 if ((rtlphy->iqk_matrix_regsetting[indexforchannel].
2653 value[0] != NULL) 2640 value[0] != NULL)
2654 /*&&(regea4 != 0) */) 2641 /*&&(regea4 != 0) */)
@@ -2672,7 +2659,7 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel)
2672 } 2659 }
2673 } 2660 }
2674 rtlphy->need_iqk = false; 2661 rtlphy->need_iqk = false;
2675 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("<====\n")); 2662 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "<====\n");
2676} 2663}
2677 2664
2678static u32 _rtl92d_phy_get_abs(u32 val1, u32 val2) 2665static u32 _rtl92d_phy_get_abs(u32 val1, u32 val2)
@@ -2727,8 +2714,8 @@ static void _rtl92d_phy_calc_curvindex(struct ieee80211_hw *hw,
2727 } 2714 }
2728 } 2715 }
2729 smallest_abs_val = 0xffffffff; 2716 smallest_abs_val = 0xffffffff;
2730 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("curveindex[%d] = %x\n", i, 2717 RTPRINT(rtlpriv, FINIT, INIT_IQK, "curveindex[%d] = %x\n",
2731 curveindex[i])); 2718 i, curveindex[i]);
2732 } 2719 }
2733} 2720}
2734 2721
@@ -2743,14 +2730,14 @@ static void _rtl92d_phy_reload_lck_setting(struct ieee80211_hw *hw,
2743 u32 u4tmp = 0, u4regvalue = 0; 2730 u32 u4tmp = 0, u4regvalue = 0;
2744 bool bneed_powerdown_radio = false; 2731 bool bneed_powerdown_radio = false;
2745 2732
2746 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("path %d\n", erfpath)); 2733 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "path %d\n", erfpath);
2747 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("band type = %d\n", 2734 RTPRINT(rtlpriv, FINIT, INIT_IQK, "band type = %d\n",
2748 rtlpriv->rtlhal.current_bandtype)); 2735 rtlpriv->rtlhal.current_bandtype);
2749 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("channel = %d\n", channel)); 2736 RTPRINT(rtlpriv, FINIT, INIT_IQK, "channel = %d\n", channel);
2750 if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G) {/* Path-A for 5G */ 2737 if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G) {/* Path-A for 5G */
2751 u4tmp = curveindex_5g[channel-1]; 2738 u4tmp = curveindex_5g[channel-1];
2752 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2739 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2753 ("ver 1 set RF-A, 5G, 0x28 = 0x%ulx !!\n", u4tmp)); 2740 "ver 1 set RF-A, 5G, 0x28 = 0x%ulx !!\n", u4tmp);
2754 if (rtlpriv->rtlhal.macphymode == DUALMAC_DUALPHY && 2741 if (rtlpriv->rtlhal.macphymode == DUALMAC_DUALPHY &&
2755 rtlpriv->rtlhal.interfaceindex == 1) { 2742 rtlpriv->rtlhal.interfaceindex == 1) {
2756 bneed_powerdown_radio = 2743 bneed_powerdown_radio =
@@ -2769,7 +2756,7 @@ static void _rtl92d_phy_reload_lck_setting(struct ieee80211_hw *hw,
2769 } else if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) { 2756 } else if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) {
2770 u4tmp = curveindex_2g[channel-1]; 2757 u4tmp = curveindex_2g[channel-1];
2771 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2758 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2772 ("ver 3 set RF-B, 2G, 0x28 = 0x%ulx !!\n", u4tmp)); 2759 "ver 3 set RF-B, 2G, 0x28 = 0x%ulx !!\n", u4tmp);
2773 if (rtlpriv->rtlhal.macphymode == DUALMAC_DUALPHY && 2760 if (rtlpriv->rtlhal.macphymode == DUALMAC_DUALPHY &&
2774 rtlpriv->rtlhal.interfaceindex == 0) { 2761 rtlpriv->rtlhal.interfaceindex == 0) {
2775 bneed_powerdown_radio = 2762 bneed_powerdown_radio =
@@ -2781,14 +2768,14 @@ static void _rtl92d_phy_reload_lck_setting(struct ieee80211_hw *hw,
2781 } 2768 }
2782 rtl_set_rfreg(hw, erfpath, RF_SYN_G4, 0x3f800, u4tmp); 2769 rtl_set_rfreg(hw, erfpath, RF_SYN_G4, 0x3f800, u4tmp);
2783 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2770 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2784 ("ver 3 set RF-B, 2G, 0x28 = 0x%ulx !!\n", 2771 "ver 3 set RF-B, 2G, 0x28 = 0x%ulx !!\n",
2785 rtl_get_rfreg(hw, erfpath, RF_SYN_G4, 0x3f800))); 2772 rtl_get_rfreg(hw, erfpath, RF_SYN_G4, 0x3f800));
2786 if (bneed_powerdown_radio) 2773 if (bneed_powerdown_radio)
2787 _rtl92d_phy_restore_rf_env(hw, erfpath, &u4regvalue); 2774 _rtl92d_phy_restore_rf_env(hw, erfpath, &u4regvalue);
2788 if (rtlpriv->rtlhal.during_mac0init_radiob) 2775 if (rtlpriv->rtlhal.during_mac0init_radiob)
2789 rtl92d_phy_powerdown_anotherphy(hw, true); 2776 rtl92d_phy_powerdown_anotherphy(hw, true);
2790 } 2777 }
2791 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("<====\n")); 2778 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "<====\n");
2792} 2779}
2793 2780
2794static void _rtl92d_phy_lc_calibrate_sw(struct ieee80211_hw *hw, bool is2t) 2781static void _rtl92d_phy_lc_calibrate_sw(struct ieee80211_hw *hw, bool is2t)
@@ -2836,20 +2823,20 @@ static void _rtl92d_phy_lc_calibrate_sw(struct ieee80211_hw *hw, bool is2t)
2836 RF_SYN_G6, BRFREGOFFSETMASK); 2823 RF_SYN_G6, BRFREGOFFSETMASK);
2837 } 2824 }
2838 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2825 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2839 ("PHY_LCK finish delay for %d ms=2\n", timecount)); 2826 "PHY_LCK finish delay for %d ms=2\n", timecount);
2840 u4tmp = rtl_get_rfreg(hw, index, RF_SYN_G4, BRFREGOFFSETMASK); 2827 u4tmp = rtl_get_rfreg(hw, index, RF_SYN_G4, BRFREGOFFSETMASK);
2841 if (index == 0 && rtlhal->interfaceindex == 0) { 2828 if (index == 0 && rtlhal->interfaceindex == 0) {
2842 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2829 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2843 ("path-A / 5G LCK\n")); 2830 "path-A / 5G LCK\n");
2844 } else { 2831 } else {
2845 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2832 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2846 ("path-B / 2.4G LCK\n")); 2833 "path-B / 2.4G LCK\n");
2847 } 2834 }
2848 memset(&curvecount_val[0], 0, CV_CURVE_CNT * 2); 2835 memset(&curvecount_val[0], 0, CV_CURVE_CNT * 2);
2849 /* Set LC calibration off */ 2836 /* Set LC calibration off */
2850 rtl_set_rfreg(hw, (enum radio_path)index, RF_CHNLBW, 2837 rtl_set_rfreg(hw, (enum radio_path)index, RF_CHNLBW,
2851 0x08000, 0x0); 2838 0x08000, 0x0);
2852 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("set RF 0x18[15] = 0\n")); 2839 RTPRINT(rtlpriv, FINIT, INIT_IQK, "set RF 0x18[15] = 0\n");
2853 /* save Curve-counting number */ 2840 /* save Curve-counting number */
2854 for (i = 0; i < CV_CURVE_CNT; i++) { 2841 for (i = 0; i < CV_CURVE_CNT; i++) {
2855 u32 readval = 0, readval2 = 0; 2842 u32 readval = 0, readval2 = 0;
@@ -2899,7 +2886,7 @@ static void _rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
2899{ 2886{
2900 struct rtl_priv *rtlpriv = rtl_priv(hw); 2887 struct rtl_priv *rtlpriv = rtl_priv(hw);
2901 2888
2902 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("cosa PHY_LCK ver=2\n")); 2889 RTPRINT(rtlpriv, FINIT, INIT_IQK, "cosa PHY_LCK ver=2\n");
2903 _rtl92d_phy_lc_calibrate_sw(hw, is2t); 2890 _rtl92d_phy_lc_calibrate_sw(hw, is2t);
2904} 2891}
2905 2892
@@ -2917,8 +2904,8 @@ void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw)
2917 2904
2918 rtlphy->lck_inprogress = true; 2905 rtlphy->lck_inprogress = true;
2919 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2906 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2920 ("LCK:Start!!! currentband %x delay %d ms\n", 2907 "LCK:Start!!! currentband %x delay %d ms\n",
2921 rtlhal->current_bandtype, timecount)); 2908 rtlhal->current_bandtype, timecount);
2922 if (IS_92D_SINGLEPHY(rtlhal->version)) { 2909 if (IS_92D_SINGLEPHY(rtlhal->version)) {
2923 _rtl92d_phy_lc_calibrate(hw, true); 2910 _rtl92d_phy_lc_calibrate(hw, true);
2924 } else { 2911 } else {
@@ -2926,7 +2913,7 @@ void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw)
2926 _rtl92d_phy_lc_calibrate(hw, false); 2913 _rtl92d_phy_lc_calibrate(hw, false);
2927 } 2914 }
2928 rtlphy->lck_inprogress = false; 2915 rtlphy->lck_inprogress = false;
2929 RTPRINT(rtlpriv, FINIT, INIT_IQK, ("LCK:Finish!!!\n")); 2916 RTPRINT(rtlpriv, FINIT, INIT_IQK, "LCK:Finish!!!\n");
2930} 2917}
2931 2918
2932void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, char delta) 2919void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, char delta)
@@ -2941,7 +2928,7 @@ static bool _rtl92d_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
2941 struct swchnlcmd *pcmd; 2928 struct swchnlcmd *pcmd;
2942 2929
2943 if (cmdtable == NULL) { 2930 if (cmdtable == NULL) {
2944 RT_ASSERT(false, ("cmdtable cannot be NULL.\n")); 2931 RT_ASSERT(false, "cmdtable cannot be NULL\n");
2945 return false; 2932 return false;
2946 } 2933 }
2947 if (cmdtableidx >= cmdtablesz) 2934 if (cmdtableidx >= cmdtablesz)
@@ -2962,10 +2949,10 @@ void rtl92d_phy_reset_iqk_result(struct ieee80211_hw *hw)
2962 u8 i; 2949 u8 i;
2963 2950
2964 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 2951 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
2965 ("settings regs %d default regs %d\n", 2952 "settings regs %d default regs %d\n",
2966 (int)(sizeof(rtlphy->iqk_matrix_regsetting) / 2953 (int)(sizeof(rtlphy->iqk_matrix_regsetting) /
2967 sizeof(struct iqk_matrix_regs)), 2954 sizeof(struct iqk_matrix_regs)),
2968 IQK_MATRIX_REG_NUM)); 2955 IQK_MATRIX_REG_NUM);
2969 /* 0xe94, 0xe9c, 0xea4, 0xeac, 0xeb4, 0xebc, 0xec4, 0xecc */ 2956 /* 0xe94, 0xe9c, 0xea4, 0xeac, 0xeb4, 0xebc, 0xec4, 0xecc */
2970 for (i = 0; i < IQK_MATRIX_SETTINGS_NUM; i++) { 2957 for (i = 0; i < IQK_MATRIX_SETTINGS_NUM; i++) {
2971 rtlphy->iqk_matrix_regsetting[i].value[0][0] = 0x100; 2958 rtlphy->iqk_matrix_regsetting[i].value[0][0] = 0x100;
@@ -3084,7 +3071,7 @@ static bool _rtl92d_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
3084 break; 3071 break;
3085 default: 3072 default:
3086 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 3073 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
3087 ("switch case not process\n")); 3074 "switch case not processed\n");
3088 break; 3075 break;
3089 } 3076 }
3090 break; 3077 break;
@@ -3111,7 +3098,7 @@ u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw)
3111 3098
3112 if ((is_hal_stop(rtlhal)) || (RT_CANNOT_IO(hw))) { 3099 if ((is_hal_stop(rtlhal)) || (RT_CANNOT_IO(hw))) {
3113 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, 3100 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD,
3114 ("sw_chnl_inprogress false driver sleep or unload\n")); 3101 "sw_chnl_inprogress false driver sleep or unload\n");
3115 return 0; 3102 return 0;
3116 } 3103 }
3117 while (rtlphy->lck_inprogress && timecount < timeout) { 3104 while (rtlphy->lck_inprogress && timecount < timeout) {
@@ -3133,19 +3120,18 @@ u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw)
3133 * 5G and 2.4G band. */ 3120 * 5G and 2.4G band. */
3134 if (channel <= 14) 3121 if (channel <= 14)
3135 return 0; 3122 return 0;
3136 RT_ASSERT((channel > 14), ("5G but channel<=14")); 3123 RT_ASSERT((channel > 14), "5G but channel<=14\n");
3137 break; 3124 break;
3138 case BAND_ON_2_4G: 3125 case BAND_ON_2_4G:
3139 /* Get first channel error when change between 3126 /* Get first channel error when change between
3140 * 5G and 2.4G band. */ 3127 * 5G and 2.4G band. */
3141 if (channel > 14) 3128 if (channel > 14)
3142 return 0; 3129 return 0;
3143 RT_ASSERT((channel <= 14), ("2G but channel>14")); 3130 RT_ASSERT((channel <= 14), "2G but channel>14\n");
3144 break; 3131 break;
3145 default: 3132 default:
3146 RT_ASSERT(false, 3133 RT_ASSERT(false, "Invalid WirelessMode(%#x)!!\n",
3147 ("Invalid WirelessMode(%#x)!!\n", 3134 rtlpriv->mac80211.mode);
3148 rtlpriv->mac80211.mode));
3149 break; 3135 break;
3150 } 3136 }
3151 rtlphy->sw_chnl_inprogress = true; 3137 rtlphy->sw_chnl_inprogress = true;
@@ -3154,7 +3140,7 @@ u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw)
3154 rtlphy->sw_chnl_stage = 0; 3140 rtlphy->sw_chnl_stage = 0;
3155 rtlphy->sw_chnl_step = 0; 3141 rtlphy->sw_chnl_step = 0;
3156 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, 3142 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE,
3157 ("switch to channel%d\n", rtlphy->current_channel)); 3143 "switch to channel%d\n", rtlphy->current_channel);
3158 3144
3159 do { 3145 do {
3160 if (!rtlphy->sw_chnl_inprogress) 3146 if (!rtlphy->sw_chnl_inprogress)
@@ -3171,7 +3157,7 @@ u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw)
3171 } 3157 }
3172 break; 3158 break;
3173 } while (true); 3159 } while (true);
3174 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 3160 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n");
3175 rtlphy->sw_chnl_inprogress = false; 3161 rtlphy->sw_chnl_inprogress = false;
3176 return 1; 3162 return 1;
3177} 3163}
@@ -3182,8 +3168,8 @@ static void rtl92d_phy_set_io(struct ieee80211_hw *hw)
3182 struct rtl_phy *rtlphy = &(rtlpriv->phy); 3168 struct rtl_phy *rtlphy = &(rtlpriv->phy);
3183 3169
3184 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 3170 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
3185 ("--->Cmd(%#x), set_io_inprogress(%d)\n", 3171 "--->Cmd(%#x), set_io_inprogress(%d)\n",
3186 rtlphy->current_io_type, rtlphy->set_io_inprogress)); 3172 rtlphy->current_io_type, rtlphy->set_io_inprogress);
3187 switch (rtlphy->current_io_type) { 3173 switch (rtlphy->current_io_type) {
3188 case IO_CMD_RESUME_DM_BY_SCAN: 3174 case IO_CMD_RESUME_DM_BY_SCAN:
3189 de_digtable.cur_igvalue = rtlphy->initgain_backup.xaagccore1; 3175 de_digtable.cur_igvalue = rtlphy->initgain_backup.xaagccore1;
@@ -3197,12 +3183,12 @@ static void rtl92d_phy_set_io(struct ieee80211_hw *hw)
3197 break; 3183 break;
3198 default: 3184 default:
3199 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 3185 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
3200 ("switch case not process\n")); 3186 "switch case not processed\n");
3201 break; 3187 break;
3202 } 3188 }
3203 rtlphy->set_io_inprogress = false; 3189 rtlphy->set_io_inprogress = false;
3204 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 3190 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<---(%#x)\n",
3205 ("<---(%#x)\n", rtlphy->current_io_type)); 3191 rtlphy->current_io_type);
3206} 3192}
3207 3193
3208bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype) 3194bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
@@ -3212,23 +3198,23 @@ bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
3212 bool postprocessing = false; 3198 bool postprocessing = false;
3213 3199
3214 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 3200 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
3215 ("-->IO Cmd(%#x), set_io_inprogress(%d)\n", 3201 "-->IO Cmd(%#x), set_io_inprogress(%d)\n",
3216 iotype, rtlphy->set_io_inprogress)); 3202 iotype, rtlphy->set_io_inprogress);
3217 do { 3203 do {
3218 switch (iotype) { 3204 switch (iotype) {
3219 case IO_CMD_RESUME_DM_BY_SCAN: 3205 case IO_CMD_RESUME_DM_BY_SCAN:
3220 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 3206 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
3221 ("[IO CMD] Resume DM after scan.\n")); 3207 "[IO CMD] Resume DM after scan\n");
3222 postprocessing = true; 3208 postprocessing = true;
3223 break; 3209 break;
3224 case IO_CMD_PAUSE_DM_BY_SCAN: 3210 case IO_CMD_PAUSE_DM_BY_SCAN:
3225 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, 3211 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE,
3226 ("[IO CMD] Pause DM before scan.\n")); 3212 "[IO CMD] Pause DM before scan\n");
3227 postprocessing = true; 3213 postprocessing = true;
3228 break; 3214 break;
3229 default: 3215 default:
3230 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 3216 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
3231 ("switch case not process\n")); 3217 "switch case not processed\n");
3232 break; 3218 break;
3233 } 3219 }
3234 } while (false); 3220 } while (false);
@@ -3239,7 +3225,7 @@ bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
3239 return false; 3225 return false;
3240 } 3226 }
3241 rtl92d_phy_set_io(hw); 3227 rtl92d_phy_set_io(hw);
3242 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, ("<--IO Type(%#x)\n", iotype)); 3228 RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<--IO Type(%#x)\n", iotype);
3243 return true; 3229 return true;
3244} 3230}
3245 3231
@@ -3297,7 +3283,7 @@ static void _rtl92d_phy_set_rfsleep(struct ieee80211_hw *hw)
3297 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); 3283 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3);
3298 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); 3284 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00);
3299 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 3285 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
3300 ("Fail !!! Switch RF timeout.\n")); 3286 "Fail !!! Switch RF timeout\n");
3301 return; 3287 return;
3302 } 3288 }
3303 /* e. For PCIE: SYS_FUNC_EN 0x02[7:0] = 0xE2 reset BB TRX function */ 3289 /* e. For PCIE: SYS_FUNC_EN 0x02[7:0] = 0xE2 reset BB TRX function */
@@ -3332,7 +3318,7 @@ bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw,
3332 do { 3318 do {
3333 InitializeCount++; 3319 InitializeCount++;
3334 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 3320 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
3335 ("IPS Set eRf nic enable\n")); 3321 "IPS Set eRf nic enable\n");
3336 rtstatus = rtl_ps_enable_nic(hw); 3322 rtstatus = rtl_ps_enable_nic(hw);
3337 } while ((rtstatus != true) && 3323 } while ((rtstatus != true) &&
3338 (InitializeCount < 10)); 3324 (InitializeCount < 10));
@@ -3341,11 +3327,10 @@ bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw,
3341 RT_RF_OFF_LEVL_HALT_NIC); 3327 RT_RF_OFF_LEVL_HALT_NIC);
3342 } else { 3328 } else {
3343 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 3329 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
3344 ("awake, sleeped:%d ms state_" 3330 "awake, sleeped:%d ms state_inap:%x\n",
3345 "inap:%x\n",
3346 jiffies_to_msecs(jiffies - 3331 jiffies_to_msecs(jiffies -
3347 ppsc->last_sleep_jiffies), 3332 ppsc->last_sleep_jiffies),
3348 rtlpriv->psc.state_inap)); 3333 rtlpriv->psc.state_inap);
3349 ppsc->last_awake_jiffies = jiffies; 3334 ppsc->last_awake_jiffies = jiffies;
3350 _rtl92d_phy_set_rfon(hw); 3335 _rtl92d_phy_set_rfon(hw);
3351 } 3336 }
@@ -3360,7 +3345,7 @@ bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw,
3360 case ERFOFF: 3345 case ERFOFF:
3361 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { 3346 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) {
3362 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 3347 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
3363 ("IPS Set eRf nic disable\n")); 3348 "IPS Set eRf nic disable\n");
3364 rtl_ps_disable_nic(hw); 3349 rtl_ps_disable_nic(hw);
3365 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); 3350 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
3366 } else { 3351 } else {
@@ -3385,41 +3370,40 @@ bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw,
3385 continue; 3370 continue;
3386 } else if (rtlpci->pdev->current_state != PCI_D0) { 3371 } else if (rtlpci->pdev->current_state != PCI_D0) {
3387 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 3372 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
3388 ("eRf Off/Sleep: %d times TcbBusyQueu" 3373 "eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 but lower power state!\n",
3389 "e[%d] !=0 but lower power state!\n", 3374 i + 1, queue_id);
3390 (i + 1), queue_id));
3391 break; 3375 break;
3392 } else { 3376 } else {
3393 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 3377 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
3394 ("eRf Off/Sleep: %d times TcbBusyQueu" 3378 "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
3395 "e[%d] =%d " 3379 i + 1, queue_id,
3396 "before doze!\n", (i + 1), queue_id, 3380 skb_queue_len(&ring->queue));
3397 skb_queue_len(&ring->queue)));
3398 udelay(10); 3381 udelay(10);
3399 i++; 3382 i++;
3400 } 3383 }
3401 3384
3402 if (i >= MAX_DOZE_WAITING_TIMES_9x) { 3385 if (i >= MAX_DOZE_WAITING_TIMES_9x) {
3403 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 3386 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
3404 ("\nERFOFF: %d times TcbBusyQueue[%d] " 3387 "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n",
3405 "= %d !\n", 3388 MAX_DOZE_WAITING_TIMES_9x, queue_id,
3406 MAX_DOZE_WAITING_TIMES_9x, queue_id, 3389 skb_queue_len(&ring->queue));
3407 skb_queue_len(&ring->queue)));
3408 break; 3390 break;
3409 } 3391 }
3410 } 3392 }
3411 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 3393 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
3412 ("Set rfsleep awaked:%d ms\n", 3394 "Set rfsleep awaked:%d ms\n",
3413 jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies))); 3395 jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies));
3414 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, ("sleep awaked:%d ms " 3396 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
3415 "state_inap:%x\n", jiffies_to_msecs(jiffies - 3397 "sleep awaked:%d ms state_inap:%x\n",
3416 ppsc->last_awake_jiffies), rtlpriv->psc.state_inap)); 3398 jiffies_to_msecs(jiffies -
3399 ppsc->last_awake_jiffies),
3400 rtlpriv->psc.state_inap);
3417 ppsc->last_sleep_jiffies = jiffies; 3401 ppsc->last_sleep_jiffies = jiffies;
3418 _rtl92d_phy_set_rfsleep(hw); 3402 _rtl92d_phy_set_rfsleep(hw);
3419 break; 3403 break;
3420 default: 3404 default:
3421 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 3405 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
3422 ("switch case not process\n")); 3406 "switch case not processed\n");
3423 bresult = false; 3407 bresult = false;
3424 break; 3408 break;
3425 } 3409 }
@@ -3437,17 +3421,17 @@ void rtl92d_phy_config_macphymode(struct ieee80211_hw *hw)
3437 switch (rtlhal->macphymode) { 3421 switch (rtlhal->macphymode) {
3438 case DUALMAC_DUALPHY: 3422 case DUALMAC_DUALPHY:
3439 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 3423 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
3440 ("MacPhyMode: DUALMAC_DUALPHY\n")); 3424 "MacPhyMode: DUALMAC_DUALPHY\n");
3441 rtl_write_byte(rtlpriv, offset, 0xF3); 3425 rtl_write_byte(rtlpriv, offset, 0xF3);
3442 break; 3426 break;
3443 case SINGLEMAC_SINGLEPHY: 3427 case SINGLEMAC_SINGLEPHY:
3444 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 3428 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
3445 ("MacPhyMode: SINGLEMAC_SINGLEPHY\n")); 3429 "MacPhyMode: SINGLEMAC_SINGLEPHY\n");
3446 rtl_write_byte(rtlpriv, offset, 0xF4); 3430 rtl_write_byte(rtlpriv, offset, 0xF4);
3447 break; 3431 break;
3448 case DUALMAC_SINGLEPHY: 3432 case DUALMAC_SINGLEPHY:
3449 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 3433 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
3450 ("MacPhyMode: DUALMAC_SINGLEPHY\n")); 3434 "MacPhyMode: DUALMAC_SINGLEPHY\n");
3451 rtl_write_byte(rtlpriv, offset, 0xF1); 3435 rtl_write_byte(rtlpriv, offset, 0xF1);
3452 break; 3436 break;
3453 } 3437 }
@@ -3578,7 +3562,7 @@ void rtl92d_phy_set_poweron(struct ieee80211_hw *hw)
3578 } 3562 }
3579 } 3563 }
3580 if (i == 200) 3564 if (i == 200)
3581 RT_ASSERT(false, ("Another mac power off over time\n")); 3565 RT_ASSERT(false, "Another mac power off over time\n");
3582 } 3566 }
3583} 3567}
3584 3568
@@ -3615,7 +3599,7 @@ void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw)
3615 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 3599 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
3616 u8 rfpath, i; 3600 u8 rfpath, i;
3617 3601
3618 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("==>\n")); 3602 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "==>\n");
3619 /* r_select_5G for path_A/B 0 for 2.4G, 1 for 5G */ 3603 /* r_select_5G for path_A/B 0 for 2.4G, 1 for 5G */
3620 if (rtlhal->current_bandtype == BAND_ON_2_4G) { 3604 if (rtlhal->current_bandtype == BAND_ON_2_4G) {
3621 /* r_select_5G for path_A/B,0x878 */ 3605 /* r_select_5G for path_A/B,0x878 */
@@ -3764,7 +3748,7 @@ void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw)
3764 } else { 3748 } else {
3765 rtl92d_phy_enable_anotherphy(hw, false); 3749 rtl92d_phy_enable_anotherphy(hw, false);
3766 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 3750 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
3767 ("MAC1 use DBI to update 0x888")); 3751 "MAC1 use DBI to update 0x888\n");
3768 /* 0x888 */ 3752 /* 0x888 */
3769 rtl92de_write_dword_dbi(hw, RFPGA0_ADDALLOCKEN, 3753 rtl92de_write_dword_dbi(hw, RFPGA0_ADDALLOCKEN,
3770 rtl92de_read_dword_dbi(hw, 3754 rtl92de_read_dword_dbi(hw,
@@ -3789,9 +3773,9 @@ void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw)
3789 BRFREGOFFSETMASK); 3773 BRFREGOFFSETMASK);
3790 } 3774 }
3791 for (i = 0; i < 2; i++) 3775 for (i = 0; i < 2; i++)
3792 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("RF 0x18 = 0x%x\n", 3776 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "RF 0x18 = 0x%x\n",
3793 rtlphy->rfreg_chnlval[i])); 3777 rtlphy->rfreg_chnlval[i]);
3794 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("<==\n")); 3778 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "<==\n");
3795 3779
3796} 3780}
3797 3781
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.h b/drivers/net/wireless/rtlwifi/rtl8192de/phy.h
index a52c824b41e3..f074952bf25c 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/reg.h b/drivers/net/wireless/rtlwifi/rtl8192de/reg.h
index 131acc306fcc..9bc462331078 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/reg.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/rf.c b/drivers/net/wireless/rtlwifi/rtl8192de/rf.c
index db27cebaac2c..ff34d2dd39b8 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/rf.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -50,8 +50,8 @@ void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
50 BIT(11), 0x01); 50 BIT(11), 0x01);
51 51
52 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, 52 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD,
53 ("20M RF 0x18 = 0x%x\n", 53 "20M RF 0x18 = 0x%x\n",
54 rtlphy->rfreg_chnlval[rfpath])); 54 rtlphy->rfreg_chnlval[rfpath]);
55 } 55 }
56 56
57 break; 57 break;
@@ -62,13 +62,13 @@ void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
62 rtl_set_rfreg(hw, rfpath, RF_CHNLBW, BIT(10) | BIT(11), 62 rtl_set_rfreg(hw, rfpath, RF_CHNLBW, BIT(10) | BIT(11),
63 0x00); 63 0x00);
64 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, 64 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD,
65 ("40M RF 0x18 = 0x%x\n", 65 "40M RF 0x18 = 0x%x\n",
66 rtlphy->rfreg_chnlval[rfpath])); 66 rtlphy->rfreg_chnlval[rfpath]);
67 } 67 }
68 break; 68 break;
69 default: 69 default:
70 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 70 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
71 ("unknown bandwidth: %#X\n", bandwidth)); 71 "unknown bandwidth: %#X\n", bandwidth);
72 break; 72 break;
73 } 73 }
74} 74}
@@ -127,23 +127,23 @@ void rtl92d_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
127 tmpval = tx_agc[RF90_PATH_A] & 0xff; 127 tmpval = tx_agc[RF90_PATH_A] & 0xff;
128 rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, BMASKBYTE1, tmpval); 128 rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, BMASKBYTE1, tmpval);
129 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 129 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
130 ("CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, 130 "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n",
131 RTXAGC_A_CCK1_MCS32)); 131 tmpval, RTXAGC_A_CCK1_MCS32);
132 tmpval = tx_agc[RF90_PATH_A] >> 8; 132 tmpval = tx_agc[RF90_PATH_A] >> 8;
133 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); 133 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval);
134 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 134 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
135 ("CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, 135 "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n",
136 RTXAGC_B_CCK11_A_CCK2_11)); 136 tmpval, RTXAGC_B_CCK11_A_CCK2_11);
137 tmpval = tx_agc[RF90_PATH_B] >> 24; 137 tmpval = tx_agc[RF90_PATH_B] >> 24;
138 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, BMASKBYTE0, tmpval); 138 rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, BMASKBYTE0, tmpval);
139 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 139 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
140 ("CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, 140 "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n",
141 RTXAGC_B_CCK11_A_CCK2_11)); 141 tmpval, RTXAGC_B_CCK11_A_CCK2_11);
142 tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff; 142 tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff;
143 rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval); 143 rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval);
144 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 144 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
145 ("CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, 145 "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n",
146 RTXAGC_B_CCK1_55_MCS32)); 146 tmpval, RTXAGC_B_CCK1_55_MCS32);
147} 147}
148 148
149static void _rtl92d_phy_get_power_base(struct ieee80211_hw *hw, 149static void _rtl92d_phy_get_power_base(struct ieee80211_hw *hw,
@@ -165,8 +165,8 @@ static void _rtl92d_phy_get_power_base(struct ieee80211_hw *hw,
165 (powerbase0 << 8) | powerbase0; 165 (powerbase0 << 8) | powerbase0;
166 *(ofdmbase + i) = powerbase0; 166 *(ofdmbase + i) = powerbase0;
167 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 167 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
168 (" [OFDM power base index rf(%c) = 0x%x]\n", 168 " [OFDM power base index rf(%c) = 0x%x]\n",
169 ((i == 0) ? 'A' : 'B'), *(ofdmbase + i))); 169 i == 0 ? 'A' : 'B', *(ofdmbase + i));
170 } 170 }
171 171
172 for (i = 0; i < 2; i++) { 172 for (i = 0; i < 2; i++) {
@@ -179,8 +179,8 @@ static void _rtl92d_phy_get_power_base(struct ieee80211_hw *hw,
179 (powerbase1 << 8) | powerbase1; 179 (powerbase1 << 8) | powerbase1;
180 *(mcsbase + i) = powerbase1; 180 *(mcsbase + i) = powerbase1;
181 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 181 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
182 (" [MCS power base index rf(%c) = 0x%x]\n", 182 " [MCS power base index rf(%c) = 0x%x]\n",
183 ((i == 0) ? 'A' : 'B'), *(mcsbase + i))); 183 i == 0 ? 'A' : 'B', *(mcsbase + i));
184 } 184 }
185} 185}
186 186
@@ -232,9 +232,9 @@ static void _rtl92d_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
232 (rf ? 8 : 0)] + ((index < 2) ? 232 (rf ? 8 : 0)] + ((index < 2) ?
233 powerbase0[rf] : 233 powerbase0[rf] :
234 powerbase1[rf]); 234 powerbase1[rf]);
235 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, ("RTK better " 235 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
236 "performance, writeval(%c) = 0x%x\n", 236 "RTK better performance, writeval(%c) = 0x%x\n",
237 ((rf == 0) ? 'A' : 'B'), writeval)); 237 rf == 0 ? 'A' : 'B', writeval);
238 break; 238 break;
239 case 1: 239 case 1:
240 if (rtlphy->pwrgroup_cnt == 1) 240 if (rtlphy->pwrgroup_cnt == 1)
@@ -253,33 +253,31 @@ static void _rtl92d_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
253 powerbase0[rf] : 253 powerbase0[rf] :
254 powerbase1[rf]); 254 powerbase1[rf]);
255 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 255 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
256 ("Realtek regulatory, " 256 "Realtek regulatory, 20MHz, writeval(%c) = 0x%x\n",
257 "20MHz, writeval(%c) = 0x%x\n", 257 rf == 0 ? 'A' : 'B', writeval);
258 ((rf == 0) ? 'A' : 'B'),
259 writeval));
260 } 258 }
261 break; 259 break;
262 case 2: 260 case 2:
263 writeval = ((index < 2) ? powerbase0[rf] : 261 writeval = ((index < 2) ? powerbase0[rf] :
264 powerbase1[rf]); 262 powerbase1[rf]);
265 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, ("Better regulatory, " 263 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
266 "writeval(%c) = 0x%x\n", 264 "Better regulatory, writeval(%c) = 0x%x\n",
267 ((rf == 0) ? 'A' : 'B'), writeval)); 265 rf == 0 ? 'A' : 'B', writeval);
268 break; 266 break;
269 case 3: 267 case 3:
270 chnlgroup = 0; 268 chnlgroup = 0;
271 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { 269 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
272 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 270 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
273 ("customer's limit, 40MHz rf(%c) = " 271 "customer's limit, 40MHz rf(%c) = 0x%x\n",
274 "0x%x\n", ((rf == 0) ? 'A' : 'B'), 272 rf == 0 ? 'A' : 'B',
275 rtlefuse->pwrgroup_ht40[rf] 273 rtlefuse->pwrgroup_ht40[rf]
276 [channel - 1])); 274 [channel - 1]);
277 } else { 275 } else {
278 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 276 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
279 ("customer's limit, 20MHz rf(%c) = " 277 "customer's limit, 20MHz rf(%c) = 0x%x\n",
280 "0x%x\n", ((rf == 0) ? 'A' : 'B'), 278 rf == 0 ? 'A' : 'B',
281 rtlefuse->pwrgroup_ht20[rf] 279 rtlefuse->pwrgroup_ht20[rf]
282 [channel - 1])); 280 [channel - 1]);
283 } 281 }
284 for (i = 0; i < 4; i++) { 282 for (i = 0; i < 4; i++) {
285 pwr_diff_limit[i] = 283 pwr_diff_limit[i] =
@@ -308,13 +306,13 @@ static void _rtl92d_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
308 (pwr_diff_limit[1] << 8) | 306 (pwr_diff_limit[1] << 8) |
309 (pwr_diff_limit[0]); 307 (pwr_diff_limit[0]);
310 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 308 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
311 ("Customer's limit rf(%c) = 0x%x\n", 309 "Customer's limit rf(%c) = 0x%x\n",
312 ((rf == 0) ? 'A' : 'B'), customer_limit)); 310 rf == 0 ? 'A' : 'B', customer_limit);
313 writeval = customer_limit + ((index < 2) ? 311 writeval = customer_limit + ((index < 2) ?
314 powerbase0[rf] : powerbase1[rf]); 312 powerbase0[rf] : powerbase1[rf]);
315 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 313 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
316 ("Customer, writeval rf(%c)= 0x%x\n", 314 "Customer, writeval rf(%c)= 0x%x\n",
317 ((rf == 0) ? 'A' : 'B'), writeval)); 315 rf == 0 ? 'A' : 'B', writeval);
318 break; 316 break;
319 default: 317 default:
320 chnlgroup = 0; 318 chnlgroup = 0;
@@ -323,9 +321,8 @@ static void _rtl92d_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
323 (rf ? 8 : 0)] + ((index < 2) ? 321 (rf ? 8 : 0)] + ((index < 2) ?
324 powerbase0[rf] : powerbase1[rf]); 322 powerbase0[rf] : powerbase1[rf]);
325 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 323 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
326 ("RTK better performance, writeval " 324 "RTK better performance, writeval rf(%c) = 0x%x\n",
327 "rf(%c) = 0x%x\n", 325 rf == 0 ? 'A' : 'B', writeval);
328 ((rf == 0) ? 'A' : 'B'), writeval));
329 break; 326 break;
330 } 327 }
331 *(p_outwriteval + rf) = writeval; 328 *(p_outwriteval + rf) = writeval;
@@ -367,7 +364,7 @@ static void _rtl92d_write_ofdm_power_reg(struct ieee80211_hw *hw,
367 regoffset = regoffset_b[index]; 364 regoffset = regoffset_b[index];
368 rtl_set_bbreg(hw, regoffset, BMASKDWORD, writeval); 365 rtl_set_bbreg(hw, regoffset, BMASKDWORD, writeval);
369 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 366 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
370 ("Set 0x%x = %08x\n", regoffset, writeval)); 367 "Set 0x%x = %08x\n", regoffset, writeval);
371 if (((get_rf_type(rtlphy) == RF_2T2R) && 368 if (((get_rf_type(rtlphy) == RF_2T2R) &&
372 (regoffset == RTXAGC_A_MCS15_MCS12 || 369 (regoffset == RTXAGC_A_MCS15_MCS12 ||
373 regoffset == RTXAGC_B_MCS15_MCS12)) || 370 regoffset == RTXAGC_B_MCS15_MCS12)) ||
@@ -423,11 +420,11 @@ bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw *hw, bool bmac0)
423 420
424 rtlhal->during_mac0init_radiob = false; 421 rtlhal->during_mac0init_radiob = false;
425 rtlhal->during_mac1init_radioa = false; 422 rtlhal->during_mac1init_radioa = false;
426 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("===>\n")); 423 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "===>\n");
427 /* MAC0 Need PHY1 load radio_b.txt . Driver use DBI to write. */ 424 /* MAC0 Need PHY1 load radio_b.txt . Driver use DBI to write. */
428 u1btmp = rtl_read_byte(rtlpriv, mac_reg); 425 u1btmp = rtl_read_byte(rtlpriv, mac_reg);
429 if (!(u1btmp & mac_on_bit)) { 426 if (!(u1btmp & mac_on_bit)) {
430 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("enable BB & RF\n")); 427 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "enable BB & RF\n");
431 /* Enable BB and RF power */ 428 /* Enable BB and RF power */
432 rtl92de_write_dword_dbi(hw, REG_SYS_ISO_CTRL, 429 rtl92de_write_dword_dbi(hw, REG_SYS_ISO_CTRL,
433 rtl92de_read_dword_dbi(hw, REG_SYS_ISO_CTRL, direct) | 430 rtl92de_read_dword_dbi(hw, REG_SYS_ISO_CTRL, direct) |
@@ -437,7 +434,7 @@ bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw *hw, bool bmac0)
437 * and radio_b.txt has been load. */ 434 * and radio_b.txt has been load. */
438 bresult = false; 435 bresult = false;
439 } 436 }
440 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("<===\n")); 437 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "<===\n");
441 return bresult; 438 return bresult;
442 439
443} 440}
@@ -453,17 +450,17 @@ void rtl92d_phy_powerdown_anotherphy(struct ieee80211_hw *hw, bool bmac0)
453 450
454 rtlhal->during_mac0init_radiob = false; 451 rtlhal->during_mac0init_radiob = false;
455 rtlhal->during_mac1init_radioa = false; 452 rtlhal->during_mac1init_radioa = false;
456 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("====>\n")); 453 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "====>\n");
457 /* check MAC0 enable or not again now, if 454 /* check MAC0 enable or not again now, if
458 * enabled, not power down radio A. */ 455 * enabled, not power down radio A. */
459 u1btmp = rtl_read_byte(rtlpriv, mac_reg); 456 u1btmp = rtl_read_byte(rtlpriv, mac_reg);
460 if (!(u1btmp & mac_on_bit)) { 457 if (!(u1btmp & mac_on_bit)) {
461 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("power down\n")); 458 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "power down\n");
462 /* power down RF radio A according to YuNan's advice. */ 459 /* power down RF radio A according to YuNan's advice. */
463 rtl92de_write_dword_dbi(hw, RFPGA0_XA_LSSIPARAMETER, 460 rtl92de_write_dword_dbi(hw, RFPGA0_XA_LSSIPARAMETER,
464 0x00000000, direct); 461 0x00000000, direct);
465 } 462 }
466 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, ("<====\n")); 463 RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "<====\n");
467} 464}
468 465
469bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw) 466bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw)
@@ -606,7 +603,7 @@ bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw)
606 } 603 }
607 if (rtstatus != true) { 604 if (rtstatus != true) {
608 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 605 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
609 ("Radio[%d] Fail!!", rfpath)); 606 "Radio[%d] Fail!!", rfpath);
610 goto phy_rf_cfg_fail; 607 goto phy_rf_cfg_fail;
611 } 608 }
612 609
@@ -620,7 +617,7 @@ bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw)
620 rtl92d_phy_powerdown_anotherphy(hw, false); 617 rtl92d_phy_powerdown_anotherphy(hw, false);
621 else if (need_pwrdown_radiob) 618 else if (need_pwrdown_radiob)
622 rtl92d_phy_powerdown_anotherphy(hw, true); 619 rtl92d_phy_powerdown_anotherphy(hw, true);
623 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, ("<---\n")); 620 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n");
624 return rtstatus; 621 return rtstatus;
625 622
626phy_rf_cfg_fail: 623phy_rf_cfg_fail:
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/rf.h b/drivers/net/wireless/rtlwifi/rtl8192de/rf.h
index 74b9cfc39a83..0fe1a48593e8 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/rf.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
index 7911c9c87085..4898c502974d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,11 +27,6 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include <linux/vmalloc.h>
33#include <linux/module.h>
34
35#include "../wifi.h" 30#include "../wifi.h"
36#include "../core.h" 31#include "../core.h"
37#include "../pci.h" 32#include "../pci.h"
@@ -44,6 +39,8 @@
44#include "trx.h" 39#include "trx.h"
45#include "led.h" 40#include "led.h"
46 41
42#include <linux/module.h>
43
47static void rtl92d_init_aspm_vars(struct ieee80211_hw *hw) 44static void rtl92d_init_aspm_vars(struct ieee80211_hw *hw)
48{ 45{
49 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 46 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -94,7 +91,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
94 u8 tid; 91 u8 tid;
95 struct rtl_priv *rtlpriv = rtl_priv(hw); 92 struct rtl_priv *rtlpriv = rtl_priv(hw);
96 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 93 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
97 const struct firmware *firmware;
98 static int header_print; 94 static int header_print;
99 95
100 rtlpriv->dm.dm_initialgain_enable = true; 96 rtlpriv->dm.dm_initialgain_enable = true;
@@ -154,9 +150,9 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
154 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; 150 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
155 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; 151 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
156 if (!rtlpriv->psc.inactiveps) 152 if (!rtlpriv->psc.inactiveps)
157 pr_info("rtl8192ce: Power Save off (module option)\n"); 153 pr_info("Power Save off (module option)\n");
158 if (!rtlpriv->psc.fwctrl_lps) 154 if (!rtlpriv->psc.fwctrl_lps)
159 pr_info("rtl8192ce: FW Power Save off (module option)\n"); 155 pr_info("FW Power Save off (module option)\n");
160 rtlpriv->psc.reg_fwctrl_lps = 3; 156 rtlpriv->psc.reg_fwctrl_lps = 3;
161 rtlpriv->psc.reg_max_lps_awakeintvl = 5; 157 rtlpriv->psc.reg_max_lps_awakeintvl = 5;
162 /* for ASPM, you can close aspm through 158 /* for ASPM, you can close aspm through
@@ -170,41 +166,38 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
170 else if (rtlpriv->psc.reg_fwctrl_lps == 3) 166 else if (rtlpriv->psc.reg_fwctrl_lps == 3)
171 rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; 167 rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE;
172 168
169 /* for early mode */
170 rtlpriv->rtlhal.earlymode_enable = true;
171 for (tid = 0; tid < 8; tid++)
172 skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]);
173
174 /* Only load firmware for first MAC */
175 if (header_print)
176 return 0;
177
173 /* for firmware buf */ 178 /* for firmware buf */
174 rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); 179 rtlpriv->rtlhal.pfirmware = vzalloc(0x8000);
175 if (!rtlpriv->rtlhal.pfirmware) { 180 if (!rtlpriv->rtlhal.pfirmware) {
176 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 181 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
177 ("Can't alloc buffer for fw.\n")); 182 "Can't alloc buffer for fw\n");
178 return 1; 183 return 1;
179 } 184 }
180 185
181 if (!header_print) { 186 rtlpriv->max_fw_size = 0x8000;
182 pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); 187 pr_info("Driver for Realtek RTL8192DE WLAN interface\n");
183 pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); 188 pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name);
184 header_print++; 189 header_print++;
185 } 190
186 /* request fw */ 191 /* request fw */
187 err = request_firmware(&firmware, rtlpriv->cfg->fw_name, 192 err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
188 rtlpriv->io.dev); 193 rtlpriv->io.dev, GFP_KERNEL, hw,
194 rtl_fw_cb);
189 if (err) { 195 if (err) {
190 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 196 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
191 ("Failed to request firmware!\n")); 197 "Failed to request firmware!\n");
192 return 1;
193 }
194 if (firmware->size > 0x8000) {
195 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
196 ("Firmware is too big!\n"));
197 release_firmware(firmware);
198 return 1; 198 return 1;
199 } 199 }
200 memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size);
201 rtlpriv->rtlhal.fwsize = firmware->size;
202 release_firmware(firmware);
203 200
204 /* for early mode */
205 rtlpriv->rtlhal.earlymode_enable = true;
206 for (tid = 0; tid < 8; tid++)
207 skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]);
208 return 0; 201 return 0;
209} 202}
210 203
@@ -424,7 +417,7 @@ static int __init rtl92de_module_init(void)
424 417
425 ret = pci_register_driver(&rtl92de_driver); 418 ret = pci_register_driver(&rtl92de_driver);
426 if (ret) 419 if (ret)
427 RT_ASSERT(false, (": No device found\n")); 420 RT_ASSERT(false, "No device found\n");
428 return ret; 421 return ret;
429} 422}
430 423
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.h b/drivers/net/wireless/rtlwifi/rtl8192de/sw.h
index c95e47de1346..0e6035b8fd86 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/table.c b/drivers/net/wireless/rtlwifi/rtl8192de/table.c
index bad7f9449ecf..8ea6f528dfa6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/table.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/table.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/table.h b/drivers/net/wireless/rtlwifi/rtl8192de/table.h
index 93f30ca62d8f..8b724a86117a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/table.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/table.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
index 3637c0c33525..a7f6126e2f86 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -602,8 +602,8 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
602 EM_HDR_LEN); 602 EM_HDR_LEN);
603 if (ptcb_desc->empkt_num) { 603 if (ptcb_desc->empkt_num) {
604 RT_TRACE(rtlpriv, COMP_SEND, DBG_LOUD, 604 RT_TRACE(rtlpriv, COMP_SEND, DBG_LOUD,
605 ("Insert 8 byte.pTcb->EMPktNum:%d\n", 605 "Insert 8 byte.pTcb->EMPktNum:%d\n",
606 ptcb_desc->empkt_num)); 606 ptcb_desc->empkt_num);
607 _rtl92de_insert_emcontent(ptcb_desc, 607 _rtl92de_insert_emcontent(ptcb_desc,
608 (u8 *)(skb->data)); 608 (u8 *)(skb->data));
609 } 609 }
@@ -700,7 +700,7 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
700 if (ieee80211_is_data_qos(fc)) { 700 if (ieee80211_is_data_qos(fc)) {
701 if (mac->rdg_en) { 701 if (mac->rdg_en) {
702 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 702 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
703 ("Enable RDG function.\n")); 703 "Enable RDG function\n");
704 SET_TX_DESC_RDG_ENABLE(pdesc, 1); 704 SET_TX_DESC_RDG_ENABLE(pdesc, 1);
705 SET_TX_DESC_HTC(pdesc, 1); 705 SET_TX_DESC_HTC(pdesc, 1);
706 } 706 }
@@ -726,7 +726,7 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
726 SET_TX_DESC_PKT_ID(pdesc, 8); 726 SET_TX_DESC_PKT_ID(pdesc, 8);
727 } 727 }
728 SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1)); 728 SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1));
729 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, ("\n")); 729 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n");
730} 730}
731 731
732void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, 732void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw,
@@ -776,7 +776,7 @@ void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw,
776 } 776 }
777 777
778 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, 778 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
779 "H2C Tx Cmd Content\n", pdesc, TX_DESC_SIZE); 779 "H2C Tx Cmd Content", pdesc, TX_DESC_SIZE);
780 wmb(); 780 wmb();
781 SET_TX_DESC_OWN(pdesc, 1); 781 SET_TX_DESC_OWN(pdesc, 1);
782} 782}
@@ -793,8 +793,8 @@ void rtl92de_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
793 SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val); 793 SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val);
794 break; 794 break;
795 default: 795 default:
796 RT_ASSERT(false, ("ERR txdesc :%d" 796 RT_ASSERT(false, "ERR txdesc :%d not process\n",
797 " not process\n", desc_name)); 797 desc_name);
798 break; 798 break;
799 } 799 }
800 } else { 800 } else {
@@ -813,8 +813,8 @@ void rtl92de_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
813 SET_RX_DESC_EOR(pdesc, 1); 813 SET_RX_DESC_EOR(pdesc, 1);
814 break; 814 break;
815 default: 815 default:
816 RT_ASSERT(false, ("ERR rxdesc :%d " 816 RT_ASSERT(false, "ERR rxdesc :%d not process\n",
817 "not process\n", desc_name)); 817 desc_name);
818 break; 818 break;
819 } 819 }
820 } 820 }
@@ -833,8 +833,8 @@ u32 rtl92de_get_desc(u8 *p_desc, bool istx, u8 desc_name)
833 ret = GET_TX_DESC_TX_BUFFER_ADDRESS(p_desc); 833 ret = GET_TX_DESC_TX_BUFFER_ADDRESS(p_desc);
834 break; 834 break;
835 default: 835 default:
836 RT_ASSERT(false, ("ERR txdesc :%d " 836 RT_ASSERT(false, "ERR txdesc :%d not process\n",
837 "not process\n", desc_name)); 837 desc_name);
838 break; 838 break;
839 } 839 }
840 } else { 840 } else {
@@ -847,8 +847,8 @@ u32 rtl92de_get_desc(u8 *p_desc, bool istx, u8 desc_name)
847 ret = GET_RX_DESC_PKT_LEN(pdesc); 847 ret = GET_RX_DESC_PKT_LEN(pdesc);
848 break; 848 break;
849 default: 849 default:
850 RT_ASSERT(false, ("ERR rxdesc :%d " 850 RT_ASSERT(false, "ERR rxdesc :%d not process\n",
851 "not process\n", desc_name)); 851 desc_name);
852 break; 852 break;
853 } 853 }
854 } 854 }
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/rtlwifi/rtl8192de/trx.h
index 4d55d0b6816d..0dc736c2723b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/def.h b/drivers/net/wireless/rtlwifi/rtl8192se/def.h
index c6c044816d39..d1b0a1e14971 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/def.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/def.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
index 4203a8531ca0..fbabae17259e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -170,9 +170,9 @@ static void _rtl92s_dm_txpowertracking_callback_thermalmeter(
170 thermalvalue = (u8)rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0x1f); 170 thermalvalue = (u8)rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0x1f);
171 171
172 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 172 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
173 ("Readback Thermal Meter = 0x%x pre thermal meter 0x%x " 173 "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermal meter 0x%x\n",
174 "eeprom_thermalmeter 0x%x\n", thermalvalue, 174 thermalvalue,
175 rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter)); 175 rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter);
176 176
177 if (thermalvalue) { 177 if (thermalvalue) {
178 rtlpriv->dm.thermalvalue = thermalvalue; 178 rtlpriv->dm.thermalvalue = thermalvalue;
@@ -282,11 +282,11 @@ static void _rtl92s_dm_refresh_rateadaptive_mask(struct ieee80211_hw *hw)
282 } 282 }
283 283
284 if (ra->pre_ratr_state != ra->ratr_state) { 284 if (ra->pre_ratr_state != ra->ratr_state) {
285 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, ("RSSI = %ld " 285 RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD,
286 "RSSI_LEVEL = %d PreState = %d, CurState = %d\n", 286 "RSSI = %ld RSSI_LEVEL = %d PreState = %d, CurState = %d\n",
287 rtlpriv->dm.undecorated_smoothed_pwdb, 287 rtlpriv->dm.undecorated_smoothed_pwdb,
288 ra->ratr_state, 288 ra->ratr_state,
289 ra->pre_ratr_state, ra->ratr_state)); 289 ra->pre_ratr_state, ra->ratr_state);
290 290
291 rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 291 rtlpriv->cfg->ops->update_rate_tbl(hw, sta,
292 ra->ratr_state); 292 ra->ratr_state);
@@ -586,7 +586,7 @@ static void _rtl92s_dm_dynamic_txpower(struct ieee80211_hw *hw)
586 if ((mac->link_state < MAC80211_LINKED) && 586 if ((mac->link_state < MAC80211_LINKED) &&
587 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { 587 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) {
588 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, 588 RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE,
589 ("Not connected to any\n")); 589 "Not connected to any\n");
590 590
591 rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL; 591 rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL;
592 592
@@ -599,22 +599,22 @@ static void _rtl92s_dm_dynamic_txpower(struct ieee80211_hw *hw)
599 undecorated_smoothed_pwdb = 599 undecorated_smoothed_pwdb =
600 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 600 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
601 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 601 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
602 ("AP Client PWDB = 0x%lx\n", 602 "AP Client PWDB = 0x%lx\n",
603 undecorated_smoothed_pwdb)); 603 undecorated_smoothed_pwdb);
604 } else { 604 } else {
605 undecorated_smoothed_pwdb = 605 undecorated_smoothed_pwdb =
606 rtlpriv->dm.undecorated_smoothed_pwdb; 606 rtlpriv->dm.undecorated_smoothed_pwdb;
607 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 607 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
608 ("STA Default Port PWDB = 0x%lx\n", 608 "STA Default Port PWDB = 0x%lx\n",
609 undecorated_smoothed_pwdb)); 609 undecorated_smoothed_pwdb);
610 } 610 }
611 } else { 611 } else {
612 undecorated_smoothed_pwdb = 612 undecorated_smoothed_pwdb =
613 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 613 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
614 614
615 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 615 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
616 ("AP Ext Port PWDB = 0x%lx\n", 616 "AP Ext Port PWDB = 0x%lx\n",
617 undecorated_smoothed_pwdb)); 617 undecorated_smoothed_pwdb);
618 } 618 }
619 619
620 txpwr_threshold_lv2 = TX_POWER_NEAR_FIELD_THRESH_LVL2; 620 txpwr_threshold_lv2 = TX_POWER_NEAR_FIELD_THRESH_LVL2;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.h b/drivers/net/wireless/rtlwifi/rtl8192se/dm.h
index 9051a556acc4..e1b19a641765 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/dm.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/fw.c b/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
index 3fda6b1dcf46..0d8bf5657008 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -66,7 +66,7 @@ static bool _rtl92s_firmware_enable_cpu(struct ieee80211_hw *hw)
66 cpustatus = rtl_read_byte(rtlpriv, TCR); 66 cpustatus = rtl_read_byte(rtlpriv, TCR);
67 if (cpustatus & IMEM_RDY) { 67 if (cpustatus & IMEM_RDY) {
68 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 68 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
69 ("IMEM Ready after CPU has refilled.\n")); 69 "IMEM Ready after CPU has refilled\n");
70 break; 70 break;
71 } 71 }
72 72
@@ -120,9 +120,8 @@ static u8 _rtl92s_firmware_header_map_rftype(struct ieee80211_hw *hw)
120 return 0x22; 120 return 0x22;
121 break; 121 break;
122 default: 122 default:
123 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 123 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Unknown RF type(%x)\n",
124 ("Unknown RF type(%x)\n", 124 rtlphy->rf_type);
125 rtlphy->rf_type));
126 break; 125 break;
127 } 126 }
128 return 0x22; 127 return 0x22;
@@ -177,7 +176,7 @@ static bool _rtl92s_firmware_downloadcode(struct ieee80211_hw *hw,
177 176
178 if (buffer_len >= MAX_FIRMWARE_CODE_SIZE) { 177 if (buffer_len >= MAX_FIRMWARE_CODE_SIZE) {
179 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 178 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
180 ("Size over FIRMWARE_CODE_SIZE!\n")); 179 "Size over FIRMWARE_CODE_SIZE!\n");
181 180
182 return false; 181 return false;
183 } 182 }
@@ -231,8 +230,8 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,
231 short pollingcnt = 1000; 230 short pollingcnt = 1000;
232 bool rtstatus = true; 231 bool rtstatus = true;
233 232
234 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("LoadStaus(%d)\n", 233 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
235 loadfw_status)); 234 "LoadStaus(%d)\n", loadfw_status);
236 235
237 firmware->fwstatus = (enum fw_status)loadfw_status; 236 firmware->fwstatus = (enum fw_status)loadfw_status;
238 237
@@ -248,8 +247,8 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,
248 247
249 if (!(cpustatus & IMEM_CHK_RPT) || (pollingcnt <= 0)) { 248 if (!(cpustatus & IMEM_CHK_RPT) || (pollingcnt <= 0)) {
250 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 249 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
251 ("FW_STATUS_LOAD_IMEM" 250 "FW_STATUS_LOAD_IMEM FAIL CPU, Status=%x\n",
252 " FAIL CPU, Status=%x\r\n", cpustatus)); 251 cpustatus);
253 goto status_check_fail; 252 goto status_check_fail;
254 } 253 }
255 break; 254 break;
@@ -266,8 +265,8 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,
266 265
267 if (!(cpustatus & EMEM_CHK_RPT) || (pollingcnt <= 0)) { 266 if (!(cpustatus & EMEM_CHK_RPT) || (pollingcnt <= 0)) {
268 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 267 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
269 ("FW_STATUS_LOAD_EMEM" 268 "FW_STATUS_LOAD_EMEM FAIL CPU, Status=%x\n",
270 " FAIL CPU, Status=%x\r\n", cpustatus)); 269 cpustatus);
271 goto status_check_fail; 270 goto status_check_fail;
272 } 271 }
273 272
@@ -275,7 +274,7 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,
275 rtstatus = _rtl92s_firmware_enable_cpu(hw); 274 rtstatus = _rtl92s_firmware_enable_cpu(hw);
276 if (rtstatus != true) { 275 if (rtstatus != true) {
277 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 276 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
278 ("Enable CPU fail!\n")); 277 "Enable CPU fail!\n");
279 goto status_check_fail; 278 goto status_check_fail;
280 } 279 }
281 break; 280 break;
@@ -291,14 +290,14 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,
291 290
292 if (!(cpustatus & DMEM_CODE_DONE) || (pollingcnt <= 0)) { 291 if (!(cpustatus & DMEM_CODE_DONE) || (pollingcnt <= 0)) {
293 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 292 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
294 ("Polling DMEM code done" 293 "Polling DMEM code done fail ! cpustatus(%#x)\n",
295 " fail ! cpustatus(%#x)\n", cpustatus)); 294 cpustatus);
296 goto status_check_fail; 295 goto status_check_fail;
297 } 296 }
298 297
299 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 298 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
300 ("DMEM code download success," 299 "DMEM code download success, cpustatus(%#x)\n",
301 " cpustatus(%#x)\n", cpustatus)); 300 cpustatus);
302 301
303 /* Prevent Delay too much and being scheduled out */ 302 /* Prevent Delay too much and being scheduled out */
304 /* Polling Load Firmware ready */ 303 /* Polling Load Firmware ready */
@@ -311,14 +310,14 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,
311 } while (pollingcnt--); 310 } while (pollingcnt--);
312 311
313 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 312 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
314 ("Polling Load Firmware ready," 313 "Polling Load Firmware ready, cpustatus(%x)\n",
315 " cpustatus(%x)\n", cpustatus)); 314 cpustatus);
316 315
317 if (((cpustatus & LOAD_FW_READY) != LOAD_FW_READY) || 316 if (((cpustatus & LOAD_FW_READY) != LOAD_FW_READY) ||
318 (pollingcnt <= 0)) { 317 (pollingcnt <= 0)) {
319 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 318 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
320 ("Polling Load Firmware" 319 "Polling Load Firmware ready fail ! cpustatus(%x)\n",
321 " ready fail ! cpustatus(%x)\n", cpustatus)); 320 cpustatus);
322 goto status_check_fail; 321 goto status_check_fail;
323 } 322 }
324 323
@@ -332,7 +331,7 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,
332 RCR_APP_ICV | RCR_APP_MIC)); 331 RCR_APP_ICV | RCR_APP_MIC));
333 332
334 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 333 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
335 ("Current RCR settings(%#x)\n", tmpu4b)); 334 "Current RCR settings(%#x)\n", tmpu4b);
336 335
337 /* Set to normal mode. */ 336 /* Set to normal mode. */
338 rtl_write_byte(rtlpriv, LBKMD_SEL, LBK_NORMAL); 337 rtl_write_byte(rtlpriv, LBKMD_SEL, LBK_NORMAL);
@@ -340,14 +339,15 @@ static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw,
340 339
341 default: 340 default:
342 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 341 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
343 ("Unknown status check!\n")); 342 "Unknown status check!\n");
344 rtstatus = false; 343 rtstatus = false;
345 break; 344 break;
346 } 345 }
347 346
348status_check_fail: 347status_check_fail:
349 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("loadfw_status(%d), " 348 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
350 "rtstatus(%x)\n", loadfw_status, rtstatus)); 349 "loadfw_status(%d), rtstatus(%x)\n",
350 loadfw_status, rtstatus);
351 return rtstatus; 351 return rtstatus;
352} 352}
353 353
@@ -364,7 +364,7 @@ int rtl92s_download_fw(struct ieee80211_hw *hw)
364 u8 fwstatus = FW_STATUS_INIT; 364 u8 fwstatus = FW_STATUS_INIT;
365 bool rtstatus = true; 365 bool rtstatus = true;
366 366
367 if (!rtlhal->pfirmware) 367 if (rtlpriv->max_fw_size == 0 || !rtlhal->pfirmware)
368 return 1; 368 return 1;
369 369
370 firmware = (struct rt_firmware *)rtlhal->pfirmware; 370 firmware = (struct rt_firmware *)rtlhal->pfirmware;
@@ -378,17 +378,17 @@ int rtl92s_download_fw(struct ieee80211_hw *hw)
378 firmware->firmwareversion = byte(pfwheader->version, 0); 378 firmware->firmwareversion = byte(pfwheader->version, 0);
379 firmware->pfwheader->fwpriv.hci_sel = 1;/* pcie */ 379 firmware->pfwheader->fwpriv.hci_sel = 1;/* pcie */
380 380
381 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("signature:%x, version:" 381 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
382 "%x, size:%x," 382 "signature:%x, version:%x, size:%x, imemsize:%x, sram size:%x\n",
383 "imemsize:%x, sram size:%x\n", pfwheader->signature, 383 pfwheader->signature,
384 pfwheader->version, pfwheader->dmem_size, 384 pfwheader->version, pfwheader->dmem_size,
385 pfwheader->img_imem_size, pfwheader->img_sram_size)); 385 pfwheader->img_imem_size, pfwheader->img_sram_size);
386 386
387 /* 2. Retrieve IMEM image. */ 387 /* 2. Retrieve IMEM image. */
388 if ((pfwheader->img_imem_size == 0) || (pfwheader->img_imem_size > 388 if ((pfwheader->img_imem_size == 0) || (pfwheader->img_imem_size >
389 sizeof(firmware->fw_imem))) { 389 sizeof(firmware->fw_imem))) {
390 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 390 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
391 ("memory for data image is less than IMEM required\n")); 391 "memory for data image is less than IMEM required\n");
392 goto fail; 392 goto fail;
393 } else { 393 } else {
394 puc_mappedfile += fwhdr_size; 394 puc_mappedfile += fwhdr_size;
@@ -401,7 +401,7 @@ int rtl92s_download_fw(struct ieee80211_hw *hw)
401 /* 3. Retriecve EMEM image. */ 401 /* 3. Retriecve EMEM image. */
402 if (pfwheader->img_sram_size > sizeof(firmware->fw_emem)) { 402 if (pfwheader->img_sram_size > sizeof(firmware->fw_emem)) {
403 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 403 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
404 ("memory for data image is less than EMEM required\n")); 404 "memory for data image is less than EMEM required\n");
405 goto fail; 405 goto fail;
406 } else { 406 } else {
407 puc_mappedfile += firmware->fw_imem_len; 407 puc_mappedfile += firmware->fw_imem_len;
@@ -436,7 +436,7 @@ int rtl92s_download_fw(struct ieee80211_hw *hw)
436 break; 436 break;
437 default: 437 default:
438 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 438 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
439 ("Unexpected Download step!!\n")); 439 "Unexpected Download step!!\n");
440 goto fail; 440 goto fail;
441 break; 441 break;
442 } 442 }
@@ -446,14 +446,14 @@ int rtl92s_download_fw(struct ieee80211_hw *hw)
446 ul_filelength); 446 ul_filelength);
447 447
448 if (rtstatus != true) { 448 if (rtstatus != true) {
449 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("fail!\n")); 449 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "fail!\n");
450 goto fail; 450 goto fail;
451 } 451 }
452 452
453 /* <3> Check whether load FW process is ready */ 453 /* <3> Check whether load FW process is ready */
454 rtstatus = _rtl92s_firmware_checkready(hw, fwstatus); 454 rtstatus = _rtl92s_firmware_checkready(hw, fwstatus);
455 if (rtstatus != true) { 455 if (rtstatus != true) {
456 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("fail!\n")); 456 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "fail!\n");
457 goto fail; 457 goto fail;
458 } 458 }
459 459
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/fw.h b/drivers/net/wireless/rtlwifi/rtl8192se/fw.h
index 74cc503efe8a..babe85d4b694 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/fw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/fw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
index c474486e3911..22098c2f38f1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,8 +27,6 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include "../wifi.h" 30#include "../wifi.h"
33#include "../efuse.h" 31#include "../efuse.h"
34#include "../base.h" 32#include "../base.h"
@@ -80,8 +78,8 @@ void rtl92se_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
80 break; 78 break;
81 } 79 }
82 default: { 80 default: {
83 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 81 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
84 ("switch case not process\n")); 82 "switch case not processed\n");
85 break; 83 break;
86 } 84 }
87 } 85 }
@@ -140,7 +138,7 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
140 u8 e_aci; 138 u8 e_aci;
141 139
142 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 140 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
143 ("HW_VAR_SLOT_TIME %x\n", val[0])); 141 "HW_VAR_SLOT_TIME %x\n", val[0]);
144 142
145 rtl_write_byte(rtlpriv, SLOT_TIME, val[0]); 143 rtl_write_byte(rtlpriv, SLOT_TIME, val[0]);
146 144
@@ -185,8 +183,8 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
185 *val = min_spacing_to_set; 183 *val = min_spacing_to_set;
186 184
187 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 185 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
188 ("Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", 186 "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n",
189 mac->min_space_cfg)); 187 mac->min_space_cfg);
190 188
191 rtl_write_byte(rtlpriv, AMPDU_MIN_SPACE, 189 rtl_write_byte(rtlpriv, AMPDU_MIN_SPACE,
192 mac->min_space_cfg); 190 mac->min_space_cfg);
@@ -201,8 +199,8 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
201 mac->min_space_cfg |= (density_to_set << 3); 199 mac->min_space_cfg |= (density_to_set << 3);
202 200
203 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 201 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
204 ("Set HW_VAR_SHORTGI_DENSITY: %#x\n", 202 "Set HW_VAR_SHORTGI_DENSITY: %#x\n",
205 mac->min_space_cfg)); 203 mac->min_space_cfg);
206 204
207 rtl_write_byte(rtlpriv, AMPDU_MIN_SPACE, 205 rtl_write_byte(rtlpriv, AMPDU_MIN_SPACE,
208 mac->min_space_cfg); 206 mac->min_space_cfg);
@@ -244,8 +242,8 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
244 rtl_write_byte(rtlpriv, AGGLEN_LMT_H, regtoset); 242 rtl_write_byte(rtlpriv, AGGLEN_LMT_H, regtoset);
245 243
246 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 244 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
247 ("Set HW_VAR_AMPDU_FACTOR: %#x\n", 245 "Set HW_VAR_AMPDU_FACTOR: %#x\n",
248 factor_toset)); 246 factor_toset);
249 } 247 }
250 break; 248 break;
251 } 249 }
@@ -282,8 +280,8 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
282 break; 280 break;
283 default: 281 default:
284 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 282 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
285 ("HW_VAR_ACM_CTRL acm set " 283 "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n",
286 "failed: eACI is %d\n", acm)); 284 acm);
287 break; 285 break;
288 } 286 }
289 } else { 287 } else {
@@ -299,13 +297,13 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
299 break; 297 break;
300 default: 298 default:
301 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 299 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
302 ("switch case not process\n")); 300 "switch case not processed\n");
303 break; 301 break;
304 } 302 }
305 } 303 }
306 304
307 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, 305 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE,
308 ("HW_VAR_ACM_CTRL Write 0x%X\n", acm_ctrl)); 306 "HW_VAR_ACM_CTRL Write 0x%X\n", acm_ctrl);
309 rtl_write_byte(rtlpriv, AcmHwCtrl, acm_ctrl); 307 rtl_write_byte(rtlpriv, AcmHwCtrl, acm_ctrl);
310 break; 308 break;
311 } 309 }
@@ -404,7 +402,7 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
404 } 402 }
405 default: 403 default:
406 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 404 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
407 ("switch case not process\n")); 405 "switch case not processed\n");
408 break; 406 break;
409 } 407 }
410 408
@@ -415,14 +413,14 @@ void rtl92se_enable_hw_security_config(struct ieee80211_hw *hw)
415 struct rtl_priv *rtlpriv = rtl_priv(hw); 413 struct rtl_priv *rtlpriv = rtl_priv(hw);
416 u8 sec_reg_value = 0x0; 414 u8 sec_reg_value = 0x0;
417 415
418 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("PairwiseEncAlgorithm = %d " 416 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
419 "GroupEncAlgorithm = %d\n", 417 "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
420 rtlpriv->sec.pairwise_enc_algorithm, 418 rtlpriv->sec.pairwise_enc_algorithm,
421 rtlpriv->sec.group_enc_algorithm)); 419 rtlpriv->sec.group_enc_algorithm);
422 420
423 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { 421 if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
424 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 422 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
425 ("not open hw encryption\n")); 423 "not open hw encryption\n");
426 return; 424 return;
427 } 425 }
428 426
@@ -433,8 +431,8 @@ void rtl92se_enable_hw_security_config(struct ieee80211_hw *hw)
433 sec_reg_value |= SCR_RXUSEDK; 431 sec_reg_value |= SCR_RXUSEDK;
434 } 432 }
435 433
436 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, ("The SECR-value %x\n", 434 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "The SECR-value %x\n",
437 sec_reg_value)); 435 sec_reg_value);
438 436
439 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); 437 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value);
440 438
@@ -718,8 +716,8 @@ static void _rtl92se_macconfig_before_fwdownload(struct ieee80211_hw *hw)
718 716
719 if (pollingcnt <= 0) { 717 if (pollingcnt <= 0) {
720 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 718 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
721 ("Polling TXDMA_INIT_VALUE " 719 "Polling TXDMA_INIT_VALUE timeout!! Current TCR(%#x)\n",
722 "timeout!! Current TCR(%#x)\n", tmpu1b)); 720 tmpu1b);
723 tmpu1b = rtl_read_byte(rtlpriv, CMDR); 721 tmpu1b = rtl_read_byte(rtlpriv, CMDR);
724 rtl_write_byte(rtlpriv, CMDR, tmpu1b & (~TXDMA_EN)); 722 rtl_write_byte(rtlpriv, CMDR, tmpu1b & (~TXDMA_EN));
725 udelay(2); 723 udelay(2);
@@ -870,10 +868,10 @@ static void _rtl92se_macconfig_after_fwdownload(struct ieee80211_hw *hw)
870 868
871 /* Change Program timing */ 869 /* Change Program timing */
872 rtl_write_byte(rtlpriv, REG_EFUSE_CTRL + 3, 0x72); 870 rtl_write_byte(rtlpriv, REG_EFUSE_CTRL + 3, 0x72);
873 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("EFUSE CONFIG OK\n")); 871 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "EFUSE CONFIG OK\n");
874 } 872 }
875 873
876 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("OK\n")); 874 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "OK\n");
877 875
878} 876}
879 877
@@ -951,12 +949,9 @@ int rtl92se_hw_init(struct ieee80211_hw *hw)
951 rtstatus = rtl92s_download_fw(hw); 949 rtstatus = rtl92s_download_fw(hw);
952 if (!rtstatus) { 950 if (!rtstatus) {
953 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 951 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
954 ("Failed to download FW. " 952 "Failed to download FW. Init HW without FW now... "
955 "Init HW without FW now.., Please copy FW into" 953 "Please copy FW into /lib/firmware/rtlwifi\n");
956 "/lib/firmware/rtlwifi\n")); 954 return 1;
957 rtlhal->fw_ready = false;
958 } else {
959 rtlhal->fw_ready = true;
960 } 955 }
961 956
962 /* After FW download, we have to reset MAC register */ 957 /* After FW download, we have to reset MAC register */
@@ -968,7 +963,7 @@ int rtl92se_hw_init(struct ieee80211_hw *hw)
968 963
969 /* 3. Initialize MAC/PHY Config by MACPHY_reg.txt */ 964 /* 3. Initialize MAC/PHY Config by MACPHY_reg.txt */
970 if (rtl92s_phy_mac_config(hw) != true) { 965 if (rtl92s_phy_mac_config(hw) != true) {
971 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("MAC Config failed\n")); 966 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "MAC Config failed\n");
972 return rtstatus; 967 return rtstatus;
973 } 968 }
974 969
@@ -978,7 +973,7 @@ int rtl92se_hw_init(struct ieee80211_hw *hw)
978 973
979 /* 4. Initialize BB After MAC Config PHY_reg.txt, AGC_Tab.txt */ 974 /* 4. Initialize BB After MAC Config PHY_reg.txt, AGC_Tab.txt */
980 if (rtl92s_phy_bb_config(hw) != true) { 975 if (rtl92s_phy_bb_config(hw) != true) {
981 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, ("BB Config failed\n")); 976 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "BB Config failed\n");
982 return rtstatus; 977 return rtstatus;
983 } 978 }
984 979
@@ -1014,7 +1009,7 @@ int rtl92se_hw_init(struct ieee80211_hw *hw)
1014 rtl_write_byte(rtlpriv, RF_CTRL, 0x07); 1009 rtl_write_byte(rtlpriv, RF_CTRL, 0x07);
1015 1010
1016 if (rtl92s_phy_rf_config(hw) != true) { 1011 if (rtl92s_phy_rf_config(hw) != true) {
1017 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("RF Config failed\n")); 1012 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "RF Config failed\n");
1018 return rtstatus; 1013 return rtstatus;
1019 } 1014 }
1020 1015
@@ -1129,26 +1124,26 @@ static int _rtl92se_set_media_status(struct ieee80211_hw *hw,
1129 case NL80211_IFTYPE_UNSPECIFIED: 1124 case NL80211_IFTYPE_UNSPECIFIED:
1130 bt_msr |= (MSR_LINK_NONE << MSR_LINK_SHIFT); 1125 bt_msr |= (MSR_LINK_NONE << MSR_LINK_SHIFT);
1131 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1126 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1132 ("Set Network type to NO LINK!\n")); 1127 "Set Network type to NO LINK!\n");
1133 break; 1128 break;
1134 case NL80211_IFTYPE_ADHOC: 1129 case NL80211_IFTYPE_ADHOC:
1135 bt_msr |= (MSR_LINK_ADHOC << MSR_LINK_SHIFT); 1130 bt_msr |= (MSR_LINK_ADHOC << MSR_LINK_SHIFT);
1136 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1131 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1137 ("Set Network type to Ad Hoc!\n")); 1132 "Set Network type to Ad Hoc!\n");
1138 break; 1133 break;
1139 case NL80211_IFTYPE_STATION: 1134 case NL80211_IFTYPE_STATION:
1140 bt_msr |= (MSR_LINK_MANAGED << MSR_LINK_SHIFT); 1135 bt_msr |= (MSR_LINK_MANAGED << MSR_LINK_SHIFT);
1141 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1136 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1142 ("Set Network type to STA!\n")); 1137 "Set Network type to STA!\n");
1143 break; 1138 break;
1144 case NL80211_IFTYPE_AP: 1139 case NL80211_IFTYPE_AP:
1145 bt_msr |= (MSR_LINK_MASTER << MSR_LINK_SHIFT); 1140 bt_msr |= (MSR_LINK_MASTER << MSR_LINK_SHIFT);
1146 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1141 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1147 ("Set Network type to AP!\n")); 1142 "Set Network type to AP!\n");
1148 break; 1143 break;
1149 default: 1144 default:
1150 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1145 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1151 ("Network type %d not support!\n", type)); 1146 "Network type %d not supported!\n", type);
1152 return 1; 1147 return 1;
1153 break; 1148 break;
1154 1149
@@ -1202,7 +1197,7 @@ void rtl92se_set_qos(struct ieee80211_hw *hw, int aci)
1202 rtl_write_dword(rtlpriv, EDCAPARA_VO, 0x2f3222); 1197 rtl_write_dword(rtlpriv, EDCAPARA_VO, 0x2f3222);
1203 break; 1198 break;
1204 default: 1199 default:
1205 RT_ASSERT(false, ("invalid aci: %d !\n", aci)); 1200 RT_ASSERT(false, "invalid aci: %d !\n", aci);
1206 break; 1201 break;
1207 } 1202 }
1208} 1203}
@@ -1219,9 +1214,14 @@ void rtl92se_enable_interrupt(struct ieee80211_hw *hw)
1219 1214
1220void rtl92se_disable_interrupt(struct ieee80211_hw *hw) 1215void rtl92se_disable_interrupt(struct ieee80211_hw *hw)
1221{ 1216{
1222 struct rtl_priv *rtlpriv = rtl_priv(hw); 1217 struct rtl_priv *rtlpriv;
1223 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1218 struct rtl_pci *rtlpci;
1224 1219
1220 rtlpriv = rtl_priv(hw);
1221 /* if firmware not available, no interrupts */
1222 if (!rtlpriv || !rtlpriv->max_fw_size)
1223 return;
1224 rtlpci = rtl_pcidev(rtl_pcipriv(hw));
1225 rtl_write_dword(rtlpriv, INTA_MASK, 0); 1225 rtl_write_dword(rtlpriv, INTA_MASK, 0);
1226 rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); 1226 rtl_write_dword(rtlpriv, INTA_MASK + 4, 0);
1227 1227
@@ -1583,8 +1583,8 @@ void rtl92se_update_interrupt_mask(struct ieee80211_hw *hw,
1583 struct rtl_priv *rtlpriv = rtl_priv(hw); 1583 struct rtl_priv *rtlpriv = rtl_priv(hw);
1584 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1584 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
1585 1585
1586 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, 1586 RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, "add_msr:%x, rm_msr:%x\n",
1587 ("add_msr:%x, rm_msr:%x\n", add_msr, rm_msr)); 1587 add_msr, rm_msr);
1588 1588
1589 if (add_msr) 1589 if (add_msr)
1590 rtlpci->irq_mask[0] |= add_msr; 1590 rtlpci->irq_mask[0] |= add_msr;
@@ -1627,7 +1627,7 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1627 1627
1628 if (rtlefuse->epromtype == EEPROM_93C46) { 1628 if (rtlefuse->epromtype == EEPROM_93C46) {
1629 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1629 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1630 ("RTL819X Not boot from eeprom, check it !!")); 1630 "RTL819X Not boot from eeprom, check it !!\n");
1631 } else if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { 1631 } else if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) {
1632 rtl_efuse_shadow_map_update(hw); 1632 rtl_efuse_shadow_map_update(hw);
1633 1633
@@ -1636,16 +1636,16 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1636 HWSET_MAX_SIZE_92S); 1636 HWSET_MAX_SIZE_92S);
1637 } 1637 }
1638 1638
1639 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP\n"), 1639 RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP",
1640 hwinfo, HWSET_MAX_SIZE_92S); 1640 hwinfo, HWSET_MAX_SIZE_92S);
1641 1641
1642 eeprom_id = *((u16 *)&hwinfo[0]); 1642 eeprom_id = *((u16 *)&hwinfo[0]);
1643 if (eeprom_id != RTL8190_EEPROM_ID) { 1643 if (eeprom_id != RTL8190_EEPROM_ID) {
1644 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 1644 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
1645 ("EEPROM ID(%#x) is invalid!!\n", eeprom_id)); 1645 "EEPROM ID(%#x) is invalid!!\n", eeprom_id);
1646 rtlefuse->autoload_failflag = true; 1646 rtlefuse->autoload_failflag = true;
1647 } else { 1647 } else {
1648 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); 1648 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
1649 rtlefuse->autoload_failflag = false; 1649 rtlefuse->autoload_failflag = false;
1650 } 1650 }
1651 1651
@@ -1663,15 +1663,15 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1663 rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; 1663 rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION];
1664 1664
1665 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1665 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1666 ("EEPROMId = 0x%4x\n", eeprom_id)); 1666 "EEPROMId = 0x%4x\n", eeprom_id);
1667 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1667 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1668 ("EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid)); 1668 "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid);
1669 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1669 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1670 ("EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did)); 1670 "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did);
1671 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1671 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1672 ("EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid)); 1672 "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid);
1673 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1673 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1674 ("EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid)); 1674 "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid);
1675 1675
1676 for (i = 0; i < 6; i += 2) { 1676 for (i = 0; i < 6; i += 2) {
1677 usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; 1677 usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i];
@@ -1681,8 +1681,7 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1681 for (i = 0; i < 6; i++) 1681 for (i = 0; i < 6; i++)
1682 rtl_write_byte(rtlpriv, MACIDR0 + i, rtlefuse->dev_addr[i]); 1682 rtl_write_byte(rtlpriv, MACIDR0 + i, rtlefuse->dev_addr[i]);
1683 1683
1684 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 1684 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr);
1685 ("%pM\n", rtlefuse->dev_addr));
1686 1685
1687 /* Get Tx Power Level by Channel */ 1686 /* Get Tx Power Level by Channel */
1688 /* Read Tx power of Channel 1 ~ 14 from EEPROM. */ 1687 /* Read Tx power of Channel 1 ~ 14 from EEPROM. */
@@ -1707,23 +1706,24 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1707 for (rf_path = 0; rf_path < 2; rf_path++) 1706 for (rf_path = 0; rf_path < 2; rf_path++)
1708 for (i = 0; i < 3; i++) 1707 for (i = 0; i < 3; i++)
1709 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 1708 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
1710 ("RF(%d) EEPROM CCK Area(%d) = 0x%x\n", rf_path, 1709 "RF(%d) EEPROM CCK Area(%d) = 0x%x\n",
1711 i, rtlefuse->eeprom_chnlarea_txpwr_cck 1710 rf_path, i,
1712 [rf_path][i])); 1711 rtlefuse->eeprom_chnlarea_txpwr_cck
1712 [rf_path][i]);
1713 for (rf_path = 0; rf_path < 2; rf_path++) 1713 for (rf_path = 0; rf_path < 2; rf_path++)
1714 for (i = 0; i < 3; i++) 1714 for (i = 0; i < 3; i++)
1715 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 1715 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
1716 ("RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n", 1716 "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n",
1717 rf_path, i, 1717 rf_path, i,
1718 rtlefuse->eeprom_chnlarea_txpwr_ht40_1s 1718 rtlefuse->eeprom_chnlarea_txpwr_ht40_1s
1719 [rf_path][i])); 1719 [rf_path][i]);
1720 for (rf_path = 0; rf_path < 2; rf_path++) 1720 for (rf_path = 0; rf_path < 2; rf_path++)
1721 for (i = 0; i < 3; i++) 1721 for (i = 0; i < 3; i++)
1722 RTPRINT(rtlpriv, FINIT, INIT_EEPROM, 1722 RTPRINT(rtlpriv, FINIT, INIT_EEPROM,
1723 ("RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n", 1723 "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n",
1724 rf_path, i, 1724 rf_path, i,
1725 rtlefuse->eeprom_chnlarea_txpwr_ht40_2sdiif 1725 rtlefuse->eeprom_chnlarea_txpwr_ht40_2sdiif
1726 [rf_path][i])); 1726 [rf_path][i]);
1727 1727
1728 for (rf_path = 0; rf_path < 2; rf_path++) { 1728 for (rf_path = 0; rf_path < 2; rf_path++) {
1729 1729
@@ -1754,11 +1754,11 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1754 1754
1755 for (i = 0; i < 14; i++) { 1755 for (i = 0; i < 14; i++) {
1756 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1756 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1757 ("RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = " 1757 "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n",
1758 "[0x%x / 0x%x / 0x%x]\n", rf_path, i, 1758 rf_path, i,
1759 rtlefuse->txpwrlevel_cck[rf_path][i], 1759 rtlefuse->txpwrlevel_cck[rf_path][i],
1760 rtlefuse->txpwrlevel_ht40_1s[rf_path][i], 1760 rtlefuse->txpwrlevel_ht40_1s[rf_path][i],
1761 rtlefuse->txpwrlevel_ht40_2s[rf_path][i])); 1761 rtlefuse->txpwrlevel_ht40_2s[rf_path][i]);
1762 } 1762 }
1763 } 1763 }
1764 1764
@@ -1791,13 +1791,13 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1791 0xf0) >> 4); 1791 0xf0) >> 4);
1792 1792
1793 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1793 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1794 ("RF-%d pwrgroup_ht20[%d] = 0x%x\n", 1794 "RF-%d pwrgroup_ht20[%d] = 0x%x\n",
1795 rf_path, i, 1795 rf_path, i,
1796 rtlefuse->pwrgroup_ht20[rf_path][i])); 1796 rtlefuse->pwrgroup_ht20[rf_path][i]);
1797 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1797 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1798 ("RF-%d pwrgroup_ht40[%d] = 0x%x\n", 1798 "RF-%d pwrgroup_ht40[%d] = 0x%x\n",
1799 rf_path, i, 1799 rf_path, i,
1800 rtlefuse->pwrgroup_ht40[rf_path][i])); 1800 rtlefuse->pwrgroup_ht40[rf_path][i]);
1801 } 1801 }
1802 } 1802 }
1803 1803
@@ -1852,27 +1852,27 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1852 (hwinfo[EEPROM_REGULATORY] & 0x1); 1852 (hwinfo[EEPROM_REGULATORY] & 0x1);
1853 } 1853 }
1854 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1854 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1855 ("eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory)); 1855 "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory);
1856 1856
1857 for (i = 0; i < 14; i++) 1857 for (i = 0; i < 14; i++)
1858 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1858 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1859 ("RF-A Ht20 to HT40 Diff[%d] = 0x%x\n", i, 1859 "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n",
1860 rtlefuse->txpwr_ht20diff[RF90_PATH_A][i])); 1860 i, rtlefuse->txpwr_ht20diff[RF90_PATH_A][i]);
1861 for (i = 0; i < 14; i++) 1861 for (i = 0; i < 14; i++)
1862 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1862 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1863 ("RF-A Legacy to Ht40 Diff[%d] = 0x%x\n", i, 1863 "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n",
1864 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i])); 1864 i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i]);
1865 for (i = 0; i < 14; i++) 1865 for (i = 0; i < 14; i++)
1866 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1866 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1867 ("RF-B Ht20 to HT40 Diff[%d] = 0x%x\n", i, 1867 "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n",
1868 rtlefuse->txpwr_ht20diff[RF90_PATH_B][i])); 1868 i, rtlefuse->txpwr_ht20diff[RF90_PATH_B][i]);
1869 for (i = 0; i < 14; i++) 1869 for (i = 0; i < 14; i++)
1870 RTPRINT(rtlpriv, FINIT, INIT_TxPower, 1870 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1871 ("RF-B Legacy to HT40 Diff[%d] = 0x%x\n", i, 1871 "RF-B Legacy to HT40 Diff[%d] = 0x%x\n",
1872 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i])); 1872 i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i]);
1873 1873
1874 RTPRINT(rtlpriv, FINIT, INIT_TxPower, ("TxPwrSafetyFlag = %d\n", 1874 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1875 rtlefuse->txpwr_safetyflag)); 1875 "TxPwrSafetyFlag = %d\n", rtlefuse->txpwr_safetyflag);
1876 1876
1877 /* Read RF-indication and Tx Power gain 1877 /* Read RF-indication and Tx Power gain
1878 * index diff of legacy to HT OFDM rate. */ 1878 * index diff of legacy to HT OFDM rate. */
@@ -1881,8 +1881,8 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1881 rtlefuse->legacy_httxpowerdiff = 1881 rtlefuse->legacy_httxpowerdiff =
1882 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][0]; 1882 rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][0];
1883 1883
1884 RTPRINT(rtlpriv, FINIT, INIT_TxPower, ("TxPowerDiff = %#x\n", 1884 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1885 rtlefuse->eeprom_txpowerdiff)); 1885 "TxPowerDiff = %#x\n", rtlefuse->eeprom_txpowerdiff);
1886 1886
1887 /* Get TSSI value for each path. */ 1887 /* Get TSSI value for each path. */
1888 usvalue = *(u16 *)&hwinfo[EEPROM_TSSI_A]; 1888 usvalue = *(u16 *)&hwinfo[EEPROM_TSSI_A];
@@ -1890,16 +1890,16 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1890 usvalue = *(u8 *)&hwinfo[EEPROM_TSSI_B]; 1890 usvalue = *(u8 *)&hwinfo[EEPROM_TSSI_B];
1891 rtlefuse->eeprom_tssi[RF90_PATH_B] = (u8)(usvalue & 0xff); 1891 rtlefuse->eeprom_tssi[RF90_PATH_B] = (u8)(usvalue & 0xff);
1892 1892
1893 RTPRINT(rtlpriv, FINIT, INIT_TxPower, ("TSSI_A = 0x%x, TSSI_B = 0x%x\n", 1893 RTPRINT(rtlpriv, FINIT, INIT_TxPower, "TSSI_A = 0x%x, TSSI_B = 0x%x\n",
1894 rtlefuse->eeprom_tssi[RF90_PATH_A], 1894 rtlefuse->eeprom_tssi[RF90_PATH_A],
1895 rtlefuse->eeprom_tssi[RF90_PATH_B])); 1895 rtlefuse->eeprom_tssi[RF90_PATH_B]);
1896 1896
1897 /* Read antenna tx power offset of B/C/D to A from EEPROM */ 1897 /* Read antenna tx power offset of B/C/D to A from EEPROM */
1898 /* and read ThermalMeter from EEPROM */ 1898 /* and read ThermalMeter from EEPROM */
1899 tempval = *(u8 *)&hwinfo[EEPROM_THERMALMETER]; 1899 tempval = *(u8 *)&hwinfo[EEPROM_THERMALMETER];
1900 rtlefuse->eeprom_thermalmeter = tempval; 1900 rtlefuse->eeprom_thermalmeter = tempval;
1901 RTPRINT(rtlpriv, FINIT, INIT_TxPower, ("thermalmeter = 0x%x\n", 1901 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1902 rtlefuse->eeprom_thermalmeter)); 1902 "thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter);
1903 1903
1904 /* ThermalMeter, BIT(0)~3 for RFIC1, BIT(4)~7 for RFIC2 */ 1904 /* ThermalMeter, BIT(0)~3 for RFIC1, BIT(4)~7 for RFIC2 */
1905 rtlefuse->thermalmeter[0] = (rtlefuse->eeprom_thermalmeter & 0x1f); 1905 rtlefuse->thermalmeter[0] = (rtlefuse->eeprom_thermalmeter & 0x1f);
@@ -1915,8 +1915,8 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1915 /* Version ID, Channel plan */ 1915 /* Version ID, Channel plan */
1916 rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN]; 1916 rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN];
1917 rtlefuse->txpwr_fromeprom = true; 1917 rtlefuse->txpwr_fromeprom = true;
1918 RTPRINT(rtlpriv, FINIT, INIT_TxPower, ("EEPROM ChannelPlan = 0x%4x\n", 1918 RTPRINT(rtlpriv, FINIT, INIT_TxPower,
1919 rtlefuse->eeprom_channelplan)); 1919 "EEPROM ChannelPlan = 0x%4x\n", rtlefuse->eeprom_channelplan);
1920 1920
1921 /* Read Customer ID or Board Type!!! */ 1921 /* Read Customer ID or Board Type!!! */
1922 tempval = *(u8 *)&hwinfo[EEPROM_BOARDTYPE]; 1922 tempval = *(u8 *)&hwinfo[EEPROM_BOARDTYPE];
@@ -1937,14 +1937,14 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1937 if (!(tempval & BIT(0))) { 1937 if (!(tempval & BIT(0))) {
1938 rtlefuse->b1x1_recvcombine = true; 1938 rtlefuse->b1x1_recvcombine = true;
1939 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1939 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1940 ("RF_TYPE=1T2R but only 1SS\n")); 1940 "RF_TYPE=1T2R but only 1SS\n");
1941 } 1941 }
1942 } 1942 }
1943 rtlefuse->b1ss_support = rtlefuse->b1x1_recvcombine; 1943 rtlefuse->b1ss_support = rtlefuse->b1x1_recvcombine;
1944 rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMID]; 1944 rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMID];
1945 1945
1946 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("EEPROM Customer ID: 0x%2x", 1946 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x",
1947 rtlefuse->eeprom_oemid)); 1947 rtlefuse->eeprom_oemid);
1948 1948
1949 /* set channel paln to world wide 13 */ 1949 /* set channel paln to world wide 13 */
1950 rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; 1950 rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13;
@@ -1959,19 +1959,19 @@ void rtl92se_read_eeprom_info(struct ieee80211_hw *hw)
1959 tmp_u1b = rtl_read_byte(rtlpriv, EPROM_CMD); 1959 tmp_u1b = rtl_read_byte(rtlpriv, EPROM_CMD);
1960 1960
1961 if (tmp_u1b & BIT(4)) { 1961 if (tmp_u1b & BIT(4)) {
1962 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from EEPROM\n")); 1962 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EEPROM\n");
1963 rtlefuse->epromtype = EEPROM_93C46; 1963 rtlefuse->epromtype = EEPROM_93C46;
1964 } else { 1964 } else {
1965 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("Boot from EFUSE\n")); 1965 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EFUSE\n");
1966 rtlefuse->epromtype = EEPROM_BOOT_EFUSE; 1966 rtlefuse->epromtype = EEPROM_BOOT_EFUSE;
1967 } 1967 }
1968 1968
1969 if (tmp_u1b & BIT(5)) { 1969 if (tmp_u1b & BIT(5)) {
1970 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Autoload OK\n")); 1970 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n");
1971 rtlefuse->autoload_failflag = false; 1971 rtlefuse->autoload_failflag = false;
1972 _rtl92se_read_adapter_info(hw); 1972 _rtl92se_read_adapter_info(hw);
1973 } else { 1973 } else {
1974 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Autoload ERR!!\n")); 1974 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Autoload ERR!!\n");
1975 rtlefuse->autoload_failflag = true; 1975 rtlefuse->autoload_failflag = true;
1976 } 1976 }
1977} 1977}
@@ -2071,8 +2071,8 @@ static void rtl92se_update_hal_rate_table(struct ieee80211_hw *hw,
2071 else 2071 else
2072 rtl92s_phy_set_fw_cmd(hw, FW_CMD_RA_REFRESH_BG); 2072 rtl92s_phy_set_fw_cmd(hw, FW_CMD_RA_REFRESH_BG);
2073 2073
2074 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, 2074 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n",
2075 ("%x\n", rtl_read_dword(rtlpriv, ARFR0))); 2075 rtl_read_dword(rtlpriv, ARFR0));
2076} 2076}
2077 2077
2078static void rtl92se_update_hal_rate_mask(struct ieee80211_hw *hw, 2078static void rtl92se_update_hal_rate_mask(struct ieee80211_hw *hw,
@@ -2224,8 +2224,8 @@ static void rtl92se_update_hal_rate_mask(struct ieee80211_hw *hw,
2224 2224
2225 mask |= (bmulticast ? 1 : 0) << 9 | (macid & 0x1f) << 4 | (band & 0xf); 2225 mask |= (bmulticast ? 1 : 0) << 9 | (macid & 0x1f) << 4 | (band & 0xf);
2226 2226
2227 RT_TRACE(rtlpriv, COMP_RATR, DBG_TRACE, ("mask = %x, bitmap = %x\n", 2227 RT_TRACE(rtlpriv, COMP_RATR, DBG_TRACE, "mask = %x, bitmap = %x\n",
2228 mask, ratr_bitmap)); 2228 mask, ratr_bitmap);
2229 rtl_write_dword(rtlpriv, 0x2c4, ratr_bitmap); 2229 rtl_write_dword(rtlpriv, 0x2c4, ratr_bitmap);
2230 rtl_write_dword(rtlpriv, WFM5, (FW_RA_UPDATE_MASK | (mask << 8))); 2230 rtl_write_dword(rtlpriv, WFM5, (FW_RA_UPDATE_MASK | (mask << 8)));
2231 2231
@@ -2301,14 +2301,14 @@ bool rtl92se_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
2301 2301
2302 if ((ppsc->hwradiooff) && (rfpwr_toset == ERFON)) { 2302 if ((ppsc->hwradiooff) && (rfpwr_toset == ERFON)) {
2303 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 2303 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
2304 ("RFKILL-HW Radio ON, RF ON\n")); 2304 "RFKILL-HW Radio ON, RF ON\n");
2305 2305
2306 rfpwr_toset = ERFON; 2306 rfpwr_toset = ERFON;
2307 ppsc->hwradiooff = false; 2307 ppsc->hwradiooff = false;
2308 actuallyset = true; 2308 actuallyset = true;
2309 } else if ((ppsc->hwradiooff == false) && (rfpwr_toset == ERFOFF)) { 2309 } else if ((ppsc->hwradiooff == false) && (rfpwr_toset == ERFOFF)) {
2310 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 2310 RT_TRACE(rtlpriv, COMP_RF,
2311 ("RFKILL-HW Radio OFF, RF OFF\n")); 2311 DBG_DMESG, "RFKILL-HW Radio OFF, RF OFF\n");
2312 2312
2313 rfpwr_toset = ERFOFF; 2313 rfpwr_toset = ERFOFF;
2314 ppsc->hwradiooff = true; 2314 ppsc->hwradiooff = true;
@@ -2372,7 +2372,7 @@ void rtl92se_set_key(struct ieee80211_hw *hw, u32 key_index, u8 *p_macaddr,
2372 u8 cam_offset = 0; 2372 u8 cam_offset = 0;
2373 u8 clear_number = 5; 2373 u8 clear_number = 5;
2374 2374
2375 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, ("clear_all\n")); 2375 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n");
2376 2376
2377 for (idx = 0; idx < clear_number; idx++) { 2377 for (idx = 0; idx < clear_number; idx++) {
2378 rtl_cam_mark_invalid(hw, cam_offset + idx); 2378 rtl_cam_mark_invalid(hw, cam_offset + idx);
@@ -2401,7 +2401,7 @@ void rtl92se_set_key(struct ieee80211_hw *hw, u32 key_index, u8 *p_macaddr,
2401 break; 2401 break;
2402 default: 2402 default:
2403 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 2403 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
2404 ("switch case not process\n")); 2404 "switch case not processed\n");
2405 enc_algo = CAM_TKIP; 2405 enc_algo = CAM_TKIP;
2406 break; 2406 break;
2407 } 2407 }
@@ -2419,9 +2419,8 @@ void rtl92se_set_key(struct ieee80211_hw *hw, u32 key_index, u8 *p_macaddr,
2419 p_macaddr); 2419 p_macaddr);
2420 if (entry_id >= TOTAL_CAM_ENTRY) { 2420 if (entry_id >= TOTAL_CAM_ENTRY) {
2421 RT_TRACE(rtlpriv, 2421 RT_TRACE(rtlpriv,
2422 COMP_SEC, DBG_EMERG, 2422 COMP_SEC, DBG_EMERG,
2423 ("Can not find free hw" 2423 "Can not find free hw security cam entry\n");
2424 " security cam entry\n"));
2425 return; 2424 return;
2426 } 2425 }
2427 } else { 2426 } else {
@@ -2435,30 +2434,31 @@ void rtl92se_set_key(struct ieee80211_hw *hw, u32 key_index, u8 *p_macaddr,
2435 2434
2436 if (rtlpriv->sec.key_len[key_index] == 0) { 2435 if (rtlpriv->sec.key_len[key_index] == 0) {
2437 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2436 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2438 ("delete one entry, entry_id is %d\n", 2437 "delete one entry, entry_id is %d\n",
2439 entry_id)); 2438 entry_id);
2440 if (mac->opmode == NL80211_IFTYPE_AP) 2439 if (mac->opmode == NL80211_IFTYPE_AP)
2441 rtl_cam_del_entry(hw, p_macaddr); 2440 rtl_cam_del_entry(hw, p_macaddr);
2442 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); 2441 rtl_cam_delete_one_entry(hw, p_macaddr, entry_id);
2443 } else { 2442 } else {
2444 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 2443 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
2445 ("The insert KEY length is %d\n", 2444 "The insert KEY length is %d\n",
2446 rtlpriv->sec.key_len[PAIRWISE_KEYIDX])); 2445 rtlpriv->sec.key_len[PAIRWISE_KEYIDX]);
2447 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, 2446 RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
2448 ("The insert KEY is %x %x\n", 2447 "The insert KEY is %x %x\n",
2449 rtlpriv->sec.key_buf[0][0], 2448 rtlpriv->sec.key_buf[0][0],
2450 rtlpriv->sec.key_buf[0][1])); 2449 rtlpriv->sec.key_buf[0][1]);
2451 2450
2452 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2451 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2453 ("add one entry\n")); 2452 "add one entry\n");
2454 if (is_pairwise) { 2453 if (is_pairwise) {
2455 RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD, 2454 RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD,
2456 "Pairwiase Key content :", 2455 "Pairwise Key content",
2457 rtlpriv->sec.pairwise_key, 2456 rtlpriv->sec.pairwise_key,
2458 rtlpriv->sec.key_len[PAIRWISE_KEYIDX]); 2457 rtlpriv->sec.
2458 key_len[PAIRWISE_KEYIDX]);
2459 2459
2460 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2460 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2461 ("set Pairwiase key\n")); 2461 "set Pairwise key\n");
2462 2462
2463 rtl_cam_add_one_entry(hw, macaddr, key_index, 2463 rtl_cam_add_one_entry(hw, macaddr, key_index,
2464 entry_id, enc_algo, 2464 entry_id, enc_algo,
@@ -2466,7 +2466,7 @@ void rtl92se_set_key(struct ieee80211_hw *hw, u32 key_index, u8 *p_macaddr,
2466 rtlpriv->sec.key_buf[key_index]); 2466 rtlpriv->sec.key_buf[key_index]);
2467 } else { 2467 } else {
2468 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, 2468 RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
2469 ("set group key\n")); 2469 "set group key\n");
2470 2470
2471 if (mac->opmode == NL80211_IFTYPE_ADHOC) { 2471 if (mac->opmode == NL80211_IFTYPE_ADHOC) {
2472 rtl_cam_add_one_entry(hw, 2472 rtl_cam_add_one_entry(hw,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.h b/drivers/net/wireless/rtlwifi/rtl8192se/hw.h
index 6160a9bfe98a..1886c2644a26 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/led.c b/drivers/net/wireless/rtlwifi/rtl8192se/led.c
index e3fe7c90ebf4..44949b5cbb87 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/led.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/led.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -52,8 +52,8 @@ void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
52 u8 ledcfg; 52 u8 ledcfg;
53 struct rtl_priv *rtlpriv = rtl_priv(hw); 53 struct rtl_priv *rtlpriv = rtl_priv(hw);
54 54
55 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, 55 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
56 ("LedAddr:%X ledpin=%d\n", LEDCFG, pled->ledpin)); 56 LEDCFG, pled->ledpin);
57 57
58 ledcfg = rtl_read_byte(rtlpriv, LEDCFG); 58 ledcfg = rtl_read_byte(rtlpriv, LEDCFG);
59 59
@@ -68,7 +68,7 @@ void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
68 break; 68 break;
69 default: 69 default:
70 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 70 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
71 ("switch case not process\n")); 71 "switch case not processed\n");
72 break; 72 break;
73 } 73 }
74 pled->ledon = true; 74 pled->ledon = true;
@@ -76,12 +76,15 @@ void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
76 76
77void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) 77void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
78{ 78{
79 struct rtl_priv *rtlpriv = rtl_priv(hw); 79 struct rtl_priv *rtlpriv;
80 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); 80 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
81 u8 ledcfg; 81 u8 ledcfg;
82 82
83 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, 83 rtlpriv = rtl_priv(hw);
84 ("LedAddr:%X ledpin=%d\n", LEDCFG, pled->ledpin)); 84 if (!rtlpriv || rtlpriv->max_fw_size)
85 return;
86 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n",
87 LEDCFG, pled->ledpin);
85 88
86 ledcfg = rtl_read_byte(rtlpriv, LEDCFG); 89 ledcfg = rtl_read_byte(rtlpriv, LEDCFG);
87 90
@@ -101,7 +104,7 @@ void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
101 break; 104 break;
102 default: 105 default:
103 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 106 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
104 ("switch case not process\n")); 107 "switch case not processed\n");
105 break; 108 break;
106 } 109 }
107 pled->ledon = false; 110 pled->ledon = false;
@@ -141,8 +144,7 @@ void rtl92se_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction)
141 ledaction == LED_CTL_POWER_ON)) { 144 ledaction == LED_CTL_POWER_ON)) {
142 return; 145 return;
143 } 146 }
144 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, ("ledaction %d,\n", 147 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d\n", ledaction);
145 ledaction));
146 148
147 _rtl92se_sw_led_control(hw, ledaction); 149 _rtl92se_sw_led_control(hw, ledaction);
148} 150}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/led.h b/drivers/net/wireless/rtlwifi/rtl8192se/led.h
index 8cce3870af3c..2182dbeb5f32 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/led.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/led.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
index f10ac1ad9087..05b4e2790e99 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,8 +27,6 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include "../wifi.h" 30#include "../wifi.h"
33#include "../pci.h" 31#include "../pci.h"
34#include "../ps.h" 32#include "../ps.h"
@@ -58,16 +56,15 @@ u32 rtl92s_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
58 struct rtl_priv *rtlpriv = rtl_priv(hw); 56 struct rtl_priv *rtlpriv = rtl_priv(hw);
59 u32 returnvalue = 0, originalvalue, bitshift; 57 u32 returnvalue = 0, originalvalue, bitshift;
60 58
61 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)\n", 59 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n",
62 regaddr, bitmask)); 60 regaddr, bitmask);
63 61
64 originalvalue = rtl_read_dword(rtlpriv, regaddr); 62 originalvalue = rtl_read_dword(rtlpriv, regaddr);
65 bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); 63 bitshift = _rtl92s_phy_calculate_bit_shift(bitmask);
66 returnvalue = (originalvalue & bitmask) >> bitshift; 64 returnvalue = (originalvalue & bitmask) >> bitshift;
67 65
68 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, 66 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "BBR MASK=0x%x Addr[0x%x]=0x%x\n",
69 ("BBR MASK=0x%x Addr[0x%x]=0x%x\n", 67 bitmask, regaddr, originalvalue);
70 bitmask, regaddr, originalvalue));
71 68
72 return returnvalue; 69 return returnvalue;
73 70
@@ -79,8 +76,9 @@ void rtl92s_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
79 struct rtl_priv *rtlpriv = rtl_priv(hw); 76 struct rtl_priv *rtlpriv = rtl_priv(hw);
80 u32 originalvalue, bitshift; 77 u32 originalvalue, bitshift;
81 78
82 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 79 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
83 " data(%#x)\n", regaddr, bitmask, data)); 80 "regaddr(%#x), bitmask(%#x), data(%#x)\n",
81 regaddr, bitmask, data);
84 82
85 if (bitmask != MASKDWORD) { 83 if (bitmask != MASKDWORD) {
86 originalvalue = rtl_read_dword(rtlpriv, regaddr); 84 originalvalue = rtl_read_dword(rtlpriv, regaddr);
@@ -90,8 +88,9 @@ void rtl92s_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
90 88
91 rtl_write_dword(rtlpriv, regaddr, data); 89 rtl_write_dword(rtlpriv, regaddr, data);
92 90
93 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 91 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
94 " data(%#x)\n", regaddr, bitmask, data)); 92 "regaddr(%#x), bitmask(%#x), data(%#x)\n",
93 regaddr, bitmask, data);
95 94
96} 95}
97 96
@@ -149,8 +148,8 @@ static u32 _rtl92s_phy_rf_serial_read(struct ieee80211_hw *hw,
149 retvalue = rtl_get_bbreg(hw, pphyreg->rflssi_readback, 148 retvalue = rtl_get_bbreg(hw, pphyreg->rflssi_readback,
150 BLSSI_READBACK_DATA); 149 BLSSI_READBACK_DATA);
151 150
152 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("RFR-%d Addr[0x%x]=0x%x\n", 151 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]=0x%x\n",
153 rfpath, pphyreg->rflssi_readback, retvalue)); 152 rfpath, pphyreg->rflssi_readback, retvalue);
154 153
155 return retvalue; 154 return retvalue;
156 155
@@ -172,8 +171,8 @@ static void _rtl92s_phy_rf_serial_write(struct ieee80211_hw *hw,
172 data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff; 171 data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff;
173 rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr); 172 rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr);
174 173
175 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("RFW-%d Addr[0x%x]=0x%x\n", 174 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]=0x%x\n",
176 rfpath, pphyreg->rf3wire_offset, data_and_addr)); 175 rfpath, pphyreg->rf3wire_offset, data_and_addr);
177} 176}
178 177
179 178
@@ -183,8 +182,9 @@ u32 rtl92s_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
183 struct rtl_priv *rtlpriv = rtl_priv(hw); 182 struct rtl_priv *rtlpriv = rtl_priv(hw);
184 u32 original_value, readback_value, bitshift; 183 u32 original_value, readback_value, bitshift;
185 184
186 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), rfpath(%#x), " 185 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
187 "bitmask(%#x)\n", regaddr, rfpath, bitmask)); 186 "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
187 regaddr, rfpath, bitmask);
188 188
189 spin_lock(&rtlpriv->locks.rf_lock); 189 spin_lock(&rtlpriv->locks.rf_lock);
190 190
@@ -195,9 +195,9 @@ u32 rtl92s_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
195 195
196 spin_unlock(&rtlpriv->locks.rf_lock); 196 spin_unlock(&rtlpriv->locks.rf_lock);
197 197
198 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), rfpath(%#x), " 198 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
199 "bitmask(%#x), original_value(%#x)\n", regaddr, rfpath, 199 "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
200 bitmask, original_value)); 200 regaddr, rfpath, bitmask, original_value);
201 201
202 return readback_value; 202 return readback_value;
203} 203}
@@ -212,8 +212,9 @@ void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
212 if (!((rtlphy->rf_pathmap >> rfpath) & 0x1)) 212 if (!((rtlphy->rf_pathmap >> rfpath) & 0x1))
213 return; 213 return;
214 214
215 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," 215 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
216 " data(%#x), rfpath(%#x)\n", regaddr, bitmask, data, rfpath)); 216 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
217 regaddr, bitmask, data, rfpath);
217 218
218 spin_lock(&rtlpriv->locks.rf_lock); 219 spin_lock(&rtlpriv->locks.rf_lock);
219 220
@@ -228,8 +229,9 @@ void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
228 229
229 spin_unlock(&rtlpriv->locks.rf_lock); 230 spin_unlock(&rtlpriv->locks.rf_lock);
230 231
231 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x), " 232 RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE,
232 "data(%#x), rfpath(%#x)\n", regaddr, bitmask, data, rfpath)); 233 "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
234 regaddr, bitmask, data, rfpath);
233 235
234} 236}
235 237
@@ -249,7 +251,7 @@ void rtl92s_phy_scan_operation_backup(struct ieee80211_hw *hw,
249 break; 251 break;
250 default: 252 default:
251 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 253 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
252 ("Unknown operation.\n")); 254 "Unknown operation\n");
253 break; 255 break;
254 } 256 }
255 } 257 }
@@ -264,9 +266,9 @@ void rtl92s_phy_set_bw_mode(struct ieee80211_hw *hw,
264 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 266 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
265 u8 reg_bw_opmode; 267 u8 reg_bw_opmode;
266 268
267 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("Switch to %s bandwidth\n", 269 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n",
268 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? 270 rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
269 "20MHz" : "40MHz")); 271 "20MHz" : "40MHz");
270 272
271 if (rtlphy->set_bwmode_inprogress) 273 if (rtlphy->set_bwmode_inprogress)
272 return; 274 return;
@@ -290,8 +292,7 @@ void rtl92s_phy_set_bw_mode(struct ieee80211_hw *hw,
290 break; 292 break;
291 default: 293 default:
292 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 294 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
293 ("unknown bandwidth: %#X\n", 295 "unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
294 rtlphy->current_chan_bw));
295 break; 296 break;
296 } 297 }
297 298
@@ -316,13 +317,13 @@ void rtl92s_phy_set_bw_mode(struct ieee80211_hw *hw,
316 break; 317 break;
317 default: 318 default:
318 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 319 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
319 ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw)); 320 "unknown bandwidth: %#X\n", rtlphy->current_chan_bw);
320 break; 321 break;
321 } 322 }
322 323
323 rtl92s_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); 324 rtl92s_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
324 rtlphy->set_bwmode_inprogress = false; 325 rtlphy->set_bwmode_inprogress = false;
325 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 326 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n");
326} 327}
327 328
328static bool _rtl92s_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, 329static bool _rtl92s_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
@@ -332,7 +333,7 @@ static bool _rtl92s_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
332 struct swchnlcmd *pcmd; 333 struct swchnlcmd *pcmd;
333 334
334 if (cmdtable == NULL) { 335 if (cmdtable == NULL) {
335 RT_ASSERT(false, ("cmdtable cannot be NULL.\n")); 336 RT_ASSERT(false, "cmdtable cannot be NULL\n");
336 return false; 337 return false;
337 } 338 }
338 339
@@ -377,7 +378,7 @@ static bool _rtl92s_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
377 rfdependcmdcnt = 0; 378 rfdependcmdcnt = 0;
378 379
379 RT_ASSERT((channel >= 1 && channel <= 14), 380 RT_ASSERT((channel >= 1 && channel <= 14),
380 ("illegal channel for Zebra: %d\n", channel)); 381 "invalid channel for Zebra: %d\n", channel);
381 382
382 _rtl92s_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, 383 _rtl92s_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++,
383 MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG, 384 MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG,
@@ -438,7 +439,7 @@ static bool _rtl92s_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
438 break; 439 break;
439 default: 440 default:
440 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 441 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
441 ("switch case not process\n")); 442 "switch case not processed\n");
442 break; 443 break;
443 } 444 }
444 445
@@ -458,9 +459,8 @@ u8 rtl92s_phy_sw_chnl(struct ieee80211_hw *hw)
458 u32 delay; 459 u32 delay;
459 bool ret; 460 bool ret;
460 461
461 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, 462 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "switch to channel%d\n",
462 ("switch to channel%d\n", 463 rtlphy->current_channel);
463 rtlphy->current_channel));
464 464
465 if (rtlphy->sw_chnl_inprogress) 465 if (rtlphy->sw_chnl_inprogress)
466 return 0; 466 return 0;
@@ -496,7 +496,7 @@ u8 rtl92s_phy_sw_chnl(struct ieee80211_hw *hw)
496 496
497 rtlphy->sw_chnl_inprogress = false; 497 rtlphy->sw_chnl_inprogress = false;
498 498
499 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); 499 RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n");
500 500
501 return 1; 501 return 1;
502} 502}
@@ -556,7 +556,7 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
556 do { 556 do {
557 InitializeCount++; 557 InitializeCount++;
558 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 558 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
559 ("IPS Set eRf nic enable\n")); 559 "IPS Set eRf nic enable\n");
560 rtstatus = rtl_ps_enable_nic(hw); 560 rtstatus = rtl_ps_enable_nic(hw);
561 } while ((rtstatus != true) && 561 } while ((rtstatus != true) &&
562 (InitializeCount < 10)); 562 (InitializeCount < 10));
@@ -565,11 +565,11 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
565 RT_RF_OFF_LEVL_HALT_NIC); 565 RT_RF_OFF_LEVL_HALT_NIC);
566 } else { 566 } else {
567 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 567 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
568 ("awake, sleeped:%d ms " 568 "awake, sleeped:%d ms state_inap:%x\n",
569 "state_inap:%x\n", 569 jiffies_to_msecs(jiffies -
570 jiffies_to_msecs(jiffies - 570 ppsc->
571 ppsc->last_sleep_jiffies), 571 last_sleep_jiffies),
572 rtlpriv->psc.state_inap)); 572 rtlpriv->psc.state_inap);
573 ppsc->last_awake_jiffies = jiffies; 573 ppsc->last_awake_jiffies = jiffies;
574 rtl_write_word(rtlpriv, CMDR, 0x37FC); 574 rtl_write_word(rtlpriv, CMDR, 0x37FC);
575 rtl_write_byte(rtlpriv, TXPAUSE, 0x00); 575 rtl_write_byte(rtlpriv, TXPAUSE, 0x00);
@@ -587,7 +587,7 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
587 case ERFOFF:{ 587 case ERFOFF:{
588 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { 588 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) {
589 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 589 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
590 ("IPS Set eRf nic disable\n")); 590 "IPS Set eRf nic disable\n");
591 rtl_ps_disable_nic(hw); 591 rtl_ps_disable_nic(hw);
592 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); 592 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
593 } else { 593 } else {
@@ -613,11 +613,9 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
613 continue; 613 continue;
614 } else { 614 } else {
615 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 615 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
616 ("eRf Off/Sleep: " 616 "eRf Off/Sleep: %d times TcbBusyQueue[%d] = %d before doze!\n",
617 "%d times TcbBusyQueue[%d] = " 617 i + 1, queue_id,
618 "%d before doze!\n", 618 skb_queue_len(&ring->queue));
619 (i + 1), queue_id,
620 skb_queue_len(&ring->queue)));
621 619
622 udelay(10); 620 udelay(10);
623 i++; 621 i++;
@@ -625,31 +623,30 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
625 623
626 if (i >= MAX_DOZE_WAITING_TIMES_9x) { 624 if (i >= MAX_DOZE_WAITING_TIMES_9x) {
627 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 625 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
628 ("\nERFOFF: %d times" 626 "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n",
629 "TcbBusyQueue[%d] = %d !\n",
630 MAX_DOZE_WAITING_TIMES_9x, 627 MAX_DOZE_WAITING_TIMES_9x,
631 queue_id, 628 queue_id,
632 skb_queue_len(&ring->queue))); 629 skb_queue_len(&ring->queue));
633 break; 630 break;
634 } 631 }
635 } 632 }
636 633
637 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 634 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
638 ("Set ERFSLEEP awaked:%d ms\n", 635 "Set ERFSLEEP awaked:%d ms\n",
639 jiffies_to_msecs(jiffies - 636 jiffies_to_msecs(jiffies -
640 ppsc->last_awake_jiffies))); 637 ppsc->last_awake_jiffies));
641 638
642 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 639 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
643 ("sleep awaked:%d ms " 640 "sleep awaked:%d ms state_inap:%x\n",
644 "state_inap:%x\n", jiffies_to_msecs(jiffies - 641 jiffies_to_msecs(jiffies -
645 ppsc->last_awake_jiffies), 642 ppsc->last_awake_jiffies),
646 rtlpriv->psc.state_inap)); 643 rtlpriv->psc.state_inap);
647 ppsc->last_sleep_jiffies = jiffies; 644 ppsc->last_sleep_jiffies = jiffies;
648 _rtl92se_phy_set_rf_sleep(hw); 645 _rtl92se_phy_set_rf_sleep(hw);
649 break; 646 break;
650 default: 647 default:
651 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 648 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
652 ("switch case not process\n")); 649 "switch case not processed\n");
653 bresult = false; 650 bresult = false;
654 break; 651 break;
655 } 652 }
@@ -995,7 +992,7 @@ static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw)
995 992
996 if (rtstatus != true) { 993 if (rtstatus != true) {
997 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 994 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
998 ("Write BB Reg Fail!!")); 995 "Write BB Reg Fail!!\n");
999 goto phy_BB8190_Config_ParaFile_Fail; 996 goto phy_BB8190_Config_ParaFile_Fail;
1000 } 997 }
1001 998
@@ -1009,8 +1006,7 @@ static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw)
1009 } 1006 }
1010 if (rtstatus != true) { 1007 if (rtstatus != true) {
1011 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 1008 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
1012 ("_rtl92s_phy_bb_config_parafile(): " 1009 "_rtl92s_phy_bb_config_parafile(): BB_PG Reg Fail!!\n");
1013 "BB_PG Reg Fail!!"));
1014 goto phy_BB8190_Config_ParaFile_Fail; 1010 goto phy_BB8190_Config_ParaFile_Fail;
1015 } 1011 }
1016 1012
@@ -1053,7 +1049,7 @@ u8 rtl92s_phy_config_rf(struct ieee80211_hw *hw, enum radio_path rfpath)
1053 radio_b_tblen = RADIOB_ARRAYLENGTH; 1049 radio_b_tblen = RADIOB_ARRAYLENGTH;
1054 } 1050 }
1055 1051
1056 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Radio No %x\n", rfpath)); 1052 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Radio No %x\n", rfpath);
1057 rtstatus = true; 1053 rtstatus = true;
1058 1054
1059 switch (rfpath) { 1055 switch (rfpath) {
@@ -1175,11 +1171,11 @@ bool rtl92s_phy_bb_config(struct ieee80211_hw *hw)
1175 (rtlphy->rf_type == RF_2T2R && rf_num != 2) || 1171 (rtlphy->rf_type == RF_2T2R && rf_num != 2) ||
1176 (rtlphy->rf_type == RF_2T2R_GREEN && rf_num != 2)) { 1172 (rtlphy->rf_type == RF_2T2R_GREEN && rf_num != 2)) {
1177 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 1173 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
1178 ("RF_Type(%x) does not match " 1174 "RF_Type(%x) does not match RF_Num(%x)!!\n",
1179 "RF_Num(%x)!!\n", rtlphy->rf_type, rf_num)); 1175 rtlphy->rf_type, rf_num);
1180 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, 1176 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
1181 ("path1 0x%x, path2 0x%x, pathmap " 1177 "path1 0x%x, path2 0x%x, pathmap 0x%x\n",
1182 "0x%x\n", path1, path2, pathmap)); 1178 path1, path2, pathmap);
1183 } 1179 }
1184 1180
1185 return rtstatus; 1181 return rtstatus;
@@ -1214,20 +1210,20 @@ void rtl92s_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
1214 ROFDM0_XCAGCCORE1, MASKBYTE0); 1210 ROFDM0_XCAGCCORE1, MASKBYTE0);
1215 rtlphy->default_initialgain[3] = rtl_get_bbreg(hw, 1211 rtlphy->default_initialgain[3] = rtl_get_bbreg(hw,
1216 ROFDM0_XDAGCCORE1, MASKBYTE0); 1212 ROFDM0_XDAGCCORE1, MASKBYTE0);
1217 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, ("Default initial gain " 1213 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1218 "(c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n", 1214 "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n",
1219 rtlphy->default_initialgain[0], 1215 rtlphy->default_initialgain[0],
1220 rtlphy->default_initialgain[1], 1216 rtlphy->default_initialgain[1],
1221 rtlphy->default_initialgain[2], 1217 rtlphy->default_initialgain[2],
1222 rtlphy->default_initialgain[3])); 1218 rtlphy->default_initialgain[3]);
1223 1219
1224 /* read framesync */ 1220 /* read framesync */
1225 rtlphy->framesync = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR3, MASKBYTE0); 1221 rtlphy->framesync = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR3, MASKBYTE0);
1226 rtlphy->framesync_c34 = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR2, 1222 rtlphy->framesync_c34 = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR2,
1227 MASKDWORD); 1223 MASKDWORD);
1228 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 1224 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
1229 ("Default framesync (0x%x) = 0x%x\n", 1225 "Default framesync (0x%x) = 0x%x\n",
1230 ROFDM0_RXDETECTOR3, rtlphy->framesync)); 1226 ROFDM0_RXDETECTOR3, rtlphy->framesync);
1231 1227
1232} 1228}
1233 1229
@@ -1287,10 +1283,9 @@ void rtl92s_phy_set_txpower(struct ieee80211_hw *hw, u8 channel)
1287 &ofdmpowerLevel[0]); 1283 &ofdmpowerLevel[0]);
1288 1284
1289 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1285 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1290 ("Channel-%d, cckPowerLevel (A / B) = " 1286 "Channel-%d, cckPowerLevel (A / B) = 0x%x / 0x%x, ofdmPowerLevel (A / B) = 0x%x / 0x%x\n",
1291 "0x%x / 0x%x, ofdmPowerLevel (A / B) = 0x%x / 0x%x\n", 1287 channel, cckpowerlevel[0], cckpowerlevel[1],
1292 channel, cckpowerlevel[0], cckpowerlevel[1], 1288 ofdmpowerLevel[0], ofdmpowerLevel[1]);
1293 ofdmpowerLevel[0], ofdmpowerLevel[1]));
1294 1289
1295 _rtl92s_phy_ccxpower_indexcheck(hw, channel, &cckpowerlevel[0], 1290 _rtl92s_phy_ccxpower_indexcheck(hw, channel, &cckpowerlevel[0],
1296 &ofdmpowerLevel[0]); 1291 &ofdmpowerLevel[0]);
@@ -1316,7 +1311,7 @@ void rtl92s_phy_chk_fwcmd_iodone(struct ieee80211_hw *hw)
1316 } while (--pollingcnt); 1311 } while (--pollingcnt);
1317 1312
1318 if (pollingcnt == 0) 1313 if (pollingcnt == 0)
1319 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, ("Set FW Cmd fail!!\n")); 1314 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Set FW Cmd fail!!\n");
1320} 1315}
1321 1316
1322 1317
@@ -1345,20 +1340,17 @@ static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw)
1345 1340
1346 switch (rtlhal->current_fwcmd_io) { 1341 switch (rtlhal->current_fwcmd_io) {
1347 case FW_CMD_RA_RESET: 1342 case FW_CMD_RA_RESET:
1348 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1343 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_RA_RESET\n");
1349 ("FW_CMD_RA_RESET\n"));
1350 rtl_write_dword(rtlpriv, WFM5, FW_RA_RESET); 1344 rtl_write_dword(rtlpriv, WFM5, FW_RA_RESET);
1351 rtl92s_phy_chk_fwcmd_iodone(hw); 1345 rtl92s_phy_chk_fwcmd_iodone(hw);
1352 break; 1346 break;
1353 case FW_CMD_RA_ACTIVE: 1347 case FW_CMD_RA_ACTIVE:
1354 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1348 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_RA_ACTIVE\n");
1355 ("FW_CMD_RA_ACTIVE\n"));
1356 rtl_write_dword(rtlpriv, WFM5, FW_RA_ACTIVE); 1349 rtl_write_dword(rtlpriv, WFM5, FW_RA_ACTIVE);
1357 rtl92s_phy_chk_fwcmd_iodone(hw); 1350 rtl92s_phy_chk_fwcmd_iodone(hw);
1358 break; 1351 break;
1359 case FW_CMD_RA_REFRESH_N: 1352 case FW_CMD_RA_REFRESH_N:
1360 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1353 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_RA_REFRESH_N\n");
1361 ("FW_CMD_RA_REFRESH_N\n"));
1362 input = FW_RA_REFRESH; 1354 input = FW_RA_REFRESH;
1363 rtl_write_dword(rtlpriv, WFM5, input); 1355 rtl_write_dword(rtlpriv, WFM5, input);
1364 rtl92s_phy_chk_fwcmd_iodone(hw); 1356 rtl92s_phy_chk_fwcmd_iodone(hw);
@@ -1367,7 +1359,7 @@ static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw)
1367 break; 1359 break;
1368 case FW_CMD_RA_REFRESH_BG: 1360 case FW_CMD_RA_REFRESH_BG:
1369 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1361 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG,
1370 ("FW_CMD_RA_REFRESH_BG\n")); 1362 "FW_CMD_RA_REFRESH_BG\n");
1371 rtl_write_dword(rtlpriv, WFM5, FW_RA_REFRESH); 1363 rtl_write_dword(rtlpriv, WFM5, FW_RA_REFRESH);
1372 rtl92s_phy_chk_fwcmd_iodone(hw); 1364 rtl92s_phy_chk_fwcmd_iodone(hw);
1373 rtl_write_dword(rtlpriv, WFM5, FW_RA_DISABLE_RSSI_MASK); 1365 rtl_write_dword(rtlpriv, WFM5, FW_RA_DISABLE_RSSI_MASK);
@@ -1375,21 +1367,20 @@ static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw)
1375 break; 1367 break;
1376 case FW_CMD_RA_REFRESH_N_COMB: 1368 case FW_CMD_RA_REFRESH_N_COMB:
1377 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1369 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG,
1378 ("FW_CMD_RA_REFRESH_N_COMB\n")); 1370 "FW_CMD_RA_REFRESH_N_COMB\n");
1379 input = FW_RA_IOT_N_COMB; 1371 input = FW_RA_IOT_N_COMB;
1380 rtl_write_dword(rtlpriv, WFM5, input); 1372 rtl_write_dword(rtlpriv, WFM5, input);
1381 rtl92s_phy_chk_fwcmd_iodone(hw); 1373 rtl92s_phy_chk_fwcmd_iodone(hw);
1382 break; 1374 break;
1383 case FW_CMD_RA_REFRESH_BG_COMB: 1375 case FW_CMD_RA_REFRESH_BG_COMB:
1384 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1376 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG,
1385 ("FW_CMD_RA_REFRESH_BG_COMB\n")); 1377 "FW_CMD_RA_REFRESH_BG_COMB\n");
1386 input = FW_RA_IOT_BG_COMB; 1378 input = FW_RA_IOT_BG_COMB;
1387 rtl_write_dword(rtlpriv, WFM5, input); 1379 rtl_write_dword(rtlpriv, WFM5, input);
1388 rtl92s_phy_chk_fwcmd_iodone(hw); 1380 rtl92s_phy_chk_fwcmd_iodone(hw);
1389 break; 1381 break;
1390 case FW_CMD_IQK_ENABLE: 1382 case FW_CMD_IQK_ENABLE:
1391 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1383 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_IQK_ENABLE\n");
1392 ("FW_CMD_IQK_ENABLE\n"));
1393 rtl_write_dword(rtlpriv, WFM5, FW_IQK_ENABLE); 1384 rtl_write_dword(rtlpriv, WFM5, FW_IQK_ENABLE);
1394 rtl92s_phy_chk_fwcmd_iodone(hw); 1385 rtl92s_phy_chk_fwcmd_iodone(hw);
1395 break; 1386 break;
@@ -1424,8 +1415,7 @@ static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw)
1424 rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0xcd); 1415 rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0xcd);
1425 break; 1416 break;
1426 case FW_CMD_LPS_ENTER: 1417 case FW_CMD_LPS_ENTER:
1427 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1418 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_LPS_ENTER\n");
1428 ("FW_CMD_LPS_ENTER\n"));
1429 current_aid = rtlpriv->mac80211.assoc_id; 1419 current_aid = rtlpriv->mac80211.assoc_id;
1430 rtl_write_dword(rtlpriv, WFM5, (FW_LPS_ENTER | 1420 rtl_write_dword(rtlpriv, WFM5, (FW_LPS_ENTER |
1431 ((current_aid | 0xc000) << 8))); 1421 ((current_aid | 0xc000) << 8)));
@@ -1434,20 +1424,18 @@ static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw)
1434 * turbo mode until driver leave LPS */ 1424 * turbo mode until driver leave LPS */
1435 break; 1425 break;
1436 case FW_CMD_LPS_LEAVE: 1426 case FW_CMD_LPS_LEAVE:
1437 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1427 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_LPS_LEAVE\n");
1438 ("FW_CMD_LPS_LEAVE\n"));
1439 rtl_write_dword(rtlpriv, WFM5, FW_LPS_LEAVE); 1428 rtl_write_dword(rtlpriv, WFM5, FW_LPS_LEAVE);
1440 rtl92s_phy_chk_fwcmd_iodone(hw); 1429 rtl92s_phy_chk_fwcmd_iodone(hw);
1441 break; 1430 break;
1442 case FW_CMD_ADD_A2_ENTRY: 1431 case FW_CMD_ADD_A2_ENTRY:
1443 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, 1432 RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_ADD_A2_ENTRY\n");
1444 ("FW_CMD_ADD_A2_ENTRY\n"));
1445 rtl_write_dword(rtlpriv, WFM5, FW_ADD_A2_ENTRY); 1433 rtl_write_dword(rtlpriv, WFM5, FW_ADD_A2_ENTRY);
1446 rtl92s_phy_chk_fwcmd_iodone(hw); 1434 rtl92s_phy_chk_fwcmd_iodone(hw);
1447 break; 1435 break;
1448 case FW_CMD_CTRL_DM_BY_DRIVER: 1436 case FW_CMD_CTRL_DM_BY_DRIVER:
1449 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 1437 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
1450 ("FW_CMD_CTRL_DM_BY_DRIVER\n")); 1438 "FW_CMD_CTRL_DM_BY_DRIVER\n");
1451 rtl_write_dword(rtlpriv, WFM5, FW_CTRL_DM_BY_DRIVER); 1439 rtl_write_dword(rtlpriv, WFM5, FW_CTRL_DM_BY_DRIVER);
1452 rtl92s_phy_chk_fwcmd_iodone(hw); 1440 rtl92s_phy_chk_fwcmd_iodone(hw);
1453 break; 1441 break;
@@ -1472,8 +1460,8 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio)
1472 bool bPostProcessing = false; 1460 bool bPostProcessing = false;
1473 1461
1474 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 1462 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
1475 ("Set FW Cmd(%#x), set_fwcmd_inprogress(%d)\n", 1463 "Set FW Cmd(%#x), set_fwcmd_inprogress(%d)\n",
1476 fw_cmdio, rtlhal->set_fwcmd_inprogress)); 1464 fw_cmdio, rtlhal->set_fwcmd_inprogress);
1477 1465
1478 do { 1466 do {
1479 /* We re-map to combined FW CMD ones if firmware version */ 1467 /* We re-map to combined FW CMD ones if firmware version */
@@ -1501,7 +1489,7 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio)
1501 * DM map table in the future. */ 1489 * DM map table in the future. */
1502 switch (fw_cmdio) { 1490 switch (fw_cmdio) {
1503 case FW_CMD_RA_INIT: 1491 case FW_CMD_RA_INIT:
1504 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, ("RA init!!\n")); 1492 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "RA init!!\n");
1505 fw_cmdmap |= FW_RA_INIT_CTL; 1493 fw_cmdmap |= FW_RA_INIT_CTL;
1506 FW_CMD_IO_SET(rtlpriv, fw_cmdmap); 1494 FW_CMD_IO_SET(rtlpriv, fw_cmdmap);
1507 /* Clear control flag to sync with FW. */ 1495 /* Clear control flag to sync with FW. */
@@ -1509,7 +1497,7 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio)
1509 break; 1497 break;
1510 case FW_CMD_DIG_DISABLE: 1498 case FW_CMD_DIG_DISABLE:
1511 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 1499 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
1512 ("Set DIG disable!!\n")); 1500 "Set DIG disable!!\n");
1513 fw_cmdmap &= ~FW_DIG_ENABLE_CTL; 1501 fw_cmdmap &= ~FW_DIG_ENABLE_CTL;
1514 FW_CMD_IO_SET(rtlpriv, fw_cmdmap); 1502 FW_CMD_IO_SET(rtlpriv, fw_cmdmap);
1515 break; 1503 break;
@@ -1517,14 +1505,14 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio)
1517 case FW_CMD_DIG_RESUME: 1505 case FW_CMD_DIG_RESUME:
1518 if (!(rtlpriv->dm.dm_flag & HAL_DM_DIG_DISABLE)) { 1506 if (!(rtlpriv->dm.dm_flag & HAL_DM_DIG_DISABLE)) {
1519 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 1507 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
1520 ("Set DIG enable or resume!!\n")); 1508 "Set DIG enable or resume!!\n");
1521 fw_cmdmap |= (FW_DIG_ENABLE_CTL | FW_SS_CTL); 1509 fw_cmdmap |= (FW_DIG_ENABLE_CTL | FW_SS_CTL);
1522 FW_CMD_IO_SET(rtlpriv, fw_cmdmap); 1510 FW_CMD_IO_SET(rtlpriv, fw_cmdmap);
1523 } 1511 }
1524 break; 1512 break;
1525 case FW_CMD_DIG_HALT: 1513 case FW_CMD_DIG_HALT:
1526 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 1514 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
1527 ("Set DIG halt!!\n")); 1515 "Set DIG halt!!\n");
1528 fw_cmdmap &= ~(FW_DIG_ENABLE_CTL | FW_SS_CTL); 1516 fw_cmdmap &= ~(FW_DIG_ENABLE_CTL | FW_SS_CTL);
1529 FW_CMD_IO_SET(rtlpriv, fw_cmdmap); 1517 FW_CMD_IO_SET(rtlpriv, fw_cmdmap);
1530 break; 1518 break;
@@ -1540,9 +1528,8 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio)
1540 (rtlefuse->thermalmeter[0] << 16)); 1528 (rtlefuse->thermalmeter[0] << 16));
1541 1529
1542 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 1530 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
1543 ("Set TxPwr tracking!! " 1531 "Set TxPwr tracking!! FwCmdMap(%#x), FwParam(%#x)\n",
1544 "FwCmdMap(%#x), FwParam(%#x)\n", 1532 fw_cmdmap, fw_param);
1545 fw_cmdmap, fw_param));
1546 1533
1547 FW_CMD_PARA_SET(rtlpriv, fw_param); 1534 FW_CMD_PARA_SET(rtlpriv, fw_param);
1548 FW_CMD_IO_SET(rtlpriv, fw_cmdmap); 1535 FW_CMD_IO_SET(rtlpriv, fw_cmdmap);
@@ -1563,9 +1550,8 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio)
1563 fw_param &= FW_RA_PARAM_CLR; 1550 fw_param &= FW_RA_PARAM_CLR;
1564 1551
1565 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 1552 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
1566 ("[FW CMD] [New Version] " 1553 "[FW CMD] [New Version] Set RA/IOT Comb in n mode!! FwCmdMap(%#x), FwParam(%#x)\n",
1567 "Set RA/IOT Comb in n mode!! FwCmdMap(%#x), " 1554 fw_cmdmap, fw_param);
1568 "FwParam(%#x)\n", fw_cmdmap, fw_param));
1569 1555
1570 FW_CMD_PARA_SET(rtlpriv, fw_param); 1556 FW_CMD_PARA_SET(rtlpriv, fw_param);
1571 FW_CMD_IO_SET(rtlpriv, fw_cmdmap); 1557 FW_CMD_IO_SET(rtlpriv, fw_cmdmap);
@@ -1652,7 +1638,7 @@ bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio)
1652 break; 1638 break;
1653 case FW_CMD_PAPE_CONTROL: 1639 case FW_CMD_PAPE_CONTROL:
1654 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, 1640 RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD,
1655 ("[FW CMD] Set PAPE Control\n")); 1641 "[FW CMD] Set PAPE Control\n");
1656 fw_cmdmap &= ~FW_PAPE_CTL_BY_SW_HW; 1642 fw_cmdmap &= ~FW_PAPE_CTL_BY_SW_HW;
1657 1643
1658 FW_CMD_IO_SET(rtlpriv, fw_cmdmap); 1644 FW_CMD_IO_SET(rtlpriv, fw_cmdmap);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.h b/drivers/net/wireless/rtlwifi/rtl8192se/phy.h
index 37e504af6446..ac0387770630 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
index 11f125c030ce..84d1181795b8 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
index 0ad50fe44aa2..ad51906124db 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,8 +27,6 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include "../wifi.h" 30#include "../wifi.h"
33#include "reg.h" 31#include "reg.h"
34#include "def.h" 32#include "def.h"
@@ -123,13 +121,13 @@ static void _rtl92s_get_powerbase(struct ieee80211_hw *hw, u8 *p_pwrlevel,
123 } 121 }
124 122
125 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { 123 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
126 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, ("40MHz finalpwr_idx " 124 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
127 "(A / B) = 0x%x / 0x%x\n", p_final_pwridx[0], 125 "40MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n",
128 p_final_pwridx[1])); 126 p_final_pwridx[0], p_final_pwridx[1]);
129 } else { 127 } else {
130 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, ("20MHz finalpwr_idx " 128 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
131 "(A / B) = 0x%x / 0x%x\n", p_final_pwridx[0], 129 "20MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n",
132 p_final_pwridx[1])); 130 p_final_pwridx[0], p_final_pwridx[1]);
133 } 131 }
134} 132}
135 133
@@ -153,9 +151,8 @@ static void _rtl92s_set_antennadiff(struct ieee80211_hw *hw,
153 ant_pwr_diff = -8; 151 ant_pwr_diff = -8;
154 152
155 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 153 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
156 ("Antenna Diff from RF-B " 154 "Antenna Diff from RF-B to RF-A = %d (0x%x)\n",
157 "to RF-A = %d (0x%x)\n", ant_pwr_diff, 155 ant_pwr_diff, ant_pwr_diff & 0xf);
158 ant_pwr_diff & 0xf));
159 156
160 ant_pwr_diff &= 0xf; 157 ant_pwr_diff &= 0xf;
161 } 158 }
@@ -172,9 +169,8 @@ static void _rtl92s_set_antennadiff(struct ieee80211_hw *hw,
172 rtl_set_bbreg(hw, RFPGA0_TXGAINSTAGE, (BXBTXAGC | BXCTXAGC | BXDTXAGC), 169 rtl_set_bbreg(hw, RFPGA0_TXGAINSTAGE, (BXBTXAGC | BXCTXAGC | BXDTXAGC),
173 u4reg_val); 170 u4reg_val);
174 171
175 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 172 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Write BCD-Diff(0x%x) = 0x%x\n",
176 ("Write BCD-Diff(0x%x) = 0x%x\n", 173 RFPGA0_TXGAINSTAGE, u4reg_val);
177 RFPGA0_TXGAINSTAGE, u4reg_val));
178} 174}
179 175
180static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, 176static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
@@ -201,8 +197,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
201 ((index < 2) ? pwrbase0 : pwrbase1); 197 ((index < 2) ? pwrbase0 : pwrbase1);
202 198
203 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 199 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
204 ("RTK better performance, " 200 "RTK better performance, writeval = 0x%x\n", writeval);
205 "writeval = 0x%x\n", writeval));
206 break; 201 break;
207 case 1: 202 case 1:
208 /* Realtek regulatory increase power diff defined 203 /* Realtek regulatory increase power diff defined
@@ -211,8 +206,8 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
211 writeval = ((index < 2) ? pwrbase0 : pwrbase1); 206 writeval = ((index < 2) ? pwrbase0 : pwrbase1);
212 207
213 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 208 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
214 ("Realtek regulatory, " 209 "Realtek regulatory, 40MHz, writeval = 0x%x\n",
215 "40MHz, writeval = 0x%x\n", writeval)); 210 writeval);
216 } else { 211 } else {
217 if (rtlphy->pwrgroup_cnt == 1) 212 if (rtlphy->pwrgroup_cnt == 1)
218 chnlgroup = 0; 213 chnlgroup = 0;
@@ -234,16 +229,15 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
234 pwrbase0 : pwrbase1); 229 pwrbase0 : pwrbase1);
235 230
236 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 231 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
237 ("Realtek regulatory, " 232 "Realtek regulatory, 20MHz, writeval = 0x%x\n",
238 "20MHz, writeval = 0x%x\n", writeval)); 233 writeval);
239 } 234 }
240 break; 235 break;
241 case 2: 236 case 2:
242 /* Better regulatory don't increase any power diff */ 237 /* Better regulatory don't increase any power diff */
243 writeval = ((index < 2) ? pwrbase0 : pwrbase1); 238 writeval = ((index < 2) ? pwrbase0 : pwrbase1);
244 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 239 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
245 ("Better regulatory, " 240 "Better regulatory, writeval = 0x%x\n", writeval);
246 "writeval = 0x%x\n", writeval));
247 break; 241 break;
248 case 3: 242 case 3:
249 /* Customer defined power diff. increase power diff 243 /* Customer defined power diff. increase power diff
@@ -252,14 +246,14 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
252 246
253 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { 247 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
254 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 248 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
255 ("customer's limit, 40MHz = 0x%x\n", 249 "customer's limit, 40MHz = 0x%x\n",
256 rtlefuse->pwrgroup_ht40 250 rtlefuse->pwrgroup_ht40
257 [RF90_PATH_A][chnl - 1])); 251 [RF90_PATH_A][chnl - 1]);
258 } else { 252 } else {
259 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 253 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
260 ("customer's limit, 20MHz = 0x%x\n", 254 "customer's limit, 20MHz = 0x%x\n",
261 rtlefuse->pwrgroup_ht20 255 rtlefuse->pwrgroup_ht20
262 [RF90_PATH_A][chnl - 1])); 256 [RF90_PATH_A][chnl - 1]);
263 } 257 }
264 258
265 for (i = 0; i < 4; i++) { 259 for (i = 0; i < 4; i++) {
@@ -293,22 +287,19 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
293 (pwrdiff_limit[1] << 8) | 287 (pwrdiff_limit[1] << 8) |
294 (pwrdiff_limit[0]); 288 (pwrdiff_limit[0]);
295 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 289 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
296 ("Customer's limit = 0x%x\n", 290 "Customer's limit = 0x%x\n", customer_limit);
297 customer_limit));
298 291
299 writeval = customer_limit + ((index < 2) ? 292 writeval = customer_limit + ((index < 2) ?
300 pwrbase0 : pwrbase1); 293 pwrbase0 : pwrbase1);
301 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 294 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
302 ("Customer, writeval = " 295 "Customer, writeval = 0x%x\n", writeval);
303 "0x%x\n", writeval));
304 break; 296 break;
305 default: 297 default:
306 chnlgroup = 0; 298 chnlgroup = 0;
307 writeval = rtlphy->mcs_txpwrlevel_origoffset[chnlgroup][index] + 299 writeval = rtlphy->mcs_txpwrlevel_origoffset[chnlgroup][index] +
308 ((index < 2) ? pwrbase0 : pwrbase1); 300 ((index < 2) ? pwrbase0 : pwrbase1);
309 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 301 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
310 ("RTK better performance, " 302 "RTK better performance, writeval = 0x%x\n", writeval);
311 "writeval = 0x%x\n", writeval));
312 break; 303 break;
313 } 304 }
314 305
@@ -541,8 +532,7 @@ void rtl92s_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
541 break; 532 break;
542 default: 533 default:
543 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 534 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
544 ("unknown bandwidth: %#X\n", 535 "unknown bandwidth: %#X\n", bandwidth);
545 bandwidth));
546 break; 536 break;
547 } 537 }
548} 538}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.h b/drivers/net/wireless/rtlwifi/rtl8192se/rf.h
index 3843baa1a874..8a29eb94ab17 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
index 36140ccf2abd..eda30b9d0f15 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -27,14 +27,11 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include <linux/vmalloc.h>
33#include <linux/module.h>
34
35#include "../wifi.h" 30#include "../wifi.h"
36#include "../core.h" 31#include "../core.h"
37#include "../pci.h" 32#include "../pci.h"
33#include "../base.h"
34#include "../pci.h"
38#include "reg.h" 35#include "reg.h"
39#include "def.h" 36#include "def.h"
40#include "phy.h" 37#include "phy.h"
@@ -45,6 +42,8 @@
45#include "trx.h" 42#include "trx.h"
46#include "led.h" 43#include "led.h"
47 44
45#include <linux/module.h>
46
48static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw) 47static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw)
49{ 48{
50 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 49 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
@@ -89,12 +88,53 @@ static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw)
89 rtlpci->const_support_pciaspm = 2; 88 rtlpci->const_support_pciaspm = 2;
90} 89}
91 90
91static void rtl92se_fw_cb(const struct firmware *firmware, void *context)
92{
93 struct ieee80211_hw *hw = context;
94 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
95 struct rtl_priv *rtlpriv = rtl_priv(hw);
96 struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
97 struct rt_firmware *pfirmware = NULL;
98 int err;
99
100 RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
101 "Firmware callback routine entered!\n");
102 complete(&rtlpriv->firmware_loading_complete);
103 if (!firmware) {
104 pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
105 rtlpriv->max_fw_size = 0;
106 return;
107 }
108 if (firmware->size > rtlpriv->max_fw_size) {
109 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
110 "Firmware is too big!\n");
111 release_firmware(firmware);
112 return;
113 }
114 pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware;
115 memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size);
116 pfirmware->sz_fw_tmpbufferlen = firmware->size;
117 release_firmware(firmware);
118
119 err = ieee80211_register_hw(hw);
120 if (err) {
121 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
122 "Can't register mac80211 hw\n");
123 return;
124 } else {
125 rtlpriv->mac80211.mac80211_registered = 1;
126 }
127 rtlpci->irq_alloc = 1;
128 set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
129
130 /*init rfkill */
131 rtl_init_rfkill(hw);
132}
133
92static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) 134static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
93{ 135{
94 struct rtl_priv *rtlpriv = rtl_priv(hw); 136 struct rtl_priv *rtlpriv = rtl_priv(hw);
95 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 137 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
96 const struct firmware *firmware;
97 struct rt_firmware *pfirmware = NULL;
98 int err = 0; 138 int err = 0;
99 u16 earlyrxthreshold = 7; 139 u16 earlyrxthreshold = 7;
100 140
@@ -168,9 +208,9 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
168 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; 208 rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
169 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; 209 rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
170 if (!rtlpriv->psc.inactiveps) 210 if (!rtlpriv->psc.inactiveps)
171 pr_info("rtl8192ce: Power Save off (module option)\n"); 211 pr_info("Power Save off (module option)\n");
172 if (!rtlpriv->psc.fwctrl_lps) 212 if (!rtlpriv->psc.fwctrl_lps)
173 pr_info("rtl8192ce: FW Power Save off (module option)\n"); 213 pr_info("FW Power Save off (module option)\n");
174 rtlpriv->psc.reg_fwctrl_lps = 3; 214 rtlpriv->psc.reg_fwctrl_lps = 3;
175 rtlpriv->psc.reg_max_lps_awakeintvl = 5; 215 rtlpriv->psc.reg_max_lps_awakeintvl = 5;
176 /* for ASPM, you can close aspm through 216 /* for ASPM, you can close aspm through
@@ -189,27 +229,19 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
189 if (!rtlpriv->rtlhal.pfirmware) 229 if (!rtlpriv->rtlhal.pfirmware)
190 return 1; 230 return 1;
191 231
232 rtlpriv->max_fw_size = sizeof(struct rt_firmware);
233
192 pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" 234 pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n"
193 "Loading firmware %s\n", rtlpriv->cfg->fw_name); 235 "Loading firmware %s\n", rtlpriv->cfg->fw_name);
194 /* request fw */ 236 /* request fw */
195 err = request_firmware(&firmware, rtlpriv->cfg->fw_name, 237 err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
196 rtlpriv->io.dev); 238 rtlpriv->io.dev, GFP_KERNEL, hw,
239 rtl92se_fw_cb);
197 if (err) { 240 if (err) {
198 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 241 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
199 ("Failed to request firmware!\n")); 242 "Failed to request firmware!\n");
200 return 1; 243 return 1;
201 } 244 }
202 if (firmware->size > sizeof(struct rt_firmware)) {
203 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
204 ("Firmware is too big!\n"));
205 release_firmware(firmware);
206 return 1;
207 }
208
209 pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware;
210 memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size);
211 pfirmware->sz_fw_tmpbufferlen = firmware->size;
212 release_firmware(firmware);
213 245
214 return err; 246 return err;
215} 247}
@@ -423,7 +455,7 @@ static int __init rtl92se_module_init(void)
423 455
424 ret = pci_register_driver(&rtl92se_driver); 456 ret = pci_register_driver(&rtl92se_driver);
425 if (ret) 457 if (ret)
426 RT_ASSERT(false, (": No device found\n")); 458 RT_ASSERT(false, "No device found\n");
427 459
428 return ret; 460 return ret;
429} 461}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.h b/drivers/net/wireless/rtlwifi/rtl8192se/sw.h
index fc4eb285a0ac..2eb88862ebe4 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/table.c b/drivers/net/wireless/rtlwifi/rtl8192se/table.c
index 154185b3969d..f1a73f75127e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/table.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/table.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/table.h b/drivers/net/wireless/rtlwifi/rtl8192se/table.h
index b4ed6d951ebb..2feb73b71a4f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/table.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/table.h
@@ -1,5 +1,5 @@
1/****************************************************************************** 1/******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. 2 * Copyright(c) 2008 - 2012 Realtek Corporation. All rights reserved.
3 * 3 *
4 * This program is distributed in the hope that it will be useful, but WITHOUT 4 * This program is distributed in the hope that it will be useful, but WITHOUT
5 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
index fbebe3ea0a22..2fd3d13b7ced 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -756,7 +756,7 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw,
756 /* DOWRD 8 */ 756 /* DOWRD 8 */
757 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping)); 757 SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping));
758 758
759 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, ("\n")); 759 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n");
760} 760}
761 761
762void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, 762void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
@@ -823,8 +823,8 @@ void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
823 SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val); 823 SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val);
824 break; 824 break;
825 default: 825 default:
826 RT_ASSERT(false, ("ERR txdesc :%d not process\n", 826 RT_ASSERT(false, "ERR txdesc :%d not process\n",
827 desc_name)); 827 desc_name);
828 break; 828 break;
829 } 829 }
830 } else { 830 } else {
@@ -843,8 +843,8 @@ void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val)
843 SET_RX_STATUS_DESC_EOR(pdesc, 1); 843 SET_RX_STATUS_DESC_EOR(pdesc, 1);
844 break; 844 break;
845 default: 845 default:
846 RT_ASSERT(false, ("ERR rxdesc :%d not process\n", 846 RT_ASSERT(false, "ERR rxdesc :%d not process\n",
847 desc_name)); 847 desc_name);
848 break; 848 break;
849 } 849 }
850 } 850 }
@@ -863,8 +863,8 @@ u32 rtl92se_get_desc(u8 *desc, bool istx, u8 desc_name)
863 ret = GET_TX_DESC_TX_BUFFER_ADDRESS(desc); 863 ret = GET_TX_DESC_TX_BUFFER_ADDRESS(desc);
864 break; 864 break;
865 default: 865 default:
866 RT_ASSERT(false, ("ERR txdesc :%d not process\n", 866 RT_ASSERT(false, "ERR txdesc :%d not process\n",
867 desc_name)); 867 desc_name);
868 break; 868 break;
869 } 869 }
870 } else { 870 } else {
@@ -876,8 +876,8 @@ u32 rtl92se_get_desc(u8 *desc, bool istx, u8 desc_name)
876 ret = GET_RX_STATUS_DESC_PKT_LEN(desc); 876 ret = GET_RX_STATUS_DESC_PKT_LEN(desc);
877 break; 877 break;
878 default: 878 default:
879 RT_ASSERT(false, ("ERR rxdesc :%d not process\n", 879 RT_ASSERT(false, "ERR rxdesc :%d not process\n",
880 desc_name)); 880 desc_name);
881 break; 881 break;
882 } 882 }
883 } 883 }
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.h b/drivers/net/wireless/rtlwifi/rtl8192se/trx.h
index 05862c51b861..011e7b0695f2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index e956fa71d040..ffcf89fe45e4 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2011 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -25,16 +25,13 @@
25 * 25 *
26 *****************************************************************************/ 26 *****************************************************************************/
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
30#include <linux/usb.h>
31#include <linux/export.h>
32#include "core.h"
33#include "wifi.h" 28#include "wifi.h"
29#include "core.h"
34#include "usb.h" 30#include "usb.h"
35#include "base.h" 31#include "base.h"
36#include "ps.h" 32#include "ps.h"
37#include "rtl8192c/fw_common.h" 33#include "rtl8192c/fw_common.h"
34#include <linux/export.h>
38 35
39#define REALTEK_USB_VENQT_READ 0xC0 36#define REALTEK_USB_VENQT_READ 0xC0
40#define REALTEK_USB_VENQT_WRITE 0x40 37#define REALTEK_USB_VENQT_WRITE 0x40
@@ -276,14 +273,14 @@ static int _rtl_usb_init_tx(struct ieee80211_hw *hw)
276 ? USB_HIGH_SPEED_BULK_SIZE 273 ? USB_HIGH_SPEED_BULK_SIZE
277 : USB_FULL_SPEED_BULK_SIZE; 274 : USB_FULL_SPEED_BULK_SIZE;
278 275
279 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, ("USB Max Bulk-out Size=%d\n", 276 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "USB Max Bulk-out Size=%d\n",
280 rtlusb->max_bulk_out_size)); 277 rtlusb->max_bulk_out_size);
281 278
282 for (i = 0; i < __RTL_TXQ_NUM; i++) { 279 for (i = 0; i < __RTL_TXQ_NUM; i++) {
283 u32 ep_num = rtlusb->ep_map.ep_mapping[i]; 280 u32 ep_num = rtlusb->ep_map.ep_mapping[i];
284 if (!ep_num) { 281 if (!ep_num) {
285 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 282 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
286 ("Invalid endpoint map setting!\n")); 283 "Invalid endpoint map setting!\n");
287 return -EINVAL; 284 return -EINVAL;
288 } 285 }
289 } 286 }
@@ -345,9 +342,9 @@ static int _rtl_usb_init(struct ieee80211_hw *hw)
345 rtlusb->out_ep_nums++; 342 rtlusb->out_ep_nums++;
346 343
347 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, 344 RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
348 ("USB EP(0x%02x), MaxPacketSize=%d ,Interval=%d.\n", 345 "USB EP(0x%02x), MaxPacketSize=%d, Interval=%d\n",
349 pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, 346 pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize,
350 pep_desc->bInterval)); 347 pep_desc->bInterval);
351 } 348 }
352 if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num) 349 if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num)
353 return -EINVAL ; 350 return -EINVAL ;
@@ -414,7 +411,7 @@ static struct sk_buff *_rtl_prep_rx_urb(struct ieee80211_hw *hw,
414 gfp_mask); 411 gfp_mask);
415 if (!skb) { 412 if (!skb) {
416 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 413 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
417 ("Failed to __dev_alloc_skb!!\n")) 414 "Failed to __dev_alloc_skb!!\n");
418 return ERR_PTR(-ENOMEM); 415 return ERR_PTR(-ENOMEM);
419 } 416 }
420 417
@@ -520,12 +517,14 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw,
520 u8 *pdata; 517 u8 *pdata;
521 518
522 uskb = dev_alloc_skb(skb->len + 128); 519 uskb = dev_alloc_skb(skb->len + 128);
523 memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, 520 if (uskb) { /* drop packet on allocation failure */
524 sizeof(rx_status)); 521 memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status,
525 pdata = (u8 *)skb_put(uskb, skb->len); 522 sizeof(rx_status));
526 memcpy(pdata, skb->data, skb->len); 523 pdata = (u8 *)skb_put(uskb, skb->len);
524 memcpy(pdata, skb->data, skb->len);
525 ieee80211_rx_irqsafe(hw, uskb);
526 }
527 dev_kfree_skb_any(skb); 527 dev_kfree_skb_any(skb);
528 ieee80211_rx_irqsafe(hw, uskb);
529 } else { 528 } else {
530 dev_kfree_skb_any(skb); 529 dev_kfree_skb_any(skb);
531 } 530 }
@@ -575,7 +574,7 @@ static void _rtl_rx_completed(struct urb *_urb)
575 if (IS_ERR(_skb)) { 574 if (IS_ERR(_skb)) {
576 err = PTR_ERR(_skb); 575 err = PTR_ERR(_skb);
577 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 576 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
578 ("Can't allocate skb for bulk IN!\n")); 577 "Can't allocate skb for bulk IN!\n");
579 return; 578 return;
580 } 579 }
581 skb = _skb; 580 skb = _skb;
@@ -632,14 +631,14 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
632 urb = usb_alloc_urb(0, GFP_KERNEL); 631 urb = usb_alloc_urb(0, GFP_KERNEL);
633 if (!urb) { 632 if (!urb) {
634 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 633 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
635 ("Failed to alloc URB!!\n")) 634 "Failed to alloc URB!!\n");
636 goto err_out; 635 goto err_out;
637 } 636 }
638 637
639 skb = _rtl_prep_rx_urb(hw, rtlusb, urb, GFP_KERNEL); 638 skb = _rtl_prep_rx_urb(hw, rtlusb, urb, GFP_KERNEL);
640 if (IS_ERR(skb)) { 639 if (IS_ERR(skb)) {
641 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 640 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
642 ("Failed to prep_rx_urb!!\n")) 641 "Failed to prep_rx_urb!!\n");
643 err = PTR_ERR(skb); 642 err = PTR_ERR(skb);
644 goto err_out; 643 goto err_out;
645 } 644 }
@@ -665,15 +664,17 @@ static int rtl_usb_start(struct ieee80211_hw *hw)
665 struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); 664 struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw));
666 665
667 err = rtlpriv->cfg->ops->hw_init(hw); 666 err = rtlpriv->cfg->ops->hw_init(hw);
668 rtl_init_rx_config(hw); 667 if (!err) {
668 rtl_init_rx_config(hw);
669 669
670 /* Enable software */ 670 /* Enable software */
671 SET_USB_START(rtlusb); 671 SET_USB_START(rtlusb);
672 /* should after adapter start and interrupt enable. */ 672 /* should after adapter start and interrupt enable. */
673 set_hal_start(rtlhal); 673 set_hal_start(rtlhal);
674 674
675 /* Start bulk IN */ 675 /* Start bulk IN */
676 _rtl_usb_receive(hw); 676 _rtl_usb_receive(hw);
677 }
677 678
678 return err; 679 return err;
679} 680}
@@ -745,7 +746,7 @@ static void _rtl_submit_tx_urb(struct ieee80211_hw *hw, struct urb *_urb)
745 struct sk_buff *skb; 746 struct sk_buff *skb;
746 747
747 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 748 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
748 ("Failed to submit urb.\n")); 749 "Failed to submit urb\n");
749 usb_unanchor_urb(_urb); 750 usb_unanchor_urb(_urb);
750 skb = (struct sk_buff *)_urb->context; 751 skb = (struct sk_buff *)_urb->context;
751 kfree_skb(skb); 752 kfree_skb(skb);
@@ -768,7 +769,7 @@ static int _usb_tx_post(struct ieee80211_hw *hw, struct urb *urb,
768 769
769 if (urb->status) { 770 if (urb->status) {
770 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 771 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
771 ("Urb has error status 0x%X\n", urb->status)); 772 "Urb has error status 0x%X\n", urb->status);
772 goto out; 773 goto out;
773 } 774 }
774 /* TODO: statistics */ 775 /* TODO: statistics */
@@ -805,7 +806,7 @@ static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw,
805 _urb = usb_alloc_urb(0, GFP_ATOMIC); 806 _urb = usb_alloc_urb(0, GFP_ATOMIC);
806 if (!_urb) { 807 if (!_urb) {
807 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 808 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
808 ("Can't allocate URB for bulk out!\n")); 809 "Can't allocate URB for bulk out!\n");
809 kfree_skb(skb); 810 kfree_skb(skb);
810 return NULL; 811 return NULL;
811 } 812 }
@@ -830,7 +831,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,
830 WARN_ON(NULL == rtlusb->usb_tx_aggregate_hdl); 831 WARN_ON(NULL == rtlusb->usb_tx_aggregate_hdl);
831 if (unlikely(IS_USB_STOP(rtlusb))) { 832 if (unlikely(IS_USB_STOP(rtlusb))) {
832 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 833 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
833 ("USB device is stopping...\n")); 834 "USB device is stopping...\n");
834 kfree_skb(skb); 835 kfree_skb(skb);
835 return; 836 return;
836 } 837 }
@@ -840,7 +841,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,
840 _urb = _rtl_usb_tx_urb_setup(hw, _skb, ep_num); 841 _urb = _rtl_usb_tx_urb_setup(hw, _skb, ep_num);
841 if (unlikely(!_urb)) { 842 if (unlikely(!_urb)) {
842 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 843 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
843 ("Can't allocate urb. Drop skb!\n")); 844 "Can't allocate urb. Drop skb!\n");
844 return; 845 return;
845 } 846 }
846 urb_list = &rtlusb->tx_pending[ep_num]; 847 urb_list = &rtlusb->tx_pending[ep_num];
@@ -865,7 +866,7 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb,
865 866
866 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); 867 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
867 if (ieee80211_is_auth(fc)) { 868 if (ieee80211_is_auth(fc)) {
868 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, ("MAC80211_LINKING\n")); 869 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "MAC80211_LINKING\n");
869 rtl_ips_nic_on(hw); 870 rtl_ips_nic_on(hw);
870 } 871 }
871 872
@@ -946,10 +947,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
946 hw = ieee80211_alloc_hw(sizeof(struct rtl_priv) + 947 hw = ieee80211_alloc_hw(sizeof(struct rtl_priv) +
947 sizeof(struct rtl_usb_priv), &rtl_ops); 948 sizeof(struct rtl_usb_priv), &rtl_ops);
948 if (!hw) { 949 if (!hw) {
949 RT_ASSERT(false, ("%s : ieee80211 alloc failed\n", __func__)); 950 RT_ASSERT(false, "ieee80211 alloc failed\n");
950 return -ENOMEM; 951 return -ENOMEM;
951 } 952 }
952 rtlpriv = hw->priv; 953 rtlpriv = hw->priv;
954 init_completion(&rtlpriv->firmware_loading_complete);
953 SET_IEEE80211_DEV(hw, &intf->dev); 955 SET_IEEE80211_DEV(hw, &intf->dev);
954 udev = interface_to_usbdev(intf); 956 udev = interface_to_usbdev(intf);
955 usb_get_dev(udev); 957 usb_get_dev(udev);
@@ -969,8 +971,7 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
969 /*like read eeprom and so on */ 971 /*like read eeprom and so on */
970 rtlpriv->cfg->ops->read_eeprom_info(hw); 972 rtlpriv->cfg->ops->read_eeprom_info(hw);
971 if (rtlpriv->cfg->ops->init_sw_vars(hw)) { 973 if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
972 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 974 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
973 ("Can't init_sw_vars.\n"));
974 goto error_out; 975 goto error_out;
975 } 976 }
976 rtlpriv->cfg->ops->init_sw_leds(hw); 977 rtlpriv->cfg->ops->init_sw_leds(hw);
@@ -980,28 +981,16 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
980 err = rtl_init_core(hw); 981 err = rtl_init_core(hw);
981 if (err) { 982 if (err) {
982 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 983 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
983 ("Can't allocate sw for mac80211.\n")); 984 "Can't allocate sw for mac80211\n");
984 goto error_out; 985 goto error_out;
985 } 986 }
986 987
987 /*init rfkill */
988 /* rtl_init_rfkill(hw); */
989
990 err = ieee80211_register_hw(hw);
991 if (err) {
992 RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG,
993 ("Can't register mac80211 hw.\n"));
994 goto error_out;
995 } else {
996 rtlpriv->mac80211.mac80211_registered = 1;
997 }
998 set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
999 return 0; 988 return 0;
1000error_out: 989error_out:
1001 rtl_deinit_core(hw); 990 rtl_deinit_core(hw);
1002 _rtl_usb_io_handler_release(hw); 991 _rtl_usb_io_handler_release(hw);
1003 ieee80211_free_hw(hw);
1004 usb_put_dev(udev); 992 usb_put_dev(udev);
993 complete(&rtlpriv->firmware_loading_complete);
1005 return -ENODEV; 994 return -ENODEV;
1006} 995}
1007EXPORT_SYMBOL(rtl_usb_probe); 996EXPORT_SYMBOL(rtl_usb_probe);
@@ -1015,6 +1004,9 @@ void rtl_usb_disconnect(struct usb_interface *intf)
1015 1004
1016 if (unlikely(!rtlpriv)) 1005 if (unlikely(!rtlpriv))
1017 return; 1006 return;
1007
1008 /* just in case driver is removed before firmware callback */
1009 wait_for_completion(&rtlpriv->firmware_loading_complete);
1018 /*ieee80211_unregister_hw will call ops_stop */ 1010 /*ieee80211_unregister_hw will call ops_stop */
1019 if (rtlmac->mac80211_registered == 1) { 1011 if (rtlmac->mac80211_registered == 1) {
1020 ieee80211_unregister_hw(hw); 1012 ieee80211_unregister_hw(hw);
diff --git a/drivers/net/wireless/rtlwifi/usb.h b/drivers/net/wireless/rtlwifi/usb.h
index d2a63fb3e1e6..43846b329153 100644
--- a/drivers/net/wireless/rtlwifi/usb.h
+++ b/drivers/net/wireless/rtlwifi/usb.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2011 Realtek Corporation. All rights reserved. 3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -28,7 +28,6 @@
28#ifndef __RTL_USB_H__ 28#ifndef __RTL_USB_H__
29#define __RTL_USB_H__ 29#define __RTL_USB_H__
30 30
31#include <linux/usb.h>
32#include <linux/skbuff.h> 31#include <linux/skbuff.h>
33 32
34#define RTL_RX_DESC_SIZE 24 33#define RTL_RX_DESC_SIZE 24
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index cdaf1429fa0b..b591614c3b9b 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2009-2010 Realtek Corporation. 3 * Copyright(c) 2009-2012 Realtek Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -30,12 +30,15 @@
30#ifndef __RTL_WIFI_H__ 30#ifndef __RTL_WIFI_H__
31#define __RTL_WIFI_H__ 31#define __RTL_WIFI_H__
32 32
33#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
34
33#include <linux/sched.h> 35#include <linux/sched.h>
34#include <linux/firmware.h> 36#include <linux/firmware.h>
35#include <linux/etherdevice.h> 37#include <linux/etherdevice.h>
36#include <linux/vmalloc.h> 38#include <linux/vmalloc.h>
37#include <linux/usb.h> 39#include <linux/usb.h>
38#include <net/mac80211.h> 40#include <net/mac80211.h>
41#include <linux/completion.h>
39#include "debug.h" 42#include "debug.h"
40 43
41#define RF_CHANGE_BY_INIT 0 44#define RF_CHANGE_BY_INIT 0
@@ -1045,7 +1048,6 @@ struct rtl_hal {
1045 u16 fw_subversion; 1048 u16 fw_subversion;
1046 bool h2c_setinprogress; 1049 bool h2c_setinprogress;
1047 u8 last_hmeboxnum; 1050 u8 last_hmeboxnum;
1048 bool fw_ready;
1049 /*Reserve page start offset except beacon in TxQ. */ 1051 /*Reserve page start offset except beacon in TxQ. */
1050 u8 fw_rsvdpage_startoffset; 1052 u8 fw_rsvdpage_startoffset;
1051 u8 h2c_txcmd_seq; 1053 u8 h2c_txcmd_seq;
@@ -1591,6 +1593,7 @@ struct rtl_debug {
1591}; 1593};
1592 1594
1593struct rtl_priv { 1595struct rtl_priv {
1596 struct completion firmware_loading_complete;
1594 struct rtl_locks locks; 1597 struct rtl_locks locks;
1595 struct rtl_works works; 1598 struct rtl_works works;
1596 struct rtl_mac mac80211; 1599 struct rtl_mac mac80211;
@@ -1612,6 +1615,7 @@ struct rtl_priv {
1612 struct rtl_rate_priv *rate_priv; 1615 struct rtl_rate_priv *rate_priv;
1613 1616
1614 struct rtl_debug dbg; 1617 struct rtl_debug dbg;
1618 int max_fw_size;
1615 1619
1616 /* 1620 /*
1617 *hal_cfg : for diff cards 1621 *hal_cfg : for diff cards
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c
index ba3268ea81fe..41302c7b1ad0 100644
--- a/drivers/net/wireless/wl1251/main.c
+++ b/drivers/net/wireless/wl1251/main.c
@@ -514,6 +514,9 @@ static int wl1251_op_add_interface(struct ieee80211_hw *hw,
514 struct wl1251 *wl = hw->priv; 514 struct wl1251 *wl = hw->priv;
515 int ret = 0; 515 int ret = 0;
516 516
517 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER |
518 IEEE80211_VIF_SUPPORTS_CQM_RSSI;
519
517 wl1251_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", 520 wl1251_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM",
518 vif->type, vif->addr); 521 vif->type, vif->addr);
519 522
@@ -1338,9 +1341,7 @@ int wl1251_init_ieee80211(struct wl1251 *wl)
1338 1341
1339 wl->hw->flags = IEEE80211_HW_SIGNAL_DBM | 1342 wl->hw->flags = IEEE80211_HW_SIGNAL_DBM |
1340 IEEE80211_HW_SUPPORTS_PS | 1343 IEEE80211_HW_SUPPORTS_PS |
1341 IEEE80211_HW_BEACON_FILTER | 1344 IEEE80211_HW_SUPPORTS_UAPSD;
1342 IEEE80211_HW_SUPPORTS_UAPSD |
1343 IEEE80211_HW_SUPPORTS_CQM_RSSI;
1344 1345
1345 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | 1346 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
1346 BIT(NL80211_IFTYPE_ADHOC); 1347 BIT(NL80211_IFTYPE_ADHOC);
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index d5f55a149de5..f8748cedbae1 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -2060,6 +2060,9 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
2060 u8 role_type; 2060 u8 role_type;
2061 bool booted = false; 2061 bool booted = false;
2062 2062
2063 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER |
2064 IEEE80211_VIF_SUPPORTS_CQM_RSSI;
2065
2063 wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", 2066 wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM",
2064 ieee80211_vif_type_p2p(vif), vif->addr); 2067 ieee80211_vif_type_p2p(vif), vif->addr);
2065 2068
@@ -4898,12 +4901,10 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
4898 wl->hw->max_listen_interval = wl->conf.conn.max_listen_interval; 4901 wl->hw->max_listen_interval = wl->conf.conn.max_listen_interval;
4899 4902
4900 wl->hw->flags = IEEE80211_HW_SIGNAL_DBM | 4903 wl->hw->flags = IEEE80211_HW_SIGNAL_DBM |
4901 IEEE80211_HW_BEACON_FILTER |
4902 IEEE80211_HW_SUPPORTS_PS | 4904 IEEE80211_HW_SUPPORTS_PS |
4903 IEEE80211_HW_SUPPORTS_UAPSD | 4905 IEEE80211_HW_SUPPORTS_UAPSD |
4904 IEEE80211_HW_HAS_RATE_CONTROL | 4906 IEEE80211_HW_HAS_RATE_CONTROL |
4905 IEEE80211_HW_CONNECTION_MONITOR | 4907 IEEE80211_HW_CONNECTION_MONITOR |
4906 IEEE80211_HW_SUPPORTS_CQM_RSSI |
4907 IEEE80211_HW_REPORTS_TX_ACK_STATUS | 4908 IEEE80211_HW_REPORTS_TX_ACK_STATUS |
4908 IEEE80211_HW_SPECTRUM_MGMT | 4909 IEEE80211_HW_SPECTRUM_MGMT |
4909 IEEE80211_HW_AP_LINK_PS | 4910 IEEE80211_HW_AP_LINK_PS |