aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-02-22 15:56:24 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-22 15:56:24 -0500
commit1a2566085650be593d464c4d73ac2d20ff67c058 (patch)
treedabdfa08fd7aca827a98a321d2b4b6ac6a39f6f8
parentd29d1c4957d4dde1a7578b10f2a2d1fae39bd47a (diff)
parent5c0c4c85463461a9ea0a69c4e80849a71c6b1e24 (diff)
Merge tag 'wireless-drivers-next-for-davem-2019-02-22' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
Kalle Valo says: ==================== wireless-drivers-next patches for 5.1 Most likely the last set of patches for 5.1. WPA3 support to ath10k and qtnfmac. FTM support to iwlwifi and ath10k. And of course other new features and bugfixes. wireless-drivers was merged due to dependency in mt76. Major changes: iwlwifi * HE radiotap * FTM (Fine Timing Measurement) initiator and responder implementation * bump supported firmware API to 46 * VHT extended NSS support * new PCI IDs for 9260 and 22000 series ath10k * change QMI interface to support the new (and backwards incompatible) interface from HL3.1 and used in recent HL2.0 branch firmware releases * support WPA3 with WCN3990 * support for mac80211 airtime fairness based on transmit rate estimation, the firmware needs to support WMI_SERVICE_PEER_STATS to enable this * report transmit airtime to mac80211 with firmwares having WMI_SERVICE_REPORT_AIRTIME feature, this to have more accurate airtime fairness based on real transmit time (instead of just estimated from transmit rate) * support Fine Timing Measurement (FTM) responder role * add dynamic VLAN support with firmware having WMI_SERVICE_PER_PACKET_SW_ENCRYPT * switch to use SPDX license identifiers ath * add new country codes for US brcmfmac * support monitor frames with the hardware/ucode header qtnfmac * enable WPA3 SAE and OWE support mt76 * beacon support for USB devices (mesh+ad-hoc only) rtlwifi * convert to use SPDX license identifiers libertas_tf * get the MAC address before registering the device ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/wireless/ath/ath10k/Makefile2
-rw-r--r--drivers/net/wireless/ath/ath10k/ahb.c16
-rw-r--r--drivers/net/wireless/ath/ath10k/ahb.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/bmi.c13
-rw-r--r--drivers/net/wireless/ath/ath10k/bmi.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/ce.c117
-rw-r--r--drivers/net/wireless/ath/ath10k/ce.h29
-rw-r--r--drivers/net/wireless/ath/ath10k/core.c45
-rw-r--r--drivers/net/wireless/ath/ath10k/core.h42
-rw-r--r--drivers/net/wireless/ath/ath10k/coredump.c15
-rw-r--r--drivers/net/wireless/ath/ath10k/coredump.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.c17
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.h33
-rw-r--r--drivers/net/wireless/ath/ath10k/debugfs_sta.c23
-rw-r--r--drivers/net/wireless/ath/ath10k/hif.h29
-rw-r--r--drivers/net/wireless/ath/ath10k/htc.c22
-rw-r--r--drivers/net/wireless/ath/ath10k/htc.h14
-rw-r--r--drivers/net/wireless/ath/ath10k/htt.c15
-rw-r--r--drivers/net/wireless/ath/ath10k/htt.h49
-rw-r--r--drivers/net/wireless/ath/ath10k/htt_rx.c103
-rw-r--r--drivers/net/wireless/ath/ath10k/htt_tx.c70
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.c23
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.h20
-rw-r--r--drivers/net/wireless/ath/ath10k/mac.c249
-rw-r--r--drivers/net/wireless/ath/ath10k/mac.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/p2p.c13
-rw-r--r--drivers/net/wireless/ath/ath10k/p2p.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.c62
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.h16
-rw-r--r--drivers/net/wireless/ath/ath10k/qmi.c13
-rw-r--r--drivers/net/wireless/ath/ath10k/qmi.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c242
-rw-r--r--drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h47
-rw-r--r--drivers/net/wireless/ath/ath10k/rx_desc.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/sdio.c59
-rw-r--r--drivers/net/wireless/ath/ath10k/sdio.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/snoc.c93
-rw-r--r--drivers/net/wireless/ath/ath10k/snoc.h15
-rw-r--r--drivers/net/wireless/ath/ath10k/spectral.c16
-rw-r--r--drivers/net/wireless/ath/ath10k/spectral.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/swap.c13
-rw-r--r--drivers/net/wireless/ath/ath10k/swap.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/targaddrs.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/testmode.c15
-rw-r--r--drivers/net/wireless/ath/ath10k/testmode.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/testmode_i.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/thermal.c13
-rw-r--r--drivers/net/wireless/ath/ath10k/thermal.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/trace.c13
-rw-r--r--drivers/net/wireless/ath/ath10k/trace.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/txrx.c19
-rw-r--r--drivers/net/wireless/ath/ath10k/txrx.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/usb.c16
-rw-r--r--drivers/net/wireless/ath/ath10k/usb.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-ops.h44
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-tlv.c88
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-tlv.h23
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c95
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.h98
-rw-r--r--drivers/net/wireless/ath/ath10k/wow.c20
-rw-r--r--drivers/net/wireless/ath/ath10k/wow.h13
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c12
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h14
-rw-r--r--drivers/net/wireless/ath/ath9k/common-spectral.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h8
-rw-r--r--drivers/net/wireless/ath/ath9k/debug_sta.c70
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c244
-rw-r--r--drivers/net/wireless/ath/carl9170/rx.c2
-rw-r--r--drivers/net/wireless/ath/regd.h2
-rw-r--r--drivers/net/wireless/ath/regd_common.h2
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c22
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h10
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c577
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c46
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c135
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h2
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h19
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c22
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h4
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c8
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c25
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h18
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c10
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c38
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c90
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c88
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c65
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c22
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c6
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c71
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c9
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/22000.c104
-rw-r--r--drivers/net/wireless/intel/iwlwifi/cfg/9000.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/dvm/agn.h9
-rw-r--r--drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c47
-rw-r--r--drivers/net/wireless/intel/iwlwifi/dvm/main.c19
-rw-r--r--drivers/net/wireless/intel/iwlwifi/dvm/rx.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/dvm/scan.c3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/acpi.c32
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/acpi.h22
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/alive.h48
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/commands.h5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h180
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/location.h191
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h27
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/power.h24
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/scan.h6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/tx.h18
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/dbg.c1110
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/dbg.h85
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/debugfs.c11
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/debugfs.h9
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/error-dump.h95
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/file.h25
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/img.h31
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/init.c3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/runtime.h23
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-config.h52
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-csr.h5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c23
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-debug.h5
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-drv.c77
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-eeprom-read.c47
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-io.c79
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-io.h44
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c31
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-prph.h7
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-trans.h41
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/Makefile1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/coex.c7
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/constants.h7
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/d3.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c138
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c654
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c244
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/fw.c141
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/led.c3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c124
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c292
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h61
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/ops.c63
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/power.c23
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rs.c30
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rx.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c103
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/scan.c20
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.c152
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.h3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/time-event.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tx.c27
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/utils.c31
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c16
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c115
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/internal.h30
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/rx.c118
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c28
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/trans.c213
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c8
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/tx.c30
-rw-r--r--drivers/net/wireless/intersil/orinoco/mic.c10
-rw-r--r--drivers/net/wireless/marvell/libertas_tf/cmd.c9
-rw-r--r--drivers/net/wireless/marvell/libertas_tf/if_usb.c38
-rw-r--r--drivers/net/wireless/marvell/libertas_tf/libertas_tf.h18
-rw-r--r--drivers/net/wireless/marvell/libertas_tf/main.c103
-rw-r--r--drivers/net/wireless/marvell/mwifiex/cfg80211.c23
-rw-r--r--drivers/net/wireless/marvell/mwifiex/ioctl.h1
-rw-r--r--drivers/net/wireless/marvell/mwifiex/sta_ioctl.c11
-rw-r--r--drivers/net/wireless/marvell/mwifiex/uap_event.c2
-rw-r--r--drivers/net/wireless/mediatek/mt76/Makefile3
-rw-r--r--drivers/net/wireless/mediatek/mt76/dma.c29
-rw-r--r--drivers/net/wireless/mediatek/mt76/dma.h2
-rw-r--r--drivers/net/wireless/mediatek/mt76/mac80211.c11
-rw-r--r--drivers/net/wireless/mediatek/mt76/mcu.c60
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76.h32
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c16
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h7
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/init.c39
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h4
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/pci.c19
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/phy.c11
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/usb.c26
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c6
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02.h7
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c2
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_mac.c90
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_mac.h8
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c69
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_mcu.h6
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c12
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c14
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c72
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02_util.c79
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h1
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2u.h1
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/pci.c26
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c31
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c2
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c6
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/phy.c2
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/usb.c24
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c32
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c17
-rw-r--r--drivers/net/wireless/mediatek/mt76/tx.c5
-rw-r--r--drivers/net/wireless/mediatek/mt76/usb.c162
-rw-r--r--drivers/net/wireless/mediatek/mt76/usb_mcu.c13
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/cfg80211.c40
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/commands.c29
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/commands.h2
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/event.c185
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/qlink.h36
-rw-r--r--drivers/net/wireless/ralink/rt2x00/rt2800lib.c141
-rw-r--r--drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c6
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/base.c29
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/base.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c35
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.c17
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.h17
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/cam.c27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/cam.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/core.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/core.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/debug.c25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/debug.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/efuse.c71
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/efuse.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/pci.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/pci.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/ps.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/ps.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/pwrseqcmd.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rc.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rc.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/regd.c34
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/regd.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/def.h29
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/reg.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c40
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192c/main.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c50
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h32
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/def.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.h30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c66
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.c36
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h32
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/reg.h85
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.c138
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c304
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.h30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h24
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.c42
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/reg.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c138
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.c34
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.h42
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c88
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/def.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c50
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c42
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c92
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c94
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/reg.h54
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.c27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/def.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/reg.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/def.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.h29
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.h33
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c48
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c70
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/reg.h75
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.c27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.h20
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.h27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/btc.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/def.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c34
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.h44
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/reg.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/def.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.h23
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c40
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/reg.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.c28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723com/main.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/def.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.h36
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c128
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h25
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c260
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c158
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/reg.h60
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c213
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.h28
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/stats.c27
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/stats.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/usb.c30
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/usb.h26
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/wifi.h52
-rw-r--r--drivers/net/wireless/rsi/rsi_91x_debugfs.c8
-rw-r--r--drivers/net/wireless/rsi/rsi_91x_mac80211.c41
-rw-r--r--drivers/net/wireless/rsi/rsi_91x_main.c6
-rw-r--r--drivers/net/wireless/rsi/rsi_91x_mgmt.c37
-rw-r--r--drivers/net/wireless/rsi/rsi_91x_sdio.c24
-rw-r--r--drivers/net/wireless/rsi/rsi_91x_usb.c9
-rw-r--r--drivers/net/wireless/rsi/rsi_main.h1
-rw-r--r--include/linux/ieee80211.h2
-rw-r--r--include/net/ieee80211_radiotap.h6
478 files changed, 8789 insertions, 10522 deletions
diff --git a/drivers/net/wireless/ath/ath10k/Makefile b/drivers/net/wireless/ath/ath10k/Makefile
index 66326b949ab1..142c777b287f 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -1,4 +1,4 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: ISC
2obj-$(CONFIG_ATH10K) += ath10k_core.o 2obj-$(CONFIG_ATH10K) += ath10k_core.o
3ath10k_core-y += mac.o \ 3ath10k_core-y += mac.o \
4 debug.o \ 4 debug.o \
diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
index 4cd69aca75e2..0bf726c55736 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2016-2017 Qualcomm Atheros, Inc. All rights reserved. 3 * Copyright (c) 2016-2017 Qualcomm Atheros, Inc. All rights reserved.
3 * Copyright (c) 2015 The Linux Foundation. All rights reserved. 4 * Copyright (c) 2015 The Linux Foundation. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17#include <linux/module.h> 6#include <linux/module.h>
18#include <linux/of.h> 7#include <linux/of.h>
@@ -661,7 +650,8 @@ static void ath10k_ahb_hif_stop(struct ath10k *ar)
661 ath10k_pci_flush(ar); 650 ath10k_pci_flush(ar);
662} 651}
663 652
664static int ath10k_ahb_hif_power_up(struct ath10k *ar) 653static int ath10k_ahb_hif_power_up(struct ath10k *ar,
654 enum ath10k_firmware_mode fw_mode)
665{ 655{
666 int ret; 656 int ret;
667 657
diff --git a/drivers/net/wireless/ath/ath10k/ahb.h b/drivers/net/wireless/ath/ath10k/ahb.h
index d43e375215c8..cee11a3ae2a5 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.h
+++ b/drivers/net/wireless/ath/ath10k/ahb.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2016 Qualcomm Atheros, Inc. All rights reserved. 3 * Copyright (c) 2016 Qualcomm Atheros, Inc. All rights reserved.
3 * Copyright (c) 2015 The Linux Foundation. All rights reserved. 4 * Copyright (c) 2015 The Linux Foundation. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#ifndef _AHB_H_ 7#ifndef _AHB_H_
diff --git a/drivers/net/wireless/ath/ath10k/bmi.c b/drivers/net/wireless/ath/ath10k/bmi.c
index 1750b182209b..95dc4be82e5c 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.c
+++ b/drivers/net/wireless/ath/ath10k/bmi.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2014,2016-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2014,2016-2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#include "bmi.h" 7#include "bmi.h"
diff --git a/drivers/net/wireless/ath/ath10k/bmi.h b/drivers/net/wireless/ath/ath10k/bmi.h
index 725c9afc63f2..ef3bdba43bed 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2015,2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2015,2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#ifndef _BMI_H_ 7#ifndef _BMI_H_
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 2a5668b4f6bc..cc154a81737d 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include "hif.h" 8#include "hif.h"
@@ -228,11 +217,31 @@ ath10k_ce_shadow_dest_ring_write_index_set(struct ath10k *ar,
228} 217}
229 218
230static inline void ath10k_ce_src_ring_base_addr_set(struct ath10k *ar, 219static inline void ath10k_ce_src_ring_base_addr_set(struct ath10k *ar,
231 u32 ce_ctrl_addr, 220 u32 ce_id,
232 unsigned int addr) 221 u64 addr)
222{
223 struct ath10k_ce *ce = ath10k_ce_priv(ar);
224 struct ath10k_ce_pipe *ce_state = &ce->ce_states[ce_id];
225 u32 ce_ctrl_addr = ath10k_ce_base_address(ar, ce_id);
226 u32 addr_lo = lower_32_bits(addr);
227
228 ath10k_ce_write32(ar, ce_ctrl_addr +
229 ar->hw_ce_regs->sr_base_addr_lo, addr_lo);
230
231 if (ce_state->ops->ce_set_src_ring_base_addr_hi) {
232 ce_state->ops->ce_set_src_ring_base_addr_hi(ar, ce_ctrl_addr,
233 addr);
234 }
235}
236
237static void ath10k_ce_set_src_ring_base_addr_hi(struct ath10k *ar,
238 u32 ce_ctrl_addr,
239 u64 addr)
233{ 240{
241 u32 addr_hi = upper_32_bits(addr) & CE_DESC_ADDR_HI_MASK;
242
234 ath10k_ce_write32(ar, ce_ctrl_addr + 243 ath10k_ce_write32(ar, ce_ctrl_addr +
235 ar->hw_ce_regs->sr_base_addr, addr); 244 ar->hw_ce_regs->sr_base_addr_hi, addr_hi);
236} 245}
237 246
238static inline void ath10k_ce_src_ring_size_set(struct ath10k *ar, 247static inline void ath10k_ce_src_ring_size_set(struct ath10k *ar,
@@ -313,11 +322,36 @@ static inline u32 ath10k_ce_dest_ring_read_index_get(struct ath10k *ar,
313} 322}
314 323
315static inline void ath10k_ce_dest_ring_base_addr_set(struct ath10k *ar, 324static inline void ath10k_ce_dest_ring_base_addr_set(struct ath10k *ar,
316 u32 ce_ctrl_addr, 325 u32 ce_id,
317 u32 addr) 326 u64 addr)
327{
328 struct ath10k_ce *ce = ath10k_ce_priv(ar);
329 struct ath10k_ce_pipe *ce_state = &ce->ce_states[ce_id];
330 u32 ce_ctrl_addr = ath10k_ce_base_address(ar, ce_id);
331 u32 addr_lo = lower_32_bits(addr);
332
333 ath10k_ce_write32(ar, ce_ctrl_addr +
334 ar->hw_ce_regs->dr_base_addr_lo, addr_lo);
335
336 if (ce_state->ops->ce_set_dest_ring_base_addr_hi) {
337 ce_state->ops->ce_set_dest_ring_base_addr_hi(ar, ce_ctrl_addr,
338 addr);
339 }
340}
341
342static void ath10k_ce_set_dest_ring_base_addr_hi(struct ath10k *ar,
343 u32 ce_ctrl_addr,
344 u64 addr)
318{ 345{
346 u32 addr_hi = upper_32_bits(addr) & CE_DESC_ADDR_HI_MASK;
347 u32 reg_value;
348
349 reg_value = ath10k_ce_read32(ar, ce_ctrl_addr +
350 ar->hw_ce_regs->dr_base_addr_hi);
351 reg_value &= ~CE_DESC_ADDR_HI_MASK;
352 reg_value |= addr_hi;
319 ath10k_ce_write32(ar, ce_ctrl_addr + 353 ath10k_ce_write32(ar, ce_ctrl_addr +
320 ar->hw_ce_regs->dr_base_addr, addr); 354 ar->hw_ce_regs->dr_base_addr_hi, reg_value);
321} 355}
322 356
323static inline void ath10k_ce_dest_ring_size_set(struct ath10k *ar, 357static inline void ath10k_ce_dest_ring_size_set(struct ath10k *ar,
@@ -500,14 +534,8 @@ static int _ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
500 write_index = CE_RING_IDX_INCR(nentries_mask, write_index); 534 write_index = CE_RING_IDX_INCR(nentries_mask, write_index);
501 535
502 /* WORKAROUND */ 536 /* WORKAROUND */
503 if (!(flags & CE_SEND_FLAG_GATHER)) { 537 if (!(flags & CE_SEND_FLAG_GATHER))
504 if (ar->hw_params.shadow_reg_support) 538 ath10k_ce_src_ring_write_index_set(ar, ctrl_addr, write_index);
505 ath10k_ce_shadow_src_ring_write_index_set(ar, ce_state,
506 write_index);
507 else
508 ath10k_ce_src_ring_write_index_set(ar, ctrl_addr,
509 write_index);
510 }
511 539
512 src_ring->write_index = write_index; 540 src_ring->write_index = write_index;
513exit: 541exit:
@@ -563,7 +591,7 @@ static int _ath10k_ce_send_nolock_64(struct ath10k_ce_pipe *ce_state,
563 591
564 addr = (__le32 *)&sdesc.addr; 592 addr = (__le32 *)&sdesc.addr;
565 593
566 flags |= upper_32_bits(buffer) & CE_DESC_FLAGS_GET_MASK; 594 flags |= upper_32_bits(buffer) & CE_DESC_ADDR_HI_MASK;
567 addr[0] = __cpu_to_le32(buffer); 595 addr[0] = __cpu_to_le32(buffer);
568 addr[1] = __cpu_to_le32(flags); 596 addr[1] = __cpu_to_le32(flags);
569 if (flags & CE_SEND_FLAG_GATHER) 597 if (flags & CE_SEND_FLAG_GATHER)
@@ -581,8 +609,14 @@ static int _ath10k_ce_send_nolock_64(struct ath10k_ce_pipe *ce_state,
581 /* Update Source Ring Write Index */ 609 /* Update Source Ring Write Index */
582 write_index = CE_RING_IDX_INCR(nentries_mask, write_index); 610 write_index = CE_RING_IDX_INCR(nentries_mask, write_index);
583 611
584 if (!(flags & CE_SEND_FLAG_GATHER)) 612 if (!(flags & CE_SEND_FLAG_GATHER)) {
585 ath10k_ce_src_ring_write_index_set(ar, ctrl_addr, write_index); 613 if (ar->hw_params.shadow_reg_support)
614 ath10k_ce_shadow_src_ring_write_index_set(ar, ce_state,
615 write_index);
616 else
617 ath10k_ce_src_ring_write_index_set(ar, ctrl_addr,
618 write_index);
619 }
586 620
587 src_ring->write_index = write_index; 621 src_ring->write_index = write_index;
588exit: 622exit:
@@ -731,7 +765,7 @@ static int __ath10k_ce_rx_post_buf_64(struct ath10k_ce_pipe *pipe,
731 return -ENOSPC; 765 return -ENOSPC;
732 766
733 desc->addr = __cpu_to_le64(paddr); 767 desc->addr = __cpu_to_le64(paddr);
734 desc->addr &= __cpu_to_le64(CE_DESC_37BIT_ADDR_MASK); 768 desc->addr &= __cpu_to_le64(CE_DESC_ADDR_MASK);
735 769
736 desc->nbytes = 0; 770 desc->nbytes = 0;
737 771
@@ -1346,7 +1380,7 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar,
1346 ath10k_ce_src_ring_write_index_get(ar, ctrl_addr); 1380 ath10k_ce_src_ring_write_index_get(ar, ctrl_addr);
1347 src_ring->write_index &= src_ring->nentries_mask; 1381 src_ring->write_index &= src_ring->nentries_mask;
1348 1382
1349 ath10k_ce_src_ring_base_addr_set(ar, ctrl_addr, 1383 ath10k_ce_src_ring_base_addr_set(ar, ce_id,
1350 src_ring->base_addr_ce_space); 1384 src_ring->base_addr_ce_space);
1351 ath10k_ce_src_ring_size_set(ar, ctrl_addr, nentries); 1385 ath10k_ce_src_ring_size_set(ar, ctrl_addr, nentries);
1352 ath10k_ce_src_ring_dmax_set(ar, ctrl_addr, attr->src_sz_max); 1386 ath10k_ce_src_ring_dmax_set(ar, ctrl_addr, attr->src_sz_max);
@@ -1385,7 +1419,7 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar,
1385 ath10k_ce_dest_ring_write_index_get(ar, ctrl_addr); 1419 ath10k_ce_dest_ring_write_index_get(ar, ctrl_addr);
1386 dest_ring->write_index &= dest_ring->nentries_mask; 1420 dest_ring->write_index &= dest_ring->nentries_mask;
1387 1421
1388 ath10k_ce_dest_ring_base_addr_set(ar, ctrl_addr, 1422 ath10k_ce_dest_ring_base_addr_set(ar, ce_id,
1389 dest_ring->base_addr_ce_space); 1423 dest_ring->base_addr_ce_space);
1390 ath10k_ce_dest_ring_size_set(ar, ctrl_addr, nentries); 1424 ath10k_ce_dest_ring_size_set(ar, ctrl_addr, nentries);
1391 ath10k_ce_dest_ring_byte_swap_set(ar, ctrl_addr, 0); 1425 ath10k_ce_dest_ring_byte_swap_set(ar, ctrl_addr, 0);
@@ -1404,12 +1438,12 @@ static int ath10k_ce_alloc_shadow_base(struct ath10k *ar,
1404 u32 nentries) 1438 u32 nentries)
1405{ 1439{
1406 src_ring->shadow_base_unaligned = kcalloc(nentries, 1440 src_ring->shadow_base_unaligned = kcalloc(nentries,
1407 sizeof(struct ce_desc), 1441 sizeof(struct ce_desc_64),
1408 GFP_KERNEL); 1442 GFP_KERNEL);
1409 if (!src_ring->shadow_base_unaligned) 1443 if (!src_ring->shadow_base_unaligned)
1410 return -ENOMEM; 1444 return -ENOMEM;
1411 1445
1412 src_ring->shadow_base = (struct ce_desc *) 1446 src_ring->shadow_base = (struct ce_desc_64 *)
1413 PTR_ALIGN(src_ring->shadow_base_unaligned, 1447 PTR_ALIGN(src_ring->shadow_base_unaligned,
1414 CE_DESC_RING_ALIGN); 1448 CE_DESC_RING_ALIGN);
1415 return 0; 1449 return 0;
@@ -1461,7 +1495,7 @@ ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int ce_id,
1461 ret = ath10k_ce_alloc_shadow_base(ar, src_ring, nentries); 1495 ret = ath10k_ce_alloc_shadow_base(ar, src_ring, nentries);
1462 if (ret) { 1496 if (ret) {
1463 dma_free_coherent(ar->dev, 1497 dma_free_coherent(ar->dev,
1464 (nentries * sizeof(struct ce_desc) + 1498 (nentries * sizeof(struct ce_desc_64) +
1465 CE_DESC_RING_ALIGN), 1499 CE_DESC_RING_ALIGN),
1466 src_ring->base_addr_owner_space_unaligned, 1500 src_ring->base_addr_owner_space_unaligned,
1467 base_addr); 1501 base_addr);
@@ -1554,7 +1588,8 @@ ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int ce_id,
1554 */ 1588 */
1555 dest_ring->base_addr_owner_space_unaligned = 1589 dest_ring->base_addr_owner_space_unaligned =
1556 dma_alloc_coherent(ar->dev, 1590 dma_alloc_coherent(ar->dev,
1557 (nentries * sizeof(struct ce_desc) + CE_DESC_RING_ALIGN), 1591 (nentries * sizeof(struct ce_desc) +
1592 CE_DESC_RING_ALIGN),
1558 &base_addr, GFP_KERNEL); 1593 &base_addr, GFP_KERNEL);
1559 if (!dest_ring->base_addr_owner_space_unaligned) { 1594 if (!dest_ring->base_addr_owner_space_unaligned) {
1560 kfree(dest_ring); 1595 kfree(dest_ring);
@@ -1660,7 +1695,7 @@ static void ath10k_ce_deinit_src_ring(struct ath10k *ar, unsigned int ce_id)
1660{ 1695{
1661 u32 ctrl_addr = ath10k_ce_base_address(ar, ce_id); 1696 u32 ctrl_addr = ath10k_ce_base_address(ar, ce_id);
1662 1697
1663 ath10k_ce_src_ring_base_addr_set(ar, ctrl_addr, 0); 1698 ath10k_ce_src_ring_base_addr_set(ar, ce_id, 0);
1664 ath10k_ce_src_ring_size_set(ar, ctrl_addr, 0); 1699 ath10k_ce_src_ring_size_set(ar, ctrl_addr, 0);
1665 ath10k_ce_src_ring_dmax_set(ar, ctrl_addr, 0); 1700 ath10k_ce_src_ring_dmax_set(ar, ctrl_addr, 0);
1666 ath10k_ce_src_ring_highmark_set(ar, ctrl_addr, 0); 1701 ath10k_ce_src_ring_highmark_set(ar, ctrl_addr, 0);
@@ -1670,7 +1705,7 @@ static void ath10k_ce_deinit_dest_ring(struct ath10k *ar, unsigned int ce_id)
1670{ 1705{
1671 u32 ctrl_addr = ath10k_ce_base_address(ar, ce_id); 1706 u32 ctrl_addr = ath10k_ce_base_address(ar, ce_id);
1672 1707
1673 ath10k_ce_dest_ring_base_addr_set(ar, ctrl_addr, 0); 1708 ath10k_ce_dest_ring_base_addr_set(ar, ce_id, 0);
1674 ath10k_ce_dest_ring_size_set(ar, ctrl_addr, 0); 1709 ath10k_ce_dest_ring_size_set(ar, ctrl_addr, 0);
1675 ath10k_ce_dest_ring_highmark_set(ar, ctrl_addr, 0); 1710 ath10k_ce_dest_ring_highmark_set(ar, ctrl_addr, 0);
1676} 1711}
@@ -1802,6 +1837,8 @@ static const struct ath10k_ce_ops ce_ops = {
1802 .ce_extract_desc_data = ath10k_ce_extract_desc_data, 1837 .ce_extract_desc_data = ath10k_ce_extract_desc_data,
1803 .ce_free_pipe = _ath10k_ce_free_pipe, 1838 .ce_free_pipe = _ath10k_ce_free_pipe,
1804 .ce_send_nolock = _ath10k_ce_send_nolock, 1839 .ce_send_nolock = _ath10k_ce_send_nolock,
1840 .ce_set_src_ring_base_addr_hi = NULL,
1841 .ce_set_dest_ring_base_addr_hi = NULL,
1805}; 1842};
1806 1843
1807static const struct ath10k_ce_ops ce_64_ops = { 1844static const struct ath10k_ce_ops ce_64_ops = {
@@ -1814,6 +1851,8 @@ static const struct ath10k_ce_ops ce_64_ops = {
1814 .ce_extract_desc_data = ath10k_ce_extract_desc_data_64, 1851 .ce_extract_desc_data = ath10k_ce_extract_desc_data_64,
1815 .ce_free_pipe = _ath10k_ce_free_pipe_64, 1852 .ce_free_pipe = _ath10k_ce_free_pipe_64,
1816 .ce_send_nolock = _ath10k_ce_send_nolock_64, 1853 .ce_send_nolock = _ath10k_ce_send_nolock_64,
1854 .ce_set_src_ring_base_addr_hi = ath10k_ce_set_src_ring_base_addr_hi,
1855 .ce_set_dest_ring_base_addr_hi = ath10k_ce_set_dest_ring_base_addr_hi,
1817}; 1856};
1818 1857
1819static void ath10k_ce_set_ops(struct ath10k *ar, 1858static void ath10k_ce_set_ops(struct ath10k *ar,
@@ -1909,7 +1948,7 @@ void ath10k_ce_alloc_rri(struct ath10k *ar)
1909 lower_32_bits(ce->paddr_rri)); 1948 lower_32_bits(ce->paddr_rri));
1910 ath10k_ce_write32(ar, ar->hw_ce_regs->ce_rri_high, 1949 ath10k_ce_write32(ar, ar->hw_ce_regs->ce_rri_high,
1911 (upper_32_bits(ce->paddr_rri) & 1950 (upper_32_bits(ce->paddr_rri) &
1912 CE_DESC_FLAGS_GET_MASK)); 1951 CE_DESC_ADDR_HI_MASK));
1913 1952
1914 for (i = 0; i < CE_COUNT; i++) { 1953 for (i = 0; i < CE_COUNT; i++) {
1915 ctrl1_regs = ar->hw_ce_regs->ctrl1_regs->addr; 1954 ctrl1_regs = ar->hw_ce_regs->ctrl1_regs->addr;
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index ead9987c3259..692b3a8957a9 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _CE_H_ 8#ifndef _CE_H_
@@ -39,8 +28,8 @@ struct ath10k_ce_pipe;
39#define CE_DESC_FLAGS_BYTE_SWAP (1 << 1) 28#define CE_DESC_FLAGS_BYTE_SWAP (1 << 1)
40#define CE_WCN3990_DESC_FLAGS_GATHER BIT(31) 29#define CE_WCN3990_DESC_FLAGS_GATHER BIT(31)
41 30
42#define CE_DESC_FLAGS_GET_MASK GENMASK(4, 0) 31#define CE_DESC_ADDR_MASK GENMASK_ULL(34, 0)
43#define CE_DESC_37BIT_ADDR_MASK GENMASK_ULL(37, 0) 32#define CE_DESC_ADDR_HI_MASK GENMASK(4, 0)
44 33
45/* Following desc flags are used in QCA99X0 */ 34/* Following desc flags are used in QCA99X0 */
46#define CE_DESC_FLAGS_HOST_INT_DIS (1 << 2) 35#define CE_DESC_FLAGS_HOST_INT_DIS (1 << 2)
@@ -104,7 +93,7 @@ struct ath10k_ce_ring {
104 /* Host address space */ 93 /* Host address space */
105 void *base_addr_owner_space_unaligned; 94 void *base_addr_owner_space_unaligned;
106 /* CE address space */ 95 /* CE address space */
107 u32 base_addr_ce_space_unaligned; 96 dma_addr_t base_addr_ce_space_unaligned;
108 97
109 /* 98 /*
110 * Actual start of descriptors. 99 * Actual start of descriptors.
@@ -115,10 +104,10 @@ struct ath10k_ce_ring {
115 void *base_addr_owner_space; 104 void *base_addr_owner_space;
116 105
117 /* CE address space */ 106 /* CE address space */
118 u32 base_addr_ce_space; 107 dma_addr_t base_addr_ce_space;
119 108
120 char *shadow_base_unaligned; 109 char *shadow_base_unaligned;
121 struct ce_desc *shadow_base; 110 struct ce_desc_64 *shadow_base;
122 111
123 /* keep last */ 112 /* keep last */
124 void *per_transfer_context[0]; 113 void *per_transfer_context[0];
@@ -334,6 +323,12 @@ struct ath10k_ce_ops {
334 void *per_transfer_context, 323 void *per_transfer_context,
335 dma_addr_t buffer, u32 nbytes, 324 dma_addr_t buffer, u32 nbytes,
336 u32 transfer_id, u32 flags); 325 u32 transfer_id, u32 flags);
326 void (*ce_set_src_ring_base_addr_hi)(struct ath10k *ar,
327 u32 ce_ctrl_addr,
328 u64 addr);
329 void (*ce_set_dest_ring_base_addr_hi)(struct ath10k *ar,
330 u32 ce_ctrl_addr,
331 u64 addr);
337}; 332};
338 333
339static inline u32 ath10k_ce_base_address(struct ath10k *ar, unsigned int ce_id) 334static inline u32 ath10k_ce_base_address(struct ath10k *ar, unsigned int ce_id)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index e8891f5fc83a..ac2cf3f1c7b4 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include <linux/module.h> 8#include <linux/module.h>
@@ -561,7 +550,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
561 .hw_ops = &wcn3990_ops, 550 .hw_ops = &wcn3990_ops,
562 .decap_align_bytes = 1, 551 .decap_align_bytes = 1,
563 .num_peers = TARGET_HL_10_TLV_NUM_PEERS, 552 .num_peers = TARGET_HL_10_TLV_NUM_PEERS,
564 .n_cipher_suites = 8, 553 .n_cipher_suites = 11,
565 .ast_skid_limit = TARGET_HL_10_TLV_AST_SKID_LIMIT, 554 .ast_skid_limit = TARGET_HL_10_TLV_AST_SKID_LIMIT,
566 .num_wds_entries = TARGET_HL_10_TLV_NUM_WDS_ENTRIES, 555 .num_wds_entries = TARGET_HL_10_TLV_NUM_WDS_ENTRIES,
567 .target_64bit = true, 556 .target_64bit = true,
@@ -2309,7 +2298,11 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
2309 ar->max_num_stations = TARGET_TLV_NUM_STATIONS; 2298 ar->max_num_stations = TARGET_TLV_NUM_STATIONS;
2310 ar->max_num_vdevs = TARGET_TLV_NUM_VDEVS; 2299 ar->max_num_vdevs = TARGET_TLV_NUM_VDEVS;
2311 ar->max_num_tdls_vdevs = TARGET_TLV_NUM_TDLS_VDEVS; 2300 ar->max_num_tdls_vdevs = TARGET_TLV_NUM_TDLS_VDEVS;
2312 ar->htt.max_num_pending_tx = TARGET_TLV_NUM_MSDU_DESC; 2301 if (ar->hif.bus == ATH10K_BUS_SDIO)
2302 ar->htt.max_num_pending_tx =
2303 TARGET_TLV_NUM_MSDU_DESC_HL;
2304 else
2305 ar->htt.max_num_pending_tx = TARGET_TLV_NUM_MSDU_DESC;
2313 ar->wow.max_num_patterns = TARGET_TLV_NUM_WOW_PATTERNS; 2306 ar->wow.max_num_patterns = TARGET_TLV_NUM_WOW_PATTERNS;
2314 ar->fw_stats_req_mask = WMI_STAT_PDEV | WMI_STAT_VDEV | 2307 ar->fw_stats_req_mask = WMI_STAT_PDEV | WMI_STAT_VDEV |
2315 WMI_STAT_PEER; 2308 WMI_STAT_PEER;
@@ -2556,6 +2549,12 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
2556 goto err_hif_stop; 2549 goto err_hif_stop;
2557 } 2550 }
2558 2551
2552 status = ath10k_hif_swap_mailbox(ar);
2553 if (status) {
2554 ath10k_err(ar, "failed to swap mailbox: %d\n", status);
2555 goto err_hif_stop;
2556 }
2557
2559 if (mode == ATH10K_FIRMWARE_MODE_NORMAL) { 2558 if (mode == ATH10K_FIRMWARE_MODE_NORMAL) {
2560 status = ath10k_htt_connect(&ar->htt); 2559 status = ath10k_htt_connect(&ar->htt);
2561 if (status) { 2560 if (status) {
@@ -2621,6 +2620,9 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
2621 ar->wmi.svc_map)) 2620 ar->wmi.svc_map))
2622 val |= WMI_10_4_TX_DATA_ACK_RSSI; 2621 val |= WMI_10_4_TX_DATA_ACK_RSSI;
2623 2622
2623 if (test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map))
2624 val |= WMI_10_4_REPORT_AIRTIME;
2625
2624 status = ath10k_mac_ext_resource_config(ar, val); 2626 status = ath10k_mac_ext_resource_config(ar, val);
2625 if (status) { 2627 if (status) {
2626 ath10k_err(ar, 2628 ath10k_err(ar,
@@ -2649,6 +2651,13 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
2649 goto err_hif_stop; 2651 goto err_hif_stop;
2650 } 2652 }
2651 2653
2654 status = ath10k_wmi_pdev_set_base_macaddr(ar, ar->mac_addr);
2655 if (status && status != -EOPNOTSUPP) {
2656 ath10k_err(ar,
2657 "failed to set base mac address: %d\n", status);
2658 goto err_hif_stop;
2659 }
2660
2652 /* Some firmware revisions do not properly set up hardware rx filter 2661 /* Some firmware revisions do not properly set up hardware rx filter
2653 * registers. 2662 * registers.
2654 * 2663 *
@@ -2763,7 +2772,7 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
2763 struct bmi_target_info target_info; 2772 struct bmi_target_info target_info;
2764 int ret = 0; 2773 int ret = 0;
2765 2774
2766 ret = ath10k_hif_power_up(ar); 2775 ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_NORMAL);
2767 if (ret) { 2776 if (ret) {
2768 ath10k_err(ar, "could not power on hif bus (%d)\n", ret); 2777 ath10k_err(ar, "could not power on hif bus (%d)\n", ret);
2769 return ret; 2778 return ret;
@@ -2977,8 +2986,8 @@ err:
2977int ath10k_core_register(struct ath10k *ar, 2986int ath10k_core_register(struct ath10k *ar,
2978 const struct ath10k_bus_params *bus_params) 2987 const struct ath10k_bus_params *bus_params)
2979{ 2988{
2980 ar->chip_id = bus_params->chip_id; 2989 ar->bus_param = *bus_params;
2981 ar->dev_type = bus_params->dev_type; 2990
2982 queue_work(ar->workqueue, &ar->register_work); 2991 queue_work(ar->workqueue, &ar->register_work);
2983 2992
2984 return 0; 2993 return 0;
@@ -3098,9 +3107,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
3098 3107
3099 mutex_init(&ar->conf_mutex); 3108 mutex_init(&ar->conf_mutex);
3100 spin_lock_init(&ar->data_lock); 3109 spin_lock_init(&ar->data_lock);
3101 spin_lock_init(&ar->txqs_lock);
3102 3110
3103 INIT_LIST_HEAD(&ar->txqs);
3104 INIT_LIST_HEAD(&ar->peers); 3111 INIT_LIST_HEAD(&ar->peers);
3105 init_waitqueue_head(&ar->peer_mapping_wq); 3112 init_waitqueue_head(&ar->peer_mapping_wq);
3106 init_waitqueue_head(&ar->htt.empty_tx_wq); 3113 init_waitqueue_head(&ar->htt.empty_tx_wq);
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 46e9c8c97a4d..27ec5557de88 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _CORE_H_ 8#ifndef _CORE_H_
@@ -90,6 +79,9 @@
90/* The magic used by QCA spec */ 79/* The magic used by QCA spec */
91#define ATH10K_SMBIOS_BDF_EXT_MAGIC "BDF_" 80#define ATH10K_SMBIOS_BDF_EXT_MAGIC "BDF_"
92 81
82/* Default Airtime weight multipler (Tuned for multiclient performance) */
83#define ATH10K_AIRTIME_WEIGHT_MULTIPLIER 4
84
93struct ath10k; 85struct ath10k;
94 86
95static inline const char *ath10k_bus_str(enum ath10k_bus bus) 87static inline const char *ath10k_bus_str(enum ath10k_bus bus)
@@ -116,6 +108,7 @@ enum ath10k_skb_flags {
116 ATH10K_SKB_F_DELIVER_CAB = BIT(2), 108 ATH10K_SKB_F_DELIVER_CAB = BIT(2),
117 ATH10K_SKB_F_MGMT = BIT(3), 109 ATH10K_SKB_F_MGMT = BIT(3),
118 ATH10K_SKB_F_QOS = BIT(4), 110 ATH10K_SKB_F_QOS = BIT(4),
111 ATH10K_SKB_F_RAW_TX = BIT(5),
119}; 112};
120 113
121struct ath10k_skb_cb { 114struct ath10k_skb_cb {
@@ -123,6 +116,7 @@ struct ath10k_skb_cb {
123 u8 flags; 116 u8 flags;
124 u8 eid; 117 u8 eid;
125 u16 msdu_id; 118 u16 msdu_id;
119 u16 airtime_est;
126 struct ieee80211_vif *vif; 120 struct ieee80211_vif *vif;
127 struct ieee80211_txq *txq; 121 struct ieee80211_txq *txq;
128} __packed; 122} __packed;
@@ -443,14 +437,14 @@ enum ath10k_amsdu_subfrm_num {
443}; 437};
444 438
445struct ath10k_sta_tid_stats { 439struct ath10k_sta_tid_stats {
446 unsigned long int rx_pkt_from_fw; 440 unsigned long rx_pkt_from_fw;
447 unsigned long int rx_pkt_unchained; 441 unsigned long rx_pkt_unchained;
448 unsigned long int rx_pkt_drop_chained; 442 unsigned long rx_pkt_drop_chained;
449 unsigned long int rx_pkt_drop_filter; 443 unsigned long rx_pkt_drop_filter;
450 unsigned long int rx_pkt_err[ATH10K_PKT_RX_ERR_MAX]; 444 unsigned long rx_pkt_err[ATH10K_PKT_RX_ERR_MAX];
451 unsigned long int rx_pkt_queued_for_mac; 445 unsigned long rx_pkt_queued_for_mac;
452 unsigned long int rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_MAX]; 446 unsigned long rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_MAX];
453 unsigned long int rx_pkt_amsdu[ATH10K_AMSDU_SUBFRM_NUM_MAX]; 447 unsigned long rx_pkt_amsdu[ATH10K_AMSDU_SUBFRM_NUM_MAX];
454}; 448};
455 449
456enum ath10k_counter_type { 450enum ath10k_counter_type {
@@ -495,6 +489,7 @@ struct ath10k_sta {
495 u16 peer_id; 489 u16 peer_id;
496 struct rate_info txrate; 490 struct rate_info txrate;
497 struct ieee80211_tx_info tx_info; 491 struct ieee80211_tx_info tx_info;
492 u32 last_tx_bitrate;
498 493
499 struct work_struct update_wk; 494 struct work_struct update_wk;
500 u64 rx_duration; 495 u64 rx_duration;
@@ -571,6 +566,7 @@ struct ath10k_vif {
571 bool nohwcrypt; 566 bool nohwcrypt;
572 int num_legacy_stations; 567 int num_legacy_stations;
573 int txpower; 568 int txpower;
569 bool ftm_responder;
574 struct wmi_wmm_params_all_arg wmm_params; 570 struct wmi_wmm_params_all_arg wmm_params;
575 struct work_struct ap_csa_work; 571 struct work_struct ap_csa_work;
576 struct delayed_work connection_loss_work; 572 struct delayed_work connection_loss_work;
@@ -922,6 +918,7 @@ enum ath10k_dev_type {
922struct ath10k_bus_params { 918struct ath10k_bus_params {
923 u32 chip_id; 919 u32 chip_id;
924 enum ath10k_dev_type dev_type; 920 enum ath10k_dev_type dev_type;
921 bool link_can_suspend;
925}; 922};
926 923
927struct ath10k { 924struct ath10k {
@@ -1068,10 +1065,7 @@ struct ath10k {
1068 1065
1069 /* protects shared structure data */ 1066 /* protects shared structure data */
1070 spinlock_t data_lock; 1067 spinlock_t data_lock;
1071 /* protects: ar->txqs, artxq->list */
1072 spinlock_t txqs_lock;
1073 1068
1074 struct list_head txqs;
1075 struct list_head arvifs; 1069 struct list_head arvifs;
1076 struct list_head peers; 1070 struct list_head peers;
1077 struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS]; 1071 struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS];
@@ -1182,6 +1176,7 @@ struct ath10k {
1182 1176
1183 u32 ampdu_reference; 1177 u32 ampdu_reference;
1184 1178
1179 const u8 *wmi_key_cipher;
1185 void *ce_priv; 1180 void *ce_priv;
1186 1181
1187 u32 sta_tid_stats_mask; 1182 u32 sta_tid_stats_mask;
@@ -1190,6 +1185,7 @@ struct ath10k {
1190 enum ath10k_radar_confirmation_state radar_conf_state; 1185 enum ath10k_radar_confirmation_state radar_conf_state;
1191 struct ath10k_radar_found_info last_radar_info; 1186 struct ath10k_radar_found_info last_radar_info;
1192 struct work_struct radar_confirmation_work; 1187 struct work_struct radar_confirmation_work;
1188 struct ath10k_bus_params bus_param;
1193 1189
1194 /* must be last */ 1190 /* must be last */
1195 u8 drv_priv[0] __aligned(sizeof(void *)); 1191 u8 drv_priv[0] __aligned(sizeof(void *));
diff --git a/drivers/net/wireless/ath/ath10k/coredump.c b/drivers/net/wireless/ath/ath10k/coredump.c
index eadae2f9206b..33838d9c1cb6 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.c
+++ b/drivers/net/wireless/ath/ath10k/coredump.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
3 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#include "coredump.h" 7#include "coredump.h"
@@ -1167,7 +1156,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
1167 dump_data->version = cpu_to_le32(ATH10K_FW_CRASH_DUMP_VERSION); 1156 dump_data->version = cpu_to_le32(ATH10K_FW_CRASH_DUMP_VERSION);
1168 1157
1169 guid_copy(&dump_data->guid, &crash_data->guid); 1158 guid_copy(&dump_data->guid, &crash_data->guid);
1170 dump_data->chip_id = cpu_to_le32(ar->chip_id); 1159 dump_data->chip_id = cpu_to_le32(ar->bus_param.chip_id);
1171 dump_data->bus_type = cpu_to_le32(0); 1160 dump_data->bus_type = cpu_to_le32(0);
1172 dump_data->target_version = cpu_to_le32(ar->target_version); 1161 dump_data->target_version = cpu_to_le32(ar->target_version);
1173 dump_data->fw_version_major = cpu_to_le32(ar->fw_version_major); 1162 dump_data->fw_version_major = cpu_to_le32(ar->fw_version_major);
diff --git a/drivers/net/wireless/ath/ath10k/coredump.h b/drivers/net/wireless/ath/ath10k/coredump.h
index 5dac653e1649..09de41922f97 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.h
+++ b/drivers/net/wireless/ath/ath10k/coredump.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#ifndef _COREDUMP_H_ 6#ifndef _COREDUMP_H_
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 02988fc378a1..1b8903280d42 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include <linux/module.h> 8#include <linux/module.h>
@@ -58,7 +47,7 @@ void ath10k_debug_print_hwfw_info(struct ath10k *ar)
58 ath10k_info(ar, "%s target 0x%08x chip_id 0x%08x sub %04x:%04x", 47 ath10k_info(ar, "%s target 0x%08x chip_id 0x%08x sub %04x:%04x",
59 ar->hw_params.name, 48 ar->hw_params.name,
60 ar->target_version, 49 ar->target_version,
61 ar->chip_id, 50 ar->bus_param.chip_id,
62 ar->id.subsystem_vendor, ar->id.subsystem_device); 51 ar->id.subsystem_vendor, ar->id.subsystem_device);
63 52
64 ath10k_info(ar, "kconfig debug %d debugfs %d tracing %d dfs %d testmode %d\n", 53 ath10k_info(ar, "kconfig debug %d debugfs %d tracing %d dfs %d testmode %d\n",
@@ -625,7 +614,7 @@ static ssize_t ath10k_read_chip_id(struct file *file, char __user *user_buf,
625 size_t len; 614 size_t len;
626 char buf[50]; 615 char buf[50];
627 616
628 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->chip_id); 617 len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->bus_param.chip_id);
629 618
630 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 619 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
631} 620}
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index 5cf16d690724..db78e855a80f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _DEBUG_H_ 8#ifndef _DEBUG_H_
@@ -213,12 +202,12 @@ void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
213void ath10k_sta_update_rx_duration(struct ath10k *ar, 202void ath10k_sta_update_rx_duration(struct ath10k *ar,
214 struct ath10k_fw_stats *stats); 203 struct ath10k_fw_stats *stats);
215void ath10k_sta_update_rx_tid_stats(struct ath10k *ar, u8 *first_hdr, 204void ath10k_sta_update_rx_tid_stats(struct ath10k *ar, u8 *first_hdr,
216 unsigned long int num_msdus, 205 unsigned long num_msdus,
217 enum ath10k_pkt_rx_err err, 206 enum ath10k_pkt_rx_err err,
218 unsigned long int unchain_cnt, 207 unsigned long unchain_cnt,
219 unsigned long int drop_cnt, 208 unsigned long drop_cnt,
220 unsigned long int drop_cnt_filter, 209 unsigned long drop_cnt_filter,
221 unsigned long int queued_msdus); 210 unsigned long queued_msdus);
222void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar, 211void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar,
223 u16 peer_id, u8 tid, 212 u16 peer_id, u8 tid,
224 struct htt_rx_indication_mpdu_range *ranges, 213 struct htt_rx_indication_mpdu_range *ranges,
@@ -232,12 +221,12 @@ void ath10k_sta_update_rx_duration(struct ath10k *ar,
232 221
233static inline 222static inline
234void ath10k_sta_update_rx_tid_stats(struct ath10k *ar, u8 *first_hdr, 223void ath10k_sta_update_rx_tid_stats(struct ath10k *ar, u8 *first_hdr,
235 unsigned long int num_msdus, 224 unsigned long num_msdus,
236 enum ath10k_pkt_rx_err err, 225 enum ath10k_pkt_rx_err err,
237 unsigned long int unchain_cnt, 226 unsigned long unchain_cnt,
238 unsigned long int drop_cnt, 227 unsigned long drop_cnt,
239 unsigned long int drop_cnt_filter, 228 unsigned long drop_cnt_filter,
240 unsigned long int queued_msdus) 229 unsigned long queued_msdus)
241{ 230{
242} 231}
243 232
diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 4778a455d81a..8331d8b09987 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
3 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#include "core.h" 7#include "core.h"
@@ -87,12 +76,12 @@ out:
87} 76}
88 77
89void ath10k_sta_update_rx_tid_stats(struct ath10k *ar, u8 *first_hdr, 78void ath10k_sta_update_rx_tid_stats(struct ath10k *ar, u8 *first_hdr,
90 unsigned long int num_msdus, 79 unsigned long num_msdus,
91 enum ath10k_pkt_rx_err err, 80 enum ath10k_pkt_rx_err err,
92 unsigned long int unchain_cnt, 81 unsigned long unchain_cnt,
93 unsigned long int drop_cnt, 82 unsigned long drop_cnt,
94 unsigned long int drop_cnt_filter, 83 unsigned long drop_cnt_filter,
95 unsigned long int queued_msdus) 84 unsigned long queued_msdus)
96{ 85{
97 struct ieee80211_sta *sta; 86 struct ieee80211_sta *sta;
98 struct ath10k_sta *arsta; 87 struct ath10k_sta *arsta;
diff --git a/drivers/net/wireless/ath/ath10k/hif.h b/drivers/net/wireless/ath/ath10k/hif.h
index 1a59ea0068c2..fe5417962f40 100644
--- a/drivers/net/wireless/ath/ath10k/hif.h
+++ b/drivers/net/wireless/ath/ath10k/hif.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2015,2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2015,2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#ifndef _HIF_H_ 7#ifndef _HIF_H_
@@ -59,6 +48,8 @@ struct ath10k_hif_ops {
59 */ 48 */
60 void (*stop)(struct ath10k *ar); 49 void (*stop)(struct ath10k *ar);
61 50
51 int (*swap_mailbox)(struct ath10k *ar);
52
62 int (*map_service_to_pipe)(struct ath10k *ar, u16 service_id, 53 int (*map_service_to_pipe)(struct ath10k *ar, u16 service_id,
63 u8 *ul_pipe, u8 *dl_pipe); 54 u8 *ul_pipe, u8 *dl_pipe);
64 55
@@ -81,7 +72,7 @@ struct ath10k_hif_ops {
81 void (*write32)(struct ath10k *ar, u32 address, u32 value); 72 void (*write32)(struct ath10k *ar, u32 address, u32 value);
82 73
83 /* Power up the device and enter BMI transfer mode for FW download */ 74 /* Power up the device and enter BMI transfer mode for FW download */
84 int (*power_up)(struct ath10k *ar); 75 int (*power_up)(struct ath10k *ar, enum ath10k_firmware_mode fw_mode);
85 76
86 /* Power down the device and free up resources. stop() must be called 77 /* Power down the device and free up resources. stop() must be called
87 * before this if start() was called earlier 78 * before this if start() was called earlier
@@ -139,6 +130,13 @@ static inline void ath10k_hif_stop(struct ath10k *ar)
139 return ar->hif.ops->stop(ar); 130 return ar->hif.ops->stop(ar);
140} 131}
141 132
133static inline int ath10k_hif_swap_mailbox(struct ath10k *ar)
134{
135 if (ar->hif.ops->swap_mailbox)
136 return ar->hif.ops->swap_mailbox(ar);
137 return 0;
138}
139
142static inline int ath10k_hif_map_service_to_pipe(struct ath10k *ar, 140static inline int ath10k_hif_map_service_to_pipe(struct ath10k *ar,
143 u16 service_id, 141 u16 service_id,
144 u8 *ul_pipe, u8 *dl_pipe) 142 u8 *ul_pipe, u8 *dl_pipe)
@@ -165,9 +163,10 @@ static inline u16 ath10k_hif_get_free_queue_number(struct ath10k *ar,
165 return ar->hif.ops->get_free_queue_number(ar, pipe_id); 163 return ar->hif.ops->get_free_queue_number(ar, pipe_id);
166} 164}
167 165
168static inline int ath10k_hif_power_up(struct ath10k *ar) 166static inline int ath10k_hif_power_up(struct ath10k *ar,
167 enum ath10k_firmware_mode fw_mode)
169{ 168{
170 return ar->hif.ops->power_up(ar); 169 return ar->hif.ops->power_up(ar, fw_mode);
171} 170}
172 171
173static inline void ath10k_hif_power_down(struct ath10k *ar) 172static inline void ath10k_hif_power_down(struct ath10k *ar)
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 28daed5981a1..805a7f8a04f2 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#include "core.h" 7#include "core.h"
@@ -53,7 +42,7 @@ static inline void ath10k_htc_restore_tx_skb(struct ath10k_htc *htc,
53{ 42{
54 struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); 43 struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
55 44
56 if (htc->ar->dev_type != ATH10K_DEV_TYPE_HL) 45 if (htc->ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL)
57 dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); 46 dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE);
58 skb_pull(skb, sizeof(struct ath10k_htc_hdr)); 47 skb_pull(skb, sizeof(struct ath10k_htc_hdr));
59} 48}
@@ -88,7 +77,8 @@ static void ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep *ep,
88 hdr->eid = ep->eid; 77 hdr->eid = ep->eid;
89 hdr->len = __cpu_to_le16(skb->len - sizeof(*hdr)); 78 hdr->len = __cpu_to_le16(skb->len - sizeof(*hdr));
90 hdr->flags = 0; 79 hdr->flags = 0;
91 hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE; 80 if (ep->tx_credit_flow_enabled)
81 hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
92 82
93 spin_lock_bh(&ep->htc->tx_lock); 83 spin_lock_bh(&ep->htc->tx_lock);
94 hdr->seq_no = ep->seq_no++; 84 hdr->seq_no = ep->seq_no++;
@@ -138,7 +128,7 @@ int ath10k_htc_send(struct ath10k_htc *htc,
138 ath10k_htc_prepare_tx_skb(ep, skb); 128 ath10k_htc_prepare_tx_skb(ep, skb);
139 129
140 skb_cb->eid = eid; 130 skb_cb->eid = eid;
141 if (ar->dev_type != ATH10K_DEV_TYPE_HL) { 131 if (ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL) {
142 skb_cb->paddr = dma_map_single(dev, skb->data, skb->len, 132 skb_cb->paddr = dma_map_single(dev, skb->data, skb->len,
143 DMA_TO_DEVICE); 133 DMA_TO_DEVICE);
144 ret = dma_mapping_error(dev, skb_cb->paddr); 134 ret = dma_mapping_error(dev, skb_cb->paddr);
@@ -161,7 +151,7 @@ int ath10k_htc_send(struct ath10k_htc *htc,
161 return 0; 151 return 0;
162 152
163err_unmap: 153err_unmap:
164 if (ar->dev_type != ATH10K_DEV_TYPE_HL) 154 if (ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL)
165 dma_unmap_single(dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); 155 dma_unmap_single(dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE);
166err_credits: 156err_credits:
167 if (ep->tx_credit_flow_enabled) { 157 if (ep->tx_credit_flow_enabled) {
diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 51fda6c23f69..f55d3caec61f 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#ifndef _HTC_H_ 7#ifndef _HTC_H_
@@ -51,7 +40,6 @@ struct ath10k;
51 */ 40 */
52 41
53#define HTC_HOST_MAX_MSG_PER_RX_BUNDLE 8 42#define HTC_HOST_MAX_MSG_PER_RX_BUNDLE 8
54#define HTC_HOST_MAX_MSG_PER_TX_BUNDLE 16
55 43
56enum ath10k_htc_tx_flags { 44enum ath10k_htc_tx_flags {
57 ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE = 0x01, 45 ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE = 0x01,
diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c
index 21a67f82f037..d235ff3098e8 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#include <linux/slab.h> 7#include <linux/slab.h>
@@ -268,7 +257,7 @@ int ath10k_htt_setup(struct ath10k_htt *htt)
268 return status; 257 return status;
269 } 258 }
270 259
271 status = ath10k_htt_h2t_aggr_cfg_msg(htt, 260 status = htt->tx_ops->htt_h2t_aggr_cfg_msg(htt,
272 htt->max_num_ampdu, 261 htt->max_num_ampdu,
273 htt->max_num_amsdu); 262 htt->max_num_amsdu);
274 if (status) { 263 if (status) {
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index a76f7c9e2199..fef716aa8f3a 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _HTT_H_ 8#ifndef _HTT_H_
@@ -357,6 +346,13 @@ struct htt_aggr_conf {
357 u8 max_num_amsdu_subframes; 346 u8 max_num_amsdu_subframes;
358} __packed; 347} __packed;
359 348
349struct htt_aggr_conf_v2 {
350 u8 max_num_ampdu_subframes;
351 /* amsdu_subframes is limited by 0x1F mask */
352 u8 max_num_amsdu_subframes;
353 u8 reserved;
354} __packed;
355
360#define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32 356#define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32
361struct htt_mgmt_tx_desc_qca99x0 { 357struct htt_mgmt_tx_desc_qca99x0 {
362 __le32 rate; 358 __le32 rate;
@@ -564,6 +560,7 @@ struct htt_mgmt_tx_completion {
564#define HTT_RX_INDICATION_INFO0_EXT_TID_LSB (0) 560#define HTT_RX_INDICATION_INFO0_EXT_TID_LSB (0)
565#define HTT_RX_INDICATION_INFO0_FLUSH_VALID (1 << 5) 561#define HTT_RX_INDICATION_INFO0_FLUSH_VALID (1 << 5)
566#define HTT_RX_INDICATION_INFO0_RELEASE_VALID (1 << 6) 562#define HTT_RX_INDICATION_INFO0_RELEASE_VALID (1 << 6)
563#define HTT_RX_INDICATION_INFO0_PPDU_DURATION BIT(7)
567 564
568#define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_MASK 0x0000003F 565#define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_MASK 0x0000003F
569#define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_LSB 0 566#define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_LSB 0
@@ -576,7 +573,10 @@ struct htt_mgmt_tx_completion {
576#define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_MASK 0xFF000000 573#define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_MASK 0xFF000000
577#define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_LSB 24 574#define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_LSB 24
578 575
579#define HTT_TX_CMPL_FLAG_DATA_RSSI BIT(0) 576#define HTT_TX_CMPL_FLAG_DATA_RSSI BIT(0)
577#define HTT_TX_CMPL_FLAG_PPID_PRESENT BIT(1)
578#define HTT_TX_CMPL_FLAG_PA_PRESENT BIT(2)
579#define HTT_TX_CMPL_FLAG_PPDU_DURATION_PRESENT BIT(3)
580 580
581struct htt_rx_indication_hdr { 581struct htt_rx_indication_hdr {
582 u8 info0; /* %HTT_RX_INDICATION_INFO0_ */ 582 u8 info0; /* %HTT_RX_INDICATION_INFO0_ */
@@ -866,6 +866,21 @@ struct htt_data_tx_completion {
866 __le16 msdus[0]; /* variable length based on %num_msdus */ 866 __le16 msdus[0]; /* variable length based on %num_msdus */
867} __packed; 867} __packed;
868 868
869#define HTT_TX_PPDU_DUR_INFO0_PEER_ID_MASK GENMASK(15, 0)
870#define HTT_TX_PPDU_DUR_INFO0_TID_MASK GENMASK(20, 16)
871
872struct htt_data_tx_ppdu_dur {
873 __le32 info0; /* HTT_TX_PPDU_DUR_INFO0_ */
874 __le32 tx_duration; /* in usecs */
875} __packed;
876
877#define HTT_TX_COMPL_PPDU_DUR_INFO0_NUM_ENTRIES_MASK GENMASK(7, 0)
878
879struct htt_data_tx_compl_ppdu_dur {
880 __le32 info0; /* HTT_TX_COMPL_PPDU_DUR_INFO0_ */
881 struct htt_data_tx_ppdu_dur ppdu_dur[0];
882} __packed;
883
869struct htt_tx_compl_ind_base { 884struct htt_tx_compl_ind_base {
870 u32 hdr; 885 u32 hdr;
871 u16 payload[1/*or more*/]; 886 u16 payload[1/*or more*/];
@@ -1650,6 +1665,7 @@ struct htt_cmd {
1650 struct htt_stats_req stats_req; 1665 struct htt_stats_req stats_req;
1651 struct htt_oob_sync_req oob_sync_req; 1666 struct htt_oob_sync_req oob_sync_req;
1652 struct htt_aggr_conf aggr_conf; 1667 struct htt_aggr_conf aggr_conf;
1668 struct htt_aggr_conf_v2 aggr_conf_v2;
1653 struct htt_frag_desc_bank_cfg32 frag_desc_bank_cfg32; 1669 struct htt_frag_desc_bank_cfg32 frag_desc_bank_cfg32;
1654 struct htt_frag_desc_bank_cfg64 frag_desc_bank_cfg64; 1670 struct htt_frag_desc_bank_cfg64 frag_desc_bank_cfg64;
1655 struct htt_tx_fetch_resp tx_fetch_resp; 1671 struct htt_tx_fetch_resp tx_fetch_resp;
@@ -1716,14 +1732,14 @@ struct ath10k_htt_txbuf_32 {
1716 struct ath10k_htc_hdr htc_hdr; 1732 struct ath10k_htc_hdr htc_hdr;
1717 struct htt_cmd_hdr cmd_hdr; 1733 struct htt_cmd_hdr cmd_hdr;
1718 struct htt_data_tx_desc cmd_tx; 1734 struct htt_data_tx_desc cmd_tx;
1719} __packed; 1735} __packed __aligned(4);
1720 1736
1721struct ath10k_htt_txbuf_64 { 1737struct ath10k_htt_txbuf_64 {
1722 struct htt_data_tx_desc_frag frags[2]; 1738 struct htt_data_tx_desc_frag frags[2];
1723 struct ath10k_htc_hdr htc_hdr; 1739 struct ath10k_htc_hdr htc_hdr;
1724 struct htt_cmd_hdr cmd_hdr; 1740 struct htt_cmd_hdr cmd_hdr;
1725 struct htt_data_tx_desc_64 cmd_tx; 1741 struct htt_data_tx_desc_64 cmd_tx;
1726} __packed; 1742} __packed __aligned(4);
1727 1743
1728struct ath10k_htt { 1744struct ath10k_htt {
1729 struct ath10k *ar; 1745 struct ath10k *ar;
@@ -1890,6 +1906,9 @@ struct ath10k_htt_tx_ops {
1890 struct sk_buff *msdu); 1906 struct sk_buff *msdu);
1891 int (*htt_alloc_txbuff)(struct ath10k_htt *htt); 1907 int (*htt_alloc_txbuff)(struct ath10k_htt *htt);
1892 void (*htt_free_txbuff)(struct ath10k_htt *htt); 1908 void (*htt_free_txbuff)(struct ath10k_htt *htt);
1909 int (*htt_h2t_aggr_cfg_msg)(struct ath10k_htt *htt,
1910 u8 max_subfrms_ampdu,
1911 u8 max_subfrms_amsdu);
1893}; 1912};
1894 1913
1895static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt) 1914static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt)
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index f42bac204ef8..4fc885617de1 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include "core.h" 8#include "core.h"
@@ -265,7 +254,7 @@ int ath10k_htt_rx_ring_refill(struct ath10k *ar)
265 struct ath10k_htt *htt = &ar->htt; 254 struct ath10k_htt *htt = &ar->htt;
266 int ret; 255 int ret;
267 256
268 if (ar->dev_type == ATH10K_DEV_TYPE_HL) 257 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
269 return 0; 258 return 0;
270 259
271 spin_lock_bh(&htt->rx_ring.lock); 260 spin_lock_bh(&htt->rx_ring.lock);
@@ -282,7 +271,7 @@ int ath10k_htt_rx_ring_refill(struct ath10k *ar)
282 271
283void ath10k_htt_rx_free(struct ath10k_htt *htt) 272void ath10k_htt_rx_free(struct ath10k_htt *htt)
284{ 273{
285 if (htt->ar->dev_type == ATH10K_DEV_TYPE_HL) 274 if (htt->ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
286 return; 275 return;
287 276
288 del_timer_sync(&htt->rx_ring.refill_retry_timer); 277 del_timer_sync(&htt->rx_ring.refill_retry_timer);
@@ -760,7 +749,7 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt)
760 size_t size; 749 size_t size;
761 struct timer_list *timer = &htt->rx_ring.refill_retry_timer; 750 struct timer_list *timer = &htt->rx_ring.refill_retry_timer;
762 751
763 if (ar->dev_type == ATH10K_DEV_TYPE_HL) 752 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
764 return 0; 753 return 0;
765 754
766 htt->rx_confused = false; 755 htt->rx_confused = false;
@@ -1905,7 +1894,7 @@ static void ath10k_htt_rx_h_enqueue(struct ath10k *ar,
1905} 1894}
1906 1895
1907static int ath10k_unchain_msdu(struct sk_buff_head *amsdu, 1896static int ath10k_unchain_msdu(struct sk_buff_head *amsdu,
1908 unsigned long int *unchain_cnt) 1897 unsigned long *unchain_cnt)
1909{ 1898{
1910 struct sk_buff *skb, *first; 1899 struct sk_buff *skb, *first;
1911 int space; 1900 int space;
@@ -1954,8 +1943,8 @@ static int ath10k_unchain_msdu(struct sk_buff_head *amsdu,
1954 1943
1955static void ath10k_htt_rx_h_unchain(struct ath10k *ar, 1944static void ath10k_htt_rx_h_unchain(struct ath10k *ar,
1956 struct sk_buff_head *amsdu, 1945 struct sk_buff_head *amsdu,
1957 unsigned long int *drop_cnt, 1946 unsigned long *drop_cnt,
1958 unsigned long int *unchain_cnt) 1947 unsigned long *unchain_cnt)
1959{ 1948{
1960 struct sk_buff *first; 1949 struct sk_buff *first;
1961 struct htt_rx_desc *rxd; 1950 struct htt_rx_desc *rxd;
@@ -2005,7 +1994,7 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
2005static void ath10k_htt_rx_h_filter(struct ath10k *ar, 1994static void ath10k_htt_rx_h_filter(struct ath10k *ar,
2006 struct sk_buff_head *amsdu, 1995 struct sk_buff_head *amsdu,
2007 struct ieee80211_rx_status *rx_status, 1996 struct ieee80211_rx_status *rx_status,
2008 unsigned long int *drop_cnt) 1997 unsigned long *drop_cnt)
2009{ 1998{
2010 if (skb_queue_empty(amsdu)) 1999 if (skb_queue_empty(amsdu))
2011 return; 2000 return;
@@ -2025,10 +2014,10 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
2025 struct ieee80211_rx_status *rx_status = &htt->rx_status; 2014 struct ieee80211_rx_status *rx_status = &htt->rx_status;
2026 struct sk_buff_head amsdu; 2015 struct sk_buff_head amsdu;
2027 int ret; 2016 int ret;
2028 unsigned long int drop_cnt = 0; 2017 unsigned long drop_cnt = 0;
2029 unsigned long int unchain_cnt = 0; 2018 unsigned long unchain_cnt = 0;
2030 unsigned long int drop_cnt_filter = 0; 2019 unsigned long drop_cnt_filter = 0;
2031 unsigned long int msdus_to_queue, num_msdus; 2020 unsigned long msdus_to_queue, num_msdus;
2032 enum ath10k_pkt_rx_err err = ATH10K_PKT_RX_ERR_MAX; 2021 enum ath10k_pkt_rx_err err = ATH10K_PKT_RX_ERR_MAX;
2033 u8 first_hdr[RX_HTT_HDR_STATUS_LEN]; 2022 u8 first_hdr[RX_HTT_HDR_STATUS_LEN];
2034 2023
@@ -2220,8 +2209,12 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
2220 int status = MS(resp->data_tx_completion.flags, HTT_DATA_TX_STATUS); 2209 int status = MS(resp->data_tx_completion.flags, HTT_DATA_TX_STATUS);
2221 __le16 msdu_id, *msdus; 2210 __le16 msdu_id, *msdus;
2222 bool rssi_enabled = false; 2211 bool rssi_enabled = false;
2223 u8 msdu_count = 0; 2212 u8 msdu_count = 0, num_airtime_records, tid;
2224 int i; 2213 int i;
2214 struct htt_data_tx_compl_ppdu_dur *ppdu_info;
2215 struct ath10k_peer *peer;
2216 u16 ppdu_info_offset = 0, peer_id;
2217 u32 tx_duration;
2225 2218
2226 switch (status) { 2219 switch (status) {
2227 case HTT_DATA_TX_STATUS_NO_ACK: 2220 case HTT_DATA_TX_STATUS_NO_ACK:
@@ -2245,12 +2238,12 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
2245 resp->data_tx_completion.num_msdus); 2238 resp->data_tx_completion.num_msdus);
2246 2239
2247 msdu_count = resp->data_tx_completion.num_msdus; 2240 msdu_count = resp->data_tx_completion.num_msdus;
2241 msdus = resp->data_tx_completion.msdus;
2248 2242
2249 if (resp->data_tx_completion.flags2 & HTT_TX_CMPL_FLAG_DATA_RSSI) 2243 if (resp->data_tx_completion.flags2 & HTT_TX_CMPL_FLAG_DATA_RSSI)
2250 rssi_enabled = true; 2244 rssi_enabled = true;
2251 2245
2252 for (i = 0; i < msdu_count; i++) { 2246 for (i = 0; i < msdu_count; i++) {
2253 msdus = resp->data_tx_completion.msdus;
2254 msdu_id = msdus[i]; 2247 msdu_id = msdus[i];
2255 tx_done.msdu_id = __le16_to_cpu(msdu_id); 2248 tx_done.msdu_id = __le16_to_cpu(msdu_id);
2256 2249
@@ -2282,6 +2275,50 @@ static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
2282 ath10k_txrx_tx_unref(htt, &tx_done); 2275 ath10k_txrx_tx_unref(htt, &tx_done);
2283 } 2276 }
2284 } 2277 }
2278
2279 if (!(resp->data_tx_completion.flags2 & HTT_TX_CMPL_FLAG_PPDU_DURATION_PRESENT))
2280 return;
2281
2282 ppdu_info_offset = (msdu_count & 0x01) ? msdu_count + 1 : msdu_count;
2283
2284 if (rssi_enabled)
2285 ppdu_info_offset += ppdu_info_offset;
2286
2287 if (resp->data_tx_completion.flags2 &
2288 (HTT_TX_CMPL_FLAG_PPID_PRESENT | HTT_TX_CMPL_FLAG_PA_PRESENT))
2289 ppdu_info_offset += 2;
2290
2291 ppdu_info = (struct htt_data_tx_compl_ppdu_dur *)&msdus[ppdu_info_offset];
2292 num_airtime_records = FIELD_GET(HTT_TX_COMPL_PPDU_DUR_INFO0_NUM_ENTRIES_MASK,
2293 __le32_to_cpu(ppdu_info->info0));
2294
2295 for (i = 0; i < num_airtime_records; i++) {
2296 struct htt_data_tx_ppdu_dur *ppdu_dur;
2297 u32 info0;
2298
2299 ppdu_dur = &ppdu_info->ppdu_dur[i];
2300 info0 = __le32_to_cpu(ppdu_dur->info0);
2301
2302 peer_id = FIELD_GET(HTT_TX_PPDU_DUR_INFO0_PEER_ID_MASK,
2303 info0);
2304 rcu_read_lock();
2305 spin_lock_bh(&ar->data_lock);
2306
2307 peer = ath10k_peer_find_by_id(ar, peer_id);
2308 if (!peer) {
2309 spin_unlock_bh(&ar->data_lock);
2310 rcu_read_unlock();
2311 continue;
2312 }
2313
2314 tid = FIELD_GET(HTT_TX_PPDU_DUR_INFO0_TID_MASK, info0);
2315 tx_duration = __le32_to_cpu(ppdu_dur->tx_duration);
2316
2317 ieee80211_sta_register_airtime(peer->sta, tid, tx_duration, 0);
2318
2319 spin_unlock_bh(&ar->data_lock);
2320 rcu_read_unlock();
2321 }
2285} 2322}
2286 2323
2287static void ath10k_htt_rx_addba(struct ath10k *ar, struct htt_resp *resp) 2324static void ath10k_htt_rx_addba(struct ath10k *ar, struct htt_resp *resp)
@@ -2596,6 +2633,7 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb)
2596 u8 tid; 2633 u8 tid;
2597 int ret; 2634 int ret;
2598 int i; 2635 int i;
2636 bool may_tx;
2599 2637
2600 ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx tx fetch ind\n"); 2638 ath10k_dbg(ar, ATH10K_DBG_HTT, "htt rx tx fetch ind\n");
2601 2639
@@ -2668,8 +2706,13 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb)
2668 num_msdus = 0; 2706 num_msdus = 0;
2669 num_bytes = 0; 2707 num_bytes = 0;
2670 2708
2709 ieee80211_txq_schedule_start(hw, txq->ac);
2710 may_tx = ieee80211_txq_may_transmit(hw, txq);
2671 while (num_msdus < max_num_msdus && 2711 while (num_msdus < max_num_msdus &&
2672 num_bytes < max_num_bytes) { 2712 num_bytes < max_num_bytes) {
2713 if (!may_tx)
2714 break;
2715
2673 ret = ath10k_mac_tx_push_txq(hw, txq); 2716 ret = ath10k_mac_tx_push_txq(hw, txq);
2674 if (ret < 0) 2717 if (ret < 0)
2675 break; 2718 break;
@@ -2677,6 +2720,8 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb)
2677 num_msdus++; 2720 num_msdus++;
2678 num_bytes += ret; 2721 num_bytes += ret;
2679 } 2722 }
2723 ieee80211_return_txq(hw, txq);
2724 ieee80211_txq_schedule_end(hw, txq->ac);
2680 2725
2681 record->num_msdus = cpu_to_le16(num_msdus); 2726 record->num_msdus = cpu_to_le16(num_msdus);
2682 record->num_bytes = cpu_to_le32(num_bytes); 2727 record->num_bytes = cpu_to_le32(num_bytes);
@@ -2975,6 +3020,8 @@ ath10k_accumulate_per_peer_tx_stats(struct ath10k *ar,
2975 STATS_OP_FMT(RETRY).rate_table[0][idx] += pstats->retry_bytes; 3020 STATS_OP_FMT(RETRY).rate_table[0][idx] += pstats->retry_bytes;
2976 STATS_OP_FMT(RETRY).rate_table[1][idx] += pstats->retry_pkts; 3021 STATS_OP_FMT(RETRY).rate_table[1][idx] += pstats->retry_pkts;
2977 } 3022 }
3023
3024 tx_stats->tx_duration += pstats->duration;
2978} 3025}
2979 3026
2980static void 3027static void
@@ -3070,6 +3117,7 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar,
3070 3117
3071 arsta->txrate.nss = txrate.nss; 3118 arsta->txrate.nss = txrate.nss;
3072 arsta->txrate.bw = ath10k_bw_to_mac80211_bw(txrate.bw); 3119 arsta->txrate.bw = ath10k_bw_to_mac80211_bw(txrate.bw);
3120 arsta->last_tx_bitrate = cfg80211_calculate_bitrate(&arsta->txrate);
3073 if (sgi) 3121 if (sgi)
3074 arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 3122 arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
3075 3123
@@ -3141,6 +3189,7 @@ static void ath10k_htt_fetch_peer_stats(struct ath10k *ar,
3141 p_tx_stats->succ_pkts = __le16_to_cpu(tx_stats->succ_pkts); 3189 p_tx_stats->succ_pkts = __le16_to_cpu(tx_stats->succ_pkts);
3142 p_tx_stats->retry_pkts = __le16_to_cpu(tx_stats->retry_pkts); 3190 p_tx_stats->retry_pkts = __le16_to_cpu(tx_stats->retry_pkts);
3143 p_tx_stats->failed_pkts = __le16_to_cpu(tx_stats->failed_pkts); 3191 p_tx_stats->failed_pkts = __le16_to_cpu(tx_stats->failed_pkts);
3192 p_tx_stats->duration = __le16_to_cpu(tx_stats->tx_duration);
3144 3193
3145 ath10k_update_per_peer_tx_stats(ar, sta, p_tx_stats); 3194 ath10k_update_per_peer_tx_stats(ar, sta, p_tx_stats);
3146 } 3195 }
@@ -3234,7 +3283,7 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
3234 break; 3283 break;
3235 } 3284 }
3236 case HTT_T2H_MSG_TYPE_RX_IND: 3285 case HTT_T2H_MSG_TYPE_RX_IND:
3237 if (ar->dev_type == ATH10K_DEV_TYPE_HL) 3286 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
3238 return ath10k_htt_rx_proc_rx_ind_hl(htt, 3287 return ath10k_htt_rx_proc_rx_ind_hl(htt,
3239 &resp->rx_ind_hl, 3288 &resp->rx_ind_hl,
3240 skb); 3289 skb);
@@ -3530,7 +3579,7 @@ void ath10k_htt_set_rx_ops(struct ath10k_htt *htt)
3530{ 3579{
3531 struct ath10k *ar = htt->ar; 3580 struct ath10k *ar = htt->ar;
3532 3581
3533 if (ar->dev_type == ATH10K_DEV_TYPE_HL) 3582 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
3534 htt->rx_ops = &htt_rx_ops_hl; 3583 htt->rx_ops = &htt_rx_ops_hl;
3535 else if (ar->hw_params.target_64bit) 3584 else if (ar->hw_params.target_64bit)
3536 htt->rx_ops = &htt_rx_ops_64; 3585 htt->rx_ops = &htt_rx_ops_64;
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index ad05ab714c9b..d8e9cc0bb772 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#include <linux/etherdevice.h> 7#include <linux/etherdevice.h>
@@ -495,7 +484,7 @@ int ath10k_htt_tx_start(struct ath10k_htt *htt)
495 if (htt->tx_mem_allocated) 484 if (htt->tx_mem_allocated)
496 return 0; 485 return 0;
497 486
498 if (ar->dev_type == ATH10K_DEV_TYPE_HL) 487 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
499 return 0; 488 return 0;
500 489
501 ret = ath10k_htt_tx_alloc_buf(htt); 490 ret = ath10k_htt_tx_alloc_buf(htt);
@@ -1035,6 +1024,53 @@ int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
1035 return 0; 1024 return 0;
1036} 1025}
1037 1026
1027static int ath10k_htt_h2t_aggr_cfg_msg_v2(struct ath10k_htt *htt,
1028 u8 max_subfrms_ampdu,
1029 u8 max_subfrms_amsdu)
1030{
1031 struct ath10k *ar = htt->ar;
1032 struct htt_aggr_conf_v2 *aggr_conf;
1033 struct sk_buff *skb;
1034 struct htt_cmd *cmd;
1035 int len;
1036 int ret;
1037
1038 /* Firmware defaults are: amsdu = 3 and ampdu = 64 */
1039
1040 if (max_subfrms_ampdu == 0 || max_subfrms_ampdu > 64)
1041 return -EINVAL;
1042
1043 if (max_subfrms_amsdu == 0 || max_subfrms_amsdu > 31)
1044 return -EINVAL;
1045
1046 len = sizeof(cmd->hdr);
1047 len += sizeof(cmd->aggr_conf_v2);
1048
1049 skb = ath10k_htc_alloc_skb(ar, len);
1050 if (!skb)
1051 return -ENOMEM;
1052
1053 skb_put(skb, len);
1054 cmd = (struct htt_cmd *)skb->data;
1055 cmd->hdr.msg_type = HTT_H2T_MSG_TYPE_AGGR_CFG;
1056
1057 aggr_conf = &cmd->aggr_conf_v2;
1058 aggr_conf->max_num_ampdu_subframes = max_subfrms_ampdu;
1059 aggr_conf->max_num_amsdu_subframes = max_subfrms_amsdu;
1060
1061 ath10k_dbg(ar, ATH10K_DBG_HTT, "htt h2t aggr cfg msg amsdu %d ampdu %d",
1062 aggr_conf->max_num_amsdu_subframes,
1063 aggr_conf->max_num_ampdu_subframes);
1064
1065 ret = ath10k_htc_send(&htt->ar->htc, htt->eid, skb);
1066 if (ret) {
1067 dev_kfree_skb_any(skb);
1068 return ret;
1069 }
1070
1071 return 0;
1072}
1073
1038int ath10k_htt_tx_fetch_resp(struct ath10k *ar, 1074int ath10k_htt_tx_fetch_resp(struct ath10k *ar,
1039 __le32 token, 1075 __le32 token,
1040 __le16 fetch_seq_num, 1076 __le16 fetch_seq_num,
@@ -1177,7 +1213,7 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
1177 return 0; 1213 return 0;
1178 1214
1179err_unmap_msdu: 1215err_unmap_msdu:
1180 if (ar->dev_type != ATH10K_DEV_TYPE_HL) 1216 if (ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL)
1181 dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); 1217 dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
1182err_free_txdesc: 1218err_free_txdesc:
1183 dev_kfree_skb_any(txdesc); 1219 dev_kfree_skb_any(txdesc);
@@ -1498,7 +1534,7 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt,
1498 u16 msdu_id, flags1 = 0; 1534 u16 msdu_id, flags1 = 0;
1499 u16 freq = 0; 1535 u16 freq = 0;
1500 dma_addr_t frags_paddr = 0; 1536 dma_addr_t frags_paddr = 0;
1501 u32 txbuf_paddr; 1537 dma_addr_t txbuf_paddr;
1502 struct htt_msdu_ext_desc_64 *ext_desc = NULL; 1538 struct htt_msdu_ext_desc_64 *ext_desc = NULL;
1503 struct htt_msdu_ext_desc_64 *ext_desc_t = NULL; 1539 struct htt_msdu_ext_desc_64 *ext_desc_t = NULL;
1504 1540
@@ -1692,6 +1728,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_32 = {
1692 .htt_tx = ath10k_htt_tx_32, 1728 .htt_tx = ath10k_htt_tx_32,
1693 .htt_alloc_txbuff = ath10k_htt_tx_alloc_cont_txbuf_32, 1729 .htt_alloc_txbuff = ath10k_htt_tx_alloc_cont_txbuf_32,
1694 .htt_free_txbuff = ath10k_htt_tx_free_cont_txbuf_32, 1730 .htt_free_txbuff = ath10k_htt_tx_free_cont_txbuf_32,
1731 .htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg,
1695}; 1732};
1696 1733
1697static const struct ath10k_htt_tx_ops htt_tx_ops_64 = { 1734static const struct ath10k_htt_tx_ops htt_tx_ops_64 = {
@@ -1702,6 +1739,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_64 = {
1702 .htt_tx = ath10k_htt_tx_64, 1739 .htt_tx = ath10k_htt_tx_64,
1703 .htt_alloc_txbuff = ath10k_htt_tx_alloc_cont_txbuf_64, 1740 .htt_alloc_txbuff = ath10k_htt_tx_alloc_cont_txbuf_64,
1704 .htt_free_txbuff = ath10k_htt_tx_free_cont_txbuf_64, 1741 .htt_free_txbuff = ath10k_htt_tx_free_cont_txbuf_64,
1742 .htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg_v2,
1705}; 1743};
1706 1744
1707static const struct ath10k_htt_tx_ops htt_tx_ops_hl = { 1745static const struct ath10k_htt_tx_ops htt_tx_ops_hl = {
@@ -1714,7 +1752,7 @@ void ath10k_htt_set_tx_ops(struct ath10k_htt *htt)
1714{ 1752{
1715 struct ath10k *ar = htt->ar; 1753 struct ath10k *ar = htt->ar;
1716 1754
1717 if (ar->dev_type == ATH10K_DEV_TYPE_HL) 1755 if (ar->bus_param.dev_type == ATH10K_DEV_TYPE_HL)
1718 htt->tx_ops = &htt_tx_ops_hl; 1756 htt->tx_ops = &htt_tx_ops_hl;
1719 else if (ar->hw_params.target_64bit) 1757 else if (ar->hw_params.target_64bit)
1720 htt->tx_ops = &htt_tx_ops_64; 1758 htt->tx_ops = &htt_tx_ops_64;
diff --git a/drivers/net/wireless/ath/ath10k/hw.c b/drivers/net/wireless/ath/ath10k/hw.c
index 61ecf931ba4d..eeaee8e41b28 100644
--- a/drivers/net/wireless/ath/ath10k/hw.c
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include <linux/types.h> 6#include <linux/types.h>
@@ -318,9 +307,11 @@ static struct ath10k_hw_ce_ctrl1_upd wcn3990_ctrl1_upd = {
318}; 307};
319 308
320const struct ath10k_hw_ce_regs wcn3990_ce_regs = { 309const struct ath10k_hw_ce_regs wcn3990_ce_regs = {
321 .sr_base_addr = 0x00000000, 310 .sr_base_addr_lo = 0x00000000,
311 .sr_base_addr_hi = 0x00000004,
322 .sr_size_addr = 0x00000008, 312 .sr_size_addr = 0x00000008,
323 .dr_base_addr = 0x0000000c, 313 .dr_base_addr_lo = 0x0000000c,
314 .dr_base_addr_hi = 0x00000010,
324 .dr_size_addr = 0x00000014, 315 .dr_size_addr = 0x00000014,
325 .misc_ie_addr = 0x00000034, 316 .misc_ie_addr = 0x00000034,
326 .sr_wr_index_addr = 0x0000003c, 317 .sr_wr_index_addr = 0x0000003c,
@@ -464,9 +455,9 @@ static struct ath10k_hw_ce_dst_src_wm_regs qcax_wm_dst_ring = {
464}; 455};
465 456
466const struct ath10k_hw_ce_regs qcax_ce_regs = { 457const struct ath10k_hw_ce_regs qcax_ce_regs = {
467 .sr_base_addr = 0x00000000, 458 .sr_base_addr_lo = 0x00000000,
468 .sr_size_addr = 0x00000004, 459 .sr_size_addr = 0x00000004,
469 .dr_base_addr = 0x00000008, 460 .dr_base_addr_lo = 0x00000008,
470 .dr_size_addr = 0x0000000c, 461 .dr_size_addr = 0x0000000c,
471 .ce_cmd_addr = 0x00000018, 462 .ce_cmd_addr = 0x00000018,
472 .misc_ie_addr = 0x00000034, 463 .misc_ie_addr = 0x00000034,
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index e50a8dc5b093..de7dc01bf51d 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _HW_H_ 8#ifndef _HW_H_
@@ -353,9 +342,11 @@ struct ath10k_hw_ce_ctrl1_upd {
353}; 342};
354 343
355struct ath10k_hw_ce_regs { 344struct ath10k_hw_ce_regs {
356 u32 sr_base_addr; 345 u32 sr_base_addr_lo;
346 u32 sr_base_addr_hi;
357 u32 sr_size_addr; 347 u32 sr_size_addr;
358 u32 dr_base_addr; 348 u32 dr_base_addr_lo;
349 u32 dr_base_addr_hi;
359 u32 dr_size_addr; 350 u32 dr_size_addr;
360 u32 ce_cmd_addr; 351 u32 ce_cmd_addr;
361 u32 misc_ie_addr; 352 u32 misc_ie_addr;
@@ -734,6 +725,7 @@ ath10k_rx_desc_msdu_limit_error(struct ath10k_hw_params *hw,
734#define TARGET_TLV_NUM_TDLS_VDEVS 1 725#define TARGET_TLV_NUM_TDLS_VDEVS 1
735#define TARGET_TLV_NUM_TIDS ((TARGET_TLV_NUM_PEERS) * 2) 726#define TARGET_TLV_NUM_TIDS ((TARGET_TLV_NUM_PEERS) * 2)
736#define TARGET_TLV_NUM_MSDU_DESC (1024 + 32) 727#define TARGET_TLV_NUM_MSDU_DESC (1024 + 32)
728#define TARGET_TLV_NUM_MSDU_DESC_HL 64
737#define TARGET_TLV_NUM_WOW_PATTERNS 22 729#define TARGET_TLV_NUM_WOW_PATTERNS 22
738#define TARGET_TLV_MGMT_NUM_MSDU_DESC (50) 730#define TARGET_TLV_MGMT_NUM_MSDU_DESC (50)
739 731
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 49758490eaba..b73c23d4ce86 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include "mac.h" 8#include "mac.h"
@@ -250,24 +239,24 @@ static int ath10k_send_key(struct ath10k_vif *arvif,
250 239
251 switch (key->cipher) { 240 switch (key->cipher) {
252 case WLAN_CIPHER_SUITE_CCMP: 241 case WLAN_CIPHER_SUITE_CCMP:
253 arg.key_cipher = WMI_CIPHER_AES_CCM; 242 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM];
254 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT; 243 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV_MGMT;
255 break; 244 break;
256 case WLAN_CIPHER_SUITE_TKIP: 245 case WLAN_CIPHER_SUITE_TKIP:
257 arg.key_cipher = WMI_CIPHER_TKIP; 246 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_TKIP];
258 arg.key_txmic_len = 8; 247 arg.key_txmic_len = 8;
259 arg.key_rxmic_len = 8; 248 arg.key_rxmic_len = 8;
260 break; 249 break;
261 case WLAN_CIPHER_SUITE_WEP40: 250 case WLAN_CIPHER_SUITE_WEP40:
262 case WLAN_CIPHER_SUITE_WEP104: 251 case WLAN_CIPHER_SUITE_WEP104:
263 arg.key_cipher = WMI_CIPHER_WEP; 252 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_WEP];
264 break; 253 break;
265 case WLAN_CIPHER_SUITE_CCMP_256: 254 case WLAN_CIPHER_SUITE_CCMP_256:
266 arg.key_cipher = WMI_CIPHER_AES_CCM; 255 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_CCM];
267 break; 256 break;
268 case WLAN_CIPHER_SUITE_GCMP: 257 case WLAN_CIPHER_SUITE_GCMP:
269 case WLAN_CIPHER_SUITE_GCMP_256: 258 case WLAN_CIPHER_SUITE_GCMP_256:
270 arg.key_cipher = WMI_CIPHER_AES_GCM; 259 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_AES_GCM];
271 break; 260 break;
272 case WLAN_CIPHER_SUITE_BIP_GMAC_128: 261 case WLAN_CIPHER_SUITE_BIP_GMAC_128:
273 case WLAN_CIPHER_SUITE_BIP_GMAC_256: 262 case WLAN_CIPHER_SUITE_BIP_GMAC_256:
@@ -284,7 +273,7 @@ static int ath10k_send_key(struct ath10k_vif *arvif,
284 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 273 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
285 274
286 if (cmd == DISABLE_KEY) { 275 if (cmd == DISABLE_KEY) {
287 arg.key_cipher = WMI_CIPHER_NONE; 276 arg.key_cipher = ar->wmi_key_cipher[WMI_CIPHER_NONE];
288 arg.key_data = NULL; 277 arg.key_data = NULL;
289 } 278 }
290 279
@@ -3397,6 +3386,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k *ar,
3397 struct sk_buff *skb) 3386 struct sk_buff *skb)
3398{ 3387{
3399 const struct ieee80211_hdr *hdr = (void *)skb->data; 3388 const struct ieee80211_hdr *hdr = (void *)skb->data;
3389 const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
3400 __le16 fc = hdr->frame_control; 3390 __le16 fc = hdr->frame_control;
3401 3391
3402 if (!vif || vif->type == NL80211_IFTYPE_MONITOR) 3392 if (!vif || vif->type == NL80211_IFTYPE_MONITOR)
@@ -3438,7 +3428,8 @@ ath10k_mac_tx_h_get_txmode(struct ath10k *ar,
3438 if (ieee80211_is_data_present(fc) && sta && sta->tdls) 3428 if (ieee80211_is_data_present(fc) && sta && sta->tdls)
3439 return ATH10K_HW_TXRX_ETHERNET; 3429 return ATH10K_HW_TXRX_ETHERNET;
3440 3430
3441 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) 3431 if (test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) ||
3432 skb_cb->flags & ATH10K_SKB_F_RAW_TX)
3442 return ATH10K_HW_TXRX_RAW; 3433 return ATH10K_HW_TXRX_RAW;
3443 3434
3444 return ATH10K_HW_TXRX_NATIVE_WIFI; 3435 return ATH10K_HW_TXRX_NATIVE_WIFI;
@@ -3544,10 +3535,13 @@ static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar,
3544static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar, 3535static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
3545 struct ieee80211_vif *vif, 3536 struct ieee80211_vif *vif,
3546 struct ieee80211_txq *txq, 3537 struct ieee80211_txq *txq,
3547 struct sk_buff *skb) 3538 struct sk_buff *skb, u16 airtime)
3548{ 3539{
3549 struct ieee80211_hdr *hdr = (void *)skb->data; 3540 struct ieee80211_hdr *hdr = (void *)skb->data;
3550 struct ath10k_skb_cb *cb = ATH10K_SKB_CB(skb); 3541 struct ath10k_skb_cb *cb = ATH10K_SKB_CB(skb);
3542 const struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
3543 bool is_data = ieee80211_is_data(hdr->frame_control) ||
3544 ieee80211_is_data_qos(hdr->frame_control);
3551 3545
3552 cb->flags = 0; 3546 cb->flags = 0;
3553 if (!ath10k_tx_h_use_hwcrypto(vif, skb)) 3547 if (!ath10k_tx_h_use_hwcrypto(vif, skb))
@@ -3559,8 +3553,19 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
3559 if (ieee80211_is_data_qos(hdr->frame_control)) 3553 if (ieee80211_is_data_qos(hdr->frame_control))
3560 cb->flags |= ATH10K_SKB_F_QOS; 3554 cb->flags |= ATH10K_SKB_F_QOS;
3561 3555
3556 /* Data frames encrypted in software will be posted to firmware
3557 * with tx encap mode set to RAW. Ex: Multicast traffic generated
3558 * for a specific VLAN group will always be encrypted in software.
3559 */
3560 if (is_data && ieee80211_has_protected(hdr->frame_control) &&
3561 !info->control.hw_key) {
3562 cb->flags |= ATH10K_SKB_F_NO_HWCRYPT;
3563 cb->flags |= ATH10K_SKB_F_RAW_TX;
3564 }
3565
3562 cb->vif = vif; 3566 cb->vif = vif;
3563 cb->txq = txq; 3567 cb->txq = txq;
3568 cb->airtime_est = airtime;
3564} 3569}
3565 3570
3566bool ath10k_mac_tx_frm_has_freq(struct ath10k *ar) 3571bool ath10k_mac_tx_frm_has_freq(struct ath10k *ar)
@@ -3667,6 +3672,7 @@ static int ath10k_mac_tx(struct ath10k *ar,
3667{ 3672{
3668 struct ieee80211_hw *hw = ar->hw; 3673 struct ieee80211_hw *hw = ar->hw;
3669 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 3674 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
3675 const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
3670 int ret; 3676 int ret;
3671 3677
3672 /* We should disable CCK RATE due to P2P */ 3678 /* We should disable CCK RATE due to P2P */
@@ -3684,7 +3690,8 @@ static int ath10k_mac_tx(struct ath10k *ar,
3684 ath10k_tx_h_8023(skb); 3690 ath10k_tx_h_8023(skb);
3685 break; 3691 break;
3686 case ATH10K_HW_TXRX_RAW: 3692 case ATH10K_HW_TXRX_RAW:
3687 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) { 3693 if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) &&
3694 !(skb_cb->flags & ATH10K_SKB_F_RAW_TX)) {
3688 WARN_ON_ONCE(1); 3695 WARN_ON_ONCE(1);
3689 ieee80211_free_txskb(hw, skb); 3696 ieee80211_free_txskb(hw, skb);
3690 return -ENOTSUPP; 3697 return -ENOTSUPP;
@@ -3863,7 +3870,7 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work)
3863 ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n", 3870 ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n",
3864 ret); 3871 ret);
3865 dma_unmap_single(ar->dev, paddr, skb->len, 3872 dma_unmap_single(ar->dev, paddr, skb->len,
3866 DMA_FROM_DEVICE); 3873 DMA_TO_DEVICE);
3867 ieee80211_free_txskb(ar->hw, skb); 3874 ieee80211_free_txskb(ar->hw, skb);
3868 } 3875 }
3869 } else { 3876 } else {
@@ -3890,7 +3897,6 @@ static void ath10k_mac_txq_init(struct ieee80211_txq *txq)
3890 3897
3891static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq) 3898static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq)
3892{ 3899{
3893 struct ath10k_txq *artxq;
3894 struct ath10k_skb_cb *cb; 3900 struct ath10k_skb_cb *cb;
3895 struct sk_buff *msdu; 3901 struct sk_buff *msdu;
3896 int msdu_id; 3902 int msdu_id;
@@ -3898,12 +3904,6 @@ static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq)
3898 if (!txq) 3904 if (!txq)
3899 return; 3905 return;
3900 3906
3901 artxq = (void *)txq->drv_priv;
3902 spin_lock_bh(&ar->txqs_lock);
3903 if (!list_empty(&artxq->list))
3904 list_del_init(&artxq->list);
3905 spin_unlock_bh(&ar->txqs_lock);
3906
3907 spin_lock_bh(&ar->htt.tx_lock); 3907 spin_lock_bh(&ar->htt.tx_lock);
3908 idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) { 3908 idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) {
3909 cb = ATH10K_SKB_CB(msdu); 3909 cb = ATH10K_SKB_CB(msdu);
@@ -3943,7 +3943,6 @@ static bool ath10k_mac_tx_can_push(struct ieee80211_hw *hw,
3943 struct ath10k_txq *artxq = (void *)txq->drv_priv; 3943 struct ath10k_txq *artxq = (void *)txq->drv_priv;
3944 3944
3945 /* No need to get locks */ 3945 /* No need to get locks */
3946
3947 if (ar->htt.tx_q_state.mode == HTT_TX_MODE_SWITCH_PUSH) 3946 if (ar->htt.tx_q_state.mode == HTT_TX_MODE_SWITCH_PUSH)
3948 return true; 3947 return true;
3949 3948
@@ -3956,6 +3955,52 @@ static bool ath10k_mac_tx_can_push(struct ieee80211_hw *hw,
3956 return false; 3955 return false;
3957} 3956}
3958 3957
3958/* Return estimated airtime in microsecond, which is calculated using last
3959 * reported TX rate. This is just a rough estimation because host driver has no
3960 * knowledge of the actual transmit rate, retries or aggregation. If actual
3961 * airtime can be reported by firmware, then delta between estimated and actual
3962 * airtime can be adjusted from deficit.
3963 */
3964#define IEEE80211_ATF_OVERHEAD 100 /* IFS + some slot time */
3965#define IEEE80211_ATF_OVERHEAD_IFS 16 /* IFS only */
3966static u16 ath10k_mac_update_airtime(struct ath10k *ar,
3967 struct ieee80211_txq *txq,
3968 struct sk_buff *skb)
3969{
3970 struct ath10k_sta *arsta;
3971 u32 pktlen;
3972 u16 airtime = 0;
3973
3974 if (!txq || !txq->sta)
3975 return airtime;
3976
3977 if (test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map))
3978 return airtime;
3979
3980 spin_lock_bh(&ar->data_lock);
3981 arsta = (struct ath10k_sta *)txq->sta->drv_priv;
3982
3983 pktlen = skb->len + 38; /* Assume MAC header 30, SNAP 8 for most case */
3984 if (arsta->last_tx_bitrate) {
3985 /* airtime in us, last_tx_bitrate in 100kbps */
3986 airtime = (pktlen * 8 * (1000 / 100))
3987 / arsta->last_tx_bitrate;
3988 /* overhead for media access time and IFS */
3989 airtime += IEEE80211_ATF_OVERHEAD_IFS;
3990 } else {
3991 /* This is mostly for throttle excessive BC/MC frames, and the
3992 * airtime/rate doesn't need be exact. Airtime of BC/MC frames
3993 * in 2G get some discount, which helps prevent very low rate
3994 * frames from being blocked for too long.
3995 */
3996 airtime = (pktlen * 8 * (1000 / 100)) / 60; /* 6M */
3997 airtime += IEEE80211_ATF_OVERHEAD;
3998 }
3999 spin_unlock_bh(&ar->data_lock);
4000
4001 return airtime;
4002}
4003
3959int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw, 4004int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,
3960 struct ieee80211_txq *txq) 4005 struct ieee80211_txq *txq)
3961{ 4006{
@@ -3971,6 +4016,7 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,
3971 size_t skb_len; 4016 size_t skb_len;
3972 bool is_mgmt, is_presp; 4017 bool is_mgmt, is_presp;
3973 int ret; 4018 int ret;
4019 u16 airtime;
3974 4020
3975 spin_lock_bh(&ar->htt.tx_lock); 4021 spin_lock_bh(&ar->htt.tx_lock);
3976 ret = ath10k_htt_tx_inc_pending(htt); 4022 ret = ath10k_htt_tx_inc_pending(htt);
@@ -3988,7 +4034,8 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,
3988 return -ENOENT; 4034 return -ENOENT;
3989 } 4035 }
3990 4036
3991 ath10k_mac_tx_h_fill_cb(ar, vif, txq, skb); 4037 airtime = ath10k_mac_update_airtime(ar, txq, skb);
4038 ath10k_mac_tx_h_fill_cb(ar, vif, txq, skb, airtime);
3992 4039
3993 skb_len = skb->len; 4040 skb_len = skb->len;
3994 txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb); 4041 txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
@@ -4030,48 +4077,45 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,
4030 return skb_len; 4077 return skb_len;
4031} 4078}
4032 4079
4033void ath10k_mac_tx_push_pending(struct ath10k *ar) 4080static int ath10k_mac_schedule_txq(struct ieee80211_hw *hw, u32 ac)
4034{ 4081{
4035 struct ieee80211_hw *hw = ar->hw;
4036 struct ieee80211_txq *txq; 4082 struct ieee80211_txq *txq;
4037 struct ath10k_txq *artxq; 4083 int ret = 0;
4038 struct ath10k_txq *last;
4039 int ret;
4040 int max;
4041
4042 if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2))
4043 return;
4044
4045 spin_lock_bh(&ar->txqs_lock);
4046 rcu_read_lock();
4047
4048 last = list_last_entry(&ar->txqs, struct ath10k_txq, list);
4049 while (!list_empty(&ar->txqs)) {
4050 artxq = list_first_entry(&ar->txqs, struct ath10k_txq, list);
4051 txq = container_of((void *)artxq, struct ieee80211_txq,
4052 drv_priv);
4053 4084
4054 /* Prevent aggressive sta/tid taking over tx queue */ 4085 ieee80211_txq_schedule_start(hw, ac);
4055 max = HTC_HOST_MAX_MSG_PER_TX_BUNDLE; 4086 while ((txq = ieee80211_next_txq(hw, ac))) {
4056 ret = 0; 4087 while (ath10k_mac_tx_can_push(hw, txq)) {
4057 while (ath10k_mac_tx_can_push(hw, txq) && max--) {
4058 ret = ath10k_mac_tx_push_txq(hw, txq); 4088 ret = ath10k_mac_tx_push_txq(hw, txq);
4059 if (ret < 0) 4089 if (ret < 0)
4060 break; 4090 break;
4061 } 4091 }
4092 ieee80211_return_txq(hw, txq);
4093 ath10k_htt_tx_txq_update(hw, txq);
4094 if (ret == -EBUSY)
4095 break;
4096 }
4097 ieee80211_txq_schedule_end(hw, ac);
4062 4098
4063 list_del_init(&artxq->list); 4099 return ret;
4064 if (ret != -ENOENT) 4100}
4065 list_add_tail(&artxq->list, &ar->txqs);
4066 4101
4067 ath10k_htt_tx_txq_update(hw, txq); 4102void ath10k_mac_tx_push_pending(struct ath10k *ar)
4103{
4104 struct ieee80211_hw *hw = ar->hw;
4105 u32 ac;
4106
4107 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH)
4108 return;
4109
4110 if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2))
4111 return;
4068 4112
4069 if (artxq == last || (ret < 0 && ret != -ENOENT)) 4113 rcu_read_lock();
4114 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
4115 if (ath10k_mac_schedule_txq(hw, ac) == -EBUSY)
4070 break; 4116 break;
4071 } 4117 }
4072
4073 rcu_read_unlock(); 4118 rcu_read_unlock();
4074 spin_unlock_bh(&ar->txqs_lock);
4075} 4119}
4076EXPORT_SYMBOL(ath10k_mac_tx_push_pending); 4120EXPORT_SYMBOL(ath10k_mac_tx_push_pending);
4077 4121
@@ -4258,8 +4302,10 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
4258 bool is_mgmt; 4302 bool is_mgmt;
4259 bool is_presp; 4303 bool is_presp;
4260 int ret; 4304 int ret;
4305 u16 airtime;
4261 4306
4262 ath10k_mac_tx_h_fill_cb(ar, vif, txq, skb); 4307 airtime = ath10k_mac_update_airtime(ar, txq, skb);
4308 ath10k_mac_tx_h_fill_cb(ar, vif, txq, skb, airtime);
4263 4309
4264 txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb); 4310 txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
4265 txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode); 4311 txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode);
@@ -4310,31 +4356,28 @@ static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw,
4310 struct ieee80211_txq *txq) 4356 struct ieee80211_txq *txq)
4311{ 4357{
4312 struct ath10k *ar = hw->priv; 4358 struct ath10k *ar = hw->priv;
4313 struct ath10k_txq *artxq = (void *)txq->drv_priv; 4359 int ret;
4314 struct ieee80211_txq *f_txq; 4360 u8 ac;
4315 struct ath10k_txq *f_artxq;
4316 int ret = 0;
4317 int max = HTC_HOST_MAX_MSG_PER_TX_BUNDLE;
4318 4361
4319 spin_lock_bh(&ar->txqs_lock); 4362 ath10k_htt_tx_txq_update(hw, txq);
4320 if (list_empty(&artxq->list)) 4363 if (ar->htt.tx_q_state.mode != HTT_TX_MODE_SWITCH_PUSH)
4321 list_add_tail(&artxq->list, &ar->txqs); 4364 return;
4322 4365
4323 f_artxq = list_first_entry(&ar->txqs, struct ath10k_txq, list); 4366 ac = txq->ac;
4324 f_txq = container_of((void *)f_artxq, struct ieee80211_txq, drv_priv); 4367 ieee80211_txq_schedule_start(hw, ac);
4325 list_del_init(&f_artxq->list); 4368 txq = ieee80211_next_txq(hw, ac);
4369 if (!txq)
4370 goto out;
4326 4371
4327 while (ath10k_mac_tx_can_push(hw, f_txq) && max--) { 4372 while (ath10k_mac_tx_can_push(hw, txq)) {
4328 ret = ath10k_mac_tx_push_txq(hw, f_txq); 4373 ret = ath10k_mac_tx_push_txq(hw, txq);
4329 if (ret < 0) 4374 if (ret < 0)
4330 break; 4375 break;
4331 } 4376 }
4332 if (ret != -ENOENT) 4377 ieee80211_return_txq(hw, txq);
4333 list_add_tail(&f_artxq->list, &ar->txqs);
4334 spin_unlock_bh(&ar->txqs_lock);
4335
4336 ath10k_htt_tx_txq_update(hw, f_txq);
4337 ath10k_htt_tx_txq_update(hw, txq); 4378 ath10k_htt_tx_txq_update(hw, txq);
4379out:
4380 ieee80211_txq_schedule_end(hw, ac);
4338} 4381}
4339 4382
4340/* Must not be called with conf_mutex held as workers can use that also. */ 4383/* Must not be called with conf_mutex held as workers can use that also. */
@@ -4549,7 +4592,8 @@ static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
4549 ht_cap.cap |= stbc; 4592 ht_cap.cap |= stbc;
4550 } 4593 }
4551 4594
4552 if (ar->ht_cap_info & WMI_HT_CAP_LDPC) 4595 if (ar->ht_cap_info & WMI_HT_CAP_LDPC || (ar->ht_cap_info &
4596 WMI_HT_CAP_RX_LDPC && (ar->ht_cap_info & WMI_HT_CAP_TX_LDPC)))
4553 ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING; 4597 ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
4554 4598
4555 if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT) 4599 if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT)
@@ -4704,7 +4748,7 @@ static int ath10k_start(struct ieee80211_hw *hw)
4704 goto err; 4748 goto err;
4705 } 4749 }
4706 4750
4707 ret = ath10k_hif_power_up(ar); 4751 ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_NORMAL);
4708 if (ret) { 4752 if (ret) {
4709 ath10k_err(ar, "Could not init hif: %d\n", ret); 4753 ath10k_err(ar, "Could not init hif: %d\n", ret);
4710 goto err_off; 4754 goto err_off;
@@ -5341,6 +5385,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
5341 goto err_peer_delete; 5385 goto err_peer_delete;
5342 } 5386 }
5343 5387
5388 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) {
5389 vdev_param = ar->wmi.vdev_param->rtt_responder_role;
5390 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
5391 arvif->ftm_responder);
5392
5393 /* It is harmless to not set FTM role. Do not warn */
5394 if (ret && ret != -EOPNOTSUPP)
5395 ath10k_warn(ar, "failed to set vdev %i FTM Responder: %d\n",
5396 arvif->vdev_id, ret);
5397 }
5398
5344 if (vif->type == NL80211_IFTYPE_MONITOR) { 5399 if (vif->type == NL80211_IFTYPE_MONITOR) {
5345 ar->monitor_arvif = arvif; 5400 ar->monitor_arvif = arvif;
5346 ret = ath10k_monitor_recalc(ar); 5401 ret = ath10k_monitor_recalc(ar);
@@ -5615,6 +5670,20 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
5615 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) 5670 if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid))
5616 ether_addr_copy(arvif->bssid, info->bssid); 5671 ether_addr_copy(arvif->bssid, info->bssid);
5617 5672
5673 if (changed & BSS_CHANGED_FTM_RESPONDER &&
5674 arvif->ftm_responder != info->ftm_responder &&
5675 test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map)) {
5676 arvif->ftm_responder = info->ftm_responder;
5677
5678 vdev_param = ar->wmi.vdev_param->rtt_responder_role;
5679 ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
5680 arvif->ftm_responder);
5681
5682 ath10k_dbg(ar, ATH10K_DBG_MAC,
5683 "mac vdev %d ftm_responder %d:ret %d\n",
5684 arvif->vdev_id, arvif->ftm_responder, ret);
5685 }
5686
5618 if (changed & BSS_CHANGED_BEACON_ENABLED) 5687 if (changed & BSS_CHANGED_BEACON_ENABLED)
5619 ath10k_control_beaconing(arvif, info); 5688 ath10k_control_beaconing(arvif, info);
5620 5689
@@ -8617,6 +8686,15 @@ int ath10k_mac_register(struct ath10k *ar)
8617 wiphy_ext_feature_set(ar->hw->wiphy, 8686 wiphy_ext_feature_set(ar->hw->wiphy,
8618 NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT); 8687 NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
8619 8688
8689 if (ath10k_peer_stats_enabled(ar) ||
8690 test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map))
8691 wiphy_ext_feature_set(ar->hw->wiphy,
8692 NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);
8693
8694 if (test_bit(WMI_SERVICE_RTT_RESPONDER_ROLE, ar->wmi.svc_map))
8695 wiphy_ext_feature_set(ar->hw->wiphy,
8696 NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
8697
8620 /* 8698 /*
8621 * on LL hardware queues are managed entirely by the FW 8699 * on LL hardware queues are managed entirely by the FW
8622 * so we only advertise to mac we can do the queues thing 8700 * so we only advertise to mac we can do the queues thing
@@ -8726,12 +8804,19 @@ int ath10k_mac_register(struct ath10k *ar)
8726 8804
8727 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); 8805 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
8728 8806
8807 ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
8808
8729 ret = ieee80211_register_hw(ar->hw); 8809 ret = ieee80211_register_hw(ar->hw);
8730 if (ret) { 8810 if (ret) {
8731 ath10k_err(ar, "failed to register ieee80211: %d\n", ret); 8811 ath10k_err(ar, "failed to register ieee80211: %d\n", ret);
8732 goto err_dfs_detector_exit; 8812 goto err_dfs_detector_exit;
8733 } 8813 }
8734 8814
8815 if (test_bit(WMI_SERVICE_PER_PACKET_SW_ENCRYPT, ar->wmi.svc_map)) {
8816 ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
8817 ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
8818 }
8819
8735 if (!ath_is_world_regd(&ar->ath_common.regulatory)) { 8820 if (!ath_is_world_regd(&ar->ath_common.regulatory)) {
8736 ret = regulatory_hint(ar->hw->wiphy, 8821 ret = regulatory_hint(ar->hw->wiphy,
8737 ar->ath_common.regulatory.alpha2); 8822 ar->ath_common.regulatory.alpha2);
diff --git a/drivers/net/wireless/ath/ath10k/mac.h b/drivers/net/wireless/ath/ath10k/mac.h
index 570493d2d648..1fe84948b868 100644
--- a/drivers/net/wireless/ath/ath10k/mac.h
+++ b/drivers/net/wireless/ath/ath10k/mac.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#ifndef _MAC_H_ 7#ifndef _MAC_H_
diff --git a/drivers/net/wireless/ath/ath10k/p2p.c b/drivers/net/wireless/ath/ath10k/p2p.c
index 7e621ee194e3..29c737b2f432 100644
--- a/drivers/net/wireless/ath/ath10k/p2p.c
+++ b/drivers/net/wireless/ath/ath10k/p2p.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2015 Qualcomm Atheros, Inc. 3 * Copyright (c) 2015 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include "core.h" 6#include "core.h"
diff --git a/drivers/net/wireless/ath/ath10k/p2p.h b/drivers/net/wireless/ath/ath10k/p2p.h
index 7be616e2e121..7d7f44809fbb 100644
--- a/drivers/net/wireless/ath/ath10k/p2p.h
+++ b/drivers/net/wireless/ath/ath10k/p2p.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2015 Qualcomm Atheros, Inc. 3 * Copyright (c) 2015 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#ifndef _P2P_H 6#ifndef _P2P_H
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 39e0b1cc2a12..271f92c24d44 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#include <linux/pci.h> 7#include <linux/pci.h>
@@ -913,7 +902,6 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
913 int nbytes) 902 int nbytes)
914{ 903{
915 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 904 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
916 struct ath10k_ce *ce = ath10k_ce_priv(ar);
917 int ret = 0; 905 int ret = 0;
918 u32 *buf; 906 u32 *buf;
919 unsigned int completed_nbytes, alloc_nbytes, remaining_bytes; 907 unsigned int completed_nbytes, alloc_nbytes, remaining_bytes;
@@ -924,8 +912,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
924 void *data_buf = NULL; 912 void *data_buf = NULL;
925 int i; 913 int i;
926 914
927 spin_lock_bh(&ce->ce_lock); 915 mutex_lock(&ar_pci->ce_diag_mutex);
928
929 ce_diag = ar_pci->ce_diag; 916 ce_diag = ar_pci->ce_diag;
930 917
931 /* 918 /*
@@ -960,19 +947,17 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
960 nbytes = min_t(unsigned int, remaining_bytes, 947 nbytes = min_t(unsigned int, remaining_bytes,
961 DIAG_TRANSFER_LIMIT); 948 DIAG_TRANSFER_LIMIT);
962 949
963 ret = ce_diag->ops->ce_rx_post_buf(ce_diag, &ce_data, ce_data); 950 ret = ath10k_ce_rx_post_buf(ce_diag, &ce_data, ce_data);
964 if (ret != 0) 951 if (ret != 0)
965 goto done; 952 goto done;
966 953
967 /* Request CE to send from Target(!) address to Host buffer */ 954 /* Request CE to send from Target(!) address to Host buffer */
968 ret = ath10k_ce_send_nolock(ce_diag, NULL, (u32)address, nbytes, 0, 955 ret = ath10k_ce_send(ce_diag, NULL, (u32)address, nbytes, 0, 0);
969 0);
970 if (ret) 956 if (ret)
971 goto done; 957 goto done;
972 958
973 i = 0; 959 i = 0;
974 while (ath10k_ce_completed_send_next_nolock(ce_diag, 960 while (ath10k_ce_completed_send_next(ce_diag, NULL) != 0) {
975 NULL) != 0) {
976 udelay(DIAG_ACCESS_CE_WAIT_US); 961 udelay(DIAG_ACCESS_CE_WAIT_US);
977 i += DIAG_ACCESS_CE_WAIT_US; 962 i += DIAG_ACCESS_CE_WAIT_US;
978 963
@@ -983,10 +968,8 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
983 } 968 }
984 969
985 i = 0; 970 i = 0;
986 while (ath10k_ce_completed_recv_next_nolock(ce_diag, 971 while (ath10k_ce_completed_recv_next(ce_diag, (void **)&buf,
987 (void **)&buf, 972 &completed_nbytes) != 0) {
988 &completed_nbytes)
989 != 0) {
990 udelay(DIAG_ACCESS_CE_WAIT_US); 973 udelay(DIAG_ACCESS_CE_WAIT_US);
991 i += DIAG_ACCESS_CE_WAIT_US; 974 i += DIAG_ACCESS_CE_WAIT_US;
992 975
@@ -1019,7 +1002,7 @@ done:
1019 dma_free_coherent(ar->dev, alloc_nbytes, data_buf, 1002 dma_free_coherent(ar->dev, alloc_nbytes, data_buf,
1020 ce_data_base); 1003 ce_data_base);
1021 1004
1022 spin_unlock_bh(&ce->ce_lock); 1005 mutex_unlock(&ar_pci->ce_diag_mutex);
1023 1006
1024 return ret; 1007 return ret;
1025} 1008}
@@ -1067,7 +1050,6 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1067 const void *data, int nbytes) 1050 const void *data, int nbytes)
1068{ 1051{
1069 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 1052 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1070 struct ath10k_ce *ce = ath10k_ce_priv(ar);
1071 int ret = 0; 1053 int ret = 0;
1072 u32 *buf; 1054 u32 *buf;
1073 unsigned int completed_nbytes, alloc_nbytes, remaining_bytes; 1055 unsigned int completed_nbytes, alloc_nbytes, remaining_bytes;
@@ -1076,8 +1058,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1076 dma_addr_t ce_data_base = 0; 1058 dma_addr_t ce_data_base = 0;
1077 int i; 1059 int i;
1078 1060
1079 spin_lock_bh(&ce->ce_lock); 1061 mutex_lock(&ar_pci->ce_diag_mutex);
1080
1081 ce_diag = ar_pci->ce_diag; 1062 ce_diag = ar_pci->ce_diag;
1082 1063
1083 /* 1064 /*
@@ -1118,7 +1099,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1118 memcpy(data_buf, data, nbytes); 1099 memcpy(data_buf, data, nbytes);
1119 1100
1120 /* Set up to receive directly into Target(!) address */ 1101 /* Set up to receive directly into Target(!) address */
1121 ret = ce_diag->ops->ce_rx_post_buf(ce_diag, &address, address); 1102 ret = ath10k_ce_rx_post_buf(ce_diag, &address, address);
1122 if (ret != 0) 1103 if (ret != 0)
1123 goto done; 1104 goto done;
1124 1105
@@ -1126,14 +1107,12 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1126 * Request CE to send caller-supplied data that 1107 * Request CE to send caller-supplied data that
1127 * was copied to bounce buffer to Target(!) address. 1108 * was copied to bounce buffer to Target(!) address.
1128 */ 1109 */
1129 ret = ath10k_ce_send_nolock(ce_diag, NULL, ce_data_base, 1110 ret = ath10k_ce_send(ce_diag, NULL, ce_data_base, nbytes, 0, 0);
1130 nbytes, 0, 0);
1131 if (ret != 0) 1111 if (ret != 0)
1132 goto done; 1112 goto done;
1133 1113
1134 i = 0; 1114 i = 0;
1135 while (ath10k_ce_completed_send_next_nolock(ce_diag, 1115 while (ath10k_ce_completed_send_next(ce_diag, NULL) != 0) {
1136 NULL) != 0) {
1137 udelay(DIAG_ACCESS_CE_WAIT_US); 1116 udelay(DIAG_ACCESS_CE_WAIT_US);
1138 i += DIAG_ACCESS_CE_WAIT_US; 1117 i += DIAG_ACCESS_CE_WAIT_US;
1139 1118
@@ -1144,10 +1123,8 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1144 } 1123 }
1145 1124
1146 i = 0; 1125 i = 0;
1147 while (ath10k_ce_completed_recv_next_nolock(ce_diag, 1126 while (ath10k_ce_completed_recv_next(ce_diag, (void **)&buf,
1148 (void **)&buf, 1127 &completed_nbytes) != 0) {
1149 &completed_nbytes)
1150 != 0) {
1151 udelay(DIAG_ACCESS_CE_WAIT_US); 1128 udelay(DIAG_ACCESS_CE_WAIT_US);
1152 i += DIAG_ACCESS_CE_WAIT_US; 1129 i += DIAG_ACCESS_CE_WAIT_US;
1153 1130
@@ -1182,7 +1159,7 @@ done:
1182 ath10k_warn(ar, "failed to write diag value at 0x%x: %d\n", 1159 ath10k_warn(ar, "failed to write diag value at 0x%x: %d\n",
1183 address, ret); 1160 address, ret);
1184 1161
1185 spin_unlock_bh(&ce->ce_lock); 1162 mutex_unlock(&ar_pci->ce_diag_mutex);
1186 1163
1187 return ret; 1164 return ret;
1188} 1165}
@@ -2283,7 +2260,7 @@ static int ath10k_pci_get_num_banks(struct ath10k *ar)
2283 return 1; 2260 return 1;
2284 case QCA6164_2_1_DEVICE_ID: 2261 case QCA6164_2_1_DEVICE_ID:
2285 case QCA6174_2_1_DEVICE_ID: 2262 case QCA6174_2_1_DEVICE_ID:
2286 switch (MS(ar->chip_id, SOC_CHIP_ID_REV)) { 2263 switch (MS(ar->bus_param.chip_id, SOC_CHIP_ID_REV)) {
2287 case QCA6174_HW_1_0_CHIP_ID_REV: 2264 case QCA6174_HW_1_0_CHIP_ID_REV:
2288 case QCA6174_HW_1_1_CHIP_ID_REV: 2265 case QCA6174_HW_1_1_CHIP_ID_REV:
2289 case QCA6174_HW_2_1_CHIP_ID_REV: 2266 case QCA6174_HW_2_1_CHIP_ID_REV:
@@ -2806,7 +2783,8 @@ static int ath10k_pci_chip_reset(struct ath10k *ar)
2806 return ar_pci->pci_hard_reset(ar); 2783 return ar_pci->pci_hard_reset(ar);
2807} 2784}
2808 2785
2809static int ath10k_pci_hif_power_up(struct ath10k *ar) 2786static int ath10k_pci_hif_power_up(struct ath10k *ar,
2787 enum ath10k_firmware_mode fw_mode)
2810{ 2788{
2811 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 2789 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
2812 int ret; 2790 int ret;
@@ -3462,6 +3440,7 @@ int ath10k_pci_setup_resource(struct ath10k *ar)
3462 3440
3463 spin_lock_init(&ce->ce_lock); 3441 spin_lock_init(&ce->ce_lock);
3464 spin_lock_init(&ar_pci->ps_lock); 3442 spin_lock_init(&ar_pci->ps_lock);
3443 mutex_init(&ar_pci->ce_diag_mutex);
3465 3444
3466 timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0); 3445 timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0);
3467 3446
@@ -3553,7 +3532,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3553 case QCA9377_1_0_DEVICE_ID: 3532 case QCA9377_1_0_DEVICE_ID:
3554 hw_rev = ATH10K_HW_QCA9377; 3533 hw_rev = ATH10K_HW_QCA9377;
3555 pci_ps = true; 3534 pci_ps = true;
3556 pci_soft_reset = NULL; 3535 pci_soft_reset = ath10k_pci_warm_reset;
3557 pci_hard_reset = ath10k_pci_qca6174_chip_reset; 3536 pci_hard_reset = ath10k_pci_qca6174_chip_reset;
3558 targ_cpu_to_ce_addr = ath10k_pci_qca6174_targ_cpu_to_ce_addr; 3537 targ_cpu_to_ce_addr = ath10k_pci_qca6174_targ_cpu_to_ce_addr;
3559 break; 3538 break;
@@ -3636,6 +3615,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
3636 } 3615 }
3637 3616
3638 bus_params.dev_type = ATH10K_DEV_TYPE_LL; 3617 bus_params.dev_type = ATH10K_DEV_TYPE_LL;
3618 bus_params.link_can_suspend = true;
3639 bus_params.chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); 3619 bus_params.chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
3640 if (bus_params.chip_id == 0xffffffff) { 3620 if (bus_params.chip_id == 0xffffffff) {
3641 ath10k_err(ar, "failed to get chip id\n"); 3621 ath10k_err(ar, "failed to get chip id\n");
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h
index e8d86331c539..3773c79f322f 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -1,24 +1,14 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#ifndef _PCI_H_ 7#ifndef _PCI_H_
19#define _PCI_H_ 8#define _PCI_H_
20 9
21#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/mutex.h>
22 12
23#include "hw.h" 13#include "hw.h"
24#include "ce.h" 14#include "ce.h"
@@ -128,6 +118,8 @@ struct ath10k_pci {
128 118
129 /* Copy Engine used for Diagnostic Accesses */ 119 /* Copy Engine used for Diagnostic Accesses */
130 struct ath10k_ce_pipe *ce_diag; 120 struct ath10k_ce_pipe *ce_diag;
121 /* For protecting ce_diag */
122 struct mutex ce_diag_mutex;
131 123
132 struct ath10k_ce ce; 124 struct ath10k_ce ce;
133 struct timer_list rx_post_retry; 125 struct timer_list rx_post_retry;
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c
index 37b3bd629f48..a7bc2c70d076 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include <linux/completion.h> 6#include <linux/completion.h>
diff --git a/drivers/net/wireless/ath/ath10k/qmi.h b/drivers/net/wireless/ath/ath10k/qmi.h
index 1efe1d22fc2f..e4aa20445666 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.h
+++ b/drivers/net/wireless/ath/ath10k/qmi.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16#ifndef _ATH10K_QMI_H_ 5#ifndef _ATH10K_QMI_H_
17#define _ATH10K_QMI_H_ 6#define _ATH10K_QMI_H_
diff --git a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
index ba79c2e4aed6..1fe05c6218c3 100644
--- a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
+++ b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include <linux/soc/qcom/qmi.h> 6#include <linux/soc/qcom/qmi.h>
@@ -1763,14 +1752,239 @@ struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[] = {
1763 daemon_support_valid), 1752 daemon_support_valid),
1764 }, 1753 },
1765 { 1754 {
1766 .data_type = QMI_UNSIGNED_1_BYTE, 1755 .data_type = QMI_UNSIGNED_4_BYTE,
1767 .elem_len = 1, 1756 .elem_len = 1,
1768 .elem_size = sizeof(u8), 1757 .elem_size = sizeof(u32),
1769 .array_type = NO_ARRAY, 1758 .array_type = NO_ARRAY,
1770 .tlv_type = 0x10, 1759 .tlv_type = 0x10,
1771 .offset = offsetof(struct wlfw_host_cap_req_msg_v01, 1760 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1772 daemon_support), 1761 daemon_support),
1773 }, 1762 },
1763 {
1764 .data_type = QMI_OPT_FLAG,
1765 .elem_len = 1,
1766 .elem_size = sizeof(u8),
1767 .array_type = NO_ARRAY,
1768 .tlv_type = 0x11,
1769 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1770 wake_msi_valid),
1771 },
1772 {
1773 .data_type = QMI_UNSIGNED_4_BYTE,
1774 .elem_len = 1,
1775 .elem_size = sizeof(u32),
1776 .array_type = NO_ARRAY,
1777 .tlv_type = 0x11,
1778 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1779 wake_msi),
1780 },
1781 {
1782 .data_type = QMI_OPT_FLAG,
1783 .elem_len = 1,
1784 .elem_size = sizeof(u8),
1785 .array_type = NO_ARRAY,
1786 .tlv_type = 0x12,
1787 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1788 gpios_valid),
1789 },
1790 {
1791 .data_type = QMI_DATA_LEN,
1792 .elem_len = 1,
1793 .elem_size = sizeof(u32),
1794 .array_type = NO_ARRAY,
1795 .tlv_type = 0x12,
1796 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1797 gpios_len),
1798 },
1799 {
1800 .data_type = QMI_UNSIGNED_4_BYTE,
1801 .elem_len = QMI_WLFW_MAX_NUM_GPIO_V01,
1802 .elem_size = sizeof(u32),
1803 .array_type = VAR_LEN_ARRAY,
1804 .tlv_type = 0x12,
1805 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1806 gpios),
1807 },
1808 {
1809 .data_type = QMI_OPT_FLAG,
1810 .elem_len = 1,
1811 .elem_size = sizeof(u8),
1812 .array_type = NO_ARRAY,
1813 .tlv_type = 0x13,
1814 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1815 nm_modem_valid),
1816 },
1817 {
1818 .data_type = QMI_UNSIGNED_1_BYTE,
1819 .elem_len = 1,
1820 .elem_size = sizeof(u8),
1821 .array_type = NO_ARRAY,
1822 .tlv_type = 0x13,
1823 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1824 nm_modem),
1825 },
1826 {
1827 .data_type = QMI_OPT_FLAG,
1828 .elem_len = 1,
1829 .elem_size = sizeof(u8),
1830 .array_type = NO_ARRAY,
1831 .tlv_type = 0x14,
1832 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1833 bdf_support_valid),
1834 },
1835 {
1836 .data_type = QMI_UNSIGNED_1_BYTE,
1837 .elem_len = 1,
1838 .elem_size = sizeof(u8),
1839 .array_type = NO_ARRAY,
1840 .tlv_type = 0x14,
1841 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1842 bdf_support),
1843 },
1844 {
1845 .data_type = QMI_OPT_FLAG,
1846 .elem_len = 1,
1847 .elem_size = sizeof(u8),
1848 .array_type = NO_ARRAY,
1849 .tlv_type = 0x15,
1850 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1851 bdf_cache_support_valid),
1852 },
1853 {
1854 .data_type = QMI_UNSIGNED_1_BYTE,
1855 .elem_len = 1,
1856 .elem_size = sizeof(u8),
1857 .array_type = NO_ARRAY,
1858 .tlv_type = 0x15,
1859 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1860 bdf_cache_support),
1861 },
1862 {
1863 .data_type = QMI_OPT_FLAG,
1864 .elem_len = 1,
1865 .elem_size = sizeof(u8),
1866 .array_type = NO_ARRAY,
1867 .tlv_type = 0x16,
1868 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1869 m3_support_valid),
1870 },
1871 {
1872 .data_type = QMI_UNSIGNED_1_BYTE,
1873 .elem_len = 1,
1874 .elem_size = sizeof(u8),
1875 .array_type = NO_ARRAY,
1876 .tlv_type = 0x16,
1877 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1878 m3_support),
1879 },
1880 {
1881 .data_type = QMI_OPT_FLAG,
1882 .elem_len = 1,
1883 .elem_size = sizeof(u8),
1884 .array_type = NO_ARRAY,
1885 .tlv_type = 0x17,
1886 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1887 m3_cache_support_valid),
1888 },
1889 {
1890 .data_type = QMI_UNSIGNED_1_BYTE,
1891 .elem_len = 1,
1892 .elem_size = sizeof(u8),
1893 .array_type = NO_ARRAY,
1894 .tlv_type = 0x17,
1895 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1896 m3_cache_support),
1897 },
1898 {
1899 .data_type = QMI_OPT_FLAG,
1900 .elem_len = 1,
1901 .elem_size = sizeof(u8),
1902 .array_type = NO_ARRAY,
1903 .tlv_type = 0x18,
1904 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1905 cal_filesys_support_valid),
1906 },
1907 {
1908 .data_type = QMI_UNSIGNED_1_BYTE,
1909 .elem_len = 1,
1910 .elem_size = sizeof(u8),
1911 .array_type = NO_ARRAY,
1912 .tlv_type = 0x18,
1913 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1914 cal_filesys_support),
1915 },
1916 {
1917 .data_type = QMI_OPT_FLAG,
1918 .elem_len = 1,
1919 .elem_size = sizeof(u8),
1920 .array_type = NO_ARRAY,
1921 .tlv_type = 0x19,
1922 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1923 cal_cache_support_valid),
1924 },
1925 {
1926 .data_type = QMI_UNSIGNED_1_BYTE,
1927 .elem_len = 1,
1928 .elem_size = sizeof(u8),
1929 .array_type = NO_ARRAY,
1930 .tlv_type = 0x19,
1931 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1932 cal_cache_support),
1933 },
1934 {
1935 .data_type = QMI_OPT_FLAG,
1936 .elem_len = 1,
1937 .elem_size = sizeof(u8),
1938 .array_type = NO_ARRAY,
1939 .tlv_type = 0x1A,
1940 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1941 cal_done_valid),
1942 },
1943 {
1944 .data_type = QMI_UNSIGNED_1_BYTE,
1945 .elem_len = 1,
1946 .elem_size = sizeof(u8),
1947 .array_type = NO_ARRAY,
1948 .tlv_type = 0x1A,
1949 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1950 cal_done),
1951 },
1952 {
1953 .data_type = QMI_OPT_FLAG,
1954 .elem_len = 1,
1955 .elem_size = sizeof(u8),
1956 .array_type = NO_ARRAY,
1957 .tlv_type = 0x1B,
1958 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1959 mem_bucket_valid),
1960 },
1961 {
1962 .data_type = QMI_UNSIGNED_4_BYTE,
1963 .elem_len = 1,
1964 .elem_size = sizeof(u32),
1965 .array_type = NO_ARRAY,
1966 .tlv_type = 0x1B,
1967 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1968 mem_bucket),
1969 },
1970 {
1971 .data_type = QMI_OPT_FLAG,
1972 .elem_len = 1,
1973 .elem_size = sizeof(u8),
1974 .array_type = NO_ARRAY,
1975 .tlv_type = 0x1C,
1976 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1977 mem_cfg_mode_valid),
1978 },
1979 {
1980 .data_type = QMI_UNSIGNED_1_BYTE,
1981 .elem_len = 1,
1982 .elem_size = sizeof(u8),
1983 .array_type = NO_ARRAY,
1984 .tlv_type = 0x1C,
1985 .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
1986 mem_cfg_mode),
1987 },
1774 {} 1988 {}
1775}; 1989};
1776 1990
diff --git a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h
index c5e3870b8871..bca1186e1560 100644
--- a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h
+++ b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#ifndef WCN3990_QMI_SVC_V01_H 6#ifndef WCN3990_QMI_SVC_V01_H
@@ -553,12 +542,38 @@ struct wlfw_mac_addr_resp_msg_v01 {
553#define WLFW_MAC_ADDR_RESP_MSG_V01_MAX_MSG_LEN 7 542#define WLFW_MAC_ADDR_RESP_MSG_V01_MAX_MSG_LEN 7
554extern struct qmi_elem_info wlfw_mac_addr_resp_msg_v01_ei[]; 543extern struct qmi_elem_info wlfw_mac_addr_resp_msg_v01_ei[];
555 544
545#define QMI_WLFW_MAX_NUM_GPIO_V01 32
556struct wlfw_host_cap_req_msg_v01 { 546struct wlfw_host_cap_req_msg_v01 {
557 u8 daemon_support_valid; 547 u8 daemon_support_valid;
558 u8 daemon_support; 548 u32 daemon_support;
559}; 549 u8 wake_msi_valid;
560 550 u32 wake_msi;
561#define WLFW_HOST_CAP_REQ_MSG_V01_MAX_MSG_LEN 4 551 u8 gpios_valid;
552 u32 gpios_len;
553 u32 gpios[QMI_WLFW_MAX_NUM_GPIO_V01];
554 u8 nm_modem_valid;
555 u8 nm_modem;
556 u8 bdf_support_valid;
557 u8 bdf_support;
558 u8 bdf_cache_support_valid;
559 u8 bdf_cache_support;
560 u8 m3_support_valid;
561 u8 m3_support;
562 u8 m3_cache_support_valid;
563 u8 m3_cache_support;
564 u8 cal_filesys_support_valid;
565 u8 cal_filesys_support;
566 u8 cal_cache_support_valid;
567 u8 cal_cache_support;
568 u8 cal_done_valid;
569 u8 cal_done;
570 u8 mem_bucket_valid;
571 u32 mem_bucket;
572 u8 mem_cfg_mode_valid;
573 u8 mem_cfg_mode;
574};
575
576#define WLFW_HOST_CAP_REQ_MSG_V01_MAX_MSG_LEN 189
562extern struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[]; 577extern struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[];
563 578
564struct wlfw_host_cap_resp_msg_v01 { 579struct wlfw_host_cap_resp_msg_v01 {
diff --git a/drivers/net/wireless/ath/ath10k/rx_desc.h b/drivers/net/wireless/ath/ath10k/rx_desc.h
index dfbfe674e11e..dec1582005b9 100644
--- a/drivers/net/wireless/ath/ath10k/rx_desc.h
+++ b/drivers/net/wireless/ath/ath10k/rx_desc.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#ifndef _RX_DESC_H_ 7#ifndef _RX_DESC_H_
diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c
index 983ecfef1d28..d62502f386f2 100644
--- a/drivers/net/wireless/ath/ath10k/sdio.c
+++ b/drivers/net/wireless/ath/ath10k/sdio.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2004-2011 Atheros Communications Inc. 3 * Copyright (c) 2004-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2012,2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2012,2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com> 5 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include <linux/module.h> 8#include <linux/module.h>
@@ -1381,7 +1370,8 @@ static int ath10k_sdio_hif_disable_intrs(struct ath10k *ar)
1381 return ret; 1370 return ret;
1382} 1371}
1383 1372
1384static int ath10k_sdio_hif_power_up(struct ath10k *ar) 1373static int ath10k_sdio_hif_power_up(struct ath10k *ar,
1374 enum ath10k_firmware_mode fw_mode)
1385{ 1375{
1386 struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); 1376 struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar);
1387 struct sdio_func *func = ar_sdio->func; 1377 struct sdio_func *func = ar_sdio->func;
@@ -1615,12 +1605,33 @@ static int ath10k_sdio_hif_diag_write_mem(struct ath10k *ar, u32 address,
1615 return 0; 1605 return 0;
1616} 1606}
1617 1607
1608static int ath10k_sdio_hif_swap_mailbox(struct ath10k *ar)
1609{
1610 struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar);
1611 u32 addr, val;
1612 int ret = 0;
1613
1614 addr = host_interest_item_address(HI_ITEM(hi_acs_flags));
1615
1616 ret = ath10k_sdio_hif_diag_read32(ar, addr, &val);
1617 if (ret) {
1618 ath10k_warn(ar, "unable to read hi_acs_flags : %d\n", ret);
1619 return ret;
1620 }
1621
1622 if (val & HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_FW_ACK) {
1623 ath10k_dbg(ar, ATH10K_DBG_SDIO,
1624 "sdio mailbox swap service enabled\n");
1625 ar_sdio->swap_mbox = true;
1626 }
1627 return 0;
1628}
1629
1618/* HIF start/stop */ 1630/* HIF start/stop */
1619 1631
1620static int ath10k_sdio_hif_start(struct ath10k *ar) 1632static int ath10k_sdio_hif_start(struct ath10k *ar)
1621{ 1633{
1622 struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); 1634 struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar);
1623 u32 addr, val;
1624 int ret; 1635 int ret;
1625 1636
1626 /* Sleep 20 ms before HIF interrupts are disabled. 1637 /* Sleep 20 ms before HIF interrupts are disabled.
@@ -1654,20 +1665,6 @@ static int ath10k_sdio_hif_start(struct ath10k *ar)
1654 if (ret) 1665 if (ret)
1655 ath10k_warn(ar, "failed to enable sdio interrupts: %d\n", ret); 1666 ath10k_warn(ar, "failed to enable sdio interrupts: %d\n", ret);
1656 1667
1657 addr = host_interest_item_address(HI_ITEM(hi_acs_flags));
1658
1659 ret = ath10k_sdio_hif_diag_read32(ar, addr, &val);
1660 if (ret) {
1661 ath10k_warn(ar, "unable to read hi_acs_flags address: %d\n", ret);
1662 return ret;
1663 }
1664
1665 if (val & HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_FW_ACK) {
1666 ath10k_dbg(ar, ATH10K_DBG_SDIO,
1667 "sdio mailbox swap service enabled\n");
1668 ar_sdio->swap_mbox = true;
1669 }
1670
1671 /* Enable sleep and then disable it again */ 1668 /* Enable sleep and then disable it again */
1672 ret = ath10k_sdio_hif_set_mbox_sleep(ar, true); 1669 ret = ath10k_sdio_hif_set_mbox_sleep(ar, true);
1673 if (ret) 1670 if (ret)
@@ -1898,6 +1895,7 @@ static const struct ath10k_hif_ops ath10k_sdio_hif_ops = {
1898 .exchange_bmi_msg = ath10k_sdio_bmi_exchange_msg, 1895 .exchange_bmi_msg = ath10k_sdio_bmi_exchange_msg,
1899 .start = ath10k_sdio_hif_start, 1896 .start = ath10k_sdio_hif_start,
1900 .stop = ath10k_sdio_hif_stop, 1897 .stop = ath10k_sdio_hif_stop,
1898 .swap_mailbox = ath10k_sdio_hif_swap_mailbox,
1901 .map_service_to_pipe = ath10k_sdio_hif_map_service_to_pipe, 1899 .map_service_to_pipe = ath10k_sdio_hif_map_service_to_pipe,
1902 .get_default_pipe = ath10k_sdio_hif_get_default_pipe, 1900 .get_default_pipe = ath10k_sdio_hif_get_default_pipe,
1903 .send_complete_check = ath10k_sdio_hif_send_complete_check, 1901 .send_complete_check = ath10k_sdio_hif_send_complete_check,
@@ -2088,7 +2086,10 @@ static struct sdio_driver ath10k_sdio_driver = {
2088 .id_table = ath10k_sdio_devices, 2086 .id_table = ath10k_sdio_devices,
2089 .probe = ath10k_sdio_probe, 2087 .probe = ath10k_sdio_probe,
2090 .remove = ath10k_sdio_remove, 2088 .remove = ath10k_sdio_remove,
2091 .drv.pm = ATH10K_SDIO_PM_OPS, 2089 .drv = {
2090 .owner = THIS_MODULE,
2091 .pm = ATH10K_SDIO_PM_OPS,
2092 },
2092}; 2093};
2093 2094
2094static int __init ath10k_sdio_init(void) 2095static int __init ath10k_sdio_init(void)
diff --git a/drivers/net/wireless/ath/ath10k/sdio.h b/drivers/net/wireless/ath/ath10k/sdio.h
index 453eb6263143..b8c7ac0330bd 100644
--- a/drivers/net/wireless/ath/ath10k/sdio.h
+++ b/drivers/net/wireless/ath/ath10k/sdio.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2004-2011 Atheros Communications Inc. 3 * Copyright (c) 2004-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2012 Qualcomm Atheros, Inc.
4 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com> 5 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _SDIO_H_ 8#ifndef _SDIO_H_
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index 54efe6be8f1d..873cb4ce419b 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include <linux/clk.h> 6#include <linux/clk.h>
@@ -30,6 +19,7 @@
30 19
31#define ATH10K_SNOC_RX_POST_RETRY_MS 50 20#define ATH10K_SNOC_RX_POST_RETRY_MS 50
32#define CE_POLL_PIPE 4 21#define CE_POLL_PIPE 4
22#define ATH10K_SNOC_WAKE_IRQ 2
33 23
34static char *const ce_name[] = { 24static char *const ce_name[] = {
35 "WLAN_CE_0", 25 "WLAN_CE_0",
@@ -66,7 +56,7 @@ static void ath10k_snoc_pktlog_rx_cb(struct ath10k_ce_pipe *ce_state);
66 56
67static const struct ath10k_snoc_drv_priv drv_priv = { 57static const struct ath10k_snoc_drv_priv drv_priv = {
68 .hw_rev = ATH10K_HW_WCN3990, 58 .hw_rev = ATH10K_HW_WCN3990,
69 .dma_mask = DMA_BIT_MASK(37), 59 .dma_mask = DMA_BIT_MASK(35),
70 .msa_size = 0x100000, 60 .msa_size = 0x100000,
71}; 61};
72 62
@@ -875,13 +865,11 @@ static void ath10k_snoc_tx_pipe_cleanup(struct ath10k_snoc_pipe *snoc_pipe)
875{ 865{
876 struct ath10k_ce_pipe *ce_pipe; 866 struct ath10k_ce_pipe *ce_pipe;
877 struct ath10k_ce_ring *ce_ring; 867 struct ath10k_ce_ring *ce_ring;
878 struct ath10k_snoc *ar_snoc;
879 struct sk_buff *skb; 868 struct sk_buff *skb;
880 struct ath10k *ar; 869 struct ath10k *ar;
881 int i; 870 int i;
882 871
883 ar = snoc_pipe->hif_ce_state; 872 ar = snoc_pipe->hif_ce_state;
884 ar_snoc = ath10k_snoc_priv(ar);
885 ce_pipe = snoc_pipe->ce_hdl; 873 ce_pipe = snoc_pipe->ce_hdl;
886 ce_ring = ce_pipe->src_ring; 874 ce_ring = ce_pipe->src_ring;
887 875
@@ -958,7 +946,8 @@ static int ath10k_snoc_init_pipes(struct ath10k *ar)
958 return 0; 946 return 0;
959} 947}
960 948
961static int ath10k_snoc_wlan_enable(struct ath10k *ar) 949static int ath10k_snoc_wlan_enable(struct ath10k *ar,
950 enum ath10k_firmware_mode fw_mode)
962{ 951{
963 struct ath10k_tgt_pipe_cfg tgt_cfg[CE_COUNT_MAX]; 952 struct ath10k_tgt_pipe_cfg tgt_cfg[CE_COUNT_MAX];
964 struct ath10k_qmi_wlan_enable_cfg cfg; 953 struct ath10k_qmi_wlan_enable_cfg cfg;
@@ -992,7 +981,17 @@ static int ath10k_snoc_wlan_enable(struct ath10k *ar)
992 cfg.shadow_reg_cfg = (struct ath10k_shadow_reg_cfg *) 981 cfg.shadow_reg_cfg = (struct ath10k_shadow_reg_cfg *)
993 &target_shadow_reg_cfg_map; 982 &target_shadow_reg_cfg_map;
994 983
995 mode = QMI_WLFW_MISSION_V01; 984 switch (fw_mode) {
985 case ATH10K_FIRMWARE_MODE_NORMAL:
986 mode = QMI_WLFW_MISSION_V01;
987 break;
988 case ATH10K_FIRMWARE_MODE_UTF:
989 mode = QMI_WLFW_FTM_V01;
990 break;
991 default:
992 ath10k_err(ar, "invalid firmware mode %d\n", fw_mode);
993 return -EINVAL;
994 }
996 995
997 return ath10k_qmi_wlan_enable(ar, &cfg, mode, 996 return ath10k_qmi_wlan_enable(ar, &cfg, mode,
998 NULL); 997 NULL);
@@ -1000,7 +999,16 @@ static int ath10k_snoc_wlan_enable(struct ath10k *ar)
1000 999
1001static void ath10k_snoc_wlan_disable(struct ath10k *ar) 1000static void ath10k_snoc_wlan_disable(struct ath10k *ar)
1002{ 1001{
1003 if (!test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) 1002 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
1003
1004 /* If both ATH10K_FLAG_CRASH_FLUSH and ATH10K_SNOC_FLAG_RECOVERY
1005 * flags are not set, it means that the driver has restarted
1006 * due to a crash inject via debugfs. In this case, the driver
1007 * needs to restart the firmware and hence send qmi wlan disable,
1008 * during the driver restart sequence.
1009 */
1010 if (!test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags) ||
1011 !test_bit(ATH10K_SNOC_FLAG_RECOVERY, &ar_snoc->flags))
1004 ath10k_qmi_wlan_disable(ar); 1012 ath10k_qmi_wlan_disable(ar);
1005} 1013}
1006 1014
@@ -1012,14 +1020,15 @@ static void ath10k_snoc_hif_power_down(struct ath10k *ar)
1012 ath10k_ce_free_rri(ar); 1020 ath10k_ce_free_rri(ar);
1013} 1021}
1014 1022
1015static int ath10k_snoc_hif_power_up(struct ath10k *ar) 1023static int ath10k_snoc_hif_power_up(struct ath10k *ar,
1024 enum ath10k_firmware_mode fw_mode)
1016{ 1025{
1017 int ret; 1026 int ret;
1018 1027
1019 ath10k_dbg(ar, ATH10K_DBG_SNOC, "%s:WCN3990 driver state = %d\n", 1028 ath10k_dbg(ar, ATH10K_DBG_SNOC, "%s:WCN3990 driver state = %d\n",
1020 __func__, ar->state); 1029 __func__, ar->state);
1021 1030
1022 ret = ath10k_snoc_wlan_enable(ar); 1031 ret = ath10k_snoc_wlan_enable(ar, fw_mode);
1023 if (ret) { 1032 if (ret) {
1024 ath10k_err(ar, "failed to enable wcn3990: %d\n", ret); 1033 ath10k_err(ar, "failed to enable wcn3990: %d\n", ret);
1025 return ret; 1034 return ret;
@@ -1041,6 +1050,46 @@ err_wlan_enable:
1041 return ret; 1050 return ret;
1042} 1051}
1043 1052
1053#ifdef CONFIG_PM
1054static int ath10k_snoc_hif_suspend(struct ath10k *ar)
1055{
1056 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
1057 int ret;
1058
1059 if (!device_may_wakeup(ar->dev))
1060 return -EPERM;
1061
1062 ret = enable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
1063 if (ret) {
1064 ath10k_err(ar, "failed to enable wakeup irq :%d\n", ret);
1065 return ret;
1066 }
1067
1068 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device suspended\n");
1069
1070 return ret;
1071}
1072
1073static int ath10k_snoc_hif_resume(struct ath10k *ar)
1074{
1075 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
1076 int ret;
1077
1078 if (!device_may_wakeup(ar->dev))
1079 return -EPERM;
1080
1081 ret = disable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
1082 if (ret) {
1083 ath10k_err(ar, "failed to disable wakeup irq: %d\n", ret);
1084 return ret;
1085 }
1086
1087 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device resumed\n");
1088
1089 return ret;
1090}
1091#endif
1092
1044static const struct ath10k_hif_ops ath10k_snoc_hif_ops = { 1093static const struct ath10k_hif_ops ath10k_snoc_hif_ops = {
1045 .read32 = ath10k_snoc_read32, 1094 .read32 = ath10k_snoc_read32,
1046 .write32 = ath10k_snoc_write32, 1095 .write32 = ath10k_snoc_write32,
@@ -1054,6 +1103,10 @@ static const struct ath10k_hif_ops ath10k_snoc_hif_ops = {
1054 .send_complete_check = ath10k_snoc_hif_send_complete_check, 1103 .send_complete_check = ath10k_snoc_hif_send_complete_check,
1055 .get_free_queue_number = ath10k_snoc_hif_get_free_queue_number, 1104 .get_free_queue_number = ath10k_snoc_hif_get_free_queue_number,
1056 .get_target_info = ath10k_snoc_hif_get_target_info, 1105 .get_target_info = ath10k_snoc_hif_get_target_info,
1106#ifdef CONFIG_PM
1107 .suspend = ath10k_snoc_hif_suspend,
1108 .resume = ath10k_snoc_hif_resume,
1109#endif
1057}; 1110};
1058 1111
1059static const struct ath10k_bus_ops ath10k_snoc_bus_ops = { 1112static const struct ath10k_bus_ops ath10k_snoc_bus_ops = {
diff --git a/drivers/net/wireless/ath/ath10k/snoc.h b/drivers/net/wireless/ath/ath10k/snoc.h
index 2b2f23cf7c5d..d62f53501fbb 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.h
+++ b/drivers/net/wireless/ath/ath10k/snoc.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#ifndef _SNOC_H_ 6#ifndef _SNOC_H_
@@ -90,7 +79,7 @@ struct ath10k_snoc {
90 struct ath10k_vreg_info *vreg; 79 struct ath10k_vreg_info *vreg;
91 struct ath10k_clk_info *clk; 80 struct ath10k_clk_info *clk;
92 struct ath10k_qmi *qmi; 81 struct ath10k_qmi *qmi;
93 unsigned long int flags; 82 unsigned long flags;
94}; 83};
95 84
96static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar) 85static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar)
diff --git a/drivers/net/wireless/ath/ath10k/spectral.c b/drivers/net/wireless/ath/ath10k/spectral.c
index 653b6d013207..5db6bff5193b 100644
--- a/drivers/net/wireless/ath/ath10k/spectral.c
+++ b/drivers/net/wireless/ath/ath10k/spectral.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2013-2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2013-2017 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include <linux/relay.h> 6#include <linux/relay.h>
@@ -494,6 +483,9 @@ static struct dentry *create_buf_file_handler(const char *filename,
494 483
495 buf_file = debugfs_create_file(filename, mode, parent, buf, 484 buf_file = debugfs_create_file(filename, mode, parent, buf,
496 &relay_file_operations); 485 &relay_file_operations);
486 if (IS_ERR(buf_file))
487 return NULL;
488
497 *is_global = 1; 489 *is_global = 1;
498 return buf_file; 490 return buf_file;
499} 491}
diff --git a/drivers/net/wireless/ath/ath10k/spectral.h b/drivers/net/wireless/ath/ath10k/spectral.h
index 13276f4dc12c..5f481f11c6e5 100644
--- a/drivers/net/wireless/ath/ath10k/spectral.h
+++ b/drivers/net/wireless/ath/ath10k/spectral.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2013-2015 Qualcomm Atheros, Inc. 3 * Copyright (c) 2013-2015 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#ifndef SPECTRAL_H 6#ifndef SPECTRAL_H
diff --git a/drivers/net/wireless/ath/ath10k/swap.c b/drivers/net/wireless/ath/ath10k/swap.c
index e7f57efadae1..4dddeee684b4 100644
--- a/drivers/net/wireless/ath/ath10k/swap.c
+++ b/drivers/net/wireless/ath/ath10k/swap.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2015-2016 Qualcomm Atheros, Inc. 3 * Copyright (c) 2015-2016 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17/* This file has implementation for code swap logic. With code swap feature, 6/* This file has implementation for code swap logic. With code swap feature,
diff --git a/drivers/net/wireless/ath/ath10k/swap.h b/drivers/net/wireless/ath/ath10k/swap.h
index fa602f15fa93..25e0ad36ddb1 100644
--- a/drivers/net/wireless/ath/ath10k/swap.h
+++ b/drivers/net/wireless/ath/ath10k/swap.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2015-2016 Qualcomm Atheros, Inc. 3 * Copyright (c) 2015-2016 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#ifndef _SWAP_H_ 6#ifndef _SWAP_H_
diff --git a/drivers/net/wireless/ath/ath10k/targaddrs.h b/drivers/net/wireless/ath/ath10k/targaddrs.h
index b11a1c3d87b4..dff6c8ac9dba 100644
--- a/drivers/net/wireless/ath/ath10k/targaddrs.h
+++ b/drivers/net/wireless/ath/ath10k/targaddrs.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#ifndef __TARGADDRS_H__ 7#ifndef __TARGADDRS_H__
diff --git a/drivers/net/wireless/ath/ath10k/testmode.c b/drivers/net/wireless/ath/ath10k/testmode.c
index c24ee616833c..6433ff10d80e 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.c
+++ b/drivers/net/wireless/ath/ath10k/testmode.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include "testmode.h" 6#include "testmode.h"
@@ -270,7 +259,7 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr *tb[])
270 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode wmi version %d\n", 259 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode wmi version %d\n",
271 ar->testmode.utf_mode_fw.fw_file.wmi_op_version); 260 ar->testmode.utf_mode_fw.fw_file.wmi_op_version);
272 261
273 ret = ath10k_hif_power_up(ar); 262 ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_UTF);
274 if (ret) { 263 if (ret) {
275 ath10k_err(ar, "failed to power up hif (testmode): %d\n", ret); 264 ath10k_err(ar, "failed to power up hif (testmode): %d\n", ret);
276 ar->state = ATH10K_STATE_OFF; 265 ar->state = ATH10K_STATE_OFF;
diff --git a/drivers/net/wireless/ath/ath10k/testmode.h b/drivers/net/wireless/ath/ath10k/testmode.h
index 9cdd150815db..6488fd514ae3 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.h
+++ b/drivers/net/wireless/ath/ath10k/testmode.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2014 Qualcomm Atheros, Inc. 3 * Copyright (c) 2014 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include "core.h" 6#include "core.h"
diff --git a/drivers/net/wireless/ath/ath10k/testmode_i.h b/drivers/net/wireless/ath/ath10k/testmode_i.h
index 6514d1a14242..ee1cb27c1d60 100644
--- a/drivers/net/wireless/ath/ath10k/testmode_i.h
+++ b/drivers/net/wireless/ath/ath10k/testmode_i.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2014,2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2014,2017 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17/* "API" level of the ath10k testmode interface. Bump it after every 6/* "API" level of the ath10k testmode interface. Bump it after every
diff --git a/drivers/net/wireless/ath/ath10k/thermal.c b/drivers/net/wireless/ath/ath10k/thermal.c
index fe35edcd3ec8..36c9a1364253 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2014-2015 Qualcomm Atheros, Inc. 3 * Copyright (c) 2014-2015 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include <linux/device.h> 6#include <linux/device.h>
diff --git a/drivers/net/wireless/ath/ath10k/thermal.h b/drivers/net/wireless/ath/ath10k/thermal.h
index 65e2419543f9..5fdb020f4da3 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.h
+++ b/drivers/net/wireless/ath/ath10k/thermal.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2014-2016 Qualcomm Atheros, Inc. 3 * Copyright (c) 2014-2016 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16#ifndef _THERMAL_ 5#ifndef _THERMAL_
17#define _THERMAL_ 6#define _THERMAL_
diff --git a/drivers/net/wireless/ath/ath10k/trace.c b/drivers/net/wireless/ath/ath10k/trace.c
index 4a31e2c6fbd4..3ecdff17f64e 100644
--- a/drivers/net/wireless/ath/ath10k/trace.c
+++ b/drivers/net/wireless/ath/ath10k/trace.c
@@ -1,17 +1,6 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc. 3 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16 5
17#include <linux/module.h> 6#include <linux/module.h>
diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index 7d2fac342150..ba977bbe6291 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) 7#if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 23606b6972d0..c5818d28f55a 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include "core.h" 8#include "core.h"
@@ -95,7 +84,11 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
95 wake_up(&htt->empty_tx_wq); 84 wake_up(&htt->empty_tx_wq);
96 spin_unlock_bh(&htt->tx_lock); 85 spin_unlock_bh(&htt->tx_lock);
97 86
98 if (ar->dev_type != ATH10K_DEV_TYPE_HL) 87 if (txq && txq->sta && skb_cb->airtime_est)
88 ieee80211_sta_register_airtime(txq->sta, txq->tid,
89 skb_cb->airtime_est, 0);
90
91 if (ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL)
99 dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); 92 dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
100 93
101 ath10k_report_offchan_tx(htt->ar, msdu); 94 ath10k_report_offchan_tx(htt->ar, msdu);
diff --git a/drivers/net/wireless/ath/ath10k/txrx.h b/drivers/net/wireless/ath/ath10k/txrx.h
index 2bf401e436d3..ecac441d83a7 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.h
+++ b/drivers/net/wireless/ath/ath10k/txrx.h
@@ -1,18 +1,7 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2014,2016 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2014,2016 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17#ifndef _TXRX_H_ 6#ifndef _TXRX_H_
18#define _TXRX_H_ 7#define _TXRX_H_
diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c
index f731d35ee76d..970cf69ac35f 100644
--- a/drivers/net/wireless/ath/ath10k/usb.c
+++ b/drivers/net/wireless/ath/ath10k/usb.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2007-2011 Atheros Communications Inc. 3 * Copyright (c) 2007-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2012,2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2012,2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com> 5 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include <linux/module.h> 8#include <linux/module.h>
@@ -706,7 +695,8 @@ static void ath10k_usb_hif_send_complete_check(struct ath10k *ar,
706{ 695{
707} 696}
708 697
709static int ath10k_usb_hif_power_up(struct ath10k *ar) 698static int ath10k_usb_hif_power_up(struct ath10k *ar,
699 enum ath10k_firmware_mode fw_mode)
710{ 700{
711 return 0; 701 return 0;
712} 702}
diff --git a/drivers/net/wireless/ath/ath10k/usb.h b/drivers/net/wireless/ath/ath10k/usb.h
index f60a3cc7d712..34d683e8fc18 100644
--- a/drivers/net/wireless/ath/ath10k/usb.h
+++ b/drivers/net/wireless/ath/ath10k/usb.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2004-2011 Atheros Communications Inc. 3 * Copyright (c) 2004-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2012 Qualcomm Atheros, Inc.
4 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com> 5 * Copyright (c) 2016-2017 Erik Stromdahl <erik.stromdahl@gmail.com>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _USB_H_ 8#ifndef _USB_H_
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 04663076d27a..1491c25518bb 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _WMI_OPS_H_ 8#ifndef _WMI_OPS_H_
@@ -33,6 +22,9 @@ struct wmi_ops {
33 struct wmi_mgmt_rx_ev_arg *arg); 22 struct wmi_mgmt_rx_ev_arg *arg);
34 int (*pull_mgmt_tx_compl)(struct ath10k *ar, struct sk_buff *skb, 23 int (*pull_mgmt_tx_compl)(struct ath10k *ar, struct sk_buff *skb,
35 struct wmi_tlv_mgmt_tx_compl_ev_arg *arg); 24 struct wmi_tlv_mgmt_tx_compl_ev_arg *arg);
25 int (*pull_mgmt_tx_bundle_compl)(
26 struct ath10k *ar, struct sk_buff *skb,
27 struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg *arg);
36 int (*pull_ch_info)(struct ath10k *ar, struct sk_buff *skb, 28 int (*pull_ch_info)(struct ath10k *ar, struct sk_buff *skb,
37 struct wmi_ch_info_ev_arg *arg); 29 struct wmi_ch_info_ev_arg *arg);
38 int (*pull_vdev_start)(struct ath10k *ar, struct sk_buff *skb, 30 int (*pull_vdev_start)(struct ath10k *ar, struct sk_buff *skb,
@@ -66,6 +58,8 @@ struct wmi_ops {
66 58
67 struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt); 59 struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt);
68 struct sk_buff *(*gen_pdev_resume)(struct ath10k *ar); 60 struct sk_buff *(*gen_pdev_resume)(struct ath10k *ar);
61 struct sk_buff *(*gen_pdev_set_base_macaddr)(struct ath10k *ar,
62 const u8 macaddr[ETH_ALEN]);
69 struct sk_buff *(*gen_pdev_set_rd)(struct ath10k *ar, u16 rd, u16 rd2g, 63 struct sk_buff *(*gen_pdev_set_rd)(struct ath10k *ar, u16 rd, u16 rd2g,
70 u16 rd5g, u16 ctl2g, u16 ctl5g, 64 u16 rd5g, u16 ctl2g, u16 ctl5g,
71 enum wmi_dfs_region dfs_reg); 65 enum wmi_dfs_region dfs_reg);
@@ -280,6 +274,16 @@ ath10k_wmi_pull_mgmt_tx_compl(struct ath10k *ar, struct sk_buff *skb,
280} 274}
281 275
282static inline int 276static inline int
277ath10k_wmi_pull_mgmt_tx_bundle_compl(struct ath10k *ar, struct sk_buff *skb,
278 struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg *arg)
279{
280 if (!ar->wmi.ops->pull_mgmt_tx_bundle_compl)
281 return -EOPNOTSUPP;
282
283 return ar->wmi.ops->pull_mgmt_tx_bundle_compl(ar, skb, arg);
284}
285
286static inline int
283ath10k_wmi_pull_mgmt_rx(struct ath10k *ar, struct sk_buff *skb, 287ath10k_wmi_pull_mgmt_rx(struct ath10k *ar, struct sk_buff *skb,
284 struct wmi_mgmt_rx_ev_arg *arg) 288 struct wmi_mgmt_rx_ev_arg *arg)
285{ 289{
@@ -507,6 +511,22 @@ ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g,
507} 511}
508 512
509static inline int 513static inline int
514ath10k_wmi_pdev_set_base_macaddr(struct ath10k *ar, const u8 macaddr[ETH_ALEN])
515{
516 struct sk_buff *skb;
517
518 if (!ar->wmi.ops->gen_pdev_set_base_macaddr)
519 return -EOPNOTSUPP;
520
521 skb = ar->wmi.ops->gen_pdev_set_base_macaddr(ar, macaddr);
522 if (IS_ERR(skb))
523 return PTR_ERR(skb);
524
525 return ath10k_wmi_cmd_send(ar, skb,
526 ar->wmi.cmd->pdev_set_base_macaddr_cmdid);
527}
528
529static inline int
510ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt) 530ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt)
511{ 531{
512 struct sk_buff *skb; 532 struct sk_buff *skb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 892bd8c30dd9..fc62174a115c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18#include "core.h" 7#include "core.h"
19#include "debug.h" 8#include "debug.h"
@@ -620,6 +609,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
620 case WMI_TLV_MGMT_TX_COMPLETION_EVENTID: 609 case WMI_TLV_MGMT_TX_COMPLETION_EVENTID:
621 ath10k_wmi_event_mgmt_tx_compl(ar, skb); 610 ath10k_wmi_event_mgmt_tx_compl(ar, skb);
622 break; 611 break;
612 case WMI_TLV_MGMT_TX_BUNDLE_COMPLETION_EVENTID:
613 ath10k_wmi_event_mgmt_tx_bundle_compl(ar, skb);
614 break;
623 default: 615 default:
624 ath10k_dbg(ar, ATH10K_DBG_WMI, "Unknown eventid: %d\n", id); 616 ath10k_dbg(ar, ATH10K_DBG_WMI, "Unknown eventid: %d\n", id);
625 break; 617 break;
@@ -686,6 +678,65 @@ ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev(struct ath10k *ar, struct sk_buff *skb,
686 return 0; 678 return 0;
687} 679}
688 680
681struct wmi_tlv_tx_bundle_compl_parse {
682 const __le32 *num_reports;
683 const __le32 *desc_ids;
684 const __le32 *status;
685 bool desc_ids_done;
686 bool status_done;
687};
688
689static int
690ath10k_wmi_tlv_mgmt_tx_bundle_compl_parse(struct ath10k *ar, u16 tag, u16 len,
691 const void *ptr, void *data)
692{
693 struct wmi_tlv_tx_bundle_compl_parse *bundle_tx_compl = data;
694
695 switch (tag) {
696 case WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_BUNDLE_EVENT:
697 bundle_tx_compl->num_reports = ptr;
698 break;
699 case WMI_TLV_TAG_ARRAY_UINT32:
700 if (!bundle_tx_compl->desc_ids_done) {
701 bundle_tx_compl->desc_ids_done = true;
702 bundle_tx_compl->desc_ids = ptr;
703 } else if (!bundle_tx_compl->status_done) {
704 bundle_tx_compl->status_done = true;
705 bundle_tx_compl->status = ptr;
706 }
707 break;
708 default:
709 break;
710 }
711 return 0;
712}
713
714static int ath10k_wmi_tlv_op_pull_mgmt_tx_bundle_compl_ev(
715 struct ath10k *ar, struct sk_buff *skb,
716 struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg *arg)
717{
718 struct wmi_tlv_tx_bundle_compl_parse bundle_tx_compl = { };
719 int ret;
720
721 ret = ath10k_wmi_tlv_iter(ar, skb->data, skb->len,
722 ath10k_wmi_tlv_mgmt_tx_bundle_compl_parse,
723 &bundle_tx_compl);
724 if (ret) {
725 ath10k_warn(ar, "failed to parse tlv: %d\n", ret);
726 return ret;
727 }
728
729 if (!bundle_tx_compl.num_reports || !bundle_tx_compl.desc_ids ||
730 !bundle_tx_compl.status)
731 return -EPROTO;
732
733 arg->num_reports = *bundle_tx_compl.num_reports;
734 arg->desc_ids = bundle_tx_compl.desc_ids;
735 arg->status = bundle_tx_compl.status;
736
737 return 0;
738}
739
689static int ath10k_wmi_tlv_op_pull_mgmt_rx_ev(struct ath10k *ar, 740static int ath10k_wmi_tlv_op_pull_mgmt_rx_ev(struct ath10k *ar,
690 struct sk_buff *skb, 741 struct sk_buff *skb,
691 struct wmi_mgmt_rx_ev_arg *arg) 742 struct wmi_mgmt_rx_ev_arg *arg)
@@ -1611,7 +1662,7 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
1611 cfg->rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(0); 1662 cfg->rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(0);
1612 cfg->vow_config = __cpu_to_le32(0); 1663 cfg->vow_config = __cpu_to_le32(0);
1613 cfg->gtk_offload_max_vdev = __cpu_to_le32(2); 1664 cfg->gtk_offload_max_vdev = __cpu_to_le32(2);
1614 cfg->num_msdu_desc = __cpu_to_le32(TARGET_TLV_NUM_MSDU_DESC); 1665 cfg->num_msdu_desc = __cpu_to_le32(ar->htt.max_num_pending_tx);
1615 cfg->max_frag_entries = __cpu_to_le32(2); 1666 cfg->max_frag_entries = __cpu_to_le32(2);
1616 cfg->num_tdls_vdevs = __cpu_to_le32(TARGET_TLV_NUM_TDLS_VDEVS); 1667 cfg->num_tdls_vdevs = __cpu_to_le32(TARGET_TLV_NUM_TDLS_VDEVS);
1617 cfg->num_tdls_conn_table_entries = __cpu_to_le32(0x20); 1668 cfg->num_tdls_conn_table_entries = __cpu_to_le32(0x20);
@@ -1626,7 +1677,7 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
1626 cfg->num_ocb_vdevs = __cpu_to_le32(0); 1677 cfg->num_ocb_vdevs = __cpu_to_le32(0);
1627 cfg->num_ocb_channels = __cpu_to_le32(0); 1678 cfg->num_ocb_channels = __cpu_to_le32(0);
1628 cfg->num_ocb_schedules = __cpu_to_le32(0); 1679 cfg->num_ocb_schedules = __cpu_to_le32(0);
1629 cfg->host_capab = __cpu_to_le32(0); 1680 cfg->host_capab = __cpu_to_le32(WMI_TLV_FLAG_MGMT_BUNDLE_TX_COMPL);
1630 1681
1631 ath10k_wmi_put_host_mem_chunks(ar, chunks); 1682 ath10k_wmi_put_host_mem_chunks(ar, chunks);
1632 1683
@@ -1998,9 +2049,11 @@ ath10k_wmi_tlv_op_gen_vdev_install_key(struct ath10k *ar,
1998 size_t len; 2049 size_t len;
1999 void *ptr; 2050 void *ptr;
2000 2051
2001 if (arg->key_cipher == WMI_CIPHER_NONE && arg->key_data != NULL) 2052 if (arg->key_cipher == ar->wmi_key_cipher[WMI_CIPHER_NONE] &&
2053 arg->key_data)
2002 return ERR_PTR(-EINVAL); 2054 return ERR_PTR(-EINVAL);
2003 if (arg->key_cipher != WMI_CIPHER_NONE && arg->key_data == NULL) 2055 if (arg->key_cipher != ar->wmi_key_cipher[WMI_CIPHER_NONE] &&
2056 !arg->key_data)
2004 return ERR_PTR(-EINVAL); 2057 return ERR_PTR(-EINVAL);
2005 2058
2006 len = sizeof(*tlv) + sizeof(*cmd) + 2059 len = sizeof(*tlv) + sizeof(*cmd) +
@@ -3259,6 +3312,8 @@ ath10k_wmi_tlv_op_gen_wow_enable(struct ath10k *ar)
3259 cmd = (void *)tlv->value; 3312 cmd = (void *)tlv->value;
3260 3313
3261 cmd->enable = __cpu_to_le32(1); 3314 cmd->enable = __cpu_to_le32(1);
3315 if (!ar->bus_param.link_can_suspend)
3316 cmd->pause_iface_config = __cpu_to_le32(WOW_IFACE_PAUSE_DISABLED);
3262 3317
3263 ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv wow enable\n"); 3318 ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv wow enable\n");
3264 return skb; 3319 return skb;
@@ -4093,6 +4148,7 @@ static const struct wmi_ops wmi_tlv_ops = {
4093 .pull_scan = ath10k_wmi_tlv_op_pull_scan_ev, 4148 .pull_scan = ath10k_wmi_tlv_op_pull_scan_ev,
4094 .pull_mgmt_rx = ath10k_wmi_tlv_op_pull_mgmt_rx_ev, 4149 .pull_mgmt_rx = ath10k_wmi_tlv_op_pull_mgmt_rx_ev,
4095 .pull_mgmt_tx_compl = ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev, 4150 .pull_mgmt_tx_compl = ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev,
4151 .pull_mgmt_tx_bundle_compl = ath10k_wmi_tlv_op_pull_mgmt_tx_bundle_compl_ev,
4096 .pull_ch_info = ath10k_wmi_tlv_op_pull_ch_info_ev, 4152 .pull_ch_info = ath10k_wmi_tlv_op_pull_ch_info_ev,
4097 .pull_vdev_start = ath10k_wmi_tlv_op_pull_vdev_start_ev, 4153 .pull_vdev_start = ath10k_wmi_tlv_op_pull_vdev_start_ev,
4098 .pull_peer_kick = ath10k_wmi_tlv_op_pull_peer_kick_ev, 4154 .pull_peer_kick = ath10k_wmi_tlv_op_pull_peer_kick_ev,
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index e07e9907e355..af4cb0e14952 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -1,19 +1,8 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18#ifndef _WMI_TLV_H 7#ifndef _WMI_TLV_H
19#define _WMI_TLV_H 8#define _WMI_TLV_H
@@ -321,6 +310,7 @@ enum wmi_tlv_event_id {
321 WMI_TLV_OFFLOAD_BCN_TX_STATUS_EVENTID, 310 WMI_TLV_OFFLOAD_BCN_TX_STATUS_EVENTID,
322 WMI_TLV_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID, 311 WMI_TLV_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID,
323 WMI_TLV_MGMT_TX_COMPLETION_EVENTID, 312 WMI_TLV_MGMT_TX_COMPLETION_EVENTID,
313 WMI_TLV_MGMT_TX_BUNDLE_COMPLETION_EVENTID,
324 WMI_TLV_TX_DELBA_COMPLETE_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_BA_NEG), 314 WMI_TLV_TX_DELBA_COMPLETE_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_BA_NEG),
325 WMI_TLV_TX_ADDBA_COMPLETE_EVENTID, 315 WMI_TLV_TX_ADDBA_COMPLETE_EVENTID,
326 WMI_TLV_BA_RSP_SSN_EVENTID, 316 WMI_TLV_BA_RSP_SSN_EVENTID,
@@ -1592,6 +1582,8 @@ struct chan_info_params {
1592 u32 mac_clk_mhz; 1582 u32 mac_clk_mhz;
1593}; 1583};
1594 1584
1585#define WMI_TLV_FLAG_MGMT_BUNDLE_TX_COMPL BIT(9)
1586
1595struct wmi_tlv_mgmt_tx_compl_ev { 1587struct wmi_tlv_mgmt_tx_compl_ev {
1596 __le32 desc_id; 1588 __le32 desc_id;
1597 __le32 status; 1589 __le32 status;
@@ -1998,8 +1990,15 @@ struct wmi_tlv_set_quiet_cmd {
1998 __le32 enabled; 1990 __le32 enabled;
1999} __packed; 1991} __packed;
2000 1992
1993enum wmi_tlv_wow_interface_cfg {
1994 WOW_IFACE_PAUSE_ENABLED,
1995 WOW_IFACE_PAUSE_DISABLED
1996};
1997
2001struct wmi_tlv_wow_enable_cmd { 1998struct wmi_tlv_wow_enable_cmd {
2002 __le32 enable; 1999 __le32 enable;
2000 __le32 pause_iface_config;
2001 __le32 flags;
2003} __packed; 2002} __packed;
2004 2003
2005struct wmi_tlv_wow_host_wakeup_ind { 2004struct wmi_tlv_wow_host_wakeup_ind {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 8e236d158ca6..97e5b2eb8a91 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1,19 +1,8 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#include <linux/skbuff.h> 8#include <linux/skbuff.h>
@@ -827,6 +816,7 @@ static struct wmi_vdev_param_map wmi_vdev_param_map = {
827 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, 816 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
828 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, 817 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
829 .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED, 818 .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED,
819 .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED,
830}; 820};
831 821
832/* 10.X WMI VDEV param map */ 822/* 10.X WMI VDEV param map */
@@ -903,6 +893,7 @@ static struct wmi_vdev_param_map wmi_10x_vdev_param_map = {
903 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, 893 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
904 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, 894 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
905 .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED, 895 .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED,
896 .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED,
906}; 897};
907 898
908static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = { 899static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = {
@@ -978,6 +969,7 @@ static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = {
978 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, 969 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED,
979 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, 970 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED,
980 .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED, 971 .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED,
972 .rtt_responder_role = WMI_VDEV_PARAM_UNSUPPORTED,
981}; 973};
982 974
983static struct wmi_vdev_param_map wmi_10_4_vdev_param_map = { 975static struct wmi_vdev_param_map wmi_10_4_vdev_param_map = {
@@ -1056,6 +1048,7 @@ static struct wmi_vdev_param_map wmi_10_4_vdev_param_map = {
1056 .inc_tsf = WMI_10_4_VDEV_PARAM_TSF_INCREMENT, 1048 .inc_tsf = WMI_10_4_VDEV_PARAM_TSF_INCREMENT,
1057 .dec_tsf = WMI_10_4_VDEV_PARAM_TSF_DECREMENT, 1049 .dec_tsf = WMI_10_4_VDEV_PARAM_TSF_DECREMENT,
1058 .disable_4addr_src_lrn = WMI_10_4_VDEV_PARAM_DISABLE_4_ADDR_SRC_LRN, 1050 .disable_4addr_src_lrn = WMI_10_4_VDEV_PARAM_DISABLE_4_ADDR_SRC_LRN,
1051 .rtt_responder_role = WMI_10_4_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE,
1059}; 1052};
1060 1053
1061static struct wmi_pdev_param_map wmi_pdev_param_map = { 1054static struct wmi_pdev_param_map wmi_pdev_param_map = {
@@ -1606,6 +1599,30 @@ static struct wmi_pdev_param_map wmi_10_4_pdev_param_map = {
1606 .enable_btcoex = WMI_10_4_PDEV_PARAM_ENABLE_BTCOEX, 1599 .enable_btcoex = WMI_10_4_PDEV_PARAM_ENABLE_BTCOEX,
1607}; 1600};
1608 1601
1602static const u8 wmi_key_cipher_suites[] = {
1603 [WMI_CIPHER_NONE] = WMI_CIPHER_NONE,
1604 [WMI_CIPHER_WEP] = WMI_CIPHER_WEP,
1605 [WMI_CIPHER_TKIP] = WMI_CIPHER_TKIP,
1606 [WMI_CIPHER_AES_OCB] = WMI_CIPHER_AES_OCB,
1607 [WMI_CIPHER_AES_CCM] = WMI_CIPHER_AES_CCM,
1608 [WMI_CIPHER_WAPI] = WMI_CIPHER_WAPI,
1609 [WMI_CIPHER_CKIP] = WMI_CIPHER_CKIP,
1610 [WMI_CIPHER_AES_CMAC] = WMI_CIPHER_AES_CMAC,
1611 [WMI_CIPHER_AES_GCM] = WMI_CIPHER_AES_GCM,
1612};
1613
1614static const u8 wmi_tlv_key_cipher_suites[] = {
1615 [WMI_CIPHER_NONE] = WMI_TLV_CIPHER_NONE,
1616 [WMI_CIPHER_WEP] = WMI_TLV_CIPHER_WEP,
1617 [WMI_CIPHER_TKIP] = WMI_TLV_CIPHER_TKIP,
1618 [WMI_CIPHER_AES_OCB] = WMI_TLV_CIPHER_AES_OCB,
1619 [WMI_CIPHER_AES_CCM] = WMI_TLV_CIPHER_AES_CCM,
1620 [WMI_CIPHER_WAPI] = WMI_TLV_CIPHER_WAPI,
1621 [WMI_CIPHER_CKIP] = WMI_TLV_CIPHER_CKIP,
1622 [WMI_CIPHER_AES_CMAC] = WMI_TLV_CIPHER_AES_CMAC,
1623 [WMI_CIPHER_AES_GCM] = WMI_TLV_CIPHER_AES_GCM,
1624};
1625
1609static const struct wmi_peer_flags_map wmi_peer_flags_map = { 1626static const struct wmi_peer_flags_map wmi_peer_flags_map = {
1610 .auth = WMI_PEER_AUTH, 1627 .auth = WMI_PEER_AUTH,
1611 .qos = WMI_PEER_QOS, 1628 .qos = WMI_PEER_QOS,
@@ -2346,7 +2363,7 @@ static int wmi_process_mgmt_tx_comp(struct ath10k *ar, u32 desc_id,
2346 2363
2347 msdu = pkt_addr->vaddr; 2364 msdu = pkt_addr->vaddr;
2348 dma_unmap_single(ar->dev, pkt_addr->paddr, 2365 dma_unmap_single(ar->dev, pkt_addr->paddr,
2349 msdu->len, DMA_FROM_DEVICE); 2366 msdu->len, DMA_TO_DEVICE);
2350 info = IEEE80211_SKB_CB(msdu); 2367 info = IEEE80211_SKB_CB(msdu);
2351 2368
2352 if (status) 2369 if (status)
@@ -2383,6 +2400,29 @@ int ath10k_wmi_event_mgmt_tx_compl(struct ath10k *ar, struct sk_buff *skb)
2383 return 0; 2400 return 0;
2384} 2401}
2385 2402
2403int ath10k_wmi_event_mgmt_tx_bundle_compl(struct ath10k *ar, struct sk_buff *skb)
2404{
2405 struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg arg;
2406 u32 num_reports;
2407 int i, ret;
2408
2409 ret = ath10k_wmi_pull_mgmt_tx_bundle_compl(ar, skb, &arg);
2410 if (ret) {
2411 ath10k_warn(ar, "failed to parse bundle mgmt compl event: %d\n", ret);
2412 return ret;
2413 }
2414
2415 num_reports = __le32_to_cpu(arg.num_reports);
2416
2417 for (i = 0; i < num_reports; i++)
2418 wmi_process_mgmt_tx_comp(ar, __le32_to_cpu(arg.desc_ids[i]),
2419 __le32_to_cpu(arg.status[i]));
2420
2421 ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv event bundle mgmt tx completion\n");
2422
2423 return 0;
2424}
2425
2386int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) 2426int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
2387{ 2427{
2388 struct wmi_mgmt_rx_ev_arg arg = {}; 2428 struct wmi_mgmt_rx_ev_arg arg = {};
@@ -6240,6 +6280,25 @@ int ath10k_wmi_connect(struct ath10k *ar)
6240} 6280}
6241 6281
6242static struct sk_buff * 6282static struct sk_buff *
6283ath10k_wmi_op_gen_pdev_set_base_macaddr(struct ath10k *ar,
6284 const u8 macaddr[ETH_ALEN])
6285{
6286 struct wmi_pdev_set_base_macaddr_cmd *cmd;
6287 struct sk_buff *skb;
6288
6289 skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
6290 if (!skb)
6291 return ERR_PTR(-ENOMEM);
6292
6293 cmd = (struct wmi_pdev_set_base_macaddr_cmd *)skb->data;
6294 ether_addr_copy(cmd->mac_addr.addr, macaddr);
6295
6296 ath10k_dbg(ar, ATH10K_DBG_WMI,
6297 "wmi pdev basemac %pM\n", macaddr);
6298 return skb;
6299}
6300
6301static struct sk_buff *
6243ath10k_wmi_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g, 6302ath10k_wmi_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g,
6244 u16 ctl2g, u16 ctl5g, 6303 u16 ctl2g, u16 ctl5g,
6245 enum wmi_dfs_region dfs_reg) 6304 enum wmi_dfs_region dfs_reg)
@@ -9048,6 +9107,7 @@ static const struct wmi_ops wmi_10_2_ops = {
9048 .gen_peer_create = ath10k_wmi_op_gen_peer_create, 9107 .gen_peer_create = ath10k_wmi_op_gen_peer_create,
9049 .gen_peer_delete = ath10k_wmi_op_gen_peer_delete, 9108 .gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
9050 .gen_peer_flush = ath10k_wmi_op_gen_peer_flush, 9109 .gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
9110 .gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
9051 .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param, 9111 .gen_peer_set_param = ath10k_wmi_op_gen_peer_set_param,
9052 .gen_set_psmode = ath10k_wmi_op_gen_set_psmode, 9112 .gen_set_psmode = ath10k_wmi_op_gen_set_psmode,
9053 .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps, 9113 .gen_set_sta_ps = ath10k_wmi_op_gen_set_sta_ps,
@@ -9166,6 +9226,7 @@ static const struct wmi_ops wmi_10_4_ops = {
9166 9226
9167 .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend, 9227 .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
9168 .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume, 9228 .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
9229 .gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
9169 .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd, 9230 .gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
9170 .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param, 9231 .gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
9171 .gen_init = ath10k_wmi_10_4_op_gen_init, 9232 .gen_init = ath10k_wmi_10_4_op_gen_init,
@@ -9229,6 +9290,7 @@ int ath10k_wmi_attach(struct ath10k *ar)
9229 ar->wmi.vdev_param = &wmi_10_4_vdev_param_map; 9290 ar->wmi.vdev_param = &wmi_10_4_vdev_param_map;
9230 ar->wmi.pdev_param = &wmi_10_4_pdev_param_map; 9291 ar->wmi.pdev_param = &wmi_10_4_pdev_param_map;
9231 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map; 9292 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map;
9293 ar->wmi_key_cipher = wmi_key_cipher_suites;
9232 break; 9294 break;
9233 case ATH10K_FW_WMI_OP_VERSION_10_2_4: 9295 case ATH10K_FW_WMI_OP_VERSION_10_2_4:
9234 ar->wmi.cmd = &wmi_10_2_4_cmd_map; 9296 ar->wmi.cmd = &wmi_10_2_4_cmd_map;
@@ -9236,6 +9298,7 @@ int ath10k_wmi_attach(struct ath10k *ar)
9236 ar->wmi.vdev_param = &wmi_10_2_4_vdev_param_map; 9298 ar->wmi.vdev_param = &wmi_10_2_4_vdev_param_map;
9237 ar->wmi.pdev_param = &wmi_10_2_4_pdev_param_map; 9299 ar->wmi.pdev_param = &wmi_10_2_4_pdev_param_map;
9238 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map; 9300 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map;
9301 ar->wmi_key_cipher = wmi_key_cipher_suites;
9239 break; 9302 break;
9240 case ATH10K_FW_WMI_OP_VERSION_10_2: 9303 case ATH10K_FW_WMI_OP_VERSION_10_2:
9241 ar->wmi.cmd = &wmi_10_2_cmd_map; 9304 ar->wmi.cmd = &wmi_10_2_cmd_map;
@@ -9243,6 +9306,7 @@ int ath10k_wmi_attach(struct ath10k *ar)
9243 ar->wmi.vdev_param = &wmi_10x_vdev_param_map; 9306 ar->wmi.vdev_param = &wmi_10x_vdev_param_map;
9244 ar->wmi.pdev_param = &wmi_10x_pdev_param_map; 9307 ar->wmi.pdev_param = &wmi_10x_pdev_param_map;
9245 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map; 9308 ar->wmi.peer_flags = &wmi_10_2_peer_flags_map;
9309 ar->wmi_key_cipher = wmi_key_cipher_suites;
9246 break; 9310 break;
9247 case ATH10K_FW_WMI_OP_VERSION_10_1: 9311 case ATH10K_FW_WMI_OP_VERSION_10_1:
9248 ar->wmi.cmd = &wmi_10x_cmd_map; 9312 ar->wmi.cmd = &wmi_10x_cmd_map;
@@ -9250,6 +9314,7 @@ int ath10k_wmi_attach(struct ath10k *ar)
9250 ar->wmi.vdev_param = &wmi_10x_vdev_param_map; 9314 ar->wmi.vdev_param = &wmi_10x_vdev_param_map;
9251 ar->wmi.pdev_param = &wmi_10x_pdev_param_map; 9315 ar->wmi.pdev_param = &wmi_10x_pdev_param_map;
9252 ar->wmi.peer_flags = &wmi_10x_peer_flags_map; 9316 ar->wmi.peer_flags = &wmi_10x_peer_flags_map;
9317 ar->wmi_key_cipher = wmi_key_cipher_suites;
9253 break; 9318 break;
9254 case ATH10K_FW_WMI_OP_VERSION_MAIN: 9319 case ATH10K_FW_WMI_OP_VERSION_MAIN:
9255 ar->wmi.cmd = &wmi_cmd_map; 9320 ar->wmi.cmd = &wmi_cmd_map;
@@ -9257,9 +9322,11 @@ int ath10k_wmi_attach(struct ath10k *ar)
9257 ar->wmi.vdev_param = &wmi_vdev_param_map; 9322 ar->wmi.vdev_param = &wmi_vdev_param_map;
9258 ar->wmi.pdev_param = &wmi_pdev_param_map; 9323 ar->wmi.pdev_param = &wmi_pdev_param_map;
9259 ar->wmi.peer_flags = &wmi_peer_flags_map; 9324 ar->wmi.peer_flags = &wmi_peer_flags_map;
9325 ar->wmi_key_cipher = wmi_key_cipher_suites;
9260 break; 9326 break;
9261 case ATH10K_FW_WMI_OP_VERSION_TLV: 9327 case ATH10K_FW_WMI_OP_VERSION_TLV:
9262 ath10k_wmi_tlv_attach(ar); 9328 ath10k_wmi_tlv_attach(ar);
9329 ar->wmi_key_cipher = wmi_tlv_key_cipher_suites;
9263 break; 9330 break;
9264 case ATH10K_FW_WMI_OP_VERSION_UNSET: 9331 case ATH10K_FW_WMI_OP_VERSION_UNSET:
9265 case ATH10K_FW_WMI_OP_VERSION_MAX: 9332 case ATH10K_FW_WMI_OP_VERSION_MAX:
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 021eb30d1fb7..d9b646f3dcc2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1,26 +1,15 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc. 3 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 6 */
18 7
19#ifndef _WMI_H_ 8#ifndef _WMI_H_
20#define _WMI_H_ 9#define _WMI_H_
21 10
22#include <linux/types.h> 11#include <linux/types.h>
23#include <net/mac80211.h> 12#include <linux/ieee80211.h>
24 13
25/* 14/*
26 * This file specifies the WMI interface for the Unified Software 15 * This file specifies the WMI interface for the Unified Software
@@ -208,6 +197,11 @@ enum wmi_service {
208 WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, 197 WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT,
209 WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, 198 WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT,
210 WMI_SERVICE_THERM_THROT, 199 WMI_SERVICE_THERM_THROT,
200 WMI_SERVICE_RTT_RESPONDER_ROLE,
201 WMI_SERVICE_PER_PACKET_SW_ENCRYPT,
202 WMI_SERVICE_REPORT_AIRTIME,
203
204 /* Remember to add the new value to wmi_service_name()! */
211 205
212 /* keep last */ 206 /* keep last */
213 WMI_SERVICE_MAX, 207 WMI_SERVICE_MAX,
@@ -368,9 +362,14 @@ enum wmi_10_4_service {
368 WMI_10_4_SERVICE_HTT_ASSERT_TRIGGER_SUPPORT, 362 WMI_10_4_SERVICE_HTT_ASSERT_TRIGGER_SUPPORT,
369 WMI_10_4_SERVICE_VDEV_FILTER_NEIGHBOR_RX_PACKETS, 363 WMI_10_4_SERVICE_VDEV_FILTER_NEIGHBOR_RX_PACKETS,
370 WMI_10_4_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, 364 WMI_10_4_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT,
365 WMI_10_4_SERVICE_PEER_CHWIDTH_CHANGE,
366 WMI_10_4_SERVICE_RX_FILTER_OUT_COUNT,
367 WMI_10_4_SERVICE_RTT_RESPONDER_ROLE,
368 WMI_10_4_SERVICE_EXT_PEER_TID_CONFIGS_SUPPORT,
369 WMI_10_4_SERVICE_REPORT_AIRTIME,
371}; 370};
372 371
373static inline char *wmi_service_name(int service_id) 372static inline char *wmi_service_name(enum wmi_service service_id)
374{ 373{
375#define SVCSTR(x) case x: return #x 374#define SVCSTR(x) case x: return #x
376 375
@@ -467,6 +466,7 @@ static inline char *wmi_service_name(int service_id)
467 SVCSTR(WMI_SERVICE_TX_MODE_PUSH_PULL); 466 SVCSTR(WMI_SERVICE_TX_MODE_PUSH_PULL);
468 SVCSTR(WMI_SERVICE_TX_MODE_DYNAMIC); 467 SVCSTR(WMI_SERVICE_TX_MODE_DYNAMIC);
469 SVCSTR(WMI_SERVICE_VDEV_RX_FILTER); 468 SVCSTR(WMI_SERVICE_VDEV_RX_FILTER);
469 SVCSTR(WMI_SERVICE_BTCOEX);
470 SVCSTR(WMI_SERVICE_CHECK_CAL_VERSION); 470 SVCSTR(WMI_SERVICE_CHECK_CAL_VERSION);
471 SVCSTR(WMI_SERVICE_DBGLOG_WARN2); 471 SVCSTR(WMI_SERVICE_DBGLOG_WARN2);
472 SVCSTR(WMI_SERVICE_BTCOEX_DUTY_CYCLE); 472 SVCSTR(WMI_SERVICE_BTCOEX_DUTY_CYCLE);
@@ -476,18 +476,29 @@ static inline char *wmi_service_name(int service_id)
476 SVCSTR(WMI_SERVICE_SMART_LOGGING_SUPPORT); 476 SVCSTR(WMI_SERVICE_SMART_LOGGING_SUPPORT);
477 SVCSTR(WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE); 477 SVCSTR(WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE);
478 SVCSTR(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY); 478 SVCSTR(WMI_SERVICE_TDLS_EXPLICIT_MODE_ONLY);
479 SVCSTR(WMI_SERVICE_MGMT_TX_WMI);
479 SVCSTR(WMI_SERVICE_TDLS_WIDER_BANDWIDTH); 480 SVCSTR(WMI_SERVICE_TDLS_WIDER_BANDWIDTH);
480 SVCSTR(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS); 481 SVCSTR(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS);
481 SVCSTR(WMI_SERVICE_HOST_DFS_CHECK_SUPPORT); 482 SVCSTR(WMI_SERVICE_HOST_DFS_CHECK_SUPPORT);
482 SVCSTR(WMI_SERVICE_TPC_STATS_FINAL); 483 SVCSTR(WMI_SERVICE_TPC_STATS_FINAL);
483 SVCSTR(WMI_SERVICE_RESET_CHIP); 484 SVCSTR(WMI_SERVICE_RESET_CHIP);
485 SVCSTR(WMI_SERVICE_SPOOF_MAC_SUPPORT);
484 SVCSTR(WMI_SERVICE_TX_DATA_ACK_RSSI); 486 SVCSTR(WMI_SERVICE_TX_DATA_ACK_RSSI);
485 SVCSTR(WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT); 487 SVCSTR(WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT);
486 default: 488 SVCSTR(WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT);
489 SVCSTR(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT);
490 SVCSTR(WMI_SERVICE_THERM_THROT);
491 SVCSTR(WMI_SERVICE_RTT_RESPONDER_ROLE);
492 SVCSTR(WMI_SERVICE_PER_PACKET_SW_ENCRYPT);
493 SVCSTR(WMI_SERVICE_REPORT_AIRTIME);
494
495 case WMI_SERVICE_MAX:
487 return NULL; 496 return NULL;
488 } 497 }
489 498
490#undef SVCSTR 499#undef SVCSTR
500
501 return NULL;
491} 502}
492 503
493#define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \ 504#define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id, len) \
@@ -579,6 +590,8 @@ static inline void wmi_10x_svc_map(const __le32 *in, unsigned long *out,
579 WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, len); 590 WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, len);
580 SVCMAP(WMI_10X_SERVICE_BB_TIMING_CONFIG_SUPPORT, 591 SVCMAP(WMI_10X_SERVICE_BB_TIMING_CONFIG_SUPPORT,
581 WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, len); 592 WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, len);
593 SVCMAP(WMI_10X_SERVICE_PER_PACKET_SW_ENCRYPT,
594 WMI_SERVICE_PER_PACKET_SW_ENCRYPT, len);
582} 595}
583 596
584static inline void wmi_main_svc_map(const __le32 *in, unsigned long *out, 597static inline void wmi_main_svc_map(const __le32 *in, unsigned long *out,
@@ -799,6 +812,12 @@ static inline void wmi_10_4_svc_map(const __le32 *in, unsigned long *out,
799 WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, len); 812 WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, len);
800 SVCMAP(WMI_10_4_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, 813 SVCMAP(WMI_10_4_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT,
801 WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, len); 814 WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, len);
815 SVCMAP(WMI_10_4_SERVICE_RTT_RESPONDER_ROLE,
816 WMI_SERVICE_RTT_RESPONDER_ROLE, len);
817 SVCMAP(WMI_10_4_SERVICE_PER_PACKET_SW_ENCRYPT,
818 WMI_SERVICE_PER_PACKET_SW_ENCRYPT, len);
819 SVCMAP(WMI_10_4_SERVICE_REPORT_AIRTIME,
820 WMI_SERVICE_REPORT_AIRTIME, len);
802} 821}
803 822
804#undef SVCMAP 823#undef SVCMAP
@@ -2075,6 +2094,8 @@ enum wmi_channel_change_cause {
2075#define WMI_HT_CAP_MPDU_DENSITY 0x0700 /* MPDU Density */ 2094#define WMI_HT_CAP_MPDU_DENSITY 0x0700 /* MPDU Density */
2076#define WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT 8 2095#define WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT 8
2077#define WMI_HT_CAP_HT40_SGI 0x0800 2096#define WMI_HT_CAP_HT40_SGI 0x0800
2097#define WMI_HT_CAP_RX_LDPC 0x1000 /* LDPC RX support */
2098#define WMI_HT_CAP_TX_LDPC 0x2000 /* LDPC TX support */
2078 2099
2079#define WMI_HT_CAP_DEFAULT_ALL (WMI_HT_CAP_ENABLED | \ 2100#define WMI_HT_CAP_DEFAULT_ALL (WMI_HT_CAP_ENABLED | \
2080 WMI_HT_CAP_HT20_SGI | \ 2101 WMI_HT_CAP_HT20_SGI | \
@@ -2972,6 +2993,8 @@ enum wmi_10_4_feature_mask {
2972 WMI_10_4_TDLS_CONN_TRACKER_IN_HOST_MODE = BIT(11), 2993 WMI_10_4_TDLS_CONN_TRACKER_IN_HOST_MODE = BIT(11),
2973 WMI_10_4_TDLS_EXPLICIT_MODE_ONLY = BIT(12), 2994 WMI_10_4_TDLS_EXPLICIT_MODE_ONLY = BIT(12),
2974 WMI_10_4_TX_DATA_ACK_RSSI = BIT(16), 2995 WMI_10_4_TX_DATA_ACK_RSSI = BIT(16),
2996 WMI_10_4_EXT_PEER_TID_CONFIGS_SUPPORT = BIT(17),
2997 WMI_10_4_REPORT_AIRTIME = BIT(18),
2975 2998
2976}; 2999};
2977 3000
@@ -4083,6 +4106,10 @@ struct wmi_pdev_set_param_cmd {
4083 __le32 param_value; 4106 __le32 param_value;
4084} __packed; 4107} __packed;
4085 4108
4109struct wmi_pdev_set_base_macaddr_cmd {
4110 struct wmi_mac_addr mac_addr;
4111} __packed;
4112
4086/* valid period is 1 ~ 60000ms, unit in millisecond */ 4113/* valid period is 1 ~ 60000ms, unit in millisecond */
4087#define WMI_PDEV_PARAM_CAL_PERIOD_MAX 60000 4114#define WMI_PDEV_PARAM_CAL_PERIOD_MAX 60000
4088 4115
@@ -4929,15 +4956,30 @@ struct wmi_key_seq_counter {
4929 __le32 key_seq_counter_h; 4956 __le32 key_seq_counter_h;
4930} __packed; 4957} __packed;
4931 4958
4932#define WMI_CIPHER_NONE 0x0 /* clear key */ 4959enum wmi_cipher_suites {
4933#define WMI_CIPHER_WEP 0x1 4960 WMI_CIPHER_NONE,
4934#define WMI_CIPHER_TKIP 0x2 4961 WMI_CIPHER_WEP,
4935#define WMI_CIPHER_AES_OCB 0x3 4962 WMI_CIPHER_TKIP,
4936#define WMI_CIPHER_AES_CCM 0x4 4963 WMI_CIPHER_AES_OCB,
4937#define WMI_CIPHER_WAPI 0x5 4964 WMI_CIPHER_AES_CCM,
4938#define WMI_CIPHER_CKIP 0x6 4965 WMI_CIPHER_WAPI,
4939#define WMI_CIPHER_AES_CMAC 0x7 4966 WMI_CIPHER_CKIP,
4940#define WMI_CIPHER_AES_GCM 0x8 4967 WMI_CIPHER_AES_CMAC,
4968 WMI_CIPHER_AES_GCM,
4969};
4970
4971enum wmi_tlv_cipher_suites {
4972 WMI_TLV_CIPHER_NONE,
4973 WMI_TLV_CIPHER_WEP,
4974 WMI_TLV_CIPHER_TKIP,
4975 WMI_TLV_CIPHER_AES_OCB,
4976 WMI_TLV_CIPHER_AES_CCM,
4977 WMI_TLV_CIPHER_WAPI,
4978 WMI_TLV_CIPHER_CKIP,
4979 WMI_TLV_CIPHER_AES_CMAC,
4980 WMI_TLV_CIPHER_ANY,
4981 WMI_TLV_CIPHER_AES_GCM,
4982};
4941 4983
4942struct wmi_vdev_install_key_cmd { 4984struct wmi_vdev_install_key_cmd {
4943 __le32 vdev_id; 4985 __le32 vdev_id;
@@ -5083,6 +5125,7 @@ struct wmi_vdev_param_map {
5083 u32 inc_tsf; 5125 u32 inc_tsf;
5084 u32 dec_tsf; 5126 u32 dec_tsf;
5085 u32 disable_4addr_src_lrn; 5127 u32 disable_4addr_src_lrn;
5128 u32 rtt_responder_role;
5086}; 5129};
5087 5130
5088#define WMI_VDEV_PARAM_UNSUPPORTED 0 5131#define WMI_VDEV_PARAM_UNSUPPORTED 0
@@ -6688,6 +6731,12 @@ struct wmi_tlv_mgmt_tx_compl_ev_arg {
6688 __le32 pdev_id; 6731 __le32 pdev_id;
6689}; 6732};
6690 6733
6734struct wmi_tlv_mgmt_tx_bundle_compl_ev_arg {
6735 __le32 num_reports;
6736 const __le32 *desc_ids;
6737 const __le32 *status;
6738};
6739
6691struct wmi_mgmt_rx_ev_arg { 6740struct wmi_mgmt_rx_ev_arg {
6692 __le32 channel; 6741 __le32 channel;
6693 __le32 snr; 6742 __le32 snr;
@@ -7244,6 +7293,7 @@ int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg);
7244int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb); 7293int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb);
7245int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb); 7294int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb);
7246int ath10k_wmi_event_mgmt_tx_compl(struct ath10k *ar, struct sk_buff *skb); 7295int ath10k_wmi_event_mgmt_tx_compl(struct ath10k *ar, struct sk_buff *skb);
7296int ath10k_wmi_event_mgmt_tx_bundle_compl(struct ath10k *ar, struct sk_buff *skb);
7247void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb); 7297void ath10k_wmi_event_chan_info(struct ath10k *ar, struct sk_buff *skb);
7248void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb); 7298void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb);
7249int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb); 7299int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb);
diff --git a/drivers/net/wireless/ath/ath10k/wow.c b/drivers/net/wireless/ath/ath10k/wow.c
index 36d4245c308e..8c26adddd034 100644
--- a/drivers/net/wireless/ath/ath10k/wow.c
+++ b/drivers/net/wireless/ath/ath10k/wow.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: ISC
1/* 2/*
2 * Copyright (c) 2015-2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2015-2017 Qualcomm Atheros, Inc.
3 * Copyright (c) 2018, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 5 */
17 6
18#include "mac.h" 7#include "mac.h"
@@ -77,7 +66,7 @@ static int ath10k_wow_cleanup(struct ath10k *ar)
77 return 0; 66 return 0;
78} 67}
79 68
80/** 69/*
81 * Convert a 802.3 format to a 802.11 format. 70 * Convert a 802.3 format to a 802.11 format.
82 * +------------+-----------+--------+----------------+ 71 * +------------+-----------+--------+----------------+
83 * 802.3: |dest mac(6B)|src mac(6B)|type(2B)| body... | 72 * 802.3: |dest mac(6B)|src mac(6B)|type(2B)| body... |
@@ -88,9 +77,8 @@ static int ath10k_wow_cleanup(struct ath10k *ar)
88 * 802.11: |4B|dest mac(6B)| 6B |src mac(6B)| 8B |type(2B)| body... | 77 * 802.11: |4B|dest mac(6B)| 6B |src mac(6B)| 8B |type(2B)| body... |
89 * +--+------------+----+-----------+---------------+-----------+ 78 * +--+------------+----+-----------+---------------+-----------+
90 */ 79 */
91static void ath10k_wow_convert_8023_to_80211 80static void ath10k_wow_convert_8023_to_80211(struct cfg80211_pkt_pattern *new,
92 (struct cfg80211_pkt_pattern *new, 81 const struct cfg80211_pkt_pattern *old)
93 const struct cfg80211_pkt_pattern *old)
94{ 82{
95 u8 hdr_8023_pattern[ETH_HLEN] = {}; 83 u8 hdr_8023_pattern[ETH_HLEN] = {};
96 u8 hdr_8023_bit_mask[ETH_HLEN] = {}; 84 u8 hdr_8023_bit_mask[ETH_HLEN] = {};
diff --git a/drivers/net/wireless/ath/ath10k/wow.h b/drivers/net/wireless/ath/ath10k/wow.h
index 6e810105b775..14ea4e1e925e 100644
--- a/drivers/net/wireless/ath/ath10k/wow.h
+++ b/drivers/net/wireless/ath/ath10k/wow.h
@@ -1,17 +1,6 @@
1/* SPDX-License-Identifier: ISC */
1/* 2/*
2 * Copyright (c) 2015,2017 Qualcomm Atheros, Inc. 3 * Copyright (c) 2015,2017 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 4 */
16#ifndef _WOW_H_ 5#ifndef _WOW_H_
17#define _WOW_H_ 6#define _WOW_H_
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 9d7ac1ab2d02..68854c45d0a4 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -776,10 +776,8 @@ int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi)
776 cmd->info.params.roam_rssi_floor = DEF_LRSSI_ROAM_FLOOR; 776 cmd->info.params.roam_rssi_floor = DEF_LRSSI_ROAM_FLOOR;
777 cmd->roam_ctrl = WMI_SET_LRSSI_SCAN_PARAMS; 777 cmd->roam_ctrl = WMI_SET_LRSSI_SCAN_PARAMS;
778 778
779 ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_SET_ROAM_CTRL_CMDID, 779 return ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_SET_ROAM_CTRL_CMDID,
780 NO_SYNC_WMIFLAG); 780 NO_SYNC_WMIFLAG);
781
782 return 0;
783} 781}
784 782
785int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid) 783int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid)
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index f019a20e5a1f..2b29bf4730f6 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3457,9 +3457,9 @@ static u32 ar9003_dump_cal_data(struct ath_hw *ah, char *buf, u32 len, u32 size,
3457 if (!((pBase->txrxMask >> i) & 1)) 3457 if (!((pBase->txrxMask >> i) & 1))
3458 continue; 3458 continue;
3459 3459
3460 len += snprintf(buf + len, size - len, "Chain %d\n", i); 3460 len += scnprintf(buf + len, size - len, "Chain %d\n", i);
3461 3461
3462 len += snprintf(buf + len, size - len, 3462 len += scnprintf(buf + len, size - len,
3463 "Freq\t ref\tvolt\ttemp\tnf_cal\tnf_pow\trx_temp\n"); 3463 "Freq\t ref\tvolt\ttemp\tnf_cal\tnf_pow\trx_temp\n");
3464 3464
3465 for (j = 0; j < cal_pier_nr; j++) { 3465 for (j = 0; j < cal_pier_nr; j++) {
@@ -3471,10 +3471,10 @@ static u32 ar9003_dump_cal_data(struct ath_hw *ah, char *buf, u32 len, u32 size,
3471 freq = 4800 + eep->calFreqPier5G[j] * 5; 3471 freq = 4800 + eep->calFreqPier5G[j] * 5;
3472 } 3472 }
3473 3473
3474 len += snprintf(buf + len, size - len, 3474 len += scnprintf(buf + len, size - len,
3475 "%d\t", freq); 3475 "%d\t", freq);
3476 3476
3477 len += snprintf(buf + len, size - len, 3477 len += scnprintf(buf + len, size - len,
3478 "%d\t%d\t%d\t%d\t%d\t%d\n", 3478 "%d\t%d\t%d\t%d\t%d\t%d\n",
3479 cal_pier->refPower, 3479 cal_pier->refPower,
3480 cal_pier->voltMeas, 3480 cal_pier->voltMeas,
@@ -3505,12 +3505,12 @@ static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
3505 len += scnprintf(buf + len, size - len, "Calibration data\n"); 3505 len += scnprintf(buf + len, size - len, "Calibration data\n");
3506 len = ar9003_dump_cal_data(ah, buf, len, size, true); 3506 len = ar9003_dump_cal_data(ah, buf, len, size, true);
3507 3507
3508 len += snprintf(buf + len, size - len, 3508 len += scnprintf(buf + len, size - len,
3509 "%20s :\n", "5GHz modal Header"); 3509 "%20s :\n", "5GHz modal Header");
3510 len = ar9003_dump_modal_eeprom(buf, len, size, 3510 len = ar9003_dump_modal_eeprom(buf, len, size,
3511 &eep->modalHeader5G); 3511 &eep->modalHeader5G);
3512 3512
3513 len += snprintf(buf + len, size - len, "Calibration data\n"); 3513 len += scnprintf(buf + len, size - len, "Calibration data\n");
3514 len = ar9003_dump_cal_data(ah, buf, len, size, false); 3514 len = ar9003_dump_cal_data(ah, buf, len, size, false);
3515 3515
3516 goto out; 3516 goto out;
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 0fca44e91a71..a412b352182c 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -112,8 +112,6 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
112#define ATH_TXFIFO_DEPTH 8 112#define ATH_TXFIFO_DEPTH 8
113#define ATH_TX_ERROR 0x01 113#define ATH_TX_ERROR 0x01
114 114
115#define ATH_AIRTIME_QUANTUM 300 /* usec */
116
117/* Stop tx traffic 1ms before the GO goes away */ 115/* Stop tx traffic 1ms before the GO goes away */
118#define ATH_P2P_PS_STOP_TIME 1000 116#define ATH_P2P_PS_STOP_TIME 1000
119 117
@@ -246,10 +244,8 @@ struct ath_atx_tid {
246 s8 bar_index; 244 s8 bar_index;
247 bool active; 245 bool active;
248 bool clear_ps_filter; 246 bool clear_ps_filter;
249 bool has_queued;
250}; 247};
251 248
252void __ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid);
253void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid); 249void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid);
254 250
255struct ath_node { 251struct ath_node {
@@ -263,12 +259,9 @@ struct ath_node {
263 259
264 bool sleeping; 260 bool sleeping;
265 bool no_ps_filter; 261 bool no_ps_filter;
266 s64 airtime_deficit[IEEE80211_NUM_ACS];
267 u32 airtime_rx_start;
268 262
269#ifdef CONFIG_ATH9K_STATION_STATISTICS 263#ifdef CONFIG_ATH9K_STATION_STATISTICS
270 struct ath_rx_rate_stats rx_rate_stats; 264 struct ath_rx_rate_stats rx_rate_stats;
271 struct ath_airtime_stats airtime_stats;
272#endif 265#endif
273 u8 key_idx[4]; 266 u8 key_idx[4];
274 267
@@ -986,11 +979,6 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs);
986 979
987#define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */ 980#define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
988 981
989#define AIRTIME_USE_TX BIT(0)
990#define AIRTIME_USE_RX BIT(1)
991#define AIRTIME_USE_NEW_QUEUES BIT(2)
992#define AIRTIME_ACTIVE(flags) (!!(flags & (AIRTIME_USE_TX|AIRTIME_USE_RX)))
993
994struct ath_softc { 982struct ath_softc {
995 struct ieee80211_hw *hw; 983 struct ieee80211_hw *hw;
996 struct device *dev; 984 struct device *dev;
@@ -1034,8 +1022,6 @@ struct ath_softc {
1034 short nbcnvifs; 1022 short nbcnvifs;
1035 unsigned long ps_usecount; 1023 unsigned long ps_usecount;
1036 1024
1037 u16 airtime_flags; /* AIRTIME_* */
1038
1039 struct ath_rx rx; 1025 struct ath_rx rx;
1040 struct ath_tx tx; 1026 struct ath_tx tx;
1041 struct ath_beacon beacon; 1027 struct ath_beacon beacon;
diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c
index 6aa3ec024ffa..21191955a7c1 100644
--- a/drivers/net/wireless/ath/ath9k/common-spectral.c
+++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
@@ -1039,6 +1039,9 @@ static struct dentry *create_buf_file_handler(const char *filename,
1039 1039
1040 buf_file = debugfs_create_file(filename, mode, parent, buf, 1040 buf_file = debugfs_create_file(filename, mode, parent, buf,
1041 &relay_file_operations); 1041 &relay_file_operations);
1042 if (IS_ERR(buf_file))
1043 return NULL;
1044
1042 *is_global = 1; 1045 *is_global = 1;
1043 return buf_file; 1046 return buf_file;
1044} 1047}
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 4399e9ad058f..0dfea5d6e949 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1443,9 +1443,6 @@ int ath9k_init_debug(struct ath_hw *ah)
1443#endif 1443#endif
1444 debugfs_create_file("tpc", 0600, sc->debug.debugfs_phy, sc, &fops_tpc); 1444 debugfs_create_file("tpc", 0600, sc->debug.debugfs_phy, sc, &fops_tpc);
1445 1445
1446 debugfs_create_u16("airtime_flags", 0600,
1447 sc->debug.debugfs_phy, &sc->airtime_flags);
1448
1449 debugfs_create_file("nf_override", 0600, 1446 debugfs_create_file("nf_override", 0600,
1450 sc->debug.debugfs_phy, sc, &fops_nf_override); 1447 sc->debug.debugfs_phy, sc, &fops_nf_override);
1451 1448
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 79607db14387..33826aa13687 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -319,20 +319,12 @@ ath9k_debug_sync_cause(struct ath_softc *sc, u32 sync_cause)
319void ath_debug_rate_stats(struct ath_softc *sc, 319void ath_debug_rate_stats(struct ath_softc *sc,
320 struct ath_rx_status *rs, 320 struct ath_rx_status *rs,
321 struct sk_buff *skb); 321 struct sk_buff *skb);
322void ath_debug_airtime(struct ath_softc *sc,
323 struct ath_node *an,
324 u32 rx, u32 tx);
325#else 322#else
326static inline void ath_debug_rate_stats(struct ath_softc *sc, 323static inline void ath_debug_rate_stats(struct ath_softc *sc,
327 struct ath_rx_status *rs, 324 struct ath_rx_status *rs,
328 struct sk_buff *skb) 325 struct sk_buff *skb)
329{ 326{
330} 327}
331static inline void ath_debug_airtime(struct ath_softc *sc,
332 struct ath_node *an,
333 u32 rx, u32 tx)
334{
335}
336#endif /* CONFIG_ATH9K_STATION_STATISTICS */ 328#endif /* CONFIG_ATH9K_STATION_STATISTICS */
337 329
338#endif /* DEBUG_H */ 330#endif /* DEBUG_H */
diff --git a/drivers/net/wireless/ath/ath9k/debug_sta.c b/drivers/net/wireless/ath/ath9k/debug_sta.c
index e8fcd3e1c470..d95cabddce33 100644
--- a/drivers/net/wireless/ath/ath9k/debug_sta.c
+++ b/drivers/net/wireless/ath/ath9k/debug_sta.c
@@ -242,75 +242,6 @@ static const struct file_operations fops_node_recv = {
242 .llseek = default_llseek, 242 .llseek = default_llseek,
243}; 243};
244 244
245void ath_debug_airtime(struct ath_softc *sc,
246 struct ath_node *an,
247 u32 rx,
248 u32 tx)
249{
250 struct ath_airtime_stats *astats = &an->airtime_stats;
251
252 astats->rx_airtime += rx;
253 astats->tx_airtime += tx;
254}
255
256static ssize_t read_airtime(struct file *file, char __user *user_buf,
257 size_t count, loff_t *ppos)
258{
259 struct ath_node *an = file->private_data;
260 struct ath_airtime_stats *astats;
261 static const char *qname[4] = {
262 "VO", "VI", "BE", "BK"
263 };
264 u32 len = 0, size = 256;
265 char *buf;
266 size_t retval;
267 int i;
268
269 buf = kzalloc(size, GFP_KERNEL);
270 if (buf == NULL)
271 return -ENOMEM;
272
273 astats = &an->airtime_stats;
274
275 len += scnprintf(buf + len, size - len, "RX: %u us\n", astats->rx_airtime);
276 len += scnprintf(buf + len, size - len, "TX: %u us\n", astats->tx_airtime);
277 len += scnprintf(buf + len, size - len, "Deficit: ");
278 for (i = 0; i < 4; i++)
279 len += scnprintf(buf+len, size - len, "%s: %lld us ", qname[i], an->airtime_deficit[i]);
280 if (len < size)
281 buf[len++] = '\n';
282
283 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
284 kfree(buf);
285
286 return retval;
287}
288
289static ssize_t
290write_airtime_reset_stub(struct file *file, const char __user *ubuf,
291 size_t count, loff_t *ppos)
292{
293 struct ath_node *an = file->private_data;
294 struct ath_airtime_stats *astats;
295 int i;
296
297 astats = &an->airtime_stats;
298 astats->rx_airtime = 0;
299 astats->tx_airtime = 0;
300 for (i = 0; i < 4; i++)
301 an->airtime_deficit[i] = ATH_AIRTIME_QUANTUM;
302 return count;
303}
304
305static const struct file_operations fops_airtime = {
306 .read = read_airtime,
307 .write = write_airtime_reset_stub,
308 .open = simple_open,
309 .owner = THIS_MODULE,
310 .llseek = default_llseek,
311};
312
313
314void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, 245void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
315 struct ieee80211_vif *vif, 246 struct ieee80211_vif *vif,
316 struct ieee80211_sta *sta, 247 struct ieee80211_sta *sta,
@@ -320,5 +251,4 @@ void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
320 251
321 debugfs_create_file("node_aggr", 0444, dir, an, &fops_node_aggr); 252 debugfs_create_file("node_aggr", 0444, dir, an, &fops_node_aggr);
322 debugfs_create_file("node_recv", 0444, dir, an, &fops_node_recv); 253 debugfs_create_file("node_recv", 0444, dir, an, &fops_node_recv);
323 debugfs_create_file("airtime", 0644, dir, an, &fops_airtime);
324} 254}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 799010ed04e0..4e8e80ac8341 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -574,12 +574,12 @@ void ath9k_tx_failed_tasklet(unsigned long data)
574{ 574{
575 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data; 575 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
576 576
577 spin_lock_bh(&priv->tx.tx_lock); 577 spin_lock(&priv->tx.tx_lock);
578 if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) { 578 if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) {
579 spin_unlock_bh(&priv->tx.tx_lock); 579 spin_unlock(&priv->tx.tx_lock);
580 return; 580 return;
581 } 581 }
582 spin_unlock_bh(&priv->tx.tx_lock); 582 spin_unlock(&priv->tx.tx_lock);
583 583
584 ath9k_htc_tx_drainq(priv, &priv->tx.tx_failed); 584 ath9k_htc_tx_drainq(priv, &priv->tx.tx_failed);
585} 585}
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index c070a9e51ebf..98141b699c88 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -636,15 +636,15 @@ static int ath9k_of_init(struct ath_softc *sc)
636 ret = ath9k_eeprom_request(sc, eeprom_name); 636 ret = ath9k_eeprom_request(sc, eeprom_name);
637 if (ret) 637 if (ret)
638 return ret; 638 return ret;
639
640 ah->ah_flags &= ~AH_USE_EEPROM;
641 ah->ah_flags |= AH_NO_EEP_SWAP;
639 } 642 }
640 643
641 mac = of_get_mac_address(np); 644 mac = of_get_mac_address(np);
642 if (mac) 645 if (mac)
643 ether_addr_copy(common->macaddr, mac); 646 ether_addr_copy(common->macaddr, mac);
644 647
645 ah->ah_flags &= ~AH_USE_EEPROM;
646 ah->ah_flags |= AH_NO_EEP_SWAP;
647
648 return 0; 648 return 0;
649} 649}
650 650
@@ -676,8 +676,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
676 676
677 /* Will be cleared in ath9k_start() */ 677 /* Will be cleared in ath9k_start() */
678 set_bit(ATH_OP_INVALID, &common->op_flags); 678 set_bit(ATH_OP_INVALID, &common->op_flags);
679 sc->airtime_flags = (AIRTIME_USE_TX | AIRTIME_USE_RX |
680 AIRTIME_USE_NEW_QUEUES);
681 679
682 sc->sc_ah = ah; 680 sc->sc_ah = ah;
683 sc->dfs_detector = dfs_pattern_detector_init(common, NL80211_DFS_UNSET); 681 sc->dfs_detector = dfs_pattern_detector_init(common, NL80211_DFS_UNSET);
@@ -1013,6 +1011,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
1013 SET_IEEE80211_PERM_ADDR(hw, common->macaddr); 1011 SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
1014 1012
1015 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); 1013 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
1014 wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);
1016} 1015}
1017 1016
1018int ath9k_init_device(u16 devid, struct ath_softc *sc, 1017int ath9k_init_device(u16 devid, struct ath_softc *sc,
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 30d1bd832d90..285a62d3019d 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -1054,14 +1054,7 @@ static void ath_rx_count_airtime(struct ath_softc *sc,
1054 len, rxs->rate_idx, is_sp); 1054 len, rxs->rate_idx, is_sp);
1055 } 1055 }
1056 1056
1057 if (!!(sc->airtime_flags & AIRTIME_USE_RX)) { 1057 ieee80211_sta_register_airtime(sta, tidno, 0, airtime);
1058 spin_lock_bh(&acq->lock);
1059 an->airtime_deficit[acno] -= airtime;
1060 if (an->airtime_deficit[acno] <= 0)
1061 __ath_tx_queue_tid(sc, ATH_AN_2_TID(an, tidno));
1062 spin_unlock_bh(&acq->lock);
1063 }
1064 ath_debug_airtime(sc, an, airtime, 0);
1065exit: 1058exit:
1066 rcu_read_unlock(); 1059 rcu_read_unlock();
1067} 1060}
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index f448d5716639..06e0c5a6fab6 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -113,44 +113,14 @@ void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq)
113 ath_tx_status(hw, skb); 113 ath_tx_status(hw, skb);
114} 114}
115 115
116void __ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
117{
118 struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
119 struct ath_chanctx *ctx = avp->chanctx;
120 struct ath_acq *acq;
121 struct list_head *tid_list;
122 u8 acno = TID_TO_WME_AC(tid->tidno);
123
124 if (!ctx || !list_empty(&tid->list))
125 return;
126
127
128 acq = &ctx->acq[acno];
129 if ((sc->airtime_flags & AIRTIME_USE_NEW_QUEUES) &&
130 tid->an->airtime_deficit[acno] > 0)
131 tid_list = &acq->acq_new;
132 else
133 tid_list = &acq->acq_old;
134
135 list_add_tail(&tid->list, tid_list);
136}
137
138void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 116void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
139{ 117{
140 struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv; 118 struct ieee80211_txq *queue =
141 struct ath_chanctx *ctx = avp->chanctx; 119 container_of((void *)tid, struct ieee80211_txq, drv_priv);
142 struct ath_acq *acq;
143 120
144 if (!ctx || !list_empty(&tid->list)) 121 ieee80211_schedule_txq(sc->hw, queue);
145 return;
146
147 acq = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
148 spin_lock_bh(&acq->lock);
149 __ath_tx_queue_tid(sc, tid);
150 spin_unlock_bh(&acq->lock);
151} 122}
152 123
153
154void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue) 124void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
155{ 125{
156 struct ath_softc *sc = hw->priv; 126 struct ath_softc *sc = hw->priv;
@@ -163,11 +133,7 @@ void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
163 tid->tidno); 133 tid->tidno);
164 134
165 ath_txq_lock(sc, txq); 135 ath_txq_lock(sc, txq);
166
167 tid->has_queued = true;
168 ath_tx_queue_tid(sc, tid);
169 ath_txq_schedule(sc, txq); 136 ath_txq_schedule(sc, txq);
170
171 ath_txq_unlock(sc, txq); 137 ath_txq_unlock(sc, txq);
172} 138}
173 139
@@ -217,8 +183,8 @@ ath_get_skb_tid(struct ath_softc *sc, struct ath_node *an, struct sk_buff *skb)
217 return ATH_AN_2_TID(an, tidno); 183 return ATH_AN_2_TID(an, tidno);
218} 184}
219 185
220static struct sk_buff * 186static int
221ath_tid_pull(struct ath_atx_tid *tid) 187ath_tid_pull(struct ath_atx_tid *tid, struct sk_buff **skbuf)
222{ 188{
223 struct ieee80211_txq *txq = container_of((void*)tid, struct ieee80211_txq, drv_priv); 189 struct ieee80211_txq *txq = container_of((void*)tid, struct ieee80211_txq, drv_priv);
224 struct ath_softc *sc = tid->an->sc; 190 struct ath_softc *sc = tid->an->sc;
@@ -229,20 +195,16 @@ ath_tid_pull(struct ath_atx_tid *tid)
229 }; 195 };
230 struct sk_buff *skb; 196 struct sk_buff *skb;
231 struct ath_frame_info *fi; 197 struct ath_frame_info *fi;
232 int q; 198 int q, ret;
233
234 if (!tid->has_queued)
235 return NULL;
236 199
237 skb = ieee80211_tx_dequeue(hw, txq); 200 skb = ieee80211_tx_dequeue(hw, txq);
238 if (!skb) { 201 if (!skb)
239 tid->has_queued = false; 202 return -ENOENT;
240 return NULL;
241 }
242 203
243 if (ath_tx_prepare(hw, skb, &txctl)) { 204 ret = ath_tx_prepare(hw, skb, &txctl);
205 if (ret) {
244 ieee80211_free_txskb(hw, skb); 206 ieee80211_free_txskb(hw, skb);
245 return NULL; 207 return ret;
246 } 208 }
247 209
248 q = skb_get_queue_mapping(skb); 210 q = skb_get_queue_mapping(skb);
@@ -252,24 +214,19 @@ ath_tid_pull(struct ath_atx_tid *tid)
252 ++tid->txq->pending_frames; 214 ++tid->txq->pending_frames;
253 } 215 }
254 216
255 return skb; 217 *skbuf = skb;
256} 218 return 0;
257
258
259static bool ath_tid_has_buffered(struct ath_atx_tid *tid)
260{
261 return !skb_queue_empty(&tid->retry_q) || tid->has_queued;
262} 219}
263 220
264static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid) 221static int ath_tid_dequeue(struct ath_atx_tid *tid,
222 struct sk_buff **skb)
265{ 223{
266 struct sk_buff *skb; 224 int ret = 0;
267 225 *skb = __skb_dequeue(&tid->retry_q);
268 skb = __skb_dequeue(&tid->retry_q); 226 if (!*skb)
269 if (!skb) 227 ret = ath_tid_pull(tid, skb);
270 skb = ath_tid_pull(tid);
271 228
272 return skb; 229 return ret;
273} 230}
274 231
275static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 232static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
@@ -365,11 +322,12 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
365 struct list_head bf_head; 322 struct list_head bf_head;
366 struct ath_tx_status ts; 323 struct ath_tx_status ts;
367 struct ath_frame_info *fi; 324 struct ath_frame_info *fi;
325 int ret;
368 326
369 memset(&ts, 0, sizeof(ts)); 327 memset(&ts, 0, sizeof(ts));
370 INIT_LIST_HEAD(&bf_head); 328 INIT_LIST_HEAD(&bf_head);
371 329
372 while ((skb = ath_tid_dequeue(tid))) { 330 while ((ret = ath_tid_dequeue(tid, &skb)) == 0) {
373 fi = get_frame_info(skb); 331 fi = get_frame_info(skb);
374 bf = fi->bf; 332 bf = fi->bf;
375 333
@@ -681,7 +639,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
681 skb_queue_splice_tail(&bf_pending, &tid->retry_q); 639 skb_queue_splice_tail(&bf_pending, &tid->retry_q);
682 if (!an->sleeping) { 640 if (!an->sleeping) {
683 ath_tx_queue_tid(sc, tid); 641 ath_tx_queue_tid(sc, tid);
684
685 if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY)) 642 if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
686 tid->clear_ps_filter = true; 643 tid->clear_ps_filter = true;
687 } 644 }
@@ -708,11 +665,11 @@ static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
708 return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE); 665 return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
709} 666}
710 667
711static void ath_tx_count_airtime(struct ath_softc *sc, struct ath_node *an, 668static void ath_tx_count_airtime(struct ath_softc *sc,
712 struct ath_atx_tid *tid, struct ath_buf *bf, 669 struct ieee80211_sta *sta,
670 struct ath_buf *bf,
713 struct ath_tx_status *ts) 671 struct ath_tx_status *ts)
714{ 672{
715 struct ath_txq *txq = tid->txq;
716 u32 airtime = 0; 673 u32 airtime = 0;
717 int i; 674 int i;
718 675
@@ -722,17 +679,7 @@ static void ath_tx_count_airtime(struct ath_softc *sc, struct ath_node *an,
722 airtime += rate_dur * bf->rates[i].count; 679 airtime += rate_dur * bf->rates[i].count;
723 } 680 }
724 681
725 if (sc->airtime_flags & AIRTIME_USE_TX) { 682 ieee80211_sta_register_airtime(sta, ts->tid, airtime, 0);
726 int q = txq->mac80211_qnum;
727 struct ath_acq *acq = &sc->cur_chan->acq[q];
728
729 spin_lock_bh(&acq->lock);
730 an->airtime_deficit[q] -= airtime;
731 if (an->airtime_deficit[q] <= 0)
732 __ath_tx_queue_tid(sc, tid);
733 spin_unlock_bh(&acq->lock);
734 }
735 ath_debug_airtime(sc, an, 0, airtime);
736} 683}
737 684
738static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, 685static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
@@ -762,7 +709,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
762 if (sta) { 709 if (sta) {
763 struct ath_node *an = (struct ath_node *)sta->drv_priv; 710 struct ath_node *an = (struct ath_node *)sta->drv_priv;
764 tid = ath_get_skb_tid(sc, an, bf->bf_mpdu); 711 tid = ath_get_skb_tid(sc, an, bf->bf_mpdu);
765 ath_tx_count_airtime(sc, an, tid, bf, ts); 712 ath_tx_count_airtime(sc, sta, bf, ts);
766 if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY)) 713 if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
767 tid->clear_ps_filter = true; 714 tid->clear_ps_filter = true;
768 } 715 }
@@ -947,20 +894,21 @@ static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid,
947 return ndelim; 894 return ndelim;
948} 895}
949 896
950static struct ath_buf * 897static int
951ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, 898ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
952 struct ath_atx_tid *tid) 899 struct ath_atx_tid *tid, struct ath_buf **buf)
953{ 900{
954 struct ieee80211_tx_info *tx_info; 901 struct ieee80211_tx_info *tx_info;
955 struct ath_frame_info *fi; 902 struct ath_frame_info *fi;
956 struct sk_buff *skb, *first_skb = NULL;
957 struct ath_buf *bf; 903 struct ath_buf *bf;
904 struct sk_buff *skb, *first_skb = NULL;
958 u16 seqno; 905 u16 seqno;
906 int ret;
959 907
960 while (1) { 908 while (1) {
961 skb = ath_tid_dequeue(tid); 909 ret = ath_tid_dequeue(tid, &skb);
962 if (!skb) 910 if (ret < 0)
963 break; 911 return ret;
964 912
965 fi = get_frame_info(skb); 913 fi = get_frame_info(skb);
966 bf = fi->bf; 914 bf = fi->bf;
@@ -992,7 +940,7 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
992 940
993 if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { 941 if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) {
994 bf->bf_state.bf_type = 0; 942 bf->bf_state.bf_type = 0;
995 return bf; 943 break;
996 } 944 }
997 945
998 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR; 946 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
@@ -1011,7 +959,7 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
1011 first_skb = skb; 959 first_skb = skb;
1012 continue; 960 continue;
1013 } 961 }
1014 break; 962 return -EINPROGRESS;
1015 } 963 }
1016 964
1017 if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) { 965 if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) {
@@ -1028,10 +976,11 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
1028 if (bf_isampdu(bf)) 976 if (bf_isampdu(bf))
1029 ath_tx_addto_baw(sc, tid, bf); 977 ath_tx_addto_baw(sc, tid, bf);
1030 978
1031 return bf; 979 break;
1032 } 980 }
1033 981
1034 return NULL; 982 *buf = bf;
983 return 0;
1035} 984}
1036 985
1037static int 986static int
@@ -1041,7 +990,7 @@ ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,
1041{ 990{
1042#define PADBYTES(_len) ((4 - ((_len) % 4)) % 4) 991#define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
1043 struct ath_buf *bf = bf_first, *bf_prev = NULL; 992 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1044 int nframes = 0, ndelim; 993 int nframes = 0, ndelim, ret;
1045 u16 aggr_limit = 0, al = 0, bpad = 0, 994 u16 aggr_limit = 0, al = 0, bpad = 0,
1046 al_delta, h_baw = tid->baw_size / 2; 995 al_delta, h_baw = tid->baw_size / 2;
1047 struct ieee80211_tx_info *tx_info; 996 struct ieee80211_tx_info *tx_info;
@@ -1093,7 +1042,9 @@ ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,
1093 1042
1094 bf_prev = bf; 1043 bf_prev = bf;
1095 1044
1096 bf = ath_tx_get_tid_subframe(sc, txq, tid); 1045 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1046 if (ret < 0)
1047 break;
1097 } 1048 }
1098 goto finish; 1049 goto finish;
1099stop: 1050stop:
@@ -1490,7 +1441,7 @@ ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq,
1490 struct ath_buf *bf_first) 1441 struct ath_buf *bf_first)
1491{ 1442{
1492 struct ath_buf *bf = bf_first, *bf_prev = NULL; 1443 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1493 int nframes = 0; 1444 int nframes = 0, ret;
1494 1445
1495 do { 1446 do {
1496 struct ieee80211_tx_info *tx_info; 1447 struct ieee80211_tx_info *tx_info;
@@ -1504,8 +1455,8 @@ ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq,
1504 if (nframes >= 2) 1455 if (nframes >= 2)
1505 break; 1456 break;
1506 1457
1507 bf = ath_tx_get_tid_subframe(sc, txq, tid); 1458 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1508 if (!bf) 1459 if (ret < 0)
1509 break; 1460 break;
1510 1461
1511 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); 1462 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
@@ -1518,30 +1469,27 @@ ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq,
1518 } while (1); 1469 } while (1);
1519} 1470}
1520 1471
1521static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, 1472static int ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
1522 struct ath_atx_tid *tid) 1473 struct ath_atx_tid *tid)
1523{ 1474{
1524 struct ath_buf *bf; 1475 struct ath_buf *bf = NULL;
1525 struct ieee80211_tx_info *tx_info; 1476 struct ieee80211_tx_info *tx_info;
1526 struct list_head bf_q; 1477 struct list_head bf_q;
1527 int aggr_len = 0; 1478 int aggr_len = 0, ret;
1528 bool aggr; 1479 bool aggr;
1529 1480
1530 if (!ath_tid_has_buffered(tid))
1531 return false;
1532
1533 INIT_LIST_HEAD(&bf_q); 1481 INIT_LIST_HEAD(&bf_q);
1534 1482
1535 bf = ath_tx_get_tid_subframe(sc, txq, tid); 1483 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1536 if (!bf) 1484 if (ret < 0)
1537 return false; 1485 return ret;
1538 1486
1539 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); 1487 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1540 aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU); 1488 aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
1541 if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) || 1489 if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
1542 (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) { 1490 (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
1543 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu); 1491 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1544 return false; 1492 return -EBUSY;
1545 } 1493 }
1546 1494
1547 ath_set_rates(tid->an->vif, tid->an->sta, bf); 1495 ath_set_rates(tid->an->vif, tid->an->sta, bf);
@@ -1551,7 +1499,7 @@ static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
1551 ath_tx_form_burst(sc, txq, tid, &bf_q, bf); 1499 ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
1552 1500
1553 if (list_empty(&bf_q)) 1501 if (list_empty(&bf_q))
1554 return false; 1502 return -EAGAIN;
1555 1503
1556 if (tid->clear_ps_filter || tid->an->no_ps_filter) { 1504 if (tid->clear_ps_filter || tid->an->no_ps_filter) {
1557 tid->clear_ps_filter = false; 1505 tid->clear_ps_filter = false;
@@ -1560,7 +1508,7 @@ static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
1560 1508
1561 ath_tx_fill_desc(sc, bf, txq, aggr_len); 1509 ath_tx_fill_desc(sc, bf, txq, aggr_len);
1562 ath_tx_txqaddbuf(sc, txq, &bf_q, false); 1510 ath_tx_txqaddbuf(sc, txq, &bf_q, false);
1563 return true; 1511 return 0;
1564} 1512}
1565 1513
1566int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, 1514int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
@@ -1623,28 +1571,16 @@ void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
1623{ 1571{
1624 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1572 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1625 struct ath_atx_tid *tid; 1573 struct ath_atx_tid *tid;
1626 struct ath_txq *txq;
1627 int tidno; 1574 int tidno;
1628 1575
1629 ath_dbg(common, XMIT, "%s called\n", __func__); 1576 ath_dbg(common, XMIT, "%s called\n", __func__);
1630 1577
1631 for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { 1578 for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
1632 tid = ath_node_to_tid(an, tidno); 1579 tid = ath_node_to_tid(an, tidno);
1633 txq = tid->txq;
1634
1635 ath_txq_lock(sc, txq);
1636
1637 if (list_empty(&tid->list)) {
1638 ath_txq_unlock(sc, txq);
1639 continue;
1640 }
1641 1580
1642 if (!skb_queue_empty(&tid->retry_q)) 1581 if (!skb_queue_empty(&tid->retry_q))
1643 ieee80211_sta_set_buffered(sta, tid->tidno, true); 1582 ieee80211_sta_set_buffered(sta, tid->tidno, true);
1644 1583
1645 list_del_init(&tid->list);
1646
1647 ath_txq_unlock(sc, txq);
1648 } 1584 }
1649} 1585}
1650 1586
@@ -1663,11 +1599,12 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
1663 1599
1664 ath_txq_lock(sc, txq); 1600 ath_txq_lock(sc, txq);
1665 tid->clear_ps_filter = true; 1601 tid->clear_ps_filter = true;
1666 if (ath_tid_has_buffered(tid)) { 1602 if (!skb_queue_empty(&tid->retry_q)) {
1667 ath_tx_queue_tid(sc, tid); 1603 ath_tx_queue_tid(sc, tid);
1668 ath_txq_schedule(sc, txq); 1604 ath_txq_schedule(sc, txq);
1669 } 1605 }
1670 ath_txq_unlock_complete(sc, txq); 1606 ath_txq_unlock_complete(sc, txq);
1607
1671 } 1608 }
1672} 1609}
1673 1610
@@ -1698,9 +1635,9 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
1698 struct ath_txq *txq = sc->tx.uapsdq; 1635 struct ath_txq *txq = sc->tx.uapsdq;
1699 struct ieee80211_tx_info *info; 1636 struct ieee80211_tx_info *info;
1700 struct list_head bf_q; 1637 struct list_head bf_q;
1701 struct ath_buf *bf_tail = NULL, *bf; 1638 struct ath_buf *bf_tail = NULL, *bf = NULL;
1702 int sent = 0; 1639 int sent = 0;
1703 int i; 1640 int i, ret;
1704 1641
1705 INIT_LIST_HEAD(&bf_q); 1642 INIT_LIST_HEAD(&bf_q);
1706 for (i = 0; tids && nframes; i++, tids >>= 1) { 1643 for (i = 0; tids && nframes; i++, tids >>= 1) {
@@ -1713,8 +1650,9 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
1713 1650
1714 ath_txq_lock(sc, tid->txq); 1651 ath_txq_lock(sc, tid->txq);
1715 while (nframes > 0) { 1652 while (nframes > 0) {
1716 bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid); 1653 ret = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq,
1717 if (!bf) 1654 tid, &bf);
1655 if (ret < 0)
1718 break; 1656 break;
1719 1657
1720 ath9k_set_moredata(sc, bf, true); 1658 ath9k_set_moredata(sc, bf, true);
@@ -1980,11 +1918,11 @@ void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq)
1980 */ 1918 */
1981void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) 1919void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
1982{ 1920{
1921 struct ieee80211_hw *hw = sc->hw;
1983 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1922 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1923 struct ieee80211_txq *queue;
1984 struct ath_atx_tid *tid; 1924 struct ath_atx_tid *tid;
1985 struct list_head *tid_list; 1925 int ret;
1986 struct ath_acq *acq;
1987 bool active = AIRTIME_ACTIVE(sc->airtime_flags);
1988 1926
1989 if (txq->mac80211_qnum < 0) 1927 if (txq->mac80211_qnum < 0)
1990 return; 1928 return;
@@ -1992,58 +1930,26 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
1992 if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) 1930 if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
1993 return; 1931 return;
1994 1932
1933 ieee80211_txq_schedule_start(hw, txq->mac80211_qnum);
1995 spin_lock_bh(&sc->chan_lock); 1934 spin_lock_bh(&sc->chan_lock);
1996 rcu_read_lock(); 1935 rcu_read_lock();
1997 acq = &sc->cur_chan->acq[txq->mac80211_qnum];
1998 1936
1999 if (sc->cur_chan->stopped) 1937 if (sc->cur_chan->stopped)
2000 goto out; 1938 goto out;
2001 1939
2002begin: 1940 while ((queue = ieee80211_next_txq(hw, txq->mac80211_qnum))) {
2003 tid_list = &acq->acq_new; 1941 tid = (struct ath_atx_tid *)queue->drv_priv;
2004 if (list_empty(tid_list)) {
2005 tid_list = &acq->acq_old;
2006 if (list_empty(tid_list))
2007 goto out;
2008 }
2009 tid = list_first_entry(tid_list, struct ath_atx_tid, list);
2010
2011 if (active && tid->an->airtime_deficit[txq->mac80211_qnum] <= 0) {
2012 spin_lock_bh(&acq->lock);
2013 tid->an->airtime_deficit[txq->mac80211_qnum] += ATH_AIRTIME_QUANTUM;
2014 list_move_tail(&tid->list, &acq->acq_old);
2015 spin_unlock_bh(&acq->lock);
2016 goto begin;
2017 }
2018
2019 if (!ath_tid_has_buffered(tid)) {
2020 spin_lock_bh(&acq->lock);
2021 if ((tid_list == &acq->acq_new) && !list_empty(&acq->acq_old))
2022 list_move_tail(&tid->list, &acq->acq_old);
2023 else {
2024 list_del_init(&tid->list);
2025 }
2026 spin_unlock_bh(&acq->lock);
2027 goto begin;
2028 }
2029 1942
1943 ret = ath_tx_sched_aggr(sc, txq, tid);
1944 ath_dbg(common, QUEUE, "ath_tx_sched_aggr returned %d\n", ret);
2030 1945
2031 /* 1946 ieee80211_return_txq(hw, queue);
2032 * If we succeed in scheduling something, immediately restart to make
2033 * sure we keep the HW busy.
2034 */
2035 if(ath_tx_sched_aggr(sc, txq, tid)) {
2036 if (!active) {
2037 spin_lock_bh(&acq->lock);
2038 list_move_tail(&tid->list, &acq->acq_old);
2039 spin_unlock_bh(&acq->lock);
2040 }
2041 goto begin;
2042 } 1947 }
2043 1948
2044out: 1949out:
2045 rcu_read_unlock(); 1950 rcu_read_unlock();
2046 spin_unlock_bh(&sc->chan_lock); 1951 spin_unlock_bh(&sc->chan_lock);
1952 ieee80211_txq_schedule_end(hw, txq->mac80211_qnum);
2047} 1953}
2048 1954
2049void ath_txq_schedule_all(struct ath_softc *sc) 1955void ath_txq_schedule_all(struct ath_softc *sc)
@@ -2887,9 +2793,6 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
2887 struct ath_atx_tid *tid; 2793 struct ath_atx_tid *tid;
2888 int tidno, acno; 2794 int tidno, acno;
2889 2795
2890 for (acno = 0; acno < IEEE80211_NUM_ACS; acno++)
2891 an->airtime_deficit[acno] = ATH_AIRTIME_QUANTUM;
2892
2893 for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { 2796 for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
2894 tid = ath_node_to_tid(an, tidno); 2797 tid = ath_node_to_tid(an, tidno);
2895 tid->an = an; 2798 tid->an = an;
@@ -2899,7 +2802,6 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
2899 tid->baw_head = tid->baw_tail = 0; 2802 tid->baw_head = tid->baw_tail = 0;
2900 tid->active = false; 2803 tid->active = false;
2901 tid->clear_ps_filter = true; 2804 tid->clear_ps_filter = true;
2902 tid->has_queued = false;
2903 __skb_queue_head_init(&tid->retry_q); 2805 __skb_queue_head_init(&tid->retry_q);
2904 INIT_LIST_HEAD(&tid->list); 2806 INIT_LIST_HEAD(&tid->list);
2905 acno = TID_TO_WME_AC(tidno); 2807 acno = TID_TO_WME_AC(tidno);
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
index f7c2f19e81c1..8e154f6364a3 100644
--- a/drivers/net/wireless/ath/carl9170/rx.c
+++ b/drivers/net/wireless/ath/carl9170/rx.c
@@ -427,7 +427,7 @@ static int carl9170_rx_mac_status(struct ar9170 *ar,
427 if (head->plcp[6] & 0x80) 427 if (head->plcp[6] & 0x80)
428 status->enc_flags |= RX_ENC_FLAG_SHORT_GI; 428 status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
429 429
430 status->rate_idx = clamp(0, 75, head->plcp[3] & 0x7f); 430 status->rate_idx = clamp(head->plcp[3] & 0x7f, 0, 75);
431 status->encoding = RX_ENC_HT; 431 status->encoding = RX_ENC_HT;
432 break; 432 break;
433 433
diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h
index d73e45e26547..75ddaefdd049 100644
--- a/drivers/net/wireless/ath/regd.h
+++ b/drivers/net/wireless/ath/regd.h
@@ -185,7 +185,9 @@ enum CountryCode {
185 CTRY_UKRAINE = 804, 185 CTRY_UKRAINE = 804,
186 CTRY_UNITED_KINGDOM = 826, 186 CTRY_UNITED_KINGDOM = 826,
187 CTRY_UNITED_STATES = 840, 187 CTRY_UNITED_STATES = 840,
188 CTRY_UNITED_STATES2 = 841,
188 CTRY_UNITED_STATES_FCC49 = 842, 189 CTRY_UNITED_STATES_FCC49 = 842,
190 CTRY_UNITED_STATES3 = 843,
189 CTRY_URUGUAY = 858, 191 CTRY_URUGUAY = 858,
190 CTRY_UZBEKISTAN = 860, 192 CTRY_UZBEKISTAN = 860,
191 CTRY_VENEZUELA = 862, 193 CTRY_VENEZUELA = 862,
diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h
index 4021e37a225a..c4bd26e65949 100644
--- a/drivers/net/wireless/ath/regd_common.h
+++ b/drivers/net/wireless/ath/regd_common.h
@@ -483,6 +483,8 @@ static struct country_code_to_enum_rd allCountries[] = {
483 {CTRY_UAE, NULL1_WORLD, "AE"}, 483 {CTRY_UAE, NULL1_WORLD, "AE"},
484 {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, 484 {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
485 {CTRY_UNITED_STATES, FCC3_FCCA, "US"}, 485 {CTRY_UNITED_STATES, FCC3_FCCA, "US"},
486 {CTRY_UNITED_STATES2, FCC3_FCCA, "US"},
487 {CTRY_UNITED_STATES3, FCC3_FCCA, "US"},
486 /* This "PS" is for US public safety actually... to support this we 488 /* This "PS" is for US public safety actually... to support this we
487 * would need to assign new special alpha2 to CRDA db as with the world 489 * would need to assign new special alpha2 to CRDA db as with the world
488 * regdomain and use another alpha2 */ 490 * regdomain and use another alpha2 */
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
index 1068a2a4494c..73d3c1a0a7c9 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
@@ -178,8 +178,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
178 *fwerr = 0; 178 *fwerr = 0;
179 ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, false); 179 ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, false);
180 if (ret < 0) { 180 if (ret < 0) {
181 brcmf_err("brcmf_proto_bcdc_msg failed w/status %d\n", 181 bphy_err(drvr, "brcmf_proto_bcdc_msg failed w/status %d\n",
182 ret); 182 ret);
183 goto done; 183 goto done;
184 } 184 }
185 185
@@ -195,9 +195,9 @@ retry:
195 if ((id < bcdc->reqid) && (++retries < RETRIES)) 195 if ((id < bcdc->reqid) && (++retries < RETRIES))
196 goto retry; 196 goto retry;
197 if (id != bcdc->reqid) { 197 if (id != bcdc->reqid) {
198 brcmf_err("%s: unexpected request id %d (expected %d)\n", 198 bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n",
199 brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id, 199 brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
200 bcdc->reqid); 200 bcdc->reqid);
201 ret = -EINVAL; 201 ret = -EINVAL;
202 goto done; 202 goto done;
203 } 203 }
@@ -245,9 +245,9 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
245 id = (flags & BCDC_DCMD_ID_MASK) >> BCDC_DCMD_ID_SHIFT; 245 id = (flags & BCDC_DCMD_ID_MASK) >> BCDC_DCMD_ID_SHIFT;
246 246
247 if (id != bcdc->reqid) { 247 if (id != bcdc->reqid) {
248 brcmf_err("%s: unexpected request id %d (expected %d)\n", 248 bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n",
249 brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id, 249 brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
250 bcdc->reqid); 250 bcdc->reqid);
251 ret = -EINVAL; 251 ret = -EINVAL;
252 goto done; 252 goto done;
253 } 253 }
@@ -312,8 +312,8 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
312 } 312 }
313 if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) != 313 if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
314 BCDC_PROTO_VER) { 314 BCDC_PROTO_VER) {
315 brcmf_err("%s: non-BCDC packet received, flags 0x%x\n", 315 bphy_err(drvr, "%s: non-BCDC packet received, flags 0x%x\n",
316 brcmf_ifname(tmp_if), h->flags); 316 brcmf_ifname(tmp_if), h->flags);
317 return -EBADE; 317 return -EBADE;
318 } 318 }
319 319
@@ -460,7 +460,7 @@ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
460 460
461 /* ensure that the msg buf directly follows the cdc msg struct */ 461 /* ensure that the msg buf directly follows the cdc msg struct */
462 if ((unsigned long)(&bcdc->msg + 1) != (unsigned long)bcdc->buf) { 462 if ((unsigned long)(&bcdc->msg + 1) != (unsigned long)bcdc->buf) {
463 brcmf_err("struct brcmf_proto_bcdc is not correctly defined\n"); 463 bphy_err(drvr, "struct brcmf_proto_bcdc is not correctly defined\n");
464 goto fail; 464 goto fail;
465 } 465 }
466 466
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
index c4965184cdf3..3d441c5c745c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
@@ -90,6 +90,7 @@ struct brcmf_bus_ops {
90 int (*get_memdump)(struct device *dev, void *data, size_t len); 90 int (*get_memdump)(struct device *dev, void *data, size_t len);
91 int (*get_fwname)(struct device *dev, const char *ext, 91 int (*get_fwname)(struct device *dev, const char *ext,
92 unsigned char *fw_name); 92 unsigned char *fw_name);
93 void (*debugfs_create)(struct device *dev);
93}; 94};
94 95
95 96
@@ -235,6 +236,15 @@ int brcmf_bus_get_fwname(struct brcmf_bus *bus, const char *ext,
235 return bus->ops->get_fwname(bus->dev, ext, fw_name); 236 return bus->ops->get_fwname(bus->dev, ext, fw_name);
236} 237}
237 238
239static inline
240void brcmf_bus_debugfs_create(struct brcmf_bus *bus)
241{
242 if (!bus->ops->debugfs_create)
243 return;
244
245 return bus->ops->debugfs_create(bus->dev);
246}
247
238/* 248/*
239 * interface functions from common layer 249 * interface functions from common layer
240 */ 250 */
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 35301237d435..e92f6351bd22 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -457,6 +457,7 @@ static void convert_key_from_CPU(struct brcmf_wsec_key *key,
457static int 457static int
458send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key) 458send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
459{ 459{
460 struct brcmf_pub *drvr = ifp->drvr;
460 int err; 461 int err;
461 struct brcmf_wsec_key_le key_le; 462 struct brcmf_wsec_key_le key_le;
462 463
@@ -468,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key)
468 sizeof(key_le)); 469 sizeof(key_le));
469 470
470 if (err) 471 if (err)
471 brcmf_err("wsec_key error (%d)\n", err); 472 bphy_err(drvr, "wsec_key error (%d)\n", err);
472 return err; 473 return err;
473} 474}
474 475
@@ -508,6 +509,7 @@ static int brcmf_get_first_free_bsscfgidx(struct brcmf_pub *drvr)
508 509
509static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp) 510static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
510{ 511{
512 struct brcmf_pub *drvr = ifp->drvr;
511 struct brcmf_mbss_ssid_le mbss_ssid_le; 513 struct brcmf_mbss_ssid_le mbss_ssid_le;
512 int bsscfgidx; 514 int bsscfgidx;
513 int err; 515 int err;
@@ -524,7 +526,7 @@ static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp)
524 err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le, 526 err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le,
525 sizeof(mbss_ssid_le)); 527 sizeof(mbss_ssid_le));
526 if (err < 0) 528 if (err < 0)
527 brcmf_err("setting ssid failed %d\n", err); 529 bphy_err(drvr, "setting ssid failed %d\n", err);
528 530
529 return err; 531 return err;
530} 532}
@@ -542,6 +544,7 @@ struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name,
542{ 544{
543 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 545 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
544 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); 546 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
547 struct brcmf_pub *drvr = cfg->pub;
545 struct brcmf_cfg80211_vif *vif; 548 struct brcmf_cfg80211_vif *vif;
546 int err; 549 int err;
547 550
@@ -567,7 +570,7 @@ struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name,
567 BRCMF_VIF_EVENT_TIMEOUT); 570 BRCMF_VIF_EVENT_TIMEOUT);
568 brcmf_cfg80211_arm_vif_event(cfg, NULL); 571 brcmf_cfg80211_arm_vif_event(cfg, NULL);
569 if (!err) { 572 if (!err) {
570 brcmf_err("timeout occurred\n"); 573 bphy_err(drvr, "timeout occurred\n");
571 err = -EIO; 574 err = -EIO;
572 goto fail; 575 goto fail;
573 } 576 }
@@ -575,7 +578,7 @@ struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name,
575 /* interface created in firmware */ 578 /* interface created in firmware */
576 ifp = vif->ifp; 579 ifp = vif->ifp;
577 if (!ifp) { 580 if (!ifp) {
578 brcmf_err("no if pointer provided\n"); 581 bphy_err(drvr, "no if pointer provided\n");
579 err = -ENOENT; 582 err = -ENOENT;
580 goto fail; 583 goto fail;
581 } 584 }
@@ -583,7 +586,7 @@ struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name,
583 strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); 586 strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1);
584 err = brcmf_net_attach(ifp, true); 587 err = brcmf_net_attach(ifp, true);
585 if (err) { 588 if (err) {
586 brcmf_err("Registering netdevice failed\n"); 589 bphy_err(drvr, "Registering netdevice failed\n");
587 free_netdev(ifp->ndev); 590 free_netdev(ifp->ndev);
588 goto fail; 591 goto fail;
589 } 592 }
@@ -614,13 +617,15 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
614 enum nl80211_iftype type, 617 enum nl80211_iftype type,
615 struct vif_params *params) 618 struct vif_params *params)
616{ 619{
620 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
621 struct brcmf_pub *drvr = cfg->pub;
617 struct wireless_dev *wdev; 622 struct wireless_dev *wdev;
618 int err; 623 int err;
619 624
620 brcmf_dbg(TRACE, "enter: %s type %d\n", name, type); 625 brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
621 err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type); 626 err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
622 if (err) { 627 if (err) {
623 brcmf_err("iface validation failed: err=%d\n", err); 628 bphy_err(drvr, "iface validation failed: err=%d\n", err);
624 return ERR_PTR(err); 629 return ERR_PTR(err);
625 } 630 }
626 switch (type) { 631 switch (type) {
@@ -645,8 +650,8 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
645 } 650 }
646 651
647 if (IS_ERR(wdev)) 652 if (IS_ERR(wdev))
648 brcmf_err("add iface %s type %d failed: err=%d\n", 653 bphy_err(drvr, "add iface %s type %d failed: err=%d\n", name,
649 name, type, (int)PTR_ERR(wdev)); 654 type, (int)PTR_ERR(wdev));
650 else 655 else
651 brcmf_cfg80211_update_proto_addr_mode(wdev); 656 brcmf_cfg80211_update_proto_addr_mode(wdev);
652 657
@@ -661,12 +666,13 @@ static void brcmf_scan_config_mpc(struct brcmf_if *ifp, int mpc)
661 666
662void brcmf_set_mpc(struct brcmf_if *ifp, int mpc) 667void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
663{ 668{
669 struct brcmf_pub *drvr = ifp->drvr;
664 s32 err = 0; 670 s32 err = 0;
665 671
666 if (check_vif_up(ifp->vif)) { 672 if (check_vif_up(ifp->vif)) {
667 err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc); 673 err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc);
668 if (err) { 674 if (err) {
669 brcmf_err("fail to set mpc\n"); 675 bphy_err(drvr, "fail to set mpc\n");
670 return; 676 return;
671 } 677 }
672 brcmf_dbg(INFO, "MPC : %d\n", mpc); 678 brcmf_dbg(INFO, "MPC : %d\n", mpc);
@@ -677,6 +683,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
677 struct brcmf_if *ifp, bool aborted, 683 struct brcmf_if *ifp, bool aborted,
678 bool fw_abort) 684 bool fw_abort)
679{ 685{
686 struct brcmf_pub *drvr = cfg->pub;
680 struct brcmf_scan_params_le params_le; 687 struct brcmf_scan_params_le params_le;
681 struct cfg80211_scan_request *scan_request; 688 struct cfg80211_scan_request *scan_request;
682 u64 reqid; 689 u64 reqid;
@@ -711,7 +718,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
711 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, 718 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
712 &params_le, sizeof(params_le)); 719 &params_le, sizeof(params_le));
713 if (err) 720 if (err)
714 brcmf_err("Scan abort failed\n"); 721 bphy_err(drvr, "Scan abort failed\n");
715 } 722 }
716 723
717 brcmf_scan_config_mpc(ifp, 1); 724 brcmf_scan_config_mpc(ifp, 1);
@@ -756,6 +763,7 @@ static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
756 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 763 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
757 struct net_device *ndev = wdev->netdev; 764 struct net_device *ndev = wdev->netdev;
758 struct brcmf_if *ifp = netdev_priv(ndev); 765 struct brcmf_if *ifp = netdev_priv(ndev);
766 struct brcmf_pub *drvr = cfg->pub;
759 int ret; 767 int ret;
760 int err; 768 int err;
761 769
@@ -763,7 +771,7 @@ static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
763 771
764 err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0); 772 err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
765 if (err) { 773 if (err) {
766 brcmf_err("interface_remove failed %d\n", err); 774 bphy_err(drvr, "interface_remove failed %d\n", err);
767 goto err_unarm; 775 goto err_unarm;
768 } 776 }
769 777
@@ -771,7 +779,7 @@ static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
771 ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL, 779 ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
772 BRCMF_VIF_EVENT_TIMEOUT); 780 BRCMF_VIF_EVENT_TIMEOUT);
773 if (!ret) { 781 if (!ret) {
774 brcmf_err("timeout occurred\n"); 782 bphy_err(drvr, "timeout occurred\n");
775 err = -EIO; 783 err = -EIO;
776 goto err_unarm; 784 goto err_unarm;
777 } 785 }
@@ -834,6 +842,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
834 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 842 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
835 struct brcmf_if *ifp = netdev_priv(ndev); 843 struct brcmf_if *ifp = netdev_priv(ndev);
836 struct brcmf_cfg80211_vif *vif = ifp->vif; 844 struct brcmf_cfg80211_vif *vif = ifp->vif;
845 struct brcmf_pub *drvr = cfg->pub;
837 s32 infra = 0; 846 s32 infra = 0;
838 s32 ap = 0; 847 s32 ap = 0;
839 s32 err = 0; 848 s32 err = 0;
@@ -873,14 +882,14 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
873 } 882 }
874 err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type); 883 err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
875 if (err) { 884 if (err) {
876 brcmf_err("iface validation failed: err=%d\n", err); 885 bphy_err(drvr, "iface validation failed: err=%d\n", err);
877 return err; 886 return err;
878 } 887 }
879 switch (type) { 888 switch (type) {
880 case NL80211_IFTYPE_MONITOR: 889 case NL80211_IFTYPE_MONITOR:
881 case NL80211_IFTYPE_WDS: 890 case NL80211_IFTYPE_WDS:
882 brcmf_err("type (%d) : currently we do not support this type\n", 891 bphy_err(drvr, "type (%d) : currently we do not support this type\n",
883 type); 892 type);
884 return -EOPNOTSUPP; 893 return -EOPNOTSUPP;
885 case NL80211_IFTYPE_ADHOC: 894 case NL80211_IFTYPE_ADHOC:
886 infra = 0; 895 infra = 0;
@@ -908,7 +917,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
908 } else { 917 } else {
909 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); 918 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra);
910 if (err) { 919 if (err) {
911 brcmf_err("WLC_SET_INFRA error (%d)\n", err); 920 bphy_err(drvr, "WLC_SET_INFRA error (%d)\n", err);
912 err = -EAGAIN; 921 err = -EAGAIN;
913 goto done; 922 goto done;
914 } 923 }
@@ -999,6 +1008,7 @@ static s32
999brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, 1008brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
1000 struct cfg80211_scan_request *request) 1009 struct cfg80211_scan_request *request)
1001{ 1010{
1011 struct brcmf_pub *drvr = cfg->pub;
1002 s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE + 1012 s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
1003 offsetof(struct brcmf_escan_params_le, params_le); 1013 offsetof(struct brcmf_escan_params_le, params_le);
1004 struct brcmf_escan_params_le *params; 1014 struct brcmf_escan_params_le *params;
@@ -1030,7 +1040,7 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
1030 if (err == -EBUSY) 1040 if (err == -EBUSY)
1031 brcmf_dbg(INFO, "system busy : escan canceled\n"); 1041 brcmf_dbg(INFO, "system busy : escan canceled\n");
1032 else 1042 else
1033 brcmf_err("error (%d)\n", err); 1043 bphy_err(drvr, "error (%d)\n", err);
1034 } 1044 }
1035 1045
1036 kfree(params); 1046 kfree(params);
@@ -1067,6 +1077,7 @@ static s32
1067brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) 1077brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
1068{ 1078{
1069 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1079 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1080 struct brcmf_pub *drvr = cfg->pub;
1070 struct brcmf_cfg80211_vif *vif; 1081 struct brcmf_cfg80211_vif *vif;
1071 s32 err = 0; 1082 s32 err = 0;
1072 1083
@@ -1076,21 +1087,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
1076 return -EIO; 1087 return -EIO;
1077 1088
1078 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { 1089 if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
1079 brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status); 1090 bphy_err(drvr, "Scanning already: status (%lu)\n",
1091 cfg->scan_status);
1080 return -EAGAIN; 1092 return -EAGAIN;
1081 } 1093 }
1082 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { 1094 if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) {
1083 brcmf_err("Scanning being aborted: status (%lu)\n", 1095 bphy_err(drvr, "Scanning being aborted: status (%lu)\n",
1084 cfg->scan_status); 1096 cfg->scan_status);
1085 return -EAGAIN; 1097 return -EAGAIN;
1086 } 1098 }
1087 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { 1099 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
1088 brcmf_err("Scanning suppressed: status (%lu)\n", 1100 bphy_err(drvr, "Scanning suppressed: status (%lu)\n",
1089 cfg->scan_status); 1101 cfg->scan_status);
1090 return -EAGAIN; 1102 return -EAGAIN;
1091 } 1103 }
1092 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) { 1104 if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) {
1093 brcmf_err("Connecting: status (%lu)\n", vif->sme_state); 1105 bphy_err(drvr, "Connecting: status (%lu)\n", vif->sme_state);
1094 return -EAGAIN; 1106 return -EAGAIN;
1095 } 1107 }
1096 1108
@@ -1124,7 +1136,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
1124 return 0; 1136 return 0;
1125 1137
1126scan_out: 1138scan_out:
1127 brcmf_err("scan error (%d)\n", err); 1139 bphy_err(drvr, "scan error (%d)\n", err);
1128 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); 1140 clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status);
1129 cfg->scan_request = NULL; 1141 cfg->scan_request = NULL;
1130 return err; 1142 return err;
@@ -1132,36 +1144,41 @@ scan_out:
1132 1144
1133static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold) 1145static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold)
1134{ 1146{
1147 struct brcmf_if *ifp = netdev_priv(ndev);
1148 struct brcmf_pub *drvr = ifp->drvr;
1135 s32 err = 0; 1149 s32 err = 0;
1136 1150
1137 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh", 1151 err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold);
1138 rts_threshold);
1139 if (err) 1152 if (err)
1140 brcmf_err("Error (%d)\n", err); 1153 bphy_err(drvr, "Error (%d)\n", err);
1141 1154
1142 return err; 1155 return err;
1143} 1156}
1144 1157
1145static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold) 1158static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold)
1146{ 1159{
1160 struct brcmf_if *ifp = netdev_priv(ndev);
1161 struct brcmf_pub *drvr = ifp->drvr;
1147 s32 err = 0; 1162 s32 err = 0;
1148 1163
1149 err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh", 1164 err = brcmf_fil_iovar_int_set(ifp, "fragthresh",
1150 frag_threshold); 1165 frag_threshold);
1151 if (err) 1166 if (err)
1152 brcmf_err("Error (%d)\n", err); 1167 bphy_err(drvr, "Error (%d)\n", err);
1153 1168
1154 return err; 1169 return err;
1155} 1170}
1156 1171
1157static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l) 1172static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
1158{ 1173{
1174 struct brcmf_if *ifp = netdev_priv(ndev);
1175 struct brcmf_pub *drvr = ifp->drvr;
1159 s32 err = 0; 1176 s32 err = 0;
1160 u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL); 1177 u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL);
1161 1178
1162 err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry); 1179 err = brcmf_fil_cmd_int_set(ifp, cmd, retry);
1163 if (err) { 1180 if (err) {
1164 brcmf_err("cmd (%d) , error (%d)\n", cmd, err); 1181 bphy_err(drvr, "cmd (%d) , error (%d)\n", cmd, err);
1165 return err; 1182 return err;
1166 } 1183 }
1167 return err; 1184 return err;
@@ -1237,6 +1254,7 @@ static u16 brcmf_map_fw_linkdown_reason(const struct brcmf_event_msg *e)
1237 1254
1238static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len) 1255static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
1239{ 1256{
1257 struct brcmf_pub *drvr = ifp->drvr;
1240 struct brcmf_wsec_pmk_le pmk; 1258 struct brcmf_wsec_pmk_le pmk;
1241 int i, err; 1259 int i, err;
1242 1260
@@ -1250,8 +1268,8 @@ static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
1250 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK, 1268 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK,
1251 &pmk, sizeof(pmk)); 1269 &pmk, sizeof(pmk));
1252 if (err < 0) 1270 if (err < 0)
1253 brcmf_err("failed to change PSK in firmware (len=%u)\n", 1271 bphy_err(drvr, "failed to change PSK in firmware (len=%u)\n",
1254 pmk_len); 1272 pmk_len);
1255 1273
1256 return err; 1274 return err;
1257} 1275}
@@ -1259,6 +1277,7 @@ static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len)
1259static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason) 1277static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
1260{ 1278{
1261 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); 1279 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
1280 struct brcmf_pub *drvr = cfg->pub;
1262 s32 err = 0; 1281 s32 err = 0;
1263 1282
1264 brcmf_dbg(TRACE, "Enter\n"); 1283 brcmf_dbg(TRACE, "Enter\n");
@@ -1268,7 +1287,7 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
1268 err = brcmf_fil_cmd_data_set(vif->ifp, 1287 err = brcmf_fil_cmd_data_set(vif->ifp,
1269 BRCMF_C_DISASSOC, NULL, 0); 1288 BRCMF_C_DISASSOC, NULL, 0);
1270 if (err) { 1289 if (err) {
1271 brcmf_err("WLC_DISASSOC failed (%d)\n", err); 1290 bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err);
1272 } 1291 }
1273 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || 1292 if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
1274 (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) 1293 (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
@@ -1292,6 +1311,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1292 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 1311 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1293 struct brcmf_if *ifp = netdev_priv(ndev); 1312 struct brcmf_if *ifp = netdev_priv(ndev);
1294 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 1313 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
1314 struct brcmf_pub *drvr = cfg->pub;
1295 struct brcmf_join_params join_params; 1315 struct brcmf_join_params join_params;
1296 size_t join_params_size = 0; 1316 size_t join_params_size = 0;
1297 s32 err = 0; 1317 s32 err = 0;
@@ -1356,7 +1376,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1356 1376
1357 err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec); 1377 err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec);
1358 if (err) { 1378 if (err) {
1359 brcmf_err("wsec failed (%d)\n", err); 1379 bphy_err(drvr, "wsec failed (%d)\n", err);
1360 goto done; 1380 goto done;
1361 } 1381 }
1362 1382
@@ -1368,7 +1388,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1368 1388
1369 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd); 1389 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd);
1370 if (err) { 1390 if (err) {
1371 brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err); 1391 bphy_err(drvr, "WLC_SET_BCNPRD failed (%d)\n", err);
1372 goto done; 1392 goto done;
1373 } 1393 }
1374 1394
@@ -1413,7 +1433,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1413 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL, 1433 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL,
1414 target_channel); 1434 target_channel);
1415 if (err) { 1435 if (err) {
1416 brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err); 1436 bphy_err(drvr, "WLC_SET_CHANNEL failed (%d)\n", err);
1417 goto done; 1437 goto done;
1418 } 1438 }
1419 } else 1439 } else
@@ -1425,7 +1445,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1425 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, 1445 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
1426 &join_params, join_params_size); 1446 &join_params, join_params_size);
1427 if (err) { 1447 if (err) {
1428 brcmf_err("WLC_SET_SSID failed (%d)\n", err); 1448 bphy_err(drvr, "WLC_SET_SSID failed (%d)\n", err);
1429 goto done; 1449 goto done;
1430 } 1450 }
1431 1451
@@ -1461,7 +1481,9 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
1461static s32 brcmf_set_wpa_version(struct net_device *ndev, 1481static s32 brcmf_set_wpa_version(struct net_device *ndev,
1462 struct cfg80211_connect_params *sme) 1482 struct cfg80211_connect_params *sme)
1463{ 1483{
1484 struct brcmf_if *ifp = netdev_priv(ndev);
1464 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); 1485 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
1486 struct brcmf_pub *drvr = ifp->drvr;
1465 struct brcmf_cfg80211_security *sec; 1487 struct brcmf_cfg80211_security *sec;
1466 s32 val = 0; 1488 s32 val = 0;
1467 s32 err = 0; 1489 s32 err = 0;
@@ -1473,9 +1495,9 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
1473 else 1495 else
1474 val = WPA_AUTH_DISABLED; 1496 val = WPA_AUTH_DISABLED;
1475 brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val); 1497 brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val);
1476 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val); 1498 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val);
1477 if (err) { 1499 if (err) {
1478 brcmf_err("set wpa_auth failed (%d)\n", err); 1500 bphy_err(drvr, "set wpa_auth failed (%d)\n", err);
1479 return err; 1501 return err;
1480 } 1502 }
1481 sec = &profile->sec; 1503 sec = &profile->sec;
@@ -1486,7 +1508,9 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
1486static s32 brcmf_set_auth_type(struct net_device *ndev, 1508static s32 brcmf_set_auth_type(struct net_device *ndev,
1487 struct cfg80211_connect_params *sme) 1509 struct cfg80211_connect_params *sme)
1488{ 1510{
1511 struct brcmf_if *ifp = netdev_priv(ndev);
1489 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); 1512 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
1513 struct brcmf_pub *drvr = ifp->drvr;
1490 struct brcmf_cfg80211_security *sec; 1514 struct brcmf_cfg80211_security *sec;
1491 s32 val = 0; 1515 s32 val = 0;
1492 s32 err = 0; 1516 s32 err = 0;
@@ -1506,9 +1530,9 @@ static s32 brcmf_set_auth_type(struct net_device *ndev,
1506 break; 1530 break;
1507 } 1531 }
1508 1532
1509 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); 1533 err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
1510 if (err) { 1534 if (err) {
1511 brcmf_err("set auth failed (%d)\n", err); 1535 bphy_err(drvr, "set auth failed (%d)\n", err);
1512 return err; 1536 return err;
1513 } 1537 }
1514 sec = &profile->sec; 1538 sec = &profile->sec;
@@ -1520,7 +1544,9 @@ static s32
1520brcmf_set_wsec_mode(struct net_device *ndev, 1544brcmf_set_wsec_mode(struct net_device *ndev,
1521 struct cfg80211_connect_params *sme) 1545 struct cfg80211_connect_params *sme)
1522{ 1546{
1547 struct brcmf_if *ifp = netdev_priv(ndev);
1523 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); 1548 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
1549 struct brcmf_pub *drvr = ifp->drvr;
1524 struct brcmf_cfg80211_security *sec; 1550 struct brcmf_cfg80211_security *sec;
1525 s32 pval = 0; 1551 s32 pval = 0;
1526 s32 gval = 0; 1552 s32 gval = 0;
@@ -1543,8 +1569,8 @@ brcmf_set_wsec_mode(struct net_device *ndev,
1543 pval = AES_ENABLED; 1569 pval = AES_ENABLED;
1544 break; 1570 break;
1545 default: 1571 default:
1546 brcmf_err("invalid cipher pairwise (%d)\n", 1572 bphy_err(drvr, "invalid cipher pairwise (%d)\n",
1547 sme->crypto.ciphers_pairwise[0]); 1573 sme->crypto.ciphers_pairwise[0]);
1548 return -EINVAL; 1574 return -EINVAL;
1549 } 1575 }
1550 } 1576 }
@@ -1564,8 +1590,8 @@ brcmf_set_wsec_mode(struct net_device *ndev,
1564 gval = AES_ENABLED; 1590 gval = AES_ENABLED;
1565 break; 1591 break;
1566 default: 1592 default:
1567 brcmf_err("invalid cipher group (%d)\n", 1593 bphy_err(drvr, "invalid cipher group (%d)\n",
1568 sme->crypto.cipher_group); 1594 sme->crypto.cipher_group);
1569 return -EINVAL; 1595 return -EINVAL;
1570 } 1596 }
1571 } 1597 }
@@ -1578,9 +1604,9 @@ brcmf_set_wsec_mode(struct net_device *ndev,
1578 pval = AES_ENABLED; 1604 pval = AES_ENABLED;
1579 1605
1580 wsec = pval | gval; 1606 wsec = pval | gval;
1581 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec); 1607 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
1582 if (err) { 1608 if (err) {
1583 brcmf_err("error (%d)\n", err); 1609 bphy_err(drvr, "error (%d)\n", err);
1584 return err; 1610 return err;
1585 } 1611 }
1586 1612
@@ -1596,6 +1622,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1596{ 1622{
1597 struct brcmf_if *ifp = netdev_priv(ndev); 1623 struct brcmf_if *ifp = netdev_priv(ndev);
1598 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 1624 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
1625 struct brcmf_pub *drvr = ifp->drvr;
1599 s32 val; 1626 s32 val;
1600 s32 err; 1627 s32 err;
1601 const struct brcmf_tlv *rsn_ie; 1628 const struct brcmf_tlv *rsn_ie;
@@ -1613,7 +1640,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1613 1640
1614 err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val); 1641 err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val);
1615 if (err) { 1642 if (err) {
1616 brcmf_err("could not get wpa_auth (%d)\n", err); 1643 bphy_err(drvr, "could not get wpa_auth (%d)\n", err);
1617 return err; 1644 return err;
1618 } 1645 }
1619 if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { 1646 if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) {
@@ -1627,8 +1654,8 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1627 val = WPA_AUTH_PSK; 1654 val = WPA_AUTH_PSK;
1628 break; 1655 break;
1629 default: 1656 default:
1630 brcmf_err("invalid cipher group (%d)\n", 1657 bphy_err(drvr, "invalid cipher group (%d)\n",
1631 sme->crypto.cipher_group); 1658 sme->crypto.cipher_group);
1632 return -EINVAL; 1659 return -EINVAL;
1633 } 1660 }
1634 } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { 1661 } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) {
@@ -1658,8 +1685,8 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1658 val = WPA2_AUTH_PSK | WPA2_AUTH_FT; 1685 val = WPA2_AUTH_PSK | WPA2_AUTH_FT;
1659 break; 1686 break;
1660 default: 1687 default:
1661 brcmf_err("invalid cipher group (%d)\n", 1688 bphy_err(drvr, "invalid cipher group (%d)\n",
1662 sme->crypto.cipher_group); 1689 sme->crypto.cipher_group);
1663 return -EINVAL; 1690 return -EINVAL;
1664 } 1691 }
1665 } 1692 }
@@ -1705,7 +1732,7 @@ skip_mfp_config:
1705 brcmf_dbg(CONN, "setting wpa_auth to %d\n", val); 1732 brcmf_dbg(CONN, "setting wpa_auth to %d\n", val);
1706 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val); 1733 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val);
1707 if (err) { 1734 if (err) {
1708 brcmf_err("could not set wpa_auth (%d)\n", err); 1735 bphy_err(drvr, "could not set wpa_auth (%d)\n", err);
1709 return err; 1736 return err;
1710 } 1737 }
1711 1738
@@ -1716,6 +1743,8 @@ static s32
1716brcmf_set_sharedkey(struct net_device *ndev, 1743brcmf_set_sharedkey(struct net_device *ndev,
1717 struct cfg80211_connect_params *sme) 1744 struct cfg80211_connect_params *sme)
1718{ 1745{
1746 struct brcmf_if *ifp = netdev_priv(ndev);
1747 struct brcmf_pub *drvr = ifp->drvr;
1719 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); 1748 struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev);
1720 struct brcmf_cfg80211_security *sec; 1749 struct brcmf_cfg80211_security *sec;
1721 struct brcmf_wsec_key key; 1750 struct brcmf_wsec_key key;
@@ -1742,7 +1771,7 @@ brcmf_set_sharedkey(struct net_device *ndev,
1742 key.len = (u32) sme->key_len; 1771 key.len = (u32) sme->key_len;
1743 key.index = (u32) sme->key_idx; 1772 key.index = (u32) sme->key_idx;
1744 if (key.len > sizeof(key.data)) { 1773 if (key.len > sizeof(key.data)) {
1745 brcmf_err("Too long key length (%u)\n", key.len); 1774 bphy_err(drvr, "Too long key length (%u)\n", key.len);
1746 return -EINVAL; 1775 return -EINVAL;
1747 } 1776 }
1748 memcpy(key.data, sme->key, key.len); 1777 memcpy(key.data, sme->key, key.len);
@@ -1755,24 +1784,24 @@ brcmf_set_sharedkey(struct net_device *ndev,
1755 key.algo = CRYPTO_ALGO_WEP128; 1784 key.algo = CRYPTO_ALGO_WEP128;
1756 break; 1785 break;
1757 default: 1786 default:
1758 brcmf_err("Invalid algorithm (%d)\n", 1787 bphy_err(drvr, "Invalid algorithm (%d)\n",
1759 sme->crypto.ciphers_pairwise[0]); 1788 sme->crypto.ciphers_pairwise[0]);
1760 return -EINVAL; 1789 return -EINVAL;
1761 } 1790 }
1762 /* Set the new key/index */ 1791 /* Set the new key/index */
1763 brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n", 1792 brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n",
1764 key.len, key.index, key.algo); 1793 key.len, key.index, key.algo);
1765 brcmf_dbg(CONN, "key \"%s\"\n", key.data); 1794 brcmf_dbg(CONN, "key \"%s\"\n", key.data);
1766 err = send_key_to_dongle(netdev_priv(ndev), &key); 1795 err = send_key_to_dongle(ifp, &key);
1767 if (err) 1796 if (err)
1768 return err; 1797 return err;
1769 1798
1770 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) { 1799 if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) {
1771 brcmf_dbg(CONN, "set auth_type to shared key\n"); 1800 brcmf_dbg(CONN, "set auth_type to shared key\n");
1772 val = WL_AUTH_SHARED_KEY; /* shared key */ 1801 val = WL_AUTH_SHARED_KEY; /* shared key */
1773 err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); 1802 err = brcmf_fil_bsscfg_int_set(ifp, "auth", val);
1774 if (err) 1803 if (err)
1775 brcmf_err("set auth failed (%d)\n", err); 1804 bphy_err(drvr, "set auth failed (%d)\n", err);
1776 } 1805 }
1777 return err; 1806 return err;
1778} 1807}
@@ -1792,6 +1821,7 @@ enum nl80211_auth_type brcmf_war_auth_type(struct brcmf_if *ifp,
1792static void brcmf_set_join_pref(struct brcmf_if *ifp, 1821static void brcmf_set_join_pref(struct brcmf_if *ifp,
1793 struct cfg80211_bss_selection *bss_select) 1822 struct cfg80211_bss_selection *bss_select)
1794{ 1823{
1824 struct brcmf_pub *drvr = ifp->drvr;
1795 struct brcmf_join_pref_params join_pref_params[2]; 1825 struct brcmf_join_pref_params join_pref_params[2];
1796 enum nl80211_band band; 1826 enum nl80211_band band;
1797 int err, i = 0; 1827 int err, i = 0;
@@ -1830,7 +1860,7 @@ static void brcmf_set_join_pref(struct brcmf_if *ifp,
1830 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, 1860 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
1831 sizeof(join_pref_params)); 1861 sizeof(join_pref_params));
1832 if (err) 1862 if (err)
1833 brcmf_err("Set join_pref error (%d)\n", err); 1863 bphy_err(drvr, "Set join_pref error (%d)\n", err);
1834} 1864}
1835 1865
1836static s32 1866static s32
@@ -1841,6 +1871,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1841 struct brcmf_if *ifp = netdev_priv(ndev); 1871 struct brcmf_if *ifp = netdev_priv(ndev);
1842 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 1872 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
1843 struct ieee80211_channel *chan = sme->channel; 1873 struct ieee80211_channel *chan = sme->channel;
1874 struct brcmf_pub *drvr = ifp->drvr;
1844 struct brcmf_join_params join_params; 1875 struct brcmf_join_params join_params;
1845 size_t join_params_size; 1876 size_t join_params_size;
1846 const struct brcmf_tlv *rsn_ie; 1877 const struct brcmf_tlv *rsn_ie;
@@ -1857,7 +1888,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1857 return -EIO; 1888 return -EIO;
1858 1889
1859 if (!sme->ssid) { 1890 if (!sme->ssid) {
1860 brcmf_err("Invalid ssid\n"); 1891 bphy_err(drvr, "Invalid ssid\n");
1861 return -EOPNOTSUPP; 1892 return -EOPNOTSUPP;
1862 } 1893 }
1863 1894
@@ -1886,7 +1917,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1886 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, 1917 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
1887 sme->ie, sme->ie_len); 1918 sme->ie, sme->ie_len);
1888 if (err) 1919 if (err)
1889 brcmf_err("Set Assoc REQ IE Failed\n"); 1920 bphy_err(drvr, "Set Assoc REQ IE Failed\n");
1890 else 1921 else
1891 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); 1922 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
1892 1923
@@ -1907,32 +1938,32 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1907 1938
1908 err = brcmf_set_wpa_version(ndev, sme); 1939 err = brcmf_set_wpa_version(ndev, sme);
1909 if (err) { 1940 if (err) {
1910 brcmf_err("wl_set_wpa_version failed (%d)\n", err); 1941 bphy_err(drvr, "wl_set_wpa_version failed (%d)\n", err);
1911 goto done; 1942 goto done;
1912 } 1943 }
1913 1944
1914 sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type); 1945 sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type);
1915 err = brcmf_set_auth_type(ndev, sme); 1946 err = brcmf_set_auth_type(ndev, sme);
1916 if (err) { 1947 if (err) {
1917 brcmf_err("wl_set_auth_type failed (%d)\n", err); 1948 bphy_err(drvr, "wl_set_auth_type failed (%d)\n", err);
1918 goto done; 1949 goto done;
1919 } 1950 }
1920 1951
1921 err = brcmf_set_wsec_mode(ndev, sme); 1952 err = brcmf_set_wsec_mode(ndev, sme);
1922 if (err) { 1953 if (err) {
1923 brcmf_err("wl_set_set_cipher failed (%d)\n", err); 1954 bphy_err(drvr, "wl_set_set_cipher failed (%d)\n", err);
1924 goto done; 1955 goto done;
1925 } 1956 }
1926 1957
1927 err = brcmf_set_key_mgmt(ndev, sme); 1958 err = brcmf_set_key_mgmt(ndev, sme);
1928 if (err) { 1959 if (err) {
1929 brcmf_err("wl_set_key_mgmt failed (%d)\n", err); 1960 bphy_err(drvr, "wl_set_key_mgmt failed (%d)\n", err);
1930 goto done; 1961 goto done;
1931 } 1962 }
1932 1963
1933 err = brcmf_set_sharedkey(ndev, sme); 1964 err = brcmf_set_sharedkey(ndev, sme);
1934 if (err) { 1965 if (err) {
1935 brcmf_err("brcmf_set_sharedkey failed (%d)\n", err); 1966 bphy_err(drvr, "brcmf_set_sharedkey failed (%d)\n", err);
1936 goto done; 1967 goto done;
1937 } 1968 }
1938 1969
@@ -1949,7 +1980,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1949 /* enable firmware supplicant for this interface */ 1980 /* enable firmware supplicant for this interface */
1950 err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1); 1981 err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
1951 if (err < 0) { 1982 if (err < 0) {
1952 brcmf_err("failed to enable fw supplicant\n"); 1983 bphy_err(drvr, "failed to enable fw supplicant\n");
1953 goto done; 1984 goto done;
1954 } 1985 }
1955 } 1986 }
@@ -2044,7 +2075,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
2044 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, 2075 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
2045 &join_params, join_params_size); 2076 &join_params, join_params_size);
2046 if (err) 2077 if (err)
2047 brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err); 2078 bphy_err(drvr, "BRCMF_C_SET_SSID failed (%d)\n", err);
2048 2079
2049done: 2080done:
2050 if (err) 2081 if (err)
@@ -2057,8 +2088,10 @@ static s32
2057brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, 2088brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
2058 u16 reason_code) 2089 u16 reason_code)
2059{ 2090{
2091 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2060 struct brcmf_if *ifp = netdev_priv(ndev); 2092 struct brcmf_if *ifp = netdev_priv(ndev);
2061 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 2093 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
2094 struct brcmf_pub *drvr = cfg->pub;
2062 struct brcmf_scb_val_le scbval; 2095 struct brcmf_scb_val_le scbval;
2063 s32 err = 0; 2096 s32 err = 0;
2064 2097
@@ -2075,7 +2108,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
2075 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC, 2108 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC,
2076 &scbval, sizeof(scbval)); 2109 &scbval, sizeof(scbval));
2077 if (err) 2110 if (err)
2078 brcmf_err("error (%d)\n", err); 2111 bphy_err(drvr, "error (%d)\n", err);
2079 2112
2080 brcmf_dbg(TRACE, "Exit\n"); 2113 brcmf_dbg(TRACE, "Exit\n");
2081 return err; 2114 return err;
@@ -2088,6 +2121,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2088 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 2121 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2089 struct net_device *ndev = cfg_to_ndev(cfg); 2122 struct net_device *ndev = cfg_to_ndev(cfg);
2090 struct brcmf_if *ifp = netdev_priv(ndev); 2123 struct brcmf_if *ifp = netdev_priv(ndev);
2124 struct brcmf_pub *drvr = cfg->pub;
2091 s32 err; 2125 s32 err;
2092 s32 disable; 2126 s32 disable;
2093 u32 qdbm = 127; 2127 u32 qdbm = 127;
@@ -2102,7 +2136,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2102 case NL80211_TX_POWER_LIMITED: 2136 case NL80211_TX_POWER_LIMITED:
2103 case NL80211_TX_POWER_FIXED: 2137 case NL80211_TX_POWER_FIXED:
2104 if (mbm < 0) { 2138 if (mbm < 0) {
2105 brcmf_err("TX_POWER_FIXED - dbm is negative\n"); 2139 bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n");
2106 err = -EINVAL; 2140 err = -EINVAL;
2107 goto done; 2141 goto done;
2108 } 2142 }
@@ -2112,7 +2146,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2112 qdbm |= WL_TXPWR_OVERRIDE; 2146 qdbm |= WL_TXPWR_OVERRIDE;
2113 break; 2147 break;
2114 default: 2148 default:
2115 brcmf_err("Unsupported type %d\n", type); 2149 bphy_err(drvr, "Unsupported type %d\n", type);
2116 err = -EINVAL; 2150 err = -EINVAL;
2117 goto done; 2151 goto done;
2118 } 2152 }
@@ -2120,11 +2154,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2120 disable = WL_RADIO_SW_DISABLE << 16; 2154 disable = WL_RADIO_SW_DISABLE << 16;
2121 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable); 2155 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable);
2122 if (err) 2156 if (err)
2123 brcmf_err("WLC_SET_RADIO error (%d)\n", err); 2157 bphy_err(drvr, "WLC_SET_RADIO error (%d)\n", err);
2124 2158
2125 err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm); 2159 err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
2126 if (err) 2160 if (err)
2127 brcmf_err("qtxpower error (%d)\n", err); 2161 bphy_err(drvr, "qtxpower error (%d)\n", err);
2128 2162
2129done: 2163done:
2130 brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE); 2164 brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
@@ -2135,7 +2169,9 @@ static s32
2135brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, 2169brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2136 s32 *dbm) 2170 s32 *dbm)
2137{ 2171{
2172 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2138 struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev); 2173 struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev);
2174 struct brcmf_pub *drvr = cfg->pub;
2139 s32 qdbm = 0; 2175 s32 qdbm = 0;
2140 s32 err; 2176 s32 err;
2141 2177
@@ -2145,7 +2181,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2145 2181
2146 err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm); 2182 err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm);
2147 if (err) { 2183 if (err) {
2148 brcmf_err("error (%d)\n", err); 2184 bphy_err(drvr, "error (%d)\n", err);
2149 goto done; 2185 goto done;
2150 } 2186 }
2151 *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4; 2187 *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
@@ -2160,6 +2196,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
2160 u8 key_idx, bool unicast, bool multicast) 2196 u8 key_idx, bool unicast, bool multicast)
2161{ 2197{
2162 struct brcmf_if *ifp = netdev_priv(ndev); 2198 struct brcmf_if *ifp = netdev_priv(ndev);
2199 struct brcmf_pub *drvr = ifp->drvr;
2163 u32 index; 2200 u32 index;
2164 u32 wsec; 2201 u32 wsec;
2165 s32 err = 0; 2202 s32 err = 0;
@@ -2171,7 +2208,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
2171 2208
2172 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); 2209 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
2173 if (err) { 2210 if (err) {
2174 brcmf_err("WLC_GET_WSEC error (%d)\n", err); 2211 bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
2175 goto done; 2212 goto done;
2176 } 2213 }
2177 2214
@@ -2181,7 +2218,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
2181 err = brcmf_fil_cmd_int_set(ifp, 2218 err = brcmf_fil_cmd_int_set(ifp,
2182 BRCMF_C_SET_KEY_PRIMARY, index); 2219 BRCMF_C_SET_KEY_PRIMARY, index);
2183 if (err) 2220 if (err)
2184 brcmf_err("error (%d)\n", err); 2221 bphy_err(drvr, "error (%d)\n", err);
2185 } 2222 }
2186done: 2223done:
2187 brcmf_dbg(TRACE, "Exit\n"); 2224 brcmf_dbg(TRACE, "Exit\n");
@@ -2230,7 +2267,9 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
2230 u8 key_idx, bool pairwise, const u8 *mac_addr, 2267 u8 key_idx, bool pairwise, const u8 *mac_addr,
2231 struct key_params *params) 2268 struct key_params *params)
2232{ 2269{
2270 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2233 struct brcmf_if *ifp = netdev_priv(ndev); 2271 struct brcmf_if *ifp = netdev_priv(ndev);
2272 struct brcmf_pub *drvr = cfg->pub;
2234 struct brcmf_wsec_key *key; 2273 struct brcmf_wsec_key *key;
2235 s32 val; 2274 s32 val;
2236 s32 wsec; 2275 s32 wsec;
@@ -2245,7 +2284,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
2245 2284
2246 if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) { 2285 if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) {
2247 /* we ignore this key index in this case */ 2286 /* we ignore this key index in this case */
2248 brcmf_err("invalid key index (%d)\n", key_idx); 2287 bphy_err(drvr, "invalid key index (%d)\n", key_idx);
2249 return -EINVAL; 2288 return -EINVAL;
2250 } 2289 }
2251 2290
@@ -2254,7 +2293,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
2254 mac_addr); 2293 mac_addr);
2255 2294
2256 if (params->key_len > sizeof(key->data)) { 2295 if (params->key_len > sizeof(key->data)) {
2257 brcmf_err("Too long key length (%u)\n", params->key_len); 2296 bphy_err(drvr, "Too long key length (%u)\n", params->key_len);
2258 return -EINVAL; 2297 return -EINVAL;
2259 } 2298 }
2260 2299
@@ -2308,7 +2347,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
2308 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n"); 2347 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n");
2309 break; 2348 break;
2310 default: 2349 default:
2311 brcmf_err("Invalid cipher (0x%x)\n", params->cipher); 2350 bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher);
2312 err = -EINVAL; 2351 err = -EINVAL;
2313 goto done; 2352 goto done;
2314 } 2353 }
@@ -2319,13 +2358,13 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
2319 2358
2320 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); 2359 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
2321 if (err) { 2360 if (err) {
2322 brcmf_err("get wsec error (%d)\n", err); 2361 bphy_err(drvr, "get wsec error (%d)\n", err);
2323 goto done; 2362 goto done;
2324 } 2363 }
2325 wsec |= val; 2364 wsec |= val;
2326 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); 2365 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
2327 if (err) { 2366 if (err) {
2328 brcmf_err("set wsec error (%d)\n", err); 2367 bphy_err(drvr, "set wsec error (%d)\n", err);
2329 goto done; 2368 goto done;
2330 } 2369 }
2331 2370
@@ -2340,9 +2379,11 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_idx,
2340 void (*callback)(void *cookie, 2379 void (*callback)(void *cookie,
2341 struct key_params *params)) 2380 struct key_params *params))
2342{ 2381{
2382 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2343 struct key_params params; 2383 struct key_params params;
2344 struct brcmf_if *ifp = netdev_priv(ndev); 2384 struct brcmf_if *ifp = netdev_priv(ndev);
2345 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; 2385 struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
2386 struct brcmf_pub *drvr = cfg->pub;
2346 struct brcmf_cfg80211_security *sec; 2387 struct brcmf_cfg80211_security *sec;
2347 s32 wsec; 2388 s32 wsec;
2348 s32 err = 0; 2389 s32 err = 0;
@@ -2356,7 +2397,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_idx,
2356 2397
2357 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); 2398 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
2358 if (err) { 2399 if (err) {
2359 brcmf_err("WLC_GET_WSEC error (%d)\n", err); 2400 bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err);
2360 /* Ignore this error, may happen during DISASSOC */ 2401 /* Ignore this error, may happen during DISASSOC */
2361 err = -EAGAIN; 2402 err = -EAGAIN;
2362 goto done; 2403 goto done;
@@ -2377,7 +2418,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, u8 key_idx,
2377 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; 2418 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
2378 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); 2419 brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n");
2379 } else { 2420 } else {
2380 brcmf_err("Invalid algo (0x%x)\n", wsec); 2421 bphy_err(drvr, "Invalid algo (0x%x)\n", wsec);
2381 err = -EINVAL; 2422 err = -EINVAL;
2382 goto done; 2423 goto done;
2383 } 2424 }
@@ -2407,6 +2448,7 @@ brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
2407static void 2448static void
2408brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp) 2449brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
2409{ 2450{
2451 struct brcmf_pub *drvr = ifp->drvr;
2410 s32 err; 2452 s32 err;
2411 u8 key_idx; 2453 u8 key_idx;
2412 struct brcmf_wsec_key *key; 2454 struct brcmf_wsec_key *key;
@@ -2423,18 +2465,18 @@ brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp)
2423 2465
2424 err = send_key_to_dongle(ifp, key); 2466 err = send_key_to_dongle(ifp, key);
2425 if (err) { 2467 if (err) {
2426 brcmf_err("Setting WEP key failed (%d)\n", err); 2468 bphy_err(drvr, "Setting WEP key failed (%d)\n", err);
2427 return; 2469 return;
2428 } 2470 }
2429 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); 2471 err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec);
2430 if (err) { 2472 if (err) {
2431 brcmf_err("get wsec error (%d)\n", err); 2473 bphy_err(drvr, "get wsec error (%d)\n", err);
2432 return; 2474 return;
2433 } 2475 }
2434 wsec |= WEP_ENABLED; 2476 wsec |= WEP_ENABLED;
2435 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); 2477 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
2436 if (err) 2478 if (err)
2437 brcmf_err("set wsec error (%d)\n", err); 2479 bphy_err(drvr, "set wsec error (%d)\n", err);
2438} 2480}
2439 2481
2440static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si) 2482static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
@@ -2460,6 +2502,7 @@ static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
2460 2502
2461static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) 2503static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
2462{ 2504{
2505 struct brcmf_pub *drvr = ifp->drvr;
2463 struct { 2506 struct {
2464 __le32 len; 2507 __le32 len;
2465 struct brcmf_bss_info_le bss_le; 2508 struct brcmf_bss_info_le bss_le;
@@ -2475,7 +2518,7 @@ static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
2475 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf, 2518 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
2476 WL_BSS_INFO_MAX); 2519 WL_BSS_INFO_MAX);
2477 if (err) { 2520 if (err) {
2478 brcmf_err("Failed to get bss info (%d)\n", err); 2521 bphy_err(drvr, "Failed to get bss info (%d)\n", err);
2479 goto out_kfree; 2522 goto out_kfree;
2480 } 2523 }
2481 si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); 2524 si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
@@ -2497,6 +2540,7 @@ static s32
2497brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp, 2540brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
2498 struct station_info *sinfo) 2541 struct station_info *sinfo)
2499{ 2542{
2543 struct brcmf_pub *drvr = ifp->drvr;
2500 struct brcmf_scb_val_le scbval; 2544 struct brcmf_scb_val_le scbval;
2501 struct brcmf_pktcnt_le pktcnt; 2545 struct brcmf_pktcnt_le pktcnt;
2502 s32 err; 2546 s32 err;
@@ -2506,7 +2550,7 @@ brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
2506 /* Get the current tx rate */ 2550 /* Get the current tx rate */
2507 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate); 2551 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
2508 if (err < 0) { 2552 if (err < 0) {
2509 brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err); 2553 bphy_err(drvr, "BRCMF_C_GET_RATE error (%d)\n", err);
2510 return err; 2554 return err;
2511 } 2555 }
2512 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); 2556 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
@@ -2516,7 +2560,7 @@ brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
2516 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval, 2560 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval,
2517 sizeof(scbval)); 2561 sizeof(scbval));
2518 if (err) { 2562 if (err) {
2519 brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err); 2563 bphy_err(drvr, "BRCMF_C_GET_RSSI error (%d)\n", err);
2520 return err; 2564 return err;
2521 } 2565 }
2522 rssi = le32_to_cpu(scbval.val); 2566 rssi = le32_to_cpu(scbval.val);
@@ -2526,7 +2570,7 @@ brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp,
2526 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt, 2570 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt,
2527 sizeof(pktcnt)); 2571 sizeof(pktcnt));
2528 if (err) { 2572 if (err) {
2529 brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err); 2573 bphy_err(drvr, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err);
2530 return err; 2574 return err;
2531 } 2575 }
2532 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | 2576 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
@@ -2545,7 +2589,9 @@ static s32
2545brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, 2589brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2546 const u8 *mac, struct station_info *sinfo) 2590 const u8 *mac, struct station_info *sinfo)
2547{ 2591{
2592 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2548 struct brcmf_if *ifp = netdev_priv(ndev); 2593 struct brcmf_if *ifp = netdev_priv(ndev);
2594 struct brcmf_pub *drvr = cfg->pub;
2549 struct brcmf_scb_val_le scb_val; 2595 struct brcmf_scb_val_le scb_val;
2550 s32 err = 0; 2596 s32 err = 0;
2551 struct brcmf_sta_info_le sta_info_le; 2597 struct brcmf_sta_info_le sta_info_le;
@@ -2574,7 +2620,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2574 &sta_info_le, 2620 &sta_info_le,
2575 sizeof(sta_info_le)); 2621 sizeof(sta_info_le));
2576 if (err < 0) { 2622 if (err < 0) {
2577 brcmf_err("GET STA INFO failed, %d\n", err); 2623 bphy_err(drvr, "GET STA INFO failed, %d\n", err);
2578 goto done; 2624 goto done;
2579 } 2625 }
2580 } 2626 }
@@ -2643,7 +2689,8 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2643 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, 2689 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
2644 &scb_val, sizeof(scb_val)); 2690 &scb_val, sizeof(scb_val));
2645 if (err) { 2691 if (err) {
2646 brcmf_err("Could not get rssi (%d)\n", err); 2692 bphy_err(drvr, "Could not get rssi (%d)\n",
2693 err);
2647 goto done; 2694 goto done;
2648 } else { 2695 } else {
2649 rssi = le32_to_cpu(scb_val.val); 2696 rssi = le32_to_cpu(scb_val.val);
@@ -2664,6 +2711,7 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev,
2664{ 2711{
2665 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 2712 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2666 struct brcmf_if *ifp = netdev_priv(ndev); 2713 struct brcmf_if *ifp = netdev_priv(ndev);
2714 struct brcmf_pub *drvr = cfg->pub;
2667 s32 err; 2715 s32 err;
2668 2716
2669 brcmf_dbg(TRACE, "Enter, idx %d\n", idx); 2717 brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
@@ -2674,8 +2722,8 @@ brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev,
2674 &cfg->assoclist, 2722 &cfg->assoclist,
2675 sizeof(cfg->assoclist)); 2723 sizeof(cfg->assoclist));
2676 if (err) { 2724 if (err) {
2677 brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n", 2725 bphy_err(drvr, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
2678 err); 2726 err);
2679 cfg->assoclist.count = 0; 2727 cfg->assoclist.count = 0;
2680 return -EOPNOTSUPP; 2728 return -EOPNOTSUPP;
2681 } 2729 }
@@ -2695,6 +2743,7 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
2695 s32 err = 0; 2743 s32 err = 0;
2696 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 2744 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2697 struct brcmf_if *ifp = netdev_priv(ndev); 2745 struct brcmf_if *ifp = netdev_priv(ndev);
2746 struct brcmf_pub *drvr = cfg->pub;
2698 2747
2699 brcmf_dbg(TRACE, "Enter\n"); 2748 brcmf_dbg(TRACE, "Enter\n");
2700 2749
@@ -2723,9 +2772,9 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
2723 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); 2772 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm);
2724 if (err) { 2773 if (err) {
2725 if (err == -ENODEV) 2774 if (err == -ENODEV)
2726 brcmf_err("net_device is not ready yet\n"); 2775 bphy_err(drvr, "net_device is not ready yet\n");
2727 else 2776 else
2728 brcmf_err("error (%d)\n", err); 2777 bphy_err(drvr, "error (%d)\n", err);
2729 } 2778 }
2730done: 2779done:
2731 brcmf_dbg(TRACE, "Exit\n"); 2780 brcmf_dbg(TRACE, "Exit\n");
@@ -2736,6 +2785,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2736 struct brcmf_bss_info_le *bi) 2785 struct brcmf_bss_info_le *bi)
2737{ 2786{
2738 struct wiphy *wiphy = cfg_to_wiphy(cfg); 2787 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2788 struct brcmf_pub *drvr = cfg->pub;
2739 struct cfg80211_bss *bss; 2789 struct cfg80211_bss *bss;
2740 enum nl80211_band band; 2790 enum nl80211_band band;
2741 struct brcmu_chan ch; 2791 struct brcmu_chan ch;
@@ -2748,7 +2798,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2748 struct cfg80211_inform_bss bss_data = {}; 2798 struct cfg80211_inform_bss bss_data = {};
2749 2799
2750 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { 2800 if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
2751 brcmf_err("Bss info is larger than buffer. Discarding\n"); 2801 bphy_err(drvr, "Bss info is larger than buffer. Discarding\n");
2752 return 0; 2802 return 0;
2753 } 2803 }
2754 2804
@@ -2807,6 +2857,7 @@ next_bss_le(struct brcmf_scan_results *list, struct brcmf_bss_info_le *bss)
2807 2857
2808static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg) 2858static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
2809{ 2859{
2860 struct brcmf_pub *drvr = cfg->pub;
2810 struct brcmf_scan_results *bss_list; 2861 struct brcmf_scan_results *bss_list;
2811 struct brcmf_bss_info_le *bi = NULL; /* must be initialized */ 2862 struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
2812 s32 err = 0; 2863 s32 err = 0;
@@ -2815,8 +2866,8 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
2815 bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; 2866 bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
2816 if (bss_list->count != 0 && 2867 if (bss_list->count != 0 &&
2817 bss_list->version != BRCMF_BSS_INFO_VERSION) { 2868 bss_list->version != BRCMF_BSS_INFO_VERSION) {
2818 brcmf_err("Version %d != WL_BSS_INFO_VERSION\n", 2869 bphy_err(drvr, "Version %d != WL_BSS_INFO_VERSION\n",
2819 bss_list->version); 2870 bss_list->version);
2820 return -EOPNOTSUPP; 2871 return -EOPNOTSUPP;
2821 } 2872 }
2822 brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count); 2873 brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count);
@@ -2833,6 +2884,7 @@ static s32 brcmf_inform_ibss(struct brcmf_cfg80211_info *cfg,
2833 struct net_device *ndev, const u8 *bssid) 2884 struct net_device *ndev, const u8 *bssid)
2834{ 2885{
2835 struct wiphy *wiphy = cfg_to_wiphy(cfg); 2886 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2887 struct brcmf_pub *drvr = cfg->pub;
2836 struct ieee80211_channel *notify_channel; 2888 struct ieee80211_channel *notify_channel;
2837 struct brcmf_bss_info_le *bi = NULL; 2889 struct brcmf_bss_info_le *bi = NULL;
2838 struct ieee80211_supported_band *band; 2890 struct ieee80211_supported_band *band;
@@ -2860,7 +2912,7 @@ static s32 brcmf_inform_ibss(struct brcmf_cfg80211_info *cfg,
2860 err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO, 2912 err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO,
2861 buf, WL_BSS_INFO_MAX); 2913 buf, WL_BSS_INFO_MAX);
2862 if (err) { 2914 if (err) {
2863 brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err); 2915 bphy_err(drvr, "WLC_GET_BSS_INFO failed: %d\n", err);
2864 goto CleanUp; 2916 goto CleanUp;
2865 } 2917 }
2866 2918
@@ -2914,6 +2966,7 @@ CleanUp:
2914static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg, 2966static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
2915 struct brcmf_if *ifp) 2967 struct brcmf_if *ifp)
2916{ 2968{
2969 struct brcmf_pub *drvr = cfg->pub;
2917 struct brcmf_bss_info_le *bi; 2970 struct brcmf_bss_info_le *bi;
2918 const struct brcmf_tlv *tim; 2971 const struct brcmf_tlv *tim;
2919 u16 beacon_interval; 2972 u16 beacon_interval;
@@ -2930,7 +2983,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
2930 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, 2983 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
2931 cfg->extra_buf, WL_EXTRA_BUF_MAX); 2984 cfg->extra_buf, WL_EXTRA_BUF_MAX);
2932 if (err) { 2985 if (err) {
2933 brcmf_err("Could not get bss info %d\n", err); 2986 bphy_err(drvr, "Could not get bss info %d\n", err);
2934 goto update_bss_info_out; 2987 goto update_bss_info_out;
2935 } 2988 }
2936 2989
@@ -2955,7 +3008,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
2955 u32 var; 3008 u32 var;
2956 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var); 3009 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var);
2957 if (err) { 3010 if (err) {
2958 brcmf_err("wl dtim_assoc failed (%d)\n", err); 3011 bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err);
2959 goto update_bss_info_out; 3012 goto update_bss_info_out;
2960 } 3013 }
2961 dtim_period = (u8)var; 3014 dtim_period = (u8)var;
@@ -2993,9 +3046,10 @@ static void brcmf_escan_timeout(struct timer_list *t)
2993{ 3046{
2994 struct brcmf_cfg80211_info *cfg = 3047 struct brcmf_cfg80211_info *cfg =
2995 from_timer(cfg, t, escan_timeout); 3048 from_timer(cfg, t, escan_timeout);
3049 struct brcmf_pub *drvr = cfg->pub;
2996 3050
2997 if (cfg->int_escan_map || cfg->scan_request) { 3051 if (cfg->int_escan_map || cfg->scan_request) {
2998 brcmf_err("timer expired\n"); 3052 bphy_err(drvr, "timer expired\n");
2999 schedule_work(&cfg->escan_timeout_work); 3053 schedule_work(&cfg->escan_timeout_work);
3000 } 3054 }
3001} 3055}
@@ -3043,7 +3097,8 @@ static s32
3043brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, 3097brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
3044 const struct brcmf_event_msg *e, void *data) 3098 const struct brcmf_event_msg *e, void *data)
3045{ 3099{
3046 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; 3100 struct brcmf_pub *drvr = ifp->drvr;
3101 struct brcmf_cfg80211_info *cfg = drvr->config;
3047 s32 status; 3102 s32 status;
3048 struct brcmf_escan_result_le *escan_result_le; 3103 struct brcmf_escan_result_le *escan_result_le;
3049 u32 escan_buflen; 3104 u32 escan_buflen;
@@ -3060,32 +3115,33 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
3060 goto exit; 3115 goto exit;
3061 3116
3062 if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { 3117 if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
3063 brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx); 3118 bphy_err(drvr, "scan not ready, bsscfgidx=%d\n",
3119 ifp->bsscfgidx);
3064 return -EPERM; 3120 return -EPERM;
3065 } 3121 }
3066 3122
3067 if (status == BRCMF_E_STATUS_PARTIAL) { 3123 if (status == BRCMF_E_STATUS_PARTIAL) {
3068 brcmf_dbg(SCAN, "ESCAN Partial result\n"); 3124 brcmf_dbg(SCAN, "ESCAN Partial result\n");
3069 if (e->datalen < sizeof(*escan_result_le)) { 3125 if (e->datalen < sizeof(*escan_result_le)) {
3070 brcmf_err("invalid event data length\n"); 3126 bphy_err(drvr, "invalid event data length\n");
3071 goto exit; 3127 goto exit;
3072 } 3128 }
3073 escan_result_le = (struct brcmf_escan_result_le *) data; 3129 escan_result_le = (struct brcmf_escan_result_le *) data;
3074 if (!escan_result_le) { 3130 if (!escan_result_le) {
3075 brcmf_err("Invalid escan result (NULL pointer)\n"); 3131 bphy_err(drvr, "Invalid escan result (NULL pointer)\n");
3076 goto exit; 3132 goto exit;
3077 } 3133 }
3078 escan_buflen = le32_to_cpu(escan_result_le->buflen); 3134 escan_buflen = le32_to_cpu(escan_result_le->buflen);
3079 if (escan_buflen > BRCMF_ESCAN_BUF_SIZE || 3135 if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
3080 escan_buflen > e->datalen || 3136 escan_buflen > e->datalen ||
3081 escan_buflen < sizeof(*escan_result_le)) { 3137 escan_buflen < sizeof(*escan_result_le)) {
3082 brcmf_err("Invalid escan buffer length: %d\n", 3138 bphy_err(drvr, "Invalid escan buffer length: %d\n",
3083 escan_buflen); 3139 escan_buflen);
3084 goto exit; 3140 goto exit;
3085 } 3141 }
3086 if (le16_to_cpu(escan_result_le->bss_count) != 1) { 3142 if (le16_to_cpu(escan_result_le->bss_count) != 1) {
3087 brcmf_err("Invalid bss_count %d: ignoring\n", 3143 bphy_err(drvr, "Invalid bss_count %d: ignoring\n",
3088 escan_result_le->bss_count); 3144 escan_result_le->bss_count);
3089 goto exit; 3145 goto exit;
3090 } 3146 }
3091 bss_info_le = &escan_result_le->bss_info_le; 3147 bss_info_le = &escan_result_le->bss_info_le;
@@ -3100,8 +3156,8 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
3100 3156
3101 bi_length = le32_to_cpu(bss_info_le->length); 3157 bi_length = le32_to_cpu(bss_info_le->length);
3102 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) { 3158 if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
3103 brcmf_err("Ignoring invalid bss_info length: %d\n", 3159 bphy_err(drvr, "Ignoring invalid bss_info length: %d\n",
3104 bi_length); 3160 bi_length);
3105 goto exit; 3161 goto exit;
3106 } 3162 }
3107 3163
@@ -3109,7 +3165,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
3109 BIT(NL80211_IFTYPE_ADHOC))) { 3165 BIT(NL80211_IFTYPE_ADHOC))) {
3110 if (le16_to_cpu(bss_info_le->capability) & 3166 if (le16_to_cpu(bss_info_le->capability) &
3111 WLAN_CAPABILITY_IBSS) { 3167 WLAN_CAPABILITY_IBSS) {
3112 brcmf_err("Ignoring IBSS result\n"); 3168 bphy_err(drvr, "Ignoring IBSS result\n");
3113 goto exit; 3169 goto exit;
3114 } 3170 }
3115 } 3171 }
@@ -3117,7 +3173,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
3117 list = (struct brcmf_scan_results *) 3173 list = (struct brcmf_scan_results *)
3118 cfg->escan_info.escan_buf; 3174 cfg->escan_info.escan_buf;
3119 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) { 3175 if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) {
3120 brcmf_err("Buffer is too small: ignoring\n"); 3176 bphy_err(drvr, "Buffer is too small: ignoring\n");
3121 goto exit; 3177 goto exit;
3122 } 3178 }
3123 3179
@@ -3276,7 +3332,8 @@ static s32
3276brcmf_notify_sched_scan_results(struct brcmf_if *ifp, 3332brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
3277 const struct brcmf_event_msg *e, void *data) 3333 const struct brcmf_event_msg *e, void *data)
3278{ 3334{
3279 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; 3335 struct brcmf_pub *drvr = ifp->drvr;
3336 struct brcmf_cfg80211_info *cfg = drvr->config;
3280 struct brcmf_pno_net_info_le *netinfo, *netinfo_start; 3337 struct brcmf_pno_net_info_le *netinfo, *netinfo_start;
3281 struct cfg80211_scan_request *request = NULL; 3338 struct cfg80211_scan_request *request = NULL;
3282 struct wiphy *wiphy = cfg_to_wiphy(cfg); 3339 struct wiphy *wiphy = cfg_to_wiphy(cfg);
@@ -3309,14 +3366,14 @@ brcmf_notify_sched_scan_results(struct brcmf_if *ifp,
3309 WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE); 3366 WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE);
3310 brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count); 3367 brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count);
3311 if (!result_count) { 3368 if (!result_count) {
3312 brcmf_err("FALSE PNO Event. (pfn_count == 0)\n"); 3369 bphy_err(drvr, "FALSE PNO Event. (pfn_count == 0)\n");
3313 goto out_err; 3370 goto out_err;
3314 } 3371 }
3315 3372
3316 netinfo_start = brcmf_get_netinfo_array(pfn_result); 3373 netinfo_start = brcmf_get_netinfo_array(pfn_result);
3317 datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result); 3374 datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result);
3318 if (datalen < result_count * sizeof(*netinfo)) { 3375 if (datalen < result_count * sizeof(*netinfo)) {
3319 brcmf_err("insufficient event data\n"); 3376 bphy_err(drvr, "insufficient event data\n");
3320 goto out_err; 3377 goto out_err;
3321 } 3378 }
3322 3379
@@ -3363,15 +3420,16 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
3363 struct net_device *ndev, 3420 struct net_device *ndev,
3364 struct cfg80211_sched_scan_request *req) 3421 struct cfg80211_sched_scan_request *req)
3365{ 3422{
3366 struct brcmf_if *ifp = netdev_priv(ndev);
3367 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 3423 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3424 struct brcmf_if *ifp = netdev_priv(ndev);
3425 struct brcmf_pub *drvr = cfg->pub;
3368 3426
3369 brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n", 3427 brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n",
3370 req->n_match_sets, req->n_ssids); 3428 req->n_match_sets, req->n_ssids);
3371 3429
3372 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { 3430 if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) {
3373 brcmf_err("Scanning suppressed: status=%lu\n", 3431 bphy_err(drvr, "Scanning suppressed: status=%lu\n",
3374 cfg->scan_status); 3432 cfg->scan_status);
3375 return -EAGAIN; 3433 return -EAGAIN;
3376 } 3434 }
3377 3435
@@ -3449,7 +3507,8 @@ static s32
3449brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e, 3507brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
3450 void *data) 3508 void *data)
3451{ 3509{
3452 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; 3510 struct brcmf_pub *drvr = ifp->drvr;
3511 struct brcmf_cfg80211_info *cfg = drvr->config;
3453 struct brcmf_pno_scanresults_le *pfn_result; 3512 struct brcmf_pno_scanresults_le *pfn_result;
3454 struct brcmf_pno_net_info_le *netinfo; 3513 struct brcmf_pno_net_info_le *netinfo;
3455 3514
@@ -3468,12 +3527,14 @@ brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
3468 } 3527 }
3469 3528
3470 if (le32_to_cpu(pfn_result->count) < 1) { 3529 if (le32_to_cpu(pfn_result->count) < 1) {
3471 brcmf_err("Invalid result count, expected 1 (%d)\n", 3530 bphy_err(drvr, "Invalid result count, expected 1 (%d)\n",
3472 le32_to_cpu(pfn_result->count)); 3531 le32_to_cpu(pfn_result->count));
3473 return -EINVAL; 3532 return -EINVAL;
3474 } 3533 }
3475 3534
3476 netinfo = brcmf_get_netinfo_array(pfn_result); 3535 netinfo = brcmf_get_netinfo_array(pfn_result);
3536 if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN)
3537 netinfo->SSID_len = IEEE80211_MAX_SSID_LEN;
3477 memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len); 3538 memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len);
3478 cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len; 3539 cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len;
3479 cfg->wowl.nd->n_channels = 1; 3540 cfg->wowl.nd->n_channels = 1;
@@ -3496,6 +3557,7 @@ brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
3496static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp) 3557static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
3497{ 3558{
3498 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 3559 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3560 struct brcmf_pub *drvr = cfg->pub;
3499 struct brcmf_wowl_wakeind_le wake_ind_le; 3561 struct brcmf_wowl_wakeind_le wake_ind_le;
3500 struct cfg80211_wowlan_wakeup wakeup_data; 3562 struct cfg80211_wowlan_wakeup wakeup_data;
3501 struct cfg80211_wowlan_wakeup *wakeup; 3563 struct cfg80211_wowlan_wakeup *wakeup;
@@ -3506,7 +3568,7 @@ static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
3506 err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le, 3568 err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
3507 sizeof(wake_ind_le)); 3569 sizeof(wake_ind_le));
3508 if (err) { 3570 if (err) {
3509 brcmf_err("Get wowl_wakeind failed, err = %d\n", err); 3571 bphy_err(drvr, "Get wowl_wakeind failed, err = %d\n", err);
3510 return; 3572 return;
3511 } 3573 }
3512 3574
@@ -3547,7 +3609,7 @@ static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
3547 cfg->wowl.nd_data_completed, 3609 cfg->wowl.nd_data_completed,
3548 BRCMF_ND_INFO_TIMEOUT); 3610 BRCMF_ND_INFO_TIMEOUT);
3549 if (!timeout) 3611 if (!timeout)
3550 brcmf_err("No result for wowl net detect\n"); 3612 bphy_err(drvr, "No result for wowl net detect\n");
3551 else 3613 else
3552 wakeup_data.net_detect = cfg->wowl.nd_info; 3614 wakeup_data.net_detect = cfg->wowl.nd_info;
3553 } 3615 }
@@ -3736,6 +3798,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3736 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 3798 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3737 struct brcmf_if *ifp = netdev_priv(ndev); 3799 struct brcmf_if *ifp = netdev_priv(ndev);
3738 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0]; 3800 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
3801 struct brcmf_pub *drvr = cfg->pub;
3739 s32 err; 3802 s32 err;
3740 u32 npmk, i; 3803 u32 npmk, i;
3741 3804
@@ -3755,7 +3818,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3755 cfg->pmk_list.npmk = cpu_to_le32(npmk); 3818 cfg->pmk_list.npmk = cpu_to_le32(npmk);
3756 } 3819 }
3757 } else { 3820 } else {
3758 brcmf_err("Too many PMKSA entries cached %d\n", npmk); 3821 bphy_err(drvr, "Too many PMKSA entries cached %d\n", npmk);
3759 return -EINVAL; 3822 return -EINVAL;
3760 } 3823 }
3761 3824
@@ -3778,6 +3841,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3778 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 3841 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3779 struct brcmf_if *ifp = netdev_priv(ndev); 3842 struct brcmf_if *ifp = netdev_priv(ndev);
3780 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0]; 3843 struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0];
3844 struct brcmf_pub *drvr = cfg->pub;
3781 s32 err; 3845 s32 err;
3782 u32 npmk, i; 3846 u32 npmk, i;
3783 3847
@@ -3801,7 +3865,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3801 memset(&pmk[i], 0, sizeof(*pmk)); 3865 memset(&pmk[i], 0, sizeof(*pmk));
3802 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1); 3866 cfg->pmk_list.npmk = cpu_to_le32(npmk - 1);
3803 } else { 3867 } else {
3804 brcmf_err("Cache entry not found\n"); 3868 bphy_err(drvr, "Cache entry not found\n");
3805 return -EINVAL; 3869 return -EINVAL;
3806 } 3870 }
3807 3871
@@ -3833,19 +3897,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev)
3833 3897
3834static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp) 3898static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
3835{ 3899{
3900 struct brcmf_pub *drvr = ifp->drvr;
3836 s32 err; 3901 s32 err;
3837 s32 wpa_val; 3902 s32 wpa_val;
3838 3903
3839 /* set auth */ 3904 /* set auth */
3840 err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0); 3905 err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0);
3841 if (err < 0) { 3906 if (err < 0) {
3842 brcmf_err("auth error %d\n", err); 3907 bphy_err(drvr, "auth error %d\n", err);
3843 return err; 3908 return err;
3844 } 3909 }
3845 /* set wsec */ 3910 /* set wsec */
3846 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0); 3911 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0);
3847 if (err < 0) { 3912 if (err < 0) {
3848 brcmf_err("wsec error %d\n", err); 3913 bphy_err(drvr, "wsec error %d\n", err);
3849 return err; 3914 return err;
3850 } 3915 }
3851 /* set upper-layer auth */ 3916 /* set upper-layer auth */
@@ -3855,7 +3920,7 @@ static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp)
3855 wpa_val = WPA_AUTH_DISABLED; 3920 wpa_val = WPA_AUTH_DISABLED;
3856 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val); 3921 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val);
3857 if (err < 0) { 3922 if (err < 0) {
3858 brcmf_err("wpa_auth error %d\n", err); 3923 bphy_err(drvr, "wpa_auth error %d\n", err);
3859 return err; 3924 return err;
3860 } 3925 }
3861 3926
@@ -3875,6 +3940,7 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
3875 const struct brcmf_vs_tlv *wpa_ie, 3940 const struct brcmf_vs_tlv *wpa_ie,
3876 bool is_rsn_ie) 3941 bool is_rsn_ie)
3877{ 3942{
3943 struct brcmf_pub *drvr = ifp->drvr;
3878 u32 auth = 0; /* d11 open authentication */ 3944 u32 auth = 0; /* d11 open authentication */
3879 u16 count; 3945 u16 count;
3880 s32 err = 0; 3946 s32 err = 0;
@@ -3905,13 +3971,13 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
3905 /* check for multicast cipher suite */ 3971 /* check for multicast cipher suite */
3906 if (offset + WPA_IE_MIN_OUI_LEN > len) { 3972 if (offset + WPA_IE_MIN_OUI_LEN > len) {
3907 err = -EINVAL; 3973 err = -EINVAL;
3908 brcmf_err("no multicast cipher suite\n"); 3974 bphy_err(drvr, "no multicast cipher suite\n");
3909 goto exit; 3975 goto exit;
3910 } 3976 }
3911 3977
3912 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { 3978 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
3913 err = -EINVAL; 3979 err = -EINVAL;
3914 brcmf_err("ivalid OUI\n"); 3980 bphy_err(drvr, "ivalid OUI\n");
3915 goto exit; 3981 goto exit;
3916 } 3982 }
3917 offset += TLV_OUI_LEN; 3983 offset += TLV_OUI_LEN;
@@ -3933,7 +3999,7 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
3933 break; 3999 break;
3934 default: 4000 default:
3935 err = -EINVAL; 4001 err = -EINVAL;
3936 brcmf_err("Invalid multi cast cipher info\n"); 4002 bphy_err(drvr, "Invalid multi cast cipher info\n");
3937 goto exit; 4003 goto exit;
3938 } 4004 }
3939 4005
@@ -3944,13 +4010,13 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
3944 /* Check for unicast suite(s) */ 4010 /* Check for unicast suite(s) */
3945 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { 4011 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
3946 err = -EINVAL; 4012 err = -EINVAL;
3947 brcmf_err("no unicast cipher suite\n"); 4013 bphy_err(drvr, "no unicast cipher suite\n");
3948 goto exit; 4014 goto exit;
3949 } 4015 }
3950 for (i = 0; i < count; i++) { 4016 for (i = 0; i < count; i++) {
3951 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { 4017 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
3952 err = -EINVAL; 4018 err = -EINVAL;
3953 brcmf_err("ivalid OUI\n"); 4019 bphy_err(drvr, "ivalid OUI\n");
3954 goto exit; 4020 goto exit;
3955 } 4021 }
3956 offset += TLV_OUI_LEN; 4022 offset += TLV_OUI_LEN;
@@ -3968,7 +4034,7 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
3968 pval |= AES_ENABLED; 4034 pval |= AES_ENABLED;
3969 break; 4035 break;
3970 default: 4036 default:
3971 brcmf_err("Invalid unicast security info\n"); 4037 bphy_err(drvr, "Invalid unicast security info\n");
3972 } 4038 }
3973 offset++; 4039 offset++;
3974 } 4040 }
@@ -3978,13 +4044,13 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
3978 /* Check for auth key management suite(s) */ 4044 /* Check for auth key management suite(s) */
3979 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { 4045 if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) {
3980 err = -EINVAL; 4046 err = -EINVAL;
3981 brcmf_err("no auth key mgmt suite\n"); 4047 bphy_err(drvr, "no auth key mgmt suite\n");
3982 goto exit; 4048 goto exit;
3983 } 4049 }
3984 for (i = 0; i < count; i++) { 4050 for (i = 0; i < count; i++) {
3985 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { 4051 if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) {
3986 err = -EINVAL; 4052 err = -EINVAL;
3987 brcmf_err("ivalid OUI\n"); 4053 bphy_err(drvr, "ivalid OUI\n");
3988 goto exit; 4054 goto exit;
3989 } 4055 }
3990 offset += TLV_OUI_LEN; 4056 offset += TLV_OUI_LEN;
@@ -4012,7 +4078,7 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
4012 wpa_auth |= WPA2_AUTH_1X_SHA256; 4078 wpa_auth |= WPA2_AUTH_1X_SHA256;
4013 break; 4079 break;
4014 default: 4080 default:
4015 brcmf_err("Invalid key mgmt info\n"); 4081 bphy_err(drvr, "Invalid key mgmt info\n");
4016 } 4082 }
4017 offset++; 4083 offset++;
4018 } 4084 }
@@ -4054,7 +4120,7 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
4054 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable", 4120 err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable",
4055 wme_bss_disable); 4121 wme_bss_disable);
4056 if (err < 0) { 4122 if (err < 0) {
4057 brcmf_err("wme_bss_disable error %d\n", err); 4123 bphy_err(drvr, "wme_bss_disable error %d\n", err);
4058 goto exit; 4124 goto exit;
4059 } 4125 }
4060 4126
@@ -4068,7 +4134,7 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
4068 &data[offset], 4134 &data[offset],
4069 WPA_IE_MIN_OUI_LEN); 4135 WPA_IE_MIN_OUI_LEN);
4070 if (err < 0) { 4136 if (err < 0) {
4071 brcmf_err("bip error %d\n", err); 4137 bphy_err(drvr, "bip error %d\n", err);
4072 goto exit; 4138 goto exit;
4073 } 4139 }
4074 } 4140 }
@@ -4079,13 +4145,13 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
4079 /* set auth */ 4145 /* set auth */
4080 err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth); 4146 err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth);
4081 if (err < 0) { 4147 if (err < 0) {
4082 brcmf_err("auth error %d\n", err); 4148 bphy_err(drvr, "auth error %d\n", err);
4083 goto exit; 4149 goto exit;
4084 } 4150 }
4085 /* set wsec */ 4151 /* set wsec */
4086 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); 4152 err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec);
4087 if (err < 0) { 4153 if (err < 0) {
4088 brcmf_err("wsec error %d\n", err); 4154 bphy_err(drvr, "wsec error %d\n", err);
4089 goto exit; 4155 goto exit;
4090 } 4156 }
4091 /* Configure MFP, this needs to go after wsec otherwise the wsec command 4157 /* Configure MFP, this needs to go after wsec otherwise the wsec command
@@ -4094,14 +4160,14 @@ brcmf_configure_wpaie(struct brcmf_if *ifp,
4094 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) { 4160 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) {
4095 err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp); 4161 err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp);
4096 if (err < 0) { 4162 if (err < 0) {
4097 brcmf_err("mfp error %d\n", err); 4163 bphy_err(drvr, "mfp error %d\n", err);
4098 goto exit; 4164 goto exit;
4099 } 4165 }
4100 } 4166 }
4101 /* set upper-layer auth */ 4167 /* set upper-layer auth */
4102 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth); 4168 err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth);
4103 if (err < 0) { 4169 if (err < 0) {
4104 brcmf_err("wpa_auth error %d\n", err); 4170 bphy_err(drvr, "wpa_auth error %d\n", err);
4105 goto exit; 4171 goto exit;
4106 } 4172 }
4107 4173
@@ -4187,6 +4253,7 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd)
4187s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, 4253s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
4188 const u8 *vndr_ie_buf, u32 vndr_ie_len) 4254 const u8 *vndr_ie_buf, u32 vndr_ie_len)
4189{ 4255{
4256 struct brcmf_pub *drvr;
4190 struct brcmf_if *ifp; 4257 struct brcmf_if *ifp;
4191 struct vif_saved_ie *saved_ie; 4258 struct vif_saved_ie *saved_ie;
4192 s32 err = 0; 4259 s32 err = 0;
@@ -4208,6 +4275,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
4208 if (!vif) 4275 if (!vif)
4209 return -ENODEV; 4276 return -ENODEV;
4210 ifp = vif->ifp; 4277 ifp = vif->ifp;
4278 drvr = ifp->drvr;
4211 saved_ie = &vif->saved_ie; 4279 saved_ie = &vif->saved_ie;
4212 4280
4213 brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx, 4281 brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
@@ -4239,13 +4307,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
4239 break; 4307 break;
4240 default: 4308 default:
4241 err = -EPERM; 4309 err = -EPERM;
4242 brcmf_err("not suitable type\n"); 4310 bphy_err(drvr, "not suitable type\n");
4243 goto exit; 4311 goto exit;
4244 } 4312 }
4245 4313
4246 if (vndr_ie_len > mgmt_ie_buf_len) { 4314 if (vndr_ie_len > mgmt_ie_buf_len) {
4247 err = -ENOMEM; 4315 err = -ENOMEM;
4248 brcmf_err("extra IE size too big\n"); 4316 bphy_err(drvr, "extra IE size too big\n");
4249 goto exit; 4317 goto exit;
4250 } 4318 }
4251 4319
@@ -4306,8 +4374,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
4306 /* verify remained buf size before copy data */ 4374 /* verify remained buf size before copy data */
4307 if (remained_buf_len < (vndrie_info->vndrie.len + 4375 if (remained_buf_len < (vndrie_info->vndrie.len +
4308 VNDR_IE_VSIE_OFFSET)) { 4376 VNDR_IE_VSIE_OFFSET)) {
4309 brcmf_err("no space in mgmt_ie_buf: len left %d", 4377 bphy_err(drvr, "no space in mgmt_ie_buf: len left %d",
4310 remained_buf_len); 4378 remained_buf_len);
4311 break; 4379 break;
4312 } 4380 }
4313 remained_buf_len -= (vndrie_info->ie_len + 4381 remained_buf_len -= (vndrie_info->ie_len +
@@ -4338,7 +4406,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
4338 err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf, 4406 err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
4339 total_ie_buf_len); 4407 total_ie_buf_len);
4340 if (err) 4408 if (err)
4341 brcmf_err("vndr ie set error : %d\n", err); 4409 bphy_err(drvr, "vndr ie set error : %d\n", err);
4342 } 4410 }
4343 4411
4344exit: 4412exit:
@@ -4366,13 +4434,14 @@ static s32
4366brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, 4434brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
4367 struct cfg80211_beacon_data *beacon) 4435 struct cfg80211_beacon_data *beacon)
4368{ 4436{
4437 struct brcmf_pub *drvr = vif->ifp->drvr;
4369 s32 err; 4438 s32 err;
4370 4439
4371 /* Set Beacon IEs to FW */ 4440 /* Set Beacon IEs to FW */
4372 err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG, 4441 err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG,
4373 beacon->tail, beacon->tail_len); 4442 beacon->tail, beacon->tail_len);
4374 if (err) { 4443 if (err) {
4375 brcmf_err("Set Beacon IE Failed\n"); 4444 bphy_err(drvr, "Set Beacon IE Failed\n");
4376 return err; 4445 return err;
4377 } 4446 }
4378 brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n"); 4447 brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n");
@@ -4382,7 +4451,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif,
4382 beacon->proberesp_ies, 4451 beacon->proberesp_ies,
4383 beacon->proberesp_ies_len); 4452 beacon->proberesp_ies_len);
4384 if (err) 4453 if (err)
4385 brcmf_err("Set Probe Resp IE Failed\n"); 4454 bphy_err(drvr, "Set Probe Resp IE Failed\n");
4386 else 4455 else
4387 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n"); 4456 brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n");
4388 4457
@@ -4396,6 +4465,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4396 s32 ie_offset; 4465 s32 ie_offset;
4397 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 4466 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4398 struct brcmf_if *ifp = netdev_priv(ndev); 4467 struct brcmf_if *ifp = netdev_priv(ndev);
4468 struct brcmf_pub *drvr = cfg->pub;
4399 const struct brcmf_tlv *ssid_ie; 4469 const struct brcmf_tlv *ssid_ie;
4400 const struct brcmf_tlv *country_ie; 4470 const struct brcmf_tlv *country_ie;
4401 struct brcmf_ssid_le ssid_le; 4471 struct brcmf_ssid_le ssid_le;
@@ -4491,7 +4561,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4491 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, 4561 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
4492 is_11d); 4562 is_11d);
4493 if (err < 0) { 4563 if (err < 0) {
4494 brcmf_err("Regulatory Set Error, %d\n", err); 4564 bphy_err(drvr, "Regulatory Set Error, %d\n",
4565 err);
4495 goto exit; 4566 goto exit;
4496 } 4567 }
4497 } 4568 }
@@ -4499,8 +4570,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4499 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, 4570 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD,
4500 settings->beacon_interval); 4571 settings->beacon_interval);
4501 if (err < 0) { 4572 if (err < 0) {
4502 brcmf_err("Beacon Interval Set Error, %d\n", 4573 bphy_err(drvr, "Beacon Interval Set Error, %d\n",
4503 err); 4574 err);
4504 goto exit; 4575 goto exit;
4505 } 4576 }
4506 } 4577 }
@@ -4508,7 +4579,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4508 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD, 4579 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD,
4509 settings->dtim_period); 4580 settings->dtim_period);
4510 if (err < 0) { 4581 if (err < 0) {
4511 brcmf_err("DTIM Interval Set Error, %d\n", err); 4582 bphy_err(drvr, "DTIM Interval Set Error, %d\n",
4583 err);
4512 goto exit; 4584 goto exit;
4513 } 4585 }
4514 } 4586 }
@@ -4518,7 +4590,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4518 !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) { 4590 !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
4519 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); 4591 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
4520 if (err < 0) { 4592 if (err < 0) {
4521 brcmf_err("BRCMF_C_DOWN error %d\n", err); 4593 bphy_err(drvr, "BRCMF_C_DOWN error %d\n",
4594 err);
4522 goto exit; 4595 goto exit;
4523 } 4596 }
4524 brcmf_fil_iovar_int_set(ifp, "apsta", 0); 4597 brcmf_fil_iovar_int_set(ifp, "apsta", 0);
@@ -4526,7 +4599,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4526 4599
4527 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1); 4600 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1);
4528 if (err < 0) { 4601 if (err < 0) {
4529 brcmf_err("SET INFRA error %d\n", err); 4602 bphy_err(drvr, "SET INFRA error %d\n", err);
4530 goto exit; 4603 goto exit;
4531 } 4604 }
4532 } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) { 4605 } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) {
@@ -4542,7 +4615,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4542 4615
4543 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1); 4616 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1);
4544 if (err < 0) { 4617 if (err < 0) {
4545 brcmf_err("setting AP mode failed %d\n", err); 4618 bphy_err(drvr, "setting AP mode failed %d\n",
4619 err);
4546 goto exit; 4620 goto exit;
4547 } 4621 }
4548 if (!mbss) { 4622 if (!mbss) {
@@ -4551,14 +4625,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4551 */ 4625 */
4552 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); 4626 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
4553 if (err < 0) { 4627 if (err < 0) {
4554 brcmf_err("Set Channel failed: chspec=%d, %d\n", 4628 bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
4555 chanspec, err); 4629 chanspec, err);
4556 goto exit; 4630 goto exit;
4557 } 4631 }
4558 } 4632 }
4559 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); 4633 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
4560 if (err < 0) { 4634 if (err < 0) {
4561 brcmf_err("BRCMF_C_UP error (%d)\n", err); 4635 bphy_err(drvr, "BRCMF_C_UP error (%d)\n", err);
4562 goto exit; 4636 goto exit;
4563 } 4637 }
4564 /* On DOWN the firmware removes the WEP keys, reconfigure 4638 /* On DOWN the firmware removes the WEP keys, reconfigure
@@ -4573,14 +4647,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4573 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, 4647 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
4574 &join_params, sizeof(join_params)); 4648 &join_params, sizeof(join_params));
4575 if (err < 0) { 4649 if (err < 0) {
4576 brcmf_err("SET SSID error (%d)\n", err); 4650 bphy_err(drvr, "SET SSID error (%d)\n", err);
4577 goto exit; 4651 goto exit;
4578 } 4652 }
4579 4653
4580 if (settings->hidden_ssid) { 4654 if (settings->hidden_ssid) {
4581 err = brcmf_fil_iovar_int_set(ifp, "closednet", 1); 4655 err = brcmf_fil_iovar_int_set(ifp, "closednet", 1);
4582 if (err) { 4656 if (err) {
4583 brcmf_err("closednet error (%d)\n", err); 4657 bphy_err(drvr, "closednet error (%d)\n", err);
4584 goto exit; 4658 goto exit;
4585 } 4659 }
4586 } 4660 }
@@ -4589,14 +4663,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4589 } else if (dev_role == NL80211_IFTYPE_P2P_GO) { 4663 } else if (dev_role == NL80211_IFTYPE_P2P_GO) {
4590 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); 4664 err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec);
4591 if (err < 0) { 4665 if (err < 0) {
4592 brcmf_err("Set Channel failed: chspec=%d, %d\n", 4666 bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n",
4593 chanspec, err); 4667 chanspec, err);
4594 goto exit; 4668 goto exit;
4595 } 4669 }
4596 err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le, 4670 err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le,
4597 sizeof(ssid_le)); 4671 sizeof(ssid_le));
4598 if (err < 0) { 4672 if (err < 0) {
4599 brcmf_err("setting ssid failed %d\n", err); 4673 bphy_err(drvr, "setting ssid failed %d\n", err);
4600 goto exit; 4674 goto exit;
4601 } 4675 }
4602 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); 4676 bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
@@ -4604,7 +4678,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4604 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, 4678 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
4605 sizeof(bss_enable)); 4679 sizeof(bss_enable));
4606 if (err < 0) { 4680 if (err < 0) {
4607 brcmf_err("bss_enable config failed %d\n", err); 4681 bphy_err(drvr, "bss_enable config failed %d\n", err);
4608 goto exit; 4682 goto exit;
4609 } 4683 }
4610 4684
@@ -4627,7 +4701,9 @@ exit:
4627 4701
4628static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) 4702static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
4629{ 4703{
4704 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4630 struct brcmf_if *ifp = netdev_priv(ndev); 4705 struct brcmf_if *ifp = netdev_priv(ndev);
4706 struct brcmf_pub *drvr = cfg->pub;
4631 s32 err; 4707 s32 err;
4632 struct brcmf_fil_bss_enable_le bss_enable; 4708 struct brcmf_fil_bss_enable_le bss_enable;
4633 struct brcmf_join_params join_params; 4709 struct brcmf_join_params join_params;
@@ -4652,13 +4728,13 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
4652 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, 4728 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID,
4653 &join_params, sizeof(join_params)); 4729 &join_params, sizeof(join_params));
4654 if (err < 0) 4730 if (err < 0)
4655 brcmf_err("SET SSID error (%d)\n", err); 4731 bphy_err(drvr, "SET SSID error (%d)\n", err);
4656 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); 4732 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
4657 if (err < 0) 4733 if (err < 0)
4658 brcmf_err("BRCMF_C_DOWN error %d\n", err); 4734 bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err);
4659 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); 4735 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0);
4660 if (err < 0) 4736 if (err < 0)
4661 brcmf_err("setting AP mode failed %d\n", err); 4737 bphy_err(drvr, "setting AP mode failed %d\n", err);
4662 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) 4738 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS))
4663 brcmf_fil_iovar_int_set(ifp, "mbss", 0); 4739 brcmf_fil_iovar_int_set(ifp, "mbss", 0);
4664 brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, 4740 brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY,
@@ -4666,7 +4742,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
4666 /* Bring device back up so it can be used again */ 4742 /* Bring device back up so it can be used again */
4667 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); 4743 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1);
4668 if (err < 0) 4744 if (err < 0)
4669 brcmf_err("BRCMF_C_UP error %d\n", err); 4745 bphy_err(drvr, "BRCMF_C_UP error %d\n", err);
4670 4746
4671 brcmf_vif_clear_mgmt_ies(ifp->vif); 4747 brcmf_vif_clear_mgmt_ies(ifp->vif);
4672 } else { 4748 } else {
@@ -4675,7 +4751,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
4675 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, 4751 err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
4676 sizeof(bss_enable)); 4752 sizeof(bss_enable));
4677 if (err < 0) 4753 if (err < 0)
4678 brcmf_err("bss_enable config failed %d\n", err); 4754 bphy_err(drvr, "bss_enable config failed %d\n", err);
4679 } 4755 }
4680 brcmf_set_mpc(ifp, 1); 4756 brcmf_set_mpc(ifp, 1);
4681 brcmf_configure_arp_nd_offload(ifp, true); 4757 brcmf_configure_arp_nd_offload(ifp, true);
@@ -4704,6 +4780,7 @@ brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev,
4704 struct station_del_parameters *params) 4780 struct station_del_parameters *params)
4705{ 4781{
4706 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 4782 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4783 struct brcmf_pub *drvr = cfg->pub;
4707 struct brcmf_scb_val_le scbval; 4784 struct brcmf_scb_val_le scbval;
4708 struct brcmf_if *ifp = netdev_priv(ndev); 4785 struct brcmf_if *ifp = netdev_priv(ndev);
4709 s32 err; 4786 s32 err;
@@ -4723,7 +4800,8 @@ brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev,
4723 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON, 4800 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
4724 &scbval, sizeof(scbval)); 4801 &scbval, sizeof(scbval));
4725 if (err) 4802 if (err)
4726 brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err); 4803 bphy_err(drvr, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n",
4804 err);
4727 4805
4728 brcmf_dbg(TRACE, "Exit\n"); 4806 brcmf_dbg(TRACE, "Exit\n");
4729 return err; 4807 return err;
@@ -4733,6 +4811,8 @@ static int
4733brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, 4811brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev,
4734 const u8 *mac, struct station_parameters *params) 4812 const u8 *mac, struct station_parameters *params)
4735{ 4813{
4814 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4815 struct brcmf_pub *drvr = cfg->pub;
4736 struct brcmf_if *ifp = netdev_priv(ndev); 4816 struct brcmf_if *ifp = netdev_priv(ndev);
4737 s32 err; 4817 s32 err;
4738 4818
@@ -4753,7 +4833,7 @@ brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev,
4753 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE, 4833 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE,
4754 (void *)mac, ETH_ALEN); 4834 (void *)mac, ETH_ALEN);
4755 if (err < 0) 4835 if (err < 0)
4756 brcmf_err("Setting SCB (de-)authorize failed, %d\n", err); 4836 bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err);
4757 4837
4758 return err; 4838 return err;
4759} 4839}
@@ -4783,6 +4863,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
4783{ 4863{
4784 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 4864 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4785 struct ieee80211_channel *chan = params->chan; 4865 struct ieee80211_channel *chan = params->chan;
4866 struct brcmf_pub *drvr = cfg->pub;
4786 const u8 *buf = params->buf; 4867 const u8 *buf = params->buf;
4787 size_t len = params->len; 4868 size_t len = params->len;
4788 const struct ieee80211_mgmt *mgmt; 4869 const struct ieee80211_mgmt *mgmt;
@@ -4803,7 +4884,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
4803 mgmt = (const struct ieee80211_mgmt *)buf; 4884 mgmt = (const struct ieee80211_mgmt *)buf;
4804 4885
4805 if (!ieee80211_is_mgmt(mgmt->frame_control)) { 4886 if (!ieee80211_is_mgmt(mgmt->frame_control)) {
4806 brcmf_err("Driver only allows MGMT packet type\n"); 4887 bphy_err(drvr, "Driver only allows MGMT packet type\n");
4807 return -EPERM; 4888 return -EPERM;
4808 } 4889 }
4809 4890
@@ -4834,13 +4915,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
4834 GFP_KERNEL); 4915 GFP_KERNEL);
4835 } else if (ieee80211_is_action(mgmt->frame_control)) { 4916 } else if (ieee80211_is_action(mgmt->frame_control)) {
4836 if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) { 4917 if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) {
4837 brcmf_err("invalid action frame length\n"); 4918 bphy_err(drvr, "invalid action frame length\n");
4838 err = -EINVAL; 4919 err = -EINVAL;
4839 goto exit; 4920 goto exit;
4840 } 4921 }
4841 af_params = kzalloc(sizeof(*af_params), GFP_KERNEL); 4922 af_params = kzalloc(sizeof(*af_params), GFP_KERNEL);
4842 if (af_params == NULL) { 4923 if (af_params == NULL) {
4843 brcmf_err("unable to allocate frame\n"); 4924 bphy_err(drvr, "unable to allocate frame\n");
4844 err = -ENOMEM; 4925 err = -ENOMEM;
4845 goto exit; 4926 goto exit;
4846 } 4927 }
@@ -4891,6 +4972,7 @@ brcmf_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
4891 u64 cookie) 4972 u64 cookie)
4892{ 4973{
4893 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 4974 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4975 struct brcmf_pub *drvr = cfg->pub;
4894 struct brcmf_cfg80211_vif *vif; 4976 struct brcmf_cfg80211_vif *vif;
4895 int err = 0; 4977 int err = 0;
4896 4978
@@ -4898,7 +4980,7 @@ brcmf_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
4898 4980
4899 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; 4981 vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
4900 if (vif == NULL) { 4982 if (vif == NULL) {
4901 brcmf_err("No p2p device available for probe response\n"); 4983 bphy_err(drvr, "No p2p device available for probe response\n");
4902 err = -ENODEV; 4984 err = -ENODEV;
4903 goto exit; 4985 goto exit;
4904 } 4986 }
@@ -4913,6 +4995,7 @@ static int brcmf_cfg80211_get_channel(struct wiphy *wiphy,
4913{ 4995{
4914 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 4996 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4915 struct net_device *ndev = wdev->netdev; 4997 struct net_device *ndev = wdev->netdev;
4998 struct brcmf_pub *drvr = cfg->pub;
4916 struct brcmf_if *ifp; 4999 struct brcmf_if *ifp;
4917 struct brcmu_chan ch; 5000 struct brcmu_chan ch;
4918 enum nl80211_band band = 0; 5001 enum nl80211_band band = 0;
@@ -4926,7 +5009,7 @@ static int brcmf_cfg80211_get_channel(struct wiphy *wiphy,
4926 5009
4927 err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec); 5010 err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec);
4928 if (err) { 5011 if (err) {
4929 brcmf_err("chanspec failed (%d)\n", err); 5012 bphy_err(drvr, "chanspec failed (%d)\n", err);
4930 return err; 5013 return err;
4931 } 5014 }
4932 5015
@@ -5048,6 +5131,8 @@ static int brcmf_cfg80211_tdls_oper(struct wiphy *wiphy,
5048 struct net_device *ndev, const u8 *peer, 5131 struct net_device *ndev, const u8 *peer,
5049 enum nl80211_tdls_operation oper) 5132 enum nl80211_tdls_operation oper)
5050{ 5133{
5134 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5135 struct brcmf_pub *drvr = cfg->pub;
5051 struct brcmf_if *ifp; 5136 struct brcmf_if *ifp;
5052 struct brcmf_tdls_iovar_le info; 5137 struct brcmf_tdls_iovar_le info;
5053 int ret = 0; 5138 int ret = 0;
@@ -5065,7 +5150,7 @@ static int brcmf_cfg80211_tdls_oper(struct wiphy *wiphy,
5065 ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint", 5150 ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint",
5066 &info, sizeof(info)); 5151 &info, sizeof(info));
5067 if (ret < 0) 5152 if (ret < 0)
5068 brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret); 5153 bphy_err(drvr, "tdls_endpoint iovar failed: ret=%d\n", ret);
5069 5154
5070 return ret; 5155 return ret;
5071} 5156}
@@ -5076,6 +5161,8 @@ brcmf_cfg80211_update_conn_params(struct wiphy *wiphy,
5076 struct cfg80211_connect_params *sme, 5161 struct cfg80211_connect_params *sme,
5077 u32 changed) 5162 u32 changed)
5078{ 5163{
5164 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5165 struct brcmf_pub *drvr = cfg->pub;
5079 struct brcmf_if *ifp; 5166 struct brcmf_if *ifp;
5080 int err; 5167 int err;
5081 5168
@@ -5086,7 +5173,7 @@ brcmf_cfg80211_update_conn_params(struct wiphy *wiphy,
5086 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, 5173 err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG,
5087 sme->ie, sme->ie_len); 5174 sme->ie, sme->ie_len);
5088 if (err) 5175 if (err)
5089 brcmf_err("Set Assoc REQ IE Failed\n"); 5176 bphy_err(drvr, "Set Assoc REQ IE Failed\n");
5090 else 5177 else
5091 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); 5178 brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n");
5092 5179
@@ -5098,6 +5185,8 @@ static int
5098brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev, 5185brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
5099 struct cfg80211_gtk_rekey_data *gtk) 5186 struct cfg80211_gtk_rekey_data *gtk)
5100{ 5187{
5188 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
5189 struct brcmf_pub *drvr = cfg->pub;
5101 struct brcmf_if *ifp = netdev_priv(ndev); 5190 struct brcmf_if *ifp = netdev_priv(ndev);
5102 struct brcmf_gtk_keyinfo_le gtk_le; 5191 struct brcmf_gtk_keyinfo_le gtk_le;
5103 int ret; 5192 int ret;
@@ -5112,7 +5201,7 @@ brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
5112 ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le, 5201 ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", &gtk_le,
5113 sizeof(gtk_le)); 5202 sizeof(gtk_le));
5114 if (ret < 0) 5203 if (ret < 0)
5115 brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret); 5204 bphy_err(drvr, "gtk_key_info iovar failed: ret=%d\n", ret);
5116 5205
5117 return ret; 5206 return ret;
5118} 5207}
@@ -5344,6 +5433,7 @@ static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_info *cfg)
5344static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, 5433static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
5345 struct brcmf_if *ifp) 5434 struct brcmf_if *ifp)
5346{ 5435{
5436 struct brcmf_pub *drvr = cfg->pub;
5347 struct brcmf_cfg80211_assoc_ielen_le *assoc_info; 5437 struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
5348 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); 5438 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
5349 u32 req_len; 5439 u32 req_len;
@@ -5355,7 +5445,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
5355 err = brcmf_fil_iovar_data_get(ifp, "assoc_info", 5445 err = brcmf_fil_iovar_data_get(ifp, "assoc_info",
5356 cfg->extra_buf, WL_ASSOC_INFO_MAX); 5446 cfg->extra_buf, WL_ASSOC_INFO_MAX);
5357 if (err) { 5447 if (err) {
5358 brcmf_err("could not get assoc info (%d)\n", err); 5448 bphy_err(drvr, "could not get assoc info (%d)\n", err);
5359 return err; 5449 return err;
5360 } 5450 }
5361 assoc_info = 5451 assoc_info =
@@ -5367,7 +5457,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
5367 cfg->extra_buf, 5457 cfg->extra_buf,
5368 WL_ASSOC_INFO_MAX); 5458 WL_ASSOC_INFO_MAX);
5369 if (err) { 5459 if (err) {
5370 brcmf_err("could not get assoc req (%d)\n", err); 5460 bphy_err(drvr, "could not get assoc req (%d)\n", err);
5371 return err; 5461 return err;
5372 } 5462 }
5373 conn_info->req_ie_len = req_len; 5463 conn_info->req_ie_len = req_len;
@@ -5383,7 +5473,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
5383 cfg->extra_buf, 5473 cfg->extra_buf,
5384 WL_ASSOC_INFO_MAX); 5474 WL_ASSOC_INFO_MAX);
5385 if (err) { 5475 if (err) {
5386 brcmf_err("could not get assoc resp (%d)\n", err); 5476 bphy_err(drvr, "could not get assoc resp (%d)\n", err);
5387 return err; 5477 return err;
5388 } 5478 }
5389 conn_info->resp_ie_len = resp_len; 5479 conn_info->resp_ie_len = resp_len;
@@ -5510,6 +5600,7 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg,
5510 struct net_device *ndev, 5600 struct net_device *ndev,
5511 const struct brcmf_event_msg *e, void *data) 5601 const struct brcmf_event_msg *e, void *data)
5512{ 5602{
5603 struct brcmf_pub *drvr = cfg->pub;
5513 static int generation; 5604 static int generation;
5514 u32 event = e->event_code; 5605 u32 event = e->event_code;
5515 u32 reason = e->reason; 5606 u32 reason = e->reason;
@@ -5527,7 +5618,7 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg,
5527 if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) && 5618 if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) &&
5528 (reason == BRCMF_E_STATUS_SUCCESS)) { 5619 (reason == BRCMF_E_STATUS_SUCCESS)) {
5529 if (!data) { 5620 if (!data) {
5530 brcmf_err("No IEs present in ASSOC/REASSOC_IND"); 5621 bphy_err(drvr, "No IEs present in ASSOC/REASSOC_IND\n");
5531 return -EINVAL; 5622 return -EINVAL;
5532 } 5623 }
5533 5624
@@ -5819,6 +5910,7 @@ static void init_vif_event(struct brcmf_cfg80211_vif_event *event)
5819 5910
5820static s32 brcmf_dongle_roam(struct brcmf_if *ifp) 5911static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
5821{ 5912{
5913 struct brcmf_pub *drvr = ifp->drvr;
5822 s32 err; 5914 s32 err;
5823 u32 bcn_timeout; 5915 u32 bcn_timeout;
5824 __le32 roamtrigger[2]; 5916 __le32 roamtrigger[2];
@@ -5831,7 +5923,7 @@ static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
5831 bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON; 5923 bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
5832 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout); 5924 err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
5833 if (err) { 5925 if (err) {
5834 brcmf_err("bcn_timeout error (%d)\n", err); 5926 bphy_err(drvr, "bcn_timeout error (%d)\n", err);
5835 goto roam_setup_done; 5927 goto roam_setup_done;
5836 } 5928 }
5837 5929
@@ -5843,7 +5935,7 @@ static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
5843 err = brcmf_fil_iovar_int_set(ifp, "roam_off", 5935 err = brcmf_fil_iovar_int_set(ifp, "roam_off",
5844 ifp->drvr->settings->roamoff); 5936 ifp->drvr->settings->roamoff);
5845 if (err) { 5937 if (err) {
5846 brcmf_err("roam_off error (%d)\n", err); 5938 bphy_err(drvr, "roam_off error (%d)\n", err);
5847 goto roam_setup_done; 5939 goto roam_setup_done;
5848 } 5940 }
5849 5941
@@ -5852,7 +5944,7 @@ static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
5852 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, 5944 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER,
5853 (void *)roamtrigger, sizeof(roamtrigger)); 5945 (void *)roamtrigger, sizeof(roamtrigger));
5854 if (err) { 5946 if (err) {
5855 brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err); 5947 bphy_err(drvr, "WLC_SET_ROAM_TRIGGER error (%d)\n", err);
5856 goto roam_setup_done; 5948 goto roam_setup_done;
5857 } 5949 }
5858 5950
@@ -5861,7 +5953,7 @@ static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
5861 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA, 5953 err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA,
5862 (void *)roam_delta, sizeof(roam_delta)); 5954 (void *)roam_delta, sizeof(roam_delta));
5863 if (err) { 5955 if (err) {
5864 brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err); 5956 bphy_err(drvr, "WLC_SET_ROAM_DELTA error (%d)\n", err);
5865 goto roam_setup_done; 5957 goto roam_setup_done;
5866 } 5958 }
5867 5959
@@ -5872,25 +5964,26 @@ roam_setup_done:
5872static s32 5964static s32
5873brcmf_dongle_scantime(struct brcmf_if *ifp) 5965brcmf_dongle_scantime(struct brcmf_if *ifp)
5874{ 5966{
5967 struct brcmf_pub *drvr = ifp->drvr;
5875 s32 err = 0; 5968 s32 err = 0;
5876 5969
5877 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, 5970 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
5878 BRCMF_SCAN_CHANNEL_TIME); 5971 BRCMF_SCAN_CHANNEL_TIME);
5879 if (err) { 5972 if (err) {
5880 brcmf_err("Scan assoc time error (%d)\n", err); 5973 bphy_err(drvr, "Scan assoc time error (%d)\n", err);
5881 goto dongle_scantime_out; 5974 goto dongle_scantime_out;
5882 } 5975 }
5883 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, 5976 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
5884 BRCMF_SCAN_UNASSOC_TIME); 5977 BRCMF_SCAN_UNASSOC_TIME);
5885 if (err) { 5978 if (err) {
5886 brcmf_err("Scan unassoc time error (%d)\n", err); 5979 bphy_err(drvr, "Scan unassoc time error (%d)\n", err);
5887 goto dongle_scantime_out; 5980 goto dongle_scantime_out;
5888 } 5981 }
5889 5982
5890 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME, 5983 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME,
5891 BRCMF_SCAN_PASSIVE_TIME); 5984 BRCMF_SCAN_PASSIVE_TIME);
5892 if (err) { 5985 if (err) {
5893 brcmf_err("Scan passive time error (%d)\n", err); 5986 bphy_err(drvr, "Scan passive time error (%d)\n", err);
5894 goto dongle_scantime_out; 5987 goto dongle_scantime_out;
5895 } 5988 }
5896 5989
@@ -5922,10 +6015,11 @@ static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel,
5922static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg, 6015static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
5923 u32 bw_cap[]) 6016 u32 bw_cap[])
5924{ 6017{
5925 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); 6018 struct wiphy *wiphy = cfg_to_wiphy(cfg);
6019 struct brcmf_pub *drvr = cfg->pub;
6020 struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
5926 struct ieee80211_supported_band *band; 6021 struct ieee80211_supported_band *band;
5927 struct ieee80211_channel *channel; 6022 struct ieee80211_channel *channel;
5928 struct wiphy *wiphy;
5929 struct brcmf_chanspec_list *list; 6023 struct brcmf_chanspec_list *list;
5930 struct brcmu_chan ch; 6024 struct brcmu_chan ch;
5931 int err; 6025 int err;
@@ -5944,11 +6038,10 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
5944 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, 6038 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
5945 BRCMF_DCMD_MEDLEN); 6039 BRCMF_DCMD_MEDLEN);
5946 if (err) { 6040 if (err) {
5947 brcmf_err("get chanspecs error (%d)\n", err); 6041 bphy_err(drvr, "get chanspecs error (%d)\n", err);
5948 goto fail_pbuf; 6042 goto fail_pbuf;
5949 } 6043 }
5950 6044
5951 wiphy = cfg_to_wiphy(cfg);
5952 band = wiphy->bands[NL80211_BAND_2GHZ]; 6045 band = wiphy->bands[NL80211_BAND_2GHZ];
5953 if (band) 6046 if (band)
5954 for (i = 0; i < band->n_channels; i++) 6047 for (i = 0; i < band->n_channels; i++)
@@ -5968,7 +6061,8 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
5968 } else if (ch.band == BRCMU_CHAN_BAND_5G) { 6061 } else if (ch.band == BRCMU_CHAN_BAND_5G) {
5969 band = wiphy->bands[NL80211_BAND_5GHZ]; 6062 band = wiphy->bands[NL80211_BAND_5GHZ];
5970 } else { 6063 } else {
5971 brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec); 6064 bphy_err(drvr, "Invalid channel Spec. 0x%x.\n",
6065 ch.chspec);
5972 continue; 6066 continue;
5973 } 6067 }
5974 if (!band) 6068 if (!band)
@@ -5991,8 +6085,8 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
5991 /* It seems firmware supports some channel we never 6085 /* It seems firmware supports some channel we never
5992 * considered. Something new in IEEE standard? 6086 * considered. Something new in IEEE standard?
5993 */ 6087 */
5994 brcmf_err("Ignoring unexpected firmware channel %d\n", 6088 bphy_err(drvr, "Ignoring unexpected firmware channel %d\n",
5995 ch.control_ch_num); 6089 ch.control_ch_num);
5996 continue; 6090 continue;
5997 } 6091 }
5998 6092
@@ -6002,11 +6096,21 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
6002 /* assuming the chanspecs order is HT20, 6096 /* assuming the chanspecs order is HT20,
6003 * HT40 upper, HT40 lower, and VHT80. 6097 * HT40 upper, HT40 lower, and VHT80.
6004 */ 6098 */
6005 if (ch.bw == BRCMU_CHAN_BW_80) { 6099 switch (ch.bw) {
6100 case BRCMU_CHAN_BW_160:
6101 channel->flags &= ~IEEE80211_CHAN_NO_160MHZ;
6102 break;
6103 case BRCMU_CHAN_BW_80:
6006 channel->flags &= ~IEEE80211_CHAN_NO_80MHZ; 6104 channel->flags &= ~IEEE80211_CHAN_NO_80MHZ;
6007 } else if (ch.bw == BRCMU_CHAN_BW_40) { 6105 break;
6106 case BRCMU_CHAN_BW_40:
6008 brcmf_update_bw40_channel_flag(channel, &ch); 6107 brcmf_update_bw40_channel_flag(channel, &ch);
6009 } else { 6108 break;
6109 default:
6110 wiphy_warn(wiphy, "Firmware reported unsupported bandwidth %d\n",
6111 ch.bw);
6112 /* fall through */
6113 case BRCMU_CHAN_BW_20:
6010 /* enable the channel and disable other bandwidths 6114 /* enable the channel and disable other bandwidths
6011 * for now as mentioned order assure they are enabled 6115 * for now as mentioned order assure they are enabled
6012 * for subsequent chanspecs. 6116 * for subsequent chanspecs.
@@ -6038,7 +6142,8 @@ fail_pbuf:
6038 6142
6039static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) 6143static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
6040{ 6144{
6041 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); 6145 struct brcmf_pub *drvr = cfg->pub;
6146 struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
6042 struct ieee80211_supported_band *band; 6147 struct ieee80211_supported_band *band;
6043 struct brcmf_fil_bwcap_le band_bwcap; 6148 struct brcmf_fil_bwcap_le band_bwcap;
6044 struct brcmf_chanspec_list *list; 6149 struct brcmf_chanspec_list *list;
@@ -6084,7 +6189,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
6084 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, 6189 err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf,
6085 BRCMF_DCMD_MEDLEN); 6190 BRCMF_DCMD_MEDLEN);
6086 if (err) { 6191 if (err) {
6087 brcmf_err("get chanspecs error (%d)\n", err); 6192 bphy_err(drvr, "get chanspecs error (%d)\n", err);
6088 kfree(pbuf); 6193 kfree(pbuf);
6089 return err; 6194 return err;
6090 } 6195 }
@@ -6115,6 +6220,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
6115 6220
6116static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[]) 6221static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
6117{ 6222{
6223 struct brcmf_pub *drvr = ifp->drvr;
6118 u32 band, mimo_bwcap; 6224 u32 band, mimo_bwcap;
6119 int err; 6225 int err;
6120 6226
@@ -6150,7 +6256,7 @@ static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[])
6150 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT; 6256 bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT;
6151 break; 6257 break;
6152 default: 6258 default:
6153 brcmf_err("invalid mimo_bw_cap value\n"); 6259 bphy_err(drvr, "invalid mimo_bw_cap value\n");
6154 } 6260 }
6155} 6261}
6156 6262
@@ -6225,8 +6331,9 @@ static void brcmf_update_vht_cap(struct ieee80211_supported_band *band,
6225 6331
6226static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg) 6332static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
6227{ 6333{
6228 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); 6334 struct brcmf_pub *drvr = cfg->pub;
6229 struct wiphy *wiphy; 6335 struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
6336 struct wiphy *wiphy = cfg_to_wiphy(cfg);
6230 u32 nmode = 0; 6337 u32 nmode = 0;
6231 u32 vhtmode = 0; 6338 u32 vhtmode = 0;
6232 u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT }; 6339 u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT };
@@ -6242,7 +6349,7 @@ static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
6242 (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); 6349 (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
6243 err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); 6350 err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
6244 if (err) { 6351 if (err) {
6245 brcmf_err("nmode error (%d)\n", err); 6352 bphy_err(drvr, "nmode error (%d)\n", err);
6246 } else { 6353 } else {
6247 brcmf_get_bwcap(ifp, bw_cap); 6354 brcmf_get_bwcap(ifp, bw_cap);
6248 } 6355 }
@@ -6252,7 +6359,7 @@ static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
6252 6359
6253 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); 6360 err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain);
6254 if (err) { 6361 if (err) {
6255 brcmf_err("rxchain error (%d)\n", err); 6362 bphy_err(drvr, "rxchain error (%d)\n", err);
6256 nchain = 1; 6363 nchain = 1;
6257 } else { 6364 } else {
6258 for (nchain = 0; rxchain; nchain++) 6365 for (nchain = 0; rxchain; nchain++)
@@ -6262,7 +6369,7 @@ static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
6262 6369
6263 err = brcmf_construct_chaninfo(cfg, bw_cap); 6370 err = brcmf_construct_chaninfo(cfg, bw_cap);
6264 if (err) { 6371 if (err) {
6265 brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err); 6372 bphy_err(drvr, "brcmf_construct_chaninfo failed (%d)\n", err);
6266 return err; 6373 return err;
6267 } 6374 }
6268 6375
@@ -6274,7 +6381,6 @@ static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg)
6274 &txbf_bfr_cap); 6381 &txbf_bfr_cap);
6275 } 6382 }
6276 6383
6277 wiphy = cfg_to_wiphy(cfg);
6278 for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) { 6384 for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
6279 band = wiphy->bands[i]; 6385 band = wiphy->bands[i];
6280 if (band == NULL) 6386 if (band == NULL)
@@ -6470,12 +6576,13 @@ static void brcmf_wiphy_wowl_params(struct wiphy *wiphy, struct brcmf_if *ifp)
6470{ 6576{
6471#ifdef CONFIG_PM 6577#ifdef CONFIG_PM
6472 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 6578 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
6579 struct brcmf_pub *drvr = cfg->pub;
6473 struct wiphy_wowlan_support *wowl; 6580 struct wiphy_wowlan_support *wowl;
6474 6581
6475 wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support), 6582 wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support),
6476 GFP_KERNEL); 6583 GFP_KERNEL);
6477 if (!wowl) { 6584 if (!wowl) {
6478 brcmf_err("only support basic wowlan features\n"); 6585 bphy_err(drvr, "only support basic wowlan features\n");
6479 wiphy->wowlan = &brcmf_wowlan_support; 6586 wiphy->wowlan = &brcmf_wowlan_support;
6480 return; 6587 return;
6481 } 6588 }
@@ -6572,7 +6679,7 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
6572 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist, 6679 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
6573 sizeof(bandlist)); 6680 sizeof(bandlist));
6574 if (err) { 6681 if (err) {
6575 brcmf_err("could not obtain band info: err=%d\n", err); 6682 bphy_err(drvr, "could not obtain band info: err=%d\n", err);
6576 return err; 6683 return err;
6577 } 6684 }
6578 /* first entry in bandlist is number of bands */ 6685 /* first entry in bandlist is number of bands */
@@ -6621,6 +6728,7 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
6621 6728
6622static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) 6729static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
6623{ 6730{
6731 struct brcmf_pub *drvr = cfg->pub;
6624 struct net_device *ndev; 6732 struct net_device *ndev;
6625 struct wireless_dev *wdev; 6733 struct wireless_dev *wdev;
6626 struct brcmf_if *ifp; 6734 struct brcmf_if *ifp;
@@ -6658,7 +6766,7 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
6658 6766
6659 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1); 6767 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1);
6660 if (err) { 6768 if (err) {
6661 brcmf_err("failed to set frameburst mode\n"); 6769 bphy_err(drvr, "failed to set frameburst mode\n");
6662 goto default_conf_out; 6770 goto default_conf_out;
6663 } 6771 }
6664 6772
@@ -6839,6 +6947,7 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
6839{ 6947{
6840 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 6948 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
6841 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); 6949 struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
6950 struct brcmf_pub *drvr = cfg->pub;
6842 struct brcmf_fil_country_le ccreq; 6951 struct brcmf_fil_country_le ccreq;
6843 s32 err; 6952 s32 err;
6844 int i; 6953 int i;
@@ -6850,8 +6959,8 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
6850 /* ignore non-ISO3166 country codes */ 6959 /* ignore non-ISO3166 country codes */
6851 for (i = 0; i < 2; i++) 6960 for (i = 0; i < 2; i++)
6852 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { 6961 if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') {
6853 brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n", 6962 bphy_err(drvr, "not an ISO3166 code (0x%02x 0x%02x)\n",
6854 req->alpha2[0], req->alpha2[1]); 6963 req->alpha2[0], req->alpha2[1]);
6855 return; 6964 return;
6856 } 6965 }
6857 6966
@@ -6860,7 +6969,7 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
6860 6969
6861 err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq)); 6970 err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq));
6862 if (err) { 6971 if (err) {
6863 brcmf_err("Country code iovar returned err = %d\n", err); 6972 bphy_err(drvr, "Country code iovar returned err = %d\n", err);
6864 return; 6973 return;
6865 } 6974 }
6866 6975
@@ -6870,7 +6979,7 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
6870 6979
6871 err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq)); 6980 err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
6872 if (err) { 6981 if (err) {
6873 brcmf_err("Firmware rejected country setting\n"); 6982 bphy_err(drvr, "Firmware rejected country setting\n");
6874 return; 6983 return;
6875 } 6984 }
6876 brcmf_setup_wiphybands(cfg); 6985 brcmf_setup_wiphybands(cfg);
@@ -6916,13 +7025,13 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6916 u16 *cap = NULL; 7025 u16 *cap = NULL;
6917 7026
6918 if (!ndev) { 7027 if (!ndev) {
6919 brcmf_err("ndev is invalid\n"); 7028 bphy_err(drvr, "ndev is invalid\n");
6920 return NULL; 7029 return NULL;
6921 } 7030 }
6922 7031
6923 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); 7032 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
6924 if (!cfg) { 7033 if (!cfg) {
6925 brcmf_err("Could not allocate wiphy device\n"); 7034 bphy_err(drvr, "Could not allocate wiphy device\n");
6926 return NULL; 7035 return NULL;
6927 } 7036 }
6928 7037
@@ -6943,7 +7052,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6943 7052
6944 err = wl_init_priv(cfg); 7053 err = wl_init_priv(cfg);
6945 if (err) { 7054 if (err) {
6946 brcmf_err("Failed to init iwm_priv (%d)\n", err); 7055 bphy_err(drvr, "Failed to init iwm_priv (%d)\n", err);
6947 brcmf_free_vif(vif); 7056 brcmf_free_vif(vif);
6948 goto wiphy_out; 7057 goto wiphy_out;
6949 } 7058 }
@@ -6952,7 +7061,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6952 /* determine d11 io type before wiphy setup */ 7061 /* determine d11 io type before wiphy setup */
6953 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type); 7062 err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type);
6954 if (err) { 7063 if (err) {
6955 brcmf_err("Failed to get D11 version (%d)\n", err); 7064 bphy_err(drvr, "Failed to get D11 version (%d)\n", err);
6956 goto priv_out; 7065 goto priv_out;
6957 } 7066 }
6958 cfg->d11inf.io_type = (u8)io_type; 7067 cfg->d11inf.io_type = (u8)io_type;
@@ -6986,13 +7095,13 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6986#endif 7095#endif
6987 err = wiphy_register(wiphy); 7096 err = wiphy_register(wiphy);
6988 if (err < 0) { 7097 if (err < 0) {
6989 brcmf_err("Could not register wiphy device (%d)\n", err); 7098 bphy_err(drvr, "Could not register wiphy device (%d)\n", err);
6990 goto priv_out; 7099 goto priv_out;
6991 } 7100 }
6992 7101
6993 err = brcmf_setup_wiphybands(cfg); 7102 err = brcmf_setup_wiphybands(cfg);
6994 if (err) { 7103 if (err) {
6995 brcmf_err("Setting wiphy bands failed (%d)\n", err); 7104 bphy_err(drvr, "Setting wiphy bands failed (%d)\n", err);
6996 goto wiphy_unreg_out; 7105 goto wiphy_unreg_out;
6997 } 7106 }
6998 7107
@@ -7010,24 +7119,24 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
7010 7119
7011 err = brcmf_fweh_activate_events(ifp); 7120 err = brcmf_fweh_activate_events(ifp);
7012 if (err) { 7121 if (err) {
7013 brcmf_err("FWEH activation failed (%d)\n", err); 7122 bphy_err(drvr, "FWEH activation failed (%d)\n", err);
7014 goto wiphy_unreg_out; 7123 goto wiphy_unreg_out;
7015 } 7124 }
7016 7125
7017 err = brcmf_p2p_attach(cfg, p2pdev_forced); 7126 err = brcmf_p2p_attach(cfg, p2pdev_forced);
7018 if (err) { 7127 if (err) {
7019 brcmf_err("P2P initialisation failed (%d)\n", err); 7128 bphy_err(drvr, "P2P initialisation failed (%d)\n", err);
7020 goto wiphy_unreg_out; 7129 goto wiphy_unreg_out;
7021 } 7130 }
7022 err = brcmf_btcoex_attach(cfg); 7131 err = brcmf_btcoex_attach(cfg);
7023 if (err) { 7132 if (err) {
7024 brcmf_err("BT-coex initialisation failed (%d)\n", err); 7133 bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err);
7025 brcmf_p2p_detach(&cfg->p2p); 7134 brcmf_p2p_detach(&cfg->p2p);
7026 goto wiphy_unreg_out; 7135 goto wiphy_unreg_out;
7027 } 7136 }
7028 err = brcmf_pno_attach(cfg); 7137 err = brcmf_pno_attach(cfg);
7029 if (err) { 7138 if (err) {
7030 brcmf_err("PNO initialisation failed (%d)\n", err); 7139 bphy_err(drvr, "PNO initialisation failed (%d)\n", err);
7031 brcmf_btcoex_detach(cfg); 7140 brcmf_btcoex_detach(cfg);
7032 brcmf_p2p_detach(&cfg->p2p); 7141 brcmf_p2p_detach(&cfg->p2p);
7033 goto wiphy_unreg_out; 7142 goto wiphy_unreg_out;
@@ -7047,7 +7156,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
7047 /* (re-) activate FWEH event handling */ 7156 /* (re-) activate FWEH event handling */
7048 err = brcmf_fweh_activate_events(ifp); 7157 err = brcmf_fweh_activate_events(ifp);
7049 if (err) { 7158 if (err) {
7050 brcmf_err("FWEH activation failed (%d)\n", err); 7159 bphy_err(drvr, "FWEH activation failed (%d)\n", err);
7051 goto detach; 7160 goto detach;
7052 } 7161 }
7053 7162
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index 0ce1d8174e6d..96b8d5b3aeed 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -90,6 +90,7 @@ struct brcmf_mp_global_t brcmf_mp_global;
90 90
91void brcmf_c_set_joinpref_default(struct brcmf_if *ifp) 91void brcmf_c_set_joinpref_default(struct brcmf_if *ifp)
92{ 92{
93 struct brcmf_pub *drvr = ifp->drvr;
93 struct brcmf_join_pref_params join_pref_params[2]; 94 struct brcmf_join_pref_params join_pref_params[2];
94 int err; 95 int err;
95 96
@@ -106,7 +107,7 @@ void brcmf_c_set_joinpref_default(struct brcmf_if *ifp)
106 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, 107 err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params,
107 sizeof(join_pref_params)); 108 sizeof(join_pref_params));
108 if (err) 109 if (err)
109 brcmf_err("Set join_pref error (%d)\n", err); 110 bphy_err(drvr, "Set join_pref error (%d)\n", err);
110} 111}
111 112
112static int brcmf_c_download(struct brcmf_if *ifp, u16 flag, 113static int brcmf_c_download(struct brcmf_if *ifp, u16 flag,
@@ -129,7 +130,8 @@ static int brcmf_c_download(struct brcmf_if *ifp, u16 flag,
129 130
130static int brcmf_c_process_clm_blob(struct brcmf_if *ifp) 131static int brcmf_c_process_clm_blob(struct brcmf_if *ifp)
131{ 132{
132 struct brcmf_bus *bus = ifp->drvr->bus_if; 133 struct brcmf_pub *drvr = ifp->drvr;
134 struct brcmf_bus *bus = drvr->bus_if;
133 struct brcmf_dload_data_le *chunk_buf; 135 struct brcmf_dload_data_le *chunk_buf;
134 const struct firmware *clm = NULL; 136 const struct firmware *clm = NULL;
135 u8 clm_name[BRCMF_FW_NAME_LEN]; 137 u8 clm_name[BRCMF_FW_NAME_LEN];
@@ -145,7 +147,7 @@ static int brcmf_c_process_clm_blob(struct brcmf_if *ifp)
145 memset(clm_name, 0, sizeof(clm_name)); 147 memset(clm_name, 0, sizeof(clm_name));
146 err = brcmf_bus_get_fwname(bus, ".clm_blob", clm_name); 148 err = brcmf_bus_get_fwname(bus, ".clm_blob", clm_name);
147 if (err) { 149 if (err) {
148 brcmf_err("get CLM blob file name failed (%d)\n", err); 150 bphy_err(drvr, "get CLM blob file name failed (%d)\n", err);
149 return err; 151 return err;
150 } 152 }
151 153
@@ -182,12 +184,12 @@ static int brcmf_c_process_clm_blob(struct brcmf_if *ifp)
182 } while ((datalen > 0) && (err == 0)); 184 } while ((datalen > 0) && (err == 0));
183 185
184 if (err) { 186 if (err) {
185 brcmf_err("clmload (%zu byte file) failed (%d); ", 187 bphy_err(drvr, "clmload (%zu byte file) failed (%d)\n",
186 clm->size, err); 188 clm->size, err);
187 /* Retrieve clmload_status and print */ 189 /* Retrieve clmload_status and print */
188 err = brcmf_fil_iovar_int_get(ifp, "clmload_status", &status); 190 err = brcmf_fil_iovar_int_get(ifp, "clmload_status", &status);
189 if (err) 191 if (err)
190 brcmf_err("get clmload_status failed (%d)\n", err); 192 bphy_err(drvr, "get clmload_status failed (%d)\n", err);
191 else 193 else
192 brcmf_dbg(INFO, "clmload_status=%d\n", status); 194 brcmf_dbg(INFO, "clmload_status=%d\n", status);
193 err = -EIO; 195 err = -EIO;
@@ -201,6 +203,7 @@ done:
201 203
202int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) 204int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
203{ 205{
206 struct brcmf_pub *drvr = ifp->drvr;
204 s8 eventmask[BRCMF_EVENTING_MASK_LEN]; 207 s8 eventmask[BRCMF_EVENTING_MASK_LEN];
205 u8 buf[BRCMF_DCMD_SMLEN]; 208 u8 buf[BRCMF_DCMD_SMLEN];
206 struct brcmf_bus *bus; 209 struct brcmf_bus *bus;
@@ -214,7 +217,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
214 err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, 217 err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr,
215 sizeof(ifp->mac_addr)); 218 sizeof(ifp->mac_addr));
216 if (err < 0) { 219 if (err < 0) {
217 brcmf_err("Retrieving cur_etheraddr failed, %d\n", err); 220 bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err);
218 goto done; 221 goto done;
219 } 222 }
220 memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN); 223 memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN);
@@ -226,7 +229,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
226 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, 229 err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO,
227 &revinfo, sizeof(revinfo)); 230 &revinfo, sizeof(revinfo));
228 if (err < 0) { 231 if (err < 0) {
229 brcmf_err("retrieving revision info failed, %d\n", err); 232 bphy_err(drvr, "retrieving revision info failed, %d\n", err);
230 strlcpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname)); 233 strlcpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname));
231 } else { 234 } else {
232 ri->vendorid = le32_to_cpu(revinfo.vendorid); 235 ri->vendorid = le32_to_cpu(revinfo.vendorid);
@@ -260,7 +263,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
260 /* Do any CLM downloading */ 263 /* Do any CLM downloading */
261 err = brcmf_c_process_clm_blob(ifp); 264 err = brcmf_c_process_clm_blob(ifp);
262 if (err < 0) { 265 if (err < 0) {
263 brcmf_err("download CLM blob file failed, %d\n", err); 266 bphy_err(drvr, "download CLM blob file failed, %d\n", err);
264 goto done; 267 goto done;
265 } 268 }
266 269
@@ -269,8 +272,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
269 strcpy(buf, "ver"); 272 strcpy(buf, "ver");
270 err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); 273 err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf));
271 if (err < 0) { 274 if (err < 0) {
272 brcmf_err("Retrieving version information failed, %d\n", 275 bphy_err(drvr, "Retrieving version information failed, %d\n",
273 err); 276 err);
274 goto done; 277 goto done;
275 } 278 }
276 ptr = (char *)buf; 279 ptr = (char *)buf;
@@ -304,7 +307,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
304 /* set mpc */ 307 /* set mpc */
305 err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); 308 err = brcmf_fil_iovar_int_set(ifp, "mpc", 1);
306 if (err) { 309 if (err) {
307 brcmf_err("failed setting mpc\n"); 310 bphy_err(drvr, "failed setting mpc\n");
308 goto done; 311 goto done;
309 } 312 }
310 313
@@ -314,14 +317,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
314 err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, 317 err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask,
315 BRCMF_EVENTING_MASK_LEN); 318 BRCMF_EVENTING_MASK_LEN);
316 if (err) { 319 if (err) {
317 brcmf_err("Get event_msgs error (%d)\n", err); 320 bphy_err(drvr, "Get event_msgs error (%d)\n", err);
318 goto done; 321 goto done;
319 } 322 }
320 setbit(eventmask, BRCMF_E_IF); 323 setbit(eventmask, BRCMF_E_IF);
321 err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask, 324 err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask,
322 BRCMF_EVENTING_MASK_LEN); 325 BRCMF_EVENTING_MASK_LEN);
323 if (err) { 326 if (err) {
324 brcmf_err("Set event_msgs error (%d)\n", err); 327 bphy_err(drvr, "Set event_msgs error (%d)\n", err);
325 goto done; 328 goto done;
326 } 329 }
327 330
@@ -329,8 +332,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
329 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, 332 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME,
330 BRCMF_DEFAULT_SCAN_CHANNEL_TIME); 333 BRCMF_DEFAULT_SCAN_CHANNEL_TIME);
331 if (err) { 334 if (err) {
332 brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", 335 bphy_err(drvr, "BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n",
333 err); 336 err);
334 goto done; 337 goto done;
335 } 338 }
336 339
@@ -338,8 +341,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
338 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, 341 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME,
339 BRCMF_DEFAULT_SCAN_UNASSOC_TIME); 342 BRCMF_DEFAULT_SCAN_UNASSOC_TIME);
340 if (err) { 343 if (err) {
341 brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", 344 bphy_err(drvr, "BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n",
342 err); 345 err);
343 goto done; 346 goto done;
344 } 347 }
345 348
@@ -350,7 +353,7 @@ done:
350} 353}
351 354
352#ifndef CONFIG_BRCM_TRACING 355#ifndef CONFIG_BRCM_TRACING
353void __brcmf_err(const char *func, const char *fmt, ...) 356void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...)
354{ 357{
355 struct va_format vaf; 358 struct va_format vaf;
356 va_list args; 359 va_list args;
@@ -359,7 +362,10 @@ void __brcmf_err(const char *func, const char *fmt, ...)
359 362
360 vaf.fmt = fmt; 363 vaf.fmt = fmt;
361 vaf.va = &args; 364 vaf.va = &args;
362 pr_err("%s: %pV", func, &vaf); 365 if (bus)
366 dev_err(bus->dev, "%s: %pV", func, &vaf);
367 else
368 pr_err("%s: %pV", func, &vaf);
363 369
364 va_end(args); 370 va_end(args);
365} 371}
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 860a4372cb56..4fbe8791f674 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -43,6 +43,36 @@
43 43
44#define BRCMF_BSSIDX_INVALID -1 44#define BRCMF_BSSIDX_INVALID -1
45 45
46#define RXS_PBPRES BIT(2)
47
48#define D11_PHY_HDR_LEN 6
49
50struct d11rxhdr_le {
51 __le16 RxFrameSize;
52 u16 PAD;
53 __le16 PhyRxStatus_0;
54 __le16 PhyRxStatus_1;
55 __le16 PhyRxStatus_2;
56 __le16 PhyRxStatus_3;
57 __le16 PhyRxStatus_4;
58 __le16 PhyRxStatus_5;
59 __le16 RxStatus1;
60 __le16 RxStatus2;
61 __le16 RxTSFTime;
62 __le16 RxChan;
63 u8 unknown[12];
64} __packed;
65
66struct wlc_d11rxhdr {
67 struct d11rxhdr_le rxhdr;
68 __le32 tsf_l;
69 s8 rssi;
70 s8 rxpwr0;
71 s8 rxpwr1;
72 s8 do_rssi_ma;
73 s8 rxpwr[4];
74} __packed;
75
46char *brcmf_ifname(struct brcmf_if *ifp) 76char *brcmf_ifname(struct brcmf_if *ifp)
47{ 77{
48 if (!ifp) 78 if (!ifp)
@@ -60,7 +90,7 @@ struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
60 s32 bsscfgidx; 90 s32 bsscfgidx;
61 91
62 if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) { 92 if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
63 brcmf_err("ifidx %d out of range\n", ifidx); 93 bphy_err(drvr, "ifidx %d out of range\n", ifidx);
64 return NULL; 94 return NULL;
65 } 95 }
66 96
@@ -111,7 +141,9 @@ void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable)
111 141
112static void _brcmf_set_multicast_list(struct work_struct *work) 142static void _brcmf_set_multicast_list(struct work_struct *work)
113{ 143{
114 struct brcmf_if *ifp; 144 struct brcmf_if *ifp = container_of(work, struct brcmf_if,
145 multicast_work);
146 struct brcmf_pub *drvr = ifp->drvr;
115 struct net_device *ndev; 147 struct net_device *ndev;
116 struct netdev_hw_addr *ha; 148 struct netdev_hw_addr *ha;
117 u32 cmd_value, cnt; 149 u32 cmd_value, cnt;
@@ -120,8 +152,6 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
120 u32 buflen; 152 u32 buflen;
121 s32 err; 153 s32 err;
122 154
123 ifp = container_of(work, struct brcmf_if, multicast_work);
124
125 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); 155 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
126 156
127 ndev = ifp->ndev; 157 ndev = ifp->ndev;
@@ -151,7 +181,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
151 181
152 err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen); 182 err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen);
153 if (err < 0) { 183 if (err < 0) {
154 brcmf_err("Setting mcast_list failed, %d\n", err); 184 bphy_err(drvr, "Setting mcast_list failed, %d\n", err);
155 cmd_value = cnt ? true : cmd_value; 185 cmd_value = cnt ? true : cmd_value;
156 } 186 }
157 187
@@ -164,25 +194,25 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
164 */ 194 */
165 err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value); 195 err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value);
166 if (err < 0) 196 if (err < 0)
167 brcmf_err("Setting allmulti failed, %d\n", err); 197 bphy_err(drvr, "Setting allmulti failed, %d\n", err);
168 198
169 /*Finally, pick up the PROMISC flag */ 199 /*Finally, pick up the PROMISC flag */
170 cmd_value = (ndev->flags & IFF_PROMISC) ? true : false; 200 cmd_value = (ndev->flags & IFF_PROMISC) ? true : false;
171 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value); 201 err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value);
172 if (err < 0) 202 if (err < 0)
173 brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", 203 bphy_err(drvr, "Setting BRCMF_C_SET_PROMISC failed, %d\n",
174 err); 204 err);
175 brcmf_configure_arp_nd_offload(ifp, !cmd_value); 205 brcmf_configure_arp_nd_offload(ifp, !cmd_value);
176} 206}
177 207
178#if IS_ENABLED(CONFIG_IPV6) 208#if IS_ENABLED(CONFIG_IPV6)
179static void _brcmf_update_ndtable(struct work_struct *work) 209static void _brcmf_update_ndtable(struct work_struct *work)
180{ 210{
181 struct brcmf_if *ifp; 211 struct brcmf_if *ifp = container_of(work, struct brcmf_if,
212 ndoffload_work);
213 struct brcmf_pub *drvr = ifp->drvr;
182 int i, ret; 214 int i, ret;
183 215
184 ifp = container_of(work, struct brcmf_if, ndoffload_work);
185
186 /* clear the table in firmware */ 216 /* clear the table in firmware */
187 ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0); 217 ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0);
188 if (ret) { 218 if (ret) {
@@ -195,7 +225,7 @@ static void _brcmf_update_ndtable(struct work_struct *work)
195 &ifp->ipv6_addr_tbl[i], 225 &ifp->ipv6_addr_tbl[i],
196 sizeof(struct in6_addr)); 226 sizeof(struct in6_addr));
197 if (ret) 227 if (ret)
198 brcmf_err("add nd ip err %d\n", ret); 228 bphy_err(drvr, "add nd ip err %d\n", ret);
199 } 229 }
200} 230}
201#else 231#else
@@ -208,6 +238,7 @@ static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr)
208{ 238{
209 struct brcmf_if *ifp = netdev_priv(ndev); 239 struct brcmf_if *ifp = netdev_priv(ndev);
210 struct sockaddr *sa = (struct sockaddr *)addr; 240 struct sockaddr *sa = (struct sockaddr *)addr;
241 struct brcmf_pub *drvr = ifp->drvr;
211 int err; 242 int err;
212 243
213 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); 244 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
@@ -215,7 +246,7 @@ static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr)
215 err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data, 246 err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data,
216 ETH_ALEN); 247 ETH_ALEN);
217 if (err < 0) { 248 if (err < 0) {
218 brcmf_err("Setting cur_etheraddr failed, %d\n", err); 249 bphy_err(drvr, "Setting cur_etheraddr failed, %d\n", err);
219 } else { 250 } else {
220 brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data); 251 brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data);
221 memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN); 252 memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN);
@@ -275,7 +306,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
275 306
276 /* Can the device send data? */ 307 /* Can the device send data? */
277 if (drvr->bus_if->state != BRCMF_BUS_UP) { 308 if (drvr->bus_if->state != BRCMF_BUS_UP) {
278 brcmf_err("xmit rejected state=%d\n", drvr->bus_if->state); 309 bphy_err(drvr, "xmit rejected state=%d\n", drvr->bus_if->state);
279 netif_stop_queue(ndev); 310 netif_stop_queue(ndev);
280 dev_kfree_skb(skb); 311 dev_kfree_skb(skb);
281 ret = -ENODEV; 312 ret = -ENODEV;
@@ -309,8 +340,8 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
309 ret = pskb_expand_head(skb, ALIGN(head_delta, NET_SKB_PAD), 0, 340 ret = pskb_expand_head(skb, ALIGN(head_delta, NET_SKB_PAD), 0,
310 GFP_ATOMIC); 341 GFP_ATOMIC);
311 if (ret < 0) { 342 if (ret < 0) {
312 brcmf_err("%s: failed to expand headroom\n", 343 bphy_err(drvr, "%s: failed to expand headroom\n",
313 brcmf_ifname(ifp)); 344 brcmf_ifname(ifp));
314 atomic_inc(&drvr->bus_if->stats.pktcow_failed); 345 atomic_inc(&drvr->bus_if->stats.pktcow_failed);
315 goto done; 346 goto done;
316 } 347 }
@@ -409,6 +440,31 @@ void brcmf_netif_mon_rx(struct brcmf_if *ifp, struct sk_buff *skb)
409{ 440{
410 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_RADIOTAP)) { 441 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_RADIOTAP)) {
411 /* Do nothing */ 442 /* Do nothing */
443 } else if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR)) {
444 struct wlc_d11rxhdr *wlc_rxhdr = (struct wlc_d11rxhdr *)skb->data;
445 struct ieee80211_radiotap_header *radiotap;
446 unsigned int offset;
447 u16 RxStatus1;
448
449 RxStatus1 = le16_to_cpu(wlc_rxhdr->rxhdr.RxStatus1);
450
451 offset = sizeof(struct wlc_d11rxhdr);
452 /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU
453 * subframes
454 */
455 if (RxStatus1 & RXS_PBPRES)
456 offset += 2;
457 offset += D11_PHY_HDR_LEN;
458
459 skb_pull(skb, offset);
460
461 /* TODO: use RX header to fill some radiotap data */
462 radiotap = skb_push(skb, sizeof(*radiotap));
463 memset(radiotap, 0, sizeof(*radiotap));
464 radiotap->it_len = cpu_to_le16(sizeof(*radiotap));
465
466 /* TODO: 4 bytes with receive status? */
467 skb->len -= 4;
412 } else { 468 } else {
413 struct ieee80211_radiotap_header *radiotap; 469 struct ieee80211_radiotap_header *radiotap;
414 470
@@ -464,7 +520,8 @@ void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
464 } else { 520 } else {
465 /* Process special event packets */ 521 /* Process special event packets */
466 if (handle_event) 522 if (handle_event)
467 brcmf_fweh_process_skb(ifp->drvr, skb); 523 brcmf_fweh_process_skb(ifp->drvr, skb,
524 BCMILCP_SUBTYPE_VENDOR_LONG);
468 525
469 brcmf_netif_rx(ifp, skb); 526 brcmf_netif_rx(ifp, skb);
470 } 527 }
@@ -481,7 +538,7 @@ void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
481 if (brcmf_rx_hdrpull(drvr, skb, &ifp)) 538 if (brcmf_rx_hdrpull(drvr, skb, &ifp))
482 return; 539 return;
483 540
484 brcmf_fweh_process_skb(ifp->drvr, skb); 541 brcmf_fweh_process_skb(ifp->drvr, skb, 0);
485 brcmu_pkt_buf_free_skb(skb); 542 brcmu_pkt_buf_free_skb(skb);
486} 543}
487 544
@@ -551,7 +608,7 @@ static int brcmf_netdev_open(struct net_device *ndev)
551 608
552 /* If bus is not ready, can't continue */ 609 /* If bus is not ready, can't continue */
553 if (bus_if->state != BRCMF_BUS_UP) { 610 if (bus_if->state != BRCMF_BUS_UP) {
554 brcmf_err("failed bus is not ready\n"); 611 bphy_err(drvr, "failed bus is not ready\n");
555 return -EAGAIN; 612 return -EAGAIN;
556 } 613 }
557 614
@@ -565,7 +622,7 @@ static int brcmf_netdev_open(struct net_device *ndev)
565 ndev->features &= ~NETIF_F_IP_CSUM; 622 ndev->features &= ~NETIF_F_IP_CSUM;
566 623
567 if (brcmf_cfg80211_up(ndev)) { 624 if (brcmf_cfg80211_up(ndev)) {
568 brcmf_err("failed to bring up cfg80211\n"); 625 bphy_err(drvr, "failed to bring up cfg80211\n");
569 return -EIO; 626 return -EIO;
570 } 627 }
571 628
@@ -610,7 +667,7 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked)
610 else 667 else
611 err = register_netdev(ndev); 668 err = register_netdev(ndev);
612 if (err != 0) { 669 if (err != 0) {
613 brcmf_err("couldn't register the net device\n"); 670 bphy_err(drvr, "couldn't register the net device\n");
614 goto fail; 671 goto fail;
615 } 672 }
616 673
@@ -687,6 +744,7 @@ static const struct net_device_ops brcmf_netdev_ops_p2p = {
687 744
688static int brcmf_net_p2p_attach(struct brcmf_if *ifp) 745static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
689{ 746{
747 struct brcmf_pub *drvr = ifp->drvr;
690 struct net_device *ndev; 748 struct net_device *ndev;
691 749
692 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx, 750 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
@@ -699,7 +757,7 @@ static int brcmf_net_p2p_attach(struct brcmf_if *ifp)
699 memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); 757 memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN);
700 758
701 if (register_netdev(ndev) != 0) { 759 if (register_netdev(ndev) != 0) {
702 brcmf_err("couldn't register the p2p net device\n"); 760 bphy_err(drvr, "couldn't register the p2p net device\n");
703 goto fail; 761 goto fail;
704 } 762 }
705 763
@@ -728,8 +786,8 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
728 */ 786 */
729 if (ifp) { 787 if (ifp) {
730 if (ifidx) { 788 if (ifidx) {
731 brcmf_err("ERROR: netdev:%s already exists\n", 789 bphy_err(drvr, "ERROR: netdev:%s already exists\n",
732 ifp->ndev->name); 790 ifp->ndev->name);
733 netif_stop_queue(ifp->ndev); 791 netif_stop_queue(ifp->ndev);
734 brcmf_net_detach(ifp->ndev, false); 792 brcmf_net_detach(ifp->ndev, false);
735 drvr->iflist[bsscfgidx] = NULL; 793 drvr->iflist[bsscfgidx] = NULL;
@@ -787,7 +845,7 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
787 ifp = drvr->iflist[bsscfgidx]; 845 ifp = drvr->iflist[bsscfgidx];
788 drvr->iflist[bsscfgidx] = NULL; 846 drvr->iflist[bsscfgidx] = NULL;
789 if (!ifp) { 847 if (!ifp) {
790 brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx); 848 bphy_err(drvr, "Null interface, bsscfgidx=%d\n", bsscfgidx);
791 return; 849 return;
792 } 850 }
793 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, 851 brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx,
@@ -837,16 +895,17 @@ static int brcmf_psm_watchdog_notify(struct brcmf_if *ifp,
837 const struct brcmf_event_msg *evtmsg, 895 const struct brcmf_event_msg *evtmsg,
838 void *data) 896 void *data)
839{ 897{
898 struct brcmf_pub *drvr = ifp->drvr;
840 int err; 899 int err;
841 900
842 brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx); 901 brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
843 902
844 brcmf_err("PSM's watchdog has fired!\n"); 903 bphy_err(drvr, "PSM's watchdog has fired!\n");
845 904
846 err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data, 905 err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
847 evtmsg->datalen); 906 evtmsg->datalen);
848 if (err) 907 if (err)
849 brcmf_err("Failed to get memory dump, %d\n", err); 908 bphy_err(drvr, "Failed to get memory dump, %d\n", err);
850 909
851 return err; 910 return err;
852} 911}
@@ -890,7 +949,7 @@ static int brcmf_inetaddr_changed(struct notifier_block *nb,
890 ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table, 949 ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table,
891 sizeof(addr_table)); 950 sizeof(addr_table));
892 if (ret) { 951 if (ret) {
893 brcmf_err("fail to get arp ip table err:%d\n", ret); 952 bphy_err(drvr, "fail to get arp ip table err:%d\n", ret);
894 return NOTIFY_OK; 953 return NOTIFY_OK;
895 } 954 }
896 955
@@ -907,7 +966,7 @@ static int brcmf_inetaddr_changed(struct notifier_block *nb,
907 ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip", 966 ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip",
908 &ifa->ifa_address, sizeof(ifa->ifa_address)); 967 &ifa->ifa_address, sizeof(ifa->ifa_address));
909 if (ret) 968 if (ret)
910 brcmf_err("add arp ip err %d\n", ret); 969 bphy_err(drvr, "add arp ip err %d\n", ret);
911 } 970 }
912 break; 971 break;
913 case NETDEV_DOWN: 972 case NETDEV_DOWN:
@@ -919,8 +978,8 @@ static int brcmf_inetaddr_changed(struct notifier_block *nb,
919 ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear", 978 ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear",
920 NULL, 0); 979 NULL, 0);
921 if (ret) { 980 if (ret) {
922 brcmf_err("fail to clear arp ip table err:%d\n", 981 bphy_err(drvr, "fail to clear arp ip table err:%d\n",
923 ret); 982 ret);
924 return NOTIFY_OK; 983 return NOTIFY_OK;
925 } 984 }
926 for (i = 0; i < ARPOL_MAX_ENTRIES; i++) { 985 for (i = 0; i < ARPOL_MAX_ENTRIES; i++) {
@@ -930,8 +989,8 @@ static int brcmf_inetaddr_changed(struct notifier_block *nb,
930 &addr_table[i], 989 &addr_table[i],
931 sizeof(addr_table[i])); 990 sizeof(addr_table[i]));
932 if (ret) 991 if (ret)
933 brcmf_err("add arp ip err %d\n", 992 bphy_err(drvr, "add arp ip err %d\n",
934 ret); 993 ret);
935 } 994 }
936 } 995 }
937 break; 996 break;
@@ -1100,11 +1159,12 @@ static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)
1100 brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); 1159 brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read);
1101 brcmf_feat_debugfs_create(drvr); 1160 brcmf_feat_debugfs_create(drvr);
1102 brcmf_proto_debugfs_create(drvr); 1161 brcmf_proto_debugfs_create(drvr);
1162 brcmf_bus_debugfs_create(bus_if);
1103 1163
1104 return 0; 1164 return 0;
1105 1165
1106fail: 1166fail:
1107 brcmf_err("failed: %d\n", ret); 1167 bphy_err(drvr, "failed: %d\n", ret);
1108 if (drvr->config) { 1168 if (drvr->config) {
1109 brcmf_cfg80211_detach(drvr->config); 1169 brcmf_cfg80211_detach(drvr->config);
1110 drvr->config = NULL; 1170 drvr->config = NULL;
@@ -1156,7 +1216,7 @@ int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
1156 /* Attach and link in the protocol */ 1216 /* Attach and link in the protocol */
1157 ret = brcmf_proto_attach(drvr); 1217 ret = brcmf_proto_attach(drvr);
1158 if (ret != 0) { 1218 if (ret != 0) {
1159 brcmf_err("brcmf_prot_attach failed\n"); 1219 bphy_err(drvr, "brcmf_prot_attach failed\n");
1160 goto fail; 1220 goto fail;
1161 } 1221 }
1162 1222
@@ -1169,7 +1229,7 @@ int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings)
1169 1229
1170 ret = brcmf_bus_started(drvr, ops); 1230 ret = brcmf_bus_started(drvr, ops);
1171 if (ret != 0) { 1231 if (ret != 0) {
1172 brcmf_err("dongle is not responding: err=%d\n", ret); 1232 bphy_err(drvr, "dongle is not responding: err=%d\n", ret);
1173 goto fail; 1233 goto fail;
1174 } 1234 }
1175 1235
@@ -1269,6 +1329,7 @@ static int brcmf_get_pend_8021x_cnt(struct brcmf_if *ifp)
1269 1329
1270int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp) 1330int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp)
1271{ 1331{
1332 struct brcmf_pub *drvr = ifp->drvr;
1272 int err; 1333 int err;
1273 1334
1274 err = wait_event_timeout(ifp->pend_8021x_wait, 1335 err = wait_event_timeout(ifp->pend_8021x_wait,
@@ -1276,7 +1337,7 @@ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp)
1276 MAX_WAIT_FOR_8021X_TX); 1337 MAX_WAIT_FOR_8021X_TX);
1277 1338
1278 if (!err) 1339 if (!err)
1279 brcmf_err("Timed out waiting for no pending 802.1x packets\n"); 1340 bphy_err(drvr, "Timed out waiting for no pending 802.1x packets\n");
1280 1341
1281 return !err; 1342 return !err;
1282} 1343}
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
index dcf6e27cc16f..d8085ce579f4 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
@@ -36,7 +36,7 @@
36#define BRCMF_DCMD_MEDLEN 1536 36#define BRCMF_DCMD_MEDLEN 1536
37#define BRCMF_DCMD_MAXLEN 8192 37#define BRCMF_DCMD_MAXLEN 8192
38 38
39/* IOCTL from host to device are limited in lenght. A device can only handle 39/* IOCTL from host to device are limited in length. A device can only handle
40 * ethernet frame size. This limitation is to be applied by protocol layer. 40 * ethernet frame size. This limitation is to be applied by protocol layer.
41 */ 41 */
42#define BRCMF_TX_IOCTL_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN) 42#define BRCMF_TX_IOCTL_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
index cfed0626bf5a..2998726b62c3 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
@@ -45,17 +45,30 @@
45#undef pr_fmt 45#undef pr_fmt
46#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 46#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
47 47
48__printf(2, 3) 48struct brcmf_bus;
49void __brcmf_err(const char *func, const char *fmt, ...); 49
50__printf(3, 4)
51void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...);
50/* Macro for error messages. When debugging / tracing the driver all error 52/* Macro for error messages. When debugging / tracing the driver all error
51 * messages are important to us. 53 * messages are important to us.
52 */ 54 */
55#ifndef brcmf_err
53#define brcmf_err(fmt, ...) \ 56#define brcmf_err(fmt, ...) \
54 do { \ 57 do { \
55 if (IS_ENABLED(CONFIG_BRCMDBG) || \ 58 if (IS_ENABLED(CONFIG_BRCMDBG) || \
56 IS_ENABLED(CONFIG_BRCM_TRACING) || \ 59 IS_ENABLED(CONFIG_BRCM_TRACING) || \
57 net_ratelimit()) \ 60 net_ratelimit()) \
58 __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ 61 __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\
62 } while (0)
63#endif
64
65#define bphy_err(drvr, fmt, ...) \
66 do { \
67 if (IS_ENABLED(CONFIG_BRCMDBG) || \
68 IS_ENABLED(CONFIG_BRCM_TRACING) || \
69 net_ratelimit()) \
70 wiphy_err((drvr)->wiphy, "%s: " fmt, __func__, \
71 ##__VA_ARGS__); \
59 } while (0) 72 } while (0)
60 73
61#if defined(DEBUG) || defined(CONFIG_BRCM_TRACING) 74#if defined(DEBUG) || defined(CONFIG_BRCM_TRACING)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
index 4c5a3995dc35..acca719b3907 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
@@ -103,6 +103,10 @@ static const struct brcmf_feat_fwfeat brcmf_feat_fwfeat_map[] = {
103 { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) }, 103 { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) },
104 /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */ 104 /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */
105 { "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) }, 105 { "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) },
106 /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 211de1679a68 */
107 { "01-801fb449", BIT(BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR) },
108 /* brcmfmac4366c-pcie.bin from linux-firmware.git commit 211de1679a68 */
109 { "01-d2cbb8fd", BIT(BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR) },
106}; 110};
107 111
108static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv) 112static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv)
@@ -181,13 +185,14 @@ static void brcmf_feat_iovar_data_set(struct brcmf_if *ifp,
181#define MAX_CAPS_BUFFER_SIZE 768 185#define MAX_CAPS_BUFFER_SIZE 768
182static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) 186static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)
183{ 187{
188 struct brcmf_pub *drvr = ifp->drvr;
184 char caps[MAX_CAPS_BUFFER_SIZE]; 189 char caps[MAX_CAPS_BUFFER_SIZE];
185 enum brcmf_feat_id id; 190 enum brcmf_feat_id id;
186 int i, err; 191 int i, err;
187 192
188 err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); 193 err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
189 if (err) { 194 if (err) {
190 brcmf_err("could not get firmware cap (%d)\n", err); 195 bphy_err(drvr, "could not get firmware cap (%d)\n", err);
191 return; 196 return;
192 } 197 }
193 198
@@ -212,14 +217,15 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp)
212static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data) 217static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
213{ 218{
214 struct brcmf_bus *bus_if = dev_get_drvdata(seq->private); 219 struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
215 struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0); 220 struct brcmf_pub *drvr = bus_if->drvr;
221 struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
216 char caps[MAX_CAPS_BUFFER_SIZE + 1] = { }; 222 char caps[MAX_CAPS_BUFFER_SIZE + 1] = { };
217 char *tmp; 223 char *tmp;
218 int err; 224 int err;
219 225
220 err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); 226 err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
221 if (err) { 227 if (err) {
222 brcmf_err("could not get firmware cap (%d)\n", err); 228 bphy_err(drvr, "could not get firmware cap (%d)\n", err);
223 return err; 229 return err;
224 } 230 }
225 231
@@ -268,9 +274,15 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)
268 BIT(BRCMF_FEAT_WOWL_GTK); 274 BIT(BRCMF_FEAT_WOWL_GTK);
269 } 275 }
270 } 276 }
271 /* MBSS does not work for 43362 */ 277 /* MBSS does not work for all chips */
272 if (drvr->bus_if->chip == BRCM_CC_43362_CHIP_ID) 278 switch (drvr->bus_if->chip) {
279 case BRCM_CC_4330_CHIP_ID:
280 case BRCM_CC_43362_CHIP_ID:
273 ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS); 281 ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS);
282 break;
283 default:
284 break;
285 }
274 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode"); 286 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
275 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable"); 287 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable");
276 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MFP, "mfp"); 288 brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MFP, "mfp");
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
index 0b4974df353a..5e88a7f16ad2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h
@@ -35,6 +35,7 @@
35 * FWSUP: Firmware supplicant. 35 * FWSUP: Firmware supplicant.
36 * MONITOR: firmware can pass monitor packets to host. 36 * MONITOR: firmware can pass monitor packets to host.
37 * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header 37 * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header
38 * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header
38 */ 39 */
39#define BRCMF_FEAT_LIST \ 40#define BRCMF_FEAT_LIST \
40 BRCMF_FEAT_DEF(MBSS) \ 41 BRCMF_FEAT_DEF(MBSS) \
@@ -52,7 +53,8 @@
52 BRCMF_FEAT_DEF(GSCAN) \ 53 BRCMF_FEAT_DEF(GSCAN) \
53 BRCMF_FEAT_DEF(FWSUP) \ 54 BRCMF_FEAT_DEF(FWSUP) \
54 BRCMF_FEAT_DEF(MONITOR) \ 55 BRCMF_FEAT_DEF(MONITOR) \
55 BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) 56 BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \
57 BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR)
56 58
57/* 59/*
58 * Quirks: 60 * Quirks:
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index 14b948917a1a..8209a42dea72 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -47,7 +47,7 @@ enum nvram_parser_state {
47 * @state: current parser state. 47 * @state: current parser state.
48 * @data: input buffer being parsed. 48 * @data: input buffer being parsed.
49 * @nvram: output buffer with parse result. 49 * @nvram: output buffer with parse result.
50 * @nvram_len: lenght of parse result. 50 * @nvram_len: length of parse result.
51 * @line: current line. 51 * @line: current line.
52 * @column: current column in line. 52 * @column: current column in line.
53 * @pos: byte offset in input buffer. 53 * @pos: byte offset in input buffer.
@@ -719,8 +719,10 @@ brcmf_fw_alloc_request(u32 chip, u32 chiprev,
719 break; 719 break;
720 } 720 }
721 721
722 brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname));
723
722 if (i == table_size) { 724 if (i == table_size) {
723 brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev); 725 brcmf_err("Unknown chip %s\n", chipname);
724 return NULL; 726 return NULL;
725 } 727 }
726 728
@@ -729,8 +731,6 @@ brcmf_fw_alloc_request(u32 chip, u32 chiprev,
729 if (!fwreq) 731 if (!fwreq)
730 return NULL; 732 return NULL;
731 733
732 brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname));
733
734 brcmf_info("using %s for chip %s\n", 734 brcmf_info("using %s for chip %s\n",
735 mapping_table[i].fw_base, chipname); 735 mapping_table[i].fw_base, chipname);
736 736
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
index e7eaa57d11d9..63e98fd583ab 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
@@ -102,7 +102,8 @@ static void brcmf_fweh_queue_event(struct brcmf_fweh_info *fweh,
102 schedule_work(&fweh->event_work); 102 schedule_work(&fweh->event_work);
103} 103}
104 104
105static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp, 105static int brcmf_fweh_call_event_handler(struct brcmf_pub *drvr,
106 struct brcmf_if *ifp,
106 enum brcmf_fweh_event_code code, 107 enum brcmf_fweh_event_code code,
107 struct brcmf_event_msg *emsg, 108 struct brcmf_event_msg *emsg,
108 void *data) 109 void *data)
@@ -117,9 +118,9 @@ static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp,
117 if (fweh->evt_handler[code]) 118 if (fweh->evt_handler[code])
118 err = fweh->evt_handler[code](ifp, emsg, data); 119 err = fweh->evt_handler[code](ifp, emsg, data);
119 else 120 else
120 brcmf_err("unhandled event %d ignored\n", code); 121 bphy_err(drvr, "unhandled event %d ignored\n", code);
121 } else { 122 } else {
122 brcmf_err("no interface object\n"); 123 bphy_err(drvr, "no interface object\n");
123 } 124 }
124 return err; 125 return err;
125} 126}
@@ -158,7 +159,7 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
158 return; 159 return;
159 } 160 }
160 if (ifevent->ifidx >= BRCMF_MAX_IFS) { 161 if (ifevent->ifidx >= BRCMF_MAX_IFS) {
161 brcmf_err("invalid interface index: %u\n", ifevent->ifidx); 162 bphy_err(drvr, "invalid interface index: %u\n", ifevent->ifidx);
162 return; 163 return;
163 } 164 }
164 165
@@ -181,7 +182,8 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
181 if (ifp && ifevent->action == BRCMF_E_IF_CHANGE) 182 if (ifp && ifevent->action == BRCMF_E_IF_CHANGE)
182 brcmf_proto_reset_if(drvr, ifp); 183 brcmf_proto_reset_if(drvr, ifp);
183 184
184 err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); 185 err = brcmf_fweh_call_event_handler(drvr, ifp, emsg->event_code, emsg,
186 data);
185 187
186 if (ifp && ifevent->action == BRCMF_E_IF_DEL) { 188 if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
187 bool armed = brcmf_cfg80211_vif_event_armed(drvr->config); 189 bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
@@ -268,11 +270,11 @@ static void brcmf_fweh_event_worker(struct work_struct *work)
268 ifp = drvr->iflist[0]; 270 ifp = drvr->iflist[0];
269 else 271 else
270 ifp = drvr->iflist[emsg.bsscfgidx]; 272 ifp = drvr->iflist[emsg.bsscfgidx];
271 err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg, 273 err = brcmf_fweh_call_event_handler(drvr, ifp, event->code,
272 event->data); 274 &emsg, event->data);
273 if (err) { 275 if (err) {
274 brcmf_err("event handler failed (%d)\n", 276 bphy_err(drvr, "event handler failed (%d)\n",
275 event->code); 277 event->code);
276 err = 0; 278 err = 0;
277 } 279 }
278event_free: 280event_free:
@@ -339,7 +341,7 @@ int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code,
339 brcmf_fweh_handler_t handler) 341 brcmf_fweh_handler_t handler)
340{ 342{
341 if (drvr->fweh.evt_handler[code]) { 343 if (drvr->fweh.evt_handler[code]) {
342 brcmf_err("event code %d already registered\n", code); 344 bphy_err(drvr, "event code %d already registered\n", code);
343 return -ENOSPC; 345 return -ENOSPC;
344 } 346 }
345 drvr->fweh.evt_handler[code] = handler; 347 drvr->fweh.evt_handler[code] = handler;
@@ -369,6 +371,7 @@ void brcmf_fweh_unregister(struct brcmf_pub *drvr,
369 */ 371 */
370int brcmf_fweh_activate_events(struct brcmf_if *ifp) 372int brcmf_fweh_activate_events(struct brcmf_if *ifp)
371{ 373{
374 struct brcmf_pub *drvr = ifp->drvr;
372 int i, err; 375 int i, err;
373 s8 eventmask[BRCMF_EVENTING_MASK_LEN]; 376 s8 eventmask[BRCMF_EVENTING_MASK_LEN];
374 377
@@ -388,7 +391,7 @@ int brcmf_fweh_activate_events(struct brcmf_if *ifp)
388 err = brcmf_fil_iovar_data_set(ifp, "event_msgs", 391 err = brcmf_fil_iovar_data_set(ifp, "event_msgs",
389 eventmask, BRCMF_EVENTING_MASK_LEN); 392 eventmask, BRCMF_EVENTING_MASK_LEN);
390 if (err) 393 if (err)
391 brcmf_err("Set event_msgs error (%d)\n", err); 394 bphy_err(drvr, "Set event_msgs error (%d)\n", err);
392 395
393 return err; 396 return err;
394} 397}
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
index 816f80ea925b..7027243db17e 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h
@@ -211,7 +211,7 @@ enum brcmf_fweh_event_code {
211 */ 211 */
212#define BRCM_OUI "\x00\x10\x18" 212#define BRCM_OUI "\x00\x10\x18"
213#define BCMILCP_BCM_SUBTYPE_EVENT 1 213#define BCMILCP_BCM_SUBTYPE_EVENT 1
214 214#define BCMILCP_SUBTYPE_VENDOR_LONG 32769
215 215
216/** 216/**
217 * struct brcm_ethhdr - broadcom specific ether header. 217 * struct brcm_ethhdr - broadcom specific ether header.
@@ -266,7 +266,7 @@ struct brcmf_event {
266 * @status: status information. 266 * @status: status information.
267 * @reason: reason code. 267 * @reason: reason code.
268 * @auth_type: authentication type. 268 * @auth_type: authentication type.
269 * @datalen: lenght of event data buffer. 269 * @datalen: length of event data buffer.
270 * @addr: ether address. 270 * @addr: ether address.
271 * @ifname: interface name. 271 * @ifname: interface name.
272 * @ifidx: interface index. 272 * @ifidx: interface index.
@@ -334,10 +334,10 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr,
334void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing); 334void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);
335 335
336static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr, 336static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
337 struct sk_buff *skb) 337 struct sk_buff *skb, u16 stype)
338{ 338{
339 struct brcmf_event *event_packet; 339 struct brcmf_event *event_packet;
340 u16 usr_stype; 340 u16 subtype, usr_stype;
341 341
342 /* only process events when protocol matches */ 342 /* only process events when protocol matches */
343 if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL)) 343 if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL))
@@ -346,8 +346,16 @@ static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
346 if ((skb->len + ETH_HLEN) < sizeof(*event_packet)) 346 if ((skb->len + ETH_HLEN) < sizeof(*event_packet))
347 return; 347 return;
348 348
349 /* check for BRCM oui match */
350 event_packet = (struct brcmf_event *)skb_mac_header(skb); 349 event_packet = (struct brcmf_event *)skb_mac_header(skb);
350
351 /* check subtype if needed */
352 if (unlikely(stype)) {
353 subtype = get_unaligned_be16(&event_packet->hdr.subtype);
354 if (subtype != stype)
355 return;
356 }
357
358 /* check for BRCM oui match */
351 if (memcmp(BRCM_OUI, &event_packet->hdr.oui[0], 359 if (memcmp(BRCM_OUI, &event_packet->hdr.oui[0],
352 sizeof(event_packet->hdr.oui))) 360 sizeof(event_packet->hdr.oui)))
353 return; 361 return;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
index 802d7cb73b80..8ea27489734e 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
@@ -110,7 +110,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)
110 s32 err, fwerr; 110 s32 err, fwerr;
111 111
112 if (drvr->bus_if->state != BRCMF_BUS_UP) { 112 if (drvr->bus_if->state != BRCMF_BUS_UP) {
113 brcmf_err("bus is down. we have nothing to do.\n"); 113 bphy_err(drvr, "bus is down. we have nothing to do.\n");
114 return -EIO; 114 return -EIO;
115 } 115 }
116 116
@@ -242,7 +242,7 @@ brcmf_fil_iovar_data_set(struct brcmf_if *ifp, char *name, const void *data,
242 buflen, true); 242 buflen, true);
243 } else { 243 } else {
244 err = -EPERM; 244 err = -EPERM;
245 brcmf_err("Creating iovar failed\n"); 245 bphy_err(drvr, "Creating iovar failed\n");
246 } 246 }
247 247
248 mutex_unlock(&drvr->proto_block); 248 mutex_unlock(&drvr->proto_block);
@@ -268,7 +268,7 @@ brcmf_fil_iovar_data_get(struct brcmf_if *ifp, char *name, void *data,
268 memcpy(data, drvr->proto_buf, len); 268 memcpy(data, drvr->proto_buf, len);
269 } else { 269 } else {
270 err = -EPERM; 270 err = -EPERM;
271 brcmf_err("Creating iovar failed\n"); 271 bphy_err(drvr, "Creating iovar failed\n");
272 } 272 }
273 273
274 brcmf_dbg(FIL, "ifidx=%d, name=%s, len=%d\n", ifp->ifidx, name, len); 274 brcmf_dbg(FIL, "ifidx=%d, name=%s, len=%d\n", ifp->ifidx, name, len);
@@ -366,7 +366,7 @@ brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, char *name,
366 buflen, true); 366 buflen, true);
367 } else { 367 } else {
368 err = -EPERM; 368 err = -EPERM;
369 brcmf_err("Creating bsscfg failed\n"); 369 bphy_err(drvr, "Creating bsscfg failed\n");
370 } 370 }
371 371
372 mutex_unlock(&drvr->proto_block); 372 mutex_unlock(&drvr->proto_block);
@@ -392,7 +392,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, char *name,
392 memcpy(data, drvr->proto_buf, len); 392 memcpy(data, drvr->proto_buf, len);
393 } else { 393 } else {
394 err = -EPERM; 394 err = -EPERM;
395 brcmf_err("Creating bsscfg failed\n"); 395 bphy_err(drvr, "Creating bsscfg failed\n");
396 } 396 }
397 brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx, 397 brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
398 ifp->bsscfgidx, name, len); 398 ifp->bsscfgidx, name, len);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
index 02759ebd207c..abeb305492e0 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
@@ -1255,6 +1255,7 @@ static int brcmf_fws_enq(struct brcmf_fws_info *fws,
1255 enum brcmf_fws_skb_state state, int fifo, 1255 enum brcmf_fws_skb_state state, int fifo,
1256 struct sk_buff *p) 1256 struct sk_buff *p)
1257{ 1257{
1258 struct brcmf_pub *drvr = fws->drvr;
1258 int prec = 2 * fifo; 1259 int prec = 2 * fifo;
1259 u32 *qfull_stat = &fws->stats.delayq_full_error; 1260 u32 *qfull_stat = &fws->stats.delayq_full_error;
1260 struct brcmf_fws_mac_descriptor *entry; 1261 struct brcmf_fws_mac_descriptor *entry;
@@ -1267,7 +1268,7 @@ static int brcmf_fws_enq(struct brcmf_fws_info *fws,
1267 1268
1268 entry = brcmf_skbcb(p)->mac; 1269 entry = brcmf_skbcb(p)->mac;
1269 if (entry == NULL) { 1270 if (entry == NULL) {
1270 brcmf_err("no mac descriptor found for skb %p\n", p); 1271 bphy_err(drvr, "no mac descriptor found for skb %p\n", p);
1271 return -ENOENT; 1272 return -ENOENT;
1272 } 1273 }
1273 1274
@@ -1457,6 +1458,7 @@ static int
1457brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, 1458brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot,
1458 u32 genbit, u16 seq, u8 compcnt) 1459 u32 genbit, u16 seq, u8 compcnt)
1459{ 1460{
1461 struct brcmf_pub *drvr = fws->drvr;
1460 u32 fifo; 1462 u32 fifo;
1461 u8 cnt = 0; 1463 u8 cnt = 0;
1462 int ret; 1464 int ret;
@@ -1481,14 +1483,14 @@ brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot,
1481 else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED) 1483 else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED)
1482 fws->stats.txs_host_tossed += compcnt; 1484 fws->stats.txs_host_tossed += compcnt;
1483 else 1485 else
1484 brcmf_err("unexpected txstatus\n"); 1486 bphy_err(drvr, "unexpected txstatus\n");
1485 1487
1486 while (cnt < compcnt) { 1488 while (cnt < compcnt) {
1487 ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, 1489 ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb,
1488 remove_from_hanger); 1490 remove_from_hanger);
1489 if (ret != 0) { 1491 if (ret != 0) {
1490 brcmf_err("no packet in hanger slot: hslot=%d\n", 1492 bphy_err(drvr, "no packet in hanger slot: hslot=%d\n",
1491 hslot); 1493 hslot);
1492 goto cont; 1494 goto cont;
1493 } 1495 }
1494 1496
@@ -1612,12 +1614,13 @@ static int brcmf_fws_notify_credit_map(struct brcmf_if *ifp,
1612 const struct brcmf_event_msg *e, 1614 const struct brcmf_event_msg *e,
1613 void *data) 1615 void *data)
1614{ 1616{
1615 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); 1617 struct brcmf_pub *drvr = ifp->drvr;
1618 struct brcmf_fws_info *fws = drvr_to_fws(drvr);
1616 int i; 1619 int i;
1617 u8 *credits = data; 1620 u8 *credits = data;
1618 1621
1619 if (e->datalen < BRCMF_FWS_FIFO_COUNT) { 1622 if (e->datalen < BRCMF_FWS_FIFO_COUNT) {
1620 brcmf_err("event payload too small (%d)\n", e->datalen); 1623 bphy_err(drvr, "event payload too small (%d)\n", e->datalen);
1621 return -EINVAL; 1624 return -EINVAL;
1622 } 1625 }
1623 1626
@@ -1681,6 +1684,7 @@ static void brcmf_rxreorder_get_skb_list(struct brcmf_ampdu_rx_reorder *rfi,
1681 1684
1682void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt) 1685void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
1683{ 1686{
1687 struct brcmf_pub *drvr = ifp->drvr;
1684 u8 *reorder_data; 1688 u8 *reorder_data;
1685 u8 flow_id, max_idx, cur_idx, exp_idx, end_idx; 1689 u8 flow_id, max_idx, cur_idx, exp_idx, end_idx;
1686 struct brcmf_ampdu_rx_reorder *rfi; 1690 struct brcmf_ampdu_rx_reorder *rfi;
@@ -1695,7 +1699,7 @@ void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
1695 1699
1696 /* validate flags and flow id */ 1700 /* validate flags and flow id */
1697 if (flags == 0xFF) { 1701 if (flags == 0xFF) {
1698 brcmf_err("invalid flags...so ignore this packet\n"); 1702 bphy_err(drvr, "invalid flags...so ignore this packet\n");
1699 brcmf_netif_rx(ifp, pkt); 1703 brcmf_netif_rx(ifp, pkt);
1700 return; 1704 return;
1701 } 1705 }
@@ -1732,7 +1736,7 @@ void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt)
1732 flow_id, max_idx); 1736 flow_id, max_idx);
1733 rfi = kzalloc(buf_size, GFP_ATOMIC); 1737 rfi = kzalloc(buf_size, GFP_ATOMIC);
1734 if (rfi == NULL) { 1738 if (rfi == NULL) {
1735 brcmf_err("failed to alloc buffer\n"); 1739 bphy_err(drvr, "failed to alloc buffer\n");
1736 brcmf_netif_rx(ifp, pkt); 1740 brcmf_netif_rx(ifp, pkt);
1737 return; 1741 return;
1738 } 1742 }
@@ -1996,6 +2000,7 @@ static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
1996static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws, 2000static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws,
1997 struct sk_buff *skb, int fifo) 2001 struct sk_buff *skb, int fifo)
1998{ 2002{
2003 struct brcmf_pub *drvr = fws->drvr;
1999 struct brcmf_fws_mac_descriptor *entry; 2004 struct brcmf_fws_mac_descriptor *entry;
2000 struct sk_buff *pktout; 2005 struct sk_buff *pktout;
2001 int qidx, hslot; 2006 int qidx, hslot;
@@ -2009,11 +2014,11 @@ static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws,
2009 2014
2010 pktout = brcmu_pktq_penq_head(&entry->psq, qidx, skb); 2015 pktout = brcmu_pktq_penq_head(&entry->psq, qidx, skb);
2011 if (pktout == NULL) { 2016 if (pktout == NULL) {
2012 brcmf_err("%s queue %d full\n", entry->name, qidx); 2017 bphy_err(drvr, "%s queue %d full\n", entry->name, qidx);
2013 rc = -ENOSPC; 2018 rc = -ENOSPC;
2014 } 2019 }
2015 } else { 2020 } else {
2016 brcmf_err("%s entry removed\n", entry->name); 2021 bphy_err(drvr, "%s entry removed\n", entry->name);
2017 rc = -ENOENT; 2022 rc = -ENOENT;
2018 } 2023 }
2019 2024
@@ -2118,7 +2123,8 @@ static int brcmf_fws_assign_htod(struct brcmf_fws_info *fws, struct sk_buff *p,
2118 2123
2119int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) 2124int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
2120{ 2125{
2121 struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); 2126 struct brcmf_pub *drvr = ifp->drvr;
2127 struct brcmf_fws_info *fws = drvr_to_fws(drvr);
2122 struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb); 2128 struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb);
2123 struct ethhdr *eh = (struct ethhdr *)(skb->data); 2129 struct ethhdr *eh = (struct ethhdr *)(skb->data);
2124 int fifo = BRCMF_FWS_FIFO_BCMC; 2130 int fifo = BRCMF_FWS_FIFO_BCMC;
@@ -2146,7 +2152,7 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb)
2146 brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb); 2152 brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb);
2147 brcmf_fws_schedule_deq(fws); 2153 brcmf_fws_schedule_deq(fws);
2148 } else { 2154 } else {
2149 brcmf_err("drop skb: no hanger slot\n"); 2155 bphy_err(drvr, "drop skb: no hanger slot\n");
2150 brcmf_txfinalize(ifp, skb, false); 2156 brcmf_txfinalize(ifp, skb, false);
2151 rc = -ENOMEM; 2157 rc = -ENOMEM;
2152 } 2158 }
@@ -2365,7 +2371,7 @@ struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr)
2365 2371
2366 fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); 2372 fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq");
2367 if (fws->fws_wq == NULL) { 2373 if (fws->fws_wq == NULL) {
2368 brcmf_err("workqueue creation failed\n"); 2374 bphy_err(drvr, "workqueue creation failed\n");
2369 rc = -EBADF; 2375 rc = -EBADF;
2370 goto fail; 2376 goto fail;
2371 } 2377 }
@@ -2381,13 +2387,13 @@ struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr)
2381 rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP, 2387 rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP,
2382 brcmf_fws_notify_credit_map); 2388 brcmf_fws_notify_credit_map);
2383 if (rc < 0) { 2389 if (rc < 0) {
2384 brcmf_err("register credit map handler failed\n"); 2390 bphy_err(drvr, "register credit map handler failed\n");
2385 goto fail; 2391 goto fail;
2386 } 2392 }
2387 rc = brcmf_fweh_register(drvr, BRCMF_E_BCMC_CREDIT_SUPPORT, 2393 rc = brcmf_fweh_register(drvr, BRCMF_E_BCMC_CREDIT_SUPPORT,
2388 brcmf_fws_notify_bcmc_credit_support); 2394 brcmf_fws_notify_bcmc_credit_support);
2389 if (rc < 0) { 2395 if (rc < 0) {
2390 brcmf_err("register bcmc credit handler failed\n"); 2396 bphy_err(drvr, "register bcmc credit handler failed\n");
2391 brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP); 2397 brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP);
2392 goto fail; 2398 goto fail;
2393 } 2399 }
@@ -2399,7 +2405,7 @@ struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr)
2399 fws->fw_signals = true; 2405 fws->fw_signals = true;
2400 ifp = brcmf_get_ifp(drvr, 0); 2406 ifp = brcmf_get_ifp(drvr, 0);
2401 if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) { 2407 if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
2402 brcmf_err("failed to set bdcv2 tlv signaling\n"); 2408 bphy_err(drvr, "failed to set bdcv2 tlv signaling\n");
2403 fws->fcmode = BRCMF_FWS_FCMODE_NONE; 2409 fws->fcmode = BRCMF_FWS_FCMODE_NONE;
2404 fws->fw_signals = false; 2410 fws->fw_signals = false;
2405 } 2411 }
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
index 4e8397a0cbc8..aef2d4092872 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
@@ -134,6 +134,14 @@ struct msgbuf_completion_hdr {
134 __le16 flow_ring_id; 134 __le16 flow_ring_id;
135}; 135};
136 136
137/* Data struct for the MSGBUF_TYPE_RING_STATUS */
138struct msgbuf_ring_status {
139 struct msgbuf_common_hdr msg;
140 struct msgbuf_completion_hdr compl_hdr;
141 __le16 write_idx;
142 __le32 rsvd0[5];
143};
144
137struct msgbuf_rx_event { 145struct msgbuf_rx_event {
138 struct msgbuf_common_hdr msg; 146 struct msgbuf_common_hdr msg;
139 struct msgbuf_completion_hdr compl_hdr; 147 struct msgbuf_completion_hdr compl_hdr;
@@ -431,7 +439,7 @@ static int brcmf_msgbuf_tx_ioctl(struct brcmf_pub *drvr, int ifidx,
431 brcmf_commonring_lock(commonring); 439 brcmf_commonring_lock(commonring);
432 ret_ptr = brcmf_commonring_reserve_for_write(commonring); 440 ret_ptr = brcmf_commonring_reserve_for_write(commonring);
433 if (!ret_ptr) { 441 if (!ret_ptr) {
434 brcmf_err("Failed to reserve space in commonring\n"); 442 bphy_err(drvr, "Failed to reserve space in commonring\n");
435 brcmf_commonring_unlock(commonring); 443 brcmf_commonring_unlock(commonring);
436 return -ENOMEM; 444 return -ENOMEM;
437 } 445 }
@@ -495,7 +503,7 @@ static int brcmf_msgbuf_query_dcmd(struct brcmf_pub *drvr, int ifidx,
495 503
496 timeout = brcmf_msgbuf_ioctl_resp_wait(msgbuf); 504 timeout = brcmf_msgbuf_ioctl_resp_wait(msgbuf);
497 if (!timeout) { 505 if (!timeout) {
498 brcmf_err("Timeout on response for query command\n"); 506 bphy_err(drvr, "Timeout on response for query command\n");
499 return -EIO; 507 return -EIO;
500 } 508 }
501 509
@@ -572,6 +580,7 @@ static u32
572brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf, 580brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf,
573 struct brcmf_msgbuf_work_item *work) 581 struct brcmf_msgbuf_work_item *work)
574{ 582{
583 struct brcmf_pub *drvr = msgbuf->drvr;
575 struct msgbuf_tx_flowring_create_req *create; 584 struct msgbuf_tx_flowring_create_req *create;
576 struct brcmf_commonring *commonring; 585 struct brcmf_commonring *commonring;
577 void *ret_ptr; 586 void *ret_ptr;
@@ -587,7 +596,7 @@ brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf,
587 &msgbuf->flowring_dma_handle[flowid], 596 &msgbuf->flowring_dma_handle[flowid],
588 GFP_KERNEL); 597 GFP_KERNEL);
589 if (!dma_buf) { 598 if (!dma_buf) {
590 brcmf_err("dma_alloc_coherent failed\n"); 599 bphy_err(drvr, "dma_alloc_coherent failed\n");
591 brcmf_flowring_delete(msgbuf->flow, flowid); 600 brcmf_flowring_delete(msgbuf->flow, flowid);
592 return BRCMF_FLOWRING_INVALID_ID; 601 return BRCMF_FLOWRING_INVALID_ID;
593 } 602 }
@@ -600,7 +609,7 @@ brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf,
600 brcmf_commonring_lock(commonring); 609 brcmf_commonring_lock(commonring);
601 ret_ptr = brcmf_commonring_reserve_for_write(commonring); 610 ret_ptr = brcmf_commonring_reserve_for_write(commonring);
602 if (!ret_ptr) { 611 if (!ret_ptr) {
603 brcmf_err("Failed to reserve space in commonring\n"); 612 bphy_err(drvr, "Failed to reserve space in commonring\n");
604 brcmf_commonring_unlock(commonring); 613 brcmf_commonring_unlock(commonring);
605 brcmf_msgbuf_remove_flowring(msgbuf, flowid); 614 brcmf_msgbuf_remove_flowring(msgbuf, flowid);
606 return BRCMF_FLOWRING_INVALID_ID; 615 return BRCMF_FLOWRING_INVALID_ID;
@@ -627,7 +636,7 @@ brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf,
627 err = brcmf_commonring_write_complete(commonring); 636 err = brcmf_commonring_write_complete(commonring);
628 brcmf_commonring_unlock(commonring); 637 brcmf_commonring_unlock(commonring);
629 if (err) { 638 if (err) {
630 brcmf_err("Failed to write commonring\n"); 639 bphy_err(drvr, "Failed to write commonring\n");
631 brcmf_msgbuf_remove_flowring(msgbuf, flowid); 640 brcmf_msgbuf_remove_flowring(msgbuf, flowid);
632 return BRCMF_FLOWRING_INVALID_ID; 641 return BRCMF_FLOWRING_INVALID_ID;
633 } 642 }
@@ -686,6 +695,7 @@ static u32 brcmf_msgbuf_flowring_create(struct brcmf_msgbuf *msgbuf, int ifidx,
686static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid) 695static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
687{ 696{
688 struct brcmf_flowring *flow = msgbuf->flow; 697 struct brcmf_flowring *flow = msgbuf->flow;
698 struct brcmf_pub *drvr = msgbuf->drvr;
689 struct brcmf_commonring *commonring; 699 struct brcmf_commonring *commonring;
690 void *ret_ptr; 700 void *ret_ptr;
691 u32 count; 701 u32 count;
@@ -705,8 +715,8 @@ static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
705 while (brcmf_flowring_qlen(flow, flowid)) { 715 while (brcmf_flowring_qlen(flow, flowid)) {
706 skb = brcmf_flowring_dequeue(flow, flowid); 716 skb = brcmf_flowring_dequeue(flow, flowid);
707 if (skb == NULL) { 717 if (skb == NULL) {
708 brcmf_err("No SKB, but qlen %d\n", 718 bphy_err(drvr, "No SKB, but qlen %d\n",
709 brcmf_flowring_qlen(flow, flowid)); 719 brcmf_flowring_qlen(flow, flowid));
710 break; 720 break;
711 } 721 }
712 skb_orphan(skb); 722 skb_orphan(skb);
@@ -714,7 +724,7 @@ static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
714 msgbuf->tx_pktids, skb, ETH_HLEN, 724 msgbuf->tx_pktids, skb, ETH_HLEN,
715 &physaddr, &pktid)) { 725 &physaddr, &pktid)) {
716 brcmf_flowring_reinsert(flow, flowid, skb); 726 brcmf_flowring_reinsert(flow, flowid, skb);
717 brcmf_err("No PKTID available !!\n"); 727 bphy_err(drvr, "No PKTID available !!\n");
718 break; 728 break;
719 } 729 }
720 ret_ptr = brcmf_commonring_reserve_for_write(commonring); 730 ret_ptr = brcmf_commonring_reserve_for_write(commonring);
@@ -885,6 +895,7 @@ brcmf_msgbuf_process_txstatus(struct brcmf_msgbuf *msgbuf, void *buf)
885 895
886static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count) 896static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count)
887{ 897{
898 struct brcmf_pub *drvr = msgbuf->drvr;
888 struct brcmf_commonring *commonring; 899 struct brcmf_commonring *commonring;
889 void *ret_ptr; 900 void *ret_ptr;
890 struct sk_buff *skb; 901 struct sk_buff *skb;
@@ -912,7 +923,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count)
912 skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE); 923 skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE);
913 924
914 if (skb == NULL) { 925 if (skb == NULL) {
915 brcmf_err("Failed to alloc SKB\n"); 926 bphy_err(drvr, "Failed to alloc SKB\n");
916 brcmf_commonring_write_cancel(commonring, alloced - i); 927 brcmf_commonring_write_cancel(commonring, alloced - i);
917 break; 928 break;
918 } 929 }
@@ -922,7 +933,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count)
922 msgbuf->rx_pktids, skb, 0, 933 msgbuf->rx_pktids, skb, 0,
923 &physaddr, &pktid)) { 934 &physaddr, &pktid)) {
924 dev_kfree_skb_any(skb); 935 dev_kfree_skb_any(skb);
925 brcmf_err("No PKTID available !!\n"); 936 bphy_err(drvr, "No PKTID available !!\n");
926 brcmf_commonring_write_cancel(commonring, alloced - i); 937 brcmf_commonring_write_cancel(commonring, alloced - i);
927 break; 938 break;
928 } 939 }
@@ -992,6 +1003,7 @@ static u32
992brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf, 1003brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf,
993 u32 count) 1004 u32 count)
994{ 1005{
1006 struct brcmf_pub *drvr = msgbuf->drvr;
995 struct brcmf_commonring *commonring; 1007 struct brcmf_commonring *commonring;
996 void *ret_ptr; 1008 void *ret_ptr;
997 struct sk_buff *skb; 1009 struct sk_buff *skb;
@@ -1009,7 +1021,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf,
1009 count, 1021 count,
1010 &alloced); 1022 &alloced);
1011 if (!ret_ptr) { 1023 if (!ret_ptr) {
1012 brcmf_err("Failed to reserve space in commonring\n"); 1024 bphy_err(drvr, "Failed to reserve space in commonring\n");
1013 brcmf_commonring_unlock(commonring); 1025 brcmf_commonring_unlock(commonring);
1014 return 0; 1026 return 0;
1015 } 1027 }
@@ -1021,7 +1033,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf,
1021 skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE); 1033 skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE);
1022 1034
1023 if (skb == NULL) { 1035 if (skb == NULL) {
1024 brcmf_err("Failed to alloc SKB\n"); 1036 bphy_err(drvr, "Failed to alloc SKB\n");
1025 brcmf_commonring_write_cancel(commonring, alloced - i); 1037 brcmf_commonring_write_cancel(commonring, alloced - i);
1026 break; 1038 break;
1027 } 1039 }
@@ -1031,7 +1043,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf,
1031 msgbuf->rx_pktids, skb, 0, 1043 msgbuf->rx_pktids, skb, 0,
1032 &physaddr, &pktid)) { 1044 &physaddr, &pktid)) {
1033 dev_kfree_skb_any(skb); 1045 dev_kfree_skb_any(skb);
1034 brcmf_err("No PKTID available !!\n"); 1046 bphy_err(drvr, "No PKTID available !!\n");
1035 brcmf_commonring_write_cancel(commonring, alloced - i); 1047 brcmf_commonring_write_cancel(commonring, alloced - i);
1036 break; 1048 break;
1037 } 1049 }
@@ -1083,6 +1095,7 @@ static void brcmf_msgbuf_rxbuf_event_post(struct brcmf_msgbuf *msgbuf)
1083 1095
1084static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf) 1096static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
1085{ 1097{
1098 struct brcmf_pub *drvr = msgbuf->drvr;
1086 struct msgbuf_rx_event *event; 1099 struct msgbuf_rx_event *event;
1087 u32 idx; 1100 u32 idx;
1088 u16 buflen; 1101 u16 buflen;
@@ -1109,14 +1122,14 @@ static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf)
1109 1122
1110 ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx); 1123 ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx);
1111 if (!ifp || !ifp->ndev) { 1124 if (!ifp || !ifp->ndev) {
1112 brcmf_err("Received pkt for invalid ifidx %d\n", 1125 bphy_err(drvr, "Received pkt for invalid ifidx %d\n",
1113 event->msg.ifidx); 1126 event->msg.ifidx);
1114 goto exit; 1127 goto exit;
1115 } 1128 }
1116 1129
1117 skb->protocol = eth_type_trans(skb, ifp->ndev); 1130 skb->protocol = eth_type_trans(skb, ifp->ndev);
1118 1131
1119 brcmf_fweh_process_skb(ifp->drvr, skb); 1132 brcmf_fweh_process_skb(ifp->drvr, skb, 0);
1120 1133
1121exit: 1134exit:
1122 brcmu_pkt_buf_free_skb(skb); 1135 brcmu_pkt_buf_free_skb(skb);
@@ -1126,6 +1139,7 @@ exit:
1126static void 1139static void
1127brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) 1140brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
1128{ 1141{
1142 struct brcmf_pub *drvr = msgbuf->drvr;
1129 struct msgbuf_rx_complete *rx_complete; 1143 struct msgbuf_rx_complete *rx_complete;
1130 struct sk_buff *skb; 1144 struct sk_buff *skb;
1131 u16 data_offset; 1145 u16 data_offset;
@@ -1159,7 +1173,7 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
1159 ifp = msgbuf->drvr->mon_if; 1173 ifp = msgbuf->drvr->mon_if;
1160 1174
1161 if (!ifp) { 1175 if (!ifp) {
1162 brcmf_err("Received unexpected monitor pkt\n"); 1176 bphy_err(drvr, "Received unexpected monitor pkt\n");
1163 brcmu_pkt_buf_free_skb(skb); 1177 brcmu_pkt_buf_free_skb(skb);
1164 return; 1178 return;
1165 } 1179 }
@@ -1170,8 +1184,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
1170 1184
1171 ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx); 1185 ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx);
1172 if (!ifp || !ifp->ndev) { 1186 if (!ifp || !ifp->ndev) {
1173 brcmf_err("Received pkt for invalid ifidx %d\n", 1187 bphy_err(drvr, "Received pkt for invalid ifidx %d\n",
1174 rx_complete->msg.ifidx); 1188 rx_complete->msg.ifidx);
1175 brcmu_pkt_buf_free_skb(skb); 1189 brcmu_pkt_buf_free_skb(skb);
1176 return; 1190 return;
1177 } 1191 }
@@ -1180,11 +1194,27 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
1180 brcmf_netif_rx(ifp, skb); 1194 brcmf_netif_rx(ifp, skb);
1181} 1195}
1182 1196
1197static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf,
1198 void *buf)
1199{
1200 struct msgbuf_ring_status *ring_status = buf;
1201 struct brcmf_pub *drvr = msgbuf->drvr;
1202 int err;
1203
1204 err = le16_to_cpu(ring_status->compl_hdr.status);
1205 if (err) {
1206 int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id);
1207
1208 bphy_err(drvr, "Firmware reported ring %d error: %d\n", ring,
1209 err);
1210 }
1211}
1183 1212
1184static void 1213static void
1185brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf, 1214brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
1186 void *buf) 1215 void *buf)
1187{ 1216{
1217 struct brcmf_pub *drvr = msgbuf->drvr;
1188 struct msgbuf_flowring_create_resp *flowring_create_resp; 1218 struct msgbuf_flowring_create_resp *flowring_create_resp;
1189 u16 status; 1219 u16 status;
1190 u16 flowid; 1220 u16 flowid;
@@ -1196,7 +1226,7 @@ brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf,
1196 status = le16_to_cpu(flowring_create_resp->compl_hdr.status); 1226 status = le16_to_cpu(flowring_create_resp->compl_hdr.status);
1197 1227
1198 if (status) { 1228 if (status) {
1199 brcmf_err("Flowring creation failed, code %d\n", status); 1229 bphy_err(drvr, "Flowring creation failed, code %d\n", status);
1200 brcmf_msgbuf_remove_flowring(msgbuf, flowid); 1230 brcmf_msgbuf_remove_flowring(msgbuf, flowid);
1201 return; 1231 return;
1202 } 1232 }
@@ -1213,6 +1243,7 @@ static void
1213brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf, 1243brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf,
1214 void *buf) 1244 void *buf)
1215{ 1245{
1246 struct brcmf_pub *drvr = msgbuf->drvr;
1216 struct msgbuf_flowring_delete_resp *flowring_delete_resp; 1247 struct msgbuf_flowring_delete_resp *flowring_delete_resp;
1217 u16 status; 1248 u16 status;
1218 u16 flowid; 1249 u16 flowid;
@@ -1224,7 +1255,7 @@ brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf,
1224 status = le16_to_cpu(flowring_delete_resp->compl_hdr.status); 1255 status = le16_to_cpu(flowring_delete_resp->compl_hdr.status);
1225 1256
1226 if (status) { 1257 if (status) {
1227 brcmf_err("Flowring deletion failed, code %d\n", status); 1258 bphy_err(drvr, "Flowring deletion failed, code %d\n", status);
1228 brcmf_flowring_delete(msgbuf->flow, flowid); 1259 brcmf_flowring_delete(msgbuf->flow, flowid);
1229 return; 1260 return;
1230 } 1261 }
@@ -1237,10 +1268,15 @@ brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf,
1237 1268
1238static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf) 1269static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf)
1239{ 1270{
1271 struct brcmf_pub *drvr = msgbuf->drvr;
1240 struct msgbuf_common_hdr *msg; 1272 struct msgbuf_common_hdr *msg;
1241 1273
1242 msg = (struct msgbuf_common_hdr *)buf; 1274 msg = (struct msgbuf_common_hdr *)buf;
1243 switch (msg->msgtype) { 1275 switch (msg->msgtype) {
1276 case MSGBUF_TYPE_RING_STATUS:
1277 brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n");
1278 brcmf_msgbuf_process_ring_status(msgbuf, buf);
1279 break;
1244 case MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT: 1280 case MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT:
1245 brcmf_dbg(MSGBUF, "MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT\n"); 1281 brcmf_dbg(MSGBUF, "MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT\n");
1246 brcmf_msgbuf_process_flow_ring_create_response(msgbuf, buf); 1282 brcmf_msgbuf_process_flow_ring_create_response(msgbuf, buf);
@@ -1269,7 +1305,7 @@ static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf)
1269 brcmf_msgbuf_process_rx_complete(msgbuf, buf); 1305 brcmf_msgbuf_process_rx_complete(msgbuf, buf);
1270 break; 1306 break;
1271 default: 1307 default:
1272 brcmf_err("Unsupported msgtype %d\n", msg->msgtype); 1308 bphy_err(drvr, "Unsupported msgtype %d\n", msg->msgtype);
1273 break; 1309 break;
1274 } 1310 }
1275} 1311}
@@ -1352,7 +1388,7 @@ void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
1352 brcmf_commonring_lock(commonring); 1388 brcmf_commonring_lock(commonring);
1353 ret_ptr = brcmf_commonring_reserve_for_write(commonring); 1389 ret_ptr = brcmf_commonring_reserve_for_write(commonring);
1354 if (!ret_ptr) { 1390 if (!ret_ptr) {
1355 brcmf_err("FW unaware, flowring will be removed !!\n"); 1391 bphy_err(drvr, "FW unaware, flowring will be removed !!\n");
1356 brcmf_commonring_unlock(commonring); 1392 brcmf_commonring_unlock(commonring);
1357 brcmf_msgbuf_remove_flowring(msgbuf, flowid); 1393 brcmf_msgbuf_remove_flowring(msgbuf, flowid);
1358 return; 1394 return;
@@ -1376,7 +1412,7 @@ void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
1376 err = brcmf_commonring_write_complete(commonring); 1412 err = brcmf_commonring_write_complete(commonring);
1377 brcmf_commonring_unlock(commonring); 1413 brcmf_commonring_unlock(commonring);
1378 if (err) { 1414 if (err) {
1379 brcmf_err("Failed to submit RING_DELETE, flowring will be removed\n"); 1415 bphy_err(drvr, "Failed to submit RING_DELETE, flowring will be removed\n");
1380 brcmf_msgbuf_remove_flowring(msgbuf, flowid); 1416 brcmf_msgbuf_remove_flowring(msgbuf, flowid);
1381 } 1417 }
1382} 1418}
@@ -1451,8 +1487,8 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
1451 if_msgbuf = drvr->bus_if->msgbuf; 1487 if_msgbuf = drvr->bus_if->msgbuf;
1452 1488
1453 if (if_msgbuf->max_flowrings >= BRCMF_FLOWRING_HASHSIZE) { 1489 if (if_msgbuf->max_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
1454 brcmf_err("driver not configured for this many flowrings %d\n", 1490 bphy_err(drvr, "driver not configured for this many flowrings %d\n",
1455 if_msgbuf->max_flowrings); 1491 if_msgbuf->max_flowrings);
1456 if_msgbuf->max_flowrings = BRCMF_FLOWRING_HASHSIZE - 1; 1492 if_msgbuf->max_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
1457 } 1493 }
1458 1494
@@ -1462,7 +1498,7 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
1462 1498
1463 msgbuf->txflow_wq = create_singlethread_workqueue("msgbuf_txflow"); 1499 msgbuf->txflow_wq = create_singlethread_workqueue("msgbuf_txflow");
1464 if (msgbuf->txflow_wq == NULL) { 1500 if (msgbuf->txflow_wq == NULL) {
1465 brcmf_err("workqueue creation failed\n"); 1501 bphy_err(drvr, "workqueue creation failed\n");
1466 goto fail; 1502 goto fail;
1467 } 1503 }
1468 INIT_WORK(&msgbuf->txflow_work, brcmf_msgbuf_txflow_worker); 1504 INIT_WORK(&msgbuf->txflow_work, brcmf_msgbuf_txflow_worker);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
index 456a1bf008b3..73a0e550f2b2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -434,6 +434,7 @@ static void brcmf_p2p_print_actframe(bool tx, void *frame, u32 frame_len)
434 */ 434 */
435static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) 435static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
436{ 436{
437 struct brcmf_pub *drvr = ifp->drvr;
437 s32 ret = 0; 438 s32 ret = 0;
438 439
439 brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); 440 brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
@@ -450,7 +451,7 @@ static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
450 ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac, 451 ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac,
451 ETH_ALEN); 452 ETH_ALEN);
452 if (ret) 453 if (ret)
453 brcmf_err("failed to update device address ret %d\n", ret); 454 bphy_err(drvr, "failed to update device address ret %d\n", ret);
454 455
455 return ret; 456 return ret;
456} 457}
@@ -570,13 +571,14 @@ static s32 brcmf_p2p_deinit_discovery(struct brcmf_p2p_info *p2p)
570 */ 571 */
571static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p) 572static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p)
572{ 573{
574 struct brcmf_pub *drvr = p2p->cfg->pub;
573 struct brcmf_cfg80211_vif *vif; 575 struct brcmf_cfg80211_vif *vif;
574 s32 ret = 0; 576 s32 ret = 0;
575 577
576 brcmf_dbg(TRACE, "enter\n"); 578 brcmf_dbg(TRACE, "enter\n");
577 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; 579 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
578 if (!vif) { 580 if (!vif) {
579 brcmf_err("P2P config device not available\n"); 581 bphy_err(drvr, "P2P config device not available\n");
580 ret = -EPERM; 582 ret = -EPERM;
581 goto exit; 583 goto exit;
582 } 584 }
@@ -590,13 +592,13 @@ static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p)
590 vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; 592 vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
591 ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1); 593 ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1);
592 if (ret < 0) { 594 if (ret < 0) {
593 brcmf_err("set p2p_disc error\n"); 595 bphy_err(drvr, "set p2p_disc error\n");
594 goto exit; 596 goto exit;
595 } 597 }
596 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; 598 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
597 ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0); 599 ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0);
598 if (ret < 0) { 600 if (ret < 0) {
599 brcmf_err("unable to set WL_P2P_DISC_ST_SCAN\n"); 601 bphy_err(drvr, "unable to set WL_P2P_DISC_ST_SCAN\n");
600 goto exit; 602 goto exit;
601 } 603 }
602 604
@@ -608,7 +610,7 @@ static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p)
608 */ 610 */
609 ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED); 611 ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED);
610 if (ret < 0) { 612 if (ret < 0) {
611 brcmf_err("wsec error %d\n", ret); 613 bphy_err(drvr, "wsec error %d\n", ret);
612 goto exit; 614 goto exit;
613 } 615 }
614 616
@@ -630,6 +632,7 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
630 u16 chanspecs[], s32 search_state, 632 u16 chanspecs[], s32 search_state,
631 enum p2p_bss_type bss_type) 633 enum p2p_bss_type bss_type)
632{ 634{
635 struct brcmf_pub *drvr = p2p->cfg->pub;
633 s32 ret = 0; 636 s32 ret = 0;
634 s32 memsize = offsetof(struct brcmf_p2p_scan_le, 637 s32 memsize = offsetof(struct brcmf_p2p_scan_le,
635 eparams.params_le.channel_list); 638 eparams.params_le.channel_list);
@@ -648,7 +651,7 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
648 651
649 vif = p2p->bss_idx[bss_type].vif; 652 vif = p2p->bss_idx[bss_type].vif;
650 if (vif == NULL) { 653 if (vif == NULL) {
651 brcmf_err("no vif for bss type %d\n", bss_type); 654 bphy_err(drvr, "no vif for bss type %d\n", bss_type);
652 ret = -EINVAL; 655 ret = -EINVAL;
653 goto exit; 656 goto exit;
654 } 657 }
@@ -676,7 +679,7 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
676 BRCMF_P2P_WILDCARD_SSID_LEN); 679 BRCMF_P2P_WILDCARD_SSID_LEN);
677 break; 680 break;
678 default: 681 default:
679 brcmf_err(" invalid search state %d\n", search_state); 682 bphy_err(drvr, " invalid search state %d\n", search_state);
680 ret = -EINVAL; 683 ret = -EINVAL;
681 goto exit; 684 goto exit;
682 } 685 }
@@ -760,6 +763,7 @@ static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg,
760 struct cfg80211_scan_request *request) 763 struct cfg80211_scan_request *request)
761{ 764{
762 struct brcmf_p2p_info *p2p = &cfg->p2p; 765 struct brcmf_p2p_info *p2p = &cfg->p2p;
766 struct brcmf_pub *drvr = cfg->pub;
763 s32 err = 0; 767 s32 err = 0;
764 s32 search_state = WL_P2P_DISC_ST_SCAN; 768 s32 search_state = WL_P2P_DISC_ST_SCAN;
765 struct brcmf_cfg80211_vif *vif; 769 struct brcmf_cfg80211_vif *vif;
@@ -822,7 +826,7 @@ static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg,
822 } 826 }
823exit: 827exit:
824 if (err) 828 if (err)
825 brcmf_err("error (%d)\n", err); 829 bphy_err(drvr, "error (%d)\n", err);
826 return err; 830 return err;
827} 831}
828 832
@@ -917,19 +921,20 @@ int brcmf_p2p_scan_prep(struct wiphy *wiphy,
917static s32 921static s32
918brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration) 922brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration)
919{ 923{
924 struct brcmf_pub *drvr = p2p->cfg->pub;
920 struct brcmf_cfg80211_vif *vif; 925 struct brcmf_cfg80211_vif *vif;
921 struct brcmu_chan ch; 926 struct brcmu_chan ch;
922 s32 err = 0; 927 s32 err = 0;
923 928
924 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; 929 vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
925 if (!vif) { 930 if (!vif) {
926 brcmf_err("Discovery is not set, so we have nothing to do\n"); 931 bphy_err(drvr, "Discovery is not set, so we have nothing to do\n");
927 err = -EPERM; 932 err = -EPERM;
928 goto exit; 933 goto exit;
929 } 934 }
930 935
931 if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) { 936 if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) {
932 brcmf_err("Previous LISTEN is not completed yet\n"); 937 bphy_err(drvr, "Previous LISTEN is not completed yet\n");
933 /* WAR: prevent cookie mismatch in wpa_supplicant return OK */ 938 /* WAR: prevent cookie mismatch in wpa_supplicant return OK */
934 goto exit; 939 goto exit;
935 } 940 }
@@ -1046,6 +1051,7 @@ void brcmf_p2p_cancel_remain_on_channel(struct brcmf_if *ifp)
1046 */ 1051 */
1047static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel) 1052static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
1048{ 1053{
1054 struct brcmf_pub *drvr = p2p->cfg->pub;
1049 s32 err; 1055 s32 err;
1050 u32 channel_cnt; 1056 u32 channel_cnt;
1051 u16 *default_chan_list; 1057 u16 *default_chan_list;
@@ -1061,7 +1067,7 @@ static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
1061 default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list), 1067 default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list),
1062 GFP_KERNEL); 1068 GFP_KERNEL);
1063 if (default_chan_list == NULL) { 1069 if (default_chan_list == NULL) {
1064 brcmf_err("channel list allocation failed\n"); 1070 bphy_err(drvr, "channel list allocation failed\n");
1065 err = -ENOMEM; 1071 err = -ENOMEM;
1066 goto exit; 1072 goto exit;
1067 } 1073 }
@@ -1103,6 +1109,7 @@ static void brcmf_p2p_afx_handler(struct work_struct *work)
1103 struct brcmf_p2p_info *p2p = container_of(afx_hdl, 1109 struct brcmf_p2p_info *p2p = container_of(afx_hdl,
1104 struct brcmf_p2p_info, 1110 struct brcmf_p2p_info,
1105 afx_hdl); 1111 afx_hdl);
1112 struct brcmf_pub *drvr = p2p->cfg->pub;
1106 s32 err; 1113 s32 err;
1107 1114
1108 if (!afx_hdl->is_active) 1115 if (!afx_hdl->is_active)
@@ -1116,7 +1123,7 @@ static void brcmf_p2p_afx_handler(struct work_struct *work)
1116 err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan); 1123 err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan);
1117 1124
1118 if (err) { 1125 if (err) {
1119 brcmf_err("ERROR occurred! value is (%d)\n", err); 1126 bphy_err(drvr, "ERROR occurred! value is (%d)\n", err);
1120 if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, 1127 if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
1121 &p2p->status)) 1128 &p2p->status))
1122 complete(&afx_hdl->act_frm_scan); 1129 complete(&afx_hdl->act_frm_scan);
@@ -1338,7 +1345,8 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
1338 const struct brcmf_event_msg *e, 1345 const struct brcmf_event_msg *e,
1339 void *data) 1346 void *data)
1340{ 1347{
1341 struct brcmf_cfg80211_info *cfg = ifp->drvr->config; 1348 struct brcmf_pub *drvr = ifp->drvr;
1349 struct brcmf_cfg80211_info *cfg = drvr->config;
1342 struct brcmf_p2p_info *p2p = &cfg->p2p; 1350 struct brcmf_p2p_info *p2p = &cfg->p2p;
1343 struct afx_hdl *afx_hdl = &p2p->afx_hdl; 1351 struct afx_hdl *afx_hdl = &p2p->afx_hdl;
1344 struct wireless_dev *wdev; 1352 struct wireless_dev *wdev;
@@ -1409,7 +1417,7 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
1409 mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) + 1417 mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) +
1410 mgmt_frame_len, GFP_KERNEL); 1418 mgmt_frame_len, GFP_KERNEL);
1411 if (!mgmt_frame) { 1419 if (!mgmt_frame) {
1412 brcmf_err("No memory available for action frame\n"); 1420 bphy_err(drvr, "No memory available for action frame\n");
1413 return -ENOMEM; 1421 return -ENOMEM;
1414 } 1422 }
1415 memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN); 1423 memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN);
@@ -1492,6 +1500,7 @@ int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp,
1492static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p, 1500static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
1493 struct brcmf_fil_af_params_le *af_params) 1501 struct brcmf_fil_af_params_le *af_params)
1494{ 1502{
1503 struct brcmf_pub *drvr = p2p->cfg->pub;
1495 struct brcmf_cfg80211_vif *vif; 1504 struct brcmf_cfg80211_vif *vif;
1496 s32 err = 0; 1505 s32 err = 0;
1497 s32 timeout = 0; 1506 s32 timeout = 0;
@@ -1506,7 +1515,7 @@ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p,
1506 err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params, 1515 err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params,
1507 sizeof(*af_params)); 1516 sizeof(*af_params));
1508 if (err) { 1517 if (err) {
1509 brcmf_err(" sending action frame has failed\n"); 1518 bphy_err(drvr, " sending action frame has failed\n");
1510 goto exit; 1519 goto exit;
1511 } 1520 }
1512 1521
@@ -1556,6 +1565,7 @@ static s32 brcmf_p2p_pub_af_tx(struct brcmf_cfg80211_info *cfg,
1556 struct brcmf_config_af_params *config_af_params) 1565 struct brcmf_config_af_params *config_af_params)
1557{ 1566{
1558 struct brcmf_p2p_info *p2p = &cfg->p2p; 1567 struct brcmf_p2p_info *p2p = &cfg->p2p;
1568 struct brcmf_pub *drvr = cfg->pub;
1559 struct brcmf_fil_action_frame_le *action_frame; 1569 struct brcmf_fil_action_frame_le *action_frame;
1560 struct brcmf_p2p_pub_act_frame *act_frm; 1570 struct brcmf_p2p_pub_act_frame *act_frm;
1561 s32 err = 0; 1571 s32 err = 0;
@@ -1634,8 +1644,8 @@ static s32 brcmf_p2p_pub_af_tx(struct brcmf_cfg80211_info *cfg,
1634 config_af_params->extra_listen = false; 1644 config_af_params->extra_listen = false;
1635 break; 1645 break;
1636 default: 1646 default:
1637 brcmf_err("Unknown p2p pub act frame subtype: %d\n", 1647 bphy_err(drvr, "Unknown p2p pub act frame subtype: %d\n",
1638 act_frm->subtype); 1648 act_frm->subtype);
1639 err = -EINVAL; 1649 err = -EINVAL;
1640 } 1650 }
1641 return err; 1651 return err;
@@ -1657,6 +1667,7 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1657 struct brcmf_fil_action_frame_le *action_frame; 1667 struct brcmf_fil_action_frame_le *action_frame;
1658 struct brcmf_config_af_params config_af_params; 1668 struct brcmf_config_af_params config_af_params;
1659 struct afx_hdl *afx_hdl = &p2p->afx_hdl; 1669 struct afx_hdl *afx_hdl = &p2p->afx_hdl;
1670 struct brcmf_pub *drvr = cfg->pub;
1660 u16 action_frame_len; 1671 u16 action_frame_len;
1661 bool ack = false; 1672 bool ack = false;
1662 u8 category; 1673 u8 category;
@@ -1692,7 +1703,7 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1692 if (brcmf_p2p_pub_af_tx(cfg, af_params, &config_af_params)) { 1703 if (brcmf_p2p_pub_af_tx(cfg, af_params, &config_af_params)) {
1693 /* Just send unknown subtype frame with */ 1704 /* Just send unknown subtype frame with */
1694 /* default parameters. */ 1705 /* default parameters. */
1695 brcmf_err("P2P Public action frame, unknown subtype.\n"); 1706 bphy_err(drvr, "P2P Public action frame, unknown subtype.\n");
1696 } 1707 }
1697 } else if (brcmf_p2p_is_gas_action(action_frame->data, 1708 } else if (brcmf_p2p_is_gas_action(action_frame->data,
1698 action_frame_len)) { 1709 action_frame_len)) {
@@ -1714,7 +1725,7 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1714 af_params->dwell_time = 1725 af_params->dwell_time =
1715 cpu_to_le32(P2P_AF_MIN_DWELL_TIME); 1726 cpu_to_le32(P2P_AF_MIN_DWELL_TIME);
1716 } else { 1727 } else {
1717 brcmf_err("Unknown action type: %d\n", action); 1728 bphy_err(drvr, "Unknown action type: %d\n", action);
1718 goto exit; 1729 goto exit;
1719 } 1730 }
1720 } else if (brcmf_p2p_is_p2p_action(action_frame->data, 1731 } else if (brcmf_p2p_is_p2p_action(action_frame->data,
@@ -1722,8 +1733,8 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1722 /* do not configure anything. it will be */ 1733 /* do not configure anything. it will be */
1723 /* sent with a default configuration */ 1734 /* sent with a default configuration */
1724 } else { 1735 } else {
1725 brcmf_err("Unknown Frame: category 0x%x, action 0x%x\n", 1736 bphy_err(drvr, "Unknown Frame: category 0x%x, action 0x%x\n",
1726 category, action); 1737 category, action);
1727 return false; 1738 return false;
1728 } 1739 }
1729 1740
@@ -1761,7 +1772,7 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1761 1772
1762 if (brcmf_p2p_af_searching_channel(p2p) == 1773 if (brcmf_p2p_af_searching_channel(p2p) ==
1763 P2P_INVALID_CHANNEL) { 1774 P2P_INVALID_CHANNEL) {
1764 brcmf_err("Couldn't find peer's channel.\n"); 1775 bphy_err(drvr, "Couldn't find peer's channel.\n");
1765 goto exit; 1776 goto exit;
1766 } 1777 }
1767 1778
@@ -1783,7 +1794,8 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
1783 tx_retry++; 1794 tx_retry++;
1784 } 1795 }
1785 if (ack == false) { 1796 if (ack == false) {
1786 brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry); 1797 bphy_err(drvr, "Failed to send Action Frame(retry %d)\n",
1798 tx_retry);
1787 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); 1799 clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
1788 } 1800 }
1789 1801
@@ -1965,6 +1977,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
1965 enum brcmf_fil_p2p_if_types if_type) 1977 enum brcmf_fil_p2p_if_types if_type)
1966{ 1978{
1967 struct brcmf_p2p_info *p2p = &cfg->p2p; 1979 struct brcmf_p2p_info *p2p = &cfg->p2p;
1980 struct brcmf_pub *drvr = cfg->pub;
1968 struct brcmf_cfg80211_vif *vif; 1981 struct brcmf_cfg80211_vif *vif;
1969 struct brcmf_fil_p2p_if_le if_request; 1982 struct brcmf_fil_p2p_if_le if_request;
1970 s32 err; 1983 s32 err;
@@ -1974,13 +1987,13 @@ int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
1974 1987
1975 vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; 1988 vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif;
1976 if (!vif) { 1989 if (!vif) {
1977 brcmf_err("vif for P2PAPI_BSSCFG_PRIMARY does not exist\n"); 1990 bphy_err(drvr, "vif for P2PAPI_BSSCFG_PRIMARY does not exist\n");
1978 return -EPERM; 1991 return -EPERM;
1979 } 1992 }
1980 brcmf_notify_escan_complete(cfg, vif->ifp, true, true); 1993 brcmf_notify_escan_complete(cfg, vif->ifp, true, true);
1981 vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; 1994 vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif;
1982 if (!vif) { 1995 if (!vif) {
1983 brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n"); 1996 bphy_err(drvr, "vif for P2PAPI_BSSCFG_CONNECTION does not exist\n");
1984 return -EPERM; 1997 return -EPERM;
1985 } 1998 }
1986 brcmf_set_mpc(vif->ifp, 0); 1999 brcmf_set_mpc(vif->ifp, 0);
@@ -1998,7 +2011,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
1998 err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request, 2011 err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request,
1999 sizeof(if_request)); 2012 sizeof(if_request));
2000 if (err) { 2013 if (err) {
2001 brcmf_err("p2p_ifupd FAILED, err=%d\n", err); 2014 bphy_err(drvr, "p2p_ifupd FAILED, err=%d\n", err);
2002 brcmf_cfg80211_arm_vif_event(cfg, NULL); 2015 brcmf_cfg80211_arm_vif_event(cfg, NULL);
2003 return err; 2016 return err;
2004 } 2017 }
@@ -2006,7 +2019,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
2006 BRCMF_VIF_EVENT_TIMEOUT); 2019 BRCMF_VIF_EVENT_TIMEOUT);
2007 brcmf_cfg80211_arm_vif_event(cfg, NULL); 2020 brcmf_cfg80211_arm_vif_event(cfg, NULL);
2008 if (!err) { 2021 if (!err) {
2009 brcmf_err("No BRCMF_E_IF_CHANGE event received\n"); 2022 bphy_err(drvr, "No BRCMF_E_IF_CHANGE event received\n");
2010 return -EIO; 2023 return -EIO;
2011 } 2024 }
2012 2025
@@ -2069,6 +2082,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
2069 struct wiphy *wiphy, 2082 struct wiphy *wiphy,
2070 u8 *addr) 2083 u8 *addr)
2071{ 2084{
2085 struct brcmf_pub *drvr = p2p->cfg->pub;
2072 struct brcmf_cfg80211_vif *p2p_vif; 2086 struct brcmf_cfg80211_vif *p2p_vif;
2073 struct brcmf_if *p2p_ifp; 2087 struct brcmf_if *p2p_ifp;
2074 struct brcmf_if *pri_ifp; 2088 struct brcmf_if *pri_ifp;
@@ -2080,7 +2094,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
2080 2094
2081 p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE); 2095 p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE);
2082 if (IS_ERR(p2p_vif)) { 2096 if (IS_ERR(p2p_vif)) {
2083 brcmf_err("could not create discovery vif\n"); 2097 bphy_err(drvr, "could not create discovery vif\n");
2084 return (struct wireless_dev *)p2p_vif; 2098 return (struct wireless_dev *)p2p_vif;
2085 } 2099 }
2086 2100
@@ -2088,7 +2102,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
2088 2102
2089 /* firmware requires unique mac address for p2pdev interface */ 2103 /* firmware requires unique mac address for p2pdev interface */
2090 if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) { 2104 if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) {
2091 brcmf_err("discovery vif must be different from primary interface\n"); 2105 bphy_err(drvr, "discovery vif must be different from primary interface\n");
2092 return ERR_PTR(-EINVAL); 2106 return ERR_PTR(-EINVAL);
2093 } 2107 }
2094 2108
@@ -2101,7 +2115,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
2101 /* Initialize P2P Discovery in the firmware */ 2115 /* Initialize P2P Discovery in the firmware */
2102 err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); 2116 err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
2103 if (err < 0) { 2117 if (err < 0) {
2104 brcmf_err("set p2p_disc error\n"); 2118 bphy_err(drvr, "set p2p_disc error\n");
2105 brcmf_fweh_p2pdev_setup(pri_ifp, false); 2119 brcmf_fweh_p2pdev_setup(pri_ifp, false);
2106 brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); 2120 brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
2107 goto fail; 2121 goto fail;
@@ -2113,7 +2127,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
2113 brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); 2127 brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
2114 brcmf_fweh_p2pdev_setup(pri_ifp, false); 2128 brcmf_fweh_p2pdev_setup(pri_ifp, false);
2115 if (!err) { 2129 if (!err) {
2116 brcmf_err("timeout occurred\n"); 2130 bphy_err(drvr, "timeout occurred\n");
2117 err = -EIO; 2131 err = -EIO;
2118 goto fail; 2132 goto fail;
2119 } 2133 }
@@ -2127,7 +2141,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
2127 /* verify bsscfg index for P2P discovery */ 2141 /* verify bsscfg index for P2P discovery */
2128 err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx); 2142 err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx);
2129 if (err < 0) { 2143 if (err < 0) {
2130 brcmf_err("retrieving discover bsscfg index failed\n"); 2144 bphy_err(drvr, "retrieving discover bsscfg index failed\n");
2131 goto fail; 2145 goto fail;
2132 } 2146 }
2133 2147
@@ -2161,6 +2175,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
2161{ 2175{
2162 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 2176 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2163 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); 2177 struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
2178 struct brcmf_pub *drvr = cfg->pub;
2164 struct brcmf_cfg80211_vif *vif; 2179 struct brcmf_cfg80211_vif *vif;
2165 enum brcmf_fil_p2p_if_types iftype; 2180 enum brcmf_fil_p2p_if_types iftype;
2166 int err; 2181 int err;
@@ -2201,7 +2216,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
2201 BRCMF_VIF_EVENT_TIMEOUT); 2216 BRCMF_VIF_EVENT_TIMEOUT);
2202 brcmf_cfg80211_arm_vif_event(cfg, NULL); 2217 brcmf_cfg80211_arm_vif_event(cfg, NULL);
2203 if (!err) { 2218 if (!err) {
2204 brcmf_err("timeout occurred\n"); 2219 bphy_err(drvr, "timeout occurred\n");
2205 err = -EIO; 2220 err = -EIO;
2206 goto fail; 2221 goto fail;
2207 } 2222 }
@@ -2209,7 +2224,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
2209 /* interface created in firmware */ 2224 /* interface created in firmware */
2210 ifp = vif->ifp; 2225 ifp = vif->ifp;
2211 if (!ifp) { 2226 if (!ifp) {
2212 brcmf_err("no if pointer provided\n"); 2227 bphy_err(drvr, "no if pointer provided\n");
2213 err = -ENOENT; 2228 err = -ENOENT;
2214 goto fail; 2229 goto fail;
2215 } 2230 }
@@ -2218,7 +2233,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
2218 ifp->ndev->name_assign_type = name_assign_type; 2233 ifp->ndev->name_assign_type = name_assign_type;
2219 err = brcmf_net_attach(ifp, true); 2234 err = brcmf_net_attach(ifp, true);
2220 if (err) { 2235 if (err) {
2221 brcmf_err("Registering netdevice failed\n"); 2236 bphy_err(drvr, "Registering netdevice failed\n");
2222 free_netdev(ifp->ndev); 2237 free_netdev(ifp->ndev);
2223 goto fail; 2238 goto fail;
2224 } 2239 }
@@ -2373,6 +2388,7 @@ void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev)
2373 */ 2388 */
2374s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced) 2389s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
2375{ 2390{
2391 struct brcmf_pub *drvr = cfg->pub;
2376 struct brcmf_p2p_info *p2p; 2392 struct brcmf_p2p_info *p2p;
2377 struct brcmf_if *pri_ifp; 2393 struct brcmf_if *pri_ifp;
2378 s32 err = 0; 2394 s32 err = 0;
@@ -2387,7 +2403,7 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
2387 if (p2pdev_forced) { 2403 if (p2pdev_forced) {
2388 err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL); 2404 err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
2389 if (IS_ERR(err_ptr)) { 2405 if (IS_ERR(err_ptr)) {
2390 brcmf_err("P2P device creation failed.\n"); 2406 bphy_err(drvr, "P2P device creation failed.\n");
2391 err = PTR_ERR(err_ptr); 2407 err = PTR_ERR(err_ptr);
2392 } 2408 }
2393 } else { 2409 } else {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 0f69b3fa296e..58a6bc379358 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -30,6 +30,15 @@
30#include <brcmu_wifi.h> 30#include <brcmu_wifi.h>
31#include <brcm_hw_ids.h> 31#include <brcm_hw_ids.h>
32 32
33/* Custom brcmf_err() that takes bus arg and passes it further */
34#define brcmf_err(bus, fmt, ...) \
35 do { \
36 if (IS_ENABLED(CONFIG_BRCMDBG) || \
37 IS_ENABLED(CONFIG_BRCM_TRACING) || \
38 net_ratelimit()) \
39 __brcmf_err(bus, __func__, fmt, ##__VA_ARGS__); \
40 } while (0)
41
33#include "debug.h" 42#include "debug.h"
34#include "bus.h" 43#include "bus.h"
35#include "commonring.h" 44#include "commonring.h"
@@ -531,6 +540,7 @@ static void
531brcmf_pcie_select_core(struct brcmf_pciedev_info *devinfo, u16 coreid) 540brcmf_pcie_select_core(struct brcmf_pciedev_info *devinfo, u16 coreid)
532{ 541{
533 const struct pci_dev *pdev = devinfo->pdev; 542 const struct pci_dev *pdev = devinfo->pdev;
543 struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
534 struct brcmf_core *core; 544 struct brcmf_core *core;
535 u32 bar0_win; 545 u32 bar0_win;
536 546
@@ -548,7 +558,7 @@ brcmf_pcie_select_core(struct brcmf_pciedev_info *devinfo, u16 coreid)
548 } 558 }
549 } 559 }
550 } else { 560 } else {
551 brcmf_err("Unsupported core selected %x\n", coreid); 561 brcmf_err(bus, "Unsupported core selected %x\n", coreid);
552 } 562 }
553} 563}
554 564
@@ -848,9 +858,8 @@ static irqreturn_t brcmf_pcie_isr_thread(int irq, void *arg)
848 858
849static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo) 859static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo)
850{ 860{
851 struct pci_dev *pdev; 861 struct pci_dev *pdev = devinfo->pdev;
852 862 struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
853 pdev = devinfo->pdev;
854 863
855 brcmf_pcie_intr_disable(devinfo); 864 brcmf_pcie_intr_disable(devinfo);
856 865
@@ -861,7 +870,7 @@ static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo)
861 brcmf_pcie_isr_thread, IRQF_SHARED, 870 brcmf_pcie_isr_thread, IRQF_SHARED,
862 "brcmf_pcie_intr", devinfo)) { 871 "brcmf_pcie_intr", devinfo)) {
863 pci_disable_msi(pdev); 872 pci_disable_msi(pdev);
864 brcmf_err("Failed to request IRQ %d\n", pdev->irq); 873 brcmf_err(bus, "Failed to request IRQ %d\n", pdev->irq);
865 return -EIO; 874 return -EIO;
866 } 875 }
867 devinfo->irq_allocated = true; 876 devinfo->irq_allocated = true;
@@ -871,15 +880,14 @@ static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo)
871 880
872static void brcmf_pcie_release_irq(struct brcmf_pciedev_info *devinfo) 881static void brcmf_pcie_release_irq(struct brcmf_pciedev_info *devinfo)
873{ 882{
874 struct pci_dev *pdev; 883 struct pci_dev *pdev = devinfo->pdev;
884 struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
875 u32 status; 885 u32 status;
876 u32 count; 886 u32 count;
877 887
878 if (!devinfo->irq_allocated) 888 if (!devinfo->irq_allocated)
879 return; 889 return;
880 890
881 pdev = devinfo->pdev;
882
883 brcmf_pcie_intr_disable(devinfo); 891 brcmf_pcie_intr_disable(devinfo);
884 free_irq(pdev->irq, devinfo); 892 free_irq(pdev->irq, devinfo);
885 pci_disable_msi(pdev); 893 pci_disable_msi(pdev);
@@ -891,7 +899,7 @@ static void brcmf_pcie_release_irq(struct brcmf_pciedev_info *devinfo)
891 count++; 899 count++;
892 } 900 }
893 if (devinfo->in_irq) 901 if (devinfo->in_irq)
894 brcmf_err("Still in IRQ (processing) !!!\n"); 902 brcmf_err(bus, "Still in IRQ (processing) !!!\n");
895 903
896 status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT); 904 status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
897 brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status); 905 brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status);
@@ -1102,6 +1110,7 @@ static void brcmf_pcie_release_ringbuffers(struct brcmf_pciedev_info *devinfo)
1102 1110
1103static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo) 1111static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo)
1104{ 1112{
1113 struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev);
1105 struct brcmf_pcie_ringbuf *ring; 1114 struct brcmf_pcie_ringbuf *ring;
1106 struct brcmf_pcie_ringbuf *rings; 1115 struct brcmf_pcie_ringbuf *rings;
1107 u32 d2h_w_idx_ptr; 1116 u32 d2h_w_idx_ptr;
@@ -1254,7 +1263,7 @@ static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo)
1254 return 0; 1263 return 0;
1255 1264
1256fail: 1265fail:
1257 brcmf_err("Allocating ring buffers failed\n"); 1266 brcmf_err(bus, "Allocating ring buffers failed\n");
1258 brcmf_pcie_release_ringbuffers(devinfo); 1267 brcmf_pcie_release_ringbuffers(devinfo);
1259 return -ENOMEM; 1268 return -ENOMEM;
1260} 1269}
@@ -1277,6 +1286,7 @@ brcmf_pcie_release_scratchbuffers(struct brcmf_pciedev_info *devinfo)
1277 1286
1278static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo) 1287static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
1279{ 1288{
1289 struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev);
1280 u64 address; 1290 u64 address;
1281 u32 addr; 1291 u32 addr;
1282 1292
@@ -1316,7 +1326,7 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
1316 return 0; 1326 return 0;
1317 1327
1318fail: 1328fail:
1319 brcmf_err("Allocating scratch buffers failed\n"); 1329 brcmf_err(bus, "Allocating scratch buffers failed\n");
1320 brcmf_pcie_release_scratchbuffers(devinfo); 1330 brcmf_pcie_release_scratchbuffers(devinfo);
1321 return -ENOMEM; 1331 return -ENOMEM;
1322} 1332}
@@ -1437,6 +1447,7 @@ static int
1437brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo, 1447brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
1438 u32 sharedram_addr) 1448 u32 sharedram_addr)
1439{ 1449{
1450 struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev);
1440 struct brcmf_pcie_shared_info *shared; 1451 struct brcmf_pcie_shared_info *shared;
1441 u32 addr; 1452 u32 addr;
1442 1453
@@ -1448,7 +1459,8 @@ brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
1448 brcmf_dbg(PCIE, "PCIe protocol version %d\n", shared->version); 1459 brcmf_dbg(PCIE, "PCIe protocol version %d\n", shared->version);
1449 if ((shared->version > BRCMF_PCIE_MAX_SHARED_VERSION) || 1460 if ((shared->version > BRCMF_PCIE_MAX_SHARED_VERSION) ||
1450 (shared->version < BRCMF_PCIE_MIN_SHARED_VERSION)) { 1461 (shared->version < BRCMF_PCIE_MIN_SHARED_VERSION)) {
1451 brcmf_err("Unsupported PCIE version %d\n", shared->version); 1462 brcmf_err(bus, "Unsupported PCIE version %d\n",
1463 shared->version);
1452 return -EINVAL; 1464 return -EINVAL;
1453 } 1465 }
1454 1466
@@ -1490,6 +1502,7 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,
1490 const struct firmware *fw, void *nvram, 1502 const struct firmware *fw, void *nvram,
1491 u32 nvram_len) 1503 u32 nvram_len)
1492{ 1504{
1505 struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev);
1493 u32 sharedram_addr; 1506 u32 sharedram_addr;
1494 u32 sharedram_addr_written; 1507 u32 sharedram_addr_written;
1495 u32 loop_counter; 1508 u32 loop_counter;
@@ -1544,7 +1557,13 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,
1544 loop_counter--; 1557 loop_counter--;
1545 } 1558 }
1546 if (sharedram_addr == sharedram_addr_written) { 1559 if (sharedram_addr == sharedram_addr_written) {
1547 brcmf_err("FW failed to initialize\n"); 1560 brcmf_err(bus, "FW failed to initialize\n");
1561 return -ENODEV;
1562 }
1563 if (sharedram_addr < devinfo->ci->rambase ||
1564 sharedram_addr >= devinfo->ci->rambase + devinfo->ci->ramsize) {
1565 brcmf_err(bus, "Invalid shared RAM address 0x%08x\n",
1566 sharedram_addr);
1548 return -ENODEV; 1567 return -ENODEV;
1549 } 1568 }
1550 brcmf_dbg(PCIE, "Shared RAM addr: 0x%08x\n", sharedram_addr); 1569 brcmf_dbg(PCIE, "Shared RAM addr: 0x%08x\n", sharedram_addr);
@@ -1555,16 +1574,15 @@ static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,
1555 1574
1556static int brcmf_pcie_get_resource(struct brcmf_pciedev_info *devinfo) 1575static int brcmf_pcie_get_resource(struct brcmf_pciedev_info *devinfo)
1557{ 1576{
1558 struct pci_dev *pdev; 1577 struct pci_dev *pdev = devinfo->pdev;
1578 struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
1559 int err; 1579 int err;
1560 phys_addr_t bar0_addr, bar1_addr; 1580 phys_addr_t bar0_addr, bar1_addr;
1561 ulong bar1_size; 1581 ulong bar1_size;
1562 1582
1563 pdev = devinfo->pdev;
1564
1565 err = pci_enable_device(pdev); 1583 err = pci_enable_device(pdev);
1566 if (err) { 1584 if (err) {
1567 brcmf_err("pci_enable_device failed err=%d\n", err); 1585 brcmf_err(bus, "pci_enable_device failed err=%d\n", err);
1568 return err; 1586 return err;
1569 } 1587 }
1570 1588
@@ -1577,7 +1595,7 @@ static int brcmf_pcie_get_resource(struct brcmf_pciedev_info *devinfo)
1577 /* read Bar-1 mapped memory range */ 1595 /* read Bar-1 mapped memory range */
1578 bar1_size = pci_resource_len(pdev, 2); 1596 bar1_size = pci_resource_len(pdev, 2);
1579 if ((bar1_size == 0) || (bar1_addr == 0)) { 1597 if ((bar1_size == 0) || (bar1_addr == 0)) {
1580 brcmf_err("BAR1 Not enabled, device size=%ld, addr=%#016llx\n", 1598 brcmf_err(bus, "BAR1 Not enabled, device size=%ld, addr=%#016llx\n",
1581 bar1_size, (unsigned long long)bar1_addr); 1599 bar1_size, (unsigned long long)bar1_addr);
1582 return -EINVAL; 1600 return -EINVAL;
1583 } 1601 }
@@ -1586,7 +1604,7 @@ static int brcmf_pcie_get_resource(struct brcmf_pciedev_info *devinfo)
1586 devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size); 1604 devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
1587 1605
1588 if (!devinfo->regs || !devinfo->tcm) { 1606 if (!devinfo->regs || !devinfo->tcm) {
1589 brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs, 1607 brcmf_err(bus, "ioremap() failed (%p,%p)\n", devinfo->regs,
1590 devinfo->tcm); 1608 devinfo->tcm);
1591 return -EINVAL; 1609 return -EINVAL;
1592 } 1610 }
@@ -1873,7 +1891,7 @@ fail_bus:
1873 kfree(bus->msgbuf); 1891 kfree(bus->msgbuf);
1874 kfree(bus); 1892 kfree(bus);
1875fail: 1893fail:
1876 brcmf_err("failed %x:%x\n", pdev->vendor, pdev->device); 1894 brcmf_err(NULL, "failed %x:%x\n", pdev->vendor, pdev->device);
1877 brcmf_pcie_release_resource(devinfo); 1895 brcmf_pcie_release_resource(devinfo);
1878 if (devinfo->ci) 1896 if (devinfo->ci)
1879 brcmf_chip_detach(devinfo->ci); 1897 brcmf_chip_detach(devinfo->ci);
@@ -1947,7 +1965,7 @@ static int brcmf_pcie_pm_enter_D3(struct device *dev)
1947 wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed, 1965 wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
1948 BRCMF_PCIE_MBDATA_TIMEOUT); 1966 BRCMF_PCIE_MBDATA_TIMEOUT);
1949 if (!devinfo->mbdata_completed) { 1967 if (!devinfo->mbdata_completed) {
1950 brcmf_err("Timeout on response for entering D3 substate\n"); 1968 brcmf_err(bus, "Timeout on response for entering D3 substate\n");
1951 brcmf_bus_change_state(bus, BRCMF_BUS_UP); 1969 brcmf_bus_change_state(bus, BRCMF_BUS_UP);
1952 return -EIO; 1970 return -EIO;
1953 } 1971 }
@@ -1993,7 +2011,7 @@ cleanup:
1993 2011
1994 err = brcmf_pcie_probe(pdev, NULL); 2012 err = brcmf_pcie_probe(pdev, NULL);
1995 if (err) 2013 if (err)
1996 brcmf_err("probe after resume failed, err=%d\n", err); 2014 brcmf_err(bus, "probe after resume failed, err=%d\n", err);
1997 2015
1998 return err; 2016 return err;
1999} 2017}
@@ -2064,7 +2082,8 @@ void brcmf_pcie_register(void)
2064 brcmf_dbg(PCIE, "Enter\n"); 2082 brcmf_dbg(PCIE, "Enter\n");
2065 err = pci_register_driver(&brcmf_pciedrvr); 2083 err = pci_register_driver(&brcmf_pciedrvr);
2066 if (err) 2084 if (err)
2067 brcmf_err("PCIE driver registration failed, err=%d\n", err); 2085 brcmf_err(NULL, "PCIE driver registration failed, err=%d\n",
2086 err);
2068} 2087}
2069 2088
2070 2089
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
index 37b403877228..0fb97f7dd5a2 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
@@ -109,6 +109,7 @@ static int brcmf_pno_channel_config(struct brcmf_if *ifp,
109static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq, 109static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq,
110 u32 mscan, u32 bestn) 110 u32 mscan, u32 bestn)
111{ 111{
112 struct brcmf_pub *drvr = ifp->drvr;
112 struct brcmf_pno_param_le pfn_param; 113 struct brcmf_pno_param_le pfn_param;
113 u16 flags; 114 u16 flags;
114 u32 pfnmem; 115 u32 pfnmem;
@@ -132,13 +133,13 @@ static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq,
132 /* set bestn in firmware */ 133 /* set bestn in firmware */
133 err = brcmf_fil_iovar_int_set(ifp, "pfnmem", pfnmem); 134 err = brcmf_fil_iovar_int_set(ifp, "pfnmem", pfnmem);
134 if (err < 0) { 135 if (err < 0) {
135 brcmf_err("failed to set pfnmem\n"); 136 bphy_err(drvr, "failed to set pfnmem\n");
136 goto exit; 137 goto exit;
137 } 138 }
138 /* get max mscan which the firmware supports */ 139 /* get max mscan which the firmware supports */
139 err = brcmf_fil_iovar_int_get(ifp, "pfnmem", &pfnmem); 140 err = brcmf_fil_iovar_int_get(ifp, "pfnmem", &pfnmem);
140 if (err < 0) { 141 if (err < 0) {
141 brcmf_err("failed to get pfnmem\n"); 142 bphy_err(drvr, "failed to get pfnmem\n");
142 goto exit; 143 goto exit;
143 } 144 }
144 mscan = min_t(u32, mscan, pfnmem); 145 mscan = min_t(u32, mscan, pfnmem);
@@ -152,7 +153,7 @@ static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq,
152 err = brcmf_fil_iovar_data_set(ifp, "pfn_set", &pfn_param, 153 err = brcmf_fil_iovar_data_set(ifp, "pfn_set", &pfn_param,
153 sizeof(pfn_param)); 154 sizeof(pfn_param));
154 if (err) 155 if (err)
155 brcmf_err("pfn_set failed, err=%d\n", err); 156 bphy_err(drvr, "pfn_set failed, err=%d\n", err);
156 157
157exit: 158exit:
158 return err; 159 return err;
@@ -160,6 +161,7 @@ exit:
160 161
161static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) 162static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)
162{ 163{
164 struct brcmf_pub *drvr = ifp->drvr;
163 struct brcmf_pno_macaddr_le pfn_mac; 165 struct brcmf_pno_macaddr_le pfn_mac;
164 u8 *mac_addr = NULL; 166 u8 *mac_addr = NULL;
165 u8 *mac_mask = NULL; 167 u8 *mac_mask = NULL;
@@ -194,7 +196,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)
194 err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, 196 err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac,
195 sizeof(pfn_mac)); 197 sizeof(pfn_mac));
196 if (err) 198 if (err)
197 brcmf_err("pfn_macaddr failed, err=%d\n", err); 199 bphy_err(drvr, "pfn_macaddr failed, err=%d\n", err);
198 200
199 return err; 201 return err;
200} 202}
@@ -202,6 +204,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)
202static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid, 204static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid,
203 bool active) 205 bool active)
204{ 206{
207 struct brcmf_pub *drvr = ifp->drvr;
205 struct brcmf_pno_net_param_le pfn; 208 struct brcmf_pno_net_param_le pfn;
206 int err; 209 int err;
207 210
@@ -218,12 +221,13 @@ static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid,
218 brcmf_dbg(SCAN, "adding ssid=%.32s (active=%d)\n", ssid->ssid, active); 221 brcmf_dbg(SCAN, "adding ssid=%.32s (active=%d)\n", ssid->ssid, active);
219 err = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, sizeof(pfn)); 222 err = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, sizeof(pfn));
220 if (err < 0) 223 if (err < 0)
221 brcmf_err("adding failed: err=%d\n", err); 224 bphy_err(drvr, "adding failed: err=%d\n", err);
222 return err; 225 return err;
223} 226}
224 227
225static int brcmf_pno_add_bssid(struct brcmf_if *ifp, const u8 *bssid) 228static int brcmf_pno_add_bssid(struct brcmf_if *ifp, const u8 *bssid)
226{ 229{
230 struct brcmf_pub *drvr = ifp->drvr;
227 struct brcmf_pno_bssid_le bssid_cfg; 231 struct brcmf_pno_bssid_le bssid_cfg;
228 int err; 232 int err;
229 233
@@ -234,7 +238,7 @@ static int brcmf_pno_add_bssid(struct brcmf_if *ifp, const u8 *bssid)
234 err = brcmf_fil_iovar_data_set(ifp, "pfn_add_bssid", &bssid_cfg, 238 err = brcmf_fil_iovar_data_set(ifp, "pfn_add_bssid", &bssid_cfg,
235 sizeof(bssid_cfg)); 239 sizeof(bssid_cfg));
236 if (err < 0) 240 if (err < 0)
237 brcmf_err("adding failed: err=%d\n", err); 241 bphy_err(drvr, "adding failed: err=%d\n", err);
238 return err; 242 return err;
239} 243}
240 244
@@ -258,6 +262,7 @@ static bool brcmf_is_ssid_active(struct cfg80211_ssid *ssid,
258 262
259static int brcmf_pno_clean(struct brcmf_if *ifp) 263static int brcmf_pno_clean(struct brcmf_if *ifp)
260{ 264{
265 struct brcmf_pub *drvr = ifp->drvr;
261 int ret; 266 int ret;
262 267
263 /* Disable pfn */ 268 /* Disable pfn */
@@ -267,7 +272,7 @@ static int brcmf_pno_clean(struct brcmf_if *ifp)
267 ret = brcmf_fil_iovar_data_set(ifp, "pfnclear", NULL, 0); 272 ret = brcmf_fil_iovar_data_set(ifp, "pfnclear", NULL, 0);
268 } 273 }
269 if (ret < 0) 274 if (ret < 0)
270 brcmf_err("failed code %d\n", ret); 275 bphy_err(drvr, "failed code %d\n", ret);
271 276
272 return ret; 277 return ret;
273} 278}
@@ -392,6 +397,7 @@ static int brcmf_pno_config_networks(struct brcmf_if *ifp,
392 397
393static int brcmf_pno_config_sched_scans(struct brcmf_if *ifp) 398static int brcmf_pno_config_sched_scans(struct brcmf_if *ifp)
394{ 399{
400 struct brcmf_pub *drvr = ifp->drvr;
395 struct brcmf_pno_info *pi; 401 struct brcmf_pno_info *pi;
396 struct brcmf_gscan_config *gscan_cfg; 402 struct brcmf_gscan_config *gscan_cfg;
397 struct brcmf_gscan_bucket_config *buckets; 403 struct brcmf_gscan_bucket_config *buckets;
@@ -416,7 +422,7 @@ static int brcmf_pno_config_sched_scans(struct brcmf_if *ifp)
416 /* clean up everything */ 422 /* clean up everything */
417 err = brcmf_pno_clean(ifp); 423 err = brcmf_pno_clean(ifp);
418 if (err < 0) { 424 if (err < 0) {
419 brcmf_err("failed error=%d\n", err); 425 bphy_err(drvr, "failed error=%d\n", err);
420 goto free_gscan; 426 goto free_gscan;
421 } 427 }
422 428
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
index c5ff551ec659..024c643052bc 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c
@@ -47,8 +47,8 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
47 if (brcmf_proto_msgbuf_attach(drvr)) 47 if (brcmf_proto_msgbuf_attach(drvr))
48 goto fail; 48 goto fail;
49 } else { 49 } else {
50 brcmf_err("Unsupported proto type %d\n", 50 bphy_err(drvr, "Unsupported proto type %d\n",
51 drvr->bus_if->proto_type); 51 drvr->bus_if->proto_type);
52 goto fail; 52 goto fail;
53 } 53 }
54 if (!proto->tx_queue_data || (proto->hdrpull == NULL) || 54 if (!proto->tx_queue_data || (proto->hdrpull == NULL) ||
@@ -56,7 +56,7 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
56 (proto->configure_addr_mode == NULL) || 56 (proto->configure_addr_mode == NULL) ||
57 (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL) || 57 (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL) ||
58 (proto->debugfs_create == NULL)) { 58 (proto->debugfs_create == NULL)) {
59 brcmf_err("Not all proto handlers have been installed\n"); 59 bphy_err(drvr, "Not all proto handlers have been installed\n");
60 goto fail; 60 goto fail;
61 } 61 }
62 return 0; 62 return 0;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 0cd5b8d970d7..4d104ab80fd8 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -2999,21 +2999,35 @@ static int brcmf_sdio_trap_info(struct seq_file *seq, struct brcmf_sdio *bus,
2999 if (error < 0) 2999 if (error < 0)
3000 return error; 3000 return error;
3001 3001
3002 seq_printf(seq, 3002 if (seq)
3003 "dongle trap info: type 0x%x @ epc 0x%08x\n" 3003 seq_printf(seq,
3004 " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n" 3004 "dongle trap info: type 0x%x @ epc 0x%08x\n"
3005 " lr 0x%08x pc 0x%08x offset 0x%x\n" 3005 " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n"
3006 " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n" 3006 " lr 0x%08x pc 0x%08x offset 0x%x\n"
3007 " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n", 3007 " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n"
3008 le32_to_cpu(tr.type), le32_to_cpu(tr.epc), 3008 " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n",
3009 le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr), 3009 le32_to_cpu(tr.type), le32_to_cpu(tr.epc),
3010 le32_to_cpu(tr.r13), le32_to_cpu(tr.r14), 3010 le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr),
3011 le32_to_cpu(tr.pc), sh->trap_addr, 3011 le32_to_cpu(tr.r13), le32_to_cpu(tr.r14),
3012 le32_to_cpu(tr.r0), le32_to_cpu(tr.r1), 3012 le32_to_cpu(tr.pc), sh->trap_addr,
3013 le32_to_cpu(tr.r2), le32_to_cpu(tr.r3), 3013 le32_to_cpu(tr.r0), le32_to_cpu(tr.r1),
3014 le32_to_cpu(tr.r4), le32_to_cpu(tr.r5), 3014 le32_to_cpu(tr.r2), le32_to_cpu(tr.r3),
3015 le32_to_cpu(tr.r6), le32_to_cpu(tr.r7)); 3015 le32_to_cpu(tr.r4), le32_to_cpu(tr.r5),
3016 3016 le32_to_cpu(tr.r6), le32_to_cpu(tr.r7));
3017 else
3018 pr_debug("dongle trap info: type 0x%x @ epc 0x%08x\n"
3019 " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n"
3020 " lr 0x%08x pc 0x%08x offset 0x%x\n"
3021 " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n"
3022 " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n",
3023 le32_to_cpu(tr.type), le32_to_cpu(tr.epc),
3024 le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr),
3025 le32_to_cpu(tr.r13), le32_to_cpu(tr.r14),
3026 le32_to_cpu(tr.pc), sh->trap_addr,
3027 le32_to_cpu(tr.r0), le32_to_cpu(tr.r1),
3028 le32_to_cpu(tr.r2), le32_to_cpu(tr.r3),
3029 le32_to_cpu(tr.r4), le32_to_cpu(tr.r5),
3030 le32_to_cpu(tr.r6), le32_to_cpu(tr.r7));
3017 return 0; 3031 return 0;
3018} 3032}
3019 3033
@@ -3067,8 +3081,10 @@ static int brcmf_sdio_checkdied(struct brcmf_sdio *bus)
3067 else if (sh.flags & SDPCM_SHARED_ASSERT) 3081 else if (sh.flags & SDPCM_SHARED_ASSERT)
3068 brcmf_err("assertion in dongle\n"); 3082 brcmf_err("assertion in dongle\n");
3069 3083
3070 if (sh.flags & SDPCM_SHARED_TRAP) 3084 if (sh.flags & SDPCM_SHARED_TRAP) {
3071 brcmf_err("firmware trap in dongle\n"); 3085 brcmf_err("firmware trap in dongle\n");
3086 brcmf_sdio_trap_info(NULL, bus, &sh);
3087 }
3072 3088
3073 return 0; 3089 return 0;
3074} 3090}
@@ -3143,9 +3159,12 @@ static int brcmf_debugfs_sdio_count_read(struct seq_file *seq, void *data)
3143 return 0; 3159 return 0;
3144} 3160}
3145 3161
3146static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) 3162static void brcmf_sdio_debugfs_create(struct device *dev)
3147{ 3163{
3148 struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr; 3164 struct brcmf_bus *bus_if = dev_get_drvdata(dev);
3165 struct brcmf_pub *drvr = bus_if->drvr;
3166 struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
3167 struct brcmf_sdio *bus = sdiodev->bus;
3149 struct dentry *dentry = brcmf_debugfs_get_devdir(drvr); 3168 struct dentry *dentry = brcmf_debugfs_get_devdir(drvr);
3150 3169
3151 if (IS_ERR_OR_NULL(dentry)) 3170 if (IS_ERR_OR_NULL(dentry))
@@ -3165,7 +3184,7 @@ static int brcmf_sdio_checkdied(struct brcmf_sdio *bus)
3165 return 0; 3184 return 0;
3166} 3185}
3167 3186
3168static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) 3187static void brcmf_sdio_debugfs_create(struct device *dev)
3169{ 3188{
3170} 3189}
3171#endif /* DEBUG */ 3190#endif /* DEBUG */
@@ -3477,8 +3496,6 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
3477 if (bus->rxbuf) 3496 if (bus->rxbuf)
3478 bus->rxblen = value; 3497 bus->rxblen = value;
3479 3498
3480 brcmf_sdio_debugfs_create(bus);
3481
3482 /* the commands below use the terms tx and rx from 3499 /* the commands below use the terms tx and rx from
3483 * a device perspective, ie. bus:txglom affects the 3500 * a device perspective, ie. bus:txglom affects the
3484 * bus transfers from device to host. 3501 * bus transfers from device to host.
@@ -4088,6 +4105,7 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = {
4088 .get_ramsize = brcmf_sdio_bus_get_ramsize, 4105 .get_ramsize = brcmf_sdio_bus_get_ramsize,
4089 .get_memdump = brcmf_sdio_bus_get_memdump, 4106 .get_memdump = brcmf_sdio_bus_get_memdump,
4090 .get_fwname = brcmf_sdio_get_fwname, 4107 .get_fwname = brcmf_sdio_get_fwname,
4108 .debugfs_create = brcmf_sdio_debugfs_create
4091}; 4109};
4092 4110
4093#define BRCMF_SDIO_FW_CODE 0 4111#define BRCMF_SDIO_FW_CODE 0
@@ -4197,7 +4215,7 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
4197 } else { 4215 } else {
4198 /* Disable F2 again */ 4216 /* Disable F2 again */
4199 sdio_disable_func(sdiod->func2); 4217 sdio_disable_func(sdiod->func2);
4200 goto release; 4218 goto checkdied;
4201 } 4219 }
4202 4220
4203 if (brcmf_chip_sr_capable(bus->ci)) { 4221 if (brcmf_chip_sr_capable(bus->ci)) {
@@ -4218,8 +4236,10 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
4218 } 4236 }
4219 4237
4220 /* If we didn't come up, turn off backplane clock */ 4238 /* If we didn't come up, turn off backplane clock */
4221 if (err != 0) 4239 if (err != 0) {
4222 brcmf_sdio_clkctl(bus, CLK_NONE, false); 4240 brcmf_sdio_clkctl(bus, CLK_NONE, false);
4241 goto checkdied;
4242 }
4223 4243
4224 sdio_release_host(sdiod->func1); 4244 sdio_release_host(sdiod->func1);
4225 4245
@@ -4233,12 +4253,15 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
4233 err = brcmf_attach(sdiod->dev, sdiod->settings); 4253 err = brcmf_attach(sdiod->dev, sdiod->settings);
4234 if (err != 0) { 4254 if (err != 0) {
4235 brcmf_err("brcmf_attach failed\n"); 4255 brcmf_err("brcmf_attach failed\n");
4236 goto fail; 4256 sdio_claim_host(sdiod->func1);
4257 goto checkdied;
4237 } 4258 }
4238 4259
4239 /* ready */ 4260 /* ready */
4240 return; 4261 return;
4241 4262
4263checkdied:
4264 brcmf_sdio_checkdied(bus);
4242release: 4265release:
4243 sdio_release_host(sdiod->func1); 4266 sdio_release_host(sdiod->func1);
4244fail: 4267fail:
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
index fe6755944b7b..a5c271bff446 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c
@@ -14,14 +14,16 @@
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#include <linux/device.h>
17#include <linux/module.h> /* bug in tracepoint.h, it should include this */ 18#include <linux/module.h> /* bug in tracepoint.h, it should include this */
18 19
19#ifndef __CHECKER__ 20#ifndef __CHECKER__
20#define CREATE_TRACE_POINTS 21#define CREATE_TRACE_POINTS
22#include "bus.h"
21#include "tracepoint.h" 23#include "tracepoint.h"
22#include "debug.h" 24#include "debug.h"
23 25
24void __brcmf_err(const char *func, const char *fmt, ...) 26void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...)
25{ 27{
26 struct va_format vaf = { 28 struct va_format vaf = {
27 .fmt = fmt, 29 .fmt = fmt,
@@ -30,7 +32,10 @@ void __brcmf_err(const char *func, const char *fmt, ...)
30 32
31 va_start(args, fmt); 33 va_start(args, fmt);
32 vaf.va = &args; 34 vaf.va = &args;
33 pr_err("%s: %pV", func, &vaf); 35 if (bus)
36 dev_err(bus->dev, "%s: %pV", func, &vaf);
37 else
38 pr_err("%s: %pV", func, &vaf);
34 trace_brcmf_err(func, &vaf); 39 trace_brcmf_err(func, &vaf);
35 va_end(args); 40 va_end(args);
36} 41}
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
index 76cfaf6999c8..e9cbfd077710 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -508,7 +508,7 @@ static void brcmf_usb_rx_complete(struct urb *urb)
508 skb = req->skb; 508 skb = req->skb;
509 req->skb = NULL; 509 req->skb = NULL;
510 510
511 /* zero lenght packets indicate usb "failure". Do not refill */ 511 /* zero length packets indicate usb "failure". Do not refill */
512 if (urb->status != 0 || !urb->actual_length) { 512 if (urb->status != 0 || !urb->actual_length) {
513 brcmu_pkt_buf_free_skb(skb); 513 brcmu_pkt_buf_free_skb(skb);
514 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); 514 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL);
@@ -575,7 +575,6 @@ static void
575brcmf_usb_state_change(struct brcmf_usbdev_info *devinfo, int state) 575brcmf_usb_state_change(struct brcmf_usbdev_info *devinfo, int state)
576{ 576{
577 struct brcmf_bus *bcmf_bus = devinfo->bus_pub.bus; 577 struct brcmf_bus *bcmf_bus = devinfo->bus_pub.bus;
578 int old_state;
579 578
580 brcmf_dbg(USB, "Enter, current state=%d, new state=%d\n", 579 brcmf_dbg(USB, "Enter, current state=%d, new state=%d\n",
581 devinfo->bus_pub.state, state); 580 devinfo->bus_pub.state, state);
@@ -583,7 +582,6 @@ brcmf_usb_state_change(struct brcmf_usbdev_info *devinfo, int state)
583 if (devinfo->bus_pub.state == state) 582 if (devinfo->bus_pub.state == state)
584 return; 583 return;
585 584
586 old_state = devinfo->bus_pub.state;
587 devinfo->bus_pub.state = state; 585 devinfo->bus_pub.state = state;
588 586
589 /* update state of upper layer */ 587 /* update state of upper layer */
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
index eb93711d474b..fdc56f821b5a 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
@@ -6,7 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2015-2017 Intel Deutschland GmbH 8 * Copyright(c) 2015-2017 Intel Deutschland GmbH
9 * Copyright (C) 2018 Intel Corporation 9 * Copyright (C) 2018-2019 Intel Corporation
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as 12 * it under the terms of version 2 of the GNU General Public License as
@@ -20,7 +20,7 @@
20 * BSD LICENSE 20 * BSD LICENSE
21 * 21 *
22 * Copyright(c) 2015-2017 Intel Deutschland GmbH 22 * Copyright(c) 2015-2017 Intel Deutschland GmbH
23 * Copyright (C) 2018 Intel Corporation 23 * Copyright (C) 2018-2019 Intel Corporation
24 * All rights reserved. 24 * All rights reserved.
25 * 25 *
26 * Redistribution and use in source and binary forms, with or without 26 * Redistribution and use in source and binary forms, with or without
@@ -56,7 +56,7 @@
56#include "iwl-config.h" 56#include "iwl-config.h"
57 57
58/* Highest firmware API version supported */ 58/* Highest firmware API version supported */
59#define IWL_22000_UCODE_API_MAX 43 59#define IWL_22000_UCODE_API_MAX 46
60 60
61/* Lowest firmware API version supported */ 61/* Lowest firmware API version supported */
62#define IWL_22000_UCODE_API_MIN 39 62#define IWL_22000_UCODE_API_MIN 39
@@ -79,11 +79,15 @@
79#define IWL_22000_HR_B_F0_FW_PRE "iwlwifi-Qu-b0-hr-b0-" 79#define IWL_22000_HR_B_F0_FW_PRE "iwlwifi-Qu-b0-hr-b0-"
80#define IWL_22000_QU_B_HR_B_FW_PRE "iwlwifi-Qu-b0-hr-b0-" 80#define IWL_22000_QU_B_HR_B_FW_PRE "iwlwifi-Qu-b0-hr-b0-"
81#define IWL_22000_HR_B_FW_PRE "iwlwifi-QuQnj-b0-hr-b0-" 81#define IWL_22000_HR_B_FW_PRE "iwlwifi-QuQnj-b0-hr-b0-"
82#define IWL_22000_JF_B0_FW_PRE "iwlwifi-QuQnj-a0-jf-b0-"
83#define IWL_22000_HR_A0_FW_PRE "iwlwifi-QuQnj-a0-hr-a0-" 82#define IWL_22000_HR_A0_FW_PRE "iwlwifi-QuQnj-a0-hr-a0-"
84#define IWL_22000_SU_Z0_FW_PRE "iwlwifi-su-z0-" 83#define IWL_22000_SU_Z0_FW_PRE "iwlwifi-su-z0-"
85#define IWL_QU_B_JF_B_FW_PRE "iwlwifi-Qu-b0-jf-b0-" 84#define IWL_QU_B_JF_B_FW_PRE "iwlwifi-Qu-b0-jf-b0-"
85#define IWL_QNJ_B_JF_B_FW_PRE "iwlwifi-QuQnj-b0-jf-b0-"
86#define IWL_CC_A_FW_PRE "iwlwifi-cc-a0-" 86#define IWL_CC_A_FW_PRE "iwlwifi-cc-a0-"
87#define IWL_22000_SO_A_JF_B_FW_PRE "iwlwifi-so-a0-jf-b0-"
88#define IWL_22000_SO_A_HR_B_FW_PRE "iwlwifi-so-a0-hr-b0-"
89#define IWL_22000_SO_A_GF_A_FW_PRE "iwlwifi-so-a0-gf-a0-"
90#define IWL_22000_TY_A_GF_A_FW_PRE "iwlwifi-ty-a0-gf-a0-"
87 91
88#define IWL_22000_HR_MODULE_FIRMWARE(api) \ 92#define IWL_22000_HR_MODULE_FIRMWARE(api) \
89 IWL_22000_HR_FW_PRE __stringify(api) ".ucode" 93 IWL_22000_HR_FW_PRE __stringify(api) ".ucode"
@@ -97,16 +101,26 @@
97 IWL_22000_QU_B_HR_B_FW_PRE __stringify(api) ".ucode" 101 IWL_22000_QU_B_HR_B_FW_PRE __stringify(api) ".ucode"
98#define IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(api) \ 102#define IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(api) \
99 IWL_22000_HR_B_FW_PRE __stringify(api) ".ucode" 103 IWL_22000_HR_B_FW_PRE __stringify(api) ".ucode"
100#define IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(api) \
101 IWL_22000_JF_B0_FW_PRE __stringify(api) ".ucode"
102#define IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(api) \ 104#define IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(api) \
103 IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode" 105 IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode"
104#define IWL_22000_SU_Z0_MODULE_FIRMWARE(api) \ 106#define IWL_22000_SU_Z0_MODULE_FIRMWARE(api) \
105 IWL_22000_SU_Z0_FW_PRE __stringify(api) ".ucode" 107 IWL_22000_SU_Z0_FW_PRE __stringify(api) ".ucode"
106#define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \ 108#define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \
107 IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode" 109 IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode"
108#define IWL_CC_A_MODULE_FIRMWARE(api) \ 110#define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \
111 IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode"
112#define IWL_QNJ_B_JF_B_MODULE_FIRMWARE(api) \
113 IWL_QNJ_B_JF_B_FW_PRE __stringify(api) ".ucode"
114#define IWL_CC_A_MODULE_FIRMWARE(api) \
109 IWL_CC_A_FW_PRE __stringify(api) ".ucode" 115 IWL_CC_A_FW_PRE __stringify(api) ".ucode"
116#define IWL_22000_SO_A_JF_B_MODULE_FIRMWARE(api) \
117 IWL_22000_SO_A_JF_B_FW_PRE __stringify(api) ".ucode"
118#define IWL_22000_SO_A_HR_B_MODULE_FIRMWARE(api) \
119 IWL_22000_SO_A_HR_B_FW_PRE __stringify(api) ".ucode"
120#define IWL_22000_SO_A_GF_A_MODULE_FIRMWARE(api) \
121 IWL_22000_SO_A_GF_A_FW_PRE __stringify(api) ".ucode"
122#define IWL_22000_TY_A_GF_A_MODULE_FIRMWARE(api) \
123 IWL_22000_TY_A_GF_A_FW_PRE __stringify(api) ".ucode"
110 124
111static const struct iwl_base_params iwl_22000_base_params = { 125static const struct iwl_base_params iwl_22000_base_params = {
112 .eeprom_size = OTP_LOW_IMAGE_SIZE_32K, 126 .eeprom_size = OTP_LOW_IMAGE_SIZE_32K,
@@ -167,6 +181,10 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
167 .d3_debug_data_base_addr = 0x401000, \ 181 .d3_debug_data_base_addr = 0x401000, \
168 .d3_debug_data_length = 60 * 1024 182 .d3_debug_data_length = 60 * 1024
169 183
184#define IWL_DEVICE_AX200_COMMON \
185 IWL_DEVICE_22000_COMMON, \
186 .umac_prph_offset = 0x300000
187
170#define IWL_DEVICE_22500 \ 188#define IWL_DEVICE_22500 \
171 IWL_DEVICE_22000_COMMON, \ 189 IWL_DEVICE_22000_COMMON, \
172 .device_family = IWL_DEVICE_FAMILY_22000, \ 190 .device_family = IWL_DEVICE_FAMILY_22000, \
@@ -179,6 +197,13 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
179 .base_params = &iwl_22560_base_params, \ 197 .base_params = &iwl_22560_base_params, \
180 .csr = &iwl_csr_v2 198 .csr = &iwl_csr_v2
181 199
200#define IWL_DEVICE_AX210 \
201 IWL_DEVICE_AX200_COMMON, \
202 .device_family = IWL_DEVICE_FAMILY_AX210, \
203 .base_params = &iwl_22000_base_params, \
204 .csr = &iwl_csr_v1, \
205 .min_txq_size = 128
206
182const struct iwl_cfg iwl22000_2ac_cfg_hr = { 207const struct iwl_cfg iwl22000_2ac_cfg_hr = {
183 .name = "Intel(R) Dual Band Wireless AC 22000", 208 .name = "Intel(R) Dual Band Wireless AC 22000",
184 .fw_name_pre = IWL_22000_HR_FW_PRE, 209 .fw_name_pre = IWL_22000_HR_FW_PRE,
@@ -198,8 +223,8 @@ const struct iwl_cfg iwl22000_2ac_cfg_jf = {
198 IWL_DEVICE_22500, 223 IWL_DEVICE_22500,
199}; 224};
200 225
201const struct iwl_cfg iwl22560_2ax_cfg_hr = { 226const struct iwl_cfg iwl_ax101_cfg_qu_hr = {
202 .name = "Intel(R) Wireless-AX 22560", 227 .name = "Intel(R) Wi-Fi 6 AX101",
203 .fw_name_pre = IWL_22000_QU_B_HR_B_FW_PRE, 228 .fw_name_pre = IWL_22000_QU_B_HR_B_FW_PRE,
204 IWL_DEVICE_22500, 229 IWL_DEVICE_22500,
205 /* 230 /*
@@ -220,10 +245,11 @@ const struct iwl_cfg iwl22260_2ax_cfg = {
220 * HT size; mac80211 would otherwise pick the HE max (256) by default. 245 * HT size; mac80211 would otherwise pick the HE max (256) by default.
221 */ 246 */
222 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, 247 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
248 .bisr_workaround = 1,
223}; 249};
224 250
225const struct iwl_cfg killer1650x_2ax_cfg = { 251const struct iwl_cfg killer1650x_2ax_cfg = {
226 .name = "Killer(R) Wireless-AX 1650x Wireless Network Adapter (22260NGW)", 252 .name = "Killer(R) Wireless-AX 1650x Wireless Network Adapter (200NGW)",
227 .fw_name_pre = IWL_CC_A_FW_PRE, 253 .fw_name_pre = IWL_CC_A_FW_PRE,
228 IWL_DEVICE_22500, 254 IWL_DEVICE_22500,
229 /* 255 /*
@@ -232,10 +258,11 @@ const struct iwl_cfg killer1650x_2ax_cfg = {
232 * HT size; mac80211 would otherwise pick the HE max (256) by default. 258 * HT size; mac80211 would otherwise pick the HE max (256) by default.
233 */ 259 */
234 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, 260 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
261 .bisr_workaround = 1,
235}; 262};
236 263
237const struct iwl_cfg killer1650w_2ax_cfg = { 264const struct iwl_cfg killer1650w_2ax_cfg = {
238 .name = "Killer(R) Wireless-AX 1650w Wireless Network Adapter (22260D2W)", 265 .name = "Killer(R) Wireless-AX 1650w Wireless Network Adapter (200D2W)",
239 .fw_name_pre = IWL_CC_A_FW_PRE, 266 .fw_name_pre = IWL_CC_A_FW_PRE,
240 IWL_DEVICE_22500, 267 IWL_DEVICE_22500,
241 /* 268 /*
@@ -244,6 +271,7 @@ const struct iwl_cfg killer1650w_2ax_cfg = {
244 * HT size; mac80211 would otherwise pick the HE max (256) by default. 271 * HT size; mac80211 would otherwise pick the HE max (256) by default.
245 */ 272 */
246 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, 273 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
274 .bisr_workaround = 1,
247}; 275};
248 276
249/* 277/*
@@ -275,6 +303,18 @@ const struct iwl_cfg iwl9560_2ac_160_cfg_qu_b0_jf_b0 = {
275 IWL_DEVICE_22500, 303 IWL_DEVICE_22500,
276}; 304};
277 305
306const struct iwl_cfg iwl9560_2ac_cfg_qnj_jf_b0 = {
307 .name = "Intel(R) Wireless-AC 9560 160MHz",
308 .fw_name_pre = IWL_QNJ_B_JF_B_FW_PRE,
309 IWL_DEVICE_22500,
310 /*
311 * This device doesn't support receiving BlockAck with a large bitmap
312 * so we need to restrict the size of transmitted aggregation to the
313 * HT size; mac80211 would otherwise pick the HE max (256) by default.
314 */
315 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
316};
317
278const struct iwl_cfg killer1550i_2ac_cfg_qu_b0_jf_b0 = { 318const struct iwl_cfg killer1550i_2ac_cfg_qu_b0_jf_b0 = {
279 .name = "Killer (R) Wireless-AC 1550i Wireless Network Adapter (9560NGW)", 319 .name = "Killer (R) Wireless-AC 1550i Wireless Network Adapter (9560NGW)",
280 .fw_name_pre = IWL_QU_B_JF_B_FW_PRE, 320 .fw_name_pre = IWL_QU_B_JF_B_FW_PRE,
@@ -347,18 +387,6 @@ const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_b0 = {
347 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, 387 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
348}; 388};
349 389
350const struct iwl_cfg iwl22000_2ax_cfg_qnj_jf_b0 = {
351 .name = "Intel(R) Dual Band Wireless AX 22000",
352 .fw_name_pre = IWL_22000_JF_B0_FW_PRE,
353 IWL_DEVICE_22500,
354 /*
355 * This device doesn't support receiving BlockAck with a large bitmap
356 * so we need to restrict the size of transmitted aggregation to the
357 * HT size; mac80211 would otherwise pick the HE max (256) by default.
358 */
359 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
360};
361
362const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0 = { 390const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0 = {
363 .name = "Intel(R) Dual Band Wireless AX 22000", 391 .name = "Intel(R) Dual Band Wireless AX 22000",
364 .fw_name_pre = IWL_22000_HR_A0_FW_PRE, 392 .fw_name_pre = IWL_22000_HR_A0_FW_PRE,
@@ -384,13 +412,41 @@ const struct iwl_cfg iwl22560_2ax_cfg_su_cdb = {
384 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, 412 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
385}; 413};
386 414
415const struct iwl_cfg iwlax210_2ax_cfg_so_jf_a0 = {
416 .name = "Intel(R) Wireless-AC 9560 160MHz",
417 .fw_name_pre = IWL_22000_SO_A_JF_B_FW_PRE,
418 IWL_DEVICE_AX210,
419};
420
421const struct iwl_cfg iwlax210_2ax_cfg_so_hr_a0 = {
422 .name = "Intel(R) Wi-Fi 6 AX201 160MHz",
423 .fw_name_pre = IWL_22000_SO_A_HR_B_FW_PRE,
424 IWL_DEVICE_AX210,
425};
426
427const struct iwl_cfg iwlax210_2ax_cfg_so_gf_a0 = {
428 .name = "Intel(R) Wi-Fi 7 AX211 160MHz",
429 .fw_name_pre = IWL_22000_SO_A_GF_A_FW_PRE,
430 IWL_DEVICE_AX210,
431};
432
433const struct iwl_cfg iwlax210_2ax_cfg_ty_gf_a0 = {
434 .name = "Intel(R) Wi-Fi 7 AX210 160MHz",
435 .fw_name_pre = IWL_22000_TY_A_GF_A_FW_PRE,
436 IWL_DEVICE_AX210,
437};
438
387MODULE_FIRMWARE(IWL_22000_HR_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 439MODULE_FIRMWARE(IWL_22000_HR_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
388MODULE_FIRMWARE(IWL_22000_JF_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 440MODULE_FIRMWARE(IWL_22000_JF_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
389MODULE_FIRMWARE(IWL_22000_HR_A_F0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 441MODULE_FIRMWARE(IWL_22000_HR_A_F0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
390MODULE_FIRMWARE(IWL_22000_HR_B_F0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 442MODULE_FIRMWARE(IWL_22000_HR_B_F0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
391MODULE_FIRMWARE(IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 443MODULE_FIRMWARE(IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
392MODULE_FIRMWARE(IWL_22000_JF_B0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
393MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 444MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
394MODULE_FIRMWARE(IWL_22000_SU_Z0_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 445MODULE_FIRMWARE(IWL_22000_SU_Z0_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
395MODULE_FIRMWARE(IWL_QU_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 446MODULE_FIRMWARE(IWL_QU_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
447MODULE_FIRMWARE(IWL_QNJ_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
396MODULE_FIRMWARE(IWL_CC_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); 448MODULE_FIRMWARE(IWL_CC_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
449MODULE_FIRMWARE(IWL_22000_SO_A_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
450MODULE_FIRMWARE(IWL_22000_SO_A_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
451MODULE_FIRMWARE(IWL_22000_SO_A_GF_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
452MODULE_FIRMWARE(IWL_22000_TY_A_GF_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
index 113bcf7735a0..3225b64eb845 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/9000.c
@@ -57,7 +57,7 @@
57#include "fw/file.h" 57#include "fw/file.h"
58 58
59/* Highest firmware API version supported */ 59/* Highest firmware API version supported */
60#define IWL9000_UCODE_API_MAX 43 60#define IWL9000_UCODE_API_MAX 46
61 61
62/* Lowest firmware API version supported */ 62/* Lowest firmware API version supported */
63#define IWL9000_UCODE_API_MIN 30 63#define IWL9000_UCODE_API_MIN 30
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/agn.h b/drivers/net/wireless/intel/iwlwifi/dvm/agn.h
index 431e13c6ee35..254a5ce52456 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/agn.h
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/agn.h
@@ -439,13 +439,10 @@ static inline void iwl_dvm_set_pmi(struct iwl_priv *priv, bool state)
439} 439}
440 440
441#ifdef CONFIG_IWLWIFI_DEBUGFS 441#ifdef CONFIG_IWLWIFI_DEBUGFS
442int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir); 442void iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir);
443#else 443#else
444static inline int iwl_dbgfs_register(struct iwl_priv *priv, 444static inline void iwl_dbgfs_register(struct iwl_priv *priv,
445 struct dentry *dbgfs_dir) 445 struct dentry *dbgfs_dir) { }
446{
447 return 0;
448}
449#endif /* CONFIG_IWLWIFI_DEBUGFS */ 446#endif /* CONFIG_IWLWIFI_DEBUGFS */
450 447
451#ifdef CONFIG_IWLWIFI_DEBUG 448#ifdef CONFIG_IWLWIFI_DEBUG
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
index 3d2e44a642de..d4b19673b06a 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
@@ -3,6 +3,7 @@
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
6 * Copyright (C) 2018 Intel Corporation
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 9 * it under the terms of version 2 of the GNU General Public License as
@@ -36,31 +37,8 @@
36 37
37/* create and remove of files */ 38/* create and remove of files */
38#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ 39#define DEBUGFS_ADD_FILE(name, parent, mode) do { \
39 if (!debugfs_create_file(#name, mode, parent, priv, \ 40 debugfs_create_file(#name, mode, parent, priv, \
40 &iwl_dbgfs_##name##_ops)) \ 41 &iwl_dbgfs_##name##_ops); \
41 goto err; \
42} while (0)
43
44#define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \
45 struct dentry *__tmp; \
46 __tmp = debugfs_create_bool(#name, 0600, parent, ptr); \
47 if (IS_ERR(__tmp) || !__tmp) \
48 goto err; \
49} while (0)
50
51#define DEBUGFS_ADD_X32(name, parent, ptr) do { \
52 struct dentry *__tmp; \
53 __tmp = debugfs_create_x32(#name, 0600, parent, ptr); \
54 if (IS_ERR(__tmp) || !__tmp) \
55 goto err; \
56} while (0)
57
58#define DEBUGFS_ADD_U32(name, parent, ptr, mode) do { \
59 struct dentry *__tmp; \
60 __tmp = debugfs_create_u32(#name, mode, \
61 parent, ptr); \
62 if (IS_ERR(__tmp) || !__tmp) \
63 goto err; \
64} while (0) 42} while (0)
65 43
66/* file operation */ 44/* file operation */
@@ -2238,7 +2216,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file,
2238 buf_size = min(count, sizeof(buf) - 1); 2216 buf_size = min(count, sizeof(buf) - 1);
2239 if (copy_from_user(buf, user_buf, buf_size)) 2217 if (copy_from_user(buf, user_buf, buf_size))
2240 return -EFAULT; 2218 return -EFAULT;
2241 if (sscanf(buf, "%d", &event_log_flag) != 1) 2219 if (sscanf(buf, "%u", &event_log_flag) != 1)
2242 return -EFAULT; 2220 return -EFAULT;
2243 if (event_log_flag == 1) 2221 if (event_log_flag == 1)
2244 iwl_dump_nic_event_log(priv, true, NULL); 2222 iwl_dump_nic_event_log(priv, true, NULL);
@@ -2347,21 +2325,15 @@ DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled);
2347 * Create the debugfs files and directories 2325 * Create the debugfs files and directories
2348 * 2326 *
2349 */ 2327 */
2350int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir) 2328void iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir)
2351{ 2329{
2352 struct dentry *dir_data, *dir_rf, *dir_debug; 2330 struct dentry *dir_data, *dir_rf, *dir_debug;
2353 2331
2354 priv->debugfs_dir = dbgfs_dir; 2332 priv->debugfs_dir = dbgfs_dir;
2355 2333
2356 dir_data = debugfs_create_dir("data", dbgfs_dir); 2334 dir_data = debugfs_create_dir("data", dbgfs_dir);
2357 if (!dir_data)
2358 goto err;
2359 dir_rf = debugfs_create_dir("rf", dbgfs_dir); 2335 dir_rf = debugfs_create_dir("rf", dbgfs_dir);
2360 if (!dir_rf)
2361 goto err;
2362 dir_debug = debugfs_create_dir("debug", dbgfs_dir); 2336 dir_debug = debugfs_create_dir("debug", dbgfs_dir);
2363 if (!dir_debug)
2364 goto err;
2365 2337
2366 DEBUGFS_ADD_FILE(nvm, dir_data, 0400); 2338 DEBUGFS_ADD_FILE(nvm, dir_data, 0400);
2367 DEBUGFS_ADD_FILE(sram, dir_data, 0600); 2339 DEBUGFS_ADD_FILE(sram, dir_data, 0600);
@@ -2421,13 +2393,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir)
2421 2393
2422 snprintf(buf, 100, "../../%pd2", dev_dir); 2394 snprintf(buf, 100, "../../%pd2", dev_dir);
2423 2395
2424 if (!debugfs_create_symlink("iwlwifi", mac80211_dir, buf)) 2396 debugfs_create_symlink("iwlwifi", mac80211_dir, buf);
2425 goto err;
2426 } 2397 }
2427
2428 return 0;
2429
2430err:
2431 IWL_ERR(priv, "failed to create the dvm debugfs entries\n");
2432 return -ENOMEM;
2433} 2398}
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c
index bd3c3b921d4c..7c68a86ed9e1 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c
@@ -1509,13 +1509,10 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
1509 if (iwlagn_mac_setup_register(priv, &fw->ucode_capa)) 1509 if (iwlagn_mac_setup_register(priv, &fw->ucode_capa))
1510 goto out_destroy_workqueue; 1510 goto out_destroy_workqueue;
1511 1511
1512 if (iwl_dbgfs_register(priv, dbgfs_dir)) 1512 iwl_dbgfs_register(priv, dbgfs_dir);
1513 goto out_mac80211_unregister;
1514 1513
1515 return op_mode; 1514 return op_mode;
1516 1515
1517out_mac80211_unregister:
1518 iwlagn_mac_unregister(priv);
1519out_destroy_workqueue: 1516out_destroy_workqueue:
1520 iwl_tt_exit(priv); 1517 iwl_tt_exit(priv);
1521 iwl_cancel_deferred_work(priv); 1518 iwl_cancel_deferred_work(priv);
@@ -1881,7 +1878,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
1881 return pos; 1878 return pos;
1882 } 1879 }
1883 1880
1884 if (!(iwl_have_debug_level(IWL_DL_FW_ERRORS)) && !full_log) 1881 if (!(iwl_have_debug_level(IWL_DL_FW)) && !full_log)
1885 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) 1882 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
1886 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; 1883 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
1887 IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n", 1884 IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n",
@@ -1897,7 +1894,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
1897 if (!*buf) 1894 if (!*buf)
1898 return -ENOMEM; 1895 return -ENOMEM;
1899 } 1896 }
1900 if (iwl_have_debug_level(IWL_DL_FW_ERRORS) || full_log) { 1897 if (iwl_have_debug_level(IWL_DL_FW) || full_log) {
1901 /* 1898 /*
1902 * if uCode has wrapped back to top of log, 1899 * if uCode has wrapped back to top of log,
1903 * start at the oldest entry, 1900 * start at the oldest entry,
@@ -1927,7 +1924,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
1927 unsigned int reload_msec; 1924 unsigned int reload_msec;
1928 unsigned long reload_jiffies; 1925 unsigned long reload_jiffies;
1929 1926
1930 if (iwl_have_debug_level(IWL_DL_FW_ERRORS)) 1927 if (iwl_have_debug_level(IWL_DL_FW))
1931 iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS); 1928 iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS);
1932 1929
1933 /* uCode is no longer loaded. */ 1930 /* uCode is no longer loaded. */
@@ -1965,12 +1962,12 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
1965 1962
1966 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { 1963 if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
1967 if (iwlwifi_mod_params.fw_restart) { 1964 if (iwlwifi_mod_params.fw_restart) {
1968 IWL_DEBUG_FW_ERRORS(priv, 1965 IWL_DEBUG_FW(priv,
1969 "Restarting adapter due to uCode error.\n"); 1966 "Restarting adapter due to uCode error.\n");
1970 queue_work(priv->workqueue, &priv->restart); 1967 queue_work(priv->workqueue, &priv->restart);
1971 } else 1968 } else
1972 IWL_DEBUG_FW_ERRORS(priv, 1969 IWL_DEBUG_FW(priv,
1973 "Detected FW error, but not restarting\n"); 1970 "Detected FW error, but not restarting\n");
1974 } 1971 }
1975} 1972}
1976 1973
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rx.c b/drivers/net/wireless/intel/iwlwifi/dvm/rx.c
index 6f17a5e24e82..e224b23f0ba8 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/rx.c
@@ -2,6 +2,7 @@
2 * 2 *
3 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
4 * Copyright(c) 2015 Intel Deutschland GmbH 4 * Copyright(c) 2015 Intel Deutschland GmbH
5 * Copyright(c) 2018 Intel Corporation
5 * 6 *
6 * Portions of this file are derived from the ipw3945 project, as well 7 * Portions of this file are derived from the ipw3945 project, as well
7 * as portionhelp of the ieee80211 subsystem header files. 8 * as portionhelp of the ieee80211 subsystem header files.
@@ -592,7 +593,7 @@ static int iwlagn_set_decrypted_flag(struct iwl_priv *priv,
592 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == 593 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
593 RX_RES_STATUS_BAD_KEY_TTAK) 594 RX_RES_STATUS_BAD_KEY_TTAK)
594 break; 595 break;
595 596 /* fall through */
596 case RX_RES_STATUS_SEC_TYPE_WEP: 597 case RX_RES_STATUS_SEC_TYPE_WEP:
597 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == 598 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
598 RX_RES_STATUS_BAD_ICV_MIC) { 599 RX_RES_STATUS_BAD_ICV_MIC) {
@@ -601,6 +602,7 @@ static int iwlagn_set_decrypted_flag(struct iwl_priv *priv,
601 IWL_DEBUG_RX(priv, "Packet destroyed\n"); 602 IWL_DEBUG_RX(priv, "Packet destroyed\n");
602 return -1; 603 return -1;
603 } 604 }
605 /* fall through */
604 case RX_RES_STATUS_SEC_TYPE_CCMP: 606 case RX_RES_STATUS_SEC_TYPE_CCMP:
605 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == 607 if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
606 RX_RES_STATUS_DECRYPT_OK) { 608 RX_RES_STATUS_DECRYPT_OK) {
@@ -729,7 +731,7 @@ static u32 iwlagn_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
729 decrypt_out |= RX_RES_STATUS_BAD_KEY_TTAK; 731 decrypt_out |= RX_RES_STATUS_BAD_KEY_TTAK;
730 break; 732 break;
731 } 733 }
732 /* fall through if TTAK OK */ 734 /* fall through */
733 default: 735 default:
734 if (!(decrypt_in & RX_MPDU_RES_STATUS_ICV_OK)) 736 if (!(decrypt_in & RX_MPDU_RES_STATUS_ICV_OK))
735 decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC; 737 decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC;
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/scan.c b/drivers/net/wireless/intel/iwlwifi/dvm/scan.c
index 8d7aafb4d9e9..f190f7beb3a8 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/scan.c
@@ -3,6 +3,7 @@
3 * GPL LICENSE SUMMARY 3 * GPL LICENSE SUMMARY
4 * 4 *
5 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 5 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
6 * Copyright(c) 2018 Intel Corporation
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * 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 9 * it under the terms of version 2 of the GNU General Public License as
@@ -418,7 +419,7 @@ static u16 iwl_limit_dwell(struct iwl_priv *priv, u16 dwell_time)
418 limit = (limits[1] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; 419 limit = (limits[1] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2;
419 limit /= 2; 420 limit /= 2;
420 dwell_time = min(limit, dwell_time); 421 dwell_time = min(limit, dwell_time);
421 /* fall through to limit further */ 422 /* fall through */
422 case 1: 423 case 1:
423 limit = (limits[0] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; 424 limit = (limits[0] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2;
424 limit /= n_active; 425 limit /= n_active;
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
index 32d000cffe9f..405038ce98d6 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
@@ -6,6 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2017 Intel Deutschland GmbH 8 * Copyright(c) 2017 Intel Deutschland GmbH
9 * Copyright (C) 2019 Intel Corporation
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * 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 12 * it under the terms of version 2 of the GNU General Public License as
@@ -26,6 +27,7 @@
26 * BSD LICENSE 27 * BSD LICENSE
27 * 28 *
28 * Copyright(c) 2017 Intel Deutschland GmbH 29 * Copyright(c) 2017 Intel Deutschland GmbH
30 * Copyright (C) 2019 Intel Corporation
29 * All rights reserved. 31 * All rights reserved.
30 * 32 *
31 * Redistribution and use in source and binary forms, with or without 33 * Redistribution and use in source and binary forms, with or without
@@ -205,3 +207,33 @@ out:
205 return dflt_pwr_limit; 207 return dflt_pwr_limit;
206} 208}
207IWL_EXPORT_SYMBOL(iwl_acpi_get_pwr_limit); 209IWL_EXPORT_SYMBOL(iwl_acpi_get_pwr_limit);
210
211int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk)
212{
213 union acpi_object *wifi_pkg, *data;
214 int ret;
215
216 data = iwl_acpi_get_object(dev, ACPI_ECKV_METHOD);
217 if (IS_ERR(data))
218 return PTR_ERR(data);
219
220 wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_ECKV_WIFI_DATA_SIZE);
221 if (IS_ERR(wifi_pkg)) {
222 ret = PTR_ERR(wifi_pkg);
223 goto out_free;
224 }
225
226 if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
227 ret = -EINVAL;
228 goto out_free;
229 }
230
231 *extl_clk = wifi_pkg->package.elements[1].integer.value;
232
233 ret = 0;
234
235out_free:
236 kfree(data);
237 return ret;
238}
239IWL_EXPORT_SYMBOL(iwl_acpi_get_eckv);
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
index 7492dfb6729b..f5704e16643f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
@@ -6,7 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2017 Intel Deutschland GmbH 8 * Copyright(c) 2017 Intel Deutschland GmbH
9 * Copyright(c) 2018 Intel Corporation 9 * Copyright(c) 2018 - 2019 Intel Corporation
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as 12 * it under the terms of version 2 of the GNU General Public License as
@@ -27,7 +27,7 @@
27 * BSD LICENSE 27 * BSD LICENSE
28 * 28 *
29 * Copyright(c) 2017 Intel Deutschland GmbH 29 * Copyright(c) 2017 Intel Deutschland GmbH
30 * Copyright(c) 2018 Intel Corporation 30 * Copyright(c) 2018 - 2019 Intel Corporation
31 * All rights reserved. 31 * All rights reserved.
32 * 32 *
33 * Redistribution and use in source and binary forms, with or without 33 * Redistribution and use in source and binary forms, with or without
@@ -67,6 +67,7 @@
67#define ACPI_WGDS_METHOD "WGDS" 67#define ACPI_WGDS_METHOD "WGDS"
68#define ACPI_WRDD_METHOD "WRDD" 68#define ACPI_WRDD_METHOD "WRDD"
69#define ACPI_SPLC_METHOD "SPLC" 69#define ACPI_SPLC_METHOD "SPLC"
70#define ACPI_ECKV_METHOD "ECKV"
70 71
71#define ACPI_WIFI_DOMAIN (0x07) 72#define ACPI_WIFI_DOMAIN (0x07)
72 73
@@ -86,6 +87,7 @@
86#define ACPI_WGDS_WIFI_DATA_SIZE 19 87#define ACPI_WGDS_WIFI_DATA_SIZE 19
87#define ACPI_WRDD_WIFI_DATA_SIZE 2 88#define ACPI_WRDD_WIFI_DATA_SIZE 2
88#define ACPI_SPLC_WIFI_DATA_SIZE 2 89#define ACPI_SPLC_WIFI_DATA_SIZE 2
90#define ACPI_ECKV_WIFI_DATA_SIZE 2
89 91
90#define ACPI_WGDS_NUM_BANDS 2 92#define ACPI_WGDS_NUM_BANDS 2
91#define ACPI_WGDS_TABLE_SIZE 3 93#define ACPI_WGDS_TABLE_SIZE 3
@@ -109,6 +111,17 @@ int iwl_acpi_get_mcc(struct device *dev, char *mcc);
109 111
110u64 iwl_acpi_get_pwr_limit(struct device *dev); 112u64 iwl_acpi_get_pwr_limit(struct device *dev);
111 113
114/*
115 * iwl_acpi_get_eckv - read external clock validation from ACPI, if available
116 *
117 * @dev: the struct device
118 * @extl_clk: output var (2 bytes) that will get the clk indication.
119 *
120 * This function tries to read the external clock indication
121 * from ACPI if available.
122 */
123int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk);
124
112#else /* CONFIG_ACPI */ 125#else /* CONFIG_ACPI */
113 126
114static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method) 127static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
@@ -133,5 +146,10 @@ static inline u64 iwl_acpi_get_pwr_limit(struct device *dev)
133 return 0; 146 return 0;
134} 147}
135 148
149static inline int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk)
150{
151 return -ENOENT;
152}
153
136#endif /* CONFIG_ACPI */ 154#endif /* CONFIG_ACPI */
137#endif /* __iwl_fw_acpi__ */ 155#endif /* __iwl_fw_acpi__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/alive.h b/drivers/net/wireless/intel/iwlwifi/fw/api/alive.h
index 08d3d8a190f6..df1bd0d2450e 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/alive.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/alive.h
@@ -96,14 +96,7 @@ enum {
96 96
97#define IWL_ALIVE_FLG_RFKILL BIT(0) 97#define IWL_ALIVE_FLG_RFKILL BIT(0)
98 98
99struct iwl_lmac_alive { 99struct iwl_lmac_debug_addrs {
100 __le32 ucode_major;
101 __le32 ucode_minor;
102 u8 ver_subtype;
103 u8 ver_type;
104 u8 mac;
105 u8 opt;
106 __le32 timestamp;
107 __le32 error_event_table_ptr; /* SRAM address for error log */ 100 __le32 error_event_table_ptr; /* SRAM address for error log */
108 __le32 log_event_table_ptr; /* SRAM address for LMAC event log */ 101 __le32 log_event_table_ptr; /* SRAM address for LMAC event log */
109 __le32 cpu_register_ptr; 102 __le32 cpu_register_ptr;
@@ -112,13 +105,28 @@ struct iwl_lmac_alive {
112 __le32 scd_base_ptr; /* SRAM address for SCD */ 105 __le32 scd_base_ptr; /* SRAM address for SCD */
113 __le32 st_fwrd_addr; /* pointer to Store and forward */ 106 __le32 st_fwrd_addr; /* pointer to Store and forward */
114 __le32 st_fwrd_size; 107 __le32 st_fwrd_size;
108} __packed; /* UCODE_DEBUG_ADDRS_API_S_VER_2 */
109
110struct iwl_lmac_alive {
111 __le32 ucode_major;
112 __le32 ucode_minor;
113 u8 ver_subtype;
114 u8 ver_type;
115 u8 mac;
116 u8 opt;
117 __le32 timestamp;
118 struct iwl_lmac_debug_addrs dbg_ptrs;
115} __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */ 119} __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
116 120
121struct iwl_umac_debug_addrs {
122 __le32 error_info_addr; /* SRAM address for UMAC error log */
123 __le32 dbg_print_buff_addr;
124} __packed; /* UMAC_DEBUG_ADDRS_API_S_VER_1 */
125
117struct iwl_umac_alive { 126struct iwl_umac_alive {
118 __le32 umac_major; /* UMAC version: major */ 127 __le32 umac_major; /* UMAC version: major */
119 __le32 umac_minor; /* UMAC version: minor */ 128 __le32 umac_minor; /* UMAC version: minor */
120 __le32 error_info_addr; /* SRAM address for UMAC error log */ 129 struct iwl_umac_debug_addrs dbg_ptrs;
121 __le32 dbg_print_buff_addr;
122} __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */ 130} __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */
123 131
124struct mvm_alive_resp_v3 { 132struct mvm_alive_resp_v3 {
@@ -189,4 +197,24 @@ struct iwl_card_state_notif {
189 __le32 flags; 197 __le32 flags;
190} __packed; /* CARD_STATE_NTFY_API_S_VER_1 */ 198} __packed; /* CARD_STATE_NTFY_API_S_VER_1 */
191 199
200/**
201 * enum iwl_error_recovery_flags - flags for error recovery cmd
202 * @ERROR_RECOVERY_UPDATE_DB: update db from blob sent
203 * @ERROR_RECOVERY_END_OF_RECOVERY: end of recovery
204 */
205enum iwl_error_recovery_flags {
206 ERROR_RECOVERY_UPDATE_DB = BIT(0),
207 ERROR_RECOVERY_END_OF_RECOVERY = BIT(1),
208};
209
210/**
211 * struct iwl_fw_error_recovery_cmd - recovery cmd sent upon assert
212 * @flags: &enum iwl_error_recovery_flags
213 * @buf_size: db buffer size in bytes
214 */
215struct iwl_fw_error_recovery_cmd {
216 __le32 flags;
217 __le32 buf_size;
218} __packed; /* ERROR_RECOVERY_CMD_HDR_API_S_VER_1 */
219
192#endif /* __iwl_fw_api_alive_h__ */ 220#endif /* __iwl_fw_api_alive_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h b/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
index 0290b333d860..4d2274bcc0b5 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
@@ -643,6 +643,11 @@ enum iwl_system_subcmd_ids {
643 * @INIT_EXTENDED_CFG_CMD: &struct iwl_init_extended_cfg_cmd 643 * @INIT_EXTENDED_CFG_CMD: &struct iwl_init_extended_cfg_cmd
644 */ 644 */
645 INIT_EXTENDED_CFG_CMD = 0x03, 645 INIT_EXTENDED_CFG_CMD = 0x03,
646
647 /**
648 * @FW_ERROR_RECOVERY_CMD: &struct iwl_fw_error_recovery_cmd
649 */
650 FW_ERROR_RECOVERY_CMD = 0x7,
646}; 651};
647 652
648#endif /* __iwl_fw_api_commands_h__ */ 653#endif /* __iwl_fw_api_commands_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h b/drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h
index ab82b7a67967..33858787817b 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright (C) 2018 Intel Corporation 8 * Copyright (C) 2018 - 2019 Intel Corporation
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
@@ -25,7 +25,7 @@
25 * 25 *
26 * BSD LICENSE 26 * BSD LICENSE
27 * 27 *
28 * Copyright (C) 2018 Intel Corporation 28 * Copyright (C) 2018 - 2019 Intel Corporation
29 * All rights reserved. 29 * All rights reserved.
30 * 30 *
31 * Redistribution and use in source and binary forms, with or without 31 * Redistribution and use in source and binary forms, with or without
@@ -70,7 +70,7 @@ struct iwl_fw_ini_header {
70 __le32 tlv_version; 70 __le32 tlv_version;
71 __le32 apply_point; 71 __le32 apply_point;
72 u8 data[]; 72 u8 data[];
73} __packed; /* FW_INI_HEADER_TLV_S */ 73} __packed; /* FW_DEBUG_TLV_HEADER_S */
74 74
75/** 75/**
76 * struct iwl_fw_ini_allocation_tlv - (IWL_FW_INI_TLV_TYPE_BUFFER_ALLOCATION) 76 * struct iwl_fw_ini_allocation_tlv - (IWL_FW_INI_TLV_TYPE_BUFFER_ALLOCATION)
@@ -92,7 +92,7 @@ struct iwl_fw_ini_allocation_tlv {
92 __le32 size; 92 __le32 size;
93 __le32 max_fragments; 93 __le32 max_fragments;
94 __le32 min_frag_size; 94 __le32 min_frag_size;
95} __packed; /* FW_INI_BUFFER_ALLOCATION_TLV_S_VER_1 */ 95} __packed; /* FW_DEBUG_TLV_BUFFER_ALLOCATION_TLV_S_VER_1 */
96 96
97/** 97/**
98 * struct iwl_fw_ini_hcmd (IWL_FW_INI_TLV_TYPE_HCMD) 98 * struct iwl_fw_ini_hcmd (IWL_FW_INI_TLV_TYPE_HCMD)
@@ -108,7 +108,7 @@ struct iwl_fw_ini_hcmd {
108 u8 group; 108 u8 group;
109 __le16 padding; 109 __le16 padding;
110 u8 data[0]; 110 u8 data[0];
111} __packed; /* FW_INI_HCMD_S */ 111} __packed; /* FW_DEBUG_TLV_HCMD_DATA_S */
112 112
113/** 113/**
114 * struct iwl_fw_ini_hcmd_tlv 114 * struct iwl_fw_ini_hcmd_tlv
@@ -118,7 +118,7 @@ struct iwl_fw_ini_hcmd {
118struct iwl_fw_ini_hcmd_tlv { 118struct iwl_fw_ini_hcmd_tlv {
119 struct iwl_fw_ini_header header; 119 struct iwl_fw_ini_header header;
120 struct iwl_fw_ini_hcmd hcmd; 120 struct iwl_fw_ini_hcmd hcmd;
121} __packed; /* FW_INI_HCMD_TLV_S_VER_1 */ 121} __packed; /* FW_DEBUG_TLV_HCMD_S_VER_1 */
122 122
123/* 123/*
124 * struct iwl_fw_ini_debug_flow_tlv (IWL_FW_INI_TLV_TYPE_DEBUG_FLOW) 124 * struct iwl_fw_ini_debug_flow_tlv (IWL_FW_INI_TLV_TYPE_DEBUG_FLOW)
@@ -129,20 +129,50 @@ struct iwl_fw_ini_hcmd_tlv {
129struct iwl_fw_ini_debug_flow_tlv { 129struct iwl_fw_ini_debug_flow_tlv {
130 struct iwl_fw_ini_header header; 130 struct iwl_fw_ini_header header;
131 __le32 debug_flow_cfg; 131 __le32 debug_flow_cfg;
132} __packed; /* FW_INI_DEBUG_FLOW_TLV_S_VER_1 */ 132} __packed; /* FW_DEBUG_TLV_FLOW_TLV_S_VER_1 */
133 133
134#define IWL_FW_INI_MAX_REGION_ID 20 134#define IWL_FW_INI_MAX_REGION_ID 64
135#define IWL_FW_INI_MAX_NAME 32 135#define IWL_FW_INI_MAX_NAME 32
136
137/**
138 * struct iwl_fw_ini_region_cfg_internal - meta data of internal memory region
139 * @num_of_range: the amount of ranges in the region
140 * @range_data_size: size of the data to read per range, in bytes.
141 */
142struct iwl_fw_ini_region_cfg_internal {
143 __le32 num_of_ranges;
144 __le32 range_data_size;
145} __packed; /* FW_DEBUG_TLV_REGION_NIC_INTERNAL_RANGES_S */
146
147/**
148 * struct iwl_fw_ini_region_cfg_fifos - meta data of fifos region
149 * @fid1: fifo id 1 - bitmap of lmac tx/rx fifos to include in the region
150 * @fid2: fifo id 2 - bitmap of umac rx fifos to include in the region.
151 * It is unused for tx.
152 * @num_of_registers: number of prph registers in the region, each register is
153 * 4 bytes size.
154 * @header_only: none zero value indicates that this region does not include
155 * fifo data and includes only the given registers.
156 */
157struct iwl_fw_ini_region_cfg_fifos {
158 __le32 fid1;
159 __le32 fid2;
160 __le32 num_of_registers;
161 __le32 header_only;
162} __packed; /* FW_DEBUG_TLV_REGION_FIFOS_S */
163
136/** 164/**
137 * struct iwl_fw_ini_region_cfg 165 * struct iwl_fw_ini_region_cfg
138 * @region_id: ID of this dump configuration 166 * @region_id: ID of this dump configuration
139 * @region_type: &enum iwl_fw_ini_region_type 167 * @region_type: &enum iwl_fw_ini_region_type
140 * @num_regions: amount of regions in the address array. 168 * @num_regions: amount of regions in the address array.
141 * @allocation_id: For DRAM type field substitutes for allocation_id.
142 * @name_len: name length 169 * @name_len: name length
143 * @name: file name to use for this region 170 * @name: file name to use for this region
144 * @size: size of the data, in bytes.(unused for IWL_FW_INI_REGION_DRAM_BUFFER) 171 * @internal: used in case the region uses internal memory.
145 * @start_addr: array of addresses. (unused for IWL_FW_INI_REGION_DRAM_BUFFER) 172 * @allocation_id: For DRAM type field substitutes for allocation_id
173 * @fifos: used in case of fifos region.
174 * @offset: offset to use for each memory base address
175 * @start_addr: array of addresses.
146 */ 176 */
147struct iwl_fw_ini_region_cfg { 177struct iwl_fw_ini_region_cfg {
148 __le32 region_id; 178 __le32 region_id;
@@ -150,32 +180,38 @@ struct iwl_fw_ini_region_cfg {
150 __le32 name_len; 180 __le32 name_len;
151 u8 name[IWL_FW_INI_MAX_NAME]; 181 u8 name[IWL_FW_INI_MAX_NAME];
152 union { 182 union {
153 __le32 num_regions; 183 struct iwl_fw_ini_region_cfg_internal internal;
154 __le32 allocation_id; 184 __le32 allocation_id;
185 struct iwl_fw_ini_region_cfg_fifos fifos;
155 }; 186 };
156 __le32 size; 187 __le32 offset;
157 __le32 start_addr[]; 188 __le32 start_addr[];
158} __packed; /* FW_INI_REGION_CONFIG_S */ 189} __packed; /* FW_DEBUG_TLV_REGION_CONFIG_S */
159 190
160/** 191/**
161 * struct iwl_fw_ini_region_tlv - (IWL_FW_INI_TLV_TYPE_REGION_CFG) 192 * struct iwl_fw_ini_region_tlv - (IWL_FW_INI_TLV_TYPE_REGION_CFG)
162 * DUMP sections define IDs and triggers that use those IDs TLV 193 * DUMP sections define IDs and triggers that use those IDs TLV
163 * @header: header 194 * @header: header
164 * @num_regions: how many different region section and IDs are coming next 195 * @num_regions: how many different region section and IDs are coming next
165 * @iwl_fw_ini_dump dump_config: list of dump configurations 196 * @region_config: list of dump configurations
166 */ 197 */
167struct iwl_fw_ini_region_tlv { 198struct iwl_fw_ini_region_tlv {
168 struct iwl_fw_ini_header header; 199 struct iwl_fw_ini_header header;
169 __le32 num_regions; 200 __le32 num_regions;
170 struct iwl_fw_ini_region_cfg region_config[]; 201 struct iwl_fw_ini_region_cfg region_config[];
171} __packed; /* FW_INI_REGION_CFG_S */ 202} __packed; /* FW_DEBUG_TLV_REGIONS_S_VER_1 */
172 203
173/** 204/**
174 * struct iwl_fw_ini_trigger - (IWL_FW_INI_TLV_TYPE_DUMP_CFG) 205 * struct iwl_fw_ini_trigger - (IWL_FW_INI_TLV_TYPE_DUMP_CFG)
175 * Region sections define IDs and triggers that use those IDs TLV 206 * Region sections define IDs and triggers that use those IDs TLV
176 * 207 *
177 * @trigger_id: enum &iwl_fw_ini_tigger_id 208 * @trigger_id: enum &iwl_fw_ini_tigger_id
178 * @ignore_default: override FW TLV with binary TLV 209 * @override_trig: determines how apply trigger in case a trigger with the
210 * same id is already in use. Using the first 2 bytes:
211 * Byte 0: if 0, override trigger configuration, otherwise use the
212 * existing configuration.
213 * Byte 1: if 0, override trigger regions, otherwise append regions to
214 * existing trigger.
179 * @dump_delay: delay from trigger fire to dump, in usec 215 * @dump_delay: delay from trigger fire to dump, in usec
180 * @occurrences: max amount of times to be fired 216 * @occurrences: max amount of times to be fired
181 * @ignore_consec: ignore consecutive triggers, in usec 217 * @ignore_consec: ignore consecutive triggers, in usec
@@ -187,7 +223,7 @@ struct iwl_fw_ini_region_tlv {
187 */ 223 */
188struct iwl_fw_ini_trigger { 224struct iwl_fw_ini_trigger {
189 __le32 trigger_id; 225 __le32 trigger_id;
190 __le32 ignore_default; 226 __le32 override_trig;
191 __le32 dump_delay; 227 __le32 dump_delay;
192 __le32 occurrences; 228 __le32 occurrences;
193 __le32 ignore_consec; 229 __le32 ignore_consec;
@@ -196,7 +232,7 @@ struct iwl_fw_ini_trigger {
196 __le32 trigger_data; 232 __le32 trigger_data;
197 __le32 num_regions; 233 __le32 num_regions;
198 __le32 data[]; 234 __le32 data[];
199} __packed; /* FW_INI_TRIGGER_CONFIG_S */ 235} __packed; /* FW_TLV_DEBUG_TRIGGER_CONFIG_S */
200 236
201/** 237/**
202 * struct iwl_fw_ini_trigger_tlv - (IWL_FW_INI_TLV_TYPE_TRIGGERS_CFG) 238 * struct iwl_fw_ini_trigger_tlv - (IWL_FW_INI_TLV_TYPE_TRIGGERS_CFG)
@@ -210,20 +246,17 @@ struct iwl_fw_ini_trigger_tlv {
210 struct iwl_fw_ini_header header; 246 struct iwl_fw_ini_header header;
211 __le32 num_triggers; 247 __le32 num_triggers;
212 struct iwl_fw_ini_trigger trigger_config[]; 248 struct iwl_fw_ini_trigger trigger_config[];
213} __packed; /* FW_INI_TRIGGER_CFG_S */ 249} __packed; /* FW_TLV_DEBUG_TRIGGERS_S_VER_1 */
214 250
215/** 251/**
216 * enum iwl_fw_ini_trigger_id 252 * enum iwl_fw_ini_trigger_id
217 * @IWL_FW_TRIGGER_ID_FW_ASSERT: FW assert 253 * @IWL_FW_TRIGGER_ID_FW_ASSERT: FW assert
218 * @IWL_FW_TRIGGER_ID_FW_TFD_Q_HANG: TFD queue hang
219 * @IWL_FW_TRIGGER_ID_FW_HW_ERROR: HW assert 254 * @IWL_FW_TRIGGER_ID_FW_HW_ERROR: HW assert
220 * @IWL_FW_TRIGGER_ID_FW_TRIGGER_ERROR: FW error notification 255 * @IWL_FW_TRIGGER_ID_FW_TFD_Q_HANG: TFD queue hang
221 * @IWL_FW_TRIGGER_ID_FW_TRIGGER_WARNING: FW warning notification 256 * @IWL_FW_TRIGGER_ID_FW_DEBUG_HOST_TRIGGER: FW debug notification
222 * @IWL_FW_TRIGGER_ID_FW_TRIGGER_INFO: FW info notification 257 * @IWL_FW_TRIGGER_ID_FW_GENERIC_NOTIFOCATION: FW generic notification
223 * @IWL_FW_TRIGGER_ID_FW_TRIGGER_DEBUG: FW debug notification
224 * @IWL_FW_TRIGGER_ID_USER_TRIGGER: User trigger 258 * @IWL_FW_TRIGGER_ID_USER_TRIGGER: User trigger
225 * @IWL_FW_TRIGGER_ID_HOST_PEER_CLIENT_INACTIVITY: peer inactivity 259 * @IWL_FW_TRIGGER_ID_HOST_PEER_CLIENT_INACTIVITY: peer inactivity
226 * @FW_DEBUG_TLV_TRIGGER_ID_HOST_DID_INITIATED_EVENT: undefined
227 * @IWL_FW_TRIGGER_ID_HOST_TX_LATENCY_THRESHOLD_CROSSED: TX latency 260 * @IWL_FW_TRIGGER_ID_HOST_TX_LATENCY_THRESHOLD_CROSSED: TX latency
228 * threshold was crossed 261 * threshold was crossed
229 * @IWL_FW_TRIGGER_ID_HOST_TX_RESPONSE_STATUS_FAILED: TX failed 262 * @IWL_FW_TRIGGER_ID_HOST_TX_RESPONSE_STATUS_FAILED: TX failed
@@ -257,50 +290,53 @@ struct iwl_fw_ini_trigger_tlv {
257 * @IWL_FW_TRIGGER_ID_NUM: number of trigger IDs 290 * @IWL_FW_TRIGGER_ID_NUM: number of trigger IDs
258 */ 291 */
259enum iwl_fw_ini_trigger_id { 292enum iwl_fw_ini_trigger_id {
293 IWL_FW_TRIGGER_ID_INVALID = 0,
294
260 /* Errors triggers */ 295 /* Errors triggers */
261 IWL_FW_TRIGGER_ID_FW_ASSERT = 1, 296 IWL_FW_TRIGGER_ID_FW_ASSERT = 1,
262 IWL_FW_TRIGGER_ID_FW_TFD_Q_HANG = 2, 297 IWL_FW_TRIGGER_ID_FW_HW_ERROR = 2,
263 IWL_FW_TRIGGER_ID_FW_HW_ERROR = 3, 298 IWL_FW_TRIGGER_ID_FW_TFD_Q_HANG = 3,
264 /* Generic triggers */ 299
265 IWL_FW_TRIGGER_ID_FW_TRIGGER_ERROR = 4, 300 /* FW triggers */
266 IWL_FW_TRIGGER_ID_FW_TRIGGER_WARNING = 5, 301 IWL_FW_TRIGGER_ID_FW_DEBUG_HOST_TRIGGER = 4,
267 IWL_FW_TRIGGER_ID_FW_TRIGGER_INFO = 6, 302 IWL_FW_TRIGGER_ID_FW_GENERIC_NOTIFOCATION = 5,
268 IWL_FW_TRIGGER_ID_FW_TRIGGER_DEBUG = 7, 303
269 /* User Trigger */ 304 /* User trigger */
270 IWL_FW_TRIGGER_ID_USER_TRIGGER = 8, 305 IWL_FW_TRIGGER_ID_USER_TRIGGER = 6,
306
271 /* Host triggers */ 307 /* Host triggers */
272 IWL_FW_TRIGGER_ID_HOST_PEER_CLIENT_INACTIVITY = 9, 308 IWL_FW_TRIGGER_ID_HOST_PEER_CLIENT_INACTIVITY = 7,
273 IWL_FW_TRIGGER_ID_HOST_DID_INITIATED_EVENT = 10, 309 IWL_FW_TRIGGER_ID_HOST_TX_LATENCY_THRESHOLD_CROSSED = 8,
274 IWL_FW_TRIGGER_ID_HOST_TX_LATENCY_THRESHOLD_CROSSED = 11, 310 IWL_FW_TRIGGER_ID_HOST_TX_RESPONSE_STATUS_FAILED = 9,
275 IWL_FW_TRIGGER_ID_HOST_TX_RESPONSE_STATUS_FAILED = 12, 311 IWL_FW_TRIGGER_ID_HOST_OS_REQ_DEAUTH_PEER = 10,
276 IWL_FW_TRIGGER_ID_HOST_OS_REQ_DEAUTH_PEER = 13, 312 IWL_FW_TRIGGER_ID_HOST_STOP_GO_REQUEST = 11,
277 IWL_FW_TRIGGER_ID_HOST_STOP_GO_REQUEST = 14, 313 IWL_FW_TRIGGER_ID_HOST_START_GO_REQUEST = 12,
278 IWL_FW_TRIGGER_ID_HOST_START_GO_REQUEST = 15, 314 IWL_FW_TRIGGER_ID_HOST_JOIN_GROUP_REQUEST = 13,
279 IWL_FW_TRIGGER_ID_HOST_JOIN_GROUP_REQUEST = 16, 315 IWL_FW_TRIGGER_ID_HOST_SCAN_START = 14,
280 IWL_FW_TRIGGER_ID_HOST_SCAN_START = 17, 316 IWL_FW_TRIGGER_ID_HOST_SCAN_SUBMITTED = 15,
281 IWL_FW_TRIGGER_ID_HOST_SCAN_SUBITTED = 18, 317 IWL_FW_TRIGGER_ID_HOST_SCAN_PARAMS = 16,
282 IWL_FW_TRIGGER_ID_HOST_SCAN_PARAMS = 19, 318 IWL_FW_TRIGGER_ID_HOST_CHECK_FOR_HANG = 17,
283 IWL_FW_TRIGGER_ID_HOST_CHECK_FOR_HANG = 20, 319 IWL_FW_TRIGGER_ID_HOST_BAR_RECEIVED = 18,
284 IWL_FW_TRIGGER_ID_HOST_BAR_RECEIVED = 21, 320 IWL_FW_TRIGGER_ID_HOST_AGG_TX_RESPONSE_STATUS_FAILED = 19,
285 IWL_FW_TRIGGER_ID_HOST_AGG_TX_RESPONSE_STATUS_FAILED = 22, 321 IWL_FW_TRIGGER_ID_HOST_EAPOL_TX_RESPONSE_FAILED = 20,
286 IWL_FW_TRIGGER_ID_HOST_EAPOL_TX_RESPONSE_FAILED = 23, 322 IWL_FW_TRIGGER_ID_HOST_FAKE_TX_RESPONSE_SUSPECTED = 21,
287 IWL_FW_TRIGGER_ID_HOST_FAKE_TX_RESPONSE_SUSPECTED = 24, 323 IWL_FW_TRIGGER_ID_HOST_AUTH_REQ_FROM_ASSOC_CLIENT = 22,
288 IWL_FW_TRIGGER_ID_HOST_AUTH_REQ_FROM_ASSOC_CLIENT = 25, 324 IWL_FW_TRIGGER_ID_HOST_ROAM_COMPLETE = 23,
289 IWL_FW_TRIGGER_ID_HOST_ROAM_COMPLETE = 26, 325 IWL_FW_TRIGGER_ID_HOST_AUTH_ASSOC_FAST_FAILED = 24,
290 IWL_FW_TRIGGER_ID_HOST_AUTH_ASSOC_FAST_FAILED = 27, 326 IWL_FW_TRIGGER_ID_HOST_D3_START = 25,
291 IWL_FW_TRIGGER_ID_HOST_D3_START = 28, 327 IWL_FW_TRIGGER_ID_HOST_D3_END = 26,
292 IWL_FW_TRIGGER_ID_HOST_D3_END = 29, 328 IWL_FW_TRIGGER_ID_HOST_BSS_MISSED_BEACONS = 27,
293 IWL_FW_TRIGGER_ID_HOST_BSS_MISSED_BEACONS = 30, 329 IWL_FW_TRIGGER_ID_HOST_P2P_CLIENT_MISSED_BEACONS = 28,
294 IWL_FW_TRIGGER_ID_HOST_P2P_CLIENT_MISSED_BEACONS = 31, 330 IWL_FW_TRIGGER_ID_HOST_PEER_CLIENT_TX_FAILURES = 29,
295 IWL_FW_TRIGGER_ID_HOST_PEER_CLIENT_TX_FAILURES = 32, 331 IWL_FW_TRIGGER_ID_HOST_TX_WFD_ACTION_FRAME_FAILED = 30,
296 IWL_FW_TRIGGER_ID_HOST_TX_WFD_ACTION_FRAME_FAILED = 33, 332 IWL_FW_TRIGGER_ID_HOST_AUTH_ASSOC_FAILED = 31,
297 IWL_FW_TRIGGER_ID_HOST_AUTH_ASSOC_FAILED = 34, 333 IWL_FW_TRIGGER_ID_HOST_SCAN_COMPLETE = 32,
298 IWL_FW_TRIGGER_ID_HOST_SCAN_COMPLETE = 35, 334 IWL_FW_TRIGGER_ID_HOST_SCAN_ABORT = 33,
299 IWL_FW_TRIGGER_ID_HOST_SCAN_ABORT = 36, 335 IWL_FW_TRIGGER_ID_HOST_NIC_ALIVE = 34,
300 IWL_FW_TRIGGER_ID_HOST_NIC_ALIVE = 37, 336 IWL_FW_TRIGGER_ID_HOST_CHANNEL_SWITCH_COMPLETE = 35,
301 IWL_FW_TRIGGER_ID_HOST_CHANNEL_SWITCH_COMPLETE = 38, 337
302 IWL_FW_TRIGGER_ID_NUM, 338 IWL_FW_TRIGGER_ID_NUM,
303}; /* FW_INI_TRIGGER_ID_E_VER_1 */ 339}; /* FW_DEBUG_TLV_TRIGGER_ID_E_VER_1 */
304 340
305/** 341/**
306 * enum iwl_fw_ini_apply_point 342 * enum iwl_fw_ini_apply_point
@@ -320,7 +356,7 @@ enum iwl_fw_ini_apply_point {
320 IWL_FW_INI_APPLY_MISSED_BEACONS, 356 IWL_FW_INI_APPLY_MISSED_BEACONS,
321 IWL_FW_INI_APPLY_SCAN_COMPLETE, 357 IWL_FW_INI_APPLY_SCAN_COMPLETE,
322 IWL_FW_INI_APPLY_NUM, 358 IWL_FW_INI_APPLY_NUM,
323}; /* FW_INI_APPLY_POINT_E_VER_1 */ 359}; /* FW_DEBUG_TLV_APPLY_POINT_E_VER_1 */
324 360
325/** 361/**
326 * enum iwl_fw_ini_allocation_id 362 * enum iwl_fw_ini_allocation_id
@@ -340,7 +376,7 @@ enum iwl_fw_ini_allocation_id {
340 IWL_FW_INI_ALLOCATION_ID_SDFX, 376 IWL_FW_INI_ALLOCATION_ID_SDFX,
341 IWL_FW_INI_ALLOCATION_ID_FW_DUMP, 377 IWL_FW_INI_ALLOCATION_ID_FW_DUMP,
342 IWL_FW_INI_ALLOCATION_ID_USER_DEFINED, 378 IWL_FW_INI_ALLOCATION_ID_USER_DEFINED,
343}; /* FW_INI_ALLOCATION_ID_E_VER_1 */ 379}; /* FW_DEBUG_TLV_ALLOCATION_ID_E_VER_1 */
344 380
345/** 381/**
346 * enum iwl_fw_ini_buffer_location 382 * enum iwl_fw_ini_buffer_location
@@ -349,10 +385,10 @@ enum iwl_fw_ini_allocation_id {
349 * @IWL_FW_INI_LOCATION_DRAM_PATH: DRAM location 385 * @IWL_FW_INI_LOCATION_DRAM_PATH: DRAM location
350 */ 386 */
351enum iwl_fw_ini_buffer_location { 387enum iwl_fw_ini_buffer_location {
352 IWL_FW_INI_LOCATION_SRAM_INVALID, 388 IWL_FW_INI_LOCATION_INVALID,
353 IWL_FW_INI_LOCATION_SRAM_PATH, 389 IWL_FW_INI_LOCATION_SRAM_PATH,
354 IWL_FW_INI_LOCATION_DRAM_PATH, 390 IWL_FW_INI_LOCATION_DRAM_PATH,
355}; /* FW_INI_BUFFER_LOCATION_E_VER_1 */ 391}; /* FW_DEBUG_TLV_BUFFER_LOCATION_E_VER_1 */
356 392
357/** 393/**
358 * enum iwl_fw_ini_debug_flow 394 * enum iwl_fw_ini_debug_flow
@@ -364,7 +400,7 @@ enum iwl_fw_ini_debug_flow {
364 IWL_FW_INI_DEBUG_INVALID, 400 IWL_FW_INI_DEBUG_INVALID,
365 IWL_FW_INI_DEBUG_DBTR_FLOW, 401 IWL_FW_INI_DEBUG_DBTR_FLOW,
366 IWL_FW_INI_DEBUG_TB2DTF_FLOW, 402 IWL_FW_INI_DEBUG_TB2DTF_FLOW,
367}; /* FW_INI_DEBUG_FLOW_E_VER_1 */ 403}; /* FW_DEBUG_TLV_FLOW_E_VER_1 */
368 404
369/** 405/**
370 * enum iwl_fw_ini_region_type 406 * enum iwl_fw_ini_region_type
@@ -396,6 +432,6 @@ enum iwl_fw_ini_region_type {
396 IWL_FW_INI_REGION_PAGING, 432 IWL_FW_INI_REGION_PAGING,
397 IWL_FW_INI_REGION_CSR, 433 IWL_FW_INI_REGION_CSR,
398 IWL_FW_INI_REGION_NUM 434 IWL_FW_INI_REGION_NUM
399}; /* FW_INI_REGION_TYPE_E_VER_1*/ 435}; /* FW_DEBUG_TLV_REGION_TYPE_E_VER_1 */
400 436
401#endif 437#endif
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/location.h b/drivers/net/wireless/intel/iwlwifi/fw/api/location.h
index 6da91ec0df55..5dddb21c1c4d 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/location.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/location.h
@@ -7,6 +7,7 @@
7 * 7 *
8 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 8 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
9 * Copyright (C) 2018 Intel Corporation 9 * Copyright (C) 2018 Intel Corporation
10 * Copyright (C) 2019 Intel Corporation
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as 13 * it under the terms of version 2 of the GNU General Public License as
@@ -28,6 +29,7 @@
28 * 29 *
29 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 30 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
30 * Copyright (C) 2018 Intel Corporation 31 * Copyright (C) 2018 Intel Corporation
32 * Copyright (C) 2019 Intel Corporation
31 * All rights reserved. 33 * All rights reserved.
32 * 34 *
33 * Redistribution and use in source and binary forms, with or without 35 * Redistribution and use in source and binary forms, with or without
@@ -322,7 +324,7 @@ enum iwl_tof_location_query {
322}; 324};
323 325
324 /** 326 /**
325 * struct iwl_tof_range_req_ap_entry - AP configuration parameters 327 * struct iwl_tof_range_req_ap_entry_v2 - AP configuration parameters
326 * @channel_num: Current AP Channel 328 * @channel_num: Current AP Channel
327 * @bandwidth: Current AP Bandwidth. One of iwl_tof_bandwidth. 329 * @bandwidth: Current AP Bandwidth. One of iwl_tof_bandwidth.
328 * @tsf_delta_direction: TSF relatively to the subject AP 330 * @tsf_delta_direction: TSF relatively to the subject AP
@@ -355,7 +357,7 @@ enum iwl_tof_location_query {
355 * @notify_mcsi: &enum iwl_tof_mcsi_ntfy. 357 * @notify_mcsi: &enum iwl_tof_mcsi_ntfy.
356 * @reserved: For alignment and future use 358 * @reserved: For alignment and future use
357 */ 359 */
358struct iwl_tof_range_req_ap_entry { 360struct iwl_tof_range_req_ap_entry_v2 {
359 u8 channel_num; 361 u8 channel_num;
360 u8 bandwidth; 362 u8 bandwidth;
361 u8 tsf_delta_direction; 363 u8 tsf_delta_direction;
@@ -374,6 +376,62 @@ struct iwl_tof_range_req_ap_entry {
374 u8 algo_type; 376 u8 algo_type;
375 u8 notify_mcsi; 377 u8 notify_mcsi;
376 __le16 reserved; 378 __le16 reserved;
379} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_2 */
380
381/**
382 * enum iwl_initiator_ap_flags - per responder FTM configuration flags
383 * @IWL_INITIATOR_AP_FLAGS_ASAP: Request for ASAP measurement.
384 * @IWL_INITIATOR_AP_FLAGS_LCI_REQUEST: Request for LCI information
385 * @IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST: Request for CIVIC information
386 * @IWL_INITIATOR_AP_FLAGS_DYN_ACK: Send HT/VHT ack for FTM frames. If not set,
387 * 20Mhz dup acks will be sent.
388 * @IWL_INITIATOR_AP_FLAGS_ALGO_LR: Use LR algo type for rtt calculation.
389 * Default algo type is ML.
390 * @IWL_INITIATOR_AP_FLAGS_ALGO_FFT: Use FFT algo type for rtt calculation.
391 * Default algo type is ML.
392 * @IWL_INITIATOR_AP_FLAGS_MCSI_REPORT: Send the MCSI for each FTM frame to the
393 * driver.
394 */
395enum iwl_initiator_ap_flags {
396 IWL_INITIATOR_AP_FLAGS_ASAP = BIT(1),
397 IWL_INITIATOR_AP_FLAGS_LCI_REQUEST = BIT(2),
398 IWL_INITIATOR_AP_FLAGS_CIVIC_REQUEST = BIT(3),
399 IWL_INITIATOR_AP_FLAGS_DYN_ACK = BIT(4),
400 IWL_INITIATOR_AP_FLAGS_ALGO_LR = BIT(5),
401 IWL_INITIATOR_AP_FLAGS_ALGO_FFT = BIT(6),
402 IWL_INITIATOR_AP_FLAGS_MCSI_REPORT = BIT(8),
403};
404
405/**
406 * struct iwl_tof_range_req_ap_entry - AP configuration parameters
407 * @initiator_ap_flags: see &enum iwl_initiator_ap_flags.
408 * @channel_num: AP Channel number
409 * @bandwidth: AP bandwidth. One of iwl_tof_bandwidth.
410 * @ctrl_ch_position: Coding of the control channel position relative to the
411 * center frequency, see iwl_mvm_get_ctrl_pos().
412 * @ftmr_max_retries: Max number of retries to send the FTMR in case of no
413 * reply from the AP.
414 * @bssid: AP's BSSID
415 * @burst_period: Recommended value to be sent to the AP. Measurement
416 * periodicity In units of 100ms. ignored if num_of_bursts_exp = 0
417 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
418 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
419 * the number of measurement iterations (min 2^0 = 1, max 2^14)
420 * @reserved: For alignment and future use
421 * @tsf_delta: not in use
422 */
423struct iwl_tof_range_req_ap_entry {
424 __le32 initiator_ap_flags;
425 u8 channel_num;
426 u8 bandwidth;
427 u8 ctrl_ch_position;
428 u8 ftmr_max_retries;
429 u8 bssid[ETH_ALEN];
430 __le16 burst_period;
431 u8 samples_per_burst;
432 u8 num_of_bursts;
433 __le16 reserved;
434 __le32 tsf_delta;
377} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */ 435} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_3 */
378 436
379/** 437/**
@@ -403,7 +461,12 @@ enum iwl_tof_response_mode {
403 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM 461 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A: use antenna A fo TX ACKs during FTM
404 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM 462 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B: use antenna B fo TX ACKs during FTM
405 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM 463 * @IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C: use antenna C fo TX ACKs during FTM
406 * @IWL_TOF_INITIATOR_FLAGS_MINDELTA_NO_PREF: no preference for minDeltaFTM 464 * @IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM: use random mac address for FTM
465 * @IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB: use the specific calib value from
466 * the range request command
467 * @IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB: use the common calib value from the
468 * ragne request command
469 * @IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT: support non-asap measurements
407 */ 470 */
408enum iwl_tof_initiator_flags { 471enum iwl_tof_initiator_flags {
409 IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0), 472 IWL_TOF_INITIATOR_FLAGS_FAST_ALGO_DISABLED = BIT(0),
@@ -413,14 +476,17 @@ enum iwl_tof_initiator_flags {
413 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4), 476 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_A = BIT(4),
414 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5), 477 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_B = BIT(5),
415 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6), 478 IWL_TOF_INITIATOR_FLAGS_TX_CHAIN_SEL_C = BIT(6),
416 IWL_TOF_INITIATOR_FLAGS_MINDELTA_NO_PREF = BIT(7), 479 IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM = BIT(7),
480 IWL_TOF_INITIATOR_FLAGS_SPECIFIC_CALIB = BIT(15),
481 IWL_TOF_INITIATOR_FLAGS_COMMON_CALIB = BIT(16),
482 IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT = BIT(20),
417}; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 483}; /* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
418 484
419#define IWL_MVM_TOF_MAX_APS 5 485#define IWL_MVM_TOF_MAX_APS 5
420#define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5 486#define IWL_MVM_TOF_MAX_TWO_SIDED_APS 5
421 487
422/** 488/**
423 * struct iwl_tof_range_req_cmd - start measurement cmd 489 * struct iwl_tof_range_req_cmd_v5 - start measurement cmd
424 * @initiator_flags: see flags @ iwl_tof_initiator_flags 490 * @initiator_flags: see flags @ iwl_tof_initiator_flags
425 * @request_id: A Token incremented per request. The same Token will be 491 * @request_id: A Token incremented per request. The same Token will be
426 * sent back in the range response 492 * sent back in the range response
@@ -448,7 +514,7 @@ enum iwl_tof_initiator_flags {
448 * @specific_calib: The specific calib value to inject to this measurement calc 514 * @specific_calib: The specific calib value to inject to this measurement calc
449 * @ap: per-AP request data 515 * @ap: per-AP request data
450 */ 516 */
451struct iwl_tof_range_req_cmd { 517struct iwl_tof_range_req_cmd_v5 {
452 __le32 initiator_flags; 518 __le32 initiator_flags;
453 u8 request_id; 519 u8 request_id;
454 u8 initiator; 520 u8 initiator;
@@ -465,10 +531,42 @@ struct iwl_tof_range_req_cmd {
465 u8 ftm_tx_chains; 531 u8 ftm_tx_chains;
466 __le16 common_calib; 532 __le16 common_calib;
467 __le16 specific_calib; 533 __le16 specific_calib;
468 struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS]; 534 struct iwl_tof_range_req_ap_entry_v2 ap[IWL_MVM_TOF_MAX_APS];
469} __packed; 535} __packed;
470/* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */ 536/* LOCATION_RANGE_REQ_CMD_API_S_VER_5 */
471 537
538/**
539 * struct iwl_tof_range_req_cmd - start measurement cmd
540 * @initiator_flags: see flags @ iwl_tof_initiator_flags
541 * @request_id: A Token incremented per request. The same Token will be
542 * sent back in the range response
543 * @num_of_ap: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
544 * @range_req_bssid: ranging request BSSID
545 * @macaddr_mask: Bits set to 0 shall be copied from the MAC address template.
546 * Bits set to 1 shall be randomized by the UMAC
547 * @macaddr_template: MAC address template to use for non-randomized bits
548 * @req_timeout_ms: Requested timeout of the response in units of milliseconds.
549 * This is the session time for completing the measurement.
550 * @tsf_mac_id: report the measurement start time for each ap in terms of the
551 * TSF of this mac id. 0xff to disable TSF reporting.
552 * @common_calib: The common calib value to inject to this measurement calc
553 * @specific_calib: The specific calib value to inject to this measurement calc
554 * @ap: per-AP request data, see &struct iwl_tof_range_req_ap_entry_v2.
555 */
556struct iwl_tof_range_req_cmd {
557 __le32 initiator_flags;
558 u8 request_id;
559 u8 num_of_ap;
560 u8 range_req_bssid[ETH_ALEN];
561 u8 macaddr_mask[ETH_ALEN];
562 u8 macaddr_template[ETH_ALEN];
563 __le32 req_timeout_ms;
564 __le32 tsf_mac_id;
565 __le16 common_calib;
566 __le16 specific_calib;
567 struct iwl_tof_range_req_ap_entry ap[IWL_MVM_TOF_MAX_APS];
568} __packed; /* LOCATION_RANGE_REQ_CMD_API_S_VER_7 */
569
472/* 570/*
473 * enum iwl_tof_range_request_status - status of the sent request 571 * enum iwl_tof_range_request_status - status of the sent request
474 * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the 572 * @IWL_TOF_RANGE_REQUEST_STATUS_SUCCESSFUL - FW successfully received the
@@ -528,7 +626,7 @@ enum iwl_tof_entry_status {
528}; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */ 626}; /* LOCATION_RANGE_RSP_AP_ENTRY_NTFY_API_S_VER_2 */
529 627
530/** 628/**
531 * struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response) 629 * struct iwl_tof_range_rsp_ap_entry_ntfy_v3 - AP parameters (response)
532 * @bssid: BSSID of the AP 630 * @bssid: BSSID of the AP
533 * @measure_status: current APs measurement status, one of 631 * @measure_status: current APs measurement status, one of
534 * &enum iwl_tof_entry_status. 632 * &enum iwl_tof_entry_status.
@@ -555,7 +653,7 @@ enum iwl_tof_entry_status {
555 * @papd_calib_output: The result of the tof papd calibration that was injected 653 * @papd_calib_output: The result of the tof papd calibration that was injected
556 * into the algorithm. 654 * into the algorithm.
557 */ 655 */
558struct iwl_tof_range_rsp_ap_entry_ntfy { 656struct iwl_tof_range_rsp_ap_entry_ntfy_v3 {
559 u8 bssid[ETH_ALEN]; 657 u8 bssid[ETH_ALEN];
560 u8 measure_status; 658 u8 measure_status;
561 u8 measure_bw; 659 u8 measure_bw;
@@ -577,6 +675,59 @@ struct iwl_tof_range_rsp_ap_entry_ntfy {
577} __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */ 675} __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_3 */
578 676
579/** 677/**
678 * struct iwl_tof_range_rsp_ap_entry_ntfy - AP parameters (response)
679 * @bssid: BSSID of the AP
680 * @measure_status: current APs measurement status, one of
681 * &enum iwl_tof_entry_status.
682 * @measure_bw: Current AP Bandwidth: 0 20MHz, 1 40MHz, 2 80MHz
683 * @rtt: The Round Trip Time that took for the last measurement for
684 * current AP [pSec]
685 * @rtt_variance: The Variance of the RTT values measured for current AP
686 * @rtt_spread: The Difference between the maximum and the minimum RTT
687 * values measured for current AP in the current session [pSec]
688 * @rssi: RSSI as uploaded in the Channel Estimation notification
689 * @rssi_spread: The Difference between the maximum and the minimum RSSI values
690 * measured for current AP in the current session
691 * @last_burst: 1 if no more FTM sessions are scheduled for this responder
692 * @refusal_period: refusal period in case of
693 * @IWL_TOF_ENTRY_RESPONDER_CANNOT_COLABORATE [sec]
694 * @timestamp: The GP2 Clock [usec] where Channel Estimation notification was
695 * uploaded by the LMAC
696 * @start_tsf: measurement start time in TSF of the mac specified in the range
697 * request
698 * @rx_rate_n_flags: rate and flags of the last FTM frame received from this
699 * responder
700 * @tx_rate_n_flags: rate and flags of the last ack sent to this responder
701 * @t2t3_initiator: as calculated from the algo in the initiator
702 * @t1t4_responder: as calculated from the algo in the responder
703 * @common_calib: Calib val that was used in for this AP measurement
704 * @specific_calib: val that was used in for this AP measurement
705 * @papd_calib_output: The result of the tof papd calibration that was injected
706 * into the algorithm.
707 */
708struct iwl_tof_range_rsp_ap_entry_ntfy {
709 u8 bssid[ETH_ALEN];
710 u8 measure_status;
711 u8 measure_bw;
712 __le32 rtt;
713 __le32 rtt_variance;
714 __le32 rtt_spread;
715 s8 rssi;
716 u8 rssi_spread;
717 u8 last_burst;
718 u8 refusal_period;
719 __le32 timestamp;
720 __le32 start_tsf;
721 __le32 rx_rate_n_flags;
722 __le32 tx_rate_n_flags;
723 __le32 t2t3_initiator;
724 __le32 t1t4_responder;
725 __le16 common_calib;
726 __le16 specific_calib;
727 __le32 papd_calib_output;
728} __packed; /* LOCATION_RANGE_RSP_AP_ETRY_NTFY_API_S_VER_4 */
729
730/**
580 * enum iwl_tof_response_status - tof response status 731 * enum iwl_tof_response_status - tof response status
581 * 732 *
582 * @IWL_TOF_RESPONSE_SUCCESS: successful range. 733 * @IWL_TOF_RESPONSE_SUCCESS: successful range.
@@ -593,7 +744,7 @@ enum iwl_tof_response_status {
593}; /* LOCATION_RNG_RSP_STATUS */ 744}; /* LOCATION_RNG_RSP_STATUS */
594 745
595/** 746/**
596 * struct iwl_tof_range_rsp_ntfy - ranging response notification 747 * struct iwl_tof_range_rsp_ntfy_v5 - ranging response notification
597 * @request_id: A Token ID of the corresponding Range request 748 * @request_id: A Token ID of the corresponding Range request
598 * @request_status: status of current measurement session, one of 749 * @request_status: status of current measurement session, one of
599 * &enum iwl_tof_response_status. 750 * &enum iwl_tof_response_status.
@@ -601,13 +752,29 @@ enum iwl_tof_response_status {
601 * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS) 752 * @num_of_aps: Number of APs to measure (error if > IWL_MVM_TOF_MAX_APS)
602 * @ap: per-AP data 753 * @ap: per-AP data
603 */ 754 */
604struct iwl_tof_range_rsp_ntfy { 755struct iwl_tof_range_rsp_ntfy_v5 {
605 u8 request_id; 756 u8 request_id;
606 u8 request_status; 757 u8 request_status;
607 u8 last_in_batch; 758 u8 last_in_batch;
608 u8 num_of_aps; 759 u8 num_of_aps;
760 struct iwl_tof_range_rsp_ap_entry_ntfy_v3 ap[IWL_MVM_TOF_MAX_APS];
761} __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_5 */
762
763/**
764 * struct iwl_tof_range_rsp_ntfy - ranging response notification
765 * @request_id: A Token ID of the corresponding Range request
766 * @num_of_aps: Number of APs results
767 * @last_report: 1 if no more FTM sessions are scheduled, 0 otherwise.
768 * @reserved: reserved
769 * @ap: per-AP data
770 */
771struct iwl_tof_range_rsp_ntfy {
772 u8 request_id;
773 u8 num_of_aps;
774 u8 last_report;
775 u8 reserved;
609 struct iwl_tof_range_rsp_ap_entry_ntfy ap[IWL_MVM_TOF_MAX_APS]; 776 struct iwl_tof_range_rsp_ap_entry_ntfy ap[IWL_MVM_TOF_MAX_APS];
610} __packed; 777} __packed; /* LOCATION_RANGE_RSP_NTFY_API_S_VER_6 */
611 778
612#define IWL_MVM_TOF_MCSI_BUF_SIZE (245) 779#define IWL_MVM_TOF_MCSI_BUF_SIZE (245)
613/** 780/**
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
index ca49db786ed6..6b4d59daacd6 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
@@ -74,6 +74,10 @@ enum iwl_mac_conf_subcmd_ids {
74 */ 74 */
75 LOW_LATENCY_CMD = 0x3, 75 LOW_LATENCY_CMD = 0x3,
76 /** 76 /**
77 * @CHANNEL_SWITCH_TIME_EVENT_CMD: &struct iwl_chan_switch_te_cmd
78 */
79 CHANNEL_SWITCH_TIME_EVENT_CMD = 0x4,
80 /**
77 * @PROBE_RESPONSE_DATA_NOTIF: &struct iwl_probe_resp_data_notif 81 * @PROBE_RESPONSE_DATA_NOTIF: &struct iwl_probe_resp_data_notif
78 */ 82 */
79 PROBE_RESPONSE_DATA_NOTIF = 0xFC, 83 PROBE_RESPONSE_DATA_NOTIF = 0xFC,
@@ -136,6 +140,29 @@ struct iwl_channel_switch_noa_notif {
136} __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */ 140} __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */
137 141
138/** 142/**
143 * struct iwl_chan_switch_te_cmd - Channel Switch Time Event command
144 *
145 * @mac_id: MAC ID for channel switch
146 * @action: action to perform, one of FW_CTXT_ACTION_*
147 * @tsf: beacon tsf
148 * @cs_count: channel switch count from CSA/eCSA IE
149 * @cs_delayed_bcn_count: if set to N (!= 0) GO/AP can delay N beacon intervals
150 * at the new channel after the channel switch, otherwise (N == 0) expect
151 * beacon right after the channel switch.
152 * @cs_mode: 1 - quiet, 0 - otherwise
153 * @reserved: reserved for alignment purposes
154 */
155struct iwl_chan_switch_te_cmd {
156 __le32 mac_id;
157 __le32 action;
158 __le32 tsf;
159 u8 cs_count;
160 u8 cs_delayed_bcn_count;
161 u8 cs_mode;
162 u8 reserved;
163} __packed; /* MAC_CHANNEL_SWITCH_TIME_EVENT_S_VER_2 */
164
165/**
139 * struct iwl_mac_low_latency_cmd - set/clear mac to 'low-latency mode' 166 * struct iwl_mac_low_latency_cmd - set/clear mac to 'low-latency mode'
140 * 167 *
141 * @mac_id: MAC ID to whom to apply the low-latency configurations 168 * @mac_id: MAC ID to whom to apply the low-latency configurations
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/power.h b/drivers/net/wireless/intel/iwlwifi/fw/api/power.h
index 286a22da232d..01f003c6cff9 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/power.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/power.h
@@ -8,7 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
11 * Copyright (C) 2018 Intel Corporation 11 * Copyright (C) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
33 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
34 * Copyright (C) 2018 Intel Corporation 34 * Copyright (C) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -200,9 +200,16 @@ struct iwl_powertable_cmd {
200 * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK: 200 * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK:
201 * '1' Allow to save power by turning off 201 * '1' Allow to save power by turning off
202 * receiver and transmitter. '0' - does not allow. 202 * receiver and transmitter. '0' - does not allow.
203 * @DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK:
204 * Device Retention indication, '1' indicate retention is enabled.
205 * @DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK:
206 * 32Khz external slow clock valid indication, '1' indicate cloack is
207 * valid.
203*/ 208*/
204enum iwl_device_power_flags { 209enum iwl_device_power_flags {
205 DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0), 210 DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
211 DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK = BIT(1),
212 DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK = BIT(12),
206}; 213};
207 214
208/** 215/**
@@ -470,6 +477,13 @@ struct iwl_geo_tx_power_profiles_resp {
470 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed 477 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
471 * for a longer period of time then this escape-timeout. Units: Beacons. 478 * for a longer period of time then this escape-timeout. Units: Beacons.
472 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled. 479 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
480 * @bf_threshold_absolute_low: See below.
481 * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated
482 * for this beacon crossed this absolute threshold. For the 'Increase'
483 * direction the bf_energy_absolute_low[i] is used. For the 'Decrease'
484 * direction the bf_energy_absolute_high[i] is used. Zero value means
485 * that this specific threshold is ignored for beacon filtering, and
486 * beacon will not be forced to be sent to driver due to this setting.
473 */ 487 */
474struct iwl_beacon_filter_cmd { 488struct iwl_beacon_filter_cmd {
475 __le32 bf_energy_delta; 489 __le32 bf_energy_delta;
@@ -483,7 +497,9 @@ struct iwl_beacon_filter_cmd {
483 __le32 bf_escape_timer; 497 __le32 bf_escape_timer;
484 __le32 ba_escape_timer; 498 __le32 ba_escape_timer;
485 __le32 ba_enable_beacon_abort; 499 __le32 ba_enable_beacon_abort;
486} __packed; 500 __le32 bf_threshold_absolute_low[2];
501 __le32 bf_threshold_absolute_high[2];
502} __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */
487 503
488/* Beacon filtering and beacon abort */ 504/* Beacon filtering and beacon abort */
489#define IWL_BF_ENERGY_DELTA_DEFAULT 5 505#define IWL_BF_ENERGY_DELTA_DEFAULT 5
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
index 18741889ec30..890a939c463d 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
@@ -8,7 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -434,7 +434,7 @@ struct iwl_periodic_scan_complete {
434/* The maximum of either of these cannot exceed 8, because we use an 434/* The maximum of either of these cannot exceed 8, because we use an
435 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h). 435 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
436 */ 436 */
437#define IWL_MVM_MAX_UMAC_SCANS 8 437#define IWL_MVM_MAX_UMAC_SCANS 4
438#define IWL_MVM_MAX_LMAC_SCANS 1 438#define IWL_MVM_MAX_LMAC_SCANS 1
439 439
440enum scan_config_flags { 440enum scan_config_flags {
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/tx.h b/drivers/net/wireless/intel/iwlwifi/fw/api/tx.h
index 358bdf051e83..8511e735c374 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/tx.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/tx.h
@@ -847,13 +847,13 @@ struct iwl_beacon_notif {
847} __packed; 847} __packed;
848 848
849/** 849/**
850 * struct iwl_extended_beacon_notif - notifies about beacon transmission 850 * struct iwl_extended_beacon_notif_v5 - notifies about beacon transmission
851 * @beacon_notify_hdr: tx response command associated with the beacon 851 * @beacon_notify_hdr: tx response command associated with the beacon
852 * @tsf: last beacon tsf 852 * @tsf: last beacon tsf
853 * @ibss_mgr_status: whether IBSS is manager 853 * @ibss_mgr_status: whether IBSS is manager
854 * @gp2: last beacon time in gp2 854 * @gp2: last beacon time in gp2
855 */ 855 */
856struct iwl_extended_beacon_notif { 856struct iwl_extended_beacon_notif_v5 {
857 struct iwl_mvm_tx_resp beacon_notify_hdr; 857 struct iwl_mvm_tx_resp beacon_notify_hdr;
858 __le64 tsf; 858 __le64 tsf;
859 __le32 ibss_mgr_status; 859 __le32 ibss_mgr_status;
@@ -861,6 +861,20 @@ struct iwl_extended_beacon_notif {
861} __packed; /* BEACON_NTFY_API_S_VER_5 */ 861} __packed; /* BEACON_NTFY_API_S_VER_5 */
862 862
863/** 863/**
864 * struct iwl_extended_beacon_notif - notifies about beacon transmission
865 * @status: the status of the Tx response of the beacon
866 * @tsf: last beacon tsf
867 * @ibss_mgr_status: whether IBSS is manager
868 * @gp2: last beacon time in gp2
869 */
870struct iwl_extended_beacon_notif {
871 __le32 status;
872 __le64 tsf;
873 __le32 ibss_mgr_status;
874 __le32 gp2;
875} __packed; /* BEACON_NTFY_API_S_VER_6_ */
876
877/**
864 * enum iwl_dump_control - dump (flush) control flags 878 * enum iwl_dump_control - dump (flush) control flags
865 * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty 879 * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty
866 * and the TFD queues are empty. 880 * and the TFD queues are empty.
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
index 22efd94da6d3..f119c49cd39c 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -242,7 +242,8 @@ static void iwl_fw_dump_rxf(struct iwl_fw_runtime *fwrt,
242 cfg->lmac[0].rxfifo1_size, 0, 0); 242 cfg->lmac[0].rxfifo1_size, 0, 0);
243 /* Pull RXF2 */ 243 /* Pull RXF2 */
244 iwl_fwrt_dump_rxf(fwrt, dump_data, cfg->rxfifo2_size, 244 iwl_fwrt_dump_rxf(fwrt, dump_data, cfg->rxfifo2_size,
245 RXF_DIFF_FROM_PREV, 1); 245 RXF_DIFF_FROM_PREV +
246 fwrt->trans->cfg->umac_prph_offset, 1);
246 /* Pull LMAC2 RXF1 */ 247 /* Pull LMAC2 RXF1 */
247 if (fwrt->smem_cfg.num_lmacs > 1) 248 if (fwrt->smem_cfg.num_lmacs > 1)
248 iwl_fwrt_dump_rxf(fwrt, dump_data, 249 iwl_fwrt_dump_rxf(fwrt, dump_data,
@@ -673,7 +674,9 @@ static void iwl_fw_prph_handler(struct iwl_fw_runtime *fwrt, void *ptr,
673{ 674{
674 u32 range_len; 675 u32 range_len;
675 676
676 if (fwrt->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000) { 677 if (fwrt->trans->cfg->device_family >= IWL_DEVICE_FAMILY_AX210) {
678 /* TODO */
679 } else if (fwrt->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000) {
677 range_len = ARRAY_SIZE(iwl_prph_dump_addr_22000); 680 range_len = ARRAY_SIZE(iwl_prph_dump_addr_22000);
678 handler(fwrt, iwl_prph_dump_addr_22000, range_len, ptr); 681 handler(fwrt, iwl_prph_dump_addr_22000, range_len, ptr);
679 } else { 682 } else {
@@ -707,28 +710,6 @@ static void iwl_fw_dump_mem(struct iwl_fw_runtime *fwrt,
707 IWL_DEBUG_INFO(fwrt, "WRT memory dump. Type=%u\n", dump_mem->type); 710 IWL_DEBUG_INFO(fwrt, "WRT memory dump. Type=%u\n", dump_mem->type);
708} 711}
709 712
710static void iwl_fw_dump_named_mem(struct iwl_fw_runtime *fwrt,
711 struct iwl_fw_error_dump_data **dump_data,
712 u32 len, u32 ofs, u8 *name, u8 name_len)
713{
714 struct iwl_fw_error_dump_named_mem *dump_mem;
715
716 if (!len)
717 return;
718
719 (*dump_data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_MEM);
720 (*dump_data)->len = cpu_to_le32(len + sizeof(*dump_mem));
721 dump_mem = (void *)(*dump_data)->data;
722 dump_mem->type = cpu_to_le32(IWL_FW_ERROR_DUMP_MEM_NAMED_MEM);
723 dump_mem->offset = cpu_to_le32(ofs);
724 dump_mem->name_len = name_len;
725 memcpy(dump_mem->name, name, name_len);
726 iwl_trans_read_mem_bytes(fwrt->trans, ofs, dump_mem->data, len);
727 *dump_data = iwl_fw_error_next_data(*dump_data);
728
729 IWL_DEBUG_INFO(fwrt, "WRT memory dump. Type=%u\n", dump_mem->type);
730}
731
732#define ADD_LEN(len, item_len, const_len) \ 713#define ADD_LEN(len, item_len, const_len) \
733 do {size_t item = item_len; len += (!!item) * const_len + item; } \ 714 do {size_t item = item_len; len += (!!item) * const_len + item; } \
734 while (0) 715 while (0)
@@ -815,6 +796,9 @@ static void iwl_dump_paging(struct iwl_fw_runtime *fwrt,
815 DMA_BIDIRECTIONAL); 796 DMA_BIDIRECTIONAL);
816 memcpy(paging->data, page_address(pages), 797 memcpy(paging->data, page_address(pages),
817 PAGING_BLOCK_SIZE); 798 PAGING_BLOCK_SIZE);
799 dma_sync_single_for_device(fwrt->trans->dev, addr,
800 PAGING_BLOCK_SIZE,
801 DMA_BIDIRECTIONAL);
818 (*data) = iwl_fw_error_next_data(*data); 802 (*data) = iwl_fw_error_next_data(*data);
819 } 803 }
820} 804}
@@ -1059,117 +1043,645 @@ out:
1059 return dump_file; 1043 return dump_file;
1060} 1044}
1061 1045
1062static void iwl_dump_prph_ini(struct iwl_trans *trans, 1046static int iwl_dump_ini_prph_iter(struct iwl_fw_runtime *fwrt,
1063 struct iwl_fw_error_dump_data **data, 1047 struct iwl_fw_ini_region_cfg *reg,
1064 struct iwl_fw_ini_region_cfg *reg) 1048 void *range_ptr, int idx)
1065{ 1049{
1066 struct iwl_fw_error_dump_prph *prph; 1050 struct iwl_fw_ini_error_dump_range *range = range_ptr;
1051 __le32 *val = range->data;
1052 u32 addr, prph_val, offset = le32_to_cpu(reg->offset);
1053 int i;
1054
1055 range->start_addr = reg->start_addr[idx];
1056 range->range_data_size = reg->internal.range_data_size;
1057 for (i = 0; i < le32_to_cpu(reg->internal.range_data_size); i += 4) {
1058 addr = le32_to_cpu(range->start_addr) + i;
1059 prph_val = iwl_read_prph(fwrt->trans, addr + offset);
1060 if (prph_val == 0x5a5a5a5a)
1061 return -EBUSY;
1062 *val++ = cpu_to_le32(prph_val);
1063 }
1064
1065 return sizeof(*range) + le32_to_cpu(range->range_data_size);
1066}
1067
1068static int iwl_dump_ini_csr_iter(struct iwl_fw_runtime *fwrt,
1069 struct iwl_fw_ini_region_cfg *reg,
1070 void *range_ptr, int idx)
1071{
1072 struct iwl_fw_ini_error_dump_range *range = range_ptr;
1073 __le32 *val = range->data;
1074 u32 addr, offset = le32_to_cpu(reg->offset);
1075 int i;
1076
1077 range->start_addr = reg->start_addr[idx];
1078 range->range_data_size = reg->internal.range_data_size;
1079 for (i = 0; i < le32_to_cpu(reg->internal.range_data_size); i += 4) {
1080 addr = le32_to_cpu(range->start_addr) + i;
1081 *val++ = cpu_to_le32(iwl_trans_read32(fwrt->trans,
1082 addr + offset));
1083 }
1084
1085 return sizeof(*range) + le32_to_cpu(range->range_data_size);
1086}
1087
1088static int iwl_dump_ini_dev_mem_iter(struct iwl_fw_runtime *fwrt,
1089 struct iwl_fw_ini_region_cfg *reg,
1090 void *range_ptr, int idx)
1091{
1092 struct iwl_fw_ini_error_dump_range *range = range_ptr;
1093 u32 addr = le32_to_cpu(range->start_addr);
1094 u32 offset = le32_to_cpu(reg->offset);
1095
1096 range->start_addr = reg->start_addr[idx];
1097 range->range_data_size = reg->internal.range_data_size;
1098 iwl_trans_read_mem_bytes(fwrt->trans, addr + offset, range->data,
1099 le32_to_cpu(reg->internal.range_data_size));
1100
1101 return sizeof(*range) + le32_to_cpu(range->range_data_size);
1102}
1103
1104static int
1105iwl_dump_ini_paging_gen2_iter(struct iwl_fw_runtime *fwrt,
1106 struct iwl_fw_ini_region_cfg *reg,
1107 void *range_ptr, int idx)
1108{
1109 struct iwl_fw_ini_error_dump_range *range = range_ptr;
1110 u32 page_size = fwrt->trans->init_dram.paging[idx].size;
1111
1112 range->start_addr = cpu_to_le32(idx);
1113 range->range_data_size = cpu_to_le32(page_size);
1114 memcpy(range->data, fwrt->trans->init_dram.paging[idx].block,
1115 page_size);
1116
1117 return sizeof(*range) + le32_to_cpu(range->range_data_size);
1118}
1119
1120static int iwl_dump_ini_paging_iter(struct iwl_fw_runtime *fwrt,
1121 struct iwl_fw_ini_region_cfg *reg,
1122 void *range_ptr, int idx)
1123{
1124 /* increase idx by 1 since the pages are from 1 to
1125 * fwrt->num_of_paging_blk + 1
1126 */
1127 struct page *page = fwrt->fw_paging_db[++idx].fw_paging_block;
1128 struct iwl_fw_ini_error_dump_range *range = range_ptr;
1129 dma_addr_t addr = fwrt->fw_paging_db[idx].fw_paging_phys;
1130 u32 page_size = fwrt->fw_paging_db[idx].fw_paging_size;
1131
1132 range->start_addr = cpu_to_le32(idx);
1133 range->range_data_size = cpu_to_le32(page_size);
1134 dma_sync_single_for_cpu(fwrt->trans->dev, addr, page_size,
1135 DMA_BIDIRECTIONAL);
1136 memcpy(range->data, page_address(page), page_size);
1137 dma_sync_single_for_device(fwrt->trans->dev, addr, page_size,
1138 DMA_BIDIRECTIONAL);
1139
1140 return sizeof(*range) + le32_to_cpu(range->range_data_size);
1141}
1142
1143static int
1144iwl_dump_ini_mon_dram_iter(struct iwl_fw_runtime *fwrt,
1145 struct iwl_fw_ini_region_cfg *reg, void *range_ptr,
1146 int idx)
1147{
1148 struct iwl_fw_ini_error_dump_range *range = range_ptr;
1149 u32 start_addr = iwl_read_umac_prph(fwrt->trans,
1150 MON_BUFF_BASE_ADDR_VER2);
1151
1152 if (start_addr == 0x5a5a5a5a)
1153 return -EBUSY;
1154
1155 range->start_addr = cpu_to_le32(start_addr);
1156 range->range_data_size = cpu_to_le32(fwrt->trans->fw_mon[idx].size);
1157
1158 memcpy(range->data, fwrt->trans->fw_mon[idx].block,
1159 fwrt->trans->fw_mon[idx].size);
1160
1161 return sizeof(*range) + le32_to_cpu(range->range_data_size);
1162}
1163
1164struct iwl_ini_txf_iter_data {
1165 int fifo;
1166 int lmac;
1167 u32 fifo_size;
1168 bool internal_txf;
1169 bool init;
1170};
1171
1172static bool iwl_ini_txf_iter(struct iwl_fw_runtime *fwrt,
1173 struct iwl_fw_ini_region_cfg *reg)
1174{
1175 struct iwl_ini_txf_iter_data *iter = fwrt->dump.fifo_iter;
1176 struct iwl_fwrt_shared_mem_cfg *cfg = &fwrt->smem_cfg;
1177 int txf_num = cfg->num_txfifo_entries;
1178 int int_txf_num = ARRAY_SIZE(cfg->internal_txfifo_size);
1179 u32 lmac_bitmap = le32_to_cpu(reg->fifos.fid1);
1180
1181 if (!iter)
1182 return false;
1183
1184 if (iter->init) {
1185 if (le32_to_cpu(reg->offset) &&
1186 WARN_ONCE(cfg->num_lmacs == 1,
1187 "Invalid lmac offset: 0x%x\n",
1188 le32_to_cpu(reg->offset)))
1189 return false;
1190
1191 iter->init = false;
1192 iter->internal_txf = false;
1193 iter->fifo_size = 0;
1194 iter->fifo = -1;
1195 if (le32_to_cpu(reg->offset))
1196 iter->lmac = 1;
1197 else
1198 iter->lmac = 0;
1199 }
1200
1201 if (!iter->internal_txf)
1202 for (iter->fifo++; iter->fifo < txf_num; iter->fifo++) {
1203 iter->fifo_size =
1204 cfg->lmac[iter->lmac].txfifo_size[iter->fifo];
1205 if (iter->fifo_size && (lmac_bitmap & BIT(iter->fifo)))
1206 return true;
1207 }
1208
1209 iter->internal_txf = true;
1210
1211 if (!fw_has_capa(&fwrt->fw->ucode_capa,
1212 IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG))
1213 return false;
1214
1215 for (iter->fifo++; iter->fifo < int_txf_num + txf_num; iter->fifo++) {
1216 iter->fifo_size =
1217 cfg->internal_txfifo_size[iter->fifo - txf_num];
1218 if (iter->fifo_size && (lmac_bitmap & BIT(iter->fifo)))
1219 return true;
1220 }
1221
1222 return false;
1223}
1224
1225static int iwl_dump_ini_txf_iter(struct iwl_fw_runtime *fwrt,
1226 struct iwl_fw_ini_region_cfg *reg,
1227 void *range_ptr, int idx)
1228{
1229 struct iwl_fw_ini_fifo_error_dump_range *range = range_ptr;
1230 struct iwl_ini_txf_iter_data *iter;
1231 u32 offs = le32_to_cpu(reg->offset), addr;
1232 u32 registers_size =
1233 le32_to_cpu(reg->fifos.num_of_registers) * sizeof(__le32);
1234 __le32 *val = range->data;
1067 unsigned long flags; 1235 unsigned long flags;
1068 u32 i, size = le32_to_cpu(reg->num_regions); 1236 int i;
1069 1237
1070 IWL_DEBUG_INFO(trans, "WRT PRPH dump\n"); 1238 if (!iwl_ini_txf_iter(fwrt, reg))
1239 return -EIO;
1071 1240
1072 if (!iwl_trans_grab_nic_access(trans, &flags)) 1241 if (!iwl_trans_grab_nic_access(fwrt->trans, &flags))
1242 return -EBUSY;
1243
1244 iter = fwrt->dump.fifo_iter;
1245
1246 range->fifo_num = cpu_to_le32(iter->fifo);
1247 range->num_of_registers = reg->fifos.num_of_registers;
1248 range->range_data_size = cpu_to_le32(iter->fifo_size + registers_size);
1249
1250 iwl_write_prph_no_grab(fwrt->trans, TXF_LARC_NUM + offs, iter->fifo);
1251
1252 /* read txf registers */
1253 for (i = 0; i < le32_to_cpu(reg->fifos.num_of_registers); i++) {
1254 addr = le32_to_cpu(reg->start_addr[i]) + offs;
1255
1256 *val++ = cpu_to_le32(iwl_read_prph_no_grab(fwrt->trans, addr));
1257 }
1258
1259 if (reg->fifos.header_only) {
1260 range->range_data_size = cpu_to_le32(registers_size);
1261 goto out;
1262 }
1263
1264 /* Set the TXF_READ_MODIFY_ADDR to TXF_WR_PTR */
1265 iwl_write_prph_no_grab(fwrt->trans, TXF_READ_MODIFY_ADDR + offs,
1266 TXF_WR_PTR + offs);
1267
1268 /* Dummy-read to advance the read pointer to the head */
1269 iwl_read_prph_no_grab(fwrt->trans, TXF_READ_MODIFY_DATA + offs);
1270
1271 /* Read FIFO */
1272 addr = TXF_READ_MODIFY_DATA + offs;
1273 for (i = 0; i < iter->fifo_size; i += sizeof(__le32))
1274 *val++ = cpu_to_le32(iwl_read_prph_no_grab(fwrt->trans, addr));
1275
1276out:
1277 iwl_trans_release_nic_access(fwrt->trans, &flags);
1278
1279 return sizeof(*range) + le32_to_cpu(range->range_data_size);
1280}
1281
1282struct iwl_ini_rxf_data {
1283 u32 fifo_num;
1284 u32 size;
1285 u32 offset;
1286};
1287
1288static void iwl_ini_get_rxf_data(struct iwl_fw_runtime *fwrt,
1289 struct iwl_fw_ini_region_cfg *reg,
1290 struct iwl_ini_rxf_data *data)
1291{
1292 u32 fid1 = le32_to_cpu(reg->fifos.fid1);
1293 u32 fid2 = le32_to_cpu(reg->fifos.fid2);
1294 u32 fifo_idx;
1295
1296 if (!data)
1073 return; 1297 return;
1074 1298
1075 for (i = 0; i < size; i++) { 1299 memset(data, 0, sizeof(*data));
1076 (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); 1300
1077 (*data)->len = cpu_to_le32(le32_to_cpu(reg->size) + 1301 if (WARN_ON_ONCE((fid1 && fid2) || (!fid1 && !fid2)))
1078 sizeof(*prph)); 1302 return;
1079 prph = (void *)(*data)->data; 1303
1080 prph->prph_start = reg->start_addr[i]; 1304 fifo_idx = ffs(fid1) - 1;
1081 prph->data[0] = cpu_to_le32(iwl_read_prph_no_grab(trans, 1305 if (fid1 && !WARN_ON_ONCE((~BIT(fifo_idx) & fid1) ||
1082 le32_to_cpu(prph->prph_start))); 1306 fifo_idx >= MAX_NUM_LMAC)) {
1083 *data = iwl_fw_error_next_data(*data); 1307 data->size = fwrt->smem_cfg.lmac[fifo_idx].rxfifo1_size;
1308 data->fifo_num = fifo_idx;
1309 return;
1310 }
1311
1312 fifo_idx = ffs(fid2) - 1;
1313 if (fid2 && !WARN_ON_ONCE(fifo_idx != 0)) {
1314 data->size = fwrt->smem_cfg.rxfifo2_size;
1315 data->offset = RXF_DIFF_FROM_PREV;
1316 /* use bit 31 to distinguish between umac and lmac rxf while
1317 * parsing the dump
1318 */
1319 data->fifo_num = fifo_idx | IWL_RXF_UMAC_BIT;
1320 return;
1084 } 1321 }
1085 iwl_trans_release_nic_access(trans, &flags);
1086} 1322}
1087 1323
1088static void iwl_dump_csr_ini(struct iwl_trans *trans, 1324static int iwl_dump_ini_rxf_iter(struct iwl_fw_runtime *fwrt,
1089 struct iwl_fw_error_dump_data **data, 1325 struct iwl_fw_ini_region_cfg *reg,
1090 struct iwl_fw_ini_region_cfg *reg) 1326 void *range_ptr, int idx)
1091{ 1327{
1092 int i, num = le32_to_cpu(reg->num_regions); 1328 struct iwl_fw_ini_fifo_error_dump_range *range = range_ptr;
1093 u32 size = le32_to_cpu(reg->size); 1329 struct iwl_ini_rxf_data rxf_data;
1330 u32 offs = le32_to_cpu(reg->offset), addr;
1331 u32 registers_size =
1332 le32_to_cpu(reg->fifos.num_of_registers) * sizeof(__le32);
1333 __le32 *val = range->data;
1334 unsigned long flags;
1335 int i;
1336
1337 iwl_ini_get_rxf_data(fwrt, reg, &rxf_data);
1338 if (!rxf_data.size)
1339 return -EIO;
1094 1340
1095 IWL_DEBUG_INFO(trans, "WRT CSR dump\n"); 1341 if (!iwl_trans_grab_nic_access(fwrt->trans, &flags))
1342 return -EBUSY;
1096 1343
1097 for (i = 0; i < num; i++) { 1344 offs += rxf_data.offset;
1098 u32 add = le32_to_cpu(reg->start_addr[i]);
1099 __le32 *val;
1100 int j;
1101 1345
1102 (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_CSR); 1346 range->fifo_num = cpu_to_le32(rxf_data.fifo_num);
1103 (*data)->len = cpu_to_le32(size); 1347 range->num_of_registers = reg->fifos.num_of_registers;
1104 val = (void *)(*data)->data; 1348 range->range_data_size = cpu_to_le32(rxf_data.size + registers_size);
1105 1349
1106 for (j = 0; j < size; j += 4) 1350 /* read rxf registers */
1107 *val++ = cpu_to_le32(iwl_trans_read32(trans, j + add)); 1351 for (i = 0; i < le32_to_cpu(reg->fifos.num_of_registers); i++) {
1352 addr = le32_to_cpu(reg->start_addr[i]) + offs;
1108 1353
1109 *data = iwl_fw_error_next_data(*data); 1354 *val++ = cpu_to_le32(iwl_read_prph_no_grab(fwrt->trans, addr));
1355 }
1356
1357 if (reg->fifos.header_only) {
1358 range->range_data_size = cpu_to_le32(registers_size);
1359 goto out;
1360 }
1361
1362 /* Lock fence */
1363 iwl_write_prph_no_grab(fwrt->trans, RXF_SET_FENCE_MODE + offs, 0x1);
1364 /* Set fence pointer to the same place like WR pointer */
1365 iwl_write_prph_no_grab(fwrt->trans, RXF_LD_WR2FENCE + offs, 0x1);
1366 /* Set fence offset */
1367 iwl_write_prph_no_grab(fwrt->trans, RXF_LD_FENCE_OFFSET_ADDR + offs,
1368 0x0);
1369
1370 /* Read FIFO */
1371 addr = RXF_FIFO_RD_FENCE_INC + offs;
1372 for (i = 0; i < rxf_data.size; i += sizeof(__le32))
1373 *val++ = cpu_to_le32(iwl_read_prph_no_grab(fwrt->trans, addr));
1374
1375out:
1376 iwl_trans_release_nic_access(fwrt->trans, &flags);
1377
1378 return sizeof(*range) + le32_to_cpu(range->range_data_size);
1379}
1380
1381static void *iwl_dump_ini_mem_fill_header(struct iwl_fw_runtime *fwrt,
1382 struct iwl_fw_ini_region_cfg *reg,
1383 void *data)
1384{
1385 struct iwl_fw_ini_error_dump *dump = data;
1386
1387 return dump->ranges;
1388}
1389
1390static void
1391*iwl_dump_ini_mon_dram_fill_header(struct iwl_fw_runtime *fwrt,
1392 struct iwl_fw_ini_region_cfg *reg,
1393 void *data)
1394{
1395 struct iwl_fw_ini_monitor_dram_dump *mon_dump = (void *)data;
1396 u32 write_ptr, cycle_cnt;
1397 unsigned long flags;
1398
1399 if (!iwl_trans_grab_nic_access(fwrt->trans, &flags)) {
1400 IWL_ERR(fwrt, "Failed to get DRAM monitor header\n");
1401 return NULL;
1110 } 1402 }
1403 write_ptr = iwl_read_umac_prph_no_grab(fwrt->trans,
1404 MON_BUFF_WRPTR_VER2);
1405 cycle_cnt = iwl_read_umac_prph_no_grab(fwrt->trans,
1406 MON_BUFF_CYCLE_CNT_VER2);
1407 iwl_trans_release_nic_access(fwrt->trans, &flags);
1408
1409 mon_dump->write_ptr = cpu_to_le32(write_ptr);
1410 mon_dump->cycle_cnt = cpu_to_le32(cycle_cnt);
1411
1412 return mon_dump->ranges;
1413}
1414
1415static void *iwl_dump_ini_fifo_fill_header(struct iwl_fw_runtime *fwrt,
1416 struct iwl_fw_ini_region_cfg *reg,
1417 void *data)
1418{
1419 struct iwl_fw_ini_fifo_error_dump *dump = data;
1420
1421 return dump->ranges;
1422}
1423
1424static u32 iwl_dump_ini_mem_ranges(struct iwl_fw_runtime *fwrt,
1425 struct iwl_fw_ini_region_cfg *reg)
1426{
1427 return le32_to_cpu(reg->internal.num_of_ranges);
1428}
1429
1430static u32 iwl_dump_ini_paging_gen2_ranges(struct iwl_fw_runtime *fwrt,
1431 struct iwl_fw_ini_region_cfg *reg)
1432{
1433 return fwrt->trans->init_dram.paging_cnt;
1434}
1435
1436static u32 iwl_dump_ini_paging_ranges(struct iwl_fw_runtime *fwrt,
1437 struct iwl_fw_ini_region_cfg *reg)
1438{
1439 return fwrt->num_of_paging_blk;
1440}
1441
1442static u32 iwl_dump_ini_mon_dram_ranges(struct iwl_fw_runtime *fwrt,
1443 struct iwl_fw_ini_region_cfg *reg)
1444{
1445 return 1;
1446}
1447
1448static u32 iwl_dump_ini_txf_ranges(struct iwl_fw_runtime *fwrt,
1449 struct iwl_fw_ini_region_cfg *reg)
1450{
1451 struct iwl_ini_txf_iter_data iter = { .init = true };
1452 void *fifo_iter = fwrt->dump.fifo_iter;
1453 u32 num_of_fifos = 0;
1454
1455 fwrt->dump.fifo_iter = &iter;
1456 while (iwl_ini_txf_iter(fwrt, reg))
1457 num_of_fifos++;
1458
1459 fwrt->dump.fifo_iter = fifo_iter;
1460
1461 return num_of_fifos;
1462}
1463
1464static u32 iwl_dump_ini_rxf_ranges(struct iwl_fw_runtime *fwrt,
1465 struct iwl_fw_ini_region_cfg *reg)
1466{
1467 /* Each Rx fifo needs a different offset and therefore, it's
1468 * region can contain only one fifo, i.e. 1 memory range.
1469 */
1470 return 1;
1471}
1472
1473static u32 iwl_dump_ini_mem_get_size(struct iwl_fw_runtime *fwrt,
1474 struct iwl_fw_ini_region_cfg *reg)
1475{
1476 return sizeof(struct iwl_fw_ini_error_dump) +
1477 iwl_dump_ini_mem_ranges(fwrt, reg) *
1478 (sizeof(struct iwl_fw_ini_error_dump_range) +
1479 le32_to_cpu(reg->internal.range_data_size));
1480}
1481
1482static u32 iwl_dump_ini_paging_gen2_get_size(struct iwl_fw_runtime *fwrt,
1483 struct iwl_fw_ini_region_cfg *reg)
1484{
1485 int i;
1486 u32 range_header_len = sizeof(struct iwl_fw_ini_error_dump_range);
1487 u32 size = sizeof(struct iwl_fw_ini_error_dump);
1488
1489 for (i = 0; i < iwl_dump_ini_paging_gen2_ranges(fwrt, reg); i++)
1490 size += range_header_len +
1491 fwrt->trans->init_dram.paging[i].size;
1492
1493 return size;
1494}
1495
1496static u32 iwl_dump_ini_paging_get_size(struct iwl_fw_runtime *fwrt,
1497 struct iwl_fw_ini_region_cfg *reg)
1498{
1499 int i;
1500 u32 range_header_len = sizeof(struct iwl_fw_ini_error_dump_range);
1501 u32 size = sizeof(struct iwl_fw_ini_error_dump);
1502
1503 for (i = 1; i <= iwl_dump_ini_paging_ranges(fwrt, reg); i++)
1504 size += range_header_len + fwrt->fw_paging_db[i].fw_paging_size;
1505
1506 return size;
1507}
1508
1509static u32 iwl_dump_ini_mon_dram_get_size(struct iwl_fw_runtime *fwrt,
1510 struct iwl_fw_ini_region_cfg *reg)
1511{
1512 u32 size = sizeof(struct iwl_fw_ini_monitor_dram_dump);
1513
1514 if (fwrt->trans->num_blocks)
1515 size += fwrt->trans->fw_mon[0].size;
1516
1517 return size;
1518}
1519
1520static u32 iwl_dump_ini_txf_get_size(struct iwl_fw_runtime *fwrt,
1521 struct iwl_fw_ini_region_cfg *reg)
1522{
1523 struct iwl_ini_txf_iter_data iter = { .init = true };
1524 void *fifo_iter = fwrt->dump.fifo_iter;
1525 u32 size = 0;
1526 u32 fifo_hdr = sizeof(struct iwl_fw_ini_fifo_error_dump_range) +
1527 le32_to_cpu(reg->fifos.num_of_registers) * sizeof(__le32);
1528
1529 fwrt->dump.fifo_iter = &iter;
1530 while (iwl_ini_txf_iter(fwrt, reg)) {
1531 size += fifo_hdr;
1532 if (!reg->fifos.header_only)
1533 size += iter.fifo_size;
1534 }
1535
1536 if (size)
1537 size += sizeof(struct iwl_fw_ini_fifo_error_dump);
1538
1539 fwrt->dump.fifo_iter = fifo_iter;
1540
1541 return size;
1542}
1543
1544static u32 iwl_dump_ini_rxf_get_size(struct iwl_fw_runtime *fwrt,
1545 struct iwl_fw_ini_region_cfg *reg)
1546{
1547 struct iwl_ini_rxf_data rx_data;
1548 u32 size = sizeof(struct iwl_fw_ini_fifo_error_dump) +
1549 sizeof(struct iwl_fw_ini_fifo_error_dump_range) +
1550 le32_to_cpu(reg->fifos.num_of_registers) * sizeof(__le32);
1551
1552 if (reg->fifos.header_only)
1553 return size;
1554
1555 iwl_ini_get_rxf_data(fwrt, reg, &rx_data);
1556 size += rx_data.size;
1557
1558 return size;
1559}
1560
1561/**
1562 * struct iwl_dump_ini_mem_ops - ini memory dump operations
1563 * @get_num_of_ranges: returns the number of memory ranges in the region.
1564 * @get_size: returns the total size of the region.
1565 * @fill_mem_hdr: fills region type specific headers and returns pointer to
1566 * the first range or NULL if failed to fill headers.
1567 * @fill_range: copies a given memory range into the dump.
1568 * Returns the size of the range or negative error value otherwise.
1569 */
1570struct iwl_dump_ini_mem_ops {
1571 u32 (*get_num_of_ranges)(struct iwl_fw_runtime *fwrt,
1572 struct iwl_fw_ini_region_cfg *reg);
1573 u32 (*get_size)(struct iwl_fw_runtime *fwrt,
1574 struct iwl_fw_ini_region_cfg *reg);
1575 void *(*fill_mem_hdr)(struct iwl_fw_runtime *fwrt,
1576 struct iwl_fw_ini_region_cfg *reg, void *data);
1577 int (*fill_range)(struct iwl_fw_runtime *fwrt,
1578 struct iwl_fw_ini_region_cfg *reg, void *range,
1579 int idx);
1580};
1581
1582/**
1583 * iwl_dump_ini_mem - copy a memory region into the dump
1584 * @fwrt: fw runtime struct.
1585 * @data: dump memory data.
1586 * @reg: region to copy to the dump.
1587 */
1588static void
1589iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt,
1590 enum iwl_fw_ini_region_type type,
1591 struct iwl_fw_error_dump_data **data,
1592 struct iwl_fw_ini_region_cfg *reg,
1593 struct iwl_dump_ini_mem_ops *ops)
1594{
1595 struct iwl_fw_ini_error_dump_header *header = (void *)(*data)->data;
1596 void *range;
1597 u32 num_of_ranges, i;
1598
1599 if (WARN_ON(!ops || !ops->get_num_of_ranges || !ops->get_size ||
1600 !ops->fill_mem_hdr || !ops->fill_range))
1601 return;
1602
1603 num_of_ranges = ops->get_num_of_ranges(fwrt, reg);
1604
1605 (*data)->type = cpu_to_le32(type | INI_DUMP_BIT);
1606 (*data)->len = cpu_to_le32(ops->get_size(fwrt, reg));
1607
1608 header->num_of_ranges = cpu_to_le32(num_of_ranges);
1609 header->name_len = cpu_to_le32(min_t(int, IWL_FW_INI_MAX_NAME,
1610 le32_to_cpu(reg->name_len)));
1611 memcpy(header->name, reg->name, le32_to_cpu(header->name_len));
1612
1613 range = ops->fill_mem_hdr(fwrt, reg, header);
1614 if (!range) {
1615 IWL_ERR(fwrt, "Failed to fill region header: id=%d, type=%d\n",
1616 le32_to_cpu(reg->region_id), type);
1617 return;
1618 }
1619
1620 for (i = 0; i < num_of_ranges; i++) {
1621 int range_size = ops->fill_range(fwrt, reg, range, i);
1622
1623 if (range_size < 0) {
1624 IWL_ERR(fwrt, "Failed to dump region: id=%d, type=%d\n",
1625 le32_to_cpu(reg->region_id), type);
1626 return;
1627 }
1628 range = range + range_size;
1629 }
1630 *data = iwl_fw_error_next_data(*data);
1111} 1631}
1112 1632
1113static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt, 1633static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,
1114 struct iwl_fw_ini_trigger *trigger) 1634 struct iwl_fw_ini_trigger *trigger)
1115{ 1635{
1116 int i, num, size = 0, hdr_len = sizeof(struct iwl_fw_error_dump_data); 1636 int i, size = 0, hdr_len = sizeof(struct iwl_fw_error_dump_data);
1117 1637
1118 if (!trigger || !trigger->num_regions) 1638 if (!trigger || !trigger->num_regions)
1119 return 0; 1639 return 0;
1120 1640
1121 num = le32_to_cpu(trigger->num_regions); 1641 for (i = 0; i < le32_to_cpu(trigger->num_regions); i++) {
1122 for (i = 0; i < num; i++) {
1123 u32 reg_id = le32_to_cpu(trigger->data[i]); 1642 u32 reg_id = le32_to_cpu(trigger->data[i]);
1124 struct iwl_fw_ini_region_cfg *reg; 1643 struct iwl_fw_ini_region_cfg *reg;
1125 enum iwl_fw_ini_region_type type; 1644 enum iwl_fw_ini_region_type type;
1126 u32 num_entries;
1127 1645
1128 if (WARN_ON(reg_id >= ARRAY_SIZE(fwrt->dump.active_regs))) 1646 if (WARN_ON(reg_id >= ARRAY_SIZE(fwrt->dump.active_regs)))
1129 continue; 1647 continue;
1130 1648
1131 reg = fwrt->dump.active_regs[reg_id].reg; 1649 reg = fwrt->dump.active_regs[reg_id];
1132 if (WARN(!reg, "Unassigned region %d\n", reg_id)) 1650 if (WARN(!reg, "Unassigned region %d\n", reg_id))
1133 continue; 1651 continue;
1134 1652
1135 type = le32_to_cpu(reg->region_type); 1653 type = le32_to_cpu(reg->region_type);
1136 num_entries = le32_to_cpu(reg->num_regions);
1137
1138 switch (type) { 1654 switch (type) {
1139 case IWL_FW_INI_REGION_DEVICE_MEMORY: 1655 case IWL_FW_INI_REGION_DEVICE_MEMORY:
1140 size += hdr_len +
1141 sizeof(struct iwl_fw_error_dump_named_mem) +
1142 le32_to_cpu(reg->size);
1143 break;
1144 case IWL_FW_INI_REGION_PERIPHERY_MAC: 1656 case IWL_FW_INI_REGION_PERIPHERY_MAC:
1145 case IWL_FW_INI_REGION_PERIPHERY_PHY: 1657 case IWL_FW_INI_REGION_PERIPHERY_PHY:
1146 case IWL_FW_INI_REGION_PERIPHERY_AUX: 1658 case IWL_FW_INI_REGION_PERIPHERY_AUX:
1147 size += num_entries * 1659 case IWL_FW_INI_REGION_INTERNAL_BUFFER:
1148 (hdr_len + 1660 case IWL_FW_INI_REGION_CSR:
1149 sizeof(struct iwl_fw_error_dump_prph) + 1661 size += hdr_len + iwl_dump_ini_mem_get_size(fwrt, reg);
1150 sizeof(u32));
1151 break; 1662 break;
1152 case IWL_FW_INI_REGION_TXF: 1663 case IWL_FW_INI_REGION_TXF:
1153 size += iwl_fw_txf_len(fwrt, &fwrt->smem_cfg); 1664 size += hdr_len + iwl_dump_ini_txf_get_size(fwrt, reg);
1154 break; 1665 break;
1155 case IWL_FW_INI_REGION_RXF: 1666 case IWL_FW_INI_REGION_RXF:
1156 size += iwl_fw_rxf_len(fwrt, &fwrt->smem_cfg); 1667 size += hdr_len + iwl_dump_ini_rxf_get_size(fwrt, reg);
1157 break; 1668 break;
1158 case IWL_FW_INI_REGION_PAGING: 1669 case IWL_FW_INI_REGION_PAGING: {
1159 if (!iwl_fw_dbg_is_paging_enabled(fwrt)) 1670 size += hdr_len;
1160 break; 1671 if (iwl_fw_dbg_is_paging_enabled(fwrt)) {
1161 size += fwrt->num_of_paging_blk * 1672 size += iwl_dump_ini_paging_get_size(fwrt, reg);
1162 (hdr_len + 1673 } else {
1163 sizeof(struct iwl_fw_error_dump_paging) + 1674 size += iwl_dump_ini_paging_gen2_get_size(fwrt,
1164 PAGING_BLOCK_SIZE); 1675 reg);
1165 break; 1676 }
1166 case IWL_FW_INI_REGION_CSR:
1167 size += num_entries *
1168 (hdr_len + le32_to_cpu(reg->size));
1169 break; 1677 break;
1678 }
1170 case IWL_FW_INI_REGION_DRAM_BUFFER: 1679 case IWL_FW_INI_REGION_DRAM_BUFFER:
1171 /* Transport takes care of DRAM dumping */ 1680 if (!fwrt->trans->num_blocks)
1172 case IWL_FW_INI_REGION_INTERNAL_BUFFER: 1681 break;
1682 size += hdr_len +
1683 iwl_dump_ini_mon_dram_get_size(fwrt, reg);
1684 break;
1173 case IWL_FW_INI_REGION_DRAM_IMR: 1685 case IWL_FW_INI_REGION_DRAM_IMR:
1174 /* Undefined yet */ 1686 /* Undefined yet */
1175 default: 1687 default:
@@ -1181,8 +1693,7 @@ static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt,
1181 1693
1182static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt, 1694static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,
1183 struct iwl_fw_ini_trigger *trigger, 1695 struct iwl_fw_ini_trigger *trigger,
1184 struct iwl_fw_error_dump_data **data, 1696 struct iwl_fw_error_dump_data **data)
1185 u32 *dump_mask)
1186{ 1697{
1187 int i, num = le32_to_cpu(trigger->num_regions); 1698 int i, num = le32_to_cpu(trigger->num_regions);
1188 1699
@@ -1190,11 +1701,12 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,
1190 u32 reg_id = le32_to_cpu(trigger->data[i]); 1701 u32 reg_id = le32_to_cpu(trigger->data[i]);
1191 enum iwl_fw_ini_region_type type; 1702 enum iwl_fw_ini_region_type type;
1192 struct iwl_fw_ini_region_cfg *reg; 1703 struct iwl_fw_ini_region_cfg *reg;
1704 struct iwl_dump_ini_mem_ops ops;
1193 1705
1194 if (reg_id >= ARRAY_SIZE(fwrt->dump.active_regs)) 1706 if (reg_id >= ARRAY_SIZE(fwrt->dump.active_regs))
1195 continue; 1707 continue;
1196 1708
1197 reg = fwrt->dump.active_regs[reg_id].reg; 1709 reg = fwrt->dump.active_regs[reg_id];
1198 /* Don't warn, get_trigger_len already warned */ 1710 /* Don't warn, get_trigger_len already warned */
1199 if (!reg) 1711 if (!reg)
1200 continue; 1712 continue;
@@ -1202,39 +1714,75 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,
1202 type = le32_to_cpu(reg->region_type); 1714 type = le32_to_cpu(reg->region_type);
1203 switch (type) { 1715 switch (type) {
1204 case IWL_FW_INI_REGION_DEVICE_MEMORY: 1716 case IWL_FW_INI_REGION_DEVICE_MEMORY:
1205 if (WARN_ON(le32_to_cpu(reg->num_regions) > 1)) 1717 case IWL_FW_INI_REGION_INTERNAL_BUFFER:
1206 continue; 1718 ops.get_num_of_ranges = iwl_dump_ini_mem_ranges;
1207 iwl_fw_dump_named_mem(fwrt, data, 1719 ops.get_size = iwl_dump_ini_mem_get_size;
1208 le32_to_cpu(reg->size), 1720 ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header;
1209 le32_to_cpu(reg->start_addr[0]), 1721 ops.fill_range = iwl_dump_ini_dev_mem_iter;
1210 reg->name, 1722 iwl_dump_ini_mem(fwrt, type, data, reg, &ops);
1211 le32_to_cpu(reg->name_len));
1212 break; 1723 break;
1213 case IWL_FW_INI_REGION_PERIPHERY_MAC: 1724 case IWL_FW_INI_REGION_PERIPHERY_MAC:
1214 case IWL_FW_INI_REGION_PERIPHERY_PHY: 1725 case IWL_FW_INI_REGION_PERIPHERY_PHY:
1215 case IWL_FW_INI_REGION_PERIPHERY_AUX: 1726 case IWL_FW_INI_REGION_PERIPHERY_AUX:
1216 iwl_dump_prph_ini(fwrt->trans, data, reg); 1727 ops.get_num_of_ranges = iwl_dump_ini_mem_ranges;
1728 ops.get_size = iwl_dump_ini_mem_get_size;
1729 ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header;
1730 ops.fill_range = iwl_dump_ini_prph_iter;
1731 iwl_dump_ini_mem(fwrt, type, data, reg, &ops);
1217 break; 1732 break;
1218 case IWL_FW_INI_REGION_DRAM_BUFFER: 1733 case IWL_FW_INI_REGION_DRAM_BUFFER:
1219 *dump_mask |= BIT(IWL_FW_ERROR_DUMP_FW_MONITOR); 1734 ops.get_num_of_ranges = iwl_dump_ini_mon_dram_ranges;
1735 ops.get_size = iwl_dump_ini_mon_dram_get_size;
1736 ops.fill_mem_hdr = iwl_dump_ini_mon_dram_fill_header;
1737 ops.fill_range = iwl_dump_ini_mon_dram_iter;
1738 iwl_dump_ini_mem(fwrt, type, data, reg, &ops);
1220 break; 1739 break;
1221 case IWL_FW_INI_REGION_PAGING: 1740 case IWL_FW_INI_REGION_PAGING: {
1222 if (iwl_fw_dbg_is_paging_enabled(fwrt)) 1741 ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header;
1223 iwl_dump_paging(fwrt, data); 1742 if (iwl_fw_dbg_is_paging_enabled(fwrt)) {
1224 else 1743 ops.get_num_of_ranges =
1225 *dump_mask |= BIT(IWL_FW_ERROR_DUMP_PAGING); 1744 iwl_dump_ini_paging_ranges;
1745 ops.get_size = iwl_dump_ini_paging_get_size;
1746 ops.fill_range = iwl_dump_ini_paging_iter;
1747 } else {
1748 ops.get_num_of_ranges =
1749 iwl_dump_ini_paging_gen2_ranges;
1750 ops.get_size =
1751 iwl_dump_ini_paging_gen2_get_size;
1752 ops.fill_range = iwl_dump_ini_paging_gen2_iter;
1753 }
1754
1755 iwl_dump_ini_mem(fwrt, type, data, reg, &ops);
1226 break; 1756 break;
1227 case IWL_FW_INI_REGION_TXF: 1757 }
1228 iwl_fw_dump_txf(fwrt, data); 1758 case IWL_FW_INI_REGION_TXF: {
1759 struct iwl_ini_txf_iter_data iter = { .init = true };
1760 void *fifo_iter = fwrt->dump.fifo_iter;
1761
1762 fwrt->dump.fifo_iter = &iter;
1763 ops.get_num_of_ranges = iwl_dump_ini_txf_ranges;
1764 ops.get_size = iwl_dump_ini_txf_get_size;
1765 ops.fill_mem_hdr = iwl_dump_ini_fifo_fill_header;
1766 ops.fill_range = iwl_dump_ini_txf_iter;
1767 iwl_dump_ini_mem(fwrt, type, data, reg, &ops);
1768 fwrt->dump.fifo_iter = fifo_iter;
1229 break; 1769 break;
1770 }
1230 case IWL_FW_INI_REGION_RXF: 1771 case IWL_FW_INI_REGION_RXF:
1231 iwl_fw_dump_rxf(fwrt, data); 1772 ops.get_num_of_ranges = iwl_dump_ini_rxf_ranges;
1773 ops.get_size = iwl_dump_ini_rxf_get_size;
1774 ops.fill_mem_hdr = iwl_dump_ini_fifo_fill_header;
1775 ops.fill_range = iwl_dump_ini_rxf_iter;
1776 iwl_dump_ini_mem(fwrt, type, data, reg, &ops);
1232 break; 1777 break;
1233 case IWL_FW_INI_REGION_CSR: 1778 case IWL_FW_INI_REGION_CSR:
1234 iwl_dump_csr_ini(fwrt->trans, data, reg); 1779 ops.get_num_of_ranges = iwl_dump_ini_mem_ranges;
1780 ops.get_size = iwl_dump_ini_mem_get_size;
1781 ops.fill_mem_hdr = iwl_dump_ini_mem_fill_header;
1782 ops.fill_range = iwl_dump_ini_csr_iter;
1783 iwl_dump_ini_mem(fwrt, type, data, reg, &ops);
1235 break; 1784 break;
1236 case IWL_FW_INI_REGION_DRAM_IMR: 1785 case IWL_FW_INI_REGION_DRAM_IMR:
1237 case IWL_FW_INI_REGION_INTERNAL_BUFFER:
1238 /* This is undefined yet */ 1786 /* This is undefined yet */
1239 default: 1787 default:
1240 break; 1788 break;
@@ -1244,26 +1792,23 @@ static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt,
1244 1792
1245static struct iwl_fw_error_dump_file * 1793static struct iwl_fw_error_dump_file *
1246_iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt, 1794_iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt,
1247 struct iwl_fw_dump_ptrs *fw_error_dump, 1795 struct iwl_fw_dump_ptrs *fw_error_dump)
1248 u32 *dump_mask)
1249{ 1796{
1250 int size, id = le32_to_cpu(fwrt->dump.desc->trig_desc.type); 1797 int size, id = le32_to_cpu(fwrt->dump.desc->trig_desc.type);
1251 struct iwl_fw_error_dump_data *dump_data; 1798 struct iwl_fw_error_dump_data *dump_data;
1252 struct iwl_fw_error_dump_file *dump_file; 1799 struct iwl_fw_error_dump_file *dump_file;
1253 struct iwl_fw_ini_trigger *trigger, *ext; 1800 struct iwl_fw_ini_trigger *trigger;
1254 1801
1255 if (id == FW_DBG_TRIGGER_FW_ASSERT) 1802 if (id == FW_DBG_TRIGGER_FW_ASSERT)
1256 id = IWL_FW_TRIGGER_ID_FW_ASSERT; 1803 id = IWL_FW_TRIGGER_ID_FW_ASSERT;
1257 1804
1258 if (WARN_ON(id >= ARRAY_SIZE(fwrt->dump.active_trigs))) 1805 if (!iwl_fw_ini_trigger_on(fwrt, id))
1259 return NULL; 1806 return NULL;
1260 1807
1261 trigger = fwrt->dump.active_trigs[id].conf; 1808 trigger = fwrt->dump.active_trigs[id].trig;
1262 ext = fwrt->dump.active_trigs[id].conf_ext;
1263 1809
1264 size = sizeof(*dump_file); 1810 size = sizeof(*dump_file);
1265 size += iwl_fw_ini_get_trigger_len(fwrt, trigger); 1811 size += iwl_fw_ini_get_trigger_len(fwrt, trigger);
1266 size += iwl_fw_ini_get_trigger_len(fwrt, ext);
1267 1812
1268 if (!size) 1813 if (!size)
1269 return NULL; 1814 return NULL;
@@ -1278,11 +1823,7 @@ _iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt,
1278 dump_data = (void *)dump_file->data; 1823 dump_data = (void *)dump_file->data;
1279 dump_file->file_len = cpu_to_le32(size); 1824 dump_file->file_len = cpu_to_le32(size);
1280 1825
1281 *dump_mask = 0; 1826 iwl_fw_ini_dump_trigger(fwrt, trigger, &dump_data);
1282 if (trigger)
1283 iwl_fw_ini_dump_trigger(fwrt, trigger, &dump_data, dump_mask);
1284 if (ext)
1285 iwl_fw_ini_dump_trigger(fwrt, ext, &dump_data, dump_mask);
1286 1827
1287 return dump_file; 1828 return dump_file;
1288} 1829}
@@ -1308,8 +1849,7 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt)
1308 goto out; 1849 goto out;
1309 1850
1310 if (fwrt->trans->ini_valid) 1851 if (fwrt->trans->ini_valid)
1311 dump_file = _iwl_fw_error_ini_dump(fwrt, fw_error_dump, 1852 dump_file = _iwl_fw_error_ini_dump(fwrt, fw_error_dump);
1312 &dump_mask);
1313 else 1853 else
1314 dump_file = _iwl_fw_error_dump(fwrt, fw_error_dump); 1854 dump_file = _iwl_fw_error_dump(fwrt, fw_error_dump);
1315 1855
@@ -1321,7 +1861,10 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt)
1321 if (!fwrt->trans->ini_valid && fwrt->dump.monitor_only) 1861 if (!fwrt->trans->ini_valid && fwrt->dump.monitor_only)
1322 dump_mask &= IWL_FW_ERROR_DUMP_FW_MONITOR; 1862 dump_mask &= IWL_FW_ERROR_DUMP_FW_MONITOR;
1323 1863
1324 fw_error_dump->trans_ptr = iwl_trans_dump_data(fwrt->trans, dump_mask); 1864 if (!fwrt->trans->ini_valid)
1865 fw_error_dump->trans_ptr =
1866 iwl_trans_dump_data(fwrt->trans, dump_mask);
1867
1325 file_len = le32_to_cpu(dump_file->file_len); 1868 file_len = le32_to_cpu(dump_file->file_len);
1326 fw_error_dump->fwrt_len = file_len; 1869 fw_error_dump->fwrt_len = file_len;
1327 if (fw_error_dump->trans_ptr) { 1870 if (fw_error_dump->trans_ptr) {
@@ -1362,61 +1905,12 @@ const struct iwl_fw_dump_desc iwl_dump_desc_assert = {
1362}; 1905};
1363IWL_EXPORT_SYMBOL(iwl_dump_desc_assert); 1906IWL_EXPORT_SYMBOL(iwl_dump_desc_assert);
1364 1907
1365void iwl_fw_assert_error_dump(struct iwl_fw_runtime *fwrt)
1366{
1367 IWL_INFO(fwrt, "error dump due to fw assert\n");
1368 fwrt->dump.desc = &iwl_dump_desc_assert;
1369 iwl_fw_error_dump(fwrt);
1370}
1371IWL_EXPORT_SYMBOL(iwl_fw_assert_error_dump);
1372
1373void iwl_fw_alive_error_dump(struct iwl_fw_runtime *fwrt)
1374{
1375 struct iwl_fw_dump_desc *iwl_dump_desc_no_alive =
1376 kmalloc(sizeof(*iwl_dump_desc_no_alive), GFP_KERNEL);
1377
1378 if (!iwl_dump_desc_no_alive)
1379 return;
1380
1381 iwl_dump_desc_no_alive->trig_desc.type =
1382 cpu_to_le32(FW_DBG_TRIGGER_NO_ALIVE);
1383 iwl_dump_desc_no_alive->len = 0;
1384
1385 if (WARN_ON(fwrt->dump.desc))
1386 iwl_fw_free_dump_desc(fwrt);
1387
1388 IWL_WARN(fwrt, "Collecting data: trigger %d fired.\n",
1389 FW_DBG_TRIGGER_NO_ALIVE);
1390
1391 fwrt->dump.desc = iwl_dump_desc_no_alive;
1392 iwl_fw_error_dump(fwrt);
1393 clear_bit(IWL_FWRT_STATUS_WAIT_ALIVE, &fwrt->status);
1394}
1395IWL_EXPORT_SYMBOL(iwl_fw_alive_error_dump);
1396
1397int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt, 1908int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
1398 const struct iwl_fw_dump_desc *desc, 1909 const struct iwl_fw_dump_desc *desc,
1399 bool monitor_only, 1910 bool monitor_only,
1400 unsigned int delay) 1911 unsigned int delay)
1401{ 1912{
1402 /* 1913 if (test_and_set_bit(IWL_FWRT_STATUS_DUMPING, &fwrt->status))
1403 * If the loading of the FW completed successfully, the next step is to
1404 * get the SMEM config data. Thus, if fwrt->smem_cfg.num_lmacs is non
1405 * zero, the FW was already loaded successully. If the state is "NO_FW"
1406 * in such a case - exit, since FW may be dead. Otherwise, we
1407 * can try to collect the data, since FW might just not be fully
1408 * loaded (no "ALIVE" yet), and the debug data is accessible.
1409 *
1410 * Corner case: got the FW alive but crashed before getting the SMEM
1411 * config. In such a case, due to HW access problems, we might
1412 * collect garbage.
1413 */
1414 if (fwrt->trans->state == IWL_TRANS_NO_FW &&
1415 fwrt->smem_cfg.num_lmacs)
1416 return -EIO;
1417
1418 if (test_and_set_bit(IWL_FWRT_STATUS_DUMPING, &fwrt->status) ||
1419 test_bit(IWL_FWRT_STATUS_WAIT_ALIVE, &fwrt->status))
1420 return -EBUSY; 1914 return -EBUSY;
1421 1915
1422 if (WARN_ON(fwrt->dump.desc)) 1916 if (WARN_ON(fwrt->dump.desc))
@@ -1428,12 +1922,39 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
1428 fwrt->dump.desc = desc; 1922 fwrt->dump.desc = desc;
1429 fwrt->dump.monitor_only = monitor_only; 1923 fwrt->dump.monitor_only = monitor_only;
1430 1924
1431 schedule_delayed_work(&fwrt->dump.wk, delay); 1925 schedule_delayed_work(&fwrt->dump.wk, usecs_to_jiffies(delay));
1432 1926
1433 return 0; 1927 return 0;
1434} 1928}
1435IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect_desc); 1929IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect_desc);
1436 1930
1931int iwl_fw_dbg_error_collect(struct iwl_fw_runtime *fwrt,
1932 enum iwl_fw_dbg_trigger trig_type)
1933{
1934 int ret;
1935 struct iwl_fw_dump_desc *iwl_dump_error_desc =
1936 kmalloc(sizeof(*iwl_dump_error_desc), GFP_KERNEL);
1937
1938 if (!iwl_dump_error_desc)
1939 return -ENOMEM;
1940
1941 iwl_dump_error_desc->trig_desc.type = cpu_to_le32(trig_type);
1942 iwl_dump_error_desc->len = 0;
1943
1944 ret = iwl_fw_dbg_collect_desc(fwrt, iwl_dump_error_desc, false, 0);
1945 if (ret) {
1946 kfree(iwl_dump_error_desc);
1947 } else {
1948 set_bit(STATUS_FW_WAIT_DUMP, &fwrt->trans->status);
1949
1950 /* trigger nmi to halt the fw */
1951 iwl_force_nmi(fwrt->trans);
1952 }
1953
1954 return ret;
1955}
1956IWL_EXPORT_SYMBOL(iwl_fw_dbg_error_collect);
1957
1437int _iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, 1958int _iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
1438 enum iwl_fw_dbg_trigger trig, 1959 enum iwl_fw_dbg_trigger trig,
1439 const char *str, size_t len, 1960 const char *str, size_t len,
@@ -1457,8 +1978,10 @@ int _iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
1457 } 1978 }
1458 1979
1459 trigger->occurrences = cpu_to_le16(occurrences); 1980 trigger->occurrences = cpu_to_le16(occurrences);
1460 delay = le16_to_cpu(trigger->trig_dis_ms);
1461 monitor_only = trigger->mode & IWL_FW_DBG_TRIGGER_MONITOR_ONLY; 1981 monitor_only = trigger->mode & IWL_FW_DBG_TRIGGER_MONITOR_ONLY;
1982
1983 /* convert msec to usec */
1984 delay = le32_to_cpu(trigger->stop_delay) * USEC_PER_MSEC;
1462 } 1985 }
1463 1986
1464 desc = kzalloc(sizeof(*desc) + len, GFP_ATOMIC); 1987 desc = kzalloc(sizeof(*desc) + len, GFP_ATOMIC);
@@ -1478,6 +2001,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
1478 u32 id, const char *str, size_t len) 2001 u32 id, const char *str, size_t len)
1479{ 2002{
1480 struct iwl_fw_dump_desc *desc; 2003 struct iwl_fw_dump_desc *desc;
2004 struct iwl_fw_ini_active_triggers *active;
1481 u32 occur, delay; 2005 u32 occur, delay;
1482 2006
1483 if (!fwrt->trans->ini_valid) 2007 if (!fwrt->trans->ini_valid)
@@ -1486,15 +2010,17 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
1486 if (id == FW_DBG_TRIGGER_USER) 2010 if (id == FW_DBG_TRIGGER_USER)
1487 id = IWL_FW_TRIGGER_ID_USER_TRIGGER; 2011 id = IWL_FW_TRIGGER_ID_USER_TRIGGER;
1488 2012
1489 if (WARN_ON(!fwrt->dump.active_trigs[id].active)) 2013 active = &fwrt->dump.active_trigs[id];
2014
2015 if (WARN_ON(!active->active))
1490 return -EINVAL; 2016 return -EINVAL;
1491 2017
1492 delay = le32_to_cpu(fwrt->dump.active_trigs[id].conf->dump_delay); 2018 delay = le32_to_cpu(active->trig->dump_delay);
1493 occur = le32_to_cpu(fwrt->dump.active_trigs[id].conf->occurrences); 2019 occur = le32_to_cpu(active->trig->occurrences);
1494 if (!occur) 2020 if (!occur)
1495 return 0; 2021 return 0;
1496 2022
1497 if (le32_to_cpu(fwrt->dump.active_trigs[id].conf->force_restart)) { 2023 if (le32_to_cpu(active->trig->force_restart)) {
1498 IWL_WARN(fwrt, "Force restart: trigger %d fired.\n", id); 2024 IWL_WARN(fwrt, "Force restart: trigger %d fired.\n", id);
1499 iwl_force_nmi(fwrt->trans); 2025 iwl_force_nmi(fwrt->trans);
1500 return 0; 2026 return 0;
@@ -1504,8 +2030,7 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
1504 if (!desc) 2030 if (!desc)
1505 return -ENOMEM; 2031 return -ENOMEM;
1506 2032
1507 occur--; 2033 active->trig->occurrences = cpu_to_le32(--occur);
1508 fwrt->dump.active_trigs[id].conf->occurrences = cpu_to_le32(occur);
1509 2034
1510 desc->len = len; 2035 desc->len = len;
1511 desc->trig_desc.type = cpu_to_le32(id); 2036 desc->trig_desc.type = cpu_to_le32(id);
@@ -1670,27 +2195,13 @@ void iwl_fw_dbg_read_d3_debug_data(struct iwl_fw_runtime *fwrt)
1670IWL_EXPORT_SYMBOL(iwl_fw_dbg_read_d3_debug_data); 2195IWL_EXPORT_SYMBOL(iwl_fw_dbg_read_d3_debug_data);
1671 2196
1672static void 2197static void
1673iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, 2198iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size)
1674 struct iwl_fw_ini_allocation_tlv *alloc)
1675{ 2199{
1676 struct iwl_trans *trans = fwrt->trans; 2200 struct iwl_trans *trans = fwrt->trans;
1677 struct iwl_ldbg_config_cmd ldbg_cmd = {
1678 .type = cpu_to_le32(BUFFER_ALLOCATION),
1679 };
1680 struct iwl_buffer_allocation_cmd *cmd = &ldbg_cmd.buffer_allocation;
1681 struct iwl_host_cmd hcmd = {
1682 .id = LDBG_CONFIG_CMD,
1683 .flags = CMD_ASYNC,
1684 .data[0] = &ldbg_cmd,
1685 .len[0] = sizeof(ldbg_cmd),
1686 };
1687 void *virtual_addr = NULL; 2201 void *virtual_addr = NULL;
1688 u32 size = le32_to_cpu(alloc->size);
1689 dma_addr_t phys_addr; 2202 dma_addr_t phys_addr;
1690 2203
1691 if (!trans->num_blocks && 2204 if (WARN_ON_ONCE(trans->num_blocks == ARRAY_SIZE(trans->fw_mon)))
1692 le32_to_cpu(alloc->buffer_location) !=
1693 IWL_FW_INI_LOCATION_DRAM_PATH)
1694 return; 2205 return;
1695 2206
1696 virtual_addr = 2207 virtual_addr =
@@ -1702,25 +2213,63 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt,
1702 if (!virtual_addr) 2213 if (!virtual_addr)
1703 IWL_ERR(fwrt, "Failed to allocate debug memory\n"); 2214 IWL_ERR(fwrt, "Failed to allocate debug memory\n");
1704 2215
1705 if (WARN_ON_ONCE(trans->num_blocks == ARRAY_SIZE(trans->fw_mon)))
1706 return;
1707
1708 trans->fw_mon[trans->num_blocks].block = virtual_addr; 2216 trans->fw_mon[trans->num_blocks].block = virtual_addr;
1709 trans->fw_mon[trans->num_blocks].physical = phys_addr; 2217 trans->fw_mon[trans->num_blocks].physical = phys_addr;
1710 trans->fw_mon[trans->num_blocks].size = size; 2218 trans->fw_mon[trans->num_blocks].size = size;
1711 trans->num_blocks++; 2219 trans->num_blocks++;
1712 2220
1713 IWL_DEBUG_FW(trans, "Allocated debug block of size %d\n", size); 2221 IWL_DEBUG_FW(trans, "Allocated debug block of size %d\n", size);
2222}
2223
2224static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
2225 struct iwl_fw_ini_allocation_data *alloc,
2226 enum iwl_fw_ini_apply_point pnt)
2227{
2228 struct iwl_trans *trans = fwrt->trans;
2229 struct iwl_ldbg_config_cmd ldbg_cmd = {
2230 .type = cpu_to_le32(BUFFER_ALLOCATION),
2231 };
2232 struct iwl_buffer_allocation_cmd *cmd = &ldbg_cmd.buffer_allocation;
2233 struct iwl_host_cmd hcmd = {
2234 .id = LDBG_CONFIG_CMD,
2235 .flags = CMD_ASYNC,
2236 .data[0] = &ldbg_cmd,
2237 .len[0] = sizeof(ldbg_cmd),
2238 };
2239 int block_idx = trans->num_blocks;
2240 u32 buf_location = le32_to_cpu(alloc->tlv.buffer_location);
2241
2242 if (buf_location == IWL_FW_INI_LOCATION_SRAM_PATH) {
2243 if (!WARN(pnt != IWL_FW_INI_APPLY_EARLY,
2244 "Invalid apply point %d for SMEM buffer allocation",
2245 pnt))
2246 /* set sram monitor by enabling bit 7 */
2247 iwl_set_bit(fwrt->trans, CSR_HW_IF_CONFIG_REG,
2248 CSR_HW_IF_CONFIG_REG_BIT_MONITOR_SRAM);
2249 return;
2250 }
2251
2252 if (buf_location != IWL_FW_INI_LOCATION_DRAM_PATH)
2253 return;
2254
2255 if (!alloc->is_alloc) {
2256 iwl_fw_dbg_buffer_allocation(fwrt,
2257 le32_to_cpu(alloc->tlv.size));
2258 if (block_idx == trans->num_blocks)
2259 return;
2260 alloc->is_alloc = 1;
2261 }
1714 2262
1715 /* First block is assigned via registers / context info */ 2263 /* First block is assigned via registers / context info */
1716 if (trans->num_blocks == 1) 2264 if (trans->num_blocks == 1)
1717 return; 2265 return;
1718 2266
1719 cmd->num_frags = cpu_to_le32(1); 2267 cmd->num_frags = cpu_to_le32(1);
1720 cmd->fragments[0].address = cpu_to_le64(phys_addr); 2268 cmd->fragments[0].address =
1721 cmd->fragments[0].size = alloc->size; 2269 cpu_to_le64(trans->fw_mon[block_idx].physical);
1722 cmd->allocation_id = alloc->allocation_id; 2270 cmd->fragments[0].size = alloc->tlv.size;
1723 cmd->buffer_location = alloc->buffer_location; 2271 cmd->allocation_id = alloc->tlv.allocation_id;
2272 cmd->buffer_location = alloc->tlv.buffer_location;
1724 2273
1725 iwl_trans_send_cmd(trans, &hcmd); 2274 iwl_trans_send_cmd(trans, &hcmd);
1726} 2275}
@@ -1749,9 +2298,9 @@ static void iwl_fw_dbg_update_regions(struct iwl_fw_runtime *fwrt,
1749 int i, size = le32_to_cpu(tlv->num_regions); 2298 int i, size = le32_to_cpu(tlv->num_regions);
1750 2299
1751 for (i = 0; i < size; i++) { 2300 for (i = 0; i < size; i++) {
1752 struct iwl_fw_ini_region_cfg *reg = iter; 2301 struct iwl_fw_ini_region_cfg *reg = iter, **active;
1753 int id = le32_to_cpu(reg->region_id); 2302 int id = le32_to_cpu(reg->region_id);
1754 struct iwl_fw_ini_active_regs *active; 2303 u32 type = le32_to_cpu(reg->region_type);
1755 2304
1756 if (WARN(id >= ARRAY_SIZE(fwrt->dump.active_regs), 2305 if (WARN(id >= ARRAY_SIZE(fwrt->dump.active_regs),
1757 "Invalid region id %d for apply point %d\n", id, pnt)) 2306 "Invalid region id %d for apply point %d\n", id, pnt))
@@ -1759,26 +2308,47 @@ static void iwl_fw_dbg_update_regions(struct iwl_fw_runtime *fwrt,
1759 2308
1760 active = &fwrt->dump.active_regs[id]; 2309 active = &fwrt->dump.active_regs[id];
1761 2310
1762 if (ext && active->apply_point == pnt) 2311 if (*active)
1763 IWL_WARN(fwrt->trans, 2312 IWL_WARN(fwrt->trans, "region TLV %d override\n", id);
1764 "External region TLV overrides FW default %x\n",
1765 id);
1766 2313
1767 IWL_DEBUG_FW(fwrt, 2314 IWL_DEBUG_FW(fwrt,
1768 "%s: apply point %d, activating region ID %d\n", 2315 "%s: apply point %d, activating region ID %d\n",
1769 __func__, pnt, id); 2316 __func__, pnt, id);
1770 2317
1771 active->reg = reg; 2318 *active = reg;
1772 active->apply_point = pnt;
1773 2319
1774 if (le32_to_cpu(reg->region_type) != 2320 if (type == IWL_FW_INI_REGION_TXF ||
1775 IWL_FW_INI_REGION_DRAM_BUFFER) 2321 type == IWL_FW_INI_REGION_RXF)
1776 iter += le32_to_cpu(reg->num_regions) * sizeof(__le32); 2322 iter += le32_to_cpu(reg->fifos.num_of_registers) *
2323 sizeof(__le32);
2324 else if (type != IWL_FW_INI_REGION_DRAM_BUFFER)
2325 iter += le32_to_cpu(reg->internal.num_of_ranges) *
2326 sizeof(__le32);
1777 2327
1778 iter += sizeof(*reg); 2328 iter += sizeof(*reg);
1779 } 2329 }
1780} 2330}
1781 2331
2332static int iwl_fw_dbg_trig_realloc(struct iwl_fw_runtime *fwrt,
2333 struct iwl_fw_ini_active_triggers *active,
2334 u32 id, int size)
2335{
2336 void *ptr;
2337
2338 if (size <= active->size)
2339 return 0;
2340
2341 ptr = krealloc(active->trig, size, GFP_KERNEL);
2342 if (!ptr) {
2343 IWL_ERR(fwrt, "Failed to allocate memory for trigger %d\n", id);
2344 return -ENOMEM;
2345 }
2346 active->trig = ptr;
2347 active->size = size;
2348
2349 return 0;
2350}
2351
1782static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt, 2352static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt,
1783 struct iwl_fw_ini_trigger_tlv *tlv, 2353 struct iwl_fw_ini_trigger_tlv *tlv,
1784 bool ext, 2354 bool ext,
@@ -1791,43 +2361,61 @@ static void iwl_fw_dbg_update_triggers(struct iwl_fw_runtime *fwrt,
1791 struct iwl_fw_ini_trigger *trig = iter; 2361 struct iwl_fw_ini_trigger *trig = iter;
1792 struct iwl_fw_ini_active_triggers *active; 2362 struct iwl_fw_ini_active_triggers *active;
1793 int id = le32_to_cpu(trig->trigger_id); 2363 int id = le32_to_cpu(trig->trigger_id);
1794 u32 num; 2364 u32 trig_regs_size = le32_to_cpu(trig->num_regions) *
2365 sizeof(__le32);
1795 2366
1796 if (WARN_ON(id >= ARRAY_SIZE(fwrt->dump.active_trigs))) 2367 if (WARN_ON(id >= ARRAY_SIZE(fwrt->dump.active_trigs)))
1797 break; 2368 break;
1798 2369
1799 active = &fwrt->dump.active_trigs[id]; 2370 active = &fwrt->dump.active_trigs[id];
1800 2371
1801 if (active->apply_point != apply_point) { 2372 if (!active->active) {
1802 active->conf = NULL; 2373 size_t trig_size = sizeof(*trig) + trig_regs_size;
1803 active->conf_ext = NULL;
1804 }
1805 2374
1806 num = le32_to_cpu(trig->num_regions); 2375 if (iwl_fw_dbg_trig_realloc(fwrt, active, id,
2376 trig_size))
2377 goto next;
1807 2378
1808 if (ext && active->apply_point == apply_point) { 2379 memcpy(active->trig, trig, trig_size);
1809 num += le32_to_cpu(active->conf->num_regions); 2380
1810 if (trig->ignore_default) { 2381 } else {
1811 active->conf_ext = active->conf; 2382 u32 conf_override =
1812 active->conf = trig; 2383 !(le32_to_cpu(trig->override_trig) & 0xff);
2384 u32 region_override =
2385 !(le32_to_cpu(trig->override_trig) & 0xff00);
2386 u32 offset = 0;
2387 u32 active_regs =
2388 le32_to_cpu(active->trig->num_regions);
2389 u32 new_regs = le32_to_cpu(trig->num_regions);
2390 int mem_to_add = trig_regs_size;
2391
2392 if (region_override) {
2393 mem_to_add -= active_regs * sizeof(__le32);
1813 } else { 2394 } else {
1814 active->conf_ext = trig; 2395 offset += active_regs;
2396 new_regs += active_regs;
1815 } 2397 }
1816 } else { 2398
1817 active->conf = trig; 2399 if (iwl_fw_dbg_trig_realloc(fwrt, active, id,
2400 active->size + mem_to_add))
2401 goto next;
2402
2403 if (conf_override)
2404 memcpy(active->trig, trig, sizeof(*trig));
2405
2406 memcpy(active->trig->data + offset, trig->data,
2407 trig_regs_size);
2408 active->trig->num_regions = cpu_to_le32(new_regs);
1818 } 2409 }
1819 2410
1820 /* Since zero means infinity - just set to -1 */ 2411 /* Since zero means infinity - just set to -1 */
1821 if (!le32_to_cpu(trig->occurrences)) 2412 if (!le32_to_cpu(active->trig->occurrences))
1822 trig->occurrences = cpu_to_le32(-1); 2413 active->trig->occurrences = cpu_to_le32(-1);
1823 if (!le32_to_cpu(trig->ignore_consec))
1824 trig->ignore_consec = cpu_to_le32(-1);
1825 2414
1826 iter += sizeof(*trig) + 2415 active->active = true;
1827 le32_to_cpu(trig->num_regions) * sizeof(__le32); 2416next:
2417 iter += sizeof(*trig) + trig_regs_size;
1828 2418
1829 active->active = num;
1830 active->apply_point = apply_point;
1831 } 2419 }
1832} 2420}
1833 2421
@@ -1844,9 +2432,13 @@ static void _iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
1844 u32 type = le32_to_cpu(tlv->type); 2432 u32 type = le32_to_cpu(tlv->type);
1845 2433
1846 switch (type) { 2434 switch (type) {
1847 case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION: 2435 case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION: {
1848 iwl_fw_dbg_buffer_allocation(fwrt, ini_tlv); 2436 struct iwl_fw_ini_allocation_data *buf_alloc = ini_tlv;
2437
2438 iwl_fw_dbg_buffer_apply(fwrt, ini_tlv, pnt);
2439 iter += sizeof(buf_alloc->is_alloc);
1849 break; 2440 break;
2441 }
1850 case IWL_UCODE_TLV_TYPE_HCMD: 2442 case IWL_UCODE_TLV_TYPE_HCMD:
1851 if (pnt < IWL_FW_INI_APPLY_AFTER_ALIVE) { 2443 if (pnt < IWL_FW_INI_APPLY_AFTER_ALIVE) {
1852 IWL_ERR(fwrt, 2444 IWL_ERR(fwrt,
@@ -1877,6 +2469,16 @@ void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
1877 enum iwl_fw_ini_apply_point apply_point) 2469 enum iwl_fw_ini_apply_point apply_point)
1878{ 2470{
1879 void *data = &fwrt->trans->apply_points[apply_point]; 2471 void *data = &fwrt->trans->apply_points[apply_point];
2472 int i;
2473
2474 if (apply_point == IWL_FW_INI_APPLY_EARLY) {
2475 for (i = 0; i < IWL_FW_INI_MAX_REGION_ID; i++)
2476 fwrt->dump.active_regs[i] = NULL;
2477
2478 /* disable the triggers, used in recovery flow */
2479 for (i = 0; i < IWL_FW_TRIGGER_ID_NUM; i++)
2480 fwrt->dump.active_trigs[i].active = false;
2481 }
1880 2482
1881 _iwl_fw_dbg_apply_point(fwrt, data, apply_point, false); 2483 _iwl_fw_dbg_apply_point(fwrt, data, apply_point, false);
1882 2484
@@ -1884,3 +2486,27 @@ void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
1884 _iwl_fw_dbg_apply_point(fwrt, data, apply_point, true); 2486 _iwl_fw_dbg_apply_point(fwrt, data, apply_point, true);
1885} 2487}
1886IWL_EXPORT_SYMBOL(iwl_fw_dbg_apply_point); 2488IWL_EXPORT_SYMBOL(iwl_fw_dbg_apply_point);
2489
2490void iwl_fwrt_stop_device(struct iwl_fw_runtime *fwrt)
2491{
2492 /* if the wait event timeout elapses instead of wake up then
2493 * the driver did not receive NMI interrupt and can not assume the FW
2494 * is halted
2495 */
2496 int ret = wait_event_timeout(fwrt->trans->fw_halt_waitq,
2497 !test_bit(STATUS_FW_WAIT_DUMP,
2498 &fwrt->trans->status),
2499 msecs_to_jiffies(2000));
2500 if (!ret) {
2501 /* failed to receive NMI interrupt, assuming the FW is stuck */
2502 set_bit(STATUS_FW_ERROR, &fwrt->trans->status);
2503
2504 clear_bit(STATUS_FW_WAIT_DUMP, &fwrt->trans->status);
2505 }
2506
2507 /* Assuming the op mode mutex is held at this point */
2508 iwl_fw_dbg_collect_sync(fwrt);
2509
2510 iwl_trans_stop_device(fwrt->trans);
2511}
2512IWL_EXPORT_SYMBOL(iwl_fwrt_stop_device);
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
index 330229d2a61d..a199056234d3 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
@@ -8,7 +8,7 @@
8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -112,6 +112,8 @@ void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt);
112int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt, 112int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
113 const struct iwl_fw_dump_desc *desc, 113 const struct iwl_fw_dump_desc *desc,
114 bool monitor_only, unsigned int delay); 114 bool monitor_only, unsigned int delay);
115int iwl_fw_dbg_error_collect(struct iwl_fw_runtime *fwrt,
116 enum iwl_fw_dbg_trigger trig_type);
115int _iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, 117int _iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
116 enum iwl_fw_dbg_trigger trig, 118 enum iwl_fw_dbg_trigger trig,
117 const char *str, size_t len, 119 const char *str, size_t len,
@@ -160,9 +162,9 @@ iwl_fw_dbg_trigger_stop_conf_match(struct iwl_fw_runtime *fwrt,
160} 162}
161 163
162static inline bool 164static inline bool
163iwl_fw_dbg_no_trig_window(struct iwl_fw_runtime *fwrt, u32 id, u32 dis_ms) 165iwl_fw_dbg_no_trig_window(struct iwl_fw_runtime *fwrt, u32 id, u32 dis_usec)
164{ 166{
165 unsigned long wind_jiff = msecs_to_jiffies(dis_ms); 167 unsigned long wind_jiff = usecs_to_jiffies(dis_usec);
166 168
167 /* If this is the first event checked, jump to update start ts */ 169 /* If this is the first event checked, jump to update start ts */
168 if (fwrt->dump.non_collect_ts_start[id] && 170 if (fwrt->dump.non_collect_ts_start[id] &&
@@ -179,11 +181,12 @@ iwl_fw_dbg_trigger_check_stop(struct iwl_fw_runtime *fwrt,
179 struct wireless_dev *wdev, 181 struct wireless_dev *wdev,
180 struct iwl_fw_dbg_trigger_tlv *trig) 182 struct iwl_fw_dbg_trigger_tlv *trig)
181{ 183{
184 u32 usec = le16_to_cpu(trig->trig_dis_ms) * USEC_PER_MSEC;
185
182 if (wdev && !iwl_fw_dbg_trigger_vif_match(trig, wdev)) 186 if (wdev && !iwl_fw_dbg_trigger_vif_match(trig, wdev))
183 return false; 187 return false;
184 188
185 if (iwl_fw_dbg_no_trig_window(fwrt, le32_to_cpu(trig->id), 189 if (iwl_fw_dbg_no_trig_window(fwrt, le32_to_cpu(trig->id), usec)) {
186 le16_to_cpu(trig->trig_dis_ms))) {
187 IWL_WARN(fwrt, "Trigger %d occurred while no-collect window.\n", 190 IWL_WARN(fwrt, "Trigger %d occurred while no-collect window.\n",
188 trig->id); 191 trig->id);
189 return false; 192 return false;
@@ -220,23 +223,22 @@ _iwl_fw_dbg_trigger_on(struct iwl_fw_runtime *fwrt,
220}) 223})
221 224
222static inline bool 225static inline bool
223_iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt, 226iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt,
224 const enum iwl_fw_dbg_trigger id) 227 enum iwl_fw_ini_trigger_id id)
225{ 228{
226 struct iwl_fw_ini_active_triggers *trig = &fwrt->dump.active_trigs[id]; 229 struct iwl_fw_ini_trigger *trig;
227 u32 ms; 230 u32 usec;
231
228 232
229 if (!fwrt->trans->ini_valid)
230 return false;
231 233
232 if (!trig || !trig->active) 234 if (!fwrt->trans->ini_valid || id >= IWL_FW_TRIGGER_ID_NUM ||
235 !fwrt->dump.active_trigs[id].active)
233 return false; 236 return false;
234 237
235 ms = le32_to_cpu(trig->conf->ignore_consec); 238 trig = fwrt->dump.active_trigs[id].trig;
236 if (ms) 239 usec = le32_to_cpu(trig->ignore_consec);
237 ms /= USEC_PER_MSEC;
238 240
239 if (iwl_fw_dbg_no_trig_window(fwrt, id, ms)) { 241 if (iwl_fw_dbg_no_trig_window(fwrt, id, usec)) {
240 IWL_WARN(fwrt, "Trigger %d fired in no-collect window\n", id); 242 IWL_WARN(fwrt, "Trigger %d fired in no-collect window\n", id);
241 return false; 243 return false;
242 } 244 }
@@ -244,12 +246,6 @@ _iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt,
244 return true; 246 return true;
245} 247}
246 248
247#define iwl_fw_ini_trigger_on(fwrt, wdev, id) ({ \
248 BUILD_BUG_ON(!__builtin_constant_p(id)); \
249 BUILD_BUG_ON((id) >= IWL_FW_TRIGGER_ID_NUM); \
250 _iwl_fw_ini_trigger_on((fwrt), (wdev), (id)); \
251})
252
253static inline void 249static inline void
254_iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt, 250_iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt,
255 struct wireless_dev *wdev, 251 struct wireless_dev *wdev,
@@ -296,13 +292,13 @@ _iwl_fw_dbg_stop_recording(struct iwl_trans *trans,
296 } 292 }
297 293
298 if (params) { 294 if (params) {
299 params->in_sample = iwl_read_prph(trans, DBGC_IN_SAMPLE); 295 params->in_sample = iwl_read_umac_prph(trans, DBGC_IN_SAMPLE);
300 params->out_ctrl = iwl_read_prph(trans, DBGC_OUT_CTRL); 296 params->out_ctrl = iwl_read_umac_prph(trans, DBGC_OUT_CTRL);
301 } 297 }
302 298
303 iwl_write_prph(trans, DBGC_IN_SAMPLE, 0); 299 iwl_write_umac_prph(trans, DBGC_IN_SAMPLE, 0);
304 udelay(100); 300 udelay(100);
305 iwl_write_prph(trans, DBGC_OUT_CTRL, 0); 301 iwl_write_umac_prph(trans, DBGC_OUT_CTRL, 0);
306#ifdef CONFIG_IWLWIFI_DEBUGFS 302#ifdef CONFIG_IWLWIFI_DEBUGFS
307 trans->dbg_rec_on = false; 303 trans->dbg_rec_on = false;
308#endif 304#endif
@@ -330,9 +326,9 @@ _iwl_fw_dbg_restart_recording(struct iwl_trans *trans,
330 iwl_clear_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x1); 326 iwl_clear_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x1);
331 iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x1); 327 iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x1);
332 } else { 328 } else {
333 iwl_write_prph(trans, DBGC_IN_SAMPLE, params->in_sample); 329 iwl_write_umac_prph(trans, DBGC_IN_SAMPLE, params->in_sample);
334 udelay(100); 330 udelay(100);
335 iwl_write_prph(trans, DBGC_OUT_CTRL, params->out_ctrl); 331 iwl_write_umac_prph(trans, DBGC_OUT_CTRL, params->out_ctrl);
336 } 332 }
337} 333}
338 334
@@ -373,7 +369,9 @@ static inline bool iwl_fw_dbg_is_d3_debug_enabled(struct iwl_fw_runtime *fwrt)
373{ 369{
374 return fw_has_capa(&fwrt->fw->ucode_capa, 370 return fw_has_capa(&fwrt->fw->ucode_capa,
375 IWL_UCODE_TLV_CAPA_D3_DEBUG) && 371 IWL_UCODE_TLV_CAPA_D3_DEBUG) &&
376 fwrt->trans->cfg->d3_debug_data_length && 372 fwrt->trans->cfg->d3_debug_data_length && fwrt->ops &&
373 fwrt->ops->d3_debug_enable &&
374 fwrt->ops->d3_debug_enable(fwrt->ops_ctx) &&
377 iwl_fw_dbg_type_on(fwrt, IWL_FW_ERROR_DUMP_D3_DEBUG_DATA); 375 iwl_fw_dbg_type_on(fwrt, IWL_FW_ERROR_DUMP_D3_DEBUG_DATA);
378} 376}
379 377
@@ -434,10 +432,33 @@ static inline void iwl_fw_resume_timestamp(struct iwl_fw_runtime *fwrt) {}
434 432
435#endif /* CONFIG_IWLWIFI_DEBUGFS */ 433#endif /* CONFIG_IWLWIFI_DEBUGFS */
436 434
437void iwl_fw_assert_error_dump(struct iwl_fw_runtime *fwrt);
438void iwl_fw_alive_error_dump(struct iwl_fw_runtime *fwrt);
439void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt); 435void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt);
440void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt, 436void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
441 enum iwl_fw_ini_apply_point apply_point); 437 enum iwl_fw_ini_apply_point apply_point);
442 438
439void iwl_fwrt_stop_device(struct iwl_fw_runtime *fwrt);
440
441static inline void iwl_fw_lmac1_set_alive_err_table(struct iwl_trans *trans,
442 u32 lmac_error_event_table)
443{
444 if (!(trans->error_event_table_tlv_status &
445 IWL_ERROR_EVENT_TABLE_LMAC1) ||
446 WARN_ON(trans->lmac_error_event_table[0] !=
447 lmac_error_event_table))
448 trans->lmac_error_event_table[0] = lmac_error_event_table;
449}
450
451static inline void iwl_fw_umac_set_alive_err_table(struct iwl_trans *trans,
452 u32 umac_error_event_table)
453{
454 if (!(trans->error_event_table_tlv_status &
455 IWL_ERROR_EVENT_TABLE_UMAC) ||
456 WARN_ON(trans->umac_error_event_table !=
457 umac_error_event_table))
458 trans->umac_error_event_table = umac_error_event_table;
459}
460
461/* This bit is used to differentiate the legacy dump from the ini dump */
462#define INI_DUMP_BIT BIT(31)
463
443#endif /* __iwl_fw_dbg_h__ */ 464#endif /* __iwl_fw_dbg_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
index 3e120dd47305..c1aa4360736b 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
@@ -173,9 +173,8 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
173 _FWRT_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz, struct iwl_fw_runtime) 173 _FWRT_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz, struct iwl_fw_runtime)
174 174
175#define FWRT_DEBUGFS_ADD_FILE_ALIAS(alias, name, parent, mode) do { \ 175#define FWRT_DEBUGFS_ADD_FILE_ALIAS(alias, name, parent, mode) do { \
176 if (!debugfs_create_file(alias, mode, parent, fwrt, \ 176 debugfs_create_file(alias, mode, parent, fwrt, \
177 &iwl_dbgfs_##name##_ops)) \ 177 &iwl_dbgfs_##name##_ops); \
178 goto err; \
179 } while (0) 178 } while (0)
180#define FWRT_DEBUGFS_ADD_FILE(name, parent, mode) \ 179#define FWRT_DEBUGFS_ADD_FILE(name, parent, mode) \
181 FWRT_DEBUGFS_ADD_FILE_ALIAS(#name, name, parent, mode) 180 FWRT_DEBUGFS_ADD_FILE_ALIAS(#name, name, parent, mode)
@@ -321,14 +320,10 @@ out:
321 320
322FWRT_DEBUGFS_WRITE_FILE_OPS(send_hcmd, 512); 321FWRT_DEBUGFS_WRITE_FILE_OPS(send_hcmd, 512);
323 322
324int iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt, 323void iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt,
325 struct dentry *dbgfs_dir) 324 struct dentry *dbgfs_dir)
326{ 325{
327 INIT_DELAYED_WORK(&fwrt->timestamp.wk, iwl_fw_timestamp_marker_wk); 326 INIT_DELAYED_WORK(&fwrt->timestamp.wk, iwl_fw_timestamp_marker_wk);
328 FWRT_DEBUGFS_ADD_FILE(timestamp_marker, dbgfs_dir, 0200); 327 FWRT_DEBUGFS_ADD_FILE(timestamp_marker, dbgfs_dir, 0200);
329 FWRT_DEBUGFS_ADD_FILE(send_hcmd, dbgfs_dir, 0200); 328 FWRT_DEBUGFS_ADD_FILE(send_hcmd, dbgfs_dir, 0200);
330 return 0;
331err:
332 IWL_ERR(fwrt, "Can't create the fwrt debugfs directory\n");
333 return -ENOMEM;
334} 329}
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.h b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.h
index 88255035e8ef..fde40ff88451 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.h
@@ -63,14 +63,11 @@
63#include "runtime.h" 63#include "runtime.h"
64 64
65#ifdef CONFIG_IWLWIFI_DEBUGFS 65#ifdef CONFIG_IWLWIFI_DEBUGFS
66int iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt, 66void iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt,
67 struct dentry *dbgfs_dir); 67 struct dentry *dbgfs_dir);
68 68
69#else 69#else
70static inline int iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt, 70static inline void iwl_fwrt_dbgfs_register(struct iwl_fw_runtime *fwrt,
71 struct dentry *dbgfs_dir) 71 struct dentry *dbgfs_dir) { }
72{
73 return 0;
74}
75 72
76#endif /* CONFIG_IWLWIFI_DEBUGFS */ 73#endif /* CONFIG_IWLWIFI_DEBUGFS */
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
index c02425a1e64f..9b5077bd46c3 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
@@ -8,7 +8,7 @@
8 * Copyright(c) 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright (C) 2018 Intel Corporation 11 * Copyright (C) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright (C) 2018 Intel Corporation 34 * Copyright (C) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -275,22 +275,68 @@ struct iwl_fw_error_dump_mem {
275}; 275};
276 276
277/** 277/**
278 * struct iwl_fw_error_dump_named_mem - chunk of memory 278 * struct iwl_fw_ini_error_dump_range - range of memory
279 * @type: &enum iwl_fw_error_dump_mem_type 279 * @start_addr: the start address of this range
280 * @offset: the offset from which the memory was read 280 * @range_data_size: the size of this range, in bytes
281 * @name_len: name length 281 * @data: the actual memory
282 * @name: file name
283 * @data: the content of the memory
284 */ 282 */
285struct iwl_fw_error_dump_named_mem { 283struct iwl_fw_ini_error_dump_range {
286 __le32 type; 284 __le32 start_addr;
287 __le32 offset; 285 __le32 range_data_size;
288 u8 name_len; 286 __le32 data[];
289 u8 name[32]; 287} __packed;
290 u8 data[]; 288
289/**
290 * struct iwl_fw_ini_error_dump_header - ini region dump header
291 * @num_of_ranges: number of ranges in this region
292 * @name_len: number of bytes allocated to the name string of this region
293 * @name: name of the region
294 */
295struct iwl_fw_ini_error_dump_header {
296 __le32 num_of_ranges;
297 __le32 name_len;
298 u8 name[IWL_FW_INI_MAX_NAME];
291}; 299};
292 300
293/** 301/**
302 * struct iwl_fw_ini_error_dump - ini region dump
303 * @header: the header of this region
304 * @ranges: the memory ranges of this region
305 */
306struct iwl_fw_ini_error_dump {
307 struct iwl_fw_ini_error_dump_header header;
308 struct iwl_fw_ini_error_dump_range ranges[];
309} __packed;
310
311/* This bit is used to differentiate between lmac and umac rxf */
312#define IWL_RXF_UMAC_BIT BIT(31)
313
314/**
315 * struct iwl_fw_ini_fifo_error_dump_range - ini fifo range dump
316 * @fifo_num: the fifo num. In case of rxf and umac rxf, set BIT(31) to
317 * distinguish between lmac and umac
318 * @num_of_registers: num of registers to dump, dword size each
319 * @range_data_size: the size of the registers and fifo data
320 * @data: fifo data
321 */
322struct iwl_fw_ini_fifo_error_dump_range {
323 __le32 fifo_num;
324 __le32 num_of_registers;
325 __le32 range_data_size;
326 __le32 data[];
327} __packed;
328
329/**
330 * struct iwl_fw_ini_fifo_error_dump - ini fifo region dump
331 * @header: the header of this region
332 * @ranges: the memory ranges of this region
333 */
334struct iwl_fw_ini_fifo_error_dump {
335 struct iwl_fw_ini_error_dump_header header;
336 struct iwl_fw_ini_fifo_error_dump_range ranges[];
337} __packed;
338
339/**
294 * struct iwl_fw_error_dump_rb - content of an Receive Buffer 340 * struct iwl_fw_error_dump_rb - content of an Receive Buffer
295 * @index: the index of the Receive Buffer in the Rx queue 341 * @index: the index of the Receive Buffer in the Rx queue
296 * @rxq: the RB's Rx queue 342 * @rxq: the RB's Rx queue
@@ -305,6 +351,20 @@ struct iwl_fw_error_dump_rb {
305}; 351};
306 352
307/** 353/**
354 * struct iwl_fw_ini_monitor_dram_dump - ini dram monitor dump
355 * @header - header of the region
356 * @write_ptr - write pointer position in the dram
357 * @cycle_cnt - cycles count
358 * @ranges - the memory ranges of this this region
359 */
360struct iwl_fw_ini_monitor_dram_dump {
361 struct iwl_fw_ini_error_dump_header header;
362 __le32 write_ptr;
363 __le32 cycle_cnt;
364 struct iwl_fw_ini_error_dump_range ranges[];
365} __packed;
366
367/**
308 * struct iwl_fw_error_dump_paging - content of the UMAC's image page 368 * struct iwl_fw_error_dump_paging - content of the UMAC's image page
309 * block on DRAM 369 * block on DRAM
310 * @index: the index of the page block 370 * @index: the index of the page block
@@ -355,7 +415,9 @@ iwl_fw_error_next_data(struct iwl_fw_error_dump_data *data)
355 * @FW_DBG_TDLS: trigger log collection upon TDLS related events. 415 * @FW_DBG_TDLS: trigger log collection upon TDLS related events.
356 * @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when 416 * @FW_DBG_TRIGGER_TX_STATUS: trigger log collection upon tx status when
357 * the firmware sends a tx reply. 417 * the firmware sends a tx reply.
358 * @FW_DBG_TRIGGER_NO_ALIVE: trigger log collection if alive flow fails 418 * @FW_DBG_TRIGGER_ALIVE_TIMEOUT: trigger log collection if alive flow timeouts
419 * @FW_DBG_TRIGGER_DRIVER: trigger log collection upon a flow failure
420 * in the driver.
359 */ 421 */
360enum iwl_fw_dbg_trigger { 422enum iwl_fw_dbg_trigger {
361 FW_DBG_TRIGGER_INVALID = 0, 423 FW_DBG_TRIGGER_INVALID = 0,
@@ -373,7 +435,8 @@ enum iwl_fw_dbg_trigger {
373 FW_DBG_TRIGGER_TX_LATENCY, 435 FW_DBG_TRIGGER_TX_LATENCY,
374 FW_DBG_TRIGGER_TDLS, 436 FW_DBG_TRIGGER_TDLS,
375 FW_DBG_TRIGGER_TX_STATUS, 437 FW_DBG_TRIGGER_TX_STATUS,
376 FW_DBG_TRIGGER_NO_ALIVE, 438 FW_DBG_TRIGGER_ALIVE_TIMEOUT,
439 FW_DBG_TRIGGER_DRIVER,
377 440
378 /* must be last */ 441 /* must be last */
379 FW_DBG_TRIGGER_MAX, 442 FW_DBG_TRIGGER_MAX,
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
index e8b00b795cbb..641c95d03b15 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
@@ -9,6 +9,7 @@
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 Intel Corporation
12 * Copyright(c) 2019 Intel Corporation
12 * 13 *
13 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 15 * it under the terms of version 2 of the GNU General Public License as
@@ -32,6 +33,7 @@
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 33 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 34 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 35 * Copyright(c) 2018 Intel Corporation
36 * Copyright(c) 2019 Intel Corporation
35 * All rights reserved. 37 * All rights reserved.
36 * 38 *
37 * Redistribution and use in source and binary forms, with or without 39 * Redistribution and use in source and binary forms, with or without
@@ -143,6 +145,9 @@ enum iwl_ucode_tlv_type {
143 IWL_UCODE_TLV_FW_GSCAN_CAPA = 50, 145 IWL_UCODE_TLV_FW_GSCAN_CAPA = 50,
144 IWL_UCODE_TLV_FW_MEM_SEG = 51, 146 IWL_UCODE_TLV_FW_MEM_SEG = 51,
145 IWL_UCODE_TLV_IML = 52, 147 IWL_UCODE_TLV_IML = 52,
148 IWL_UCODE_TLV_UMAC_DEBUG_ADDRS = 54,
149 IWL_UCODE_TLV_LMAC_DEBUG_ADDRS = 55,
150 IWL_UCODE_TLV_FW_RECOVERY_INFO = 57,
146 IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION = IWL_UCODE_INI_TLV_GROUP | 0x1, 151 IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION = IWL_UCODE_INI_TLV_GROUP | 0x1,
147 IWL_UCODE_TLV_TYPE_HCMD = IWL_UCODE_INI_TLV_GROUP | 0x2, 152 IWL_UCODE_TLV_TYPE_HCMD = IWL_UCODE_INI_TLV_GROUP | 0x2,
148 IWL_UCODE_TLV_TYPE_REGIONS = IWL_UCODE_INI_TLV_GROUP | 0x3, 153 IWL_UCODE_TLV_TYPE_REGIONS = IWL_UCODE_INI_TLV_GROUP | 0x3,
@@ -263,6 +268,12 @@ typedef unsigned int __bitwise iwl_ucode_tlv_api_t;
263 * @IWL_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS 268 * @IWL_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS
264 * @IWL_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of 269 * @IWL_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of
265 * the REDUCE_TX_POWER_CMD. 270 * the REDUCE_TX_POWER_CMD.
271 * @IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short
272 * version of the beacon notification.
273 * @IWL_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of
274 * BEACON_FILTER_CONFIG_API_S_VER_4.
275 * @IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ: This ucode supports v7 of
276 * LOCATION_RANGE_REQ_CMD_API_S and v6 of LOCATION_RANGE_RESP_NTFY_API_S.
266 * 277 *
267 * @NUM_IWL_UCODE_TLV_API: number of bits used 278 * @NUM_IWL_UCODE_TLV_API: number of bits used
268 */ 279 */
@@ -287,6 +298,9 @@ enum iwl_ucode_tlv_api {
287 IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2 = (__force iwl_ucode_tlv_api_t)42, 298 IWL_UCODE_TLV_API_ADAPTIVE_DWELL_V2 = (__force iwl_ucode_tlv_api_t)42,
288 IWL_UCODE_TLV_API_FRAG_EBS = (__force iwl_ucode_tlv_api_t)44, 299 IWL_UCODE_TLV_API_FRAG_EBS = (__force iwl_ucode_tlv_api_t)44,
289 IWL_UCODE_TLV_API_REDUCE_TX_POWER = (__force iwl_ucode_tlv_api_t)45, 300 IWL_UCODE_TLV_API_REDUCE_TX_POWER = (__force iwl_ucode_tlv_api_t)45,
301 IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF = (__force iwl_ucode_tlv_api_t)46,
302 IWL_UCODE_TLV_API_BEACON_FILTER_V4 = (__force iwl_ucode_tlv_api_t)47,
303 IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ = (__force iwl_ucode_tlv_api_t)49,
290 304
291 NUM_IWL_UCODE_TLV_API 305 NUM_IWL_UCODE_TLV_API
292#ifdef __CHECKER__ 306#ifdef __CHECKER__
@@ -333,6 +347,7 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
333 * @IWL_UCODE_TLV_CAPA_TLC_OFFLOAD: firmware implements rate scaling algorithm 347 * @IWL_UCODE_TLV_CAPA_TLC_OFFLOAD: firmware implements rate scaling algorithm
334 * @IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA: firmware implements quota related 348 * @IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA: firmware implements quota related
335 * @IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2: firmware implements Coex Schema 2 349 * @IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2: firmware implements Coex Schema 2
350 * IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD: firmware supports CSA command
336 * @IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS: firmware supports ultra high band 351 * @IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS: firmware supports ultra high band
337 * (6 GHz). 352 * (6 GHz).
338 * @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement 353 * @IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE: extended DTS measurement
@@ -363,12 +378,15 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
363 * capability. 378 * capability.
364 * @IWL_UCODE_TLV_CAPA_CSI_REPORTING: firmware is capable of being configured 379 * @IWL_UCODE_TLV_CAPA_CSI_REPORTING: firmware is capable of being configured
365 * to report the CSI information with (certain) RX frames 380 * to report the CSI information with (certain) RX frames
381 * @IWL_UCODE_TLV_CAPA_FTM_CALIBRATED: has FTM calibrated and thus supports both
382 * initiator and responder
366 * 383 *
367 * @IWL_UCODE_TLV_CAPA_MLME_OFFLOAD: supports MLME offload 384 * @IWL_UCODE_TLV_CAPA_MLME_OFFLOAD: supports MLME offload
368 * 385 *
369 * @NUM_IWL_UCODE_TLV_CAPA: number of bits used 386 * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
370 */ 387 */
371enum iwl_ucode_tlv_capa { 388enum iwl_ucode_tlv_capa {
389 /* set 0 */
372 IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = (__force iwl_ucode_tlv_capa_t)0, 390 IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = (__force iwl_ucode_tlv_capa_t)0,
373 IWL_UCODE_TLV_CAPA_LAR_SUPPORT = (__force iwl_ucode_tlv_capa_t)1, 391 IWL_UCODE_TLV_CAPA_LAR_SUPPORT = (__force iwl_ucode_tlv_capa_t)1,
374 IWL_UCODE_TLV_CAPA_UMAC_SCAN = (__force iwl_ucode_tlv_capa_t)2, 392 IWL_UCODE_TLV_CAPA_UMAC_SCAN = (__force iwl_ucode_tlv_capa_t)2,
@@ -390,6 +408,8 @@ enum iwl_ucode_tlv_capa {
390 IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC = (__force iwl_ucode_tlv_capa_t)29, 408 IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC = (__force iwl_ucode_tlv_capa_t)29,
391 IWL_UCODE_TLV_CAPA_BT_COEX_RRC = (__force iwl_ucode_tlv_capa_t)30, 409 IWL_UCODE_TLV_CAPA_BT_COEX_RRC = (__force iwl_ucode_tlv_capa_t)30,
392 IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT = (__force iwl_ucode_tlv_capa_t)31, 410 IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT = (__force iwl_ucode_tlv_capa_t)31,
411
412 /* set 1 */
393 IWL_UCODE_TLV_CAPA_STA_PM_NOTIF = (__force iwl_ucode_tlv_capa_t)38, 413 IWL_UCODE_TLV_CAPA_STA_PM_NOTIF = (__force iwl_ucode_tlv_capa_t)38,
394 IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT = (__force iwl_ucode_tlv_capa_t)39, 414 IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT = (__force iwl_ucode_tlv_capa_t)39,
395 IWL_UCODE_TLV_CAPA_CDB_SUPPORT = (__force iwl_ucode_tlv_capa_t)40, 415 IWL_UCODE_TLV_CAPA_CDB_SUPPORT = (__force iwl_ucode_tlv_capa_t)40,
@@ -397,7 +417,11 @@ enum iwl_ucode_tlv_capa {
397 IWL_UCODE_TLV_CAPA_TLC_OFFLOAD = (__force iwl_ucode_tlv_capa_t)43, 417 IWL_UCODE_TLV_CAPA_TLC_OFFLOAD = (__force iwl_ucode_tlv_capa_t)43,
398 IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA = (__force iwl_ucode_tlv_capa_t)44, 418 IWL_UCODE_TLV_CAPA_DYNAMIC_QUOTA = (__force iwl_ucode_tlv_capa_t)44,
399 IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2 = (__force iwl_ucode_tlv_capa_t)45, 419 IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2 = (__force iwl_ucode_tlv_capa_t)45,
420 IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD = (__force iwl_ucode_tlv_capa_t)46,
400 IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS = (__force iwl_ucode_tlv_capa_t)48, 421 IWL_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS = (__force iwl_ucode_tlv_capa_t)48,
422 IWL_UCODE_TLV_CAPA_FTM_CALIBRATED = (__force iwl_ucode_tlv_capa_t)47,
423
424 /* set 2 */
401 IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE = (__force iwl_ucode_tlv_capa_t)64, 425 IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE = (__force iwl_ucode_tlv_capa_t)64,
402 IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS = (__force iwl_ucode_tlv_capa_t)65, 426 IWL_UCODE_TLV_CAPA_SHORT_PM_TIMEOUTS = (__force iwl_ucode_tlv_capa_t)65,
403 IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT = (__force iwl_ucode_tlv_capa_t)67, 427 IWL_UCODE_TLV_CAPA_BT_MPLUT_SUPPORT = (__force iwl_ucode_tlv_capa_t)67,
@@ -418,6 +442,7 @@ enum iwl_ucode_tlv_capa {
418 IWL_UCODE_TLV_CAPA_MCC_UPDATE_11AX_SUPPORT = (__force iwl_ucode_tlv_capa_t)89, 442 IWL_UCODE_TLV_CAPA_MCC_UPDATE_11AX_SUPPORT = (__force iwl_ucode_tlv_capa_t)89,
419 IWL_UCODE_TLV_CAPA_CSI_REPORTING = (__force iwl_ucode_tlv_capa_t)90, 443 IWL_UCODE_TLV_CAPA_CSI_REPORTING = (__force iwl_ucode_tlv_capa_t)90,
420 444
445 /* set 3 */
421 IWL_UCODE_TLV_CAPA_MLME_OFFLOAD = (__force iwl_ucode_tlv_capa_t)96, 446 IWL_UCODE_TLV_CAPA_MLME_OFFLOAD = (__force iwl_ucode_tlv_capa_t)96,
422 447
423 NUM_IWL_UCODE_TLV_CAPA 448 NUM_IWL_UCODE_TLV_CAPA
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/img.h b/drivers/net/wireless/intel/iwlwifi/fw/img.h
index 12333167ea23..f4c5a4d73206 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/img.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/img.h
@@ -105,6 +105,8 @@ struct iwl_ucode_capabilities {
105 u32 n_scan_channels; 105 u32 n_scan_channels;
106 u32 standard_phy_calibration_size; 106 u32 standard_phy_calibration_size;
107 u32 flags; 107 u32 flags;
108 u32 error_log_addr;
109 u32 error_log_size;
108 unsigned long _api[BITS_TO_LONGS(NUM_IWL_UCODE_TLV_API)]; 110 unsigned long _api[BITS_TO_LONGS(NUM_IWL_UCODE_TLV_API)];
109 unsigned long _capa[BITS_TO_LONGS(NUM_IWL_UCODE_TLV_CAPA)]; 111 unsigned long _capa[BITS_TO_LONGS(NUM_IWL_UCODE_TLV_CAPA)];
110}; 112};
@@ -223,27 +225,24 @@ struct iwl_fw_dbg {
223}; 225};
224 226
225/** 227/**
228 * @tlv: the buffer allocation tlv
229 * @is_alloc: indicates if the buffer was already allocated
230 */
231struct iwl_fw_ini_allocation_data {
232 struct iwl_fw_ini_allocation_tlv tlv;
233 u32 is_alloc;
234} __packed;
235
236/**
226 * struct iwl_fw_ini_active_triggers 237 * struct iwl_fw_ini_active_triggers
227 * @active: is this trigger active 238 * @active: is this trigger active
228 * @apply_point: last apply point that updated this trigger 239 * @size: allocated memory size of the trigger
229 * @conf: active trigger 240 * @trig: trigger
230 * @conf_ext: second trigger, contains extra regions to dump
231 */ 241 */
232struct iwl_fw_ini_active_triggers { 242struct iwl_fw_ini_active_triggers {
233 bool active; 243 bool active;
234 enum iwl_fw_ini_apply_point apply_point; 244 size_t size;
235 struct iwl_fw_ini_trigger *conf; 245 struct iwl_fw_ini_trigger *trig;
236 struct iwl_fw_ini_trigger *conf_ext;
237};
238
239/**
240 * struct iwl_fw_ini_active_regs
241 * @reg: active region from TLV
242 * @apply_point: apply point where it became active
243 */
244struct iwl_fw_ini_active_regs {
245 struct iwl_fw_ini_region_cfg *reg;
246 enum iwl_fw_ini_apply_point apply_point;
247}; 246};
248 247
249/** 248/**
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/init.c b/drivers/net/wireless/intel/iwlwifi/fw/init.c
index 2efac307909e..7adf4e4e841a 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/init.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/init.c
@@ -6,6 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2017 Intel Deutschland GmbH 8 * Copyright(c) 2017 Intel Deutschland GmbH
9 * Copyright(c) 2019 Intel Corporation
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * 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 12 * it under the terms of version 2 of the GNU General Public License as
@@ -26,6 +27,7 @@
26 * BSD LICENSE 27 * BSD LICENSE
27 * 28 *
28 * Copyright(c) 2017 Intel Deutschland GmbH 29 * Copyright(c) 2017 Intel Deutschland GmbH
30 * Copyright(c) 2019 Intel Corporation
29 * All rights reserved. 31 * All rights reserved.
30 * 32 *
31 * Redistribution and use in source and binary forms, with or without 33 * Redistribution and use in source and binary forms, with or without
@@ -74,6 +76,7 @@ void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
74 fwrt->ops_ctx = ops_ctx; 76 fwrt->ops_ctx = ops_ctx;
75 INIT_DELAYED_WORK(&fwrt->dump.wk, iwl_fw_error_dump_wk); 77 INIT_DELAYED_WORK(&fwrt->dump.wk, iwl_fw_error_dump_wk);
76 iwl_fwrt_dbgfs_register(fwrt, dbgfs_dir); 78 iwl_fwrt_dbgfs_register(fwrt, dbgfs_dir);
79 init_waitqueue_head(&fwrt->trans->fw_halt_waitq);
77} 80}
78IWL_EXPORT_SYMBOL(iwl_fw_runtime_init); 81IWL_EXPORT_SYMBOL(iwl_fw_runtime_init);
79 82
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/runtime.h b/drivers/net/wireless/intel/iwlwifi/fw/runtime.h
index a0fcbb28114b..a5fe1a8ca426 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/runtime.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/runtime.h
@@ -6,7 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2017 Intel Deutschland GmbH 8 * Copyright(c) 2017 Intel Deutschland GmbH
9 * Copyright(c) 2018 Intel Corporation 9 * Copyright (C) 2018-2019 Intel Corporation
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as 12 * it under the terms of version 2 of the GNU General Public License as
@@ -27,7 +27,7 @@
27 * BSD LICENSE 27 * BSD LICENSE
28 * 28 *
29 * Copyright(c) 2017 Intel Deutschland GmbH 29 * Copyright(c) 2017 Intel Deutschland GmbH
30 * Copyright(c) 2018 Intel Corporation 30 * Copyright (C) 2018-2019 Intel Corporation
31 * All rights reserved. 31 * All rights reserved.
32 * 32 *
33 * Redistribution and use in source and binary forms, with or without 33 * Redistribution and use in source and binary forms, with or without
@@ -73,6 +73,7 @@ struct iwl_fw_runtime_ops {
73 void (*dump_end)(void *ctx); 73 void (*dump_end)(void *ctx);
74 bool (*fw_running)(void *ctx); 74 bool (*fw_running)(void *ctx);
75 int (*send_hcmd)(void *ctx, struct iwl_host_cmd *host_cmd); 75 int (*send_hcmd)(void *ctx, struct iwl_host_cmd *host_cmd);
76 bool (*d3_debug_enable)(void *ctx);
76}; 77};
77 78
78#define MAX_NUM_LMAC 2 79#define MAX_NUM_LMAC 2
@@ -90,7 +91,6 @@ struct iwl_fwrt_shared_mem_cfg {
90 91
91enum iwl_fw_runtime_status { 92enum iwl_fw_runtime_status {
92 IWL_FWRT_STATUS_DUMPING = 0, 93 IWL_FWRT_STATUS_DUMPING = 0,
93 IWL_FWRT_STATUS_WAIT_ALIVE,
94}; 94};
95 95
96/** 96/**
@@ -138,12 +138,13 @@ struct iwl_fw_runtime {
138 u8 conf; 138 u8 conf;
139 139
140 /* ts of the beginning of a non-collect fw dbg data period */ 140 /* ts of the beginning of a non-collect fw dbg data period */
141 unsigned long non_collect_ts_start[IWL_FW_TRIGGER_ID_NUM - 1]; 141 unsigned long non_collect_ts_start[IWL_FW_TRIGGER_ID_NUM];
142 u32 *d3_debug_data; 142 u32 *d3_debug_data;
143 struct iwl_fw_ini_active_regs active_regs[IWL_FW_INI_MAX_REGION_ID]; 143 struct iwl_fw_ini_region_cfg *active_regs[IWL_FW_INI_MAX_REGION_ID];
144 struct iwl_fw_ini_active_triggers active_trigs[IWL_FW_TRIGGER_ID_NUM]; 144 struct iwl_fw_ini_active_triggers active_trigs[IWL_FW_TRIGGER_ID_NUM];
145 u32 lmac_err_id[MAX_NUM_LMAC]; 145 u32 lmac_err_id[MAX_NUM_LMAC];
146 u32 umac_err_id; 146 u32 umac_err_id;
147 void *fifo_iter;
147 } dump; 148 } dump;
148#ifdef CONFIG_IWLWIFI_DEBUGFS 149#ifdef CONFIG_IWLWIFI_DEBUGFS
149 struct { 150 struct {
@@ -161,8 +162,20 @@ void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
161 162
162static inline void iwl_fw_runtime_free(struct iwl_fw_runtime *fwrt) 163static inline void iwl_fw_runtime_free(struct iwl_fw_runtime *fwrt)
163{ 164{
165 int i;
166
164 kfree(fwrt->dump.d3_debug_data); 167 kfree(fwrt->dump.d3_debug_data);
165 fwrt->dump.d3_debug_data = NULL; 168 fwrt->dump.d3_debug_data = NULL;
169
170 for (i = 0; i < IWL_FW_TRIGGER_ID_NUM; i++) {
171 struct iwl_fw_ini_active_triggers *active =
172 &fwrt->dump.active_trigs[i];
173
174 active->active = false;
175 active->size = 0;
176 kfree(active->trig);
177 active->trig = NULL;
178 }
166} 179}
167 180
168void iwl_fw_runtime_suspend(struct iwl_fw_runtime *fwrt); 181void iwl_fw_runtime_suspend(struct iwl_fw_runtime *fwrt);
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index ff942532fac3..f5f87773667b 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
9 * Copyright (C) 2016 - 2017 Intel Deutschland GmbH 9 * Copyright (C) 2016 - 2017 Intel Deutschland GmbH
10 * Copyright(c) 2018 Intel Corporation 10 * Copyright(c) 2018 - 2019 Intel Corporation
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 13 * it under the terms of version 2 of the GNU General Public License as
@@ -29,7 +29,7 @@
29 * 29 *
30 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 30 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
31 * Copyright (C) 2016 - 2017 Intel Deutschland GmbH 31 * Copyright (C) 2016 - 2017 Intel Deutschland GmbH
32 * Copyright(c) 2018 Intel Corporation 32 * Copyright(c) 2018 - 2019 Intel Corporation
33 * All rights reserved. 33 * All rights reserved.
34 * 34 *
35 * Redistribution and use in source and binary forms, with or without 35 * Redistribution and use in source and binary forms, with or without
@@ -89,6 +89,7 @@ enum iwl_device_family {
89 IWL_DEVICE_FAMILY_9000, 89 IWL_DEVICE_FAMILY_9000,
90 IWL_DEVICE_FAMILY_22000, 90 IWL_DEVICE_FAMILY_22000,
91 IWL_DEVICE_FAMILY_22560, 91 IWL_DEVICE_FAMILY_22560,
92 IWL_DEVICE_FAMILY_AX210,
92}; 93};
93 94
94/* 95/*
@@ -379,6 +380,9 @@ struct iwl_csr_params {
379 * @nvm_type: see &enum iwl_nvm_type 380 * @nvm_type: see &enum iwl_nvm_type
380 * @d3_debug_data_base_addr: base address where D3 debug data is stored 381 * @d3_debug_data_base_addr: base address where D3 debug data is stored
381 * @d3_debug_data_length: length of the D3 debug data 382 * @d3_debug_data_length: length of the D3 debug data
383 * @bisr_workaround: BISR hardware workaround (for 22260 series devices)
384 * @min_txq_size: minimum number of slots required in a TX queue
385 * @umac_prph_offset: offset to add to UMAC periphery address
382 * 386 *
383 * We enable the driver to be backward compatible wrt. hardware features. 387 * We enable the driver to be backward compatible wrt. hardware features.
384 * API differences in uCode shouldn't be handled here but through TLVs 388 * API differences in uCode shouldn't be handled here but through TLVs
@@ -428,7 +432,8 @@ struct iwl_cfg {
428 use_tfh:1, 432 use_tfh:1,
429 gen2:1, 433 gen2:1,
430 cdb:1, 434 cdb:1,
431 dbgc_supported:1; 435 dbgc_supported:1,
436 bisr_workaround:1;
432 u8 valid_tx_ant; 437 u8 valid_tx_ant;
433 u8 valid_rx_ant; 438 u8 valid_rx_ant;
434 u8 non_shared_ant; 439 u8 non_shared_ant;
@@ -443,37 +448,12 @@ struct iwl_cfg {
443 u32 extra_phy_cfg_flags; 448 u32 extra_phy_cfg_flags;
444 u32 d3_debug_data_base_addr; 449 u32 d3_debug_data_base_addr;
445 u32 d3_debug_data_length; 450 u32 d3_debug_data_length;
451 u32 min_txq_size;
452 u32 umac_prph_offset;
446}; 453};
447 454
448static const struct iwl_csr_params iwl_csr_v1 = { 455extern const struct iwl_csr_params iwl_csr_v1;
449 .flag_mac_clock_ready = 0, 456extern const struct iwl_csr_params iwl_csr_v2;
450 .flag_val_mac_access_en = 0,
451 .flag_init_done = 2,
452 .flag_mac_access_req = 3,
453 .flag_sw_reset = 7,
454 .flag_master_dis = 8,
455 .flag_stop_master = 9,
456 .addr_sw_reset = (CSR_BASE + 0x020),
457 .mac_addr0_otp = 0x380,
458 .mac_addr1_otp = 0x384,
459 .mac_addr0_strap = 0x388,
460 .mac_addr1_strap = 0x38C
461};
462
463static const struct iwl_csr_params iwl_csr_v2 = {
464 .flag_init_done = 6,
465 .flag_mac_clock_ready = 20,
466 .flag_val_mac_access_en = 20,
467 .flag_mac_access_req = 21,
468 .flag_master_dis = 28,
469 .flag_stop_master = 29,
470 .flag_sw_reset = 31,
471 .addr_sw_reset = (CSR_BASE + 0x024),
472 .mac_addr0_otp = 0x30,
473 .mac_addr1_otp = 0x34,
474 .mac_addr0_strap = 0x38,
475 .mac_addr1_strap = 0x3C
476};
477 457
478/* 458/*
479 * This list declares the config structures for all devices. 459 * This list declares the config structures for all devices.
@@ -568,7 +548,7 @@ extern const struct iwl_cfg iwl9560_killer_s_2ac_cfg_shared_clk;
568extern const struct iwl_cfg iwl22000_2ac_cfg_hr; 548extern const struct iwl_cfg iwl22000_2ac_cfg_hr;
569extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb; 549extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb;
570extern const struct iwl_cfg iwl22000_2ac_cfg_jf; 550extern const struct iwl_cfg iwl22000_2ac_cfg_jf;
571extern const struct iwl_cfg iwl22560_2ax_cfg_hr; 551extern const struct iwl_cfg iwl_ax101_cfg_qu_hr;
572extern const struct iwl_cfg iwl22000_2ax_cfg_hr; 552extern const struct iwl_cfg iwl22000_2ax_cfg_hr;
573extern const struct iwl_cfg iwl22260_2ax_cfg; 553extern const struct iwl_cfg iwl22260_2ax_cfg;
574extern const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0; 554extern const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0;
@@ -585,9 +565,13 @@ extern const struct iwl_cfg iwl22000_2ax_cfg_jf;
585extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0_f0; 565extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0_f0;
586extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_b0_f0; 566extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_b0_f0;
587extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_b0; 567extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_b0;
588extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_jf_b0; 568extern const struct iwl_cfg iwl9560_2ac_cfg_qnj_jf_b0;
589extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0; 569extern const struct iwl_cfg iwl22000_2ax_cfg_qnj_hr_a0;
590extern const struct iwl_cfg iwl22560_2ax_cfg_su_cdb; 570extern const struct iwl_cfg iwl22560_2ax_cfg_su_cdb;
571extern const struct iwl_cfg iwlax210_2ax_cfg_so_jf_a0;
572extern const struct iwl_cfg iwlax210_2ax_cfg_so_hr_a0;
573extern const struct iwl_cfg iwlax210_2ax_cfg_so_gf_a0;
574extern const struct iwl_cfg iwlax210_2ax_cfg_ty_gf_a0;
591#endif /* CPTCFG_IWLMVM || CPTCFG_IWLFMAC */ 575#endif /* CPTCFG_IWLMVM || CPTCFG_IWLFMAC */
592 576
593#endif /* __IWL_CONFIG_H__ */ 577#endif /* __IWL_CONFIG_H__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
index 42af421bbc3c..aea6d03e545a 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
@@ -180,6 +180,7 @@
180/* Bits for CSR_HW_IF_CONFIG_REG */ 180/* Bits for CSR_HW_IF_CONFIG_REG */
181#define CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH (0x00000003) 181#define CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH (0x00000003)
182#define CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP (0x0000000C) 182#define CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP (0x0000000C)
183#define CSR_HW_IF_CONFIG_REG_BIT_MONITOR_SRAM (0x00000080)
183#define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x000000C0) 184#define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x000000C0)
184#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100) 185#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100)
185#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200) 186#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200)
@@ -327,11 +328,14 @@ enum {
327#define CSR_HW_REV_TYPE_QNJ (0x0000360) 328#define CSR_HW_REV_TYPE_QNJ (0x0000360)
328#define CSR_HW_REV_TYPE_QNJ_B0 (0x0000364) 329#define CSR_HW_REV_TYPE_QNJ_B0 (0x0000364)
329#define CSR_HW_REV_TYPE_HR_CDB (0x0000340) 330#define CSR_HW_REV_TYPE_HR_CDB (0x0000340)
331#define CSR_HW_REV_TYPE_SO (0x0000370)
332#define CSR_HW_REV_TYPE_TY (0x0000420)
330 333
331/* RF_ID value */ 334/* RF_ID value */
332#define CSR_HW_RF_ID_TYPE_JF (0x00105100) 335#define CSR_HW_RF_ID_TYPE_JF (0x00105100)
333#define CSR_HW_RF_ID_TYPE_HR (0x0010A000) 336#define CSR_HW_RF_ID_TYPE_HR (0x0010A000)
334#define CSR_HW_RF_ID_TYPE_HRCDB (0x00109F00) 337#define CSR_HW_RF_ID_TYPE_HRCDB (0x00109F00)
338#define CSR_HW_RF_ID_TYPE_GF (0x0010D000)
335 339
336/* HW_RF CHIP ID */ 340/* HW_RF CHIP ID */
337#define CSR_HW_RF_ID_TYPE_CHIP_ID(_val) (((_val) >> 12) & 0xFFF) 341#define CSR_HW_RF_ID_TYPE_CHIP_ID(_val) (((_val) >> 12) & 0xFFF)
@@ -593,6 +597,7 @@ enum msix_hw_int_causes {
593 MSIX_HW_INT_CAUSES_REG_ALIVE = BIT(0), 597 MSIX_HW_INT_CAUSES_REG_ALIVE = BIT(0),
594 MSIX_HW_INT_CAUSES_REG_WAKEUP = BIT(1), 598 MSIX_HW_INT_CAUSES_REG_WAKEUP = BIT(1),
595 MSIX_HW_INT_CAUSES_REG_IPC = BIT(1), 599 MSIX_HW_INT_CAUSES_REG_IPC = BIT(1),
600 MSIX_HW_INT_CAUSES_REG_IML = BIT(2),
596 MSIX_HW_INT_CAUSES_REG_SW_ERR_V2 = BIT(5), 601 MSIX_HW_INT_CAUSES_REG_SW_ERR_V2 = BIT(5),
597 MSIX_HW_INT_CAUSES_REG_CT_KILL = BIT(6), 602 MSIX_HW_INT_CAUSES_REG_CT_KILL = BIT(6),
598 MSIX_HW_INT_CAUSES_REG_RF_KILL = BIT(7), 603 MSIX_HW_INT_CAUSES_REG_RF_KILL = BIT(7),
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
index 43d815cb3ce9..5798f434f68f 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
@@ -71,6 +71,7 @@ void iwl_fw_dbg_copy_tlv(struct iwl_trans *trans, struct iwl_ucode_tlv *tlv,
71 u32 apply_point = le32_to_cpu(header->apply_point); 71 u32 apply_point = le32_to_cpu(header->apply_point);
72 72
73 int copy_size = le32_to_cpu(tlv->length) + sizeof(*tlv); 73 int copy_size = le32_to_cpu(tlv->length) + sizeof(*tlv);
74 int offset_size = copy_size;
74 75
75 if (WARN_ONCE(apply_point >= IWL_FW_INI_APPLY_NUM, 76 if (WARN_ONCE(apply_point >= IWL_FW_INI_APPLY_NUM,
76 "Invalid apply point id %d\n", apply_point)) 77 "Invalid apply point id %d\n", apply_point))
@@ -81,17 +82,25 @@ void iwl_fw_dbg_copy_tlv(struct iwl_trans *trans, struct iwl_ucode_tlv *tlv,
81 else 82 else
82 data = &trans->apply_points[apply_point]; 83 data = &trans->apply_points[apply_point];
83 84
85 /* add room for is_alloc field in &iwl_fw_ini_allocation_data struct */
86 if (le32_to_cpu(tlv->type) == IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION) {
87 struct iwl_fw_ini_allocation_data *buf_alloc =
88 (void *)tlv->data;
89
90 offset_size += sizeof(buf_alloc->is_alloc);
91 }
92
84 /* 93 /*
85 * Make sure we still have room to copy this TLV. Offset points to the 94 * Make sure we still have room to copy this TLV. Offset points to the
86 * location the last copy ended. 95 * location the last copy ended.
87 */ 96 */
88 if (WARN_ONCE(data->offset + copy_size > data->size, 97 if (WARN_ONCE(data->offset + offset_size > data->size,
89 "Not enough memory for apply point %d\n", 98 "Not enough memory for apply point %d\n",
90 apply_point)) 99 apply_point))
91 return; 100 return;
92 101
93 memcpy(data->data + data->offset, (void *)tlv, copy_size); 102 memcpy(data->data + data->offset, (void *)tlv, copy_size);
94 data->offset += copy_size; 103 data->offset += offset_size;
95} 104}
96 105
97void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data, 106void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data,
@@ -129,6 +138,16 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data,
129 if (WARN_ON(apply >= IWL_FW_INI_APPLY_NUM)) 138 if (WARN_ON(apply >= IWL_FW_INI_APPLY_NUM))
130 continue; 139 continue;
131 140
141 /* add room for is_alloc field in &iwl_fw_ini_allocation_data
142 * struct
143 */
144 if (tlv_type == IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION) {
145 struct iwl_fw_ini_allocation_data *buf_alloc =
146 (void *)tlv->data;
147
148 size[apply] += sizeof(buf_alloc->is_alloc);
149 }
150
132 size[apply] += sizeof(*tlv) + tlv_len; 151 size[apply] += sizeof(*tlv) + tlv_len;
133 } 152 }
134 153
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-debug.h b/drivers/net/wireless/intel/iwlwifi/iwl-debug.h
index a2af68a0d34b..655ff5694560 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-debug.h
@@ -1,6 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
4 * Copyright (C) 2018 Intel Corporation
4 * 5 *
5 * Portions of this file are derived from the ipw3945 project. 6 * Portions of this file are derived from the ipw3945 project.
6 * 7 *
@@ -159,7 +160,7 @@ do { \
159/* 0x000F0000 - 0x00010000 */ 160/* 0x000F0000 - 0x00010000 */
160#define IWL_DL_FW 0x00010000 161#define IWL_DL_FW 0x00010000
161#define IWL_DL_RF_KILL 0x00020000 162#define IWL_DL_RF_KILL 0x00020000
162#define IWL_DL_FW_ERRORS 0x00040000 163#define IWL_DL_TPT 0x00040000
163/* 0x00F00000 - 0x00100000 */ 164/* 0x00F00000 - 0x00100000 */
164#define IWL_DL_RATE 0x00100000 165#define IWL_DL_RATE 0x00100000
165#define IWL_DL_CALIB 0x00200000 166#define IWL_DL_CALIB 0x00200000
@@ -193,7 +194,6 @@ do { \
193#define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a) 194#define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a)
194#define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a) 195#define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a)
195#define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a) 196#define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a)
196#define IWL_DEBUG_FW_ERRORS(p, f, a...) IWL_DEBUG(p, IWL_DL_FW_ERRORS, f, ## a)
197#define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a) 197#define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a)
198#define IWL_DEBUG_DROP_LIMIT(p, f, a...) \ 198#define IWL_DEBUG_DROP_LIMIT(p, f, a...) \
199 IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a) 199 IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a)
@@ -215,6 +215,7 @@ do { \
215#define IWL_DEBUG_DEV_RADIO(p, f, a...) IWL_DEBUG_DEV(p, IWL_DL_RADIO, f, ## a) 215#define IWL_DEBUG_DEV_RADIO(p, f, a...) IWL_DEBUG_DEV(p, IWL_DL_RADIO, f, ## a)
216#define IWL_DEBUG_POWER(p, f, a...) IWL_DEBUG(p, IWL_DL_POWER, f, ## a) 216#define IWL_DEBUG_POWER(p, f, a...) IWL_DEBUG(p, IWL_DL_POWER, f, ## a)
217#define IWL_DEBUG_11H(p, f, a...) IWL_DEBUG(p, IWL_DL_11H, f, ## a) 217#define IWL_DEBUG_11H(p, f, a...) IWL_DEBUG(p, IWL_DL_11H, f, ## a)
218#define IWL_DEBUG_TPT(p, f, a...) IWL_DEBUG(p, IWL_DL_TPT, f, ## a)
218#define IWL_DEBUG_RPM(p, f, a...) IWL_DEBUG(p, IWL_DL_RPM, f, ## a) 219#define IWL_DEBUG_RPM(p, f, a...) IWL_DEBUG(p, IWL_DL_RPM, f, ## a)
219#define IWL_DEBUG_LAR(p, f, a...) IWL_DEBUG(p, IWL_DL_LAR, f, ## a) 220#define IWL_DEBUG_LAR(p, f, a...) IWL_DEBUG(p, IWL_DL_LAR, f, ## a)
220 221
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 2efa1dfe9b4c..689a65b11cc3 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -8,6 +8,7 @@
8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 - 2019 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -30,6 +31,7 @@
30 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
31 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
32 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 - 2019 Intel Corporation
33 * All rights reserved. 35 * All rights reserved.
34 * 36 *
35 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -75,6 +77,7 @@
75#include "iwl-dbg-tlv.h" 77#include "iwl-dbg-tlv.h"
76#include "iwl-config.h" 78#include "iwl-config.h"
77#include "iwl-modparams.h" 79#include "iwl-modparams.h"
80#include "fw/api/alive.h"
78 81
79/****************************************************************************** 82/******************************************************************************
80 * 83 *
@@ -588,6 +591,8 @@ static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv,
588 return 0; 591 return 0;
589} 592}
590 593
594#define FW_ADDR_CACHE_CONTROL 0xC0000000
595
591static int iwl_parse_tlv_firmware(struct iwl_drv *drv, 596static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
592 const struct firmware *ucode_raw, 597 const struct firmware *ucode_raw,
593 struct iwl_firmware_pieces *pieces, 598 struct iwl_firmware_pieces *pieces,
@@ -1085,6 +1090,52 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
1085 return -ENOMEM; 1090 return -ENOMEM;
1086 break; 1091 break;
1087 } 1092 }
1093 case IWL_UCODE_TLV_FW_RECOVERY_INFO: {
1094 struct {
1095 __le32 buf_addr;
1096 __le32 buf_size;
1097 } *recov_info = (void *)tlv_data;
1098
1099 if (tlv_len != sizeof(*recov_info))
1100 goto invalid_tlv_len;
1101 capa->error_log_addr =
1102 le32_to_cpu(recov_info->buf_addr);
1103 capa->error_log_size =
1104 le32_to_cpu(recov_info->buf_size);
1105 }
1106 break;
1107 case IWL_UCODE_TLV_UMAC_DEBUG_ADDRS: {
1108 struct iwl_umac_debug_addrs *dbg_ptrs =
1109 (void *)tlv_data;
1110
1111 if (tlv_len != sizeof(*dbg_ptrs))
1112 goto invalid_tlv_len;
1113 if (drv->trans->cfg->device_family <
1114 IWL_DEVICE_FAMILY_22000)
1115 break;
1116 drv->trans->umac_error_event_table =
1117 le32_to_cpu(dbg_ptrs->error_info_addr) &
1118 ~FW_ADDR_CACHE_CONTROL;
1119 drv->trans->error_event_table_tlv_status |=
1120 IWL_ERROR_EVENT_TABLE_UMAC;
1121 break;
1122 }
1123 case IWL_UCODE_TLV_LMAC_DEBUG_ADDRS: {
1124 struct iwl_lmac_debug_addrs *dbg_ptrs =
1125 (void *)tlv_data;
1126
1127 if (tlv_len != sizeof(*dbg_ptrs))
1128 goto invalid_tlv_len;
1129 if (drv->trans->cfg->device_family <
1130 IWL_DEVICE_FAMILY_22000)
1131 break;
1132 drv->trans->lmac_error_event_table[0] =
1133 le32_to_cpu(dbg_ptrs->error_event_table_ptr) &
1134 ~FW_ADDR_CACHE_CONTROL;
1135 drv->trans->error_event_table_tlv_status |=
1136 IWL_ERROR_EVENT_TABLE_LMAC1;
1137 break;
1138 }
1088 case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION: 1139 case IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION:
1089 case IWL_UCODE_TLV_TYPE_HCMD: 1140 case IWL_UCODE_TLV_TYPE_HCMD:
1090 case IWL_UCODE_TLV_TYPE_REGIONS: 1141 case IWL_UCODE_TLV_TYPE_REGIONS:
@@ -1202,11 +1253,6 @@ _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op)
1202#ifdef CONFIG_IWLWIFI_DEBUGFS 1253#ifdef CONFIG_IWLWIFI_DEBUGFS
1203 drv->dbgfs_op_mode = debugfs_create_dir(op->name, 1254 drv->dbgfs_op_mode = debugfs_create_dir(op->name,
1204 drv->dbgfs_drv); 1255 drv->dbgfs_drv);
1205 if (!drv->dbgfs_op_mode) {
1206 IWL_ERR(drv,
1207 "failed to create opmode debugfs directory\n");
1208 return op_mode;
1209 }
1210 dbgfs_dir = drv->dbgfs_op_mode; 1256 dbgfs_dir = drv->dbgfs_op_mode;
1211#endif 1257#endif
1212 1258
@@ -1262,8 +1308,8 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
1262 fw->ucode_capa.standard_phy_calibration_size = 1308 fw->ucode_capa.standard_phy_calibration_size =
1263 IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE; 1309 IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE;
1264 fw->ucode_capa.n_scan_channels = IWL_DEFAULT_SCAN_CHANNELS; 1310 fw->ucode_capa.n_scan_channels = IWL_DEFAULT_SCAN_CHANNELS;
1265 /* dump all fw memory areas by default except d3 debug data */ 1311 /* dump all fw memory areas by default */
1266 fw->dbg.dump_mask = 0xfffdffff; 1312 fw->dbg.dump_mask = 0xffffffff;
1267 1313
1268 pieces = kzalloc(sizeof(*pieces), GFP_KERNEL); 1314 pieces = kzalloc(sizeof(*pieces), GFP_KERNEL);
1269 if (!pieces) 1315 if (!pieces)
@@ -1569,20 +1615,8 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans)
1569 drv->dbgfs_drv = debugfs_create_dir(dev_name(trans->dev), 1615 drv->dbgfs_drv = debugfs_create_dir(dev_name(trans->dev),
1570 iwl_dbgfs_root); 1616 iwl_dbgfs_root);
1571 1617
1572 if (!drv->dbgfs_drv) {
1573 IWL_ERR(drv, "failed to create debugfs directory\n");
1574 ret = -ENOMEM;
1575 goto err_free_tlv;
1576 }
1577
1578 /* Create transport layer debugfs dir */ 1618 /* Create transport layer debugfs dir */
1579 drv->trans->dbgfs_dir = debugfs_create_dir("trans", drv->dbgfs_drv); 1619 drv->trans->dbgfs_dir = debugfs_create_dir("trans", drv->dbgfs_drv);
1580
1581 if (!drv->trans->dbgfs_dir) {
1582 IWL_ERR(drv, "failed to create transport debugfs directory\n");
1583 ret = -ENOMEM;
1584 goto err_free_dbgfs;
1585 }
1586#endif 1620#endif
1587 1621
1588 ret = iwl_request_firmware(drv, true); 1622 ret = iwl_request_firmware(drv, true);
@@ -1595,9 +1629,7 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans)
1595 1629
1596err_fw: 1630err_fw:
1597#ifdef CONFIG_IWLWIFI_DEBUGFS 1631#ifdef CONFIG_IWLWIFI_DEBUGFS
1598err_free_dbgfs:
1599 debugfs_remove_recursive(drv->dbgfs_drv); 1632 debugfs_remove_recursive(drv->dbgfs_drv);
1600err_free_tlv:
1601 iwl_fw_dbg_free(drv->trans); 1633 iwl_fw_dbg_free(drv->trans);
1602#endif 1634#endif
1603 kfree(drv); 1635 kfree(drv);
@@ -1708,9 +1740,6 @@ static int __init iwl_drv_init(void)
1708#ifdef CONFIG_IWLWIFI_DEBUGFS 1740#ifdef CONFIG_IWLWIFI_DEBUGFS
1709 /* Create the root of iwlwifi debugfs subsystem. */ 1741 /* Create the root of iwlwifi debugfs subsystem. */
1710 iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL); 1742 iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL);
1711
1712 if (!iwl_dbgfs_root)
1713 return -EFAULT;
1714#endif 1743#endif
1715 1744
1716 return iwl_pci_register_driver(); 1745 return iwl_pci_register_driver();
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c
index 75940ac406b9..04338c3a6205 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c
@@ -850,8 +850,7 @@ iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
850 if (WARN_ON(!cfg || !cfg->eeprom_params)) 850 if (WARN_ON(!cfg || !cfg->eeprom_params))
851 return NULL; 851 return NULL;
852 852
853 data = kzalloc(sizeof(*data) + 853 data = kzalloc(struct_size(data, channels, IWL_NUM_CHANNELS),
854 sizeof(struct ieee80211_channel) * IWL_NUM_CHANNELS,
855 GFP_KERNEL); 854 GFP_KERNEL);
856 if (!data) 855 if (!data)
857 return NULL; 856 return NULL;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-read.c b/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-read.c
index a6db6a814257..82e87192119e 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-read.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-read.c
@@ -193,34 +193,25 @@ static int iwl_init_otp_access(struct iwl_trans *trans)
193{ 193{
194 int ret; 194 int ret;
195 195
196 /* Enable 40MHz radio clock */ 196 ret = iwl_finish_nic_init(trans);
197 iwl_write32(trans, CSR_GP_CNTRL, 197 if (ret)
198 iwl_read32(trans, CSR_GP_CNTRL) | 198 return ret;
199 BIT(trans->cfg->csr->flag_init_done)); 199
200 200 iwl_set_bits_prph(trans, APMG_PS_CTRL_REG,
201 /* wait for clock to be ready */ 201 APMG_PS_CTRL_VAL_RESET_REQ);
202 ret = iwl_poll_bit(trans, CSR_GP_CNTRL, 202 udelay(5);
203 BIT(trans->cfg->csr->flag_mac_clock_ready), 203 iwl_clear_bits_prph(trans, APMG_PS_CTRL_REG,
204 BIT(trans->cfg->csr->flag_mac_clock_ready), 204 APMG_PS_CTRL_VAL_RESET_REQ);
205 25000); 205
206 if (ret < 0) { 206 /*
207 IWL_ERR(trans, "Time out access OTP\n"); 207 * CSR auto clock gate disable bit -
208 } else { 208 * this is only applicable for HW with OTP shadow RAM
209 iwl_set_bits_prph(trans, APMG_PS_CTRL_REG, 209 */
210 APMG_PS_CTRL_VAL_RESET_REQ); 210 if (trans->cfg->base_params->shadow_ram_support)
211 udelay(5); 211 iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
212 iwl_clear_bits_prph(trans, APMG_PS_CTRL_REG, 212 CSR_RESET_LINK_PWR_MGMT_DISABLED);
213 APMG_PS_CTRL_VAL_RESET_REQ); 213
214 214 return 0;
215 /*
216 * CSR auto clock gate disable bit -
217 * this is only applicable for HW with OTP shadow RAM
218 */
219 if (trans->cfg->base_params->shadow_ram_support)
220 iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
221 CSR_RESET_LINK_PWR_MGMT_DISABLED);
222 }
223 return ret;
224} 215}
225 216
226static int iwl_read_otp_word(struct iwl_trans *trans, u16 addr, 217static int iwl_read_otp_word(struct iwl_trans *trans, u16 addr,
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.c b/drivers/net/wireless/intel/iwlwifi/iwl-io.c
index ffd1e649bfa0..a704e25af810 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.c
@@ -7,6 +7,7 @@
7 * 7 *
8 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2015 - 2016 Intel Deutschland GmbH 9 * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
10 * Copyright(C) 2018 - 2019 Intel Corporation
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of version 2 of the GNU General Public License as 13 * under the terms of version 2 of the GNU General Public License as
@@ -28,6 +29,7 @@
28 * 29 *
29 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 30 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
30 * Copyright(c) 2015 - 2016 Intel Deutschland GmbH 31 * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
32 * Copyright (C) 2018 - 2019 Intel Corporation
31 * All rights reserved. 33 * All rights reserved.
32 * 34 *
33 * Redistribution and use in source and binary forms, with or without 35 * Redistribution and use in source and binary forms, with or without
@@ -68,6 +70,36 @@
68#include "iwl-prph.h" 70#include "iwl-prph.h"
69#include "iwl-fh.h" 71#include "iwl-fh.h"
70 72
73const struct iwl_csr_params iwl_csr_v1 = {
74 .flag_mac_clock_ready = 0,
75 .flag_val_mac_access_en = 0,
76 .flag_init_done = 2,
77 .flag_mac_access_req = 3,
78 .flag_sw_reset = 7,
79 .flag_master_dis = 8,
80 .flag_stop_master = 9,
81 .addr_sw_reset = CSR_BASE + 0x020,
82 .mac_addr0_otp = 0x380,
83 .mac_addr1_otp = 0x384,
84 .mac_addr0_strap = 0x388,
85 .mac_addr1_strap = 0x38C
86};
87
88const struct iwl_csr_params iwl_csr_v2 = {
89 .flag_init_done = 6,
90 .flag_mac_clock_ready = 20,
91 .flag_val_mac_access_en = 20,
92 .flag_mac_access_req = 21,
93 .flag_master_dis = 28,
94 .flag_stop_master = 29,
95 .flag_sw_reset = 31,
96 .addr_sw_reset = CSR_BASE + 0x024,
97 .mac_addr0_otp = 0x30,
98 .mac_addr1_otp = 0x34,
99 .mac_addr0_strap = 0x38,
100 .mac_addr1_strap = 0x3C
101};
102
71void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) 103void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)
72{ 104{
73 trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val); 105 trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val);
@@ -275,9 +307,12 @@ void iwl_force_nmi(struct iwl_trans *trans)
275 if (trans->cfg->device_family < IWL_DEVICE_FAMILY_9000) 307 if (trans->cfg->device_family < IWL_DEVICE_FAMILY_9000)
276 iwl_write_prph(trans, DEVICE_SET_NMI_REG, 308 iwl_write_prph(trans, DEVICE_SET_NMI_REG,
277 DEVICE_SET_NMI_VAL_DRV); 309 DEVICE_SET_NMI_VAL_DRV);
310 else if (trans->cfg->device_family < IWL_DEVICE_FAMILY_AX210)
311 iwl_write_umac_prph(trans, UREG_NIC_SET_NMI_DRIVER,
312 UREG_NIC_SET_NMI_DRIVER_NMI_FROM_DRIVER_MSK);
278 else 313 else
279 iwl_write_prph(trans, UREG_NIC_SET_NMI_DRIVER, 314 iwl_write_umac_prph(trans, UREG_DOORBELL_TO_ISR6,
280 UREG_NIC_SET_NMI_DRIVER_NMI_FROM_DRIVER_MSK); 315 UREG_DOORBELL_TO_ISR6_NMI_BIT);
281} 316}
282IWL_EXPORT_SYMBOL(iwl_force_nmi); 317IWL_EXPORT_SYMBOL(iwl_force_nmi);
283 318
@@ -456,3 +491,43 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf)
456 491
457 return 0; 492 return 0;
458} 493}
494
495int iwl_finish_nic_init(struct iwl_trans *trans)
496{
497 int err;
498
499 if (trans->cfg->bisr_workaround) {
500 /* ensure the TOP FSM isn't still in previous reset */
501 mdelay(2);
502 }
503
504 /*
505 * Set "initialization complete" bit to move adapter from
506 * D0U* --> D0A* (powered-up active) state.
507 */
508 iwl_set_bit(trans, CSR_GP_CNTRL,
509 BIT(trans->cfg->csr->flag_init_done));
510
511 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
512 udelay(2);
513
514 /*
515 * Wait for clock stabilization; once stabilized, access to
516 * device-internal resources is supported, e.g. iwl_write_prph()
517 * and accesses to uCode SRAM.
518 */
519 err = iwl_poll_bit(trans, CSR_GP_CNTRL,
520 BIT(trans->cfg->csr->flag_mac_clock_ready),
521 BIT(trans->cfg->csr->flag_mac_clock_ready),
522 25000);
523 if (err < 0)
524 IWL_DEBUG_INFO(trans, "Failed to wake NIC\n");
525
526 if (trans->cfg->bisr_workaround) {
527 /* ensure BISR shift has finished */
528 udelay(200);
529 }
530
531 return err < 0 ? err : 0;
532}
533IWL_EXPORT_SYMBOL(iwl_finish_nic_init);
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.h b/drivers/net/wireless/intel/iwlwifi/iwl-io.h
index 61477e58352d..920e2146ea3f 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.h
@@ -5,6 +5,8 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright (C) 2018 - 2019 Intel Corporation
9 *
8 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of version 2 of the GNU General Public License as 11 * under the terms of version 2 of the GNU General Public License as
10 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
@@ -23,6 +25,7 @@
23 * 25 *
24 * BSD LICENSE 26 * BSD LICENSE
25 * 27 *
28 * Copyright (C) 2018 - 2019 Intel Corporation
26 * All rights reserved. 29 * All rights reserved.
27 * 30 *
28 * Redistribution and use in source and binary forms, with or without 31 * Redistribution and use in source and binary forms, with or without
@@ -96,7 +99,48 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs,
96void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); 99void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
97void iwl_force_nmi(struct iwl_trans *trans); 100void iwl_force_nmi(struct iwl_trans *trans);
98 101
102int iwl_finish_nic_init(struct iwl_trans *trans);
103
99/* Error handling */ 104/* Error handling */
100int iwl_dump_fh(struct iwl_trans *trans, char **buf); 105int iwl_dump_fh(struct iwl_trans *trans, char **buf);
101 106
107/*
108 * UMAC periphery address space changed from 0xA00000 to 0xD00000 starting from
109 * device family AX200. So peripheries used in families above and below AX200
110 * should go through iwl_..._umac_..._prph.
111 */
112static inline u32 iwl_umac_prph(struct iwl_trans *trans, u32 ofs)
113{
114 return ofs + trans->cfg->umac_prph_offset;
115}
116
117static inline u32 iwl_read_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs)
118{
119 return iwl_read_prph_no_grab(trans, ofs + trans->cfg->umac_prph_offset);
120}
121
122static inline u32 iwl_read_umac_prph(struct iwl_trans *trans, u32 ofs)
123{
124 return iwl_read_prph(trans, ofs + trans->cfg->umac_prph_offset);
125}
126
127static inline void iwl_write_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs,
128 u32 val)
129{
130 iwl_write_prph_no_grab(trans, ofs + trans->cfg->umac_prph_offset, val);
131}
132
133static inline void iwl_write_umac_prph(struct iwl_trans *trans, u32 ofs,
134 u32 val)
135{
136 iwl_write_prph(trans, ofs + trans->cfg->umac_prph_offset, val);
137}
138
139static inline int iwl_poll_umac_prph_bit(struct iwl_trans *trans, u32 addr,
140 u32 bits, u32 mask, int timeout)
141{
142 return iwl_poll_prph_bit(trans, addr + trans->cfg->umac_prph_offset,
143 bits, mask, timeout);
144}
145
102#endif 146#endif
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index 63c081e5c63a..87d6de7efdd2 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -463,6 +463,9 @@ static void iwl_init_vht_hw_capab(const struct iwl_cfg *cfg,
463 } 463 }
464 464
465 vht_cap->vht_mcs.tx_mcs_map = vht_cap->vht_mcs.rx_mcs_map; 465 vht_cap->vht_mcs.tx_mcs_map = vht_cap->vht_mcs.rx_mcs_map;
466
467 vht_cap->vht_mcs.tx_highest |=
468 cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE);
466} 469}
467 470
468static struct ieee80211_sband_iftype_data iwl_he_capa[] = { 471static struct ieee80211_sband_iftype_data iwl_he_capa[] = {
@@ -930,15 +933,13 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
930 const __le16 *ch_section; 933 const __le16 *ch_section;
931 934
932 if (cfg->nvm_type != IWL_NVM_EXT) 935 if (cfg->nvm_type != IWL_NVM_EXT)
933 data = kzalloc(sizeof(*data) + 936 data = kzalloc(struct_size(data, channels,
934 sizeof(struct ieee80211_channel) * 937 IWL_NVM_NUM_CHANNELS),
935 IWL_NVM_NUM_CHANNELS, 938 GFP_KERNEL);
936 GFP_KERNEL);
937 else 939 else
938 data = kzalloc(sizeof(*data) + 940 data = kzalloc(struct_size(data, channels,
939 sizeof(struct ieee80211_channel) * 941 IWL_NVM_NUM_CHANNELS_EXT),
940 IWL_NVM_NUM_CHANNELS_EXT, 942 GFP_KERNEL);
941 GFP_KERNEL);
942 if (!data) 943 if (!data)
943 return NULL; 944 return NULL;
944 945
@@ -1086,12 +1087,12 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
1086 int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ? 1087 int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ?
1087 IWL_NVM_NUM_CHANNELS_EXT : IWL_NVM_NUM_CHANNELS; 1088 IWL_NVM_NUM_CHANNELS_EXT : IWL_NVM_NUM_CHANNELS;
1088 1089
1089 if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES))
1090 return ERR_PTR(-EINVAL);
1091
1092 if (WARN_ON(num_of_ch > max_num_ch)) 1090 if (WARN_ON(num_of_ch > max_num_ch))
1093 num_of_ch = max_num_ch; 1091 num_of_ch = max_num_ch;
1094 1092
1093 if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES))
1094 return ERR_PTR(-EINVAL);
1095
1095 IWL_DEBUG_DEV(dev, IWL_DL_LAR, "building regdom for %d channels\n", 1096 IWL_DEBUG_DEV(dev, IWL_DL_LAR, "building regdom for %d channels\n",
1096 num_of_ch); 1097 num_of_ch);
1097 1098
@@ -1425,9 +1426,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
1425 if (empty_otp) 1426 if (empty_otp)
1426 IWL_INFO(trans, "OTP is empty\n"); 1427 IWL_INFO(trans, "OTP is empty\n");
1427 1428
1428 nvm = kzalloc(sizeof(*nvm) + 1429 nvm = kzalloc(struct_size(nvm, channels, IWL_NUM_CHANNELS), GFP_KERNEL);
1429 sizeof(struct ieee80211_channel) * IWL_NUM_CHANNELS,
1430 GFP_KERNEL);
1431 if (!nvm) { 1430 if (!nvm) {
1432 ret = -ENOMEM; 1431 ret = -ENOMEM;
1433 goto out; 1432 goto out;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
index 3aaa5f06461c..1af9f9e1ecd4 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
@@ -8,7 +8,7 @@
8 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 Intel Deutschland GmbH 10 * Copyright(c) 2016 Intel Deutschland GmbH
11 * Copyright (C) 2018 Intel Corporation 11 * Copyright (C) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 Intel Deutschland GmbH 33 * Copyright(c) 2016 Intel Deutschland GmbH
34 * Copyright (C) 2018 Intel Corporation 34 * Copyright (C) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -433,4 +433,7 @@ enum {
433#define HPM_DEBUG 0xA03440 433#define HPM_DEBUG 0xA03440
434#define PERSISTENCE_BIT BIT(12) 434#define PERSISTENCE_BIT BIT(12)
435#define PREG_WFPM_ACCESS BIT(12) 435#define PREG_WFPM_ACCESS BIT(12)
436
437#define UREG_DOORBELL_TO_ISR6 0xA05C04
438#define UREG_DOORBELL_TO_ISR6_NMI_BIT BIT(0)
436#endif /* __iwl_prph_h__ */ 439#endif /* __iwl_prph_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index a7009cd4232d..bbebbf3efd57 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -8,6 +8,7 @@
8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 - 2019 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -30,6 +31,7 @@
30 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
31 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
32 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 - 2019 Intel Corporation
33 * All rights reserved. 35 * All rights reserved.
34 * 36 *
35 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -230,6 +232,12 @@ enum iwl_hcmd_dataflag {
230 IWL_HCMD_DFL_DUP = BIT(1), 232 IWL_HCMD_DFL_DUP = BIT(1),
231}; 233};
232 234
235enum iwl_error_event_table_status {
236 IWL_ERROR_EVENT_TABLE_LMAC1 = BIT(0),
237 IWL_ERROR_EVENT_TABLE_LMAC2 = BIT(1),
238 IWL_ERROR_EVENT_TABLE_UMAC = BIT(2),
239};
240
233/** 241/**
234 * struct iwl_host_cmd - Host command to the uCode 242 * struct iwl_host_cmd - Host command to the uCode
235 * 243 *
@@ -330,6 +338,7 @@ enum iwl_d3_status {
330 * are sent 338 * are sent
331 * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent 339 * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent
332 * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation 340 * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation
341 * @STATUS_FW_WAIT_DUMP: if set, wait until cleared before collecting dump
333 */ 342 */
334enum iwl_trans_status { 343enum iwl_trans_status {
335 STATUS_SYNC_HCMD_ACTIVE, 344 STATUS_SYNC_HCMD_ACTIVE,
@@ -342,6 +351,7 @@ enum iwl_trans_status {
342 STATUS_TRANS_GOING_IDLE, 351 STATUS_TRANS_GOING_IDLE,
343 STATUS_TRANS_IDLE, 352 STATUS_TRANS_IDLE,
344 STATUS_TRANS_DEAD, 353 STATUS_TRANS_DEAD,
354 STATUS_FW_WAIT_DUMP,
345}; 355};
346 356
347static inline int 357static inline int
@@ -684,6 +694,9 @@ enum iwl_plat_pm_mode {
684 */ 694 */
685#define IWL_TRANS_IDLE_TIMEOUT 2000 695#define IWL_TRANS_IDLE_TIMEOUT 2000
686 696
697/* Max time to wait for nmi interrupt */
698#define IWL_TRANS_NMI_TIMEOUT (HZ / 4)
699
687/** 700/**
688 * struct iwl_dram_data 701 * struct iwl_dram_data
689 * @physical: page phy pointer 702 * @physical: page phy pointer
@@ -697,6 +710,20 @@ struct iwl_dram_data {
697}; 710};
698 711
699/** 712/**
713 * struct iwl_self_init_dram - dram data used by self init process
714 * @fw: lmac and umac dram data
715 * @fw_cnt: total number of items in array
716 * @paging: paging dram data
717 * @paging_cnt: total number of items in array
718 */
719struct iwl_self_init_dram {
720 struct iwl_dram_data *fw;
721 int fw_cnt;
722 struct iwl_dram_data *paging;
723 int paging_cnt;
724};
725
726/**
700 * struct iwl_trans - transport common data 727 * struct iwl_trans - transport common data
701 * 728 *
702 * @ops - pointer to iwl_trans_ops 729 * @ops - pointer to iwl_trans_ops
@@ -738,6 +765,10 @@ struct iwl_dram_data {
738 * mode is set during the initialization phase and is not 765 * mode is set during the initialization phase and is not
739 * supposed to change during runtime. 766 * supposed to change during runtime.
740 * @dbg_rec_on: true iff there is a fw debug recording currently active 767 * @dbg_rec_on: true iff there is a fw debug recording currently active
768 * @lmac_error_event_table: addrs of lmacs error tables
769 * @umac_error_event_table: addr of umac error table
770 * @error_event_table_tlv_status: bitmap that indicates what error table
771 * pointers was recevied via TLV. use enum &iwl_error_event_table_status
741 */ 772 */
742struct iwl_trans { 773struct iwl_trans {
743 const struct iwl_trans_ops *ops; 774 const struct iwl_trans_ops *ops;
@@ -790,12 +821,18 @@ struct iwl_trans {
790 u8 dbg_n_dest_reg; 821 u8 dbg_n_dest_reg;
791 int num_blocks; 822 int num_blocks;
792 struct iwl_dram_data fw_mon[IWL_FW_INI_APPLY_NUM]; 823 struct iwl_dram_data fw_mon[IWL_FW_INI_APPLY_NUM];
824 struct iwl_self_init_dram init_dram;
793 825
794 enum iwl_plat_pm_mode system_pm_mode; 826 enum iwl_plat_pm_mode system_pm_mode;
795 enum iwl_plat_pm_mode runtime_pm_mode; 827 enum iwl_plat_pm_mode runtime_pm_mode;
796 bool suspending; 828 bool suspending;
797 bool dbg_rec_on; 829 bool dbg_rec_on;
798 830
831 u32 lmac_error_event_table[2];
832 u32 umac_error_event_table;
833 unsigned int error_event_table_tlv_status;
834 wait_queue_head_t fw_halt_waitq;
835
799 /* pointer to trans specific struct */ 836 /* pointer to trans specific struct */
800 /*Ensure that this pointer will always be aligned to sizeof pointer */ 837 /*Ensure that this pointer will always be aligned to sizeof pointer */
801 char trans_specific[0] __aligned(sizeof(void *)); 838 char trans_specific[0] __aligned(sizeof(void *));
@@ -1202,6 +1239,10 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans)
1202 /* prevent double restarts due to the same erroneous FW */ 1239 /* prevent double restarts due to the same erroneous FW */
1203 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) 1240 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status))
1204 iwl_op_mode_nic_error(trans->op_mode); 1241 iwl_op_mode_nic_error(trans->op_mode);
1242
1243 if (test_and_clear_bit(STATUS_FW_WAIT_DUMP, &trans->status))
1244 wake_up(&trans->fw_halt_waitq);
1245
1205} 1246}
1206 1247
1207/***************************************************** 1248/*****************************************************
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/Makefile b/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
index 30cbd981efbd..dd268c4bd371 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
@@ -5,6 +5,7 @@ iwlmvm-y += utils.o rx.o rxmq.o tx.o binding.o quota.o sta.o sf.o
5iwlmvm-y += scan.o time-event.o rs.o rs-fw.o 5iwlmvm-y += scan.o time-event.o rs.o rs-fw.o
6iwlmvm-y += power.o coex.o 6iwlmvm-y += power.o coex.o
7iwlmvm-y += tt.o offloading.o tdls.o 7iwlmvm-y += tt.o offloading.o tdls.o
8iwlmvm-y += ftm-responder.o ftm-initiator.o
8iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o 9iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o
9iwlmvm-$(CONFIG_IWLWIFI_LEDS) += led.o 10iwlmvm-$(CONFIG_IWLWIFI_LEDS) += led.o
10iwlmvm-$(CONFIG_PM) += d3.o 11iwlmvm-$(CONFIG_PM) += d3.o
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
index 730e37744dc0..3d2abbc5c76c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
@@ -241,7 +241,6 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
241 struct iwl_bt_coex_reduced_txp_update_cmd cmd = {}; 241 struct iwl_bt_coex_reduced_txp_update_cmd cmd = {};
242 struct iwl_mvm_sta *mvmsta; 242 struct iwl_mvm_sta *mvmsta;
243 u32 value; 243 u32 value;
244 int ret;
245 244
246 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id); 245 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id);
247 if (!mvmsta) 246 if (!mvmsta)
@@ -262,10 +261,8 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
262 cmd.reduced_txp = cpu_to_le32(value); 261 cmd.reduced_txp = cpu_to_le32(value);
263 mvmsta->bt_reduced_txpower = enable; 262 mvmsta->bt_reduced_txpower = enable;
264 263
265 ret = iwl_mvm_send_cmd_pdu(mvm, BT_COEX_UPDATE_REDUCED_TXP, CMD_ASYNC, 264 return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_UPDATE_REDUCED_TXP,
266 sizeof(cmd), &cmd); 265 CMD_ASYNC, sizeof(cmd), &cmd);
267
268 return ret;
269} 266}
270 267
271struct iwl_bt_iterator_data { 268struct iwl_bt_iterator_data {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
index d96ada3c06fc..dff14f1ec55f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
@@ -8,6 +8,7 @@
8 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2015 Intel Deutschland GmbH 10 * Copyright(c) 2015 Intel Deutschland GmbH
11 * Copyright(c) 2018 - 2019 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -30,6 +31,7 @@
30 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
31 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
32 * Copyright(c) 2015 Intel Deutschland GmbH 33 * Copyright(c) 2015 Intel Deutschland GmbH
34 * Copyright(c) 2018 - 2019 Intel Corporation
33 * All rights reserved. 35 * All rights reserved.
34 * 36 *
35 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -63,6 +65,7 @@
63#define __MVM_CONSTANTS_H 65#define __MVM_CONSTANTS_H
64 66
65#include <linux/ieee80211.h> 67#include <linux/ieee80211.h>
68#include "fw-api.h"
66 69
67#define IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM 20 70#define IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM 20
68 71
@@ -114,6 +117,7 @@
114#define IWL_MVM_TCM_LOWLAT_ENABLE_THRESH 100 /* packets/10 seconds */ 117#define IWL_MVM_TCM_LOWLAT_ENABLE_THRESH 100 /* packets/10 seconds */
115#define IWL_MVM_UAPSD_NONAGG_PERIOD 5000 /* msecs */ 118#define IWL_MVM_UAPSD_NONAGG_PERIOD 5000 /* msecs */
116#define IWL_MVM_UAPSD_NOAGG_LIST_LEN IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM 119#define IWL_MVM_UAPSD_NOAGG_LIST_LEN IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM
120#define IWL_MVM_NON_TRANSMITTING_AP 0
117#define IWL_MVM_RS_NUM_TRY_BEFORE_ANT_TOGGLE 1 121#define IWL_MVM_RS_NUM_TRY_BEFORE_ANT_TOGGLE 1
118#define IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE 2 122#define IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE 2
119#define IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE_TW 1 123#define IWL_MVM_RS_HT_VHT_RETRIES_PER_RATE_TW 1
@@ -145,5 +149,8 @@
145#define IWL_MVM_RS_TPC_SR_NO_INCREASE 85 /* percent */ 149#define IWL_MVM_RS_TPC_SR_NO_INCREASE 85 /* percent */
146#define IWL_MVM_RS_TPC_TX_POWER_STEP 3 150#define IWL_MVM_RS_TPC_TX_POWER_STEP 3
147#define IWL_MVM_ENABLE_EBS 1 151#define IWL_MVM_ENABLE_EBS 1
152#define IWL_MVM_FTM_INITIATOR_ALGO IWL_TOF_ALGO_TYPE_MAX_LIKE
153#define IWL_MVM_FTM_INITIATOR_DYNACK true
154#define IWL_MVM_D3_DEBUG false
148 155
149#endif /* __MVM_CONSTANTS_H */ 156#endif /* __MVM_CONSTANTS_H */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index 36ed7d6fc971..808bc6f363d0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -1899,7 +1899,7 @@ static void iwl_mvm_d3_disconnect_iter(void *data, u8 *mac,
1899static int iwl_mvm_check_rt_status(struct iwl_mvm *mvm, 1899static int iwl_mvm_check_rt_status(struct iwl_mvm *mvm,
1900 struct ieee80211_vif *vif) 1900 struct ieee80211_vif *vif)
1901{ 1901{
1902 u32 base = mvm->error_event_table[0]; 1902 u32 base = mvm->trans->lmac_error_event_table[0];
1903 struct error_table_start { 1903 struct error_table_start {
1904 /* cf. struct iwl_error_event_table */ 1904 /* cf. struct iwl_error_event_table */
1905 u32 valid; 1905 u32 valid;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index e136475a34f6..776b24f54200 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -1188,6 +1188,111 @@ out:
1188 return ret ?: count; 1188 return ret ?: count;
1189} 1189}
1190 1190
1191static int _iwl_dbgfs_inject_beacon_ie(struct iwl_mvm *mvm, char *bin, int len)
1192{
1193 struct ieee80211_vif *vif;
1194 struct iwl_mvm_vif *mvmvif;
1195 struct sk_buff *beacon;
1196 struct ieee80211_tx_info *info;
1197 struct iwl_mac_beacon_cmd beacon_cmd = {};
1198 u8 rate;
1199 u16 flags;
1200 int i;
1201
1202 len /= 2;
1203
1204 /* Element len should be represented by u8 */
1205 if (len >= U8_MAX)
1206 return -EINVAL;
1207
1208 if (!iwl_mvm_firmware_running(mvm))
1209 return -EIO;
1210
1211 if (!iwl_mvm_has_new_tx_api(mvm) &&
1212 !fw_has_api(&mvm->fw->ucode_capa,
1213 IWL_UCODE_TLV_API_NEW_BEACON_TEMPLATE))
1214 return -EINVAL;
1215
1216 rcu_read_lock();
1217
1218 for (i = 0; i < NUM_MAC_INDEX_DRIVER; i++) {
1219 vif = iwl_mvm_rcu_dereference_vif_id(mvm, i, true);
1220 if (!vif)
1221 continue;
1222
1223 if (vif->type == NL80211_IFTYPE_AP)
1224 break;
1225 }
1226
1227 if (i == NUM_MAC_INDEX_DRIVER || !vif)
1228 goto out_err;
1229
1230 mvm->hw->extra_beacon_tailroom = len;
1231
1232 beacon = ieee80211_beacon_get_template(mvm->hw, vif, NULL);
1233 if (!beacon)
1234 goto out_err;
1235
1236 if (len && hex2bin(skb_put_zero(beacon, len), bin, len)) {
1237 dev_kfree_skb(beacon);
1238 goto out_err;
1239 }
1240
1241 mvm->beacon_inject_active = true;
1242
1243 mvmvif = iwl_mvm_vif_from_mac80211(vif);
1244 info = IEEE80211_SKB_CB(beacon);
1245 rate = iwl_mvm_mac_ctxt_get_lowest_rate(info, vif);
1246 flags = iwl_mvm_mac80211_idx_to_hwrate(rate);
1247
1248 if (rate == IWL_FIRST_CCK_RATE)
1249 flags |= IWL_MAC_BEACON_CCK;
1250
1251 beacon_cmd.flags = cpu_to_le16(flags);
1252 beacon_cmd.byte_cnt = cpu_to_le16((u16)beacon->len);
1253 beacon_cmd.template_id = cpu_to_le32((u32)mvmvif->id);
1254
1255 iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd.tim_idx,
1256 &beacon_cmd.tim_size,
1257 beacon->data, beacon->len);
1258
1259 mutex_lock(&mvm->mutex);
1260 iwl_mvm_mac_ctxt_send_beacon_cmd(mvm, beacon, &beacon_cmd,
1261 sizeof(beacon_cmd));
1262 mutex_unlock(&mvm->mutex);
1263
1264 dev_kfree_skb(beacon);
1265
1266 rcu_read_unlock();
1267 return 0;
1268
1269out_err:
1270 rcu_read_unlock();
1271 return -EINVAL;
1272}
1273
1274static ssize_t iwl_dbgfs_inject_beacon_ie_write(struct iwl_mvm *mvm,
1275 char *buf, size_t count,
1276 loff_t *ppos)
1277{
1278 int ret = _iwl_dbgfs_inject_beacon_ie(mvm, buf, count);
1279
1280 mvm->hw->extra_beacon_tailroom = 0;
1281 return ret ?: count;
1282}
1283
1284static ssize_t iwl_dbgfs_inject_beacon_ie_restore_write(struct iwl_mvm *mvm,
1285 char *buf,
1286 size_t count,
1287 loff_t *ppos)
1288{
1289 int ret = _iwl_dbgfs_inject_beacon_ie(mvm, NULL, 0);
1290
1291 mvm->hw->extra_beacon_tailroom = 0;
1292 mvm->beacon_inject_active = false;
1293 return ret ?: count;
1294}
1295
1191static ssize_t iwl_dbgfs_fw_dbg_conf_read(struct file *file, 1296static ssize_t iwl_dbgfs_fw_dbg_conf_read(struct file *file,
1192 char __user *user_buf, 1297 char __user *user_buf,
1193 size_t count, loff_t *ppos) 1298 size_t count, loff_t *ppos)
@@ -1684,6 +1789,7 @@ iwl_dbgfs_send_echo_cmd_write(struct iwl_mvm *mvm, char *buf,
1684 1789
1685struct iwl_mvm_sniffer_apply { 1790struct iwl_mvm_sniffer_apply {
1686 struct iwl_mvm *mvm; 1791 struct iwl_mvm *mvm;
1792 u8 *bssid;
1687 u16 aid; 1793 u16 aid;
1688}; 1794};
1689 1795
@@ -1693,6 +1799,8 @@ static bool iwl_mvm_sniffer_apply(struct iwl_notif_wait_data *notif_data,
1693 struct iwl_mvm_sniffer_apply *apply = data; 1799 struct iwl_mvm_sniffer_apply *apply = data;
1694 1800
1695 apply->mvm->cur_aid = cpu_to_le16(apply->aid); 1801 apply->mvm->cur_aid = cpu_to_le16(apply->aid);
1802 memcpy(apply->mvm->cur_bssid, apply->bssid,
1803 sizeof(apply->mvm->cur_bssid));
1696 1804
1697 return true; 1805 return true;
1698} 1806}
@@ -1725,6 +1833,7 @@ iwl_dbgfs_he_sniffer_params_write(struct iwl_mvm *mvm, char *buf,
1725 he_mon_cmd.aid = cpu_to_le16(aid); 1833 he_mon_cmd.aid = cpu_to_le16(aid);
1726 1834
1727 apply.aid = aid; 1835 apply.aid = aid;
1836 apply.bssid = (void *)he_mon_cmd.bssid;
1728 1837
1729 mutex_lock(&mvm->mutex); 1838 mutex_lock(&mvm->mutex);
1730 1839
@@ -1754,6 +1863,23 @@ iwl_dbgfs_he_sniffer_params_write(struct iwl_mvm *mvm, char *buf,
1754} 1863}
1755 1864
1756static ssize_t 1865static ssize_t
1866iwl_dbgfs_he_sniffer_params_read(struct file *file, char __user *user_buf,
1867 size_t count, loff_t *ppos)
1868{
1869 struct iwl_mvm *mvm = file->private_data;
1870 u8 buf[32];
1871 int len;
1872
1873 len = scnprintf(buf, sizeof(buf),
1874 "%d %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
1875 le16_to_cpu(mvm->cur_aid), mvm->cur_bssid[0],
1876 mvm->cur_bssid[1], mvm->cur_bssid[2], mvm->cur_bssid[3],
1877 mvm->cur_bssid[4], mvm->cur_bssid[5]);
1878
1879 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1880}
1881
1882static ssize_t
1757iwl_dbgfs_uapsd_noagg_bssids_read(struct file *file, char __user *user_buf, 1883iwl_dbgfs_uapsd_noagg_bssids_read(struct file *file, char __user *user_buf,
1758 size_t count, loff_t *ppos) 1884 size_t count, loff_t *ppos)
1759{ 1885{
@@ -1806,6 +1932,8 @@ MVM_DEBUGFS_WRITE_FILE_OPS(max_amsdu_len, 8);
1806MVM_DEBUGFS_WRITE_FILE_OPS(indirection_tbl, 1932MVM_DEBUGFS_WRITE_FILE_OPS(indirection_tbl,
1807 (IWL_RSS_INDIRECTION_TABLE_SIZE * 2)); 1933 (IWL_RSS_INDIRECTION_TABLE_SIZE * 2));
1808MVM_DEBUGFS_WRITE_FILE_OPS(inject_packet, 512); 1934MVM_DEBUGFS_WRITE_FILE_OPS(inject_packet, 512);
1935MVM_DEBUGFS_WRITE_FILE_OPS(inject_beacon_ie, 512);
1936MVM_DEBUGFS_WRITE_FILE_OPS(inject_beacon_ie_restore, 512);
1809 1937
1810MVM_DEBUGFS_READ_FILE_OPS(uapsd_noagg_bssids); 1938MVM_DEBUGFS_READ_FILE_OPS(uapsd_noagg_bssids);
1811 1939
@@ -1821,7 +1949,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(d3_sram, 8);
1821MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile); 1949MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile);
1822#endif 1950#endif
1823 1951
1824MVM_DEBUGFS_WRITE_FILE_OPS(he_sniffer_params, 32); 1952MVM_DEBUGFS_READ_WRITE_FILE_OPS(he_sniffer_params, 32);
1825 1953
1826static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf, 1954static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,
1827 size_t count, loff_t *ppos) 1955 size_t count, loff_t *ppos)
@@ -2007,10 +2135,12 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
2007 MVM_DEBUGFS_ADD_FILE(send_echo_cmd, mvm->debugfs_dir, 0200); 2135 MVM_DEBUGFS_ADD_FILE(send_echo_cmd, mvm->debugfs_dir, 0200);
2008 MVM_DEBUGFS_ADD_FILE(indirection_tbl, mvm->debugfs_dir, 0200); 2136 MVM_DEBUGFS_ADD_FILE(indirection_tbl, mvm->debugfs_dir, 0200);
2009 MVM_DEBUGFS_ADD_FILE(inject_packet, mvm->debugfs_dir, 0200); 2137 MVM_DEBUGFS_ADD_FILE(inject_packet, mvm->debugfs_dir, 0200);
2138 MVM_DEBUGFS_ADD_FILE(inject_beacon_ie, mvm->debugfs_dir, 0200);
2139 MVM_DEBUGFS_ADD_FILE(inject_beacon_ie_restore, mvm->debugfs_dir, 0200);
2010#ifdef CONFIG_ACPI 2140#ifdef CONFIG_ACPI
2011 MVM_DEBUGFS_ADD_FILE(sar_geo_profile, dbgfs_dir, 0400); 2141 MVM_DEBUGFS_ADD_FILE(sar_geo_profile, dbgfs_dir, 0400);
2012#endif 2142#endif
2013 MVM_DEBUGFS_ADD_FILE(he_sniffer_params, mvm->debugfs_dir, 0200); 2143 MVM_DEBUGFS_ADD_FILE(he_sniffer_params, mvm->debugfs_dir, 0600);
2014 2144
2015 if (!debugfs_create_bool("enable_scan_iteration_notif", 2145 if (!debugfs_create_bool("enable_scan_iteration_notif",
2016 0600, 2146 0600,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
new file mode 100644
index 000000000000..e9822a3ec373
--- /dev/null
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
@@ -0,0 +1,654 @@
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
9 * Copyright (C) 2018 Intel Corporation
10 * Copyright (C) 2019 Intel Corporation
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * The full GNU General Public License is included in this distribution
22 * in the file called COPYING.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <linuxwifi@intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *
28 * BSD LICENSE
29 *
30 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
31 * Copyright (C) 2018 Intel Corporation
32 * Copyright (C) 2019 Intel Corporation
33 * All rights reserved.
34 *
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
37 * are met:
38 *
39 * * Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * * Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in
43 * the documentation and/or other materials provided with the
44 * distribution.
45 * * Neither the name Intel Corporation nor the names of its
46 * contributors may be used to endorse or promote products derived
47 * from this software without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 *****************************************************************************/
62#include <linux/etherdevice.h>
63#include <linux/math64.h>
64#include <net/cfg80211.h>
65#include "mvm.h"
66#include "iwl-io.h"
67#include "iwl-prph.h"
68#include "constants.h"
69
70struct iwl_mvm_loc_entry {
71 struct list_head list;
72 u8 addr[ETH_ALEN];
73 u8 lci_len, civic_len;
74 u8 buf[];
75};
76
77static void iwl_mvm_ftm_reset(struct iwl_mvm *mvm)
78{
79 struct iwl_mvm_loc_entry *e, *t;
80
81 mvm->ftm_initiator.req = NULL;
82 mvm->ftm_initiator.req_wdev = NULL;
83 memset(mvm->ftm_initiator.responses, 0,
84 sizeof(mvm->ftm_initiator.responses));
85 list_for_each_entry_safe(e, t, &mvm->ftm_initiator.loc_list, list) {
86 list_del(&e->list);
87 kfree(e);
88 }
89}
90
91void iwl_mvm_ftm_restart(struct iwl_mvm *mvm)
92{
93 struct cfg80211_pmsr_result result = {
94 .status = NL80211_PMSR_STATUS_FAILURE,
95 .final = 1,
96 .host_time = ktime_get_boot_ns(),
97 .type = NL80211_PMSR_TYPE_FTM,
98 };
99 int i;
100
101 lockdep_assert_held(&mvm->mutex);
102
103 if (!mvm->ftm_initiator.req)
104 return;
105
106 for (i = 0; i < mvm->ftm_initiator.req->n_peers; i++) {
107 memcpy(result.addr, mvm->ftm_initiator.req->peers[i].addr,
108 ETH_ALEN);
109 result.ftm.burst_index = mvm->ftm_initiator.responses[i];
110
111 cfg80211_pmsr_report(mvm->ftm_initiator.req_wdev,
112 mvm->ftm_initiator.req,
113 &result, GFP_KERNEL);
114 }
115
116 cfg80211_pmsr_complete(mvm->ftm_initiator.req_wdev,
117 mvm->ftm_initiator.req, GFP_KERNEL);
118 iwl_mvm_ftm_reset(mvm);
119}
120
121static int
122iwl_ftm_range_request_status_to_err(enum iwl_tof_range_request_status s)
123{
124 switch (s) {
125 case IWL_TOF_RANGE_REQUEST_STATUS_SUCCESS:
126 return 0;
127 case IWL_TOF_RANGE_REQUEST_STATUS_BUSY:
128 return -EBUSY;
129 default:
130 WARN_ON_ONCE(1);
131 return -EIO;
132 }
133}
134
135static void iwl_mvm_ftm_cmd_v5(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
136 struct iwl_tof_range_req_cmd_v5 *cmd,
137 struct cfg80211_pmsr_request *req)
138{
139 int i;
140
141 cmd->request_id = req->cookie;
142 cmd->num_of_ap = req->n_peers;
143
144 /* use maximum for "no timeout" or bigger than what we can do */
145 if (!req->timeout || req->timeout > 255 * 100)
146 cmd->req_timeout = 255;
147 else
148 cmd->req_timeout = DIV_ROUND_UP(req->timeout, 100);
149
150 /*
151 * We treat it always as random, since if not we'll
152 * have filled our local address there instead.
153 */
154 cmd->macaddr_random = 1;
155 memcpy(cmd->macaddr_template, req->mac_addr, ETH_ALEN);
156 for (i = 0; i < ETH_ALEN; i++)
157 cmd->macaddr_mask[i] = ~req->mac_addr_mask[i];
158
159 if (vif->bss_conf.assoc)
160 memcpy(cmd->range_req_bssid, vif->bss_conf.bssid, ETH_ALEN);
161 else
162 eth_broadcast_addr(cmd->range_req_bssid);
163}
164
165static void iwl_mvm_ftm_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
166 struct iwl_tof_range_req_cmd *cmd,
167 struct cfg80211_pmsr_request *req)
168{
169 int i;
170
171 cmd->initiator_flags =
172 cpu_to_le32(IWL_TOF_INITIATOR_FLAGS_MACADDR_RANDOM |
173 IWL_TOF_INITIATOR_FLAGS_NON_ASAP_SUPPORT);
174 cmd->request_id = req->cookie;
175 cmd->num_of_ap = req->n_peers;
176
177 /*
178 * Use a large value for "no timeout". Don't use the maximum value
179 * because of fw limitations.
180 */
181 if (req->timeout)
182 cmd->req_timeout_ms = cpu_to_le32(req->timeout);
183 else
184 cmd->req_timeout_ms = cpu_to_le32(0xfffff);
185
186 memcpy(cmd->macaddr_template, req->mac_addr, ETH_ALEN);
187 for (i = 0; i < ETH_ALEN; i++)
188 cmd->macaddr_mask[i] = ~req->mac_addr_mask[i];
189
190 if (vif->bss_conf.assoc)
191 memcpy(cmd->range_req_bssid, vif->bss_conf.bssid, ETH_ALEN);
192 else
193 eth_broadcast_addr(cmd->range_req_bssid);
194
195 /* TODO: fill in tsf_mac_id if needed */
196 cmd->tsf_mac_id = cpu_to_le32(0xff);
197}
198
199static int iwl_mvm_ftm_target_chandef(struct iwl_mvm *mvm,
200 struct cfg80211_pmsr_request_peer *peer,
201 u8 *channel, u8 *bandwidth,
202 u8 *ctrl_ch_position)
203{
204 u32 freq = peer->chandef.chan->center_freq;
205
206 *channel = ieee80211_frequency_to_channel(freq);
207
208 switch (peer->chandef.width) {
209 case NL80211_CHAN_WIDTH_20_NOHT:
210 *bandwidth = IWL_TOF_BW_20_LEGACY;
211 break;
212 case NL80211_CHAN_WIDTH_20:
213 *bandwidth = IWL_TOF_BW_20_HT;
214 break;
215 case NL80211_CHAN_WIDTH_40:
216 *bandwidth = IWL_TOF_BW_40;
217 break;
218 case NL80211_CHAN_WIDTH_80:
219 *bandwidth = IWL_TOF_BW_80;
220 break;
221 default:
222 IWL_ERR(mvm, "Unsupported BW in FTM request (%d)\n",
223 peer->chandef.width);
224 return -EINVAL;
225 }
226
227 *ctrl_ch_position = (peer->chandef.width > NL80211_CHAN_WIDTH_20) ?
228 iwl_mvm_get_ctrl_pos(&peer->chandef) : 0;
229
230 return 0;
231}
232
233static int
234iwl_mvm_ftm_put_target_v2(struct iwl_mvm *mvm,
235 struct cfg80211_pmsr_request_peer *peer,
236 struct iwl_tof_range_req_ap_entry_v2 *target)
237{
238 int ret;
239
240 ret = iwl_mvm_ftm_target_chandef(mvm, peer, &target->channel_num,
241 &target->bandwidth,
242 &target->ctrl_ch_position);
243 if (ret)
244 return ret;
245
246 memcpy(target->bssid, peer->addr, ETH_ALEN);
247 target->burst_period =
248 cpu_to_le16(peer->ftm.burst_period);
249 target->samples_per_burst = peer->ftm.ftms_per_burst;
250 target->num_of_bursts = peer->ftm.num_bursts_exp;
251 target->measure_type = 0; /* regular two-sided FTM */
252 target->retries_per_sample = peer->ftm.ftmr_retries;
253 target->asap_mode = peer->ftm.asap;
254 target->enable_dyn_ack = IWL_MVM_FTM_INITIATOR_DYNACK;
255
256 if (peer->ftm.request_lci)
257 target->location_req |= IWL_TOF_LOC_LCI;
258 if (peer->ftm.request_civicloc)
259 target->location_req |= IWL_TOF_LOC_CIVIC;
260
261 target->algo_type = IWL_MVM_FTM_INITIATOR_ALGO;
262
263 return 0;
264}
265
266#define FTM_PUT_FLAG(flag) (target->initiator_ap_flags |= \
267 cpu_to_le32(IWL_INITIATOR_AP_FLAGS_##flag))
268
269static int iwl_mvm_ftm_put_target(struct iwl_mvm *mvm,
270 struct cfg80211_pmsr_request_peer *peer,
271 struct iwl_tof_range_req_ap_entry *target)
272{
273 int ret;
274
275 ret = iwl_mvm_ftm_target_chandef(mvm, peer, &target->channel_num,
276 &target->bandwidth,
277 &target->ctrl_ch_position);
278 if (ret)
279 return ret;
280
281 memcpy(target->bssid, peer->addr, ETH_ALEN);
282 target->burst_period =
283 cpu_to_le16(peer->ftm.burst_period);
284 target->samples_per_burst = peer->ftm.ftms_per_burst;
285 target->num_of_bursts = peer->ftm.num_bursts_exp;
286 target->ftmr_max_retries = peer->ftm.ftmr_retries;
287 target->initiator_ap_flags = cpu_to_le32(0);
288
289 if (peer->ftm.asap)
290 FTM_PUT_FLAG(ASAP);
291
292 if (peer->ftm.request_lci)
293 FTM_PUT_FLAG(LCI_REQUEST);
294
295 if (peer->ftm.request_civicloc)
296 FTM_PUT_FLAG(CIVIC_REQUEST);
297
298 if (IWL_MVM_FTM_INITIATOR_DYNACK)
299 FTM_PUT_FLAG(DYN_ACK);
300
301 if (IWL_MVM_FTM_INITIATOR_ALGO == IWL_TOF_ALGO_TYPE_LINEAR_REG)
302 FTM_PUT_FLAG(ALGO_LR);
303 else if (IWL_MVM_FTM_INITIATOR_ALGO == IWL_TOF_ALGO_TYPE_FFT)
304 FTM_PUT_FLAG(ALGO_FFT);
305
306 return 0;
307}
308
309int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
310 struct cfg80211_pmsr_request *req)
311{
312 struct iwl_tof_range_req_cmd_v5 cmd_v5;
313 struct iwl_tof_range_req_cmd cmd;
314 bool new_api = fw_has_api(&mvm->fw->ucode_capa,
315 IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ);
316 u8 num_of_ap;
317 struct iwl_host_cmd hcmd = {
318 .id = iwl_cmd_id(TOF_RANGE_REQ_CMD, LOCATION_GROUP, 0),
319 .dataflags[0] = IWL_HCMD_DFL_DUP,
320 };
321 u32 status = 0;
322 int err, i;
323
324 lockdep_assert_held(&mvm->mutex);
325
326 if (mvm->ftm_initiator.req)
327 return -EBUSY;
328
329 if (new_api) {
330 iwl_mvm_ftm_cmd(mvm, vif, &cmd, req);
331 hcmd.data[0] = &cmd;
332 hcmd.len[0] = sizeof(cmd);
333 num_of_ap = cmd.num_of_ap;
334 } else {
335 iwl_mvm_ftm_cmd_v5(mvm, vif, &cmd_v5, req);
336 hcmd.data[0] = &cmd_v5;
337 hcmd.len[0] = sizeof(cmd_v5);
338 num_of_ap = cmd_v5.num_of_ap;
339 }
340
341 for (i = 0; i < num_of_ap; i++) {
342 struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
343
344 if (new_api)
345 err = iwl_mvm_ftm_put_target(mvm, peer, &cmd.ap[i]);
346 else
347 err = iwl_mvm_ftm_put_target_v2(mvm, peer,
348 &cmd_v5.ap[i]);
349
350 if (err)
351 return err;
352 }
353
354 err = iwl_mvm_send_cmd_status(mvm, &hcmd, &status);
355 if (!err && status) {
356 IWL_ERR(mvm, "FTM range request command failure, status: %u\n",
357 status);
358 err = iwl_ftm_range_request_status_to_err(status);
359 }
360
361 if (!err) {
362 mvm->ftm_initiator.req = req;
363 mvm->ftm_initiator.req_wdev = ieee80211_vif_to_wdev(vif);
364 }
365
366 return err;
367}
368
369void iwl_mvm_ftm_abort(struct iwl_mvm *mvm, struct cfg80211_pmsr_request *req)
370{
371 struct iwl_tof_range_abort_cmd cmd = {
372 .request_id = req->cookie,
373 };
374
375 lockdep_assert_held(&mvm->mutex);
376
377 if (req != mvm->ftm_initiator.req)
378 return;
379
380 if (iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(TOF_RANGE_ABORT_CMD,
381 LOCATION_GROUP, 0),
382 0, sizeof(cmd), &cmd))
383 IWL_ERR(mvm, "failed to abort FTM process\n");
384}
385
386static int iwl_mvm_ftm_find_peer(struct cfg80211_pmsr_request *req,
387 const u8 *addr)
388{
389 int i;
390
391 for (i = 0; i < req->n_peers; i++) {
392 struct cfg80211_pmsr_request_peer *peer = &req->peers[i];
393
394 if (ether_addr_equal_unaligned(peer->addr, addr))
395 return i;
396 }
397
398 return -ENOENT;
399}
400
401static u64 iwl_mvm_ftm_get_host_time(struct iwl_mvm *mvm, __le32 fw_gp2_ts)
402{
403 u32 gp2_ts = le32_to_cpu(fw_gp2_ts);
404 u32 curr_gp2, diff;
405 u64 now_from_boot_ns;
406
407 iwl_mvm_get_sync_time(mvm, &curr_gp2, &now_from_boot_ns);
408
409 if (curr_gp2 >= gp2_ts)
410 diff = curr_gp2 - gp2_ts;
411 else
412 diff = curr_gp2 + (U32_MAX - gp2_ts + 1);
413
414 return now_from_boot_ns - (u64)diff * 1000;
415}
416
417static void iwl_mvm_ftm_get_lci_civic(struct iwl_mvm *mvm,
418 struct cfg80211_pmsr_result *res)
419{
420 struct iwl_mvm_loc_entry *entry;
421
422 list_for_each_entry(entry, &mvm->ftm_initiator.loc_list, list) {
423 if (!ether_addr_equal_unaligned(res->addr, entry->addr))
424 continue;
425
426 if (entry->lci_len) {
427 res->ftm.lci_len = entry->lci_len;
428 res->ftm.lci = entry->buf;
429 }
430
431 if (entry->civic_len) {
432 res->ftm.civicloc_len = entry->civic_len;
433 res->ftm.civicloc = entry->buf + entry->lci_len;
434 }
435
436 /* we found the entry we needed */
437 break;
438 }
439}
440
441static int iwl_mvm_ftm_range_resp_valid(struct iwl_mvm *mvm, u8 request_id,
442 u8 num_of_aps)
443{
444 lockdep_assert_held(&mvm->mutex);
445
446 if (request_id != (u8)mvm->ftm_initiator.req->cookie) {
447 IWL_ERR(mvm, "Request ID mismatch, got %u, active %u\n",
448 request_id, (u8)mvm->ftm_initiator.req->cookie);
449 return -EINVAL;
450 }
451
452 if (num_of_aps > mvm->ftm_initiator.req->n_peers) {
453 IWL_ERR(mvm, "FTM range response invalid\n");
454 return -EINVAL;
455 }
456
457 return 0;
458}
459
460static void iwl_mvm_debug_range_resp(struct iwl_mvm *mvm, u8 index,
461 struct cfg80211_pmsr_result *res)
462{
463 s64 rtt_avg = res->ftm.rtt_avg * 100;
464
465 do_div(rtt_avg, 6666);
466
467 IWL_DEBUG_INFO(mvm, "entry %d\n", index);
468 IWL_DEBUG_INFO(mvm, "\tstatus: %d\n", res->status);
469 IWL_DEBUG_INFO(mvm, "\tBSSID: %pM\n", res->addr);
470 IWL_DEBUG_INFO(mvm, "\thost time: %llu\n", res->host_time);
471 IWL_DEBUG_INFO(mvm, "\tburst index: %hhu\n", res->ftm.burst_index);
472 IWL_DEBUG_INFO(mvm, "\tsuccess num: %u\n", res->ftm.num_ftmr_successes);
473 IWL_DEBUG_INFO(mvm, "\trssi: %d\n", res->ftm.rssi_avg);
474 IWL_DEBUG_INFO(mvm, "\trssi spread: %hhu\n", res->ftm.rssi_spread);
475 IWL_DEBUG_INFO(mvm, "\trtt: %lld\n", res->ftm.rtt_avg);
476 IWL_DEBUG_INFO(mvm, "\trtt var: %llu\n", res->ftm.rtt_variance);
477 IWL_DEBUG_INFO(mvm, "\trtt spread: %llu\n", res->ftm.rtt_spread);
478 IWL_DEBUG_INFO(mvm, "\tdistance: %lld\n", rtt_avg);
479}
480
481void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
482{
483 struct iwl_rx_packet *pkt = rxb_addr(rxb);
484 struct iwl_tof_range_rsp_ntfy_v5 *fw_resp_v5 = (void *)pkt->data;
485 struct iwl_tof_range_rsp_ntfy *fw_resp = (void *)pkt->data;
486 int i;
487 bool new_api = fw_has_api(&mvm->fw->ucode_capa,
488 IWL_UCODE_TLV_API_FTM_NEW_RANGE_REQ);
489 u8 num_of_aps, last_in_batch;
490
491 lockdep_assert_held(&mvm->mutex);
492
493 if (!mvm->ftm_initiator.req) {
494 IWL_ERR(mvm, "Got FTM response but have no request?\n");
495 return;
496 }
497
498 if (new_api) {
499 if (iwl_mvm_ftm_range_resp_valid(mvm, fw_resp->request_id,
500 fw_resp->num_of_aps))
501 return;
502
503 num_of_aps = fw_resp->num_of_aps;
504 last_in_batch = fw_resp->last_report;
505 } else {
506 if (iwl_mvm_ftm_range_resp_valid(mvm, fw_resp_v5->request_id,
507 fw_resp_v5->num_of_aps))
508 return;
509
510 num_of_aps = fw_resp_v5->num_of_aps;
511 last_in_batch = fw_resp_v5->last_in_batch;
512 }
513
514 IWL_DEBUG_INFO(mvm, "Range response received\n");
515 IWL_DEBUG_INFO(mvm, "request id: %lld, num of entries: %hhu\n",
516 mvm->ftm_initiator.req->cookie, num_of_aps);
517
518 for (i = 0; i < num_of_aps && i < IWL_MVM_TOF_MAX_APS; i++) {
519 struct cfg80211_pmsr_result result = {};
520 struct iwl_tof_range_rsp_ap_entry_ntfy *fw_ap;
521 int peer_idx;
522
523 if (new_api) {
524 fw_ap = &fw_resp->ap[i];
525 result.final = fw_resp->ap[i].last_burst;
526 } else {
527 /* the first part is the same for old and new APIs */
528 fw_ap = (void *)&fw_resp_v5->ap[i];
529 /*
530 * FIXME: the firmware needs to report this, we don't
531 * even know the number of bursts the responder picked
532 * (if we asked it to)
533 */
534 result.final = 0;
535 }
536
537 peer_idx = iwl_mvm_ftm_find_peer(mvm->ftm_initiator.req,
538 fw_ap->bssid);
539 if (peer_idx < 0) {
540 IWL_WARN(mvm,
541 "Unknown address (%pM, target #%d) in FTM response\n",
542 fw_ap->bssid, i);
543 continue;
544 }
545
546 switch (fw_ap->measure_status) {
547 case IWL_TOF_ENTRY_SUCCESS:
548 result.status = NL80211_PMSR_STATUS_SUCCESS;
549 break;
550 case IWL_TOF_ENTRY_TIMING_MEASURE_TIMEOUT:
551 result.status = NL80211_PMSR_STATUS_TIMEOUT;
552 break;
553 case IWL_TOF_ENTRY_NO_RESPONSE:
554 result.status = NL80211_PMSR_STATUS_FAILURE;
555 result.ftm.failure_reason =
556 NL80211_PMSR_FTM_FAILURE_NO_RESPONSE;
557 break;
558 case IWL_TOF_ENTRY_REQUEST_REJECTED:
559 result.status = NL80211_PMSR_STATUS_FAILURE;
560 result.ftm.failure_reason =
561 NL80211_PMSR_FTM_FAILURE_PEER_BUSY;
562 result.ftm.busy_retry_time = fw_ap->refusal_period;
563 break;
564 default:
565 result.status = NL80211_PMSR_STATUS_FAILURE;
566 result.ftm.failure_reason =
567 NL80211_PMSR_FTM_FAILURE_UNSPECIFIED;
568 break;
569 }
570 memcpy(result.addr, fw_ap->bssid, ETH_ALEN);
571 result.host_time = iwl_mvm_ftm_get_host_time(mvm,
572 fw_ap->timestamp);
573 result.type = NL80211_PMSR_TYPE_FTM;
574 result.ftm.burst_index = mvm->ftm_initiator.responses[peer_idx];
575 mvm->ftm_initiator.responses[peer_idx]++;
576 result.ftm.rssi_avg = fw_ap->rssi;
577 result.ftm.rssi_avg_valid = 1;
578 result.ftm.rssi_spread = fw_ap->rssi_spread;
579 result.ftm.rssi_spread_valid = 1;
580 result.ftm.rtt_avg = (s32)le32_to_cpu(fw_ap->rtt);
581 result.ftm.rtt_avg_valid = 1;
582 result.ftm.rtt_variance = le32_to_cpu(fw_ap->rtt_variance);
583 result.ftm.rtt_variance_valid = 1;
584 result.ftm.rtt_spread = le32_to_cpu(fw_ap->rtt_spread);
585 result.ftm.rtt_spread_valid = 1;
586
587 iwl_mvm_ftm_get_lci_civic(mvm, &result);
588
589 cfg80211_pmsr_report(mvm->ftm_initiator.req_wdev,
590 mvm->ftm_initiator.req,
591 &result, GFP_KERNEL);
592
593 iwl_mvm_debug_range_resp(mvm, i, &result);
594 }
595
596 if (last_in_batch) {
597 cfg80211_pmsr_complete(mvm->ftm_initiator.req_wdev,
598 mvm->ftm_initiator.req,
599 GFP_KERNEL);
600 iwl_mvm_ftm_reset(mvm);
601 }
602}
603
604void iwl_mvm_ftm_lc_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
605{
606 struct iwl_rx_packet *pkt = rxb_addr(rxb);
607 const struct ieee80211_mgmt *mgmt = (void *)pkt->data;
608 size_t len = iwl_rx_packet_payload_len(pkt);
609 struct iwl_mvm_loc_entry *entry;
610 const u8 *ies, *lci, *civic, *msr_ie;
611 size_t ies_len, lci_len = 0, civic_len = 0;
612 size_t baselen = IEEE80211_MIN_ACTION_SIZE +
613 sizeof(mgmt->u.action.u.ftm);
614 static const u8 rprt_type_lci = IEEE80211_SPCT_MSR_RPRT_TYPE_LCI;
615 static const u8 rprt_type_civic = IEEE80211_SPCT_MSR_RPRT_TYPE_CIVIC;
616
617 if (len <= baselen)
618 return;
619
620 lockdep_assert_held(&mvm->mutex);
621
622 ies = mgmt->u.action.u.ftm.variable;
623 ies_len = len - baselen;
624
625 msr_ie = cfg80211_find_ie_match(WLAN_EID_MEASURE_REPORT, ies, ies_len,
626 &rprt_type_lci, 1, 4);
627 if (msr_ie) {
628 lci = msr_ie + 2;
629 lci_len = msr_ie[1];
630 }
631
632 msr_ie = cfg80211_find_ie_match(WLAN_EID_MEASURE_REPORT, ies, ies_len,
633 &rprt_type_civic, 1, 4);
634 if (msr_ie) {
635 civic = msr_ie + 2;
636 civic_len = msr_ie[1];
637 }
638
639 entry = kmalloc(sizeof(*entry) + lci_len + civic_len, GFP_KERNEL);
640 if (!entry)
641 return;
642
643 memcpy(entry->addr, mgmt->bssid, ETH_ALEN);
644
645 entry->lci_len = lci_len;
646 if (lci_len)
647 memcpy(entry->buf, lci, lci_len);
648
649 entry->civic_len = civic_len;
650 if (civic_len)
651 memcpy(entry->buf + lci_len, civic, civic_len);
652
653 list_add_tail(&entry->list, &mvm->ftm_initiator.loc_list);
654}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c
new file mode 100644
index 000000000000..1513b8b4062f
--- /dev/null
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c
@@ -0,0 +1,244 @@
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
9 * Copyright (C) 2018 Intel Corporation
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * The full GNU General Public License is included in this distribution
21 * in the file called COPYING.
22 *
23 * Contact Information:
24 * Intel Linux Wireless <linuxwifi@intel.com>
25 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 *
27 * BSD LICENSE
28 *
29 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
30 * Copyright (C) 2018 Intel Corporation
31 * All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 *
37 * * Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * * Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in
41 * the documentation and/or other materials provided with the
42 * distribution.
43 * * Neither the name Intel Corporation nor the names of its
44 * contributors may be used to endorse or promote products derived
45 * from this software without specific prior written permission.
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
48 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
49 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
50 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
51 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
53 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 *
59 *****************************************************************************/
60#include <net/cfg80211.h>
61#include <linux/etherdevice.h>
62#include "mvm.h"
63#include "constants.h"
64
65static int
66iwl_mvm_ftm_responder_cmd(struct iwl_mvm *mvm,
67 struct ieee80211_vif *vif,
68 struct cfg80211_chan_def *chandef)
69{
70 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
71 struct iwl_tof_responder_config_cmd cmd = {
72 .channel_num = chandef->chan->hw_value,
73 .cmd_valid_fields =
74 cpu_to_le32(IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO |
75 IWL_TOF_RESPONDER_CMD_VALID_BSSID |
76 IWL_TOF_RESPONDER_CMD_VALID_STA_ID),
77 .sta_id = mvmvif->bcast_sta.sta_id,
78 };
79
80 lockdep_assert_held(&mvm->mutex);
81
82 switch (chandef->width) {
83 case NL80211_CHAN_WIDTH_20_NOHT:
84 cmd.bandwidth = IWL_TOF_BW_20_LEGACY;
85 break;
86 case NL80211_CHAN_WIDTH_20:
87 cmd.bandwidth = IWL_TOF_BW_20_HT;
88 break;
89 case NL80211_CHAN_WIDTH_40:
90 cmd.bandwidth = IWL_TOF_BW_40;
91 cmd.ctrl_ch_position = iwl_mvm_get_ctrl_pos(chandef);
92 break;
93 case NL80211_CHAN_WIDTH_80:
94 cmd.bandwidth = IWL_TOF_BW_80;
95 cmd.ctrl_ch_position = iwl_mvm_get_ctrl_pos(chandef);
96 break;
97 default:
98 WARN_ON(1);
99 return -EINVAL;
100 }
101
102 memcpy(cmd.bssid, vif->addr, ETH_ALEN);
103
104 return iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(TOF_RESPONDER_CONFIG_CMD,
105 LOCATION_GROUP, 0),
106 0, sizeof(cmd), &cmd);
107}
108
109static int
110iwl_mvm_ftm_responder_dyn_cfg_cmd(struct iwl_mvm *mvm,
111 struct ieee80211_vif *vif,
112 struct ieee80211_ftm_responder_params *params)
113{
114 struct iwl_tof_responder_dyn_config_cmd cmd = {
115 .lci_len = cpu_to_le32(params->lci_len + 2),
116 .civic_len = cpu_to_le32(params->civicloc_len + 2),
117 };
118 u8 data[IWL_LCI_CIVIC_IE_MAX_SIZE] = {0};
119 struct iwl_host_cmd hcmd = {
120 .id = iwl_cmd_id(TOF_RESPONDER_DYN_CONFIG_CMD,
121 LOCATION_GROUP, 0),
122 .data[0] = &cmd,
123 .len[0] = sizeof(cmd),
124 .data[1] = &data,
125 /* .len[1] set later */
126 /* may not be able to DMA from stack */
127 .dataflags[1] = IWL_HCMD_DFL_DUP,
128 };
129 u32 aligned_lci_len = ALIGN(params->lci_len + 2, 4);
130 u32 aligned_civicloc_len = ALIGN(params->civicloc_len + 2, 4);
131 u8 *pos = data;
132
133 lockdep_assert_held(&mvm->mutex);
134
135 if (aligned_lci_len + aligned_civicloc_len > sizeof(data)) {
136 IWL_ERR(mvm, "LCI/civicloc data too big (%zd + %zd)\n",
137 params->lci_len, params->civicloc_len);
138 return -ENOBUFS;
139 }
140
141 pos[0] = WLAN_EID_MEASURE_REPORT;
142 pos[1] = params->lci_len;
143 memcpy(pos + 2, params->lci, params->lci_len);
144
145 pos += aligned_lci_len;
146 pos[0] = WLAN_EID_MEASURE_REPORT;
147 pos[1] = params->civicloc_len;
148 memcpy(pos + 2, params->civicloc, params->civicloc_len);
149
150 hcmd.len[1] = aligned_lci_len + aligned_civicloc_len;
151
152 return iwl_mvm_send_cmd(mvm, &hcmd);
153}
154
155int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
156{
157 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
158 struct ieee80211_ftm_responder_params *params;
159 struct ieee80211_chanctx_conf ctx, *pctx;
160 u16 *phy_ctxt_id;
161 struct iwl_mvm_phy_ctxt *phy_ctxt;
162 int ret;
163
164 params = vif->bss_conf.ftmr_params;
165
166 lockdep_assert_held(&mvm->mutex);
167
168 if (WARN_ON_ONCE(!vif->bss_conf.ftm_responder))
169 return -EINVAL;
170
171 if (vif->p2p || vif->type != NL80211_IFTYPE_AP ||
172 !mvmvif->ap_ibss_active) {
173 IWL_ERR(mvm, "Cannot start responder, not in AP mode\n");
174 return -EIO;
175 }
176
177 rcu_read_lock();
178 pctx = rcu_dereference(vif->chanctx_conf);
179 /* Copy the ctx to unlock the rcu and send the phy ctxt. We don't care
180 * about changes in the ctx after releasing the lock because the driver
181 * is still protected by the mutex. */
182 ctx = *pctx;
183 phy_ctxt_id = (u16 *)pctx->drv_priv;
184 rcu_read_unlock();
185
186 phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
187 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx.def,
188 ctx.rx_chains_static,
189 ctx.rx_chains_dynamic);
190 if (ret)
191 return ret;
192
193 ret = iwl_mvm_ftm_responder_cmd(mvm, vif, &ctx.def);
194 if (ret)
195 return ret;
196
197 if (params)
198 ret = iwl_mvm_ftm_responder_dyn_cfg_cmd(mvm, vif, params);
199
200 return ret;
201}
202
203void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm,
204 struct ieee80211_vif *vif)
205{
206 if (!vif->bss_conf.ftm_responder)
207 return;
208
209 iwl_mvm_ftm_start_responder(mvm, vif);
210}
211
212void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm,
213 struct iwl_rx_cmd_buffer *rxb)
214{
215 struct iwl_rx_packet *pkt = rxb_addr(rxb);
216 struct iwl_ftm_responder_stats *resp = (void *)pkt->data;
217 struct cfg80211_ftm_responder_stats *stats = &mvm->ftm_resp_stats;
218 u32 flags = le32_to_cpu(resp->flags);
219
220 if (resp->success_ftm == resp->ftm_per_burst)
221 stats->success_num++;
222 else if (resp->success_ftm >= 2)
223 stats->partial_num++;
224 else
225 stats->failed_num++;
226
227 if ((flags & FTM_RESP_STAT_ASAP_REQ) &&
228 (flags & FTM_RESP_STAT_ASAP_RESP))
229 stats->asap_num++;
230
231 if (flags & FTM_RESP_STAT_NON_ASAP_RESP)
232 stats->non_asap_num++;
233
234 stats->total_duration_ms += le32_to_cpu(resp->duration) / USEC_PER_MSEC;
235
236 if (flags & FTM_RESP_STAT_TRIGGER_UNKNOWN)
237 stats->unknown_triggers_num++;
238
239 if (flags & FTM_RESP_STAT_DUP)
240 stats->reschedule_requests_num++;
241
242 if (flags & FTM_RESP_STAT_NON_ASAP_OUT_WIN)
243 stats->out_of_window_triggers_num++;
244}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index d3dc9d276e0f..00a47f6f1d81 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -105,12 +105,12 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
105 int i; 105 int i;
106 struct iwl_rss_config_cmd cmd = { 106 struct iwl_rss_config_cmd cmd = {
107 .flags = cpu_to_le32(IWL_RSS_ENABLE), 107 .flags = cpu_to_le32(IWL_RSS_ENABLE),
108 .hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP | 108 .hash_mask = BIT(IWL_RSS_HASH_TYPE_IPV4_TCP) |
109 IWL_RSS_HASH_TYPE_IPV4_UDP | 109 BIT(IWL_RSS_HASH_TYPE_IPV4_UDP) |
110 IWL_RSS_HASH_TYPE_IPV4_PAYLOAD | 110 BIT(IWL_RSS_HASH_TYPE_IPV4_PAYLOAD) |
111 IWL_RSS_HASH_TYPE_IPV6_TCP | 111 BIT(IWL_RSS_HASH_TYPE_IPV6_TCP) |
112 IWL_RSS_HASH_TYPE_IPV6_UDP | 112 BIT(IWL_RSS_HASH_TYPE_IPV6_UDP) |
113 IWL_RSS_HASH_TYPE_IPV6_PAYLOAD, 113 BIT(IWL_RSS_HASH_TYPE_IPV6_PAYLOAD),
114 }; 114 };
115 115
116 if (mvm->trans->num_rx_queues == 1) 116 if (mvm->trans->num_rx_queues == 1)
@@ -127,13 +127,17 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
127 127
128static int iwl_configure_rxq(struct iwl_mvm *mvm) 128static int iwl_configure_rxq(struct iwl_mvm *mvm)
129{ 129{
130 int i, num_queues, size; 130 int i, num_queues, size, ret;
131 struct iwl_rfh_queue_config *cmd; 131 struct iwl_rfh_queue_config *cmd;
132 struct iwl_host_cmd hcmd = {
133 .id = WIDE_ID(DATA_PATH_GROUP, RFH_QUEUE_CONFIG_CMD),
134 .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
135 };
132 136
133 /* Do not configure default queue, it is configured via context info */ 137 /* Do not configure default queue, it is configured via context info */
134 num_queues = mvm->trans->num_rx_queues - 1; 138 num_queues = mvm->trans->num_rx_queues - 1;
135 139
136 size = sizeof(*cmd) + num_queues * sizeof(struct iwl_rfh_queue_data); 140 size = struct_size(cmd, data, num_queues);
137 141
138 cmd = kzalloc(size, GFP_KERNEL); 142 cmd = kzalloc(size, GFP_KERNEL);
139 if (!cmd) 143 if (!cmd)
@@ -154,10 +158,14 @@ static int iwl_configure_rxq(struct iwl_mvm *mvm)
154 cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid); 158 cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid);
155 } 159 }
156 160
157 return iwl_mvm_send_cmd_pdu(mvm, 161 hcmd.data[0] = cmd;
158 WIDE_ID(DATA_PATH_GROUP, 162 hcmd.len[0] = size;
159 RFH_QUEUE_CONFIG_CMD), 163
160 0, size, cmd); 164 ret = iwl_mvm_send_cmd(mvm, &hcmd);
165
166 kfree(cmd);
167
168 return ret;
161} 169}
162 170
163static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm) 171static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm)
@@ -210,7 +218,7 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
210 struct iwl_lmac_alive *lmac1; 218 struct iwl_lmac_alive *lmac1;
211 struct iwl_lmac_alive *lmac2 = NULL; 219 struct iwl_lmac_alive *lmac2 = NULL;
212 u16 status; 220 u16 status;
213 u32 umac_error_event_table; 221 u32 lmac_error_event_table, umac_error_event_table;
214 222
215 if (iwl_rx_packet_payload_len(pkt) == sizeof(*palive)) { 223 if (iwl_rx_packet_payload_len(pkt) == sizeof(*palive)) {
216 palive = (void *)pkt->data; 224 palive = (void *)pkt->data;
@@ -225,30 +233,35 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
225 status = le16_to_cpu(palive3->status); 233 status = le16_to_cpu(palive3->status);
226 } 234 }
227 235
228 mvm->error_event_table[0] = le32_to_cpu(lmac1->error_event_table_ptr); 236 lmac_error_event_table =
237 le32_to_cpu(lmac1->dbg_ptrs.error_event_table_ptr);
238 iwl_fw_lmac1_set_alive_err_table(mvm->trans, lmac_error_event_table);
239
229 if (lmac2) 240 if (lmac2)
230 mvm->error_event_table[1] = 241 mvm->trans->lmac_error_event_table[1] =
231 le32_to_cpu(lmac2->error_event_table_ptr); 242 le32_to_cpu(lmac2->dbg_ptrs.error_event_table_ptr);
232 mvm->log_event_table = le32_to_cpu(lmac1->log_event_table_ptr);
233 243
234 umac_error_event_table = le32_to_cpu(umac->error_info_addr); 244 umac_error_event_table = le32_to_cpu(umac->dbg_ptrs.error_info_addr);
235 245
236 if (!umac_error_event_table) { 246 if (!umac_error_event_table) {
237 mvm->support_umac_log = false; 247 mvm->support_umac_log = false;
238 } else if (umac_error_event_table >= 248 } else if (umac_error_event_table >=
239 mvm->trans->cfg->min_umac_error_event_table) { 249 mvm->trans->cfg->min_umac_error_event_table) {
240 mvm->support_umac_log = true; 250 mvm->support_umac_log = true;
241 mvm->umac_error_event_table = umac_error_event_table;
242 } else { 251 } else {
243 IWL_ERR(mvm, 252 IWL_ERR(mvm,
244 "Not valid error log pointer 0x%08X for %s uCode\n", 253 "Not valid error log pointer 0x%08X for %s uCode\n",
245 mvm->umac_error_event_table, 254 umac_error_event_table,
246 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ? 255 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ?
247 "Init" : "RT"); 256 "Init" : "RT");
248 mvm->support_umac_log = false; 257 mvm->support_umac_log = false;
249 } 258 }
250 259
251 alive_data->scd_base_addr = le32_to_cpu(lmac1->scd_base_ptr); 260 if (mvm->support_umac_log)
261 iwl_fw_umac_set_alive_err_table(mvm->trans,
262 umac_error_event_table);
263
264 alive_data->scd_base_addr = le32_to_cpu(lmac1->dbg_ptrs.scd_base_ptr);
252 alive_data->valid = status == IWL_ALIVE_STATUS_OK; 265 alive_data->valid = status == IWL_ALIVE_STATUS_OK;
253 266
254 IWL_DEBUG_FW(mvm, 267 IWL_DEBUG_FW(mvm,
@@ -299,7 +312,6 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
299 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img; 312 enum iwl_ucode_type old_type = mvm->fwrt.cur_fw_img;
300 static const u16 alive_cmd[] = { MVM_ALIVE }; 313 static const u16 alive_cmd[] = { MVM_ALIVE };
301 314
302 set_bit(IWL_FWRT_STATUS_WAIT_ALIVE, &mvm->fwrt.status);
303 if (ucode_type == IWL_UCODE_REGULAR && 315 if (ucode_type == IWL_UCODE_REGULAR &&
304 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) && 316 iwl_fw_dbg_conf_usniffer(mvm->fw, FW_DBG_START_FROM_ALIVE) &&
305 !(fw_has_capa(&mvm->fw->ucode_capa, 317 !(fw_has_capa(&mvm->fw->ucode_capa,
@@ -332,11 +344,16 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
332 if (ret) { 344 if (ret) {
333 struct iwl_trans *trans = mvm->trans; 345 struct iwl_trans *trans = mvm->trans;
334 346
347 if (ret == -ETIMEDOUT)
348 iwl_fw_dbg_error_collect(&mvm->fwrt,
349 FW_DBG_TRIGGER_ALIVE_TIMEOUT);
350
335 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000) 351 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000)
336 IWL_ERR(mvm, 352 IWL_ERR(mvm,
337 "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n", 353 "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n",
338 iwl_read_prph(trans, UMAG_SB_CPU_1_STATUS), 354 iwl_read_umac_prph(trans, UMAG_SB_CPU_1_STATUS),
339 iwl_read_prph(trans, UMAG_SB_CPU_2_STATUS)); 355 iwl_read_umac_prph(trans,
356 UMAG_SB_CPU_2_STATUS));
340 else if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_8000) 357 else if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_8000)
341 IWL_ERR(mvm, 358 IWL_ERR(mvm,
342 "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n", 359 "SecBoot CPU1 Status: 0x%x, CPU2 Status: 0x%x\n",
@@ -377,7 +394,6 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
377#ifdef CONFIG_IWLWIFI_DEBUGFS 394#ifdef CONFIG_IWLWIFI_DEBUGFS
378 iwl_fw_set_dbg_rec_on(&mvm->fwrt); 395 iwl_fw_set_dbg_rec_on(&mvm->fwrt);
379#endif 396#endif
380 clear_bit(IWL_FWRT_STATUS_WAIT_ALIVE, &mvm->fwrt.status);
381 397
382 return 0; 398 return 0;
383} 399}
@@ -403,13 +419,15 @@ static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
403 iwl_wait_init_complete, 419 iwl_wait_init_complete,
404 NULL); 420 NULL);
405 421
422 iwl_fw_dbg_apply_point(&mvm->fwrt, IWL_FW_INI_APPLY_EARLY);
423
406 /* Will also start the device */ 424 /* Will also start the device */
407 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); 425 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR);
408 if (ret) { 426 if (ret) {
409 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); 427 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
410 iwl_fw_assert_error_dump(&mvm->fwrt);
411 goto error; 428 goto error;
412 } 429 }
430 iwl_fw_dbg_apply_point(&mvm->fwrt, IWL_FW_INI_APPLY_AFTER_ALIVE);
413 431
414 /* Send init config command to mark that we are sending NVM access 432 /* Send init config command to mark that we are sending NVM access
415 * commands 433 * commands
@@ -628,10 +646,10 @@ static int iwl_mvm_config_ltr(struct iwl_mvm *mvm)
628} 646}
629 647
630#ifdef CONFIG_ACPI 648#ifdef CONFIG_ACPI
631static int iwl_mvm_sar_set_profile(struct iwl_mvm *mvm, 649static inline int iwl_mvm_sar_set_profile(struct iwl_mvm *mvm,
632 union acpi_object *table, 650 union acpi_object *table,
633 struct iwl_mvm_sar_profile *profile, 651 struct iwl_mvm_sar_profile *profile,
634 bool enabled) 652 bool enabled)
635{ 653{
636 int i; 654 int i;
637 655
@@ -962,6 +980,57 @@ int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
962} 980}
963#endif /* CONFIG_ACPI */ 981#endif /* CONFIG_ACPI */
964 982
983void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags)
984{
985 u32 error_log_size = mvm->fw->ucode_capa.error_log_size;
986 int ret;
987 u32 resp;
988
989 struct iwl_fw_error_recovery_cmd recovery_cmd = {
990 .flags = cpu_to_le32(flags),
991 .buf_size = 0,
992 };
993 struct iwl_host_cmd host_cmd = {
994 .id = WIDE_ID(SYSTEM_GROUP, FW_ERROR_RECOVERY_CMD),
995 .flags = CMD_WANT_SKB,
996 .data = {&recovery_cmd, },
997 .len = {sizeof(recovery_cmd), },
998 };
999
1000 /* no error log was defined in TLV */
1001 if (!error_log_size)
1002 return;
1003
1004 if (flags & ERROR_RECOVERY_UPDATE_DB) {
1005 /* no buf was allocated while HW reset */
1006 if (!mvm->error_recovery_buf)
1007 return;
1008
1009 host_cmd.data[1] = mvm->error_recovery_buf;
1010 host_cmd.len[1] = error_log_size;
1011 host_cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY;
1012 recovery_cmd.buf_size = cpu_to_le32(error_log_size);
1013 }
1014
1015 ret = iwl_mvm_send_cmd(mvm, &host_cmd);
1016 kfree(mvm->error_recovery_buf);
1017 mvm->error_recovery_buf = NULL;
1018
1019 if (ret) {
1020 IWL_ERR(mvm, "Failed to send recovery cmd %d\n", ret);
1021 return;
1022 }
1023
1024 /* skb respond is only relevant in ERROR_RECOVERY_UPDATE_DB */
1025 if (flags & ERROR_RECOVERY_UPDATE_DB) {
1026 resp = le32_to_cpu(*(__le32 *)host_cmd.resp_pkt->data);
1027 if (resp)
1028 IWL_ERR(mvm,
1029 "Failed to send recovery cmd blob was invalid %d\n",
1030 resp);
1031 }
1032}
1033
965static int iwl_mvm_sar_init(struct iwl_mvm *mvm) 1034static int iwl_mvm_sar_init(struct iwl_mvm *mvm)
966{ 1035{
967 int ret; 1036 int ret;
@@ -1052,7 +1121,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
1052 ret = iwl_mvm_load_rt_fw(mvm); 1121 ret = iwl_mvm_load_rt_fw(mvm);
1053 if (ret) { 1122 if (ret) {
1054 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); 1123 IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
1055 iwl_fw_assert_error_dump(&mvm->fwrt); 1124 iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER);
1056 goto error; 1125 goto error;
1057 } 1126 }
1058 1127
@@ -1198,6 +1267,12 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
1198 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) 1267 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
1199 iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); 1268 iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN);
1200 1269
1270 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
1271 iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_UPDATE_DB);
1272
1273 if (iwl_acpi_get_eckv(mvm->dev, &mvm->ext_clock_valid))
1274 IWL_DEBUG_INFO(mvm, "ECKV table doesn't exist in BIOS\n");
1275
1201 ret = iwl_mvm_sar_init(mvm); 1276 ret = iwl_mvm_sar_init(mvm);
1202 if (ret == 0) { 1277 if (ret == 0) {
1203 ret = iwl_mvm_sar_geo_init(mvm); 1278 ret = iwl_mvm_sar_geo_init(mvm);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/led.c b/drivers/net/wireless/intel/iwlwifi/mvm/led.c
index 9bb1de1cad64..4348bb00e761 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/led.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/led.c
@@ -7,6 +7,7 @@
7 * 7 *
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2017 Intel Deutschland GmbH 9 * Copyright(c) 2017 Intel Deutschland GmbH
10 * Copyright(c) 2018 Intel Corporation
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as 13 * it under the terms of version 2 of the GNU General Public License as
@@ -28,6 +29,7 @@
28 * 29 *
29 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 30 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
30 * Copyright(c) 2017 Intel Deutschland GmbH 31 * Copyright(c) 2017 Intel Deutschland GmbH
32 * Copyright(c) 2018 Intel Corporation
31 * All rights reserved. 33 * All rights reserved.
32 * 34 *
33 * Redistribution and use in source and binary forms, with or without 35 * Redistribution and use in source and binary forms, with or without
@@ -113,6 +115,7 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm)
113 switch (mode) { 115 switch (mode) {
114 case IWL_LED_BLINK: 116 case IWL_LED_BLINK:
115 IWL_ERR(mvm, "Blink led mode not supported, used default\n"); 117 IWL_ERR(mvm, "Blink led mode not supported, used default\n");
118 /* fall through */
116 case IWL_LED_DEFAULT: 119 case IWL_LED_DEFAULT:
117 case IWL_LED_RF_STATE: 120 case IWL_LED_RF_STATE:
118 mode = IWL_LED_RF_STATE; 121 mode = IWL_LED_RF_STATE;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index 7cfdd07d8736..6a70dece447d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -706,8 +706,7 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
706 if (vif->probe_req_reg && vif->bss_conf.assoc && vif->p2p) 706 if (vif->probe_req_reg && vif->bss_conf.assoc && vif->p2p)
707 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST); 707 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST);
708 708
709 if (vif->bss_conf.assoc && vif->bss_conf.he_support && 709 if (vif->bss_conf.he_support && !iwlwifi_mod_params.disable_11ax) {
710 !iwlwifi_mod_params.disable_11ax) {
711 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_11AX); 710 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_11AX);
712 if (vif->bss_conf.twt_requester) 711 if (vif->bss_conf.twt_requester)
713 ctxt_sta->data_policy |= cpu_to_le32(TWT_SUPPORTED); 712 ctxt_sta->data_policy |= cpu_to_le32(TWT_SUPPORTED);
@@ -812,9 +811,9 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_device(struct iwl_mvm *mvm,
812 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 811 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
813} 812}
814 813
815static void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, 814void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm,
816 __le32 *tim_index, __le32 *tim_size, 815 __le32 *tim_index, __le32 *tim_size,
817 u8 *beacon, u32 frame_size) 816 u8 *beacon, u32 frame_size)
818{ 817{
819 u32 tim_idx; 818 u32 tim_idx;
820 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon; 819 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon;
@@ -854,8 +853,8 @@ static u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size)
854 return ie - beacon; 853 return ie - beacon;
855} 854}
856 855
857static u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct ieee80211_tx_info *info, 856u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct ieee80211_tx_info *info,
858 struct ieee80211_vif *vif) 857 struct ieee80211_vif *vif)
859{ 858{
860 u8 rate; 859 u8 rate;
861 860
@@ -905,9 +904,9 @@ static void iwl_mvm_mac_ctxt_set_tx(struct iwl_mvm *mvm,
905 904
906} 905}
907 906
908static int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm, 907int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm,
909 struct sk_buff *beacon, 908 struct sk_buff *beacon,
910 void *data, int len) 909 void *data, int len)
911{ 910{
912 struct iwl_host_cmd cmd = { 911 struct iwl_host_cmd cmd = {
913 .id = BEACON_TEMPLATE_CMD, 912 .id = BEACON_TEMPLATE_CMD,
@@ -1010,13 +1009,16 @@ static int iwl_mvm_mac_ctxt_send_beacon_v9(struct iwl_mvm *mvm,
1010 sizeof(beacon_cmd)); 1009 sizeof(beacon_cmd));
1011} 1010}
1012 1011
1013static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, 1012int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
1014 struct ieee80211_vif *vif, 1013 struct ieee80211_vif *vif,
1015 struct sk_buff *beacon) 1014 struct sk_buff *beacon)
1016{ 1015{
1017 if (WARN_ON(!beacon)) 1016 if (WARN_ON(!beacon))
1018 return -EINVAL; 1017 return -EINVAL;
1019 1018
1019 if (IWL_MVM_NON_TRANSMITTING_AP)
1020 return 0;
1021
1020 if (!fw_has_capa(&mvm->fw->ucode_capa, 1022 if (!fw_has_capa(&mvm->fw->ucode_capa,
1021 IWL_UCODE_TLV_CAPA_CSA_AND_TBTT_OFFLOAD)) 1023 IWL_UCODE_TLV_CAPA_CSA_AND_TBTT_OFFLOAD))
1022 return iwl_mvm_mac_ctxt_send_beacon_v6(mvm, vif, beacon); 1024 return iwl_mvm_mac_ctxt_send_beacon_v6(mvm, vif, beacon);
@@ -1042,6 +1044,11 @@ int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
1042 if (!beacon) 1044 if (!beacon)
1043 return -ENOMEM; 1045 return -ENOMEM;
1044 1046
1047#ifdef CONFIG_IWLWIFI_DEBUGFS
1048 if (mvm->beacon_inject_active)
1049 return -EBUSY;
1050#endif
1051
1045 ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon); 1052 ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon);
1046 dev_kfree_skb(beacon); 1053 dev_kfree_skb(beacon);
1047 return ret; 1054 return ret;
@@ -1330,7 +1337,7 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
1330{ 1337{
1331 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1338 struct iwl_rx_packet *pkt = rxb_addr(rxb);
1332 struct iwl_extended_beacon_notif *beacon = (void *)pkt->data; 1339 struct iwl_extended_beacon_notif *beacon = (void *)pkt->data;
1333 struct iwl_mvm_tx_resp *beacon_notify_hdr; 1340 struct iwl_extended_beacon_notif_v5 *beacon_v5 = (void *)pkt->data;
1334 struct ieee80211_vif *csa_vif; 1341 struct ieee80211_vif *csa_vif;
1335 struct ieee80211_vif *tx_blocked_vif; 1342 struct ieee80211_vif *tx_blocked_vif;
1336 struct agg_tx_status *agg_status; 1343 struct agg_tx_status *agg_status;
@@ -1338,18 +1345,29 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
1338 1345
1339 lockdep_assert_held(&mvm->mutex); 1346 lockdep_assert_held(&mvm->mutex);
1340 1347
1341 beacon_notify_hdr = &beacon->beacon_notify_hdr;
1342 mvm->ap_last_beacon_gp2 = le32_to_cpu(beacon->gp2); 1348 mvm->ap_last_beacon_gp2 = le32_to_cpu(beacon->gp2);
1343 mvm->ibss_manager = beacon->ibss_mgr_status != 0;
1344 1349
1345 agg_status = iwl_mvm_get_agg_status(mvm, beacon_notify_hdr); 1350 if (!iwl_mvm_is_short_beacon_notif_supported(mvm)) {
1346 status = le16_to_cpu(agg_status->status) & TX_STATUS_MSK; 1351 struct iwl_mvm_tx_resp *beacon_notify_hdr =
1347 IWL_DEBUG_RX(mvm, 1352 &beacon_v5->beacon_notify_hdr;
1348 "beacon status %#x retries:%d tsf:0x%016llX gp2:0x%X rate:%d\n", 1353
1349 status, beacon_notify_hdr->failure_frame, 1354 mvm->ibss_manager = beacon_v5->ibss_mgr_status != 0;
1350 le64_to_cpu(beacon->tsf), 1355 agg_status = iwl_mvm_get_agg_status(mvm, beacon_notify_hdr);
1351 mvm->ap_last_beacon_gp2, 1356 status = le16_to_cpu(agg_status->status) & TX_STATUS_MSK;
1352 le32_to_cpu(beacon_notify_hdr->initial_rate)); 1357 IWL_DEBUG_RX(mvm,
1358 "beacon status %#x retries:%d tsf:0x%016llX gp2:0x%X rate:%d\n",
1359 status, beacon_notify_hdr->failure_frame,
1360 le64_to_cpu(beacon->tsf),
1361 mvm->ap_last_beacon_gp2,
1362 le32_to_cpu(beacon_notify_hdr->initial_rate));
1363 } else {
1364 mvm->ibss_manager = beacon->ibss_mgr_status != 0;
1365 status = le32_to_cpu(beacon->status) & TX_STATUS_MSK;
1366 IWL_DEBUG_RX(mvm,
1367 "beacon status %#x tsf:0x%016llX gp2:0x%X\n",
1368 status, le64_to_cpu(beacon->tsf),
1369 mvm->ap_last_beacon_gp2);
1370 }
1353 1371
1354 csa_vif = rcu_dereference_protected(mvm->csa_vif, 1372 csa_vif = rcu_dereference_protected(mvm->csa_vif,
1355 lockdep_is_held(&mvm->mutex)); 1373 lockdep_is_held(&mvm->mutex));
@@ -1539,42 +1557,58 @@ void iwl_mvm_channel_switch_noa_notif(struct iwl_mvm *mvm,
1539{ 1557{
1540 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1558 struct iwl_rx_packet *pkt = rxb_addr(rxb);
1541 struct iwl_channel_switch_noa_notif *notif = (void *)pkt->data; 1559 struct iwl_channel_switch_noa_notif *notif = (void *)pkt->data;
1542 struct ieee80211_vif *csa_vif; 1560 struct ieee80211_vif *csa_vif, *vif;
1543 struct iwl_mvm_vif *mvmvif; 1561 struct iwl_mvm_vif *mvmvif;
1544 int len = iwl_rx_packet_payload_len(pkt); 1562 int len = iwl_rx_packet_payload_len(pkt);
1545 u32 id_n_color; 1563 u32 id_n_color, csa_id, mac_id;
1546 1564
1547 if (WARN_ON_ONCE(len < sizeof(*notif))) 1565 if (WARN_ON_ONCE(len < sizeof(*notif)))
1548 return; 1566 return;
1549 1567
1550 rcu_read_lock();
1551
1552 csa_vif = rcu_dereference(mvm->csa_vif);
1553 if (WARN_ON(!csa_vif || !csa_vif->csa_active))
1554 goto out_unlock;
1555
1556 id_n_color = le32_to_cpu(notif->id_and_color); 1568 id_n_color = le32_to_cpu(notif->id_and_color);
1569 mac_id = id_n_color & FW_CTXT_ID_MSK;
1557 1570
1558 mvmvif = iwl_mvm_vif_from_mac80211(csa_vif); 1571 if (WARN_ON_ONCE(mac_id >= NUM_MAC_INDEX_DRIVER))
1559 if (WARN(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color) != id_n_color, 1572 return;
1560 "channel switch noa notification on unexpected vif (csa_vif=%d, notif=%d)",
1561 FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color), id_n_color))
1562 goto out_unlock;
1563 1573
1564 IWL_DEBUG_INFO(mvm, "Channel Switch Started Notification\n"); 1574 rcu_read_lock();
1575 vif = rcu_dereference(mvm->vif_id_to_mac[mac_id]);
1565 1576
1566 schedule_delayed_work(&mvm->cs_tx_unblock_dwork, 1577 switch (vif->type) {
1567 msecs_to_jiffies(IWL_MVM_CS_UNBLOCK_TX_TIMEOUT * 1578 case NL80211_IFTYPE_AP:
1568 csa_vif->bss_conf.beacon_int)); 1579 csa_vif = rcu_dereference(mvm->csa_vif);
1580 if (WARN_ON(!csa_vif || !csa_vif->csa_active ||
1581 csa_vif != vif))
1582 goto out_unlock;
1569 1583
1570 ieee80211_csa_finish(csa_vif); 1584 mvmvif = iwl_mvm_vif_from_mac80211(csa_vif);
1585 csa_id = FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color);
1586 if (WARN(csa_id != id_n_color,
1587 "channel switch noa notification on unexpected vif (csa_vif=%d, notif=%d)",
1588 csa_id, id_n_color))
1589 goto out_unlock;
1571 1590
1572 rcu_read_unlock(); 1591 IWL_DEBUG_INFO(mvm, "Channel Switch Started Notification\n");
1573 1592
1574 RCU_INIT_POINTER(mvm->csa_vif, NULL); 1593 schedule_delayed_work(&mvm->cs_tx_unblock_dwork,
1594 msecs_to_jiffies(IWL_MVM_CS_UNBLOCK_TX_TIMEOUT *
1595 csa_vif->bss_conf.beacon_int));
1575 1596
1576 return; 1597 ieee80211_csa_finish(csa_vif);
1577 1598
1599 rcu_read_unlock();
1600
1601 RCU_INIT_POINTER(mvm->csa_vif, NULL);
1602 return;
1603 case NL80211_IFTYPE_STATION:
1604 iwl_mvm_csa_client_absent(mvm, vif);
1605 ieee80211_chswitch_done(vif, true);
1606 break;
1607 default:
1608 /* should never happen */
1609 WARN_ON_ONCE(1);
1610 break;
1611 }
1578out_unlock: 1612out_unlock:
1579 rcu_read_unlock(); 1613 rcu_read_unlock();
1580} 1614}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index e098884dd915..3a92c09d4692 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -184,6 +184,29 @@ static const struct iwl_fw_bcast_filter iwl_mvm_default_bcast_filters[] = {
184}; 184};
185#endif 185#endif
186 186
187static const struct cfg80211_pmsr_capabilities iwl_mvm_pmsr_capa = {
188 .max_peers = IWL_MVM_TOF_MAX_APS,
189 .report_ap_tsf = 1,
190 .randomize_mac_addr = 1,
191
192 .ftm = {
193 .supported = 1,
194 .asap = 1,
195 .non_asap = 1,
196 .request_lci = 1,
197 .request_civicloc = 1,
198 .max_bursts_exponent = -1, /* all supported */
199 .max_ftms_per_burst = 0, /* no limits */
200 .bandwidths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
201 BIT(NL80211_CHAN_WIDTH_20) |
202 BIT(NL80211_CHAN_WIDTH_40) |
203 BIT(NL80211_CHAN_WIDTH_80),
204 .preambles = BIT(NL80211_PREAMBLE_LEGACY) |
205 BIT(NL80211_PREAMBLE_HT) |
206 BIT(NL80211_PREAMBLE_VHT),
207 },
208};
209
187void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type) 210void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type)
188{ 211{
189 if (!iwl_mvm_is_d0i3_supported(mvm)) 212 if (!iwl_mvm_is_d0i3_supported(mvm))
@@ -420,6 +443,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
420 WLAN_CIPHER_SUITE_TKIP, 443 WLAN_CIPHER_SUITE_TKIP,
421 WLAN_CIPHER_SUITE_CCMP, 444 WLAN_CIPHER_SUITE_CCMP,
422 }; 445 };
446#ifdef CONFIG_PM_SLEEP
447 bool unified = fw_has_capa(&mvm->fw->ucode_capa,
448 IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
449#endif
423 450
424 /* Tell mac80211 our characteristics */ 451 /* Tell mac80211 our characteristics */
425 ieee80211_hw_set(hw, SIGNAL_DBM); 452 ieee80211_hw_set(hw, SIGNAL_DBM);
@@ -544,6 +571,13 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
544 hw->wiphy->n_cipher_suites++; 571 hw->wiphy->n_cipher_suites++;
545 } 572 }
546 573
574 if (fw_has_capa(&mvm->fw->ucode_capa,
575 IWL_UCODE_TLV_CAPA_FTM_CALIBRATED)) {
576 wiphy_ext_feature_set(hw->wiphy,
577 NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
578 hw->wiphy->pmsr_capa = &iwl_mvm_pmsr_capa;
579 }
580
547 ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS); 581 ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
548 hw->wiphy->features |= 582 hw->wiphy->features |=
549 NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR | 583 NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
@@ -709,7 +743,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
709 hw->wiphy->wowlan = &mvm->wowlan; 743 hw->wiphy->wowlan = &mvm->wowlan;
710 } 744 }
711 745
712 if (mvm->fw->img[IWL_UCODE_WOWLAN].num_sec && 746 if ((unified || mvm->fw->img[IWL_UCODE_WOWLAN].num_sec) &&
713 mvm->trans->ops->d3_suspend && 747 mvm->trans->ops->d3_suspend &&
714 mvm->trans->ops->d3_resume && 748 mvm->trans->ops->d3_resume &&
715 device_can_wakeup(mvm->trans->dev)) { 749 device_can_wakeup(mvm->trans->dev)) {
@@ -762,15 +796,15 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
762 hw->netdev_features |= IWL_TX_CSUM_NETIF_FLAGS; 796 hw->netdev_features |= IWL_TX_CSUM_NETIF_FLAGS;
763 } 797 }
764 798
765 ret = ieee80211_register_hw(mvm->hw);
766 if (ret)
767 iwl_mvm_leds_exit(mvm);
768 mvm->init_status |= IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE;
769
770 if (mvm->cfg->vht_mu_mimo_supported) 799 if (mvm->cfg->vht_mu_mimo_supported)
771 wiphy_ext_feature_set(hw->wiphy, 800 wiphy_ext_feature_set(hw->wiphy,
772 NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER); 801 NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER);
773 802
803 ret = ieee80211_register_hw(mvm->hw);
804 if (ret) {
805 iwl_mvm_leds_exit(mvm);
806 }
807
774 return ret; 808 return ret;
775} 809}
776 810
@@ -907,8 +941,14 @@ void iwl_mvm_mac_itxq_xmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
907 IWL_PLAT_PM_MODE_DISABLED))) { 941 IWL_PLAT_PM_MODE_DISABLED))) {
908 skb = ieee80211_tx_dequeue(hw, txq); 942 skb = ieee80211_tx_dequeue(hw, txq);
909 943
910 if (!skb) 944 if (!skb) {
945 if (txq->sta)
946 IWL_DEBUG_TX(mvm,
947 "TXQ of sta %pM tid %d is now empty\n",
948 txq->sta->addr,
949 txq->tid);
911 break; 950 break;
951 }
912 952
913 if (!txq->sta) 953 if (!txq->sta)
914 iwl_mvm_tx_skb_non_sta(mvm, skb); 954 iwl_mvm_tx_skb_non_sta(mvm, skb);
@@ -1177,6 +1217,8 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
1177 iwl_mvm_cleanup_roc_te(mvm); 1217 iwl_mvm_cleanup_roc_te(mvm);
1178 ieee80211_remain_on_channel_expired(mvm->hw); 1218 ieee80211_remain_on_channel_expired(mvm->hw);
1179 1219
1220 iwl_mvm_ftm_restart(mvm);
1221
1180 /* 1222 /*
1181 * cleanup all interfaces, even inactive ones, as some might have 1223 * cleanup all interfaces, even inactive ones, as some might have
1182 * gone down during the HW restart 1224 * gone down during the HW restart
@@ -1290,6 +1332,8 @@ static void iwl_mvm_restart_complete(struct iwl_mvm *mvm)
1290 /* allow transport/FW low power modes */ 1332 /* allow transport/FW low power modes */
1291 iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN); 1333 iwl_mvm_unref(mvm, IWL_MVM_REF_UCODE_DOWN);
1292 1334
1335 iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_END_OF_RECOVERY);
1336
1293 /* 1337 /*
1294 * If we have TDLS peers, remove them. We don't know the last seqno/PN 1338 * If we have TDLS peers, remove them. We don't know the last seqno/PN
1295 * of packets the FW sent out, so we must reconnect. 1339 * of packets the FW sent out, so we must reconnect.
@@ -1653,6 +1697,9 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
1653 IEEE80211_VIF_SUPPORTS_CQM_RSSI); 1697 IEEE80211_VIF_SUPPORTS_CQM_RSSI);
1654 } 1698 }
1655 1699
1700 if (vif->bss_conf.ftm_responder)
1701 memset(&mvm->ftm_resp_stats, 0, sizeof(mvm->ftm_resp_stats));
1702
1656 iwl_mvm_vif_dbgfs_clean(mvm, vif); 1703 iwl_mvm_vif_dbgfs_clean(mvm, vif);
1657 1704
1658 /* 1705 /*
@@ -2363,7 +2410,10 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
2363 * If update fails - SF might be running in associated 2410 * If update fails - SF might be running in associated
2364 * mode while disassociated - which is forbidden. 2411 * mode while disassociated - which is forbidden.
2365 */ 2412 */
2366 WARN_ONCE(iwl_mvm_sf_update(mvm, vif, false), 2413 ret = iwl_mvm_sf_update(mvm, vif, false);
2414 WARN_ONCE(ret &&
2415 !test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
2416 &mvm->status),
2367 "Failed to update SF upon disassociation\n"); 2417 "Failed to update SF upon disassociation\n");
2368 2418
2369 /* 2419 /*
@@ -2584,6 +2634,8 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
2584 if (iwl_mvm_phy_ctx_count(mvm) > 1) 2634 if (iwl_mvm_phy_ctx_count(mvm) > 1)
2585 iwl_mvm_teardown_tdls_peers(mvm); 2635 iwl_mvm_teardown_tdls_peers(mvm);
2586 2636
2637 iwl_mvm_ftm_restart_responder(mvm, vif);
2638
2587 goto out_unlock; 2639 goto out_unlock;
2588 2640
2589out_quota_failed: 2641out_quota_failed:
@@ -2695,6 +2747,15 @@ iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm,
2695 bss_conf->txpower); 2747 bss_conf->txpower);
2696 iwl_mvm_set_tx_power(mvm, vif, bss_conf->txpower); 2748 iwl_mvm_set_tx_power(mvm, vif, bss_conf->txpower);
2697 } 2749 }
2750
2751 if (changes & BSS_CHANGED_FTM_RESPONDER) {
2752 int ret = iwl_mvm_ftm_start_responder(mvm, vif);
2753
2754 if (ret)
2755 IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n",
2756 ret);
2757 }
2758
2698} 2759}
2699 2760
2700static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, 2761static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
@@ -3106,11 +3167,15 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3106 } else if (old_state == IEEE80211_STA_AUTH && 3167 } else if (old_state == IEEE80211_STA_AUTH &&
3107 new_state == IEEE80211_STA_ASSOC) { 3168 new_state == IEEE80211_STA_ASSOC) {
3108 if (vif->type == NL80211_IFTYPE_AP) { 3169 if (vif->type == NL80211_IFTYPE_AP) {
3170 vif->bss_conf.he_support = sta->he_cap.has_he;
3109 mvmvif->ap_assoc_sta_count++; 3171 mvmvif->ap_assoc_sta_count++;
3110 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); 3172 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
3111 if (vif->bss_conf.he_support && 3173 if (vif->bss_conf.he_support &&
3112 !iwlwifi_mod_params.disable_11ax) 3174 !iwlwifi_mod_params.disable_11ax)
3113 iwl_mvm_cfg_he_sta(mvm, vif, mvm_sta->sta_id); 3175 iwl_mvm_cfg_he_sta(mvm, vif, mvm_sta->sta_id);
3176 } else if (vif->type == NL80211_IFTYPE_STATION) {
3177 vif->bss_conf.he_support = sta->he_cap.has_he;
3178 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
3114 } 3179 }
3115 3180
3116 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, 3181 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band,
@@ -3118,6 +3183,24 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3118 ret = iwl_mvm_update_sta(mvm, vif, sta); 3183 ret = iwl_mvm_update_sta(mvm, vif, sta);
3119 } else if (old_state == IEEE80211_STA_ASSOC && 3184 } else if (old_state == IEEE80211_STA_ASSOC &&
3120 new_state == IEEE80211_STA_AUTHORIZED) { 3185 new_state == IEEE80211_STA_AUTHORIZED) {
3186 /* if wep is used, need to set the key for the station now */
3187 if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) {
3188 mvm_sta->wep_key =
3189 kmemdup(mvmvif->ap_wep_key,
3190 sizeof(*mvmvif->ap_wep_key) +
3191 mvmvif->ap_wep_key->keylen,
3192 GFP_KERNEL);
3193 if (!mvm_sta->wep_key) {
3194 ret = -ENOMEM;
3195 goto out_unlock;
3196 }
3197
3198 ret = iwl_mvm_set_sta_key(mvm, vif, sta,
3199 mvm_sta->wep_key,
3200 STA_KEY_IDX_INVALID);
3201 } else {
3202 ret = 0;
3203 }
3121 3204
3122 /* we don't support TDLS during DCM */ 3205 /* we don't support TDLS during DCM */
3123 if (iwl_mvm_phy_ctx_count(mvm) > 1) 3206 if (iwl_mvm_phy_ctx_count(mvm) > 1)
@@ -3132,18 +3215,13 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3132 3215
3133 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, 3216 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band,
3134 true); 3217 true);
3135
3136 /* if wep is used, need to set the key for the station now */
3137 if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key)
3138 ret = iwl_mvm_set_sta_key(mvm, vif, sta,
3139 mvmvif->ap_wep_key,
3140 STA_KEY_IDX_INVALID);
3141 else
3142 ret = 0;
3143 } else if (old_state == IEEE80211_STA_AUTHORIZED && 3218 } else if (old_state == IEEE80211_STA_AUTHORIZED &&
3144 new_state == IEEE80211_STA_ASSOC) { 3219 new_state == IEEE80211_STA_ASSOC) {
3145 /* disable beacon filtering */ 3220 /* disable beacon filtering */
3146 WARN_ON(iwl_mvm_disable_beacon_filter(mvm, vif, 0)); 3221 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0);
3222 WARN_ON(ret &&
3223 !test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
3224 &mvm->status));
3147 ret = 0; 3225 ret = 0;
3148 } else if (old_state == IEEE80211_STA_ASSOC && 3226 } else if (old_state == IEEE80211_STA_ASSOC &&
3149 new_state == IEEE80211_STA_AUTH) { 3227 new_state == IEEE80211_STA_AUTH) {
@@ -3167,12 +3245,18 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3167 /* Remove STA key if this is an AP using WEP */ 3245 /* Remove STA key if this is an AP using WEP */
3168 if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) { 3246 if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) {
3169 int rm_ret = iwl_mvm_remove_sta_key(mvm, vif, sta, 3247 int rm_ret = iwl_mvm_remove_sta_key(mvm, vif, sta,
3170 mvmvif->ap_wep_key); 3248 mvm_sta->wep_key);
3171 3249
3172 if (!ret) 3250 if (!ret)
3173 ret = rm_ret; 3251 ret = rm_ret;
3252 kfree(mvm_sta->wep_key);
3253 mvm_sta->wep_key = NULL;
3174 } 3254 }
3175 3255
3256 if (unlikely(ret &&
3257 test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
3258 &mvm->status)))
3259 ret = 0;
3176 } else { 3260 } else {
3177 ret = -EIO; 3261 ret = -EIO;
3178 } 3262 }
@@ -3816,11 +3900,43 @@ static int iwl_mvm_cancel_roc(struct ieee80211_hw *hw)
3816 return 0; 3900 return 0;
3817} 3901}
3818 3902
3903struct iwl_mvm_ftm_responder_iter_data {
3904 bool responder;
3905 struct ieee80211_chanctx_conf *ctx;
3906};
3907
3908static void iwl_mvm_ftm_responder_chanctx_iter(void *_data, u8 *mac,
3909 struct ieee80211_vif *vif)
3910{
3911 struct iwl_mvm_ftm_responder_iter_data *data = _data;
3912
3913 if (rcu_access_pointer(vif->chanctx_conf) == data->ctx &&
3914 vif->type == NL80211_IFTYPE_AP && vif->bss_conf.ftmr_params)
3915 data->responder = true;
3916}
3917
3918static bool iwl_mvm_is_ftm_responder_chanctx(struct iwl_mvm *mvm,
3919 struct ieee80211_chanctx_conf *ctx)
3920{
3921 struct iwl_mvm_ftm_responder_iter_data data = {
3922 .responder = false,
3923 .ctx = ctx,
3924 };
3925
3926 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
3927 IEEE80211_IFACE_ITER_NORMAL,
3928 iwl_mvm_ftm_responder_chanctx_iter,
3929 &data);
3930 return data.responder;
3931}
3932
3819static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm, 3933static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm,
3820 struct ieee80211_chanctx_conf *ctx) 3934 struct ieee80211_chanctx_conf *ctx)
3821{ 3935{
3822 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; 3936 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
3823 struct iwl_mvm_phy_ctxt *phy_ctxt; 3937 struct iwl_mvm_phy_ctxt *phy_ctxt;
3938 bool responder = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx);
3939 struct cfg80211_chan_def *def = responder ? &ctx->def : &ctx->min_def;
3824 int ret; 3940 int ret;
3825 3941
3826 lockdep_assert_held(&mvm->mutex); 3942 lockdep_assert_held(&mvm->mutex);
@@ -3833,7 +3949,7 @@ static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm,
3833 goto out; 3949 goto out;
3834 } 3950 }
3835 3951
3836 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->min_def, 3952 ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def,
3837 ctx->rx_chains_static, 3953 ctx->rx_chains_static,
3838 ctx->rx_chains_dynamic); 3954 ctx->rx_chains_dynamic);
3839 if (ret) { 3955 if (ret) {
@@ -3888,6 +4004,8 @@ static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
3888 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 4004 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3889 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; 4005 u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
3890 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; 4006 struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
4007 bool responder = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx);
4008 struct cfg80211_chan_def *def = responder ? &ctx->def : &ctx->min_def;
3891 4009
3892 if (WARN_ONCE((phy_ctxt->ref > 1) && 4010 if (WARN_ONCE((phy_ctxt->ref > 1) &&
3893 (changed & ~(IEEE80211_CHANCTX_CHANGE_WIDTH | 4011 (changed & ~(IEEE80211_CHANCTX_CHANGE_WIDTH |
@@ -3902,17 +4020,17 @@ static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
3902 4020
3903 /* we are only changing the min_width, may be a noop */ 4021 /* we are only changing the min_width, may be a noop */
3904 if (changed == IEEE80211_CHANCTX_CHANGE_MIN_WIDTH) { 4022 if (changed == IEEE80211_CHANCTX_CHANGE_MIN_WIDTH) {
3905 if (phy_ctxt->width == ctx->min_def.width) 4023 if (phy_ctxt->width == def->width)
3906 goto out_unlock; 4024 goto out_unlock;
3907 4025
3908 /* we are just toggling between 20_NOHT and 20 */ 4026 /* we are just toggling between 20_NOHT and 20 */
3909 if (phy_ctxt->width <= NL80211_CHAN_WIDTH_20 && 4027 if (phy_ctxt->width <= NL80211_CHAN_WIDTH_20 &&
3910 ctx->min_def.width <= NL80211_CHAN_WIDTH_20) 4028 def->width <= NL80211_CHAN_WIDTH_20)
3911 goto out_unlock; 4029 goto out_unlock;
3912 } 4030 }
3913 4031
3914 iwl_mvm_bt_coex_vif_change(mvm); 4032 iwl_mvm_bt_coex_vif_change(mvm);
3915 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->min_def, 4033 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def,
3916 ctx->rx_chains_static, 4034 ctx->rx_chains_static,
3917 ctx->rx_chains_dynamic); 4035 ctx->rx_chains_dynamic);
3918 4036
@@ -3941,6 +4059,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
3941 mvmvif->ap_ibss_active = true; 4059 mvmvif->ap_ibss_active = true;
3942 break; 4060 break;
3943 } 4061 }
4062 /* fall through */
3944 case NL80211_IFTYPE_ADHOC: 4063 case NL80211_IFTYPE_ADHOC:
3945 /* 4064 /*
3946 * The AP binding flow is handled as part of the start_ap flow 4065 * The AP binding flow is handled as part of the start_ap flow
@@ -3993,25 +4112,30 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
3993 } 4112 }
3994 4113
3995 if (switching_chanctx && vif->type == NL80211_IFTYPE_STATION) { 4114 if (switching_chanctx && vif->type == NL80211_IFTYPE_STATION) {
3996 u32 duration = 3 * vif->bss_conf.beacon_int; 4115 mvmvif->csa_bcn_pending = true;
3997 4116
3998 /* iwl_mvm_protect_session() reads directly from the 4117 if (!fw_has_capa(&mvm->fw->ucode_capa,
3999 * device (the system time), so make sure it is 4118 IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD)) {
4000 * available. 4119 u32 duration = 3 * vif->bss_conf.beacon_int;
4001 */
4002 ret = iwl_mvm_ref_sync(mvm, IWL_MVM_REF_PROTECT_CSA);
4003 if (ret)
4004 goto out_remove_binding;
4005 4120
4006 /* Protect the session to make sure we hear the first
4007 * beacon on the new channel.
4008 */
4009 mvmvif->csa_bcn_pending = true;
4010 iwl_mvm_protect_session(mvm, vif, duration, duration,
4011 vif->bss_conf.beacon_int / 2,
4012 true);
4013 4121
4014 iwl_mvm_unref(mvm, IWL_MVM_REF_PROTECT_CSA); 4122 /* iwl_mvm_protect_session() reads directly from the
4123 * device (the system time), so make sure it is
4124 * available.
4125 */
4126 ret = iwl_mvm_ref_sync(mvm, IWL_MVM_REF_PROTECT_CSA);
4127 if (ret)
4128 goto out_remove_binding;
4129
4130 /* Protect the session to make sure we hear the first
4131 * beacon on the new channel.
4132 */
4133 iwl_mvm_protect_session(mvm, vif, duration, duration,
4134 vif->bss_conf.beacon_int / 2,
4135 true);
4136
4137 iwl_mvm_unref(mvm, IWL_MVM_REF_PROTECT_CSA);
4138 }
4015 4139
4016 iwl_mvm_update_quotas(mvm, false, NULL); 4140 iwl_mvm_update_quotas(mvm, false, NULL);
4017 } 4141 }
@@ -4081,7 +4205,9 @@ static void __iwl_mvm_unassign_vif_chanctx(struct iwl_mvm *mvm,
4081 4205
4082 disabled_vif = vif; 4206 disabled_vif = vif;
4083 4207
4084 iwl_mvm_mac_ctxt_changed(mvm, vif, true, NULL); 4208 if (!fw_has_capa(&mvm->fw->ucode_capa,
4209 IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD))
4210 iwl_mvm_mac_ctxt_changed(mvm, vif, true, NULL);
4085 break; 4211 break;
4086 default: 4212 default:
4087 break; 4213 break;
@@ -4332,6 +4458,27 @@ static void iwl_mvm_channel_switch(struct ieee80211_hw *hw,
4332 "dummy channel switch op\n"); 4458 "dummy channel switch op\n");
4333} 4459}
4334 4460
4461static int iwl_mvm_schedule_client_csa(struct iwl_mvm *mvm,
4462 struct ieee80211_vif *vif,
4463 struct ieee80211_channel_switch *chsw)
4464{
4465 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
4466 struct iwl_chan_switch_te_cmd cmd = {
4467 .mac_id = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
4468 mvmvif->color)),
4469 .action = cpu_to_le32(FW_CTXT_ACTION_ADD),
4470 .tsf = cpu_to_le32(chsw->timestamp),
4471 .cs_count = chsw->count,
4472 };
4473
4474 lockdep_assert_held(&mvm->mutex);
4475
4476 return iwl_mvm_send_cmd_pdu(mvm,
4477 WIDE_ID(MAC_CONF_GROUP,
4478 CHANNEL_SWITCH_TIME_EVENT_CMD),
4479 0, sizeof(cmd), &cmd);
4480}
4481
4335static int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw, 4482static int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw,
4336 struct ieee80211_vif *vif, 4483 struct ieee80211_vif *vif,
4337 struct ieee80211_channel_switch *chsw) 4484 struct ieee80211_channel_switch *chsw)
@@ -4399,14 +4546,19 @@ static int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw,
4399 if (chsw->block_tx) 4546 if (chsw->block_tx)
4400 iwl_mvm_csa_client_absent(mvm, vif); 4547 iwl_mvm_csa_client_absent(mvm, vif);
4401 4548
4402 iwl_mvm_schedule_csa_period(mvm, vif, vif->bss_conf.beacon_int,
4403 apply_time);
4404 if (mvmvif->bf_data.bf_enabled) { 4549 if (mvmvif->bf_data.bf_enabled) {
4405 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0); 4550 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0);
4406 if (ret) 4551 if (ret)
4407 goto out_unlock; 4552 goto out_unlock;
4408 } 4553 }
4409 4554
4555 if (fw_has_capa(&mvm->fw->ucode_capa,
4556 IWL_UCODE_TLV_CAPA_CHANNEL_SWITCH_CMD))
4557 iwl_mvm_schedule_client_csa(mvm, vif, chsw);
4558 else
4559 iwl_mvm_schedule_csa_period(mvm, vif,
4560 vif->bss_conf.beacon_int,
4561 apply_time);
4410 break; 4562 break;
4411 default: 4563 default:
4412 break; 4564 break;
@@ -4799,6 +4951,60 @@ static void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw)
4799 mutex_unlock(&mvm->mutex); 4951 mutex_unlock(&mvm->mutex);
4800} 4952}
4801 4953
4954static int
4955iwl_mvm_mac_get_ftm_responder_stats(struct ieee80211_hw *hw,
4956 struct ieee80211_vif *vif,
4957 struct cfg80211_ftm_responder_stats *stats)
4958{
4959 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
4960 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
4961
4962 if (vif->p2p || vif->type != NL80211_IFTYPE_AP ||
4963 !mvmvif->ap_ibss_active || !vif->bss_conf.ftm_responder)
4964 return -EINVAL;
4965
4966 mutex_lock(&mvm->mutex);
4967 *stats = mvm->ftm_resp_stats;
4968 mutex_unlock(&mvm->mutex);
4969
4970 stats->filled = BIT(NL80211_FTM_STATS_SUCCESS_NUM) |
4971 BIT(NL80211_FTM_STATS_PARTIAL_NUM) |
4972 BIT(NL80211_FTM_STATS_FAILED_NUM) |
4973 BIT(NL80211_FTM_STATS_ASAP_NUM) |
4974 BIT(NL80211_FTM_STATS_NON_ASAP_NUM) |
4975 BIT(NL80211_FTM_STATS_TOTAL_DURATION_MSEC) |
4976 BIT(NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM) |
4977 BIT(NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM) |
4978 BIT(NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM);
4979
4980 return 0;
4981}
4982
4983static int iwl_mvm_start_pmsr(struct ieee80211_hw *hw,
4984 struct ieee80211_vif *vif,
4985 struct cfg80211_pmsr_request *request)
4986{
4987 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
4988 int ret;
4989
4990 mutex_lock(&mvm->mutex);
4991 ret = iwl_mvm_ftm_start(mvm, vif, request);
4992 mutex_unlock(&mvm->mutex);
4993
4994 return ret;
4995}
4996
4997static void iwl_mvm_abort_pmsr(struct ieee80211_hw *hw,
4998 struct ieee80211_vif *vif,
4999 struct cfg80211_pmsr_request *request)
5000{
5001 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
5002
5003 mutex_lock(&mvm->mutex);
5004 iwl_mvm_ftm_abort(mvm, request);
5005 mutex_unlock(&mvm->mutex);
5006}
5007
4802static bool iwl_mvm_can_hw_csum(struct sk_buff *skb) 5008static bool iwl_mvm_can_hw_csum(struct sk_buff *skb)
4803{ 5009{
4804 u8 protocol = ip_hdr(skb)->protocol; 5010 u8 protocol = ip_hdr(skb)->protocol;
@@ -4901,6 +5107,10 @@ const struct ieee80211_ops iwl_mvm_hw_ops = {
4901#endif 5107#endif
4902 .get_survey = iwl_mvm_mac_get_survey, 5108 .get_survey = iwl_mvm_mac_get_survey,
4903 .sta_statistics = iwl_mvm_mac_sta_statistics, 5109 .sta_statistics = iwl_mvm_mac_sta_statistics,
5110 .get_ftm_responder_stats = iwl_mvm_mac_get_ftm_responder_stats,
5111 .start_pmsr = iwl_mvm_start_pmsr,
5112 .abort_pmsr = iwl_mvm_abort_pmsr,
5113
4904 .can_aggregate_in_amsdu = iwl_mvm_mac_can_aggregate, 5114 .can_aggregate_in_amsdu = iwl_mvm_mac_can_aggregate,
4905#ifdef CONFIG_IWLWIFI_DEBUGFS 5115#ifdef CONFIG_IWLWIFI_DEBUGFS
4906 .sta_add_debugfs = iwl_mvm_sta_add_debugfs, 5116 .sta_add_debugfs = iwl_mvm_sta_add_debugfs,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 12e9ecc3ee27..bca6f6b536d9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -879,9 +879,6 @@ struct iwl_mvm {
879 879
880 bool hw_registered; 880 bool hw_registered;
881 bool calibrating; 881 bool calibrating;
882 u32 error_event_table[2];
883 u32 log_event_table;
884 u32 umac_error_event_table;
885 bool support_umac_log; 882 bool support_umac_log;
886 883
887 u32 ampdu_ref; 884 u32 ampdu_ref;
@@ -981,6 +978,7 @@ struct iwl_mvm {
981 u32 dbgfs_prph_reg_addr; 978 u32 dbgfs_prph_reg_addr;
982 bool disable_power_off; 979 bool disable_power_off;
983 bool disable_power_off_d3; 980 bool disable_power_off_d3;
981 bool beacon_inject_active;
984 982
985 bool scan_iter_notif_enabled; 983 bool scan_iter_notif_enabled;
986 984
@@ -1017,6 +1015,7 @@ struct iwl_mvm {
1017 1015
1018 /* -1 for always, 0 for never, >0 for that many times */ 1016 /* -1 for always, 0 for never, >0 for that many times */
1019 s8 fw_restart; 1017 s8 fw_restart;
1018 u8 *error_recovery_buf;
1020 1019
1021#ifdef CONFIG_IWLWIFI_LEDS 1020#ifdef CONFIG_IWLWIFI_LEDS
1022 struct led_classdev led; 1021 struct led_classdev led;
@@ -1106,6 +1105,8 @@ struct iwl_mvm {
1106 1105
1107 /* Indicate if device power save is allowed */ 1106 /* Indicate if device power save is allowed */
1108 u8 ps_disabled; /* u8 instead of bool to ease debugfs_create_* usage */ 1107 u8 ps_disabled; /* u8 instead of bool to ease debugfs_create_* usage */
1108 /* Indicate if 32Khz external clock is valid */
1109 u32 ext_clock_valid;
1109 unsigned int max_amsdu_len; /* used for debugfs only */ 1110 unsigned int max_amsdu_len; /* used for debugfs only */
1110 1111
1111 struct ieee80211_vif __rcu *csa_vif; 1112 struct ieee80211_vif __rcu *csa_vif;
@@ -1150,6 +1151,14 @@ struct iwl_mvm {
1150 u32 ciphers[IWL_MVM_NUM_CIPHERS]; 1151 u32 ciphers[IWL_MVM_NUM_CIPHERS];
1151 struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS]; 1152 struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS];
1152 1153
1154 struct cfg80211_ftm_responder_stats ftm_resp_stats;
1155 struct {
1156 struct cfg80211_pmsr_request *req;
1157 struct wireless_dev *req_wdev;
1158 struct list_head loc_list;
1159 int responses[IWL_MVM_TOF_MAX_APS];
1160 } ftm_initiator;
1161
1153 struct ieee80211_vif *nan_vif; 1162 struct ieee80211_vif *nan_vif;
1154#define IWL_MAX_BAID 32 1163#define IWL_MAX_BAID 32
1155 struct iwl_mvm_baid_data __rcu *baid_map[IWL_MAX_BAID]; 1164 struct iwl_mvm_baid_data __rcu *baid_map[IWL_MAX_BAID];
@@ -1167,6 +1176,7 @@ struct iwl_mvm {
1167 1176
1168 /* sniffer data to include in radiotap */ 1177 /* sniffer data to include in radiotap */
1169 __le16 cur_aid; 1178 __le16 cur_aid;
1179 u8 cur_bssid[ETH_ALEN];
1170 1180
1171#ifdef CONFIG_ACPI 1181#ifdef CONFIG_ACPI
1172 struct iwl_mvm_sar_profile sar_profiles[ACPI_SAR_PROFILE_NUM]; 1182 struct iwl_mvm_sar_profile sar_profiles[ACPI_SAR_PROFILE_NUM];
@@ -1211,7 +1221,6 @@ enum iwl_mvm_status {
1211enum iwl_mvm_init_status { 1221enum iwl_mvm_init_status {
1212 IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0), 1222 IWL_MVM_INIT_STATUS_THERMAL_INIT_COMPLETE = BIT(0),
1213 IWL_MVM_INIT_STATUS_LEDS_INIT_COMPLETE = BIT(1), 1223 IWL_MVM_INIT_STATUS_LEDS_INIT_COMPLETE = BIT(1),
1214 IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE = BIT(2),
1215}; 1224};
1216 1225
1217static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm) 1226static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
@@ -1311,6 +1320,12 @@ static inline bool iwl_mvm_is_frag_ebs_supported(struct iwl_mvm *mvm)
1311 return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_FRAG_EBS); 1320 return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_FRAG_EBS);
1312} 1321}
1313 1322
1323static inline bool iwl_mvm_is_short_beacon_notif_supported(struct iwl_mvm *mvm)
1324{
1325 return fw_has_api(&mvm->fw->ucode_capa,
1326 IWL_UCODE_TLV_API_SHORT_BEACON_NOTIF);
1327}
1328
1314static inline bool iwl_mvm_enter_d0i3_on_suspend(struct iwl_mvm *mvm) 1329static inline bool iwl_mvm_enter_d0i3_on_suspend(struct iwl_mvm *mvm)
1315{ 1330{
1316 /* For now we only use this mode to differentiate between 1331 /* For now we only use this mode to differentiate between
@@ -1646,6 +1661,7 @@ void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
1646void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 1661void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
1647void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, 1662void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm,
1648 struct iwl_rx_cmd_buffer *rxb); 1663 struct iwl_rx_cmd_buffer *rxb);
1664void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags);
1649void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb); 1665void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
1650void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, 1666void iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
1651 struct iwl_rx_cmd_buffer *rxb); 1667 struct iwl_rx_cmd_buffer *rxb);
@@ -1680,6 +1696,17 @@ int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1680int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); 1696int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
1681int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, 1697int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
1682 struct ieee80211_vif *vif); 1698 struct ieee80211_vif *vif);
1699int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,
1700 struct ieee80211_vif *vif,
1701 struct sk_buff *beacon);
1702int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm,
1703 struct sk_buff *beacon,
1704 void *data, int len);
1705u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct ieee80211_tx_info *info,
1706 struct ieee80211_vif *vif);
1707void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm,
1708 __le32 *tim_index, __le32 *tim_size,
1709 u8 *beacon, u32 frame_size);
1683void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, 1710void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
1684 struct iwl_rx_cmd_buffer *rxb); 1711 struct iwl_rx_cmd_buffer *rxb);
1685void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm, 1712void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
@@ -2007,15 +2034,12 @@ static inline void iwl_mvm_stop_device(struct iwl_mvm *mvm)
2007 &mvm->status)) 2034 &mvm->status))
2008 iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert, 2035 iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert,
2009 false, 0); 2036 false, 0);
2010 /* calling this function without using dump_start/end since at this 2037
2011 * point we already hold the op mode mutex
2012 */
2013 iwl_fw_dbg_collect_sync(&mvm->fwrt);
2014 iwl_fw_cancel_timestamp(&mvm->fwrt); 2038 iwl_fw_cancel_timestamp(&mvm->fwrt);
2015 iwl_free_fw_paging(&mvm->fwrt);
2016 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); 2039 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status);
2040 iwl_fwrt_stop_device(&mvm->fwrt);
2041 iwl_free_fw_paging(&mvm->fwrt);
2017 iwl_fw_dump_conf_clear(&mvm->fwrt); 2042 iwl_fw_dump_conf_clear(&mvm->fwrt);
2018 iwl_trans_stop_device(mvm->trans);
2019} 2043}
2020 2044
2021/* Re-configure the SCD for a queue that has already been configured */ 2045/* Re-configure the SCD for a queue that has already been configured */
@@ -2057,6 +2081,23 @@ void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm);
2057int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 2081int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2058 bool added_vif); 2082 bool added_vif);
2059 2083
2084/* FTM responder */
2085int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
2086void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm,
2087 struct ieee80211_vif *vif);
2088void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm,
2089 struct iwl_rx_cmd_buffer *rxb);
2090
2091/* FTM initiator */
2092void iwl_mvm_ftm_restart(struct iwl_mvm *mvm);
2093void iwl_mvm_ftm_range_resp(struct iwl_mvm *mvm,
2094 struct iwl_rx_cmd_buffer *rxb);
2095void iwl_mvm_ftm_lc_notif(struct iwl_mvm *mvm,
2096 struct iwl_rx_cmd_buffer *rxb);
2097int iwl_mvm_ftm_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2098 struct cfg80211_pmsr_request *request);
2099void iwl_mvm_ftm_abort(struct iwl_mvm *mvm, struct cfg80211_pmsr_request *req);
2100
2060/* TDLS */ 2101/* TDLS */
2061 2102
2062/* 2103/*
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 5e4f8b767d10..ba27dce4c2bb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -82,7 +82,6 @@
82#include "fw/api/scan.h" 82#include "fw/api/scan.h"
83#include "time-event.h" 83#include "time-event.h"
84#include "fw-api.h" 84#include "fw-api.h"
85#include "fw/api/scan.h"
86#include "fw/acpi.h" 85#include "fw/acpi.h"
87 86
88#define DRV_DESCRIPTION "The new Intel(R) wireless AGN driver for Linux" 87#define DRV_DESCRIPTION "The new Intel(R) wireless AGN driver for Linux"
@@ -301,6 +300,14 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
301 RX_HANDLER_ASYNC_LOCKED), 300 RX_HANDLER_ASYNC_LOCKED),
302 RX_HANDLER(MFUART_LOAD_NOTIFICATION, iwl_mvm_rx_mfuart_notif, 301 RX_HANDLER(MFUART_LOAD_NOTIFICATION, iwl_mvm_rx_mfuart_notif,
303 RX_HANDLER_SYNC), 302 RX_HANDLER_SYNC),
303 RX_HANDLER_GRP(LOCATION_GROUP, TOF_RESPONDER_STATS,
304 iwl_mvm_ftm_responder_stats, RX_HANDLER_ASYNC_LOCKED),
305
306 RX_HANDLER_GRP(LOCATION_GROUP, TOF_RANGE_RESPONSE_NOTIF,
307 iwl_mvm_ftm_range_resp, RX_HANDLER_ASYNC_LOCKED),
308 RX_HANDLER_GRP(LOCATION_GROUP, TOF_LC_NOTIF,
309 iwl_mvm_ftm_lc_notif, RX_HANDLER_ASYNC_LOCKED),
310
304 RX_HANDLER_GRP(DEBUG_GROUP, MFU_ASSERT_DUMP_NTF, 311 RX_HANDLER_GRP(DEBUG_GROUP, MFU_ASSERT_DUMP_NTF,
305 iwl_mvm_mfu_assert_dump_notif, RX_HANDLER_SYNC), 312 iwl_mvm_mfu_assert_dump_notif, RX_HANDLER_SYNC),
306 RX_HANDLER_GRP(PROT_OFFLOAD_GROUP, STORED_BEACON_NTF, 313 RX_HANDLER_GRP(PROT_OFFLOAD_GROUP, STORED_BEACON_NTF,
@@ -415,12 +422,14 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = {
415static const struct iwl_hcmd_names iwl_mvm_system_names[] = { 422static const struct iwl_hcmd_names iwl_mvm_system_names[] = {
416 HCMD_NAME(SHARED_MEM_CFG_CMD), 423 HCMD_NAME(SHARED_MEM_CFG_CMD),
417 HCMD_NAME(INIT_EXTENDED_CFG_CMD), 424 HCMD_NAME(INIT_EXTENDED_CFG_CMD),
425 HCMD_NAME(FW_ERROR_RECOVERY_CMD),
418}; 426};
419 427
420/* Please keep this array *SORTED* by hex value. 428/* Please keep this array *SORTED* by hex value.
421 * Access is done through binary search 429 * Access is done through binary search
422 */ 430 */
423static const struct iwl_hcmd_names iwl_mvm_mac_conf_names[] = { 431static const struct iwl_hcmd_names iwl_mvm_mac_conf_names[] = {
432 HCMD_NAME(CHANNEL_SWITCH_TIME_EVENT_CMD),
424 HCMD_NAME(CHANNEL_SWITCH_NOA_NOTIF), 433 HCMD_NAME(CHANNEL_SWITCH_NOA_NOTIF),
425}; 434};
426 435
@@ -445,6 +454,7 @@ static const struct iwl_hcmd_names iwl_mvm_data_path_names[] = {
445 HCMD_NAME(TRIGGER_RX_QUEUES_NOTIF_CMD), 454 HCMD_NAME(TRIGGER_RX_QUEUES_NOTIF_CMD),
446 HCMD_NAME(STA_HE_CTXT_CMD), 455 HCMD_NAME(STA_HE_CTXT_CMD),
447 HCMD_NAME(RFH_QUEUE_CONFIG_CMD), 456 HCMD_NAME(RFH_QUEUE_CONFIG_CMD),
457 HCMD_NAME(TLC_MNG_CONFIG_CMD),
448 HCMD_NAME(CHEST_COLLECTOR_FILTER_CONFIG_CMD), 458 HCMD_NAME(CHEST_COLLECTOR_FILTER_CONFIG_CMD),
449 HCMD_NAME(STA_PM_NOTIF), 459 HCMD_NAME(STA_PM_NOTIF),
450 HCMD_NAME(MU_GROUP_MGMT_NOTIF), 460 HCMD_NAME(MU_GROUP_MGMT_NOTIF),
@@ -591,11 +601,17 @@ static int iwl_mvm_fwrt_send_hcmd(void *ctx, struct iwl_host_cmd *host_cmd)
591 return ret; 601 return ret;
592} 602}
593 603
604static bool iwl_mvm_d3_debug_enable(void *ctx)
605{
606 return IWL_MVM_D3_DEBUG;
607}
608
594static const struct iwl_fw_runtime_ops iwl_mvm_fwrt_ops = { 609static const struct iwl_fw_runtime_ops iwl_mvm_fwrt_ops = {
595 .dump_start = iwl_mvm_fwrt_dump_start, 610 .dump_start = iwl_mvm_fwrt_dump_start,
596 .dump_end = iwl_mvm_fwrt_dump_end, 611 .dump_end = iwl_mvm_fwrt_dump_end,
597 .fw_running = iwl_mvm_fwrt_fw_running, 612 .fw_running = iwl_mvm_fwrt_fw_running,
598 .send_hcmd = iwl_mvm_fwrt_send_hcmd, 613 .send_hcmd = iwl_mvm_fwrt_send_hcmd,
614 .d3_debug_enable = iwl_mvm_d3_debug_enable,
599}; 615};
600 616
601static struct iwl_op_mode * 617static struct iwl_op_mode *
@@ -690,6 +706,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
690 INIT_LIST_HEAD(&mvm->aux_roc_te_list); 706 INIT_LIST_HEAD(&mvm->aux_roc_te_list);
691 INIT_LIST_HEAD(&mvm->async_handlers_list); 707 INIT_LIST_HEAD(&mvm->async_handlers_list);
692 spin_lock_init(&mvm->time_event_lock); 708 spin_lock_init(&mvm->time_event_lock);
709 INIT_LIST_HEAD(&mvm->ftm_initiator.loc_list);
693 710
694 INIT_WORK(&mvm->async_handlers_wk, iwl_mvm_async_handlers_wk); 711 INIT_WORK(&mvm->async_handlers_wk, iwl_mvm_async_handlers_wk);
695 INIT_WORK(&mvm->roc_done_wk, iwl_mvm_roc_done_wk); 712 INIT_WORK(&mvm->roc_done_wk, iwl_mvm_roc_done_wk);
@@ -817,8 +834,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
817 mutex_lock(&mvm->mutex); 834 mutex_lock(&mvm->mutex);
818 iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE); 835 iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE);
819 err = iwl_run_init_mvm_ucode(mvm, true); 836 err = iwl_run_init_mvm_ucode(mvm, true);
820 if (test_bit(IWL_FWRT_STATUS_WAIT_ALIVE, &mvm->fwrt.status)) 837 if (err)
821 iwl_fw_alive_error_dump(&mvm->fwrt); 838 iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER);
822 if (!iwlmvm_mod_params.init_dbg || !err) 839 if (!iwlmvm_mod_params.init_dbg || !err)
823 iwl_mvm_stop_device(mvm); 840 iwl_mvm_stop_device(mvm);
824 iwl_mvm_unref(mvm, IWL_MVM_REF_INIT_UCODE); 841 iwl_mvm_unref(mvm, IWL_MVM_REF_INIT_UCODE);
@@ -902,15 +919,15 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode)
902 919
903 iwl_mvm_thermal_exit(mvm); 920 iwl_mvm_thermal_exit(mvm);
904 921
905 if (mvm->init_status & IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE) { 922 ieee80211_unregister_hw(mvm->hw);
906 ieee80211_unregister_hw(mvm->hw);
907 mvm->init_status &= ~IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE;
908 }
909 923
910 kfree(mvm->scan_cmd); 924 kfree(mvm->scan_cmd);
911 kfree(mvm->mcast_filter_cmd); 925 kfree(mvm->mcast_filter_cmd);
912 mvm->mcast_filter_cmd = NULL; 926 mvm->mcast_filter_cmd = NULL;
913 927
928 kfree(mvm->error_recovery_buf);
929 mvm->error_recovery_buf = NULL;
930
914#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_IWLWIFI_DEBUGFS) 931#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_IWLWIFI_DEBUGFS)
915 kfree(mvm->d3_resume_sram); 932 kfree(mvm->d3_resume_sram);
916#endif 933#endif
@@ -1105,6 +1122,12 @@ static void iwl_mvm_async_cb(struct iwl_op_mode *op_mode,
1105 iwl_trans_block_txq_ptrs(mvm->trans, false); 1122 iwl_trans_block_txq_ptrs(mvm->trans, false);
1106} 1123}
1107 1124
1125static int iwl_mvm_is_static_queue(struct iwl_mvm *mvm, int queue)
1126{
1127 return queue == mvm->aux_queue || queue == mvm->probe_queue ||
1128 queue == mvm->p2p_dev_queue || queue == mvm->snif_queue;
1129}
1130
1108static void iwl_mvm_queue_state_change(struct iwl_op_mode *op_mode, 1131static void iwl_mvm_queue_state_change(struct iwl_op_mode *op_mode,
1109 int hw_queue, bool start) 1132 int hw_queue, bool start)
1110{ 1133{
@@ -1131,6 +1154,15 @@ static void iwl_mvm_queue_state_change(struct iwl_op_mode *op_mode,
1131 goto out; 1154 goto out;
1132 mvmsta = iwl_mvm_sta_from_mac80211(sta); 1155 mvmsta = iwl_mvm_sta_from_mac80211(sta);
1133 1156
1157 if (iwl_mvm_is_static_queue(mvm, hw_queue)) {
1158 if (!start)
1159 ieee80211_stop_queues(mvm->hw);
1160 else if (mvmsta->sta_state != IEEE80211_STA_NOTEXIST)
1161 ieee80211_wake_queues(mvm->hw);
1162
1163 goto out;
1164 }
1165
1134 if (iwl_mvm_has_new_tx_api(mvm)) { 1166 if (iwl_mvm_has_new_tx_api(mvm)) {
1135 int tid = mvm->tvqm_info[hw_queue].txq_tid; 1167 int tid = mvm->tvqm_info[hw_queue].txq_tid;
1136 1168
@@ -1285,12 +1317,29 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error)
1285 reprobe->dev = mvm->trans->dev; 1317 reprobe->dev = mvm->trans->dev;
1286 INIT_WORK(&reprobe->work, iwl_mvm_reprobe_wk); 1318 INIT_WORK(&reprobe->work, iwl_mvm_reprobe_wk);
1287 schedule_work(&reprobe->work); 1319 schedule_work(&reprobe->work);
1320 } else if (test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
1321 &mvm->status)) {
1322 IWL_ERR(mvm, "HW restart already requested, but not started\n");
1288 } else if (mvm->fwrt.cur_fw_img == IWL_UCODE_REGULAR && 1323 } else if (mvm->fwrt.cur_fw_img == IWL_UCODE_REGULAR &&
1289 mvm->hw_registered && 1324 mvm->hw_registered &&
1290 !test_bit(STATUS_TRANS_DEAD, &mvm->trans->status)) { 1325 !test_bit(STATUS_TRANS_DEAD, &mvm->trans->status)) {
1291 /* don't let the transport/FW power down */ 1326 /* don't let the transport/FW power down */
1292 iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); 1327 iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
1293 1328
1329 if (mvm->fw->ucode_capa.error_log_size) {
1330 u32 src_size = mvm->fw->ucode_capa.error_log_size;
1331 u32 src_addr = mvm->fw->ucode_capa.error_log_addr;
1332 u8 *recover_buf = kzalloc(src_size, GFP_ATOMIC);
1333
1334 if (recover_buf) {
1335 mvm->error_recovery_buf = recover_buf;
1336 iwl_trans_read_mem_bytes(mvm->trans,
1337 src_addr,
1338 recover_buf,
1339 src_size);
1340 }
1341 }
1342
1294 if (fw_error && mvm->fw_restart > 0) 1343 if (fw_error && mvm->fw_restart > 0)
1295 mvm->fw_restart--; 1344 mvm->fw_restart--;
1296 set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); 1345 set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
index f369173db11c..86e40bae57e3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
@@ -109,6 +109,7 @@ u8 iwl_mvm_get_ctrl_pos(struct cfg80211_chan_def *chandef)
109 return PHY_VHT_CTRL_POS_4_ABOVE; 109 return PHY_VHT_CTRL_POS_4_ABOVE;
110 default: 110 default:
111 WARN(1, "Invalid channel definition"); 111 WARN(1, "Invalid channel definition");
112 /* fall through */
112 case 0: 113 case 0:
113 /* 114 /*
114 * The FW is expected to check the control channel position only 115 * The FW is expected to check the control channel position only
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/power.c b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
index 5a0a28fd762d..36f5fa1ee793 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
@@ -8,6 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
11 * Copyright (C) 2018 - 2019 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -30,6 +31,7 @@
30 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
31 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
32 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
34 * Copyright (C) 2018 - 2019 Intel Corporation
33 * All rights reserved. 35 * All rights reserved.
34 * 36 *
35 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -79,6 +81,8 @@ int iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm,
79 struct iwl_beacon_filter_cmd *cmd, 81 struct iwl_beacon_filter_cmd *cmd,
80 u32 flags) 82 u32 flags)
81{ 83{
84 u16 len;
85
82 IWL_DEBUG_POWER(mvm, "ba_enable_beacon_abort is: %d\n", 86 IWL_DEBUG_POWER(mvm, "ba_enable_beacon_abort is: %d\n",
83 le32_to_cpu(cmd->ba_enable_beacon_abort)); 87 le32_to_cpu(cmd->ba_enable_beacon_abort));
84 IWL_DEBUG_POWER(mvm, "ba_escape_timer is: %d\n", 88 IWL_DEBUG_POWER(mvm, "ba_escape_timer is: %d\n",
@@ -101,9 +105,23 @@ int iwl_mvm_beacon_filter_send_cmd(struct iwl_mvm *mvm,
101 le32_to_cpu(cmd->bf_temp_fast_filter)); 105 le32_to_cpu(cmd->bf_temp_fast_filter));
102 IWL_DEBUG_POWER(mvm, "bf_temp_slow_filter is: %d\n", 106 IWL_DEBUG_POWER(mvm, "bf_temp_slow_filter is: %d\n",
103 le32_to_cpu(cmd->bf_temp_slow_filter)); 107 le32_to_cpu(cmd->bf_temp_slow_filter));
108 IWL_DEBUG_POWER(mvm, "bf_threshold_absolute_low is: %d, %d\n",
109 le32_to_cpu(cmd->bf_threshold_absolute_low[0]),
110 le32_to_cpu(cmd->bf_threshold_absolute_low[1]));
111
112 IWL_DEBUG_POWER(mvm, "bf_threshold_absolute_high is: %d, %d\n",
113 le32_to_cpu(cmd->bf_threshold_absolute_high[0]),
114 le32_to_cpu(cmd->bf_threshold_absolute_high[1]));
115
116 if (fw_has_api(&mvm->fw->ucode_capa,
117 IWL_UCODE_TLV_API_BEACON_FILTER_V4))
118 len = sizeof(struct iwl_beacon_filter_cmd);
119 else
120 len = offsetof(struct iwl_beacon_filter_cmd,
121 bf_threshold_absolute_low);
104 122
105 return iwl_mvm_send_cmd_pdu(mvm, REPLY_BEACON_FILTERING_CMD, flags, 123 return iwl_mvm_send_cmd_pdu(mvm, REPLY_BEACON_FILTERING_CMD, flags,
106 sizeof(struct iwl_beacon_filter_cmd), cmd); 124 len, cmd);
107} 125}
108 126
109static 127static
@@ -526,6 +544,9 @@ int iwl_mvm_power_update_device(struct iwl_mvm *mvm)
526 cmd.flags &= 544 cmd.flags &=
527 cpu_to_le16(~DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK); 545 cpu_to_le16(~DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK);
528#endif 546#endif
547 if (mvm->ext_clock_valid)
548 cmd.flags |= cpu_to_le16(DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK);
549
529 IWL_DEBUG_POWER(mvm, 550 IWL_DEBUG_POWER(mvm,
530 "Sending device power command with flags = 0x%X\n", 551 "Sending device power command with flags = 0x%X\n",
531 cmd.flags); 552 cmd.flags);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 09866f50857a..e231a44d2423 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -3,7 +3,7 @@
3 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 3 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
4 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 4 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
5 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 5 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
6 * Copyright(c) 2018 Intel Corporation 6 * Copyright(c) 2018 - 2019 Intel Corporation
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of version 2 of the GNU General Public License as 9 * under the terms of version 2 of the GNU General Public License as
@@ -1643,8 +1643,26 @@ static s32 rs_get_best_rate(struct iwl_mvm *mvm,
1643 1643
1644static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta) 1644static u32 rs_bw_from_sta_bw(struct ieee80211_sta *sta)
1645{ 1645{
1646 struct ieee80211_sta_vht_cap *sta_vht_cap = &sta->vht_cap;
1647 struct ieee80211_vht_cap vht_cap = {
1648 .vht_cap_info = cpu_to_le32(sta_vht_cap->cap),
1649 .supp_mcs = sta_vht_cap->vht_mcs,
1650 };
1651
1646 switch (sta->bandwidth) { 1652 switch (sta->bandwidth) {
1647 case IEEE80211_STA_RX_BW_160: 1653 case IEEE80211_STA_RX_BW_160:
1654 /*
1655 * Don't use 160 MHz if VHT extended NSS support
1656 * says we cannot use 2 streams, we don't want to
1657 * deal with this.
1658 * We only check MCS 0 - they will support that if
1659 * we got here at all and we don't care which MCS,
1660 * we want to determine a more global state.
1661 */
1662 if (ieee80211_get_vht_max_nss(&vht_cap,
1663 IEEE80211_VHT_CHANWIDTH_160MHZ,
1664 0, true) < sta->rx_nss)
1665 return RATE_MCS_CHAN_WIDTH_80;
1648 return RATE_MCS_CHAN_WIDTH_160; 1666 return RATE_MCS_CHAN_WIDTH_160;
1649 case IEEE80211_STA_RX_BW_80: 1667 case IEEE80211_STA_RX_BW_80:
1650 return RATE_MCS_CHAN_WIDTH_80; 1668 return RATE_MCS_CHAN_WIDTH_80;
@@ -1757,7 +1775,12 @@ static void rs_set_amsdu_len(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1757 else 1775 else
1758 mvmsta->amsdu_enabled = 0xFFFF; 1776 mvmsta->amsdu_enabled = 0xFFFF;
1759 1777
1760 mvmsta->max_amsdu_len = sta->max_amsdu_len; 1778 if (mvmsta->vif->bss_conf.he_support &&
1779 !iwlwifi_mod_params.disable_11ax)
1780 mvmsta->max_amsdu_len = sta->max_amsdu_len;
1781 else
1782 mvmsta->max_amsdu_len = min_t(int, sta->max_amsdu_len, 8500);
1783
1761 sta->max_rc_amsdu_len = mvmsta->max_amsdu_len; 1784 sta->max_rc_amsdu_len = mvmsta->max_amsdu_len;
1762 1785
1763 for (i = 0; i < IWL_MAX_TID_COUNT; i++) { 1786 for (i = 0; i < IWL_MAX_TID_COUNT; i++) {
@@ -1791,7 +1814,7 @@ static bool rs_tweak_rate_tbl(struct iwl_mvm *mvm,
1791 struct iwl_scale_tbl_info *tbl, 1814 struct iwl_scale_tbl_info *tbl,
1792 enum rs_action scale_action) 1815 enum rs_action scale_action)
1793{ 1816{
1794 if (sta->bandwidth != IEEE80211_STA_RX_BW_80) 1817 if (rs_bw_from_sta_bw(sta) != RATE_MCS_CHAN_WIDTH_80)
1795 return false; 1818 return false;
1796 1819
1797 if (!is_vht_siso(&tbl->rate)) 1820 if (!is_vht_siso(&tbl->rate))
@@ -4122,6 +4145,7 @@ static const struct rate_control_ops rs_mvm_ops_drv = {
4122 .add_sta_debugfs = rs_drv_add_sta_debugfs, 4145 .add_sta_debugfs = rs_drv_add_sta_debugfs,
4123 .remove_sta_debugfs = rs_remove_sta_debugfs, 4146 .remove_sta_debugfs = rs_remove_sta_debugfs,
4124#endif 4147#endif
4148 .capa = RATE_CTRL_CAPA_VHT_EXT_NSS_BW,
4125}; 4149};
4126 4150
4127void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 4151void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index 235ab26ca429..fbd3014e8b82 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -222,7 +222,7 @@ static u32 iwl_mvm_set_mac80211_rx_flag(struct iwl_mvm *mvm,
222 !(rx_pkt_status & RX_MPDU_RES_STATUS_TTAK_OK)) 222 !(rx_pkt_status & RX_MPDU_RES_STATUS_TTAK_OK))
223 return 0; 223 return 0;
224 *crypt_len = IEEE80211_TKIP_IV_LEN; 224 *crypt_len = IEEE80211_TKIP_IV_LEN;
225 /* fall through if TTAK OK */ 225 /* fall through */
226 226
227 case RX_MPDU_RES_STATUS_SEC_WEP_ENC: 227 case RX_MPDU_RES_STATUS_SEC_WEP_ENC:
228 if (!(rx_pkt_status & RX_MPDU_RES_STATUS_ICV_OK)) 228 if (!(rx_pkt_status & RX_MPDU_RES_STATUS_ICV_OK))
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index 2c56f73d688e..1e03acf30762 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -66,11 +66,37 @@
66#include "mvm.h" 66#include "mvm.h"
67#include "fw-api.h" 67#include "fw-api.h"
68 68
69static void *iwl_mvm_skb_get_hdr(struct sk_buff *skb)
70{
71 struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
72 u8 *data = skb->data;
73
74 /* Alignment concerns */
75 BUILD_BUG_ON(sizeof(struct ieee80211_radiotap_he) % 4);
76 BUILD_BUG_ON(sizeof(struct ieee80211_radiotap_he_mu) % 4);
77 BUILD_BUG_ON(sizeof(struct ieee80211_radiotap_lsig) % 4);
78 BUILD_BUG_ON(sizeof(struct ieee80211_vendor_radiotap) % 4);
79
80 if (rx_status->flag & RX_FLAG_RADIOTAP_HE)
81 data += sizeof(struct ieee80211_radiotap_he);
82 if (rx_status->flag & RX_FLAG_RADIOTAP_HE_MU)
83 data += sizeof(struct ieee80211_radiotap_he_mu);
84 if (rx_status->flag & RX_FLAG_RADIOTAP_LSIG)
85 data += sizeof(struct ieee80211_radiotap_lsig);
86 if (rx_status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) {
87 struct ieee80211_vendor_radiotap *radiotap = (void *)data;
88
89 data += sizeof(*radiotap) + radiotap->len + radiotap->pad;
90 }
91
92 return data;
93}
94
69static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb, 95static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb,
70 int queue, struct ieee80211_sta *sta) 96 int queue, struct ieee80211_sta *sta)
71{ 97{
72 struct iwl_mvm_sta *mvmsta; 98 struct iwl_mvm_sta *mvmsta;
73 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 99 struct ieee80211_hdr *hdr = iwl_mvm_skb_get_hdr(skb);
74 struct ieee80211_rx_status *stats = IEEE80211_SKB_RXCB(skb); 100 struct ieee80211_rx_status *stats = IEEE80211_SKB_RXCB(skb);
75 struct iwl_mvm_key_pn *ptk_pn; 101 struct iwl_mvm_key_pn *ptk_pn;
76 int res; 102 int res;
@@ -197,12 +223,15 @@ static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm,
197{ 223{
198 struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); 224 struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
199 struct ieee80211_vendor_radiotap *radiotap; 225 struct ieee80211_vendor_radiotap *radiotap;
200 int size = sizeof(*radiotap) + sizeof(__le16); 226 const int size = sizeof(*radiotap) + sizeof(__le16);
201 227
202 if (!mvm->cur_aid) 228 if (!mvm->cur_aid)
203 return; 229 return;
204 230
205 radiotap = skb_put(skb, size); 231 /* ensure alignment */
232 BUILD_BUG_ON((size + 2) % 4);
233
234 radiotap = skb_put(skb, size + 2);
206 radiotap->align = 1; 235 radiotap->align = 1;
207 /* Intel OUI */ 236 /* Intel OUI */
208 radiotap->oui[0] = 0xf6; 237 radiotap->oui[0] = 0xf6;
@@ -212,10 +241,12 @@ static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm,
212 radiotap->subns = 1; 241 radiotap->subns = 1;
213 radiotap->present = 0x1; 242 radiotap->present = 0x1;
214 radiotap->len = size - sizeof(*radiotap); 243 radiotap->len = size - sizeof(*radiotap);
215 radiotap->pad = 0; 244 radiotap->pad = 2;
216 245
217 /* fill the data now */ 246 /* fill the data now */
218 memcpy(radiotap->data, &mvm->cur_aid, sizeof(mvm->cur_aid)); 247 memcpy(radiotap->data, &mvm->cur_aid, sizeof(mvm->cur_aid));
248 /* and clear the padding */
249 memset(radiotap->data + sizeof(__le16), 0, radiotap->pad);
219 250
220 rx_status->flag |= RX_FLAG_RADIOTAP_VENDOR_DATA; 251 rx_status->flag |= RX_FLAG_RADIOTAP_VENDOR_DATA;
221} 252}
@@ -227,10 +258,7 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm,
227 struct ieee80211_sta *sta, 258 struct ieee80211_sta *sta,
228 bool csi) 259 bool csi)
229{ 260{
230 struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); 261 if (iwl_mvm_check_pn(mvm, skb, queue, sta))
231
232 if (!(rx_status->flag & RX_FLAG_NO_PSDU) &&
233 iwl_mvm_check_pn(mvm, skb, queue, sta))
234 kfree_skb(skb); 262 kfree_skb(skb);
235 else 263 else
236 ieee80211_rx_napi(mvm->hw, sta, skb, napi); 264 ieee80211_rx_napi(mvm->hw, sta, skb, napi);
@@ -310,7 +338,7 @@ static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
310 stats->flag |= RX_FLAG_MMIC_ERROR; 338 stats->flag |= RX_FLAG_MMIC_ERROR;
311 339
312 *crypt_len = IEEE80211_TKIP_IV_LEN; 340 *crypt_len = IEEE80211_TKIP_IV_LEN;
313 /* fall through if TTAK OK */ 341 /* fall through */
314 case IWL_RX_MPDU_STATUS_SEC_WEP: 342 case IWL_RX_MPDU_STATUS_SEC_WEP:
315 if (!(status & IWL_RX_MPDU_STATUS_ICV_OK)) 343 if (!(status & IWL_RX_MPDU_STATUS_ICV_OK))
316 return -1; 344 return -1;
@@ -663,7 +691,7 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
663 struct sk_buff *skb, 691 struct sk_buff *skb,
664 struct iwl_rx_mpdu_desc *desc) 692 struct iwl_rx_mpdu_desc *desc)
665{ 693{
666 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 694 struct ieee80211_hdr *hdr = iwl_mvm_skb_get_hdr(skb);
667 struct iwl_mvm_sta *mvm_sta; 695 struct iwl_mvm_sta *mvm_sta;
668 struct iwl_mvm_baid_data *baid_data; 696 struct iwl_mvm_baid_data *baid_data;
669 struct iwl_mvm_reorder_buffer *buffer; 697 struct iwl_mvm_reorder_buffer *buffer;
@@ -960,6 +988,7 @@ iwl_mvm_decode_he_phy_ru_alloc(struct iwl_mvm_rx_phy_data *phy_data,
960 * the TSF/timers are not be transmitted in HE-MU. 988 * the TSF/timers are not be transmitted in HE-MU.
961 */ 989 */
962 u8 ru = le32_get_bits(phy_data->d1, IWL_RX_PHY_DATA1_HE_RU_ALLOC_MASK); 990 u8 ru = le32_get_bits(phy_data->d1, IWL_RX_PHY_DATA1_HE_RU_ALLOC_MASK);
991 u32 he_type = rate_n_flags & RATE_MCS_HE_TYPE_MSK;
963 u8 offs = 0; 992 u8 offs = 0;
964 993
965 rx_status->bw = RATE_INFO_BW_HE_RU; 994 rx_status->bw = RATE_INFO_BW_HE_RU;
@@ -1002,19 +1031,27 @@ iwl_mvm_decode_he_phy_ru_alloc(struct iwl_mvm_rx_phy_data *phy_data,
1002 he->data2 |= 1031 he->data2 |=
1003 cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC); 1032 cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC);
1004 1033
1005 if (he_mu) {
1006#define CHECK_BW(bw) \ 1034#define CHECK_BW(bw) \
1007 BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_ ## bw ## MHZ != \ 1035 BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_ ## bw ## MHZ != \
1036 RATE_MCS_CHAN_WIDTH_##bw >> RATE_MCS_CHAN_WIDTH_POS); \
1037 BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_ ## bw ## MHZ != \
1008 RATE_MCS_CHAN_WIDTH_##bw >> RATE_MCS_CHAN_WIDTH_POS) 1038 RATE_MCS_CHAN_WIDTH_##bw >> RATE_MCS_CHAN_WIDTH_POS)
1009 CHECK_BW(20); 1039 CHECK_BW(20);
1010 CHECK_BW(40); 1040 CHECK_BW(40);
1011 CHECK_BW(80); 1041 CHECK_BW(80);
1012 CHECK_BW(160); 1042 CHECK_BW(160);
1043
1044 if (he_mu)
1013 he_mu->flags2 |= 1045 he_mu->flags2 |=
1014 le16_encode_bits(FIELD_GET(RATE_MCS_CHAN_WIDTH_MSK, 1046 le16_encode_bits(FIELD_GET(RATE_MCS_CHAN_WIDTH_MSK,
1015 rate_n_flags), 1047 rate_n_flags),
1016 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW); 1048 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW);
1017 } 1049 else if (he_type == RATE_MCS_HE_TYPE_TRIG)
1050 he->data6 |=
1051 cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN) |
1052 le16_encode_bits(FIELD_GET(RATE_MCS_CHAN_WIDTH_MSK,
1053 rate_n_flags),
1054 IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW);
1018} 1055}
1019 1056
1020static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm, 1057static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm,
@@ -1037,16 +1074,16 @@ static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm,
1037 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE2_KNOWN | 1074 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE2_KNOWN |
1038 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE3_KNOWN | 1075 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE3_KNOWN |
1039 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE4_KNOWN); 1076 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE4_KNOWN);
1040 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1077 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d2,
1041 IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE1), 1078 IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE1),
1042 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE1); 1079 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE1);
1043 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1080 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d2,
1044 IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE2), 1081 IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE2),
1045 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE2); 1082 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE2);
1046 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1083 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d2,
1047 IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE3), 1084 IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE3),
1048 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE3); 1085 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE3);
1049 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1086 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d2,
1050 IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE4), 1087 IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE4),
1051 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE4); 1088 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE4);
1052 /* fall through */ 1089 /* fall through */
@@ -1056,7 +1093,6 @@ static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm,
1056 case IWL_RX_PHY_INFO_TYPE_HE_TB: 1093 case IWL_RX_PHY_INFO_TYPE_HE_TB:
1057 /* HE common */ 1094 /* HE common */
1058 he->data1 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN | 1095 he->data1 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN |
1059 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN |
1060 IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN | 1096 IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN |
1061 IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN); 1097 IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN);
1062 he->data2 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN | 1098 he->data2 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN |
@@ -1076,9 +1112,6 @@ static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm,
1076 he->data3 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1112 he->data3 |= le16_encode_bits(le32_get_bits(phy_data->d0,
1077 IWL_RX_PHY_DATA0_HE_LDPC_EXT_SYM), 1113 IWL_RX_PHY_DATA0_HE_LDPC_EXT_SYM),
1078 IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG); 1114 IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG);
1079 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0,
1080 IWL_RX_PHY_DATA0_HE_SPATIAL_REUSE_MASK),
1081 IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE);
1082 he->data5 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1115 he->data5 |= le16_encode_bits(le32_get_bits(phy_data->d0,
1083 IWL_RX_PHY_DATA0_HE_PRE_FEC_PAD_MASK), 1116 IWL_RX_PHY_DATA0_HE_PRE_FEC_PAD_MASK),
1084 IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD); 1117 IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD);
@@ -1099,6 +1132,20 @@ static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm,
1099 1132
1100 switch (phy_data->info_type) { 1133 switch (phy_data->info_type) {
1101 case IWL_RX_PHY_INFO_TYPE_HE_MU_EXT: 1134 case IWL_RX_PHY_INFO_TYPE_HE_MU_EXT:
1135 case IWL_RX_PHY_INFO_TYPE_HE_MU:
1136 case IWL_RX_PHY_INFO_TYPE_HE_SU:
1137 he->data1 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN);
1138 he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0,
1139 IWL_RX_PHY_DATA0_HE_SPATIAL_REUSE_MASK),
1140 IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE);
1141 break;
1142 default:
1143 /* nothing here */
1144 break;
1145 }
1146
1147 switch (phy_data->info_type) {
1148 case IWL_RX_PHY_INFO_TYPE_HE_MU_EXT:
1102 he_mu->flags1 |= 1149 he_mu->flags1 |=
1103 le16_encode_bits(le16_get_bits(phy_data->d4, 1150 le16_encode_bits(le16_get_bits(phy_data->d4,
1104 IWL_RX_PHY_DATA4_HE_MU_EXT_SIGB_DCM), 1151 IWL_RX_PHY_DATA4_HE_MU_EXT_SIGB_DCM),
@@ -1165,22 +1212,16 @@ static void iwl_mvm_rx_he(struct iwl_mvm *mvm, struct sk_buff *skb,
1165 .flags2 = cpu_to_le16(IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN | 1212 .flags2 = cpu_to_le16(IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN |
1166 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN), 1213 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN),
1167 }; 1214 };
1168 unsigned int radiotap_len = 0;
1169 1215
1170 he = skb_put_data(skb, &known, sizeof(known)); 1216 he = skb_put_data(skb, &known, sizeof(known));
1171 radiotap_len += sizeof(known);
1172 rx_status->flag |= RX_FLAG_RADIOTAP_HE; 1217 rx_status->flag |= RX_FLAG_RADIOTAP_HE;
1173 1218
1174 if (phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_MU || 1219 if (phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_MU ||
1175 phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_MU_EXT) { 1220 phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_MU_EXT) {
1176 he_mu = skb_put_data(skb, &mu_known, sizeof(mu_known)); 1221 he_mu = skb_put_data(skb, &mu_known, sizeof(mu_known));
1177 radiotap_len += sizeof(mu_known);
1178 rx_status->flag |= RX_FLAG_RADIOTAP_HE_MU; 1222 rx_status->flag |= RX_FLAG_RADIOTAP_HE_MU;
1179 } 1223 }
1180 1224
1181 /* temporarily hide the radiotap data */
1182 __skb_pull(skb, radiotap_len);
1183
1184 /* report the AMPDU-EOF bit on single frames */ 1225 /* report the AMPDU-EOF bit on single frames */
1185 if (!queue && !(phy_info & IWL_RX_MPDU_PHY_AMPDU)) { 1226 if (!queue && !(phy_info & IWL_RX_MPDU_PHY_AMPDU)) {
1186 rx_status->flag |= RX_FLAG_AMPDU_DETAILS; 1227 rx_status->flag |= RX_FLAG_AMPDU_DETAILS;
@@ -1766,7 +1807,7 @@ void iwl_mvm_rx_monitor_ndp(struct iwl_mvm *mvm, struct napi_struct *napi,
1766 rx_status->rate_idx = rate; 1807 rx_status->rate_idx = rate;
1767 } 1808 }
1768 1809
1769 iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta, false); 1810 ieee80211_rx_napi(mvm->hw, sta, skb, napi);
1770out: 1811out:
1771 rcu_read_unlock(); 1812 rcu_read_unlock();
1772} 1813}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index 86d598d5b68f..78694bc38e76 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -1580,6 +1580,11 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type)
1580 * scheduled scan before starting a normal scan. 1580 * scheduled scan before starting a normal scan.
1581 */ 1581 */
1582 1582
1583 /* FW supports only a single periodic scan */
1584 if ((type == IWL_MVM_SCAN_SCHED || type == IWL_MVM_SCAN_NETDETECT) &&
1585 mvm->scan_status & (IWL_MVM_SCAN_SCHED | IWL_MVM_SCAN_NETDETECT))
1586 return -EBUSY;
1587
1583 if (iwl_mvm_num_scans(mvm) < mvm->max_scans) 1588 if (iwl_mvm_num_scans(mvm) < mvm->max_scans)
1584 return 0; 1589 return 0;
1585 1590
@@ -1616,10 +1621,10 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type)
1616 if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) 1621 if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK)
1617 return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, 1622 return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED,
1618 true); 1623 true);
1619 1624 /* Something is wrong if no scan was running but we
1620 /* fall through, something is wrong if no scan was 1625 * ran out of scans.
1621 * running but we ran out of scans.
1622 */ 1626 */
1627 /* fall through */
1623 default: 1628 default:
1624 WARN_ON(1); 1629 WARN_ON(1);
1625 break; 1630 break;
@@ -1976,9 +1981,8 @@ static int iwl_mvm_scan_stop_wait(struct iwl_mvm *mvm, int type)
1976 return ret; 1981 return ret;
1977 } 1982 }
1978 1983
1979 ret = iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, 1 * HZ); 1984 return iwl_wait_notification(&mvm->notif_wait, &wait_scan_done,
1980 1985 1 * HZ);
1981 return ret;
1982} 1986}
1983 1987
1984int iwl_mvm_scan_size(struct iwl_mvm *mvm) 1988int iwl_mvm_scan_size(struct iwl_mvm *mvm)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index c5a01470a3bc..498c315291cf 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -314,7 +314,6 @@ static int iwl_mvm_invalidate_sta_queue(struct iwl_mvm *mvm, int queue,
314 struct iwl_mvm_sta *mvmsta; 314 struct iwl_mvm_sta *mvmsta;
315 u32 status; 315 u32 status;
316 u8 sta_id; 316 u8 sta_id;
317 int ret;
318 317
319 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) 318 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm)))
320 return -EINVAL; 319 return -EINVAL;
@@ -349,11 +348,9 @@ static int iwl_mvm_invalidate_sta_queue(struct iwl_mvm *mvm, int queue,
349 348
350 /* Notify FW of queue removal from the STA queues */ 349 /* Notify FW of queue removal from the STA queues */
351 status = ADD_STA_SUCCESS; 350 status = ADD_STA_SUCCESS;
352 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, 351 return iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA,
353 iwl_mvm_add_sta_cmd_size(mvm), 352 iwl_mvm_add_sta_cmd_size(mvm),
354 &cmd, &status); 353 &cmd, &status);
355
356 return ret;
357} 354}
358 355
359static int iwl_mvm_disable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 356static int iwl_mvm_disable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
@@ -753,7 +750,8 @@ static int iwl_mvm_tvqm_enable_txq(struct iwl_mvm *mvm,
753 750
754 if (tid == IWL_MAX_TID_COUNT) { 751 if (tid == IWL_MAX_TID_COUNT) {
755 tid = IWL_MGMT_TID; 752 tid = IWL_MGMT_TID;
756 size = IWL_MGMT_QUEUE_SIZE; 753 size = max_t(u32, IWL_MGMT_QUEUE_SIZE,
754 mvm->trans->cfg->min_txq_size);
757 } 755 }
758 queue = iwl_trans_txq_alloc(mvm->trans, 756 queue = iwl_trans_txq_alloc(mvm->trans,
759 cpu_to_le16(TX_QUEUE_CFG_ENABLE_QUEUE), 757 cpu_to_le16(TX_QUEUE_CFG_ENABLE_QUEUE),
@@ -794,11 +792,9 @@ static int iwl_mvm_sta_alloc_queue_tvqm(struct iwl_mvm *mvm,
794 if (queue < 0) 792 if (queue < 0)
795 return queue; 793 return queue;
796 794
797 if (sta) { 795 mvmtxq->txq_id = queue;
798 mvmtxq->txq_id = queue; 796 mvm->tvqm_info[queue].txq_tid = tid;
799 mvm->tvqm_info[queue].txq_tid = tid; 797 mvm->tvqm_info[queue].sta_id = mvmsta->sta_id;
800 mvm->tvqm_info[queue].sta_id = mvmsta->sta_id;
801 }
802 798
803 IWL_DEBUG_TX_QUEUES(mvm, "Allocated queue is %d\n", queue); 799 IWL_DEBUG_TX_QUEUES(mvm, "Allocated queue is %d\n", queue);
804 800
@@ -2340,11 +2336,13 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
2340 if (mvmvif->ap_wep_key) { 2336 if (mvmvif->ap_wep_key) {
2341 u8 key_offset = iwl_mvm_set_fw_key_idx(mvm); 2337 u8 key_offset = iwl_mvm_set_fw_key_idx(mvm);
2342 2338
2339 __set_bit(key_offset, mvm->fw_key_table);
2340
2343 if (key_offset == STA_KEY_IDX_INVALID) 2341 if (key_offset == STA_KEY_IDX_INVALID)
2344 return -ENOSPC; 2342 return -ENOSPC;
2345 2343
2346 ret = iwl_mvm_send_sta_key(mvm, mvmvif->mcast_sta.sta_id, 2344 ret = iwl_mvm_send_sta_key(mvm, mvmvif->mcast_sta.sta_id,
2347 mvmvif->ap_wep_key, 1, 0, NULL, 0, 2345 mvmvif->ap_wep_key, true, 0, NULL, 0,
2348 key_offset, 0); 2346 key_offset, 0);
2349 if (ret) 2347 if (ret)
2350 return ret; 2348 return ret;
@@ -2353,6 +2351,59 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
2353 return 0; 2351 return 0;
2354} 2352}
2355 2353
2354static int __iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, u8 sta_id,
2355 struct ieee80211_key_conf *keyconf,
2356 bool mcast)
2357{
2358 union {
2359 struct iwl_mvm_add_sta_key_cmd_v1 cmd_v1;
2360 struct iwl_mvm_add_sta_key_cmd cmd;
2361 } u = {};
2362 bool new_api = fw_has_api(&mvm->fw->ucode_capa,
2363 IWL_UCODE_TLV_API_TKIP_MIC_KEYS);
2364 __le16 key_flags;
2365 int ret, size;
2366 u32 status;
2367
2368 /* This is a valid situation for GTK removal */
2369 if (sta_id == IWL_MVM_INVALID_STA)
2370 return 0;
2371
2372 key_flags = cpu_to_le16((keyconf->keyidx << STA_KEY_FLG_KEYID_POS) &
2373 STA_KEY_FLG_KEYID_MSK);
2374 key_flags |= cpu_to_le16(STA_KEY_FLG_NO_ENC | STA_KEY_FLG_WEP_KEY_MAP);
2375 key_flags |= cpu_to_le16(STA_KEY_NOT_VALID);
2376
2377 if (mcast)
2378 key_flags |= cpu_to_le16(STA_KEY_MULTICAST);
2379
2380 /*
2381 * The fields assigned here are in the same location at the start
2382 * of the command, so we can do this union trick.
2383 */
2384 u.cmd.common.key_flags = key_flags;
2385 u.cmd.common.key_offset = keyconf->hw_key_idx;
2386 u.cmd.common.sta_id = sta_id;
2387
2388 size = new_api ? sizeof(u.cmd) : sizeof(u.cmd_v1);
2389
2390 status = ADD_STA_SUCCESS;
2391 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, size, &u.cmd,
2392 &status);
2393
2394 switch (status) {
2395 case ADD_STA_SUCCESS:
2396 IWL_DEBUG_WEP(mvm, "MODIFY_STA: remove sta key passed\n");
2397 break;
2398 default:
2399 ret = -EIO;
2400 IWL_ERR(mvm, "MODIFY_STA: remove sta key failed\n");
2401 break;
2402 }
2403
2404 return ret;
2405}
2406
2356/* 2407/*
2357 * Send the FW a request to remove the station from it's internal data 2408 * Send the FW a request to remove the station from it's internal data
2358 * structures, and in addition remove it from the local data structure. 2409 * structures, and in addition remove it from the local data structure.
@@ -2368,6 +2419,28 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
2368 2419
2369 iwl_mvm_disable_txq(mvm, NULL, mvmvif->cab_queue, 0, 0); 2420 iwl_mvm_disable_txq(mvm, NULL, mvmvif->cab_queue, 0, 0);
2370 2421
2422 if (mvmvif->ap_wep_key) {
2423 int i;
2424
2425 if (!__test_and_clear_bit(mvmvif->ap_wep_key->hw_key_idx,
2426 mvm->fw_key_table)) {
2427 IWL_ERR(mvm, "offset %d not used in fw key table.\n",
2428 mvmvif->ap_wep_key->hw_key_idx);
2429 return -ENOENT;
2430 }
2431
2432 /* track which key was deleted last */
2433 for (i = 0; i < STA_KEY_MAX_NUM; i++) {
2434 if (mvm->fw_key_deleted[i] < U8_MAX)
2435 mvm->fw_key_deleted[i]++;
2436 }
2437 mvm->fw_key_deleted[mvmvif->ap_wep_key->hw_key_idx] = 0;
2438 ret = __iwl_mvm_remove_sta_key(mvm, mvmvif->mcast_sta.sta_id,
2439 mvmvif->ap_wep_key, true);
2440 if (ret)
2441 return ret;
2442 }
2443
2371 ret = iwl_mvm_rm_sta_common(mvm, mvmvif->mcast_sta.sta_id); 2444 ret = iwl_mvm_rm_sta_common(mvm, mvmvif->mcast_sta.sta_id);
2372 if (ret) 2445 if (ret)
2373 IWL_WARN(mvm, "Failed sending remove station\n"); 2446 IWL_WARN(mvm, "Failed sending remove station\n");
@@ -3399,59 +3472,6 @@ static int __iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
3399 return ret; 3472 return ret;
3400} 3473}
3401 3474
3402static int __iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, u8 sta_id,
3403 struct ieee80211_key_conf *keyconf,
3404 bool mcast)
3405{
3406 union {
3407 struct iwl_mvm_add_sta_key_cmd_v1 cmd_v1;
3408 struct iwl_mvm_add_sta_key_cmd cmd;
3409 } u = {};
3410 bool new_api = fw_has_api(&mvm->fw->ucode_capa,
3411 IWL_UCODE_TLV_API_TKIP_MIC_KEYS);
3412 __le16 key_flags;
3413 int ret, size;
3414 u32 status;
3415
3416 /* This is a valid situation for GTK removal */
3417 if (sta_id == IWL_MVM_INVALID_STA)
3418 return 0;
3419
3420 key_flags = cpu_to_le16((keyconf->keyidx << STA_KEY_FLG_KEYID_POS) &
3421 STA_KEY_FLG_KEYID_MSK);
3422 key_flags |= cpu_to_le16(STA_KEY_FLG_NO_ENC | STA_KEY_FLG_WEP_KEY_MAP);
3423 key_flags |= cpu_to_le16(STA_KEY_NOT_VALID);
3424
3425 if (mcast)
3426 key_flags |= cpu_to_le16(STA_KEY_MULTICAST);
3427
3428 /*
3429 * The fields assigned here are in the same location at the start
3430 * of the command, so we can do this union trick.
3431 */
3432 u.cmd.common.key_flags = key_flags;
3433 u.cmd.common.key_offset = keyconf->hw_key_idx;
3434 u.cmd.common.sta_id = sta_id;
3435
3436 size = new_api ? sizeof(u.cmd) : sizeof(u.cmd_v1);
3437
3438 status = ADD_STA_SUCCESS;
3439 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, size, &u.cmd,
3440 &status);
3441
3442 switch (status) {
3443 case ADD_STA_SUCCESS:
3444 IWL_DEBUG_WEP(mvm, "MODIFY_STA: remove sta key passed\n");
3445 break;
3446 default:
3447 ret = -EIO;
3448 IWL_ERR(mvm, "MODIFY_STA: remove sta key failed\n");
3449 break;
3450 }
3451
3452 return ret;
3453}
3454
3455int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, 3475int iwl_mvm_set_sta_key(struct iwl_mvm *mvm,
3456 struct ieee80211_vif *vif, 3476 struct ieee80211_vif *vif,
3457 struct ieee80211_sta *sta, 3477 struct ieee80211_sta *sta,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
index 0614296244b3..79700c7310a1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
@@ -394,6 +394,7 @@ struct iwl_mvm_rxq_dup_data {
394 * the BA window. To be used for UAPSD only. 394 * the BA window. To be used for UAPSD only.
395 * @ptk_pn: per-queue PTK PN data structures 395 * @ptk_pn: per-queue PTK PN data structures
396 * @dup_data: per queue duplicate packet detection data 396 * @dup_data: per queue duplicate packet detection data
397 * @wep_key: used in AP mode. Is a duplicate of the WEP key.
397 * @deferred_traffic_tid_map: indication bitmap of deferred traffic per-TID 398 * @deferred_traffic_tid_map: indication bitmap of deferred traffic per-TID
398 * @tx_ant: the index of the antenna to use for data tx to this station. Only 399 * @tx_ant: the index of the antenna to use for data tx to this station. Only
399 * used during connection establishment (e.g. for the 4 way handshake 400 * used during connection establishment (e.g. for the 4 way handshake
@@ -425,6 +426,8 @@ struct iwl_mvm_sta {
425 struct iwl_mvm_key_pn __rcu *ptk_pn[4]; 426 struct iwl_mvm_key_pn __rcu *ptk_pn[4];
426 struct iwl_mvm_rxq_dup_data *dup_data; 427 struct iwl_mvm_rxq_dup_data *dup_data;
427 428
429 struct ieee80211_key_conf *wep_key;
430
428 u8 reserved_queue; 431 u8 reserved_queue;
429 432
430 /* Temporary, until the new TLC will control the Tx protection */ 433 /* Temporary, until the new TLC will control the Tx protection */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
index 5b34100e9099..9693fa4cdc39 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
@@ -85,7 +85,7 @@ void iwl_mvm_te_clear_data(struct iwl_mvm *mvm,
85{ 85{
86 lockdep_assert_held(&mvm->time_event_lock); 86 lockdep_assert_held(&mvm->time_event_lock);
87 87
88 if (!te_data->vif) 88 if (!te_data || !te_data->vif)
89 return; 89 return;
90 90
91 list_del(&te_data->list); 91 list_del(&te_data->list);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index ac62eb8c4b36..0c2aabc842f9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -209,7 +209,9 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
209 u16 offload_assist = 0; 209 u16 offload_assist = 0;
210 u8 ac; 210 u8 ac;
211 211
212 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) 212 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) ||
213 (ieee80211_is_probe_resp(fc) &&
214 !is_multicast_ether_addr(hdr->addr1)))
213 tx_flags |= TX_CMD_FLG_ACK; 215 tx_flags |= TX_CMD_FLG_ACK;
214 else 216 else
215 tx_flags &= ~TX_CMD_FLG_ACK; 217 tx_flags &= ~TX_CMD_FLG_ACK;
@@ -278,7 +280,7 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
278 } 280 }
279 281
280 if (ieee80211_is_data(fc) && len > mvm->rts_threshold && 282 if (ieee80211_is_data(fc) && len > mvm->rts_threshold &&
281 !is_multicast_ether_addr(ieee80211_get_DA(hdr))) 283 !is_multicast_ether_addr(hdr->addr1))
282 tx_flags |= TX_CMD_FLG_PROT_REQUIRE; 284 tx_flags |= TX_CMD_FLG_PROT_REQUIRE;
283 285
284 if (fw_has_capa(&mvm->fw->ucode_capa, 286 if (fw_has_capa(&mvm->fw->ucode_capa,
@@ -719,6 +721,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
719 IEEE80211_TX_CTL_TX_OFFCHAN; 721 IEEE80211_TX_CTL_TX_OFFCHAN;
720 int queue = -1; 722 int queue = -1;
721 723
724 if (IWL_MVM_NON_TRANSMITTING_AP && ieee80211_is_probe_resp(fc))
725 return -1;
726
722 memcpy(&info, skb->cb, sizeof(info)); 727 memcpy(&info, skb->cb, sizeof(info));
723 728
724 if (WARN_ON_ONCE(info.flags & IEEE80211_TX_CTL_AMPDU)) 729 if (WARN_ON_ONCE(info.flags & IEEE80211_TX_CTL_AMPDU))
@@ -1078,6 +1083,9 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
1078 fc = hdr->frame_control; 1083 fc = hdr->frame_control;
1079 hdrlen = ieee80211_hdrlen(fc); 1084 hdrlen = ieee80211_hdrlen(fc);
1080 1085
1086 if (IWL_MVM_NON_TRANSMITTING_AP && ieee80211_is_probe_resp(fc))
1087 return -1;
1088
1081 if (WARN_ON_ONCE(!mvmsta)) 1089 if (WARN_ON_ONCE(!mvmsta))
1082 return -1; 1090 return -1;
1083 1091
@@ -1107,12 +1115,14 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
1107 */ 1115 */
1108 if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc)) { 1116 if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc)) {
1109 tid = ieee80211_get_tid(hdr); 1117 tid = ieee80211_get_tid(hdr);
1110 if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT)) 1118 if (WARN_ONCE(tid >= IWL_MAX_TID_COUNT, "Invalid TID %d", tid))
1111 goto drop_unlock_sta; 1119 goto drop_unlock_sta;
1112 1120
1113 is_ampdu = info->flags & IEEE80211_TX_CTL_AMPDU; 1121 is_ampdu = info->flags & IEEE80211_TX_CTL_AMPDU;
1114 if (WARN_ON_ONCE(is_ampdu && 1122 if (WARN_ONCE(is_ampdu &&
1115 mvmsta->tid_data[tid].state != IWL_AGG_ON)) 1123 mvmsta->tid_data[tid].state != IWL_AGG_ON,
1124 "Invalid internal agg state %d for TID %d",
1125 mvmsta->tid_data[tid].state, tid))
1116 goto drop_unlock_sta; 1126 goto drop_unlock_sta;
1117 1127
1118 seq_number = mvmsta->tid_data[tid].seq_number; 1128 seq_number = mvmsta->tid_data[tid].seq_number;
@@ -1134,7 +1144,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
1134 1144
1135 WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM); 1145 WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM);
1136 1146
1137 if (WARN_ON_ONCE(txq_id == IWL_MVM_INVALID_QUEUE)) { 1147 if (WARN_ONCE(txq_id == IWL_MVM_INVALID_QUEUE, "Invalid TXQ id")) {
1138 iwl_trans_free_tx_cmd(mvm->trans, dev_cmd); 1148 iwl_trans_free_tx_cmd(mvm->trans, dev_cmd);
1139 spin_unlock(&mvmsta->lock); 1149 spin_unlock(&mvmsta->lock);
1140 return 0; 1150 return 0;
@@ -1184,6 +1194,7 @@ drop_unlock_sta:
1184 iwl_trans_free_tx_cmd(mvm->trans, dev_cmd); 1194 iwl_trans_free_tx_cmd(mvm->trans, dev_cmd);
1185 spin_unlock(&mvmsta->lock); 1195 spin_unlock(&mvmsta->lock);
1186drop: 1196drop:
1197 IWL_DEBUG_TX(mvm, "TX to [%d|%d] dropped\n", mvmsta->sta_id, tid);
1187 return -1; 1198 return -1;
1188} 1199}
1189 1200
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
index 211c4638d690..4649327abb45 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
@@ -294,6 +294,7 @@ static const struct {
294 { "SYSASSERT", 0x35 }, 294 { "SYSASSERT", 0x35 },
295 { "UCODE_VERSION_MISMATCH", 0x37 }, 295 { "UCODE_VERSION_MISMATCH", 0x37 },
296 { "BAD_COMMAND", 0x38 }, 296 { "BAD_COMMAND", 0x38 },
297 { "BAD_COMMAND", 0x39 },
297 { "NMI_INTERRUPT_DATA_ACTION_PT", 0x3C }, 298 { "NMI_INTERRUPT_DATA_ACTION_PT", 0x3C },
298 { "FATAL_ERROR", 0x3D }, 299 { "FATAL_ERROR", 0x3D },
299 { "NMI_TRM_HW_ERR", 0x46 }, 300 { "NMI_TRM_HW_ERR", 0x46 },
@@ -456,12 +457,14 @@ static void iwl_mvm_dump_umac_error_log(struct iwl_mvm *mvm)
456{ 457{
457 struct iwl_trans *trans = mvm->trans; 458 struct iwl_trans *trans = mvm->trans;
458 struct iwl_umac_error_event_table table; 459 struct iwl_umac_error_event_table table;
460 u32 base = mvm->trans->umac_error_event_table;
459 461
460 if (!mvm->support_umac_log) 462 if (!mvm->support_umac_log &&
463 !(mvm->trans->error_event_table_tlv_status &
464 IWL_ERROR_EVENT_TABLE_UMAC))
461 return; 465 return;
462 466
463 iwl_trans_read_mem_bytes(trans, mvm->umac_error_event_table, &table, 467 iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table));
464 sizeof(table));
465 468
466 if (table.valid) 469 if (table.valid)
467 mvm->fwrt.dump.umac_err_id = table.error_id; 470 mvm->fwrt.dump.umac_err_id = table.error_id;
@@ -493,7 +496,7 @@ static void iwl_mvm_dump_lmac_error_log(struct iwl_mvm *mvm, u8 lmac_num)
493{ 496{
494 struct iwl_trans *trans = mvm->trans; 497 struct iwl_trans *trans = mvm->trans;
495 struct iwl_error_event_table table; 498 struct iwl_error_event_table table;
496 u32 val, base = mvm->error_event_table[lmac_num]; 499 u32 val, base = mvm->trans->lmac_error_event_table[lmac_num];
497 500
498 if (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) { 501 if (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) {
499 if (!base) 502 if (!base)
@@ -522,23 +525,9 @@ static void iwl_mvm_dump_lmac_error_log(struct iwl_mvm *mvm, u8 lmac_num)
522 /* reset the device */ 525 /* reset the device */
523 iwl_trans_sw_reset(trans); 526 iwl_trans_sw_reset(trans);
524 527
525 /* set INIT_DONE flag */ 528 err = iwl_finish_nic_init(trans);
526 iwl_set_bit(trans, CSR_GP_CNTRL, 529 if (err)
527 BIT(trans->cfg->csr->flag_init_done));
528
529 /* and wait for clock stabilization */
530 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
531 udelay(2);
532
533 err = iwl_poll_bit(trans, CSR_GP_CNTRL,
534 BIT(trans->cfg->csr->flag_mac_clock_ready),
535 BIT(trans->cfg->csr->flag_mac_clock_ready),
536 25000);
537 if (err < 0) {
538 IWL_DEBUG_INFO(trans,
539 "Failed to reset the card for the dump\n");
540 return; 530 return;
541 }
542 } 531 }
543 532
544 iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table)); 533 iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table));
@@ -603,7 +592,7 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)
603 592
604 iwl_mvm_dump_lmac_error_log(mvm, 0); 593 iwl_mvm_dump_lmac_error_log(mvm, 0);
605 594
606 if (mvm->error_event_table[1]) 595 if (mvm->trans->lmac_error_event_table[1])
607 iwl_mvm_dump_lmac_error_log(mvm, 1); 596 iwl_mvm_dump_lmac_error_log(mvm, 1);
608 597
609 iwl_mvm_dump_umac_error_log(mvm); 598 iwl_mvm_dump_umac_error_log(mvm);
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
index ceb3aa03d561..1e36459948db 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2018 Intel Corporation 8 * Copyright(c) 2018 - 2019 Intel Corporation
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
@@ -18,7 +18,7 @@
18 * 18 *
19 * BSD LICENSE 19 * BSD LICENSE
20 * 20 *
21 * Copyright(c) 2018 Intel Corporation 21 * Copyright(c) 2018 - 2019 Intel Corporation
22 * All rights reserved. 22 * All rights reserved.
23 * 23 *
24 * Redistribution and use in source and binary forms, with or without 24 * Redistribution and use in source and binary forms, with or without
@@ -66,6 +66,7 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
66 void *iml_img; 66 void *iml_img;
67 u32 control_flags = 0; 67 u32 control_flags = 0;
68 int ret; 68 int ret;
69 int cmdq_size = max_t(u32, TFD_CMD_SLOTS, trans->cfg->min_txq_size);
69 70
70 /* Allocate prph scratch */ 71 /* Allocate prph scratch */
71 prph_scratch = dma_alloc_coherent(trans->dev, sizeof(*prph_scratch), 72 prph_scratch = dma_alloc_coherent(trans->dev, sizeof(*prph_scratch),
@@ -151,7 +152,7 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
151 ctxt_info_gen3->mcr_base_addr = 152 ctxt_info_gen3->mcr_base_addr =
152 cpu_to_le64(trans_pcie->rxq->used_bd_dma); 153 cpu_to_le64(trans_pcie->rxq->used_bd_dma);
153 ctxt_info_gen3->mtr_size = 154 ctxt_info_gen3->mtr_size =
154 cpu_to_le16(TFD_QUEUE_CB_SIZE(TFD_CMD_SLOTS)); 155 cpu_to_le16(TFD_QUEUE_CB_SIZE(cmdq_size));
155 ctxt_info_gen3->mcr_size = 156 ctxt_info_gen3->mcr_size =
156 cpu_to_le16(RX_QUEUE_CB_SIZE(MQ_RX_TABLE_SIZE)); 157 cpu_to_le16(RX_QUEUE_CB_SIZE(MQ_RX_TABLE_SIZE));
157 158
@@ -175,8 +176,13 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
175 iwl_write64(trans, CSR_IML_DATA_ADDR, 176 iwl_write64(trans, CSR_IML_DATA_ADDR,
176 trans_pcie->iml_dma_addr); 177 trans_pcie->iml_dma_addr);
177 iwl_write32(trans, CSR_IML_SIZE_ADDR, trans->iml_len); 178 iwl_write32(trans, CSR_IML_SIZE_ADDR, trans->iml_len);
178 iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL, CSR_AUTO_FUNC_BOOT_ENA); 179
179 iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT); 180 iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL,
181 CSR_AUTO_FUNC_BOOT_ENA);
182 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
183 iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1);
184 else
185 iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT);
180 186
181 return 0; 187 return 0;
182} 188}
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
index 7f4aaa810ea1..9274e317cc77 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
@@ -59,8 +59,7 @@
59 59
60void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans) 60void iwl_pcie_ctxt_info_free_paging(struct iwl_trans *trans)
61{ 61{
62 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 62 struct iwl_self_init_dram *dram = &trans->init_dram;
63 struct iwl_self_init_dram *dram = &trans_pcie->init_dram;
64 int i; 63 int i;
65 64
66 if (!dram->paging) { 65 if (!dram->paging) {
@@ -83,8 +82,7 @@ int iwl_pcie_init_fw_sec(struct iwl_trans *trans,
83 const struct fw_img *fw, 82 const struct fw_img *fw,
84 struct iwl_context_info_dram *ctxt_dram) 83 struct iwl_context_info_dram *ctxt_dram)
85{ 84{
86 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 85 struct iwl_self_init_dram *dram = &trans->init_dram;
87 struct iwl_self_init_dram *dram = &trans_pcie->init_dram;
88 int i, ret, lmac_cnt, umac_cnt, paging_cnt; 86 int i, ret, lmac_cnt, umac_cnt, paging_cnt;
89 87
90 if (WARN(dram->paging, 88 if (WARN(dram->paging,
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index a22e47639a4e..2b94e4cef56c 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016-2017 Intel Deutschland GmbH 10 * Copyright(c) 2016-2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -32,7 +32,7 @@
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * All rights reserved. 33 * All rights reserved.
34 * Copyright(c) 2017 Intel Deutschland GmbH 34 * Copyright(c) 2017 Intel Deutschland GmbH
35 * Copyright(c) 2018 Intel Corporation 35 * Copyright(c) 2018 - 2019 Intel Corporation
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions 38 * modification, are permitted provided that the following conditions
@@ -517,6 +517,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
517 {IWL_PCI_DEVICE(0x02F0, 0x0034, iwl9560_2ac_cfg_soc)}, 517 {IWL_PCI_DEVICE(0x02F0, 0x0034, iwl9560_2ac_cfg_soc)},
518 {IWL_PCI_DEVICE(0x02F0, 0x0038, iwl9560_2ac_160_cfg_soc)}, 518 {IWL_PCI_DEVICE(0x02F0, 0x0038, iwl9560_2ac_160_cfg_soc)},
519 {IWL_PCI_DEVICE(0x02F0, 0x003C, iwl9560_2ac_160_cfg_soc)}, 519 {IWL_PCI_DEVICE(0x02F0, 0x003C, iwl9560_2ac_160_cfg_soc)},
520 {IWL_PCI_DEVICE(0x02F0, 0x0040, iwl_ax101_cfg_qu_hr)},
521 {IWL_PCI_DEVICE(0x02F0, 0x0044, iwl_ax101_cfg_qu_hr)},
520 {IWL_PCI_DEVICE(0x02F0, 0x0060, iwl9461_2ac_cfg_soc)}, 522 {IWL_PCI_DEVICE(0x02F0, 0x0060, iwl9461_2ac_cfg_soc)},
521 {IWL_PCI_DEVICE(0x02F0, 0x0064, iwl9461_2ac_cfg_soc)}, 523 {IWL_PCI_DEVICE(0x02F0, 0x0064, iwl9461_2ac_cfg_soc)},
522 {IWL_PCI_DEVICE(0x02F0, 0x00A0, iwl9462_2ac_cfg_soc)}, 524 {IWL_PCI_DEVICE(0x02F0, 0x00A0, iwl9462_2ac_cfg_soc)},
@@ -525,6 +527,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
525 {IWL_PCI_DEVICE(0x02F0, 0x0234, iwl9560_2ac_cfg_soc)}, 527 {IWL_PCI_DEVICE(0x02F0, 0x0234, iwl9560_2ac_cfg_soc)},
526 {IWL_PCI_DEVICE(0x02F0, 0x0238, iwl9560_2ac_cfg_soc)}, 528 {IWL_PCI_DEVICE(0x02F0, 0x0238, iwl9560_2ac_cfg_soc)},
527 {IWL_PCI_DEVICE(0x02F0, 0x023C, iwl9560_2ac_cfg_soc)}, 529 {IWL_PCI_DEVICE(0x02F0, 0x023C, iwl9560_2ac_cfg_soc)},
530 {IWL_PCI_DEVICE(0x02F0, 0x0244, iwl_ax101_cfg_qu_hr)},
528 {IWL_PCI_DEVICE(0x02F0, 0x0260, iwl9461_2ac_cfg_soc)}, 531 {IWL_PCI_DEVICE(0x02F0, 0x0260, iwl9461_2ac_cfg_soc)},
529 {IWL_PCI_DEVICE(0x02F0, 0x0264, iwl9461_2ac_cfg_soc)}, 532 {IWL_PCI_DEVICE(0x02F0, 0x0264, iwl9461_2ac_cfg_soc)},
530 {IWL_PCI_DEVICE(0x02F0, 0x02A0, iwl9462_2ac_cfg_soc)}, 533 {IWL_PCI_DEVICE(0x02F0, 0x02A0, iwl9462_2ac_cfg_soc)},
@@ -542,6 +545,8 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
542 {IWL_PCI_DEVICE(0x06F0, 0x0034, iwl9560_2ac_cfg_soc)}, 545 {IWL_PCI_DEVICE(0x06F0, 0x0034, iwl9560_2ac_cfg_soc)},
543 {IWL_PCI_DEVICE(0x06F0, 0x0038, iwl9560_2ac_160_cfg_soc)}, 546 {IWL_PCI_DEVICE(0x06F0, 0x0038, iwl9560_2ac_160_cfg_soc)},
544 {IWL_PCI_DEVICE(0x06F0, 0x003C, iwl9560_2ac_160_cfg_soc)}, 547 {IWL_PCI_DEVICE(0x06F0, 0x003C, iwl9560_2ac_160_cfg_soc)},
548 {IWL_PCI_DEVICE(0x06F0, 0x0040, iwl_ax101_cfg_qu_hr)},
549 {IWL_PCI_DEVICE(0x06F0, 0x0044, iwl_ax101_cfg_qu_hr)},
545 {IWL_PCI_DEVICE(0x06F0, 0x0060, iwl9461_2ac_cfg_soc)}, 550 {IWL_PCI_DEVICE(0x06F0, 0x0060, iwl9461_2ac_cfg_soc)},
546 {IWL_PCI_DEVICE(0x06F0, 0x0064, iwl9461_2ac_cfg_soc)}, 551 {IWL_PCI_DEVICE(0x06F0, 0x0064, iwl9461_2ac_cfg_soc)},
547 {IWL_PCI_DEVICE(0x06F0, 0x00A0, iwl9462_2ac_cfg_soc)}, 552 {IWL_PCI_DEVICE(0x06F0, 0x00A0, iwl9462_2ac_cfg_soc)},
@@ -550,6 +555,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
550 {IWL_PCI_DEVICE(0x06F0, 0x0234, iwl9560_2ac_cfg_soc)}, 555 {IWL_PCI_DEVICE(0x06F0, 0x0234, iwl9560_2ac_cfg_soc)},
551 {IWL_PCI_DEVICE(0x06F0, 0x0238, iwl9560_2ac_cfg_soc)}, 556 {IWL_PCI_DEVICE(0x06F0, 0x0238, iwl9560_2ac_cfg_soc)},
552 {IWL_PCI_DEVICE(0x06F0, 0x023C, iwl9560_2ac_cfg_soc)}, 557 {IWL_PCI_DEVICE(0x06F0, 0x023C, iwl9560_2ac_cfg_soc)},
558 {IWL_PCI_DEVICE(0x06F0, 0x0244, iwl_ax101_cfg_qu_hr)},
553 {IWL_PCI_DEVICE(0x06F0, 0x0260, iwl9461_2ac_cfg_soc)}, 559 {IWL_PCI_DEVICE(0x06F0, 0x0260, iwl9461_2ac_cfg_soc)},
554 {IWL_PCI_DEVICE(0x06F0, 0x0264, iwl9461_2ac_cfg_soc)}, 560 {IWL_PCI_DEVICE(0x06F0, 0x0264, iwl9461_2ac_cfg_soc)},
555 {IWL_PCI_DEVICE(0x06F0, 0x02A0, iwl9462_2ac_cfg_soc)}, 561 {IWL_PCI_DEVICE(0x06F0, 0x02A0, iwl9462_2ac_cfg_soc)},
@@ -597,6 +603,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
597 {IWL_PCI_DEVICE(0x2526, 0x2030, iwl9560_2ac_160_cfg_soc)}, 603 {IWL_PCI_DEVICE(0x2526, 0x2030, iwl9560_2ac_160_cfg_soc)},
598 {IWL_PCI_DEVICE(0x2526, 0x2034, iwl9560_2ac_160_cfg_soc)}, 604 {IWL_PCI_DEVICE(0x2526, 0x2034, iwl9560_2ac_160_cfg_soc)},
599 {IWL_PCI_DEVICE(0x2526, 0x4010, iwl9260_2ac_160_cfg)}, 605 {IWL_PCI_DEVICE(0x2526, 0x4010, iwl9260_2ac_160_cfg)},
606 {IWL_PCI_DEVICE(0x2526, 0x4018, iwl9260_2ac_160_cfg)},
600 {IWL_PCI_DEVICE(0x2526, 0x401C, iwl9260_2ac_160_cfg)}, 607 {IWL_PCI_DEVICE(0x2526, 0x401C, iwl9260_2ac_160_cfg)},
601 {IWL_PCI_DEVICE(0x2526, 0x4030, iwl9560_2ac_160_cfg)}, 608 {IWL_PCI_DEVICE(0x2526, 0x4030, iwl9560_2ac_160_cfg)},
602 {IWL_PCI_DEVICE(0x2526, 0x4034, iwl9560_2ac_160_cfg_soc)}, 609 {IWL_PCI_DEVICE(0x2526, 0x4034, iwl9560_2ac_160_cfg_soc)},
@@ -614,6 +621,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
614 {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_160_cfg)}, 621 {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_160_cfg)},
615 {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_160_cfg)}, 622 {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_160_cfg)},
616 {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_160_cfg)}, 623 {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_160_cfg)},
624 {IWL_PCI_DEVICE(0x2720, 0x0044, iwl_ax101_cfg_qu_hr)},
617 {IWL_PCI_DEVICE(0x2720, 0x0060, iwl9461_2ac_cfg_soc)}, 625 {IWL_PCI_DEVICE(0x2720, 0x0060, iwl9461_2ac_cfg_soc)},
618 {IWL_PCI_DEVICE(0x2720, 0x0064, iwl9461_2ac_cfg_soc)}, 626 {IWL_PCI_DEVICE(0x2720, 0x0064, iwl9461_2ac_cfg_soc)},
619 {IWL_PCI_DEVICE(0x2720, 0x00A0, iwl9462_2ac_cfg_soc)}, 627 {IWL_PCI_DEVICE(0x2720, 0x00A0, iwl9462_2ac_cfg_soc)},
@@ -622,6 +630,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
622 {IWL_PCI_DEVICE(0x2720, 0x0234, iwl9560_2ac_cfg)}, 630 {IWL_PCI_DEVICE(0x2720, 0x0234, iwl9560_2ac_cfg)},
623 {IWL_PCI_DEVICE(0x2720, 0x0238, iwl9560_2ac_cfg)}, 631 {IWL_PCI_DEVICE(0x2720, 0x0238, iwl9560_2ac_cfg)},
624 {IWL_PCI_DEVICE(0x2720, 0x023C, iwl9560_2ac_cfg)}, 632 {IWL_PCI_DEVICE(0x2720, 0x023C, iwl9560_2ac_cfg)},
633 {IWL_PCI_DEVICE(0x2720, 0x0244, iwl_ax101_cfg_qu_hr)},
625 {IWL_PCI_DEVICE(0x2720, 0x0260, iwl9461_2ac_cfg_soc)}, 634 {IWL_PCI_DEVICE(0x2720, 0x0260, iwl9461_2ac_cfg_soc)},
626 {IWL_PCI_DEVICE(0x2720, 0x0264, iwl9461_2ac_cfg_soc)}, 635 {IWL_PCI_DEVICE(0x2720, 0x0264, iwl9461_2ac_cfg_soc)},
627 {IWL_PCI_DEVICE(0x2720, 0x02A0, iwl9462_2ac_cfg_soc)}, 636 {IWL_PCI_DEVICE(0x2720, 0x02A0, iwl9462_2ac_cfg_soc)},
@@ -699,6 +708,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
699 {IWL_PCI_DEVICE(0x34F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 708 {IWL_PCI_DEVICE(0x34F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
700 {IWL_PCI_DEVICE(0x34F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 709 {IWL_PCI_DEVICE(0x34F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
701 {IWL_PCI_DEVICE(0x34F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, 710 {IWL_PCI_DEVICE(0x34F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
711 {IWL_PCI_DEVICE(0x34F0, 0x0044, iwl_ax101_cfg_qu_hr)},
702 {IWL_PCI_DEVICE(0x34F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 712 {IWL_PCI_DEVICE(0x34F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
703 {IWL_PCI_DEVICE(0x34F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 713 {IWL_PCI_DEVICE(0x34F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
704 {IWL_PCI_DEVICE(0x34F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 714 {IWL_PCI_DEVICE(0x34F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
@@ -707,6 +717,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
707 {IWL_PCI_DEVICE(0x34F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 717 {IWL_PCI_DEVICE(0x34F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
708 {IWL_PCI_DEVICE(0x34F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 718 {IWL_PCI_DEVICE(0x34F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
709 {IWL_PCI_DEVICE(0x34F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, 719 {IWL_PCI_DEVICE(0x34F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
720 {IWL_PCI_DEVICE(0x34F0, 0x0244, iwl_ax101_cfg_qu_hr)},
710 {IWL_PCI_DEVICE(0x34F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 721 {IWL_PCI_DEVICE(0x34F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
711 {IWL_PCI_DEVICE(0x34F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, 722 {IWL_PCI_DEVICE(0x34F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
712 {IWL_PCI_DEVICE(0x34F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, 723 {IWL_PCI_DEVICE(0x34F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
@@ -753,6 +764,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
753 {IWL_PCI_DEVICE(0x43F0, 0x0034, iwl9560_2ac_cfg_soc)}, 764 {IWL_PCI_DEVICE(0x43F0, 0x0034, iwl9560_2ac_cfg_soc)},
754 {IWL_PCI_DEVICE(0x43F0, 0x0038, iwl9560_2ac_160_cfg_soc)}, 765 {IWL_PCI_DEVICE(0x43F0, 0x0038, iwl9560_2ac_160_cfg_soc)},
755 {IWL_PCI_DEVICE(0x43F0, 0x003C, iwl9560_2ac_160_cfg_soc)}, 766 {IWL_PCI_DEVICE(0x43F0, 0x003C, iwl9560_2ac_160_cfg_soc)},
767 {IWL_PCI_DEVICE(0x43F0, 0x0044, iwl_ax101_cfg_qu_hr)},
756 {IWL_PCI_DEVICE(0x43F0, 0x0060, iwl9461_2ac_cfg_soc)}, 768 {IWL_PCI_DEVICE(0x43F0, 0x0060, iwl9461_2ac_cfg_soc)},
757 {IWL_PCI_DEVICE(0x43F0, 0x0064, iwl9461_2ac_cfg_soc)}, 769 {IWL_PCI_DEVICE(0x43F0, 0x0064, iwl9461_2ac_cfg_soc)},
758 {IWL_PCI_DEVICE(0x43F0, 0x00A0, iwl9462_2ac_cfg_soc)}, 770 {IWL_PCI_DEVICE(0x43F0, 0x00A0, iwl9462_2ac_cfg_soc)},
@@ -761,6 +773,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
761 {IWL_PCI_DEVICE(0x43F0, 0x0234, iwl9560_2ac_cfg_soc)}, 773 {IWL_PCI_DEVICE(0x43F0, 0x0234, iwl9560_2ac_cfg_soc)},
762 {IWL_PCI_DEVICE(0x43F0, 0x0238, iwl9560_2ac_cfg_soc)}, 774 {IWL_PCI_DEVICE(0x43F0, 0x0238, iwl9560_2ac_cfg_soc)},
763 {IWL_PCI_DEVICE(0x43F0, 0x023C, iwl9560_2ac_cfg_soc)}, 775 {IWL_PCI_DEVICE(0x43F0, 0x023C, iwl9560_2ac_cfg_soc)},
776 {IWL_PCI_DEVICE(0x43F0, 0x0244, iwl_ax101_cfg_qu_hr)},
764 {IWL_PCI_DEVICE(0x43F0, 0x0260, iwl9461_2ac_cfg_soc)}, 777 {IWL_PCI_DEVICE(0x43F0, 0x0260, iwl9461_2ac_cfg_soc)},
765 {IWL_PCI_DEVICE(0x43F0, 0x0264, iwl9461_2ac_cfg_soc)}, 778 {IWL_PCI_DEVICE(0x43F0, 0x0264, iwl9461_2ac_cfg_soc)},
766 {IWL_PCI_DEVICE(0x43F0, 0x02A0, iwl9462_2ac_cfg_soc)}, 779 {IWL_PCI_DEVICE(0x43F0, 0x02A0, iwl9462_2ac_cfg_soc)},
@@ -820,6 +833,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
820 {IWL_PCI_DEVICE(0xA0F0, 0x0034, iwl9560_2ac_cfg_soc)}, 833 {IWL_PCI_DEVICE(0xA0F0, 0x0034, iwl9560_2ac_cfg_soc)},
821 {IWL_PCI_DEVICE(0xA0F0, 0x0038, iwl9560_2ac_160_cfg_soc)}, 834 {IWL_PCI_DEVICE(0xA0F0, 0x0038, iwl9560_2ac_160_cfg_soc)},
822 {IWL_PCI_DEVICE(0xA0F0, 0x003C, iwl9560_2ac_160_cfg_soc)}, 835 {IWL_PCI_DEVICE(0xA0F0, 0x003C, iwl9560_2ac_160_cfg_soc)},
836 {IWL_PCI_DEVICE(0xA0F0, 0x0044, iwl_ax101_cfg_qu_hr)},
823 {IWL_PCI_DEVICE(0xA0F0, 0x0060, iwl9461_2ac_cfg_soc)}, 837 {IWL_PCI_DEVICE(0xA0F0, 0x0060, iwl9461_2ac_cfg_soc)},
824 {IWL_PCI_DEVICE(0xA0F0, 0x0064, iwl9461_2ac_cfg_soc)}, 838 {IWL_PCI_DEVICE(0xA0F0, 0x0064, iwl9461_2ac_cfg_soc)},
825 {IWL_PCI_DEVICE(0xA0F0, 0x00A0, iwl9462_2ac_cfg_soc)}, 839 {IWL_PCI_DEVICE(0xA0F0, 0x00A0, iwl9462_2ac_cfg_soc)},
@@ -828,6 +842,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
828 {IWL_PCI_DEVICE(0xA0F0, 0x0234, iwl9560_2ac_cfg_soc)}, 842 {IWL_PCI_DEVICE(0xA0F0, 0x0234, iwl9560_2ac_cfg_soc)},
829 {IWL_PCI_DEVICE(0xA0F0, 0x0238, iwl9560_2ac_cfg_soc)}, 843 {IWL_PCI_DEVICE(0xA0F0, 0x0238, iwl9560_2ac_cfg_soc)},
830 {IWL_PCI_DEVICE(0xA0F0, 0x023C, iwl9560_2ac_cfg_soc)}, 844 {IWL_PCI_DEVICE(0xA0F0, 0x023C, iwl9560_2ac_cfg_soc)},
845 {IWL_PCI_DEVICE(0xA0F0, 0x0244, iwl_ax101_cfg_qu_hr)},
831 {IWL_PCI_DEVICE(0xA0F0, 0x0260, iwl9461_2ac_cfg_soc)}, 846 {IWL_PCI_DEVICE(0xA0F0, 0x0260, iwl9461_2ac_cfg_soc)},
832 {IWL_PCI_DEVICE(0xA0F0, 0x0264, iwl9461_2ac_cfg_soc)}, 847 {IWL_PCI_DEVICE(0xA0F0, 0x0264, iwl9461_2ac_cfg_soc)},
833 {IWL_PCI_DEVICE(0xA0F0, 0x02A0, iwl9462_2ac_cfg_soc)}, 848 {IWL_PCI_DEVICE(0xA0F0, 0x02A0, iwl9462_2ac_cfg_soc)},
@@ -872,82 +887,92 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
872 {IWL_PCI_DEVICE(0xA370, 0x40A4, iwl9462_2ac_cfg_soc)}, 887 {IWL_PCI_DEVICE(0xA370, 0x40A4, iwl9462_2ac_cfg_soc)},
873 {IWL_PCI_DEVICE(0xA370, 0x4234, iwl9560_2ac_cfg_soc)}, 888 {IWL_PCI_DEVICE(0xA370, 0x4234, iwl9560_2ac_cfg_soc)},
874 {IWL_PCI_DEVICE(0xA370, 0x42A4, iwl9462_2ac_cfg_soc)}, 889 {IWL_PCI_DEVICE(0xA370, 0x42A4, iwl9462_2ac_cfg_soc)},
890 {IWL_PCI_DEVICE(0x2720, 0x0030, iwl9560_2ac_cfg_qnj_jf_b0)},
875 891
876/* 22000 Series */ 892/* 22000 Series */
877 {IWL_PCI_DEVICE(0x02F0, 0x0070, iwl22560_2ax_cfg_hr)}, 893 {IWL_PCI_DEVICE(0x02F0, 0x0070, iwl_ax101_cfg_qu_hr)},
878 {IWL_PCI_DEVICE(0x02F0, 0x0074, iwl22560_2ax_cfg_hr)}, 894 {IWL_PCI_DEVICE(0x02F0, 0x0074, iwl_ax101_cfg_qu_hr)},
879 {IWL_PCI_DEVICE(0x02F0, 0x0078, iwl22560_2ax_cfg_hr)}, 895 {IWL_PCI_DEVICE(0x02F0, 0x0078, iwl_ax101_cfg_qu_hr)},
880 {IWL_PCI_DEVICE(0x02F0, 0x007C, iwl22560_2ax_cfg_hr)}, 896 {IWL_PCI_DEVICE(0x02F0, 0x007C, iwl_ax101_cfg_qu_hr)},
881 {IWL_PCI_DEVICE(0x02F0, 0x0310, iwl22560_2ax_cfg_hr)}, 897 {IWL_PCI_DEVICE(0x02F0, 0x0310, iwl_ax101_cfg_qu_hr)},
882 {IWL_PCI_DEVICE(0x02F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)}, 898 {IWL_PCI_DEVICE(0x02F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)},
883 {IWL_PCI_DEVICE(0x02F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)}, 899 {IWL_PCI_DEVICE(0x02F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)},
884 {IWL_PCI_DEVICE(0x02F0, 0x4070, iwl22560_2ax_cfg_hr)}, 900 {IWL_PCI_DEVICE(0x02F0, 0x4070, iwl_ax101_cfg_qu_hr)},
885 {IWL_PCI_DEVICE(0x06F0, 0x0070, iwl22560_2ax_cfg_hr)}, 901 {IWL_PCI_DEVICE(0x06F0, 0x0070, iwl_ax101_cfg_qu_hr)},
886 {IWL_PCI_DEVICE(0x06F0, 0x0074, iwl22560_2ax_cfg_hr)}, 902 {IWL_PCI_DEVICE(0x06F0, 0x0074, iwl_ax101_cfg_qu_hr)},
887 {IWL_PCI_DEVICE(0x06F0, 0x0078, iwl22560_2ax_cfg_hr)}, 903 {IWL_PCI_DEVICE(0x06F0, 0x0078, iwl_ax101_cfg_qu_hr)},
888 {IWL_PCI_DEVICE(0x06F0, 0x007C, iwl22560_2ax_cfg_hr)}, 904 {IWL_PCI_DEVICE(0x06F0, 0x007C, iwl_ax101_cfg_qu_hr)},
889 {IWL_PCI_DEVICE(0x06F0, 0x0310, iwl22560_2ax_cfg_hr)}, 905 {IWL_PCI_DEVICE(0x06F0, 0x0310, iwl_ax101_cfg_qu_hr)},
890 {IWL_PCI_DEVICE(0x06F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)}, 906 {IWL_PCI_DEVICE(0x06F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)},
891 {IWL_PCI_DEVICE(0x06F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)}, 907 {IWL_PCI_DEVICE(0x06F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)},
892 {IWL_PCI_DEVICE(0x06F0, 0x4070, iwl22560_2ax_cfg_hr)}, 908 {IWL_PCI_DEVICE(0x06F0, 0x4070, iwl_ax101_cfg_qu_hr)},
893 {IWL_PCI_DEVICE(0x2720, 0x0000, iwl22560_2ax_cfg_hr)}, 909 {IWL_PCI_DEVICE(0x2720, 0x0000, iwl_ax101_cfg_qu_hr)},
894 {IWL_PCI_DEVICE(0x2720, 0x0030, iwl9560_2ac_160_cfg_soc)}, 910 {IWL_PCI_DEVICE(0x2720, 0x0040, iwl_ax101_cfg_qu_hr)},
895 {IWL_PCI_DEVICE(0x2720, 0x0040, iwl22560_2ax_cfg_hr)},
896 {IWL_PCI_DEVICE(0x2720, 0x0070, iwl22000_2ac_cfg_hr_cdb)}, 911 {IWL_PCI_DEVICE(0x2720, 0x0070, iwl22000_2ac_cfg_hr_cdb)},
897 {IWL_PCI_DEVICE(0x2720, 0x0074, iwl22560_2ax_cfg_hr)}, 912 {IWL_PCI_DEVICE(0x2720, 0x0074, iwl_ax101_cfg_qu_hr)},
898 {IWL_PCI_DEVICE(0x2720, 0x0078, iwl22560_2ax_cfg_hr)}, 913 {IWL_PCI_DEVICE(0x2720, 0x0078, iwl_ax101_cfg_qu_hr)},
899 {IWL_PCI_DEVICE(0x2720, 0x007C, iwl22560_2ax_cfg_hr)}, 914 {IWL_PCI_DEVICE(0x2720, 0x007C, iwl_ax101_cfg_qu_hr)},
900 {IWL_PCI_DEVICE(0x2720, 0x0090, iwl22000_2ac_cfg_hr_cdb)}, 915 {IWL_PCI_DEVICE(0x2720, 0x0090, iwl22000_2ac_cfg_hr_cdb)},
901 {IWL_PCI_DEVICE(0x2720, 0x0310, iwl22000_2ac_cfg_hr_cdb)}, 916 {IWL_PCI_DEVICE(0x2720, 0x0310, iwl22000_2ac_cfg_hr_cdb)},
902 {IWL_PCI_DEVICE(0x2720, 0x0A10, iwl22000_2ac_cfg_hr_cdb)}, 917 {IWL_PCI_DEVICE(0x2720, 0x0A10, iwl22000_2ac_cfg_hr_cdb)},
903 {IWL_PCI_DEVICE(0x2720, 0x1080, iwl22560_2ax_cfg_hr)}, 918 {IWL_PCI_DEVICE(0x2720, 0x1080, iwl_ax101_cfg_qu_hr)},
904 {IWL_PCI_DEVICE(0x2720, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)}, 919 {IWL_PCI_DEVICE(0x2720, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)},
905 {IWL_PCI_DEVICE(0x2720, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)}, 920 {IWL_PCI_DEVICE(0x2720, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)},
906 {IWL_PCI_DEVICE(0x2720, 0x4070, iwl22560_2ax_cfg_hr)}, 921 {IWL_PCI_DEVICE(0x2720, 0x4070, iwl_ax101_cfg_qu_hr)},
907 {IWL_PCI_DEVICE(0x34F0, 0x0040, iwl22560_2ax_cfg_hr)}, 922 {IWL_PCI_DEVICE(0x34F0, 0x0040, iwl_ax101_cfg_qu_hr)},
908 {IWL_PCI_DEVICE(0x34F0, 0x0070, iwl22560_2ax_cfg_hr)}, 923 {IWL_PCI_DEVICE(0x34F0, 0x0070, iwl_ax101_cfg_qu_hr)},
909 {IWL_PCI_DEVICE(0x34F0, 0x0074, iwl22560_2ax_cfg_hr)}, 924 {IWL_PCI_DEVICE(0x34F0, 0x0074, iwl_ax101_cfg_qu_hr)},
910 {IWL_PCI_DEVICE(0x34F0, 0x0078, iwl22560_2ax_cfg_hr)}, 925 {IWL_PCI_DEVICE(0x34F0, 0x0078, iwl_ax101_cfg_qu_hr)},
911 {IWL_PCI_DEVICE(0x34F0, 0x007C, iwl22560_2ax_cfg_hr)}, 926 {IWL_PCI_DEVICE(0x34F0, 0x007C, iwl_ax101_cfg_qu_hr)},
912 {IWL_PCI_DEVICE(0x34F0, 0x0310, iwl22560_2ax_cfg_hr)}, 927 {IWL_PCI_DEVICE(0x34F0, 0x0310, iwl_ax101_cfg_qu_hr)},
913 {IWL_PCI_DEVICE(0x34F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)}, 928 {IWL_PCI_DEVICE(0x34F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)},
914 {IWL_PCI_DEVICE(0x34F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)}, 929 {IWL_PCI_DEVICE(0x34F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)},
915 {IWL_PCI_DEVICE(0x34F0, 0x4070, iwl22560_2ax_cfg_hr)}, 930 {IWL_PCI_DEVICE(0x34F0, 0x4070, iwl_ax101_cfg_qu_hr)},
916 {IWL_PCI_DEVICE(0x40C0, 0x0000, iwl22560_2ax_cfg_su_cdb)}, 931 {IWL_PCI_DEVICE(0x40C0, 0x0000, iwl22560_2ax_cfg_su_cdb)},
917 {IWL_PCI_DEVICE(0x40C0, 0x0010, iwl22560_2ax_cfg_su_cdb)}, 932 {IWL_PCI_DEVICE(0x40C0, 0x0010, iwl22560_2ax_cfg_su_cdb)},
918 {IWL_PCI_DEVICE(0x40c0, 0x0090, iwl22560_2ax_cfg_su_cdb)}, 933 {IWL_PCI_DEVICE(0x40c0, 0x0090, iwl22560_2ax_cfg_su_cdb)},
919 {IWL_PCI_DEVICE(0x40C0, 0x0310, iwl22560_2ax_cfg_su_cdb)}, 934 {IWL_PCI_DEVICE(0x40C0, 0x0310, iwl22560_2ax_cfg_su_cdb)},
920 {IWL_PCI_DEVICE(0x40C0, 0x0A10, iwl22560_2ax_cfg_su_cdb)}, 935 {IWL_PCI_DEVICE(0x40C0, 0x0A10, iwl22560_2ax_cfg_su_cdb)},
921 {IWL_PCI_DEVICE(0x43F0, 0x0040, iwl22560_2ax_cfg_hr)}, 936 {IWL_PCI_DEVICE(0x43F0, 0x0040, iwl_ax101_cfg_qu_hr)},
922 {IWL_PCI_DEVICE(0x43F0, 0x0070, iwl22560_2ax_cfg_hr)}, 937 {IWL_PCI_DEVICE(0x43F0, 0x0070, iwl_ax101_cfg_qu_hr)},
923 {IWL_PCI_DEVICE(0x43F0, 0x0074, iwl22560_2ax_cfg_hr)}, 938 {IWL_PCI_DEVICE(0x43F0, 0x0074, iwl_ax101_cfg_qu_hr)},
924 {IWL_PCI_DEVICE(0x43F0, 0x0078, iwl22560_2ax_cfg_hr)}, 939 {IWL_PCI_DEVICE(0x43F0, 0x0078, iwl_ax101_cfg_qu_hr)},
925 {IWL_PCI_DEVICE(0x43F0, 0x007C, iwl22560_2ax_cfg_hr)}, 940 {IWL_PCI_DEVICE(0x43F0, 0x007C, iwl_ax101_cfg_qu_hr)},
926 {IWL_PCI_DEVICE(0x43F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)}, 941 {IWL_PCI_DEVICE(0x43F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)},
927 {IWL_PCI_DEVICE(0x43F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)}, 942 {IWL_PCI_DEVICE(0x43F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)},
928 {IWL_PCI_DEVICE(0x43F0, 0x4070, iwl22560_2ax_cfg_hr)}, 943 {IWL_PCI_DEVICE(0x43F0, 0x4070, iwl_ax101_cfg_qu_hr)},
929 {IWL_PCI_DEVICE(0xA0F0, 0x0000, iwl22560_2ax_cfg_hr)}, 944 {IWL_PCI_DEVICE(0xA0F0, 0x0000, iwl_ax101_cfg_qu_hr)},
930 {IWL_PCI_DEVICE(0xA0F0, 0x0040, iwl22560_2ax_cfg_hr)}, 945 {IWL_PCI_DEVICE(0xA0F0, 0x0040, iwl_ax101_cfg_qu_hr)},
931 {IWL_PCI_DEVICE(0xA0F0, 0x0070, iwl22560_2ax_cfg_hr)}, 946 {IWL_PCI_DEVICE(0xA0F0, 0x0070, iwl_ax101_cfg_qu_hr)},
932 {IWL_PCI_DEVICE(0xA0F0, 0x0074, iwl22560_2ax_cfg_hr)}, 947 {IWL_PCI_DEVICE(0xA0F0, 0x0074, iwl_ax101_cfg_qu_hr)},
933 {IWL_PCI_DEVICE(0xA0F0, 0x0078, iwl22560_2ax_cfg_hr)}, 948 {IWL_PCI_DEVICE(0xA0F0, 0x0078, iwl_ax101_cfg_qu_hr)},
934 {IWL_PCI_DEVICE(0xA0F0, 0x007C, iwl22560_2ax_cfg_hr)}, 949 {IWL_PCI_DEVICE(0xA0F0, 0x007C, iwl_ax101_cfg_qu_hr)},
935 {IWL_PCI_DEVICE(0xA0F0, 0x00B0, iwl22560_2ax_cfg_hr)}, 950 {IWL_PCI_DEVICE(0xA0F0, 0x00B0, iwl_ax101_cfg_qu_hr)},
936 {IWL_PCI_DEVICE(0xA0F0, 0x0A10, iwl22560_2ax_cfg_hr)}, 951 {IWL_PCI_DEVICE(0xA0F0, 0x0A10, iwl_ax101_cfg_qu_hr)},
937 {IWL_PCI_DEVICE(0xA0F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)}, 952 {IWL_PCI_DEVICE(0xA0F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0)},
938 {IWL_PCI_DEVICE(0xA0F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)}, 953 {IWL_PCI_DEVICE(0xA0F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)},
939 {IWL_PCI_DEVICE(0xA0F0, 0x4070, iwl22560_2ax_cfg_hr)}, 954 {IWL_PCI_DEVICE(0xA0F0, 0x4070, iwl_ax101_cfg_qu_hr)},
940 955
941 {IWL_PCI_DEVICE(0x2723, 0x0080, iwl22260_2ax_cfg)}, 956 {IWL_PCI_DEVICE(0x2723, 0x0080, iwl22260_2ax_cfg)},
942 {IWL_PCI_DEVICE(0x2723, 0x0084, iwl22260_2ax_cfg)}, 957 {IWL_PCI_DEVICE(0x2723, 0x0084, iwl22260_2ax_cfg)},
943 {IWL_PCI_DEVICE(0x2723, 0x0088, iwl22260_2ax_cfg)}, 958 {IWL_PCI_DEVICE(0x2723, 0x0088, iwl22260_2ax_cfg)},
944 {IWL_PCI_DEVICE(0x2723, 0x008C, iwl22260_2ax_cfg)}, 959 {IWL_PCI_DEVICE(0x2723, 0x008C, iwl22260_2ax_cfg)},
960 {IWL_PCI_DEVICE(0x2723, 0x1653, killer1650w_2ax_cfg)},
961 {IWL_PCI_DEVICE(0x2723, 0x1654, killer1650x_2ax_cfg)},
945 {IWL_PCI_DEVICE(0x2723, 0x4080, iwl22260_2ax_cfg)}, 962 {IWL_PCI_DEVICE(0x2723, 0x4080, iwl22260_2ax_cfg)},
946 {IWL_PCI_DEVICE(0x2723, 0x4088, iwl22260_2ax_cfg)}, 963 {IWL_PCI_DEVICE(0x2723, 0x4088, iwl22260_2ax_cfg)},
947 964
948 {IWL_PCI_DEVICE(0x1a56, 0x1653, killer1650w_2ax_cfg)}, 965 {IWL_PCI_DEVICE(0x1a56, 0x1653, killer1650w_2ax_cfg)},
949 {IWL_PCI_DEVICE(0x1a56, 0x1654, killer1650x_2ax_cfg)}, 966 {IWL_PCI_DEVICE(0x1a56, 0x1654, killer1650x_2ax_cfg)},
950 967
968 {IWL_PCI_DEVICE(0x2725, 0x0090, iwlax210_2ax_cfg_so_hr_a0)},
969 {IWL_PCI_DEVICE(0x7A70, 0x0090, iwlax210_2ax_cfg_so_hr_a0)},
970 {IWL_PCI_DEVICE(0x7A70, 0x0310, iwlax210_2ax_cfg_so_hr_a0)},
971 {IWL_PCI_DEVICE(0x2725, 0x0020, iwlax210_2ax_cfg_so_hr_a0)},
972 {IWL_PCI_DEVICE(0x2725, 0x0310, iwlax210_2ax_cfg_so_hr_a0)},
973 {IWL_PCI_DEVICE(0x2725, 0x0A10, iwlax210_2ax_cfg_so_hr_a0)},
974 {IWL_PCI_DEVICE(0x2725, 0x00B0, iwlax210_2ax_cfg_so_hr_a0)},
975
951#endif /* CONFIG_IWLMVM */ 976#endif /* CONFIG_IWLMVM */
952 977
953 {0} 978 {0}
@@ -999,7 +1024,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
999 1024
1000 if (rf_id_chp == jf_chp_id) { 1025 if (rf_id_chp == jf_chp_id) {
1001 if (iwl_trans->hw_rev == CSR_HW_REV_TYPE_QNJ) 1026 if (iwl_trans->hw_rev == CSR_HW_REV_TYPE_QNJ)
1002 cfg = &iwl22000_2ax_cfg_qnj_jf_b0; 1027 cfg = &iwl9560_2ac_cfg_qnj_jf_b0;
1003 else 1028 else
1004 cfg = &iwl22000_2ac_cfg_jf; 1029 cfg = &iwl22000_2ac_cfg_jf;
1005 } else if (rf_id_chp == hr_chp_id) { 1030 } else if (rf_id_chp == hr_chp_id) {
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
index 0d16bcc3141f..bf8b61a476c5 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
@@ -8,7 +8,7 @@
8 * Copyright(c) 2003 - 2015 Intel Corporation. All rights reserved. 8 * Copyright(c) 2003 - 2015 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify it 13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of version 2 of the GNU General Public License as 14 * under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2003 - 2015 Intel Corporation. All rights reserved. 31 * Copyright(c) 2003 - 2015 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -400,6 +400,8 @@ struct iwl_txq {
400 u32 id; 400 u32 id;
401 int low_mark; 401 int low_mark;
402 int high_mark; 402 int high_mark;
403
404 bool overflow_tx;
403}; 405};
404 406
405static inline dma_addr_t 407static inline dma_addr_t
@@ -454,20 +456,6 @@ enum iwl_image_response_code {
454}; 456};
455 457
456/** 458/**
457 * struct iwl_self_init_dram - dram data used by self init process
458 * @fw: lmac and umac dram data
459 * @fw_cnt: total number of items in array
460 * @paging: paging dram data
461 * @paging_cnt: total number of items in array
462 */
463struct iwl_self_init_dram {
464 struct iwl_dram_data *fw;
465 int fw_cnt;
466 struct iwl_dram_data *paging;
467 int paging_cnt;
468};
469
470/**
471 * struct cont_rec: continuous recording data structure 459 * struct cont_rec: continuous recording data structure
472 * @prev_wr_ptr: the last address that was read in monitor_data 460 * @prev_wr_ptr: the last address that was read in monitor_data
473 * debugfs file 461 * debugfs file
@@ -538,6 +526,8 @@ struct cont_rec {
538 * @fh_mask: current unmasked fh causes 526 * @fh_mask: current unmasked fh causes
539 * @hw_mask: current unmasked hw causes 527 * @hw_mask: current unmasked hw causes
540 * @in_rescan: true if we have triggered a device rescan 528 * @in_rescan: true if we have triggered a device rescan
529 * @base_rb_stts: base virtual address of receive buffer status for all queues
530 * @base_rb_stts_dma: base physical address of receive buffer status
541 */ 531 */
542struct iwl_trans_pcie { 532struct iwl_trans_pcie {
543 struct iwl_rxq *rxq; 533 struct iwl_rxq *rxq;
@@ -554,7 +544,6 @@ struct iwl_trans_pcie {
554 dma_addr_t prph_info_dma_addr; 544 dma_addr_t prph_info_dma_addr;
555 dma_addr_t prph_scratch_dma_addr; 545 dma_addr_t prph_scratch_dma_addr;
556 dma_addr_t iml_dma_addr; 546 dma_addr_t iml_dma_addr;
557 struct iwl_self_init_dram init_dram;
558 struct iwl_trans *trans; 547 struct iwl_trans *trans;
559 548
560 struct net_device napi_dev; 549 struct net_device napi_dev;
@@ -630,6 +619,9 @@ struct iwl_trans_pcie {
630 cpumask_t affinity_mask[IWL_MAX_RX_HW_QUEUES]; 619 cpumask_t affinity_mask[IWL_MAX_RX_HW_QUEUES];
631 u16 tx_cmd_queue_size; 620 u16 tx_cmd_queue_size;
632 bool in_rescan; 621 bool in_rescan;
622
623 void *base_rb_stts;
624 dma_addr_t base_rb_stts_dma;
633}; 625};
634 626
635static inline struct iwl_trans_pcie * 627static inline struct iwl_trans_pcie *
@@ -813,8 +805,7 @@ static inline int iwl_pcie_ctxt_info_alloc_dma(struct iwl_trans *trans,
813 805
814static inline void iwl_pcie_ctxt_info_free_fw_img(struct iwl_trans *trans) 806static inline void iwl_pcie_ctxt_info_free_fw_img(struct iwl_trans *trans)
815{ 807{
816 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 808 struct iwl_self_init_dram *dram = &trans->init_dram;
817 struct iwl_self_init_dram *dram = &trans_pcie->init_dram;
818 int i; 809 int i;
819 810
820 if (!dram->fw) { 811 if (!dram->fw) {
@@ -1052,6 +1043,7 @@ static inline bool iwl_pcie_dbg_on(struct iwl_trans *trans)
1052 1043
1053void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state); 1044void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state);
1054void iwl_trans_pcie_dump_regs(struct iwl_trans *trans); 1045void iwl_trans_pcie_dump_regs(struct iwl_trans *trans);
1046void iwl_trans_sync_nmi(struct iwl_trans *trans);
1055 1047
1056#ifdef CONFIG_IWLWIFI_DEBUGFS 1048#ifdef CONFIG_IWLWIFI_DEBUGFS
1057int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans); 1049int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans);
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index c260d1251b5f..8d4f0628622b 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify it 13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of version 2 of the GNU General Public License as 14 * under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -202,9 +202,9 @@ int iwl_pcie_rx_stop(struct iwl_trans *trans)
202{ 202{
203 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) { 203 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) {
204 /* TODO: remove this for 22560 once fw does it */ 204 /* TODO: remove this for 22560 once fw does it */
205 iwl_write_prph(trans, RFH_RXF_DMA_CFG_GEN3, 0); 205 iwl_write_umac_prph(trans, RFH_RXF_DMA_CFG_GEN3, 0);
206 return iwl_poll_prph_bit(trans, RFH_GEN_STATUS_GEN3, 206 return iwl_poll_umac_prph_bit(trans, RFH_GEN_STATUS_GEN3,
207 RXF_DMA_IDLE, RXF_DMA_IDLE, 1000); 207 RXF_DMA_IDLE, RXF_DMA_IDLE, 1000);
208 } else if (trans->cfg->mq_rx_supported) { 208 } else if (trans->cfg->mq_rx_supported) {
209 iwl_write_prph(trans, RFH_RXF_DMA_CFG, 0); 209 iwl_write_prph(trans, RFH_RXF_DMA_CFG, 0);
210 return iwl_poll_prph_bit(trans, RFH_GEN_STATUS, 210 return iwl_poll_prph_bit(trans, RFH_GEN_STATUS,
@@ -247,7 +247,7 @@ static void iwl_pcie_rxq_inc_wr_ptr(struct iwl_trans *trans,
247 } 247 }
248 248
249 rxq->write_actual = round_down(rxq->write, 8); 249 rxq->write_actual = round_down(rxq->write, 8);
250 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) 250 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_22560)
251 iwl_write32(trans, HBUS_TARG_WRPTR, 251 iwl_write32(trans, HBUS_TARG_WRPTR,
252 (rxq->write_actual | 252 (rxq->write_actual |
253 ((FIRST_RX_QUEUE + rxq->id) << 16))); 253 ((FIRST_RX_QUEUE + rxq->id) << 16)));
@@ -538,9 +538,9 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)
538 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 538 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
539 struct iwl_rb_allocator *rba = &trans_pcie->rba; 539 struct iwl_rb_allocator *rba = &trans_pcie->rba;
540 struct list_head local_empty; 540 struct list_head local_empty;
541 int pending = atomic_xchg(&rba->req_pending, 0); 541 int pending = atomic_read(&rba->req_pending);
542 542
543 IWL_DEBUG_RX(trans, "Pending allocation requests = %d\n", pending); 543 IWL_DEBUG_TPT(trans, "Pending allocation requests = %d\n", pending);
544 544
545 /* If we were scheduled - there is at least one request */ 545 /* If we were scheduled - there is at least one request */
546 spin_lock(&rba->lock); 546 spin_lock(&rba->lock);
@@ -593,12 +593,15 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)
593 i++; 593 i++;
594 } 594 }
595 595
596 atomic_dec(&rba->req_pending);
596 pending--; 597 pending--;
598
597 if (!pending) { 599 if (!pending) {
598 pending = atomic_xchg(&rba->req_pending, 0); 600 pending = atomic_read(&rba->req_pending);
599 IWL_DEBUG_RX(trans, 601 if (pending)
600 "Pending allocation requests = %d\n", 602 IWL_DEBUG_TPT(trans,
601 pending); 603 "Got more pending allocation requests = %d\n",
604 pending);
602 } 605 }
603 606
604 spin_lock(&rba->lock); 607 spin_lock(&rba->lock);
@@ -609,12 +612,15 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)
609 spin_unlock(&rba->lock); 612 spin_unlock(&rba->lock);
610 613
611 atomic_inc(&rba->req_ready); 614 atomic_inc(&rba->req_ready);
615
612 } 616 }
613 617
614 spin_lock(&rba->lock); 618 spin_lock(&rba->lock);
615 /* return unused rbds to the allocator empty list */ 619 /* return unused rbds to the allocator empty list */
616 list_splice_tail(&local_empty, &rba->rbd_empty); 620 list_splice_tail(&local_empty, &rba->rbd_empty);
617 spin_unlock(&rba->lock); 621 spin_unlock(&rba->lock);
622
623 IWL_DEBUG_TPT(trans, "%s, exit.\n", __func__);
618} 624}
619 625
620/* 626/*
@@ -696,11 +702,6 @@ static void iwl_pcie_free_rxq_dma(struct iwl_trans *trans,
696 rxq->bd_dma = 0; 702 rxq->bd_dma = 0;
697 rxq->bd = NULL; 703 rxq->bd = NULL;
698 704
699 if (rxq->rb_stts)
700 dma_free_coherent(trans->dev,
701 use_rx_td ? sizeof(__le16) :
702 sizeof(struct iwl_rb_status),
703 rxq->rb_stts, rxq->rb_stts_dma);
704 rxq->rb_stts_dma = 0; 705 rxq->rb_stts_dma = 0;
705 rxq->rb_stts = NULL; 706 rxq->rb_stts = NULL;
706 707
@@ -737,6 +738,8 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,
737 int free_size; 738 int free_size;
738 bool use_rx_td = (trans->cfg->device_family >= 739 bool use_rx_td = (trans->cfg->device_family >=
739 IWL_DEVICE_FAMILY_22560); 740 IWL_DEVICE_FAMILY_22560);
741 size_t rb_stts_size = use_rx_td ? sizeof(__le16) :
742 sizeof(struct iwl_rb_status);
740 743
741 spin_lock_init(&rxq->lock); 744 spin_lock_init(&rxq->lock);
742 if (trans->cfg->mq_rx_supported) 745 if (trans->cfg->mq_rx_supported)
@@ -764,12 +767,9 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,
764 goto err; 767 goto err;
765 } 768 }
766 769
767 /* Allocate the driver's pointer to receive buffer status */ 770 rxq->rb_stts = trans_pcie->base_rb_stts + rxq->id * rb_stts_size;
768 rxq->rb_stts = dma_alloc_coherent(dev, 771 rxq->rb_stts_dma =
769 use_rx_td ? sizeof(__le16) : sizeof(struct iwl_rb_status), 772 trans_pcie->base_rb_stts_dma + rxq->id * rb_stts_size;
770 &rxq->rb_stts_dma, GFP_KERNEL);
771 if (!rxq->rb_stts)
772 goto err;
773 773
774 if (!use_rx_td) 774 if (!use_rx_td)
775 return 0; 775 return 0;
@@ -799,7 +799,6 @@ err:
799 799
800 iwl_pcie_free_rxq_dma(trans, rxq); 800 iwl_pcie_free_rxq_dma(trans, rxq);
801 } 801 }
802 kfree(trans_pcie->rxq);
803 802
804 return -ENOMEM; 803 return -ENOMEM;
805} 804}
@@ -809,6 +808,9 @@ int iwl_pcie_rx_alloc(struct iwl_trans *trans)
809 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 808 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
810 struct iwl_rb_allocator *rba = &trans_pcie->rba; 809 struct iwl_rb_allocator *rba = &trans_pcie->rba;
811 int i, ret; 810 int i, ret;
811 size_t rb_stts_size = trans->cfg->device_family >=
812 IWL_DEVICE_FAMILY_22560 ?
813 sizeof(__le16) : sizeof(struct iwl_rb_status);
812 814
813 if (WARN_ON(trans_pcie->rxq)) 815 if (WARN_ON(trans_pcie->rxq))
814 return -EINVAL; 816 return -EINVAL;
@@ -816,18 +818,46 @@ int iwl_pcie_rx_alloc(struct iwl_trans *trans)
816 trans_pcie->rxq = kcalloc(trans->num_rx_queues, sizeof(struct iwl_rxq), 818 trans_pcie->rxq = kcalloc(trans->num_rx_queues, sizeof(struct iwl_rxq),
817 GFP_KERNEL); 819 GFP_KERNEL);
818 if (!trans_pcie->rxq) 820 if (!trans_pcie->rxq)
819 return -EINVAL; 821 return -ENOMEM;
820 822
821 spin_lock_init(&rba->lock); 823 spin_lock_init(&rba->lock);
822 824
825 /*
826 * Allocate the driver's pointer to receive buffer status.
827 * Allocate for all queues continuously (HW requirement).
828 */
829 trans_pcie->base_rb_stts =
830 dma_alloc_coherent(trans->dev,
831 rb_stts_size * trans->num_rx_queues,
832 &trans_pcie->base_rb_stts_dma,
833 GFP_KERNEL);
834 if (!trans_pcie->base_rb_stts) {
835 ret = -ENOMEM;
836 goto err;
837 }
838
823 for (i = 0; i < trans->num_rx_queues; i++) { 839 for (i = 0; i < trans->num_rx_queues; i++) {
824 struct iwl_rxq *rxq = &trans_pcie->rxq[i]; 840 struct iwl_rxq *rxq = &trans_pcie->rxq[i];
825 841
842 rxq->id = i;
826 ret = iwl_pcie_alloc_rxq_dma(trans, rxq); 843 ret = iwl_pcie_alloc_rxq_dma(trans, rxq);
827 if (ret) 844 if (ret)
828 return ret; 845 goto err;
829 } 846 }
830 return 0; 847 return 0;
848
849err:
850 if (trans_pcie->base_rb_stts) {
851 dma_free_coherent(trans->dev,
852 rb_stts_size * trans->num_rx_queues,
853 trans_pcie->base_rb_stts,
854 trans_pcie->base_rb_stts_dma);
855 trans_pcie->base_rb_stts = NULL;
856 trans_pcie->base_rb_stts_dma = 0;
857 }
858 kfree(trans_pcie->rxq);
859
860 return ret;
831} 861}
832 862
833static void iwl_pcie_rx_hw_init(struct iwl_trans *trans, struct iwl_rxq *rxq) 863static void iwl_pcie_rx_hw_init(struct iwl_trans *trans, struct iwl_rxq *rxq)
@@ -1036,8 +1066,6 @@ int _iwl_pcie_rx_init(struct iwl_trans *trans)
1036 for (i = 0; i < trans->num_rx_queues; i++) { 1066 for (i = 0; i < trans->num_rx_queues; i++) {
1037 struct iwl_rxq *rxq = &trans_pcie->rxq[i]; 1067 struct iwl_rxq *rxq = &trans_pcie->rxq[i];
1038 1068
1039 rxq->id = i;
1040
1041 spin_lock(&rxq->lock); 1069 spin_lock(&rxq->lock);
1042 /* 1070 /*
1043 * Set read write pointer to reflect that we have processed 1071 * Set read write pointer to reflect that we have processed
@@ -1124,6 +1152,9 @@ void iwl_pcie_rx_free(struct iwl_trans *trans)
1124 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1152 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1125 struct iwl_rb_allocator *rba = &trans_pcie->rba; 1153 struct iwl_rb_allocator *rba = &trans_pcie->rba;
1126 int i; 1154 int i;
1155 size_t rb_stts_size = trans->cfg->device_family >=
1156 IWL_DEVICE_FAMILY_22560 ?
1157 sizeof(__le16) : sizeof(struct iwl_rb_status);
1127 1158
1128 /* 1159 /*
1129 * if rxq is NULL, it means that nothing has been allocated, 1160 * if rxq is NULL, it means that nothing has been allocated,
@@ -1138,6 +1169,15 @@ void iwl_pcie_rx_free(struct iwl_trans *trans)
1138 1169
1139 iwl_pcie_free_rbs_pool(trans); 1170 iwl_pcie_free_rbs_pool(trans);
1140 1171
1172 if (trans_pcie->base_rb_stts) {
1173 dma_free_coherent(trans->dev,
1174 rb_stts_size * trans->num_rx_queues,
1175 trans_pcie->base_rb_stts,
1176 trans_pcie->base_rb_stts_dma);
1177 trans_pcie->base_rb_stts = NULL;
1178 trans_pcie->base_rb_stts_dma = 0;
1179 }
1180
1141 for (i = 0; i < trans->num_rx_queues; i++) { 1181 for (i = 0; i < trans->num_rx_queues; i++) {
1142 struct iwl_rxq *rxq = &trans_pcie->rxq[i]; 1182 struct iwl_rxq *rxq = &trans_pcie->rxq[i];
1143 1183
@@ -1424,6 +1464,9 @@ restart:
1424 !emergency)) { 1464 !emergency)) {
1425 iwl_pcie_rx_move_to_allocator(rxq, rba); 1465 iwl_pcie_rx_move_to_allocator(rxq, rba);
1426 emergency = true; 1466 emergency = true;
1467 IWL_DEBUG_TPT(trans,
1468 "RX path is in emergency. Pending allocations %d\n",
1469 rb_pending_alloc);
1427 } 1470 }
1428 1471
1429 IWL_DEBUG_RX(trans, "Q %d: HW = %d, SW = %d\n", rxq->id, r, i); 1472 IWL_DEBUG_RX(trans, "Q %d: HW = %d, SW = %d\n", rxq->id, r, i);
@@ -1453,8 +1496,12 @@ restart:
1453 count++; 1496 count++;
1454 if (count == 8) { 1497 if (count == 8) {
1455 count = 0; 1498 count = 0;
1456 if (rb_pending_alloc < rxq->queue_size / 3) 1499 if (rb_pending_alloc < rxq->queue_size / 3) {
1500 IWL_DEBUG_TPT(trans,
1501 "RX path exited emergency. Pending allocations %d\n",
1502 rb_pending_alloc);
1457 emergency = false; 1503 emergency = false;
1504 }
1458 1505
1459 rxq->read = i; 1506 rxq->read = i;
1460 spin_unlock(&rxq->lock); 1507 spin_unlock(&rxq->lock);
@@ -2120,7 +2167,7 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id)
2120 } 2167 }
2121 } 2168 }
2122 2169
2123 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560 && 2170 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_22560 &&
2124 inta_hw & MSIX_HW_INT_CAUSES_REG_IPC) { 2171 inta_hw & MSIX_HW_INT_CAUSES_REG_IPC) {
2125 /* Reflect IML transfer status */ 2172 /* Reflect IML transfer status */
2126 int res = iwl_read32(trans, CSR_IML_RESP_ADDR); 2173 int res = iwl_read32(trans, CSR_IML_RESP_ADDR);
@@ -2139,6 +2186,17 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id)
2139 isr_stats->wakeup++; 2186 isr_stats->wakeup++;
2140 } 2187 }
2141 2188
2189 if (inta_hw & MSIX_HW_INT_CAUSES_REG_IML) {
2190 /* Reflect IML transfer status */
2191 int res = iwl_read32(trans, CSR_IML_RESP_ADDR);
2192
2193 IWL_DEBUG_ISR(trans, "IML transfer status: %d\n", res);
2194 if (res == IWL_IMAGE_RESP_FAIL) {
2195 isr_stats->sw++;
2196 iwl_pcie_irq_handle_error(trans);
2197 }
2198 }
2199
2142 /* Chip got too hot and stopped itself */ 2200 /* Chip got too hot and stopped itself */
2143 if (inta_hw & MSIX_HW_INT_CAUSES_REG_CT_KILL) { 2201 if (inta_hw & MSIX_HW_INT_CAUSES_REG_CT_KILL) {
2144 IWL_ERR(trans, "Microcode CT kill error detected.\n"); 2202 IWL_ERR(trans, "Microcode CT kill error detected.\n");
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
index 77f3610e5ca9..9c203ca75de9 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
@@ -92,26 +92,9 @@ int iwl_pcie_gen2_apm_init(struct iwl_trans *trans)
92 92
93 iwl_pcie_apm_config(trans); 93 iwl_pcie_apm_config(trans);
94 94
95 /* 95 ret = iwl_finish_nic_init(trans);
96 * Set "initialization complete" bit to move adapter from 96 if (ret)
97 * D0U* --> D0A* (powered-up active) state.
98 */
99 iwl_set_bit(trans, CSR_GP_CNTRL,
100 BIT(trans->cfg->csr->flag_init_done));
101
102 /*
103 * Wait for clock stabilization; once stabilized, access to
104 * device-internal resources is supported, e.g. iwl_write_prph()
105 * and accesses to uCode SRAM.
106 */
107 ret = iwl_poll_bit(trans, CSR_GP_CNTRL,
108 BIT(trans->cfg->csr->flag_mac_clock_ready),
109 BIT(trans->cfg->csr->flag_mac_clock_ready),
110 25000);
111 if (ret < 0) {
112 IWL_DEBUG_INFO(trans, "Failed to init the card\n");
113 return ret; 97 return ret;
114 }
115 98
116 set_bit(STATUS_DEVICE_ENABLED, &trans->status); 99 set_bit(STATUS_DEVICE_ENABLED, &trans->status);
117 100
@@ -188,7 +171,7 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
188 } 171 }
189 172
190 iwl_pcie_ctxt_info_free_paging(trans); 173 iwl_pcie_ctxt_info_free_paging(trans);
191 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_22560) 174 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560)
192 iwl_pcie_ctxt_info_gen3_free(trans); 175 iwl_pcie_ctxt_info_gen3_free(trans);
193 else 176 else
194 iwl_pcie_ctxt_info_free(trans); 177 iwl_pcie_ctxt_info_free(trans);
@@ -251,6 +234,7 @@ void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
251static int iwl_pcie_gen2_nic_init(struct iwl_trans *trans) 234static int iwl_pcie_gen2_nic_init(struct iwl_trans *trans)
252{ 235{
253 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 236 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
237 int queue_size = max_t(u32, TFD_CMD_SLOTS, trans->cfg->min_txq_size);
254 238
255 /* TODO: most of the logic can be removed in A0 - but not in Z0 */ 239 /* TODO: most of the logic can be removed in A0 - but not in Z0 */
256 spin_lock(&trans_pcie->irq_lock); 240 spin_lock(&trans_pcie->irq_lock);
@@ -264,7 +248,7 @@ static int iwl_pcie_gen2_nic_init(struct iwl_trans *trans)
264 return -ENOMEM; 248 return -ENOMEM;
265 249
266 /* Allocate or reset and init all Tx and Command queues */ 250 /* Allocate or reset and init all Tx and Command queues */
267 if (iwl_pcie_gen2_tx_init(trans, trans_pcie->cmd_queue, TFD_CMD_SLOTS)) 251 if (iwl_pcie_gen2_tx_init(trans, trans_pcie->cmd_queue, queue_size))
268 return -ENOMEM; 252 return -ENOMEM;
269 253
270 /* enable shadow regs in HW */ 254 /* enable shadow regs in HW */
@@ -349,7 +333,7 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans,
349 goto out; 333 goto out;
350 } 334 }
351 335
352 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_22560) 336 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560)
353 ret = iwl_pcie_ctxt_info_gen3_init(trans, fw); 337 ret = iwl_pcie_ctxt_info_gen3_init(trans, fw);
354 else 338 else
355 ret = iwl_pcie_ctxt_info_init(trans, fw); 339 ret = iwl_pcie_ctxt_info_init(trans, fw);
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index f74281508197..fe8269d023de 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2007 - 2015 Intel Corporation. All rights reserved. 8 * Copyright(c) 2007 - 2015 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2005 - 2015 Intel Corporation. All rights reserved. 31 * Copyright(c) 2005 - 2015 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -364,26 +364,9 @@ static int iwl_pcie_apm_init(struct iwl_trans *trans)
364 if (trans->cfg->base_params->pll_cfg) 364 if (trans->cfg->base_params->pll_cfg)
365 iwl_set_bit(trans, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL); 365 iwl_set_bit(trans, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
366 366
367 /* 367 ret = iwl_finish_nic_init(trans);
368 * Set "initialization complete" bit to move adapter from 368 if (ret)
369 * D0U* --> D0A* (powered-up active) state.
370 */
371 iwl_set_bit(trans, CSR_GP_CNTRL,
372 BIT(trans->cfg->csr->flag_init_done));
373
374 /*
375 * Wait for clock stabilization; once stabilized, access to
376 * device-internal resources is supported, e.g. iwl_write_prph()
377 * and accesses to uCode SRAM.
378 */
379 ret = iwl_poll_bit(trans, CSR_GP_CNTRL,
380 BIT(trans->cfg->csr->flag_mac_clock_ready),
381 BIT(trans->cfg->csr->flag_mac_clock_ready),
382 25000);
383 if (ret < 0) {
384 IWL_ERR(trans, "Failed to init the card\n");
385 return ret; 369 return ret;
386 }
387 370
388 if (trans->cfg->host_interrupt_operation_mode) { 371 if (trans->cfg->host_interrupt_operation_mode) {
389 /* 372 /*
@@ -453,23 +436,8 @@ static void iwl_pcie_apm_lp_xtal_enable(struct iwl_trans *trans)
453 436
454 iwl_trans_pcie_sw_reset(trans); 437 iwl_trans_pcie_sw_reset(trans);
455 438
456 /* 439 ret = iwl_finish_nic_init(trans);
457 * Set "initialization complete" bit to move adapter from 440 if (WARN_ON(ret)) {
458 * D0U* --> D0A* (powered-up active) state.
459 */
460 iwl_set_bit(trans, CSR_GP_CNTRL,
461 BIT(trans->cfg->csr->flag_init_done));
462
463 /*
464 * Wait for clock stabilization; once stabilized, access to
465 * device-internal resources is possible.
466 */
467 ret = iwl_poll_bit(trans, CSR_GP_CNTRL,
468 BIT(trans->cfg->csr->flag_mac_clock_ready),
469 BIT(trans->cfg->csr->flag_mac_clock_ready),
470 25000);
471 if (WARN_ON(ret < 0)) {
472 IWL_ERR(trans, "Access time out - failed to enable LP XTAL\n");
473 /* Release XTAL ON request */ 441 /* Release XTAL ON request */
474 __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, 442 __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
475 CSR_GP_CNTRL_REG_FLAG_XTAL_ON); 443 CSR_GP_CNTRL_REG_FLAG_XTAL_ON);
@@ -928,13 +896,13 @@ void iwl_pcie_apply_destination(struct iwl_trans *trans)
928 if (!trans->num_blocks) 896 if (!trans->num_blocks)
929 return; 897 return;
930 898
931 iwl_write_prph(trans, MON_BUFF_BASE_ADDR_VER2, 899 iwl_write_umac_prph(trans, MON_BUFF_BASE_ADDR_VER2,
932 trans->fw_mon[0].physical >> 900 trans->fw_mon[0].physical >>
933 MON_BUFF_SHIFT_VER2); 901 MON_BUFF_SHIFT_VER2);
934 iwl_write_prph(trans, MON_BUFF_END_ADDR_VER2, 902 iwl_write_umac_prph(trans, MON_BUFF_END_ADDR_VER2,
935 (trans->fw_mon[0].physical + 903 (trans->fw_mon[0].physical +
936 trans->fw_mon[0].size - 256) >> 904 trans->fw_mon[0].size - 256) >>
937 MON_BUFF_SHIFT_VER2); 905 MON_BUFF_SHIFT_VER2);
938 return; 906 return;
939 } 907 }
940 908
@@ -1126,6 +1094,7 @@ static struct iwl_causes_list causes_list[] = {
1126 {MSIX_FH_INT_CAUSES_FH_ERR, CSR_MSIX_FH_INT_MASK_AD, 0x5}, 1094 {MSIX_FH_INT_CAUSES_FH_ERR, CSR_MSIX_FH_INT_MASK_AD, 0x5},
1127 {MSIX_HW_INT_CAUSES_REG_ALIVE, CSR_MSIX_HW_INT_MASK_AD, 0x10}, 1095 {MSIX_HW_INT_CAUSES_REG_ALIVE, CSR_MSIX_HW_INT_MASK_AD, 0x10},
1128 {MSIX_HW_INT_CAUSES_REG_WAKEUP, CSR_MSIX_HW_INT_MASK_AD, 0x11}, 1096 {MSIX_HW_INT_CAUSES_REG_WAKEUP, CSR_MSIX_HW_INT_MASK_AD, 0x11},
1097 {MSIX_HW_INT_CAUSES_REG_IML, CSR_MSIX_HW_INT_MASK_AD, 0x12},
1129 {MSIX_HW_INT_CAUSES_REG_CT_KILL, CSR_MSIX_HW_INT_MASK_AD, 0x16}, 1098 {MSIX_HW_INT_CAUSES_REG_CT_KILL, CSR_MSIX_HW_INT_MASK_AD, 0x16},
1130 {MSIX_HW_INT_CAUSES_REG_RF_KILL, CSR_MSIX_HW_INT_MASK_AD, 0x17}, 1099 {MSIX_HW_INT_CAUSES_REG_RF_KILL, CSR_MSIX_HW_INT_MASK_AD, 0x17},
1131 {MSIX_HW_INT_CAUSES_REG_PERIODIC, CSR_MSIX_HW_INT_MASK_AD, 0x18}, 1100 {MSIX_HW_INT_CAUSES_REG_PERIODIC, CSR_MSIX_HW_INT_MASK_AD, 0x18},
@@ -1158,7 +1127,7 @@ static void iwl_pcie_map_non_rx_causes(struct iwl_trans *trans)
1158 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1127 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1159 int val = trans_pcie->def_irq | MSIX_NON_AUTO_CLEAR_CAUSE; 1128 int val = trans_pcie->def_irq | MSIX_NON_AUTO_CLEAR_CAUSE;
1160 int i, arr_size = 1129 int i, arr_size =
1161 (trans->cfg->device_family < IWL_DEVICE_FAMILY_22560) ? 1130 (trans->cfg->device_family != IWL_DEVICE_FAMILY_22560) ?
1162 ARRAY_SIZE(causes_list) : ARRAY_SIZE(causes_list_v2); 1131 ARRAY_SIZE(causes_list) : ARRAY_SIZE(causes_list_v2);
1163 1132
1164 /* 1133 /*
@@ -1168,7 +1137,7 @@ static void iwl_pcie_map_non_rx_causes(struct iwl_trans *trans)
1168 */ 1137 */
1169 for (i = 0; i < arr_size; i++) { 1138 for (i = 0; i < arr_size; i++) {
1170 struct iwl_causes_list *causes = 1139 struct iwl_causes_list *causes =
1171 (trans->cfg->device_family < IWL_DEVICE_FAMILY_22560) ? 1140 (trans->cfg->device_family != IWL_DEVICE_FAMILY_22560) ?
1172 causes_list : causes_list_v2; 1141 causes_list : causes_list_v2;
1173 1142
1174 iwl_write8(trans, CSR_MSIX_IVAR(causes[i].addr), val); 1143 iwl_write8(trans, CSR_MSIX_IVAR(causes[i].addr), val);
@@ -1214,8 +1183,8 @@ void iwl_pcie_conf_msix_hw(struct iwl_trans_pcie *trans_pcie)
1214 if (!trans_pcie->msix_enabled) { 1183 if (!trans_pcie->msix_enabled) {
1215 if (trans->cfg->mq_rx_supported && 1184 if (trans->cfg->mq_rx_supported &&
1216 test_bit(STATUS_DEVICE_ENABLED, &trans->status)) 1185 test_bit(STATUS_DEVICE_ENABLED, &trans->status))
1217 iwl_write_prph(trans, UREG_CHICK, 1186 iwl_write_umac_prph(trans, UREG_CHICK,
1218 UREG_CHICK_MSI_ENABLE); 1187 UREG_CHICK_MSI_ENABLE);
1219 return; 1188 return;
1220 } 1189 }
1221 /* 1190 /*
@@ -1224,7 +1193,7 @@ void iwl_pcie_conf_msix_hw(struct iwl_trans_pcie *trans_pcie)
1224 * prph. 1193 * prph.
1225 */ 1194 */
1226 if (test_bit(STATUS_DEVICE_ENABLED, &trans->status)) 1195 if (test_bit(STATUS_DEVICE_ENABLED, &trans->status))
1227 iwl_write_prph(trans, UREG_CHICK, UREG_CHICK_MSIX_ENABLE); 1196 iwl_write_umac_prph(trans, UREG_CHICK, UREG_CHICK_MSIX_ENABLE);
1228 1197
1229 /* 1198 /*
1230 * Each cause from the causes list above and the RX causes is 1199 * Each cause from the causes list above and the RX causes is
@@ -1558,20 +1527,10 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
1558 1527
1559 iwl_set_bit(trans, CSR_GP_CNTRL, 1528 iwl_set_bit(trans, CSR_GP_CNTRL,
1560 BIT(trans->cfg->csr->flag_mac_access_req)); 1529 BIT(trans->cfg->csr->flag_mac_access_req));
1561 iwl_set_bit(trans, CSR_GP_CNTRL,
1562 BIT(trans->cfg->csr->flag_init_done));
1563
1564 if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_8000)
1565 udelay(2);
1566 1530
1567 ret = iwl_poll_bit(trans, CSR_GP_CNTRL, 1531 ret = iwl_finish_nic_init(trans);
1568 BIT(trans->cfg->csr->flag_mac_clock_ready), 1532 if (ret)
1569 BIT(trans->cfg->csr->flag_mac_clock_ready),
1570 25000);
1571 if (ret < 0) {
1572 IWL_ERR(trans, "Failed to resume the device (mac ready)\n");
1573 return ret; 1533 return ret;
1574 }
1575 1534
1576 /* 1535 /*
1577 * Reconfigure IVAR table in case of MSIX or reset ict table in 1536 * Reconfigure IVAR table in case of MSIX or reset ict table in
@@ -1602,7 +1561,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
1602 } 1561 }
1603 1562
1604 IWL_DEBUG_POWER(trans, "WFPM value upon resume = 0x%08X\n", 1563 IWL_DEBUG_POWER(trans, "WFPM value upon resume = 0x%08X\n",
1605 iwl_read_prph(trans, WFPM_GP2)); 1564 iwl_read_umac_prph(trans, WFPM_GP2));
1606 1565
1607 val = iwl_read32(trans, CSR_RESET); 1566 val = iwl_read32(trans, CSR_RESET);
1608 if (val & CSR_RESET_REG_FLAG_NEVO_RESET) 1567 if (val & CSR_RESET_REG_FLAG_NEVO_RESET)
@@ -1751,15 +1710,18 @@ static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power)
1751 return err; 1710 return err;
1752 } 1711 }
1753 1712
1754 hpm = iwl_trans_read_prph(trans, HPM_DEBUG); 1713 hpm = iwl_read_umac_prph_no_grab(trans, HPM_DEBUG);
1755 if (hpm != 0xa5a5a5a0 && (hpm & PERSISTENCE_BIT)) { 1714 if (hpm != 0xa5a5a5a0 && (hpm & PERSISTENCE_BIT)) {
1756 if (iwl_trans_read_prph(trans, PREG_PRPH_WPROT_0) & 1715 int wfpm_val = iwl_read_umac_prph_no_grab(trans,
1757 PREG_WFPM_ACCESS) { 1716 PREG_PRPH_WPROT_0);
1717
1718 if (wfpm_val & PREG_WFPM_ACCESS) {
1758 IWL_ERR(trans, 1719 IWL_ERR(trans,
1759 "Error, can not clear persistence bit\n"); 1720 "Error, can not clear persistence bit\n");
1760 return -EPERM; 1721 return -EPERM;
1761 } 1722 }
1762 iwl_trans_write_prph(trans, HPM_DEBUG, hpm & ~PERSISTENCE_BIT); 1723 iwl_write_umac_prph_no_grab(trans, HPM_DEBUG,
1724 hpm & ~PERSISTENCE_BIT);
1763 } 1725 }
1764 1726
1765 iwl_trans_pcie_sw_reset(trans); 1727 iwl_trans_pcie_sw_reset(trans);
@@ -2281,6 +2243,7 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, int txq_idx)
2281 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 2243 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
2282 struct iwl_txq *txq; 2244 struct iwl_txq *txq;
2283 unsigned long now = jiffies; 2245 unsigned long now = jiffies;
2246 bool overflow_tx;
2284 u8 wr_ptr; 2247 u8 wr_ptr;
2285 2248
2286 /* Make sure the NIC is still alive in the bus */ 2249 /* Make sure the NIC is still alive in the bus */
@@ -2292,18 +2255,37 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, int txq_idx)
2292 2255
2293 IWL_DEBUG_TX_QUEUES(trans, "Emptying queue %d...\n", txq_idx); 2256 IWL_DEBUG_TX_QUEUES(trans, "Emptying queue %d...\n", txq_idx);
2294 txq = trans_pcie->txq[txq_idx]; 2257 txq = trans_pcie->txq[txq_idx];
2258
2259 spin_lock_bh(&txq->lock);
2260 overflow_tx = txq->overflow_tx ||
2261 !skb_queue_empty(&txq->overflow_q);
2262 spin_unlock_bh(&txq->lock);
2263
2295 wr_ptr = READ_ONCE(txq->write_ptr); 2264 wr_ptr = READ_ONCE(txq->write_ptr);
2296 2265
2297 while (txq->read_ptr != READ_ONCE(txq->write_ptr) && 2266 while ((txq->read_ptr != READ_ONCE(txq->write_ptr) ||
2267 overflow_tx) &&
2298 !time_after(jiffies, 2268 !time_after(jiffies,
2299 now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS))) { 2269 now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS))) {
2300 u8 write_ptr = READ_ONCE(txq->write_ptr); 2270 u8 write_ptr = READ_ONCE(txq->write_ptr);
2301 2271
2302 if (WARN_ONCE(wr_ptr != write_ptr, 2272 /*
2273 * If write pointer moved during the wait, warn only
2274 * if the TX came from op mode. In case TX came from
2275 * trans layer (overflow TX) don't warn.
2276 */
2277 if (WARN_ONCE(wr_ptr != write_ptr && !overflow_tx,
2303 "WR pointer moved while flushing %d -> %d\n", 2278 "WR pointer moved while flushing %d -> %d\n",
2304 wr_ptr, write_ptr)) 2279 wr_ptr, write_ptr))
2305 return -ETIMEDOUT; 2280 return -ETIMEDOUT;
2281 wr_ptr = write_ptr;
2282
2306 usleep_range(1000, 2000); 2283 usleep_range(1000, 2000);
2284
2285 spin_lock_bh(&txq->lock);
2286 overflow_tx = txq->overflow_tx ||
2287 !skb_queue_empty(&txq->overflow_q);
2288 spin_unlock_bh(&txq->lock);
2307 } 2289 }
2308 2290
2309 if (txq->read_ptr != txq->write_ptr) { 2291 if (txq->read_ptr != txq->write_ptr) {
@@ -2989,7 +2971,8 @@ static u32 iwl_trans_pcie_fh_regs_dump(struct iwl_trans *trans,
2989 i += sizeof(u32)) 2971 i += sizeof(u32))
2990 *val++ = cpu_to_le32(iwl_trans_pcie_read32(trans, i)); 2972 *val++ = cpu_to_le32(iwl_trans_pcie_read32(trans, i));
2991 else 2973 else
2992 for (i = FH_MEM_LOWER_BOUND_GEN2; i < FH_MEM_UPPER_BOUND_GEN2; 2974 for (i = iwl_umac_prph(trans, FH_MEM_LOWER_BOUND_GEN2);
2975 i < iwl_umac_prph(trans, FH_MEM_UPPER_BOUND_GEN2);
2993 i += sizeof(u32)) 2976 i += sizeof(u32))
2994 *val++ = cpu_to_le32(iwl_trans_pcie_read_prph(trans, 2977 *val++ = cpu_to_le32(iwl_trans_pcie_read_prph(trans,
2995 i)); 2978 i));
@@ -3014,11 +2997,11 @@ iwl_trans_pci_dump_marbh_monitor(struct iwl_trans *trans,
3014 if (!iwl_trans_grab_nic_access(trans, &flags)) 2997 if (!iwl_trans_grab_nic_access(trans, &flags))
3015 return 0; 2998 return 0;
3016 2999
3017 iwl_write_prph_no_grab(trans, MON_DMARB_RD_CTL_ADDR, 0x1); 3000 iwl_write_umac_prph_no_grab(trans, MON_DMARB_RD_CTL_ADDR, 0x1);
3018 for (i = 0; i < buf_size_in_dwords; i++) 3001 for (i = 0; i < buf_size_in_dwords; i++)
3019 buffer[i] = iwl_read_prph_no_grab(trans, 3002 buffer[i] = iwl_read_umac_prph_no_grab(trans,
3020 MON_DMARB_RD_DATA_ADDR); 3003 MON_DMARB_RD_DATA_ADDR);
3021 iwl_write_prph_no_grab(trans, MON_DMARB_RD_CTL_ADDR, 0x0); 3004 iwl_write_umac_prph_no_grab(trans, MON_DMARB_RD_CTL_ADDR, 0x0);
3022 3005
3023 iwl_trans_release_nic_access(trans, &flags); 3006 iwl_trans_release_nic_access(trans, &flags);
3024 3007
@@ -3033,9 +3016,9 @@ iwl_trans_pcie_dump_pointers(struct iwl_trans *trans,
3033 3016
3034 /* If there was a dest TLV - use the values from there */ 3017 /* If there was a dest TLV - use the values from there */
3035 if (trans->ini_valid) { 3018 if (trans->ini_valid) {
3036 base = MON_BUFF_BASE_ADDR_VER2; 3019 base = iwl_umac_prph(trans, MON_BUFF_BASE_ADDR_VER2);
3037 write_ptr = MON_BUFF_WRPTR_VER2; 3020 write_ptr = iwl_umac_prph(trans, MON_BUFF_WRPTR_VER2);
3038 wrap_cnt = MON_BUFF_CYCLE_CNT_VER2; 3021 wrap_cnt = iwl_umac_prph(trans, MON_BUFF_CYCLE_CNT_VER2);
3039 } else if (trans->dbg_dest_tlv) { 3022 } else if (trans->dbg_dest_tlv) {
3040 write_ptr = le32_to_cpu(trans->dbg_dest_tlv->write_ptr_reg); 3023 write_ptr = le32_to_cpu(trans->dbg_dest_tlv->write_ptr_reg);
3041 wrap_cnt = le32_to_cpu(trans->dbg_dest_tlv->wrap_count); 3024 wrap_cnt = le32_to_cpu(trans->dbg_dest_tlv->wrap_count);
@@ -3197,8 +3180,8 @@ static struct iwl_trans_dump_data
3197 if (dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS)) { 3180 if (dump_mask & BIT(IWL_FW_ERROR_DUMP_FH_REGS)) {
3198 if (trans->cfg->gen2) 3181 if (trans->cfg->gen2)
3199 len += sizeof(*data) + 3182 len += sizeof(*data) +
3200 (FH_MEM_UPPER_BOUND_GEN2 - 3183 (iwl_umac_prph(trans, FH_MEM_UPPER_BOUND_GEN2) -
3201 FH_MEM_LOWER_BOUND_GEN2); 3184 iwl_umac_prph(trans, FH_MEM_LOWER_BOUND_GEN2));
3202 else 3185 else
3203 len += sizeof(*data) + 3186 len += sizeof(*data) +
3204 (FH_MEM_UPPER_BOUND - 3187 (FH_MEM_UPPER_BOUND -
@@ -3220,10 +3203,10 @@ static struct iwl_trans_dump_data
3220 3203
3221 /* Paged memory for gen2 HW */ 3204 /* Paged memory for gen2 HW */
3222 if (trans->cfg->gen2 && dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING)) 3205 if (trans->cfg->gen2 && dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING))
3223 for (i = 0; i < trans_pcie->init_dram.paging_cnt; i++) 3206 for (i = 0; i < trans->init_dram.paging_cnt; i++)
3224 len += sizeof(*data) + 3207 len += sizeof(*data) +
3225 sizeof(struct iwl_fw_error_dump_paging) + 3208 sizeof(struct iwl_fw_error_dump_paging) +
3226 trans_pcie->init_dram.paging[i].size; 3209 trans->init_dram.paging[i].size;
3227 3210
3228 dump_data = vzalloc(len); 3211 dump_data = vzalloc(len);
3229 if (!dump_data) 3212 if (!dump_data)
@@ -3275,20 +3258,16 @@ static struct iwl_trans_dump_data
3275 3258
3276 /* Paged memory for gen2 HW */ 3259 /* Paged memory for gen2 HW */
3277 if (trans->cfg->gen2 && dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING)) { 3260 if (trans->cfg->gen2 && dump_mask & BIT(IWL_FW_ERROR_DUMP_PAGING)) {
3278 for (i = 0; i < trans_pcie->init_dram.paging_cnt; i++) { 3261 for (i = 0; i < trans->init_dram.paging_cnt; i++) {
3279 struct iwl_fw_error_dump_paging *paging; 3262 struct iwl_fw_error_dump_paging *paging;
3280 dma_addr_t addr = 3263 u32 page_len = trans->init_dram.paging[i].size;
3281 trans_pcie->init_dram.paging[i].physical;
3282 u32 page_len = trans_pcie->init_dram.paging[i].size;
3283 3264
3284 data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PAGING); 3265 data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PAGING);
3285 data->len = cpu_to_le32(sizeof(*paging) + page_len); 3266 data->len = cpu_to_le32(sizeof(*paging) + page_len);
3286 paging = (void *)data->data; 3267 paging = (void *)data->data;
3287 paging->index = cpu_to_le32(i); 3268 paging->index = cpu_to_le32(i);
3288 dma_sync_single_for_cpu(trans->dev, addr, page_len,
3289 DMA_BIDIRECTIONAL);
3290 memcpy(paging->data, 3269 memcpy(paging->data,
3291 trans_pcie->init_dram.paging[i].block, page_len); 3270 trans->init_dram.paging[i].block, page_len);
3292 data = iwl_fw_error_next_data(data); 3271 data = iwl_fw_error_next_data(data);
3293 3272
3294 len += sizeof(*data) + sizeof(*paging) + page_len; 3273 len += sizeof(*data) + sizeof(*paging) + page_len;
@@ -3525,25 +3504,18 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
3525 * in-order to recognize C step driver should read chip version 3504 * in-order to recognize C step driver should read chip version
3526 * id located at the AUX bus MISC address space. 3505 * id located at the AUX bus MISC address space.
3527 */ 3506 */
3528 iwl_set_bit(trans, CSR_GP_CNTRL, 3507 ret = iwl_finish_nic_init(trans);
3529 BIT(trans->cfg->csr->flag_init_done)); 3508 if (ret)
3530 udelay(2);
3531
3532 ret = iwl_poll_bit(trans, CSR_GP_CNTRL,
3533 BIT(trans->cfg->csr->flag_mac_clock_ready),
3534 BIT(trans->cfg->csr->flag_mac_clock_ready),
3535 25000);
3536 if (ret < 0) {
3537 IWL_DEBUG_INFO(trans, "Failed to wake up the nic\n");
3538 goto out_no_pci; 3509 goto out_no_pci;
3539 }
3540 3510
3541 if (iwl_trans_grab_nic_access(trans, &flags)) { 3511 if (iwl_trans_grab_nic_access(trans, &flags)) {
3542 u32 hw_step; 3512 u32 hw_step;
3543 3513
3544 hw_step = iwl_read_prph_no_grab(trans, WFPM_CTRL_REG); 3514 hw_step = iwl_read_umac_prph_no_grab(trans,
3515 WFPM_CTRL_REG);
3545 hw_step |= ENABLE_WFPM; 3516 hw_step |= ENABLE_WFPM;
3546 iwl_write_prph_no_grab(trans, WFPM_CTRL_REG, hw_step); 3517 iwl_write_umac_prph_no_grab(trans, WFPM_CTRL_REG,
3518 hw_step);
3547 hw_step = iwl_read_prph_no_grab(trans, AUX_MISC_REG); 3519 hw_step = iwl_read_prph_no_grab(trans, AUX_MISC_REG);
3548 hw_step = (hw_step >> HW_STEP_LOCATION_BITS) & 0xF; 3520 hw_step = (hw_step >> HW_STEP_LOCATION_BITS) & 0xF;
3549 if (hw_step == 0x3) 3521 if (hw_step == 0x3)
@@ -3558,10 +3530,20 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
3558#if IS_ENABLED(CONFIG_IWLMVM) 3530#if IS_ENABLED(CONFIG_IWLMVM)
3559 trans->hw_rf_id = iwl_read32(trans, CSR_HW_RF_ID); 3531 trans->hw_rf_id = iwl_read32(trans, CSR_HW_RF_ID);
3560 3532
3561 if (cfg == &iwl22560_2ax_cfg_hr) { 3533 if (cfg == &iwlax210_2ax_cfg_so_hr_a0) {
3534 if (trans->hw_rev == CSR_HW_REV_TYPE_TY) {
3535 trans->cfg = &iwlax210_2ax_cfg_ty_gf_a0;
3536 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
3537 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_JF)) {
3538 trans->cfg = &iwlax210_2ax_cfg_so_jf_a0;
3539 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
3540 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_GF)) {
3541 trans->cfg = &iwlax210_2ax_cfg_so_gf_a0;
3542 }
3543 } else if (cfg == &iwl_ax101_cfg_qu_hr) {
3562 if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == 3544 if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
3563 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR)) { 3545 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR)) {
3564 trans->cfg = &iwl22560_2ax_cfg_hr; 3546 trans->cfg = &iwl_ax101_cfg_qu_hr;
3565 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == 3547 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
3566 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_JF)) { 3548 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_JF)) {
3567 trans->cfg = &iwl22000_2ax_cfg_jf; 3549 trans->cfg = &iwl22000_2ax_cfg_jf;
@@ -3654,3 +3636,28 @@ out_no_pci:
3654 iwl_trans_free(trans); 3636 iwl_trans_free(trans);
3655 return ERR_PTR(ret); 3637 return ERR_PTR(ret);
3656} 3638}
3639
3640void iwl_trans_sync_nmi(struct iwl_trans *trans)
3641{
3642 unsigned long timeout = jiffies + IWL_TRANS_NMI_TIMEOUT;
3643
3644 iwl_disable_interrupts(trans);
3645 iwl_force_nmi(trans);
3646 while (time_after(timeout, jiffies)) {
3647 u32 inta_hw = iwl_read32(trans,
3648 CSR_MSIX_HW_INT_CAUSES_AD);
3649
3650 /* Error detected by uCode */
3651 if (inta_hw & MSIX_HW_INT_CAUSES_REG_SW_ERR) {
3652 /* Clear causes register */
3653 iwl_write32(trans, CSR_MSIX_HW_INT_CAUSES_AD,
3654 inta_hw &
3655 MSIX_HW_INT_CAUSES_REG_SW_ERR);
3656 break;
3657 }
3658
3659 mdelay(1);
3660 }
3661 iwl_enable_interrupts(trans);
3662 iwl_trans_fw_error(trans);
3663}
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
index f3d2e8fe920b..88530d9f4a54 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
@@ -6,7 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2017 Intel Deutschland GmbH 8 * Copyright(c) 2017 Intel Deutschland GmbH
9 * Copyright(c) 2018 Intel Corporation 9 * Copyright(c) 2018 - 2019 Intel Corporation
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as 12 * it under the terms of version 2 of the GNU General Public License as
@@ -20,7 +20,7 @@
20 * BSD LICENSE 20 * BSD LICENSE
21 * 21 *
22 * Copyright(c) 2017 Intel Deutschland GmbH 22 * Copyright(c) 2017 Intel Deutschland GmbH
23 * Copyright(c) 2018 Intel Corporation 23 * Copyright(c) 2018 - 2019 Intel Corporation
24 * All rights reserved. 24 * All rights reserved.
25 * 25 *
26 * Redistribution and use in source and binary forms, with or without 26 * Redistribution and use in source and binary forms, with or without
@@ -965,9 +965,7 @@ static int iwl_pcie_gen2_send_hcmd_sync(struct iwl_trans *trans,
965 cmd_str); 965 cmd_str);
966 ret = -ETIMEDOUT; 966 ret = -ETIMEDOUT;
967 967
968 iwl_force_nmi(trans); 968 iwl_trans_sync_nmi(trans);
969 iwl_trans_fw_error(trans);
970
971 goto cancel; 969 goto cancel;
972 } 970 }
973 971
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
index 07395502f419..9fbd37d23e85 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
@@ -8,7 +8,7 @@
8 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11 * Copyright(c) 2018 Intel Corporation 11 * Copyright(c) 2018 - 2019 Intel Corporation
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify it 13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of version 2 of the GNU General Public License as 14 * under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
31 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 - 2019 Intel Corporation
35 * All rights reserved. 35 * All rights reserved.
36 * 36 *
37 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -995,7 +995,11 @@ static int iwl_pcie_tx_alloc(struct iwl_trans *trans)
995 txq_id++) { 995 txq_id++) {
996 bool cmd_queue = (txq_id == trans_pcie->cmd_queue); 996 bool cmd_queue = (txq_id == trans_pcie->cmd_queue);
997 997
998 slots_num = cmd_queue ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 998 if (cmd_queue)
999 slots_num = max_t(u32, TFD_CMD_SLOTS,
1000 trans->cfg->min_txq_size);
1001 else
1002 slots_num = TFD_TX_CMD_SLOTS;
999 trans_pcie->txq[txq_id] = &trans_pcie->txq_memory[txq_id]; 1003 trans_pcie->txq[txq_id] = &trans_pcie->txq_memory[txq_id];
1000 ret = iwl_pcie_txq_alloc(trans, trans_pcie->txq[txq_id], 1004 ret = iwl_pcie_txq_alloc(trans, trans_pcie->txq[txq_id],
1001 slots_num, cmd_queue); 1005 slots_num, cmd_queue);
@@ -1044,7 +1048,11 @@ int iwl_pcie_tx_init(struct iwl_trans *trans)
1044 txq_id++) { 1048 txq_id++) {
1045 bool cmd_queue = (txq_id == trans_pcie->cmd_queue); 1049 bool cmd_queue = (txq_id == trans_pcie->cmd_queue);
1046 1050
1047 slots_num = cmd_queue ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 1051 if (cmd_queue)
1052 slots_num = max_t(u32, TFD_CMD_SLOTS,
1053 trans->cfg->min_txq_size);
1054 else
1055 slots_num = TFD_TX_CMD_SLOTS;
1048 ret = iwl_pcie_txq_init(trans, trans_pcie->txq[txq_id], 1056 ret = iwl_pcie_txq_init(trans, trans_pcie->txq[txq_id],
1049 slots_num, cmd_queue); 1057 slots_num, cmd_queue);
1050 if (ret) { 1058 if (ret) {
@@ -1174,6 +1182,15 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
1174 skb_queue_splice_init(&txq->overflow_q, &overflow_skbs); 1182 skb_queue_splice_init(&txq->overflow_q, &overflow_skbs);
1175 1183
1176 /* 1184 /*
1185 * We are going to transmit from the overflow queue.
1186 * Remember this state so that wait_for_txq_empty will know we
1187 * are adding more packets to the TFD queue. It cannot rely on
1188 * the state of &txq->overflow_q, as we just emptied it, but
1189 * haven't TXed the content yet.
1190 */
1191 txq->overflow_tx = true;
1192
1193 /*
1177 * This is tricky: we are in reclaim path which is non 1194 * This is tricky: we are in reclaim path which is non
1178 * re-entrant, so noone will try to take the access the 1195 * re-entrant, so noone will try to take the access the
1179 * txq data from that path. We stopped tx, so we can't 1196 * txq data from that path. We stopped tx, so we can't
@@ -1201,6 +1218,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
1201 iwl_wake_queue(trans, txq); 1218 iwl_wake_queue(trans, txq);
1202 1219
1203 spin_lock_bh(&txq->lock); 1220 spin_lock_bh(&txq->lock);
1221 txq->overflow_tx = false;
1204 } 1222 }
1205 1223
1206 if (txq->read_ptr == txq->write_ptr) { 1224 if (txq->read_ptr == txq->write_ptr) {
@@ -1942,9 +1960,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
1942 iwl_get_cmd_string(trans, cmd->id)); 1960 iwl_get_cmd_string(trans, cmd->id));
1943 ret = -ETIMEDOUT; 1961 ret = -ETIMEDOUT;
1944 1962
1945 iwl_force_nmi(trans); 1963 iwl_trans_sync_nmi(trans);
1946 iwl_trans_fw_error(trans);
1947
1948 goto cancel; 1964 goto cancel;
1949 } 1965 }
1950 1966
diff --git a/drivers/net/wireless/intersil/orinoco/mic.c b/drivers/net/wireless/intersil/orinoco/mic.c
index 709d9ab3e7bc..67b0c05afbdb 100644
--- a/drivers/net/wireless/intersil/orinoco/mic.c
+++ b/drivers/net/wireless/intersil/orinoco/mic.c
@@ -18,16 +18,16 @@ int orinoco_mic_init(struct orinoco_private *priv)
18{ 18{
19 priv->tx_tfm_mic = crypto_alloc_shash("michael_mic", 0, 0); 19 priv->tx_tfm_mic = crypto_alloc_shash("michael_mic", 0, 0);
20 if (IS_ERR(priv->tx_tfm_mic)) { 20 if (IS_ERR(priv->tx_tfm_mic)) {
21 printk(KERN_DEBUG "orinoco_mic_init: could not allocate " 21 printk(KERN_DEBUG "%s: could not allocate "
22 "crypto API michael_mic\n"); 22 "crypto API michael_mic\n", __func__);
23 priv->tx_tfm_mic = NULL; 23 priv->tx_tfm_mic = NULL;
24 return -ENOMEM; 24 return -ENOMEM;
25 } 25 }
26 26
27 priv->rx_tfm_mic = crypto_alloc_shash("michael_mic", 0, 0); 27 priv->rx_tfm_mic = crypto_alloc_shash("michael_mic", 0, 0);
28 if (IS_ERR(priv->rx_tfm_mic)) { 28 if (IS_ERR(priv->rx_tfm_mic)) {
29 printk(KERN_DEBUG "orinoco_mic_init: could not allocate " 29 printk(KERN_DEBUG "%s: could not allocate "
30 "crypto API michael_mic\n"); 30 "crypto API michael_mic\n", __func__);
31 priv->rx_tfm_mic = NULL; 31 priv->rx_tfm_mic = NULL;
32 return -ENOMEM; 32 return -ENOMEM;
33 } 33 }
@@ -52,7 +52,7 @@ int orinoco_mic(struct crypto_shash *tfm_michael, u8 *key,
52 int err; 52 int err;
53 53
54 if (tfm_michael == NULL) { 54 if (tfm_michael == NULL) {
55 printk(KERN_WARNING "orinoco_mic: tfm_michael == NULL\n"); 55 printk(KERN_WARNING "%s: tfm_michael == NULL\n", __func__);
56 return -1; 56 return -1;
57 } 57 }
58 58
diff --git a/drivers/net/wireless/marvell/libertas_tf/cmd.c b/drivers/net/wireless/marvell/libertas_tf/cmd.c
index 909ac3685010..130f578daafd 100644
--- a/drivers/net/wireless/marvell/libertas_tf/cmd.c
+++ b/drivers/net/wireless/marvell/libertas_tf/cmd.c
@@ -256,7 +256,7 @@ static void lbtf_submit_command(struct lbtf_private *priv,
256 command, le16_to_cpu(cmd->seqnum), cmdsize); 256 command, le16_to_cpu(cmd->seqnum), cmdsize);
257 lbtf_deb_hex(LBTF_DEB_CMD, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); 257 lbtf_deb_hex(LBTF_DEB_CMD, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize);
258 258
259 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); 259 ret = priv->ops->hw_host_to_card(priv, MVMS_CMD, (u8 *)cmd, cmdsize);
260 spin_unlock_irqrestore(&priv->driver_lock, flags); 260 spin_unlock_irqrestore(&priv->driver_lock, flags);
261 261
262 if (ret) { 262 if (ret) {
@@ -737,10 +737,9 @@ int lbtf_process_rx_command(struct lbtf_private *priv)
737 respcmd = le16_to_cpu(resp->command); 737 respcmd = le16_to_cpu(resp->command);
738 result = le16_to_cpu(resp->result); 738 result = le16_to_cpu(resp->result);
739 739
740 if (net_ratelimit()) 740 lbtf_deb_cmd("libertastf: cmd response 0x%04x, seq %d, size %d\n",
741 pr_info("libertastf: cmd response 0x%04x, seq %d, size %d\n", 741 respcmd, le16_to_cpu(resp->seqnum),
742 respcmd, le16_to_cpu(resp->seqnum), 742 le16_to_cpu(resp->size));
743 le16_to_cpu(resp->size));
744 743
745 if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) { 744 if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) {
746 spin_unlock_irqrestore(&priv->driver_lock, flags); 745 spin_unlock_irqrestore(&priv->driver_lock, flags);
diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index 789337ea676a..a4b9ede70705 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -42,14 +42,14 @@ MODULE_DEVICE_TABLE(usb, if_usb_table);
42 42
43static void if_usb_receive(struct urb *urb); 43static void if_usb_receive(struct urb *urb);
44static void if_usb_receive_fwload(struct urb *urb); 44static void if_usb_receive_fwload(struct urb *urb);
45static int if_usb_prog_firmware(struct if_usb_card *cardp); 45static int if_usb_prog_firmware(struct lbtf_private *priv);
46static int if_usb_host_to_card(struct lbtf_private *priv, uint8_t type, 46static int if_usb_host_to_card(struct lbtf_private *priv, uint8_t type,
47 uint8_t *payload, uint16_t nb); 47 uint8_t *payload, uint16_t nb);
48static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, 48static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload,
49 uint16_t nb, u8 data); 49 uint16_t nb, u8 data);
50static void if_usb_free(struct if_usb_card *cardp); 50static void if_usb_free(struct if_usb_card *cardp);
51static int if_usb_submit_rx_urb(struct if_usb_card *cardp); 51static int if_usb_submit_rx_urb(struct if_usb_card *cardp);
52static int if_usb_reset_device(struct if_usb_card *cardp); 52static int if_usb_reset_device(struct lbtf_private *priv);
53 53
54/** 54/**
55 * if_usb_wrike_bulk_callback - call back to handle URB status 55 * if_usb_wrike_bulk_callback - call back to handle URB status
@@ -131,6 +131,12 @@ static void if_usb_fw_timeo(struct timer_list *t)
131 lbtf_deb_leave(LBTF_DEB_USB); 131 lbtf_deb_leave(LBTF_DEB_USB);
132} 132}
133 133
134static const struct lbtf_ops if_usb_ops = {
135 .hw_host_to_card = if_usb_host_to_card,
136 .hw_prog_firmware = if_usb_prog_firmware,
137 .hw_reset_device = if_usb_reset_device,
138};
139
134/** 140/**
135 * if_usb_probe - sets the configuration values 141 * if_usb_probe - sets the configuration values
136 * 142 *
@@ -216,17 +222,11 @@ static int if_usb_probe(struct usb_interface *intf,
216 goto dealloc; 222 goto dealloc;
217 } 223 }
218 224
219 priv = lbtf_add_card(cardp, &udev->dev); 225 cardp->boot2_version = udev->descriptor.bcdDevice;
226 priv = lbtf_add_card(cardp, &udev->dev, &if_usb_ops);
220 if (!priv) 227 if (!priv)
221 goto dealloc; 228 goto dealloc;
222 229
223 cardp->priv = priv;
224
225 priv->hw_host_to_card = if_usb_host_to_card;
226 priv->hw_prog_firmware = if_usb_prog_firmware;
227 priv->hw_reset_device = if_usb_reset_device;
228 cardp->boot2_version = udev->descriptor.bcdDevice;
229
230 usb_get_dev(udev); 230 usb_get_dev(udev);
231 usb_set_intfdata(intf, cardp); 231 usb_set_intfdata(intf, cardp);
232 232
@@ -251,7 +251,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
251 251
252 lbtf_deb_enter(LBTF_DEB_MAIN); 252 lbtf_deb_enter(LBTF_DEB_MAIN);
253 253
254 if_usb_reset_device(cardp); 254 if_usb_reset_device(priv);
255 255
256 if (priv) 256 if (priv)
257 lbtf_remove_card(priv); 257 lbtf_remove_card(priv);
@@ -334,8 +334,9 @@ static int if_usb_send_fw_pkt(struct if_usb_card *cardp)
334 return 0; 334 return 0;
335} 335}
336 336
337static int if_usb_reset_device(struct if_usb_card *cardp) 337static int if_usb_reset_device(struct lbtf_private *priv)
338{ 338{
339 struct if_usb_card *cardp = priv->card;
339 struct cmd_ds_802_11_reset *cmd = cardp->ep_out_buf + 4; 340 struct cmd_ds_802_11_reset *cmd = cardp->ep_out_buf + 4;
340 int ret; 341 int ret;
341 342
@@ -433,8 +434,6 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp,
433 skb_tail_pointer(skb), 434 skb_tail_pointer(skb),
434 MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, cardp); 435 MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, cardp);
435 436
436 cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
437
438 lbtf_deb_usb2(&cardp->udev->dev, "Pointer for rx_urb %p\n", 437 lbtf_deb_usb2(&cardp->udev->dev, "Pointer for rx_urb %p\n",
439 cardp->rx_urb); 438 cardp->rx_urb);
440 ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC); 439 ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC);
@@ -808,14 +807,17 @@ static int check_fwfile_format(const u8 *data, u32 totlen)
808} 807}
809 808
810 809
811static int if_usb_prog_firmware(struct if_usb_card *cardp) 810static int if_usb_prog_firmware(struct lbtf_private *priv)
812{ 811{
812 struct if_usb_card *cardp = priv->card;
813 int i = 0; 813 int i = 0;
814 static int reset_count = 10; 814 static int reset_count = 10;
815 int ret = 0; 815 int ret = 0;
816 816
817 lbtf_deb_enter(LBTF_DEB_USB); 817 lbtf_deb_enter(LBTF_DEB_USB);
818 818
819 cardp->priv = priv;
820
819 kernel_param_lock(THIS_MODULE); 821 kernel_param_lock(THIS_MODULE);
820 ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev); 822 ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev);
821 if (ret < 0) { 823 if (ret < 0) {
@@ -851,7 +853,7 @@ restart:
851 853
852 if (cardp->bootcmdresp <= 0) { 854 if (cardp->bootcmdresp <= 0) {
853 if (--reset_count >= 0) { 855 if (--reset_count >= 0) {
854 if_usb_reset_device(cardp); 856 if_usb_reset_device(priv);
855 goto restart; 857 goto restart;
856 } 858 }
857 return -1; 859 return -1;
@@ -880,7 +882,7 @@ restart:
880 if (!cardp->fwdnldover) { 882 if (!cardp->fwdnldover) {
881 pr_info("failed to load fw, resetting device!\n"); 883 pr_info("failed to load fw, resetting device!\n");
882 if (--reset_count >= 0) { 884 if (--reset_count >= 0) {
883 if_usb_reset_device(cardp); 885 if_usb_reset_device(priv);
884 goto restart; 886 goto restart;
885 } 887 }
886 888
@@ -889,8 +891,6 @@ restart:
889 goto release_fw; 891 goto release_fw;
890 } 892 }
891 893
892 cardp->priv->fw_ready = 1;
893
894 release_fw: 894 release_fw:
895 release_firmware(cardp->fw); 895 release_firmware(cardp->fw);
896 cardp->fw = NULL; 896 cardp->fw = NULL;
diff --git a/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h b/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h
index ad77b92d0b41..3ed1fbe28798 100644
--- a/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h
+++ b/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h
@@ -173,10 +173,19 @@ struct channel_range {
173 173
174struct if_usb_card; 174struct if_usb_card;
175 175
176struct lbtf_ops {
177 /** Hardware access */
178 int (*hw_host_to_card)(struct lbtf_private *priv, u8 type,
179 u8 *payload, u16 nb);
180 int (*hw_prog_firmware)(struct lbtf_private *priv);
181 int (*hw_reset_device)(struct lbtf_private *priv);
182};
183
176/** Private structure for the MV device */ 184/** Private structure for the MV device */
177struct lbtf_private { 185struct lbtf_private {
178 void *card; 186 void *card;
179 struct ieee80211_hw *hw; 187 struct ieee80211_hw *hw;
188 const struct lbtf_ops *ops;
180 189
181 /* Command response buffer */ 190 /* Command response buffer */
182 u8 cmd_resp_buff[LBS_UPLD_SIZE]; 191 u8 cmd_resp_buff[LBS_UPLD_SIZE];
@@ -188,11 +197,6 @@ struct lbtf_private {
188 197
189 struct work_struct cmd_work; 198 struct work_struct cmd_work;
190 struct work_struct tx_work; 199 struct work_struct tx_work;
191 /** Hardware access */
192 int (*hw_host_to_card) (struct lbtf_private *priv, u8 type, u8 *payload, u16 nb);
193 int (*hw_prog_firmware) (struct if_usb_card *cardp);
194 int (*hw_reset_device) (struct if_usb_card *cardp);
195
196 200
197 /** Wlan adapter data structure*/ 201 /** Wlan adapter data structure*/
198 /** STATUS variables */ 202 /** STATUS variables */
@@ -250,7 +254,6 @@ struct lbtf_private {
250 struct ieee80211_supported_band band; 254 struct ieee80211_supported_band band;
251 struct lbtf_offset_value offsetvalue; 255 struct lbtf_offset_value offsetvalue;
252 256
253 u8 fw_ready;
254 u8 surpriseremoved; 257 u8 surpriseremoved;
255 struct sk_buff_head bc_ps_buf; 258 struct sk_buff_head bc_ps_buf;
256 259
@@ -486,7 +489,8 @@ void lbtf_cmd_response_rx(struct lbtf_private *priv);
486/* main.c */ 489/* main.c */
487struct chan_freq_power *lbtf_get_region_cfp_table(u8 region, 490struct chan_freq_power *lbtf_get_region_cfp_table(u8 region,
488 int *cfp_no); 491 int *cfp_no);
489struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev); 492struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev,
493 const struct lbtf_ops *ops);
490int lbtf_remove_card(struct lbtf_private *priv); 494int lbtf_remove_card(struct lbtf_private *priv);
491int lbtf_start_card(struct lbtf_private *priv); 495int lbtf_start_card(struct lbtf_private *priv);
492int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb); 496int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb);
diff --git a/drivers/net/wireless/marvell/libertas_tf/main.c b/drivers/net/wireless/marvell/libertas_tf/main.c
index a7cb7d06e5e6..5799e9886d83 100644
--- a/drivers/net/wireless/marvell/libertas_tf/main.c
+++ b/drivers/net/wireless/marvell/libertas_tf/main.c
@@ -118,11 +118,6 @@ static void lbtf_cmd_work(struct work_struct *work)
118 priv->cmd_timed_out = 0; 118 priv->cmd_timed_out = 0;
119 spin_unlock_irq(&priv->driver_lock); 119 spin_unlock_irq(&priv->driver_lock);
120 120
121 if (!priv->fw_ready) {
122 lbtf_deb_leave_args(LBTF_DEB_CMD, "fw not ready");
123 return;
124 }
125
126 /* Execute the next command */ 121 /* Execute the next command */
127 if (!priv->cur_cmd) 122 if (!priv->cur_cmd)
128 lbtf_execute_next_command(priv); 123 lbtf_execute_next_command(priv);
@@ -131,37 +126,6 @@ static void lbtf_cmd_work(struct work_struct *work)
131} 126}
132 127
133/** 128/**
134 * lbtf_setup_firmware: initialize firmware.
135 *
136 * @priv A pointer to struct lbtf_private structure
137 *
138 * Returns: 0 on success.
139 */
140static int lbtf_setup_firmware(struct lbtf_private *priv)
141{
142 int ret = -1;
143
144 lbtf_deb_enter(LBTF_DEB_FW);
145 /*
146 * Read priv address from HW
147 */
148 eth_broadcast_addr(priv->current_addr);
149 ret = lbtf_update_hw_spec(priv);
150 if (ret) {
151 ret = -1;
152 goto done;
153 }
154
155 lbtf_set_mac_control(priv);
156 lbtf_set_radio_control(priv);
157
158 ret = 0;
159done:
160 lbtf_deb_leave_args(LBTF_DEB_FW, "ret: %d", ret);
161 return ret;
162}
163
164/**
165 * This function handles the timeout of command sending. 129 * This function handles the timeout of command sending.
166 * It will re-send the same command again. 130 * It will re-send the same command again.
167 */ 131 */
@@ -281,7 +245,7 @@ static void lbtf_tx_work(struct work_struct *work)
281 BUG_ON(priv->tx_skb); 245 BUG_ON(priv->tx_skb);
282 spin_lock_irq(&priv->driver_lock); 246 spin_lock_irq(&priv->driver_lock);
283 priv->tx_skb = skb; 247 priv->tx_skb = skb;
284 err = priv->hw_host_to_card(priv, MVMS_DAT, skb->data, skb->len); 248 err = priv->ops->hw_host_to_card(priv, MVMS_DAT, skb->data, skb->len);
285 spin_unlock_irq(&priv->driver_lock); 249 spin_unlock_irq(&priv->driver_lock);
286 if (err) { 250 if (err) {
287 dev_kfree_skb_any(skb); 251 dev_kfree_skb_any(skb);
@@ -294,38 +258,17 @@ static void lbtf_tx_work(struct work_struct *work)
294static int lbtf_op_start(struct ieee80211_hw *hw) 258static int lbtf_op_start(struct ieee80211_hw *hw)
295{ 259{
296 struct lbtf_private *priv = hw->priv; 260 struct lbtf_private *priv = hw->priv;
297 void *card = priv->card;
298 int ret = -1;
299 261
300 lbtf_deb_enter(LBTF_DEB_MACOPS); 262 lbtf_deb_enter(LBTF_DEB_MACOPS);
301 263
302 if (!priv->fw_ready)
303 /* Upload firmware */
304 if (priv->hw_prog_firmware(card))
305 goto err_prog_firmware;
306
307 /* poke the firmware */
308 priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; 264 priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
309 priv->radioon = RADIO_ON; 265 priv->radioon = RADIO_ON;
310 priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; 266 priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
311 ret = lbtf_setup_firmware(priv); 267 lbtf_set_mac_control(priv);
312 if (ret) 268 lbtf_set_radio_control(priv);
313 goto err_prog_firmware;
314
315 if ((priv->fwrelease < LBTF_FW_VER_MIN) ||
316 (priv->fwrelease > LBTF_FW_VER_MAX)) {
317 ret = -1;
318 goto err_prog_firmware;
319 }
320 269
321 printk(KERN_INFO "libertastf: Marvell WLAN 802.11 thinfirm adapter\n");
322 lbtf_deb_leave(LBTF_DEB_MACOPS); 270 lbtf_deb_leave(LBTF_DEB_MACOPS);
323 return 0; 271 return 0;
324
325err_prog_firmware:
326 priv->hw_reset_device(card);
327 lbtf_deb_leave_args(LBTF_DEB_MACOPS, "error programming fw; ret=%d", ret);
328 return ret;
329} 272}
330 273
331static void lbtf_op_stop(struct ieee80211_hw *hw) 274static void lbtf_op_stop(struct ieee80211_hw *hw)
@@ -551,11 +494,15 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
551 struct ieee80211_rx_status stats; 494 struct ieee80211_rx_status stats;
552 struct rxpd *prxpd; 495 struct rxpd *prxpd;
553 int need_padding; 496 int need_padding;
554 unsigned int flags;
555 struct ieee80211_hdr *hdr; 497 struct ieee80211_hdr *hdr;
556 498
557 lbtf_deb_enter(LBTF_DEB_RX); 499 lbtf_deb_enter(LBTF_DEB_RX);
558 500
501 if (priv->radioon != RADIO_ON) {
502 lbtf_deb_rx("rx before we turned on the radio");
503 goto done;
504 }
505
559 prxpd = (struct rxpd *) skb->data; 506 prxpd = (struct rxpd *) skb->data;
560 507
561 memset(&stats, 0, sizeof(stats)); 508 memset(&stats, 0, sizeof(stats));
@@ -563,7 +510,7 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
563 stats.flag |= RX_FLAG_FAILED_FCS_CRC; 510 stats.flag |= RX_FLAG_FAILED_FCS_CRC;
564 stats.freq = priv->cur_freq; 511 stats.freq = priv->cur_freq;
565 stats.band = NL80211_BAND_2GHZ; 512 stats.band = NL80211_BAND_2GHZ;
566 stats.signal = prxpd->snr; 513 stats.signal = prxpd->snr - prxpd->nf;
567 priv->noise = prxpd->nf; 514 priv->noise = prxpd->nf;
568 /* Marvell rate index has a hole at value 4 */ 515 /* Marvell rate index has a hole at value 4 */
569 if (prxpd->rx_rate > 4) 516 if (prxpd->rx_rate > 4)
@@ -572,7 +519,6 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
572 skb_pull(skb, sizeof(struct rxpd)); 519 skb_pull(skb, sizeof(struct rxpd));
573 520
574 hdr = (struct ieee80211_hdr *)skb->data; 521 hdr = (struct ieee80211_hdr *)skb->data;
575 flags = le32_to_cpu(*(__le32 *)(skb->data + 4));
576 522
577 need_padding = ieee80211_is_data_qos(hdr->frame_control); 523 need_padding = ieee80211_is_data_qos(hdr->frame_control);
578 need_padding ^= ieee80211_has_a4(hdr->frame_control); 524 need_padding ^= ieee80211_has_a4(hdr->frame_control);
@@ -594,19 +540,21 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
594 540
595 ieee80211_rx_irqsafe(priv->hw, skb); 541 ieee80211_rx_irqsafe(priv->hw, skb);
596 542
543done:
597 lbtf_deb_leave(LBTF_DEB_RX); 544 lbtf_deb_leave(LBTF_DEB_RX);
598 return 0; 545 return 0;
599} 546}
600EXPORT_SYMBOL_GPL(lbtf_rx); 547EXPORT_SYMBOL_GPL(lbtf_rx);
601 548
602/** 549/**
603 * lbtf_add_card: Add and initialize the card, no fw upload yet. 550 * lbtf_add_card: Add and initialize the card.
604 * 551 *
605 * @card A pointer to card 552 * @card A pointer to card
606 * 553 *
607 * Returns: pointer to struct lbtf_priv. 554 * Returns: pointer to struct lbtf_priv.
608 */ 555 */
609struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev) 556struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev,
557 const struct lbtf_ops *ops)
610{ 558{
611 struct ieee80211_hw *hw; 559 struct ieee80211_hw *hw;
612 struct lbtf_private *priv = NULL; 560 struct lbtf_private *priv = NULL;
@@ -623,10 +571,13 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev)
623 571
624 priv->hw = hw; 572 priv->hw = hw;
625 priv->card = card; 573 priv->card = card;
574 priv->ops = ops;
626 priv->tx_skb = NULL; 575 priv->tx_skb = NULL;
576 priv->radioon = RADIO_OFF;
627 577
628 hw->queues = 1; 578 hw->queues = 1;
629 ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); 579 ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
580 ieee80211_hw_set(hw, SIGNAL_DBM);
630 hw->extra_tx_headroom = sizeof(struct txpd); 581 hw->extra_tx_headroom = sizeof(struct txpd);
631 memcpy(priv->channels, lbtf_channels, sizeof(lbtf_channels)); 582 memcpy(priv->channels, lbtf_channels, sizeof(lbtf_channels));
632 memcpy(priv->rates, lbtf_rates, sizeof(lbtf_rates)); 583 memcpy(priv->rates, lbtf_rates, sizeof(lbtf_rates));
@@ -646,9 +597,31 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev)
646 597
647 INIT_WORK(&priv->cmd_work, lbtf_cmd_work); 598 INIT_WORK(&priv->cmd_work, lbtf_cmd_work);
648 INIT_WORK(&priv->tx_work, lbtf_tx_work); 599 INIT_WORK(&priv->tx_work, lbtf_tx_work);
600
601 if (priv->ops->hw_prog_firmware(priv)) {
602 lbtf_deb_usbd(dmdev, "Error programming the firmware\n");
603 priv->ops->hw_reset_device(priv);
604 goto err_init_adapter;
605 }
606
607 eth_broadcast_addr(priv->current_addr);
608 if (lbtf_update_hw_spec(priv))
609 goto err_init_adapter;
610
611 if (priv->fwrelease < LBTF_FW_VER_MIN ||
612 priv->fwrelease > LBTF_FW_VER_MAX) {
613 goto err_init_adapter;
614 }
615
616 /* The firmware seems to start with the radio enabled. Turn it
617 * off before an actual mac80211 start callback is invoked.
618 */
619 lbtf_set_radio_control(priv);
620
649 if (ieee80211_register_hw(hw)) 621 if (ieee80211_register_hw(hw))
650 goto err_init_adapter; 622 goto err_init_adapter;
651 623
624 dev_info(dmdev, "libertastf: Marvell WLAN 802.11 thinfirm adapter\n");
652 goto done; 625 goto done;
653 626
654err_init_adapter: 627err_init_adapter:
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 1467af22e394..c46f0a54a0c7 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -376,11 +376,20 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy,
376 struct mwifiex_power_cfg power_cfg; 376 struct mwifiex_power_cfg power_cfg;
377 int dbm = MBM_TO_DBM(mbm); 377 int dbm = MBM_TO_DBM(mbm);
378 378
379 if (type == NL80211_TX_POWER_FIXED) { 379 switch (type) {
380 case NL80211_TX_POWER_FIXED:
380 power_cfg.is_power_auto = 0; 381 power_cfg.is_power_auto = 0;
382 power_cfg.is_power_fixed = 1;
381 power_cfg.power_level = dbm; 383 power_cfg.power_level = dbm;
382 } else { 384 break;
385 case NL80211_TX_POWER_LIMITED:
386 power_cfg.is_power_auto = 0;
387 power_cfg.is_power_fixed = 0;
388 power_cfg.power_level = dbm;
389 break;
390 case NL80211_TX_POWER_AUTOMATIC:
383 power_cfg.is_power_auto = 1; 391 power_cfg.is_power_auto = 1;
392 break;
384 } 393 }
385 394
386 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); 395 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
@@ -4310,11 +4319,13 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
4310 wiphy->mgmt_stypes = mwifiex_mgmt_stypes; 4319 wiphy->mgmt_stypes = mwifiex_mgmt_stypes;
4311 wiphy->max_remain_on_channel_duration = 5000; 4320 wiphy->max_remain_on_channel_duration = 5000;
4312 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | 4321 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
4313 BIT(NL80211_IFTYPE_ADHOC) |
4314 BIT(NL80211_IFTYPE_P2P_CLIENT) | 4322 BIT(NL80211_IFTYPE_P2P_CLIENT) |
4315 BIT(NL80211_IFTYPE_P2P_GO) | 4323 BIT(NL80211_IFTYPE_P2P_GO) |
4316 BIT(NL80211_IFTYPE_AP); 4324 BIT(NL80211_IFTYPE_AP);
4317 4325
4326 if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info))
4327 wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
4328
4318 wiphy->bands[NL80211_BAND_2GHZ] = &mwifiex_band_2ghz; 4329 wiphy->bands[NL80211_BAND_2GHZ] = &mwifiex_band_2ghz;
4319 if (adapter->config_bands & BAND_A) 4330 if (adapter->config_bands & BAND_A)
4320 wiphy->bands[NL80211_BAND_5GHZ] = &mwifiex_band_5ghz; 4331 wiphy->bands[NL80211_BAND_5GHZ] = &mwifiex_band_5ghz;
@@ -4374,11 +4385,13 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
4374 wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1; 4385 wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1;
4375 wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1; 4386 wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1;
4376 4387
4377 wiphy->features |= NL80211_FEATURE_HT_IBSS | 4388 wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER |
4378 NL80211_FEATURE_INACTIVITY_TIMER |
4379 NL80211_FEATURE_LOW_PRIORITY_SCAN | 4389 NL80211_FEATURE_LOW_PRIORITY_SCAN |
4380 NL80211_FEATURE_NEED_OBSS_SCAN; 4390 NL80211_FEATURE_NEED_OBSS_SCAN;
4381 4391
4392 if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info))
4393 wiphy->features |= NL80211_FEATURE_HT_IBSS;
4394
4382 if (ISSUPP_RANDOM_MAC(adapter->fw_cap_info)) 4395 if (ISSUPP_RANDOM_MAC(adapter->fw_cap_info))
4383 wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR | 4396 wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR |
4384 NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR | 4397 NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
diff --git a/drivers/net/wireless/marvell/mwifiex/ioctl.h b/drivers/net/wireless/marvell/mwifiex/ioctl.h
index 48e154e1865d..0dd592ea6e83 100644
--- a/drivers/net/wireless/marvell/mwifiex/ioctl.h
+++ b/drivers/net/wireless/marvell/mwifiex/ioctl.h
@@ -267,6 +267,7 @@ struct mwifiex_ds_encrypt_key {
267 267
268struct mwifiex_power_cfg { 268struct mwifiex_power_cfg {
269 u32 is_power_auto; 269 u32 is_power_auto;
270 u32 is_power_fixed;
270 u32 power_level; 271 u32 power_level;
271}; 272};
272 273
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index b454b5f85503..ebc0e41e5d3b 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -688,6 +688,9 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
688 txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf; 688 txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf;
689 txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET); 689 txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
690 if (!power_cfg->is_power_auto) { 690 if (!power_cfg->is_power_auto) {
691 u16 dbm_min = power_cfg->is_power_fixed ?
692 dbm : priv->min_tx_power_level;
693
691 txp_cfg->mode = cpu_to_le32(1); 694 txp_cfg->mode = cpu_to_le32(1);
692 pg_tlv = (struct mwifiex_types_power_group *) 695 pg_tlv = (struct mwifiex_types_power_group *)
693 (buf + sizeof(struct host_cmd_ds_txpwr_cfg)); 696 (buf + sizeof(struct host_cmd_ds_txpwr_cfg));
@@ -702,7 +705,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
702 pg->last_rate_code = 0x03; 705 pg->last_rate_code = 0x03;
703 pg->modulation_class = MOD_CLASS_HR_DSSS; 706 pg->modulation_class = MOD_CLASS_HR_DSSS;
704 pg->power_step = 0; 707 pg->power_step = 0;
705 pg->power_min = (s8) dbm; 708 pg->power_min = (s8) dbm_min;
706 pg->power_max = (s8) dbm; 709 pg->power_max = (s8) dbm;
707 pg++; 710 pg++;
708 /* Power group for modulation class OFDM */ 711 /* Power group for modulation class OFDM */
@@ -710,7 +713,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
710 pg->last_rate_code = 0x07; 713 pg->last_rate_code = 0x07;
711 pg->modulation_class = MOD_CLASS_OFDM; 714 pg->modulation_class = MOD_CLASS_OFDM;
712 pg->power_step = 0; 715 pg->power_step = 0;
713 pg->power_min = (s8) dbm; 716 pg->power_min = (s8) dbm_min;
714 pg->power_max = (s8) dbm; 717 pg->power_max = (s8) dbm;
715 pg++; 718 pg++;
716 /* Power group for modulation class HTBW20 */ 719 /* Power group for modulation class HTBW20 */
@@ -718,7 +721,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
718 pg->last_rate_code = 0x20; 721 pg->last_rate_code = 0x20;
719 pg->modulation_class = MOD_CLASS_HT; 722 pg->modulation_class = MOD_CLASS_HT;
720 pg->power_step = 0; 723 pg->power_step = 0;
721 pg->power_min = (s8) dbm; 724 pg->power_min = (s8) dbm_min;
722 pg->power_max = (s8) dbm; 725 pg->power_max = (s8) dbm;
723 pg->ht_bandwidth = HT_BW_20; 726 pg->ht_bandwidth = HT_BW_20;
724 pg++; 727 pg++;
@@ -727,7 +730,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
727 pg->last_rate_code = 0x20; 730 pg->last_rate_code = 0x20;
728 pg->modulation_class = MOD_CLASS_HT; 731 pg->modulation_class = MOD_CLASS_HT;
729 pg->power_step = 0; 732 pg->power_step = 0;
730 pg->power_min = (s8) dbm; 733 pg->power_min = (s8) dbm_min;
731 pg->power_max = (s8) dbm; 734 pg->power_max = (s8) dbm;
732 pg->ht_bandwidth = HT_BW_40; 735 pg->ht_bandwidth = HT_BW_40;
733 } 736 }
diff --git a/drivers/net/wireless/marvell/mwifiex/uap_event.c b/drivers/net/wireless/marvell/mwifiex/uap_event.c
index e86217a6b9ca..ca759d9c0253 100644
--- a/drivers/net/wireless/marvell/mwifiex/uap_event.c
+++ b/drivers/net/wireless/marvell/mwifiex/uap_event.c
@@ -300,7 +300,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
300 mwifiex_11h_handle_radar_detected(priv, adapter->event_skb); 300 mwifiex_11h_handle_radar_detected(priv, adapter->event_skb);
301 break; 301 break;
302 case EVENT_BT_COEX_WLAN_PARA_CHANGE: 302 case EVENT_BT_COEX_WLAN_PARA_CHANGE:
303 dev_err(adapter->dev, "EVENT: BT coex wlan param update\n"); 303 mwifiex_dbg(adapter, EVENT, "event: BT coex wlan param update\n");
304 mwifiex_bt_coex_wlan_param_update_event(priv, 304 mwifiex_bt_coex_wlan_param_update_event(priv,
305 adapter->event_skb); 305 adapter->event_skb);
306 break; 306 break;
diff --git a/drivers/net/wireless/mediatek/mt76/Makefile b/drivers/net/wireless/mediatek/mt76/Makefile
index 1a45cb30f39f..fa7a44edd02d 100644
--- a/drivers/net/wireless/mediatek/mt76/Makefile
+++ b/drivers/net/wireless/mediatek/mt76/Makefile
@@ -4,7 +4,8 @@ obj-$(CONFIG_MT76x02_LIB) += mt76x02-lib.o
4obj-$(CONFIG_MT76x02_USB) += mt76x02-usb.o 4obj-$(CONFIG_MT76x02_USB) += mt76x02-usb.o
5 5
6mt76-y := \ 6mt76-y := \
7 mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o tx.o agg-rx.o 7 mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \
8 tx.o agg-rx.o mcu.o
8 9
9mt76-usb-y := usb.o usb_trace.o usb_mcu.o 10mt76-usb-y := usb.o usb_trace.o usb_mcu.o
10 11
diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index e769c8a555dd..6eedc0ec7661 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -242,6 +242,30 @@ mt76_dma_kick_queue(struct mt76_dev *dev, struct mt76_queue *q)
242 iowrite32(q->head, &q->regs->cpu_idx); 242 iowrite32(q->head, &q->regs->cpu_idx);
243} 243}
244 244
245static int
246mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, enum mt76_txq_id qid,
247 struct sk_buff *skb, u32 tx_info)
248{
249 struct mt76_queue *q = &dev->q_tx[qid];
250 struct mt76_queue_buf buf;
251 dma_addr_t addr;
252
253 addr = dma_map_single(dev->dev, skb->data, skb->len,
254 DMA_TO_DEVICE);
255 if (dma_mapping_error(dev->dev, addr))
256 return -ENOMEM;
257
258 buf.addr = addr;
259 buf.len = skb->len;
260
261 spin_lock_bh(&q->lock);
262 mt76_dma_add_buf(dev, q, &buf, 1, tx_info, skb, NULL);
263 mt76_dma_kick_queue(dev, q);
264 spin_unlock_bh(&q->lock);
265
266 return 0;
267}
268
245int mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, 269int mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
246 struct sk_buff *skb, struct mt76_wcid *wcid, 270 struct sk_buff *skb, struct mt76_wcid *wcid,
247 struct ieee80211_sta *sta) 271 struct ieee80211_sta *sta)
@@ -522,17 +546,16 @@ mt76_dma_init(struct mt76_dev *dev)
522static const struct mt76_queue_ops mt76_dma_ops = { 546static const struct mt76_queue_ops mt76_dma_ops = {
523 .init = mt76_dma_init, 547 .init = mt76_dma_init,
524 .alloc = mt76_dma_alloc_queue, 548 .alloc = mt76_dma_alloc_queue,
525 .add_buf = mt76_dma_add_buf, 549 .tx_queue_skb_raw = mt76_dma_tx_queue_skb_raw,
526 .tx_queue_skb = mt76_dma_tx_queue_skb, 550 .tx_queue_skb = mt76_dma_tx_queue_skb,
527 .tx_cleanup = mt76_dma_tx_cleanup, 551 .tx_cleanup = mt76_dma_tx_cleanup,
528 .rx_reset = mt76_dma_rx_reset, 552 .rx_reset = mt76_dma_rx_reset,
529 .kick = mt76_dma_kick_queue, 553 .kick = mt76_dma_kick_queue,
530}; 554};
531 555
532int mt76_dma_attach(struct mt76_dev *dev) 556void mt76_dma_attach(struct mt76_dev *dev)
533{ 557{
534 dev->queue_ops = &mt76_dma_ops; 558 dev->queue_ops = &mt76_dma_ops;
535 return 0;
536} 559}
537EXPORT_SYMBOL_GPL(mt76_dma_attach); 560EXPORT_SYMBOL_GPL(mt76_dma_attach);
538 561
diff --git a/drivers/net/wireless/mediatek/mt76/dma.h b/drivers/net/wireless/mediatek/mt76/dma.h
index 357cc356342d..e3292df5e9b2 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.h
+++ b/drivers/net/wireless/mediatek/mt76/dma.h
@@ -54,7 +54,7 @@ enum mt76_mcu_evt_type {
54 EVT_EVENT_DFS_DETECT_RSP, 54 EVT_EVENT_DFS_DETECT_RSP,
55}; 55};
56 56
57int mt76_dma_attach(struct mt76_dev *dev); 57void mt76_dma_attach(struct mt76_dev *dev);
58void mt76_dma_cleanup(struct mt76_dev *dev); 58void mt76_dma_cleanup(struct mt76_dev *dev);
59 59
60#endif 60#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index ee3b65a14870..82e9f78ef328 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -124,7 +124,7 @@ static void mt76_init_stream_cap(struct mt76_dev *dev,
124 bool vht) 124 bool vht)
125{ 125{
126 struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap; 126 struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap;
127 int i, nstream = __sw_hweight8(dev->antenna_mask); 127 int i, nstream = hweight8(dev->antenna_mask);
128 struct ieee80211_sta_vht_cap *vht_cap; 128 struct ieee80211_sta_vht_cap *vht_cap;
129 u16 mcs_map = 0; 129 u16 mcs_map = 0;
130 130
@@ -269,7 +269,9 @@ mt76_check_sband(struct mt76_dev *dev, int band)
269} 269}
270 270
271struct mt76_dev * 271struct mt76_dev *
272mt76_alloc_device(unsigned int size, const struct ieee80211_ops *ops) 272mt76_alloc_device(struct device *pdev, unsigned int size,
273 const struct ieee80211_ops *ops,
274 const struct mt76_driver_ops *drv_ops)
273{ 275{
274 struct ieee80211_hw *hw; 276 struct ieee80211_hw *hw;
275 struct mt76_dev *dev; 277 struct mt76_dev *dev;
@@ -280,6 +282,9 @@ mt76_alloc_device(unsigned int size, const struct ieee80211_ops *ops)
280 282
281 dev = hw->priv; 283 dev = hw->priv;
282 dev->hw = hw; 284 dev->hw = hw;
285 dev->dev = pdev;
286 dev->drv = drv_ops;
287
283 spin_lock_init(&dev->rx_lock); 288 spin_lock_init(&dev->rx_lock);
284 spin_lock_init(&dev->lock); 289 spin_lock_init(&dev->lock);
285 spin_lock_init(&dev->cc_lock); 290 spin_lock_init(&dev->cc_lock);
@@ -721,7 +726,7 @@ int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
721 int *dbm) 726 int *dbm)
722{ 727{
723 struct mt76_dev *dev = hw->priv; 728 struct mt76_dev *dev = hw->priv;
724 int n_chains = __sw_hweight8(dev->antenna_mask); 729 int n_chains = hweight8(dev->antenna_mask);
725 730
726 *dbm = dev->txpower_cur / 2; 731 *dbm = dev->txpower_cur / 2;
727 732
diff --git a/drivers/net/wireless/mediatek/mt76/mcu.c b/drivers/net/wireless/mediatek/mt76/mcu.c
new file mode 100644
index 000000000000..dbb57b593a87
--- /dev/null
+++ b/drivers/net/wireless/mediatek/mt76/mcu.c
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2019 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include "mt76.h"
18
19struct sk_buff *
20mt76_mcu_msg_alloc(const void *data, int head_len,
21 int data_len, int tail_len)
22{
23 struct sk_buff *skb;
24
25 skb = alloc_skb(head_len + data_len + tail_len,
26 GFP_KERNEL);
27 if (!skb)
28 return NULL;
29
30 skb_reserve(skb, head_len);
31 if (data && data_len)
32 skb_put_data(skb, data, data_len);
33
34 return skb;
35}
36EXPORT_SYMBOL_GPL(mt76_mcu_msg_alloc);
37
38/* mmio */
39struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev,
40 unsigned long expires)
41{
42 unsigned long timeout;
43
44 if (!time_is_after_jiffies(expires))
45 return NULL;
46
47 timeout = expires - jiffies;
48 wait_event_timeout(dev->mmio.mcu.wait,
49 !skb_queue_empty(&dev->mmio.mcu.res_q),
50 timeout);
51 return skb_dequeue(&dev->mmio.mcu.res_q);
52}
53EXPORT_SYMBOL_GPL(mt76_mcu_get_response);
54
55void mt76_mcu_rx_event(struct mt76_dev *dev, struct sk_buff *skb)
56{
57 skb_queue_tail(&dev->mmio.mcu.res_q, skb);
58 wake_up(&dev->mmio.mcu.wait);
59}
60EXPORT_SYMBOL_GPL(mt76_mcu_rx_event);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 2bb9db4ed80a..f55dc621e060 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -87,6 +87,7 @@ struct mt76u_buf {
87 struct mt76_dev *dev; 87 struct mt76_dev *dev;
88 struct urb *urb; 88 struct urb *urb;
89 size_t len; 89 size_t len;
90 void *buf;
90 bool done; 91 bool done;
91}; 92};
92 93
@@ -157,6 +158,9 @@ struct mt76_queue_ops {
157 struct sk_buff *skb, struct mt76_wcid *wcid, 158 struct sk_buff *skb, struct mt76_wcid *wcid,
158 struct ieee80211_sta *sta); 159 struct ieee80211_sta *sta);
159 160
161 int (*tx_queue_skb_raw)(struct mt76_dev *dev, enum mt76_txq_id qid,
162 struct sk_buff *skb, u32 tx_info);
163
160 void *(*dequeue)(struct mt76_dev *dev, struct mt76_queue *q, bool flush, 164 void *(*dequeue)(struct mt76_dev *dev, struct mt76_queue *q, bool flush,
161 int *len, u32 *info, bool *more); 165 int *len, u32 *info, bool *more);
162 166
@@ -376,6 +380,7 @@ struct mt76_usb {
376 u16 out_max_packet; 380 u16 out_max_packet;
377 u8 in_ep[__MT_EP_IN_MAX]; 381 u8 in_ep[__MT_EP_IN_MAX];
378 u16 in_max_packet; 382 u16 in_max_packet;
383 bool sg_en;
379 384
380 struct mt76u_mcu { 385 struct mt76u_mcu {
381 struct mutex mutex; 386 struct mutex mutex;
@@ -562,7 +567,7 @@ static inline u16 mt76_rev(struct mt76_dev *dev)
562 567
563#define mt76_init_queues(dev) (dev)->mt76.queue_ops->init(&((dev)->mt76)) 568#define mt76_init_queues(dev) (dev)->mt76.queue_ops->init(&((dev)->mt76))
564#define mt76_queue_alloc(dev, ...) (dev)->mt76.queue_ops->alloc(&((dev)->mt76), __VA_ARGS__) 569#define mt76_queue_alloc(dev, ...) (dev)->mt76.queue_ops->alloc(&((dev)->mt76), __VA_ARGS__)
565#define mt76_queue_add_buf(dev, ...) (dev)->mt76.queue_ops->add_buf(&((dev)->mt76), __VA_ARGS__) 570#define mt76_tx_queue_skb_raw(dev, ...) (dev)->mt76.queue_ops->tx_queue_skb_raw(&((dev)->mt76), __VA_ARGS__)
566#define mt76_queue_rx_reset(dev, ...) (dev)->mt76.queue_ops->rx_reset(&((dev)->mt76), __VA_ARGS__) 571#define mt76_queue_rx_reset(dev, ...) (dev)->mt76.queue_ops->rx_reset(&((dev)->mt76), __VA_ARGS__)
567#define mt76_queue_tx_cleanup(dev, ...) (dev)->mt76.queue_ops->tx_cleanup(&((dev)->mt76), __VA_ARGS__) 572#define mt76_queue_tx_cleanup(dev, ...) (dev)->mt76.queue_ops->tx_cleanup(&((dev)->mt76), __VA_ARGS__)
568#define mt76_queue_kick(dev, ...) (dev)->mt76.queue_ops->kick(&((dev)->mt76), __VA_ARGS__) 573#define mt76_queue_kick(dev, ...) (dev)->mt76.queue_ops->kick(&((dev)->mt76), __VA_ARGS__)
@@ -582,8 +587,9 @@ mt76_channel_state(struct mt76_dev *dev, struct ieee80211_channel *c)
582 return &msband->chan[idx]; 587 return &msband->chan[idx];
583} 588}
584 589
585struct mt76_dev *mt76_alloc_device(unsigned int size, 590struct mt76_dev *mt76_alloc_device(struct device *pdev, unsigned int size,
586 const struct ieee80211_ops *ops); 591 const struct ieee80211_ops *ops,
592 const struct mt76_driver_ops *drv_ops);
587int mt76_register_device(struct mt76_dev *dev, bool vht, 593int mt76_register_device(struct mt76_dev *dev, bool vht,
588 struct ieee80211_rate *rates, int n_rates); 594 struct ieee80211_rate *rates, int n_rates);
589void mt76_unregister_device(struct mt76_dev *dev); 595void mt76_unregister_device(struct mt76_dev *dev);
@@ -722,14 +728,17 @@ static inline u8 q2ep(u8 qid)
722 return qid + 1; 728 return qid + 1;
723} 729}
724 730
725static inline bool mt76u_check_sg(struct mt76_dev *dev) 731static inline int
732mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int timeout)
726{ 733{
727 struct usb_interface *intf = to_usb_interface(dev->dev); 734 struct usb_interface *intf = to_usb_interface(dev->dev);
728 struct usb_device *udev = interface_to_usbdev(intf); 735 struct usb_device *udev = interface_to_usbdev(intf);
736 struct mt76_usb *usb = &dev->usb;
737 unsigned int pipe;
738 int sent;
729 739
730 return (udev->bus->sg_tablesize > 0 && 740 pipe = usb_sndbulkpipe(udev, usb->out_ep[MT_EP_OUT_INBAND_CMD]);
731 (udev->bus->no_sg_constraint || 741 return usb_bulk_msg(udev, pipe, data, len, &sent, timeout);
732 udev->speed == USB_SPEED_WIRELESS));
733} 742}
734 743
735int mt76u_vendor_request(struct mt76_dev *dev, u8 req, 744int mt76u_vendor_request(struct mt76_dev *dev, u8 req,
@@ -740,7 +749,7 @@ void mt76u_single_wr(struct mt76_dev *dev, const u8 req,
740int mt76u_init(struct mt76_dev *dev, struct usb_interface *intf); 749int mt76u_init(struct mt76_dev *dev, struct usb_interface *intf);
741void mt76u_deinit(struct mt76_dev *dev); 750void mt76u_deinit(struct mt76_dev *dev);
742int mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf, 751int mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf,
743 int nsgs, int len, int sglen, gfp_t gfp); 752 int len, int data_len, gfp_t gfp);
744void mt76u_buf_free(struct mt76u_buf *buf); 753void mt76u_buf_free(struct mt76u_buf *buf);
745int mt76u_submit_buf(struct mt76_dev *dev, int dir, int index, 754int mt76u_submit_buf(struct mt76_dev *dev, int dir, int index,
746 struct mt76u_buf *buf, gfp_t gfp, 755 struct mt76u_buf *buf, gfp_t gfp,
@@ -751,6 +760,13 @@ void mt76u_stop_queues(struct mt76_dev *dev);
751void mt76u_stop_stat_wk(struct mt76_dev *dev); 760void mt76u_stop_stat_wk(struct mt76_dev *dev);
752void mt76u_queues_deinit(struct mt76_dev *dev); 761void mt76u_queues_deinit(struct mt76_dev *dev);
753 762
763struct sk_buff *
764mt76_mcu_msg_alloc(const void *data, int head_len,
765 int data_len, int tail_len);
766void mt76_mcu_rx_event(struct mt76_dev *dev, struct sk_buff *skb);
767struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev,
768 unsigned long expires);
769
754void mt76u_mcu_complete_urb(struct urb *urb); 770void mt76u_mcu_complete_urb(struct urb *urb);
755int mt76u_mcu_init_rx(struct mt76_dev *dev); 771int mt76u_mcu_init_rx(struct mt76_dev *dev);
756void mt76u_mcu_deinit(struct mt76_dev *dev); 772void mt76u_mcu_deinit(struct mt76_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
index b2cabce1d74d..ab6dfc026acb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
@@ -152,11 +152,11 @@ static s8 mt76x0_get_delta(struct mt76x02_dev *dev)
152 return mt76x02_rate_power_val(val); 152 return mt76x02_rate_power_val(val);
153} 153}
154 154
155void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev) 155void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev,
156 struct ieee80211_channel *chan,
157 struct mt76_rate_power *t)
156{ 158{
157 struct ieee80211_channel *chan = dev->mt76.chandef.chan;
158 bool is_2ghz = chan->band == NL80211_BAND_2GHZ; 159 bool is_2ghz = chan->band == NL80211_BAND_2GHZ;
159 struct mt76_rate_power *t = &dev->mt76.rate_power;
160 u16 val, addr; 160 u16 val, addr;
161 s8 delta; 161 s8 delta;
162 162
@@ -189,7 +189,7 @@ void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev)
189 addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 8 : 0x126; 189 addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 8 : 0x126;
190 val = mt76x02_eeprom_get(dev, addr); 190 val = mt76x02_eeprom_get(dev, addr);
191 t->ht[4] = t->ht[5] = t->vht[4] = t->vht[5] = s6_to_s8(val); 191 t->ht[4] = t->ht[5] = t->vht[4] = t->vht[5] = s6_to_s8(val);
192 t->ht[6] = t->vht[6] = s6_to_s8(val >> 8); 192 t->ht[6] = t->ht[7] = t->vht[6] = t->vht[7] = s6_to_s8(val >> 8);
193 193
194 /* ht-vht mcs 1ss 0, 1, 2, 3 stbc */ 194 /* ht-vht mcs 1ss 0, 1, 2, 3 stbc */
195 addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 14 : 0xec; 195 addr = is_2ghz ? MT_EE_TX_POWER_BYRATE_BASE + 14 : 0xec;
@@ -205,14 +205,15 @@ void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev)
205 205
206 /* vht mcs 8, 9 5GHz */ 206 /* vht mcs 8, 9 5GHz */
207 val = mt76x02_eeprom_get(dev, 0x132); 207 val = mt76x02_eeprom_get(dev, 0x132);
208 t->vht[7] = s6_to_s8(val); 208 t->vht[8] = s6_to_s8(val);
209 t->vht[8] = s6_to_s8(val >> 8); 209 t->vht[9] = s6_to_s8(val >> 8);
210 210
211 delta = mt76x0_tssi_enabled(dev) ? 0 : mt76x0_get_delta(dev); 211 delta = mt76x0_tssi_enabled(dev) ? 0 : mt76x0_get_delta(dev);
212 mt76x02_add_rate_power_offset(t, delta); 212 mt76x02_add_rate_power_offset(t, delta);
213} 213}
214 214
215void mt76x0_get_power_info(struct mt76x02_dev *dev, s8 *tp) 215void mt76x0_get_power_info(struct mt76x02_dev *dev,
216 struct ieee80211_channel *chan, s8 *tp)
216{ 217{
217 struct mt76x0_chan_map { 218 struct mt76x0_chan_map {
218 u8 chan; 219 u8 chan;
@@ -226,7 +227,6 @@ void mt76x0_get_power_info(struct mt76x02_dev *dev, s8 *tp)
226 { 140, 26 }, { 151, 28 }, { 157, 30 }, { 161, 32 }, 227 { 140, 26 }, { 151, 28 }, { 157, 30 }, { 161, 32 },
227 { 167, 34 }, { 171, 36 }, { 175, 38 }, 228 { 167, 34 }, { 171, 36 }, { 175, 38 },
228 }; 229 };
229 struct ieee80211_channel *chan = dev->mt76.chandef.chan;
230 u8 offset, addr; 230 u8 offset, addr;
231 int i, idx = 0; 231 int i, idx = 0;
232 u16 data; 232 u16 data;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h
index 42b259f90b6d..7f73034a23b1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h
@@ -25,8 +25,11 @@ struct mt76x02_dev;
25 25
26int mt76x0_eeprom_init(struct mt76x02_dev *dev); 26int mt76x0_eeprom_init(struct mt76x02_dev *dev);
27void mt76x0_read_rx_gain(struct mt76x02_dev *dev); 27void mt76x0_read_rx_gain(struct mt76x02_dev *dev);
28void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev); 28void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev,
29void mt76x0_get_power_info(struct mt76x02_dev *dev, s8 *tp); 29 struct ieee80211_channel *chan,
30 struct mt76_rate_power *t);
31void mt76x0_get_power_info(struct mt76x02_dev *dev,
32 struct ieee80211_channel *chan, s8 *tp);
30 33
31static inline s8 s6_to_s8(u32 val) 34static inline s8 s6_to_s8(u32 val)
32{ 35{
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
index 87b575fe1c74..a529ce111c20 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
@@ -18,6 +18,7 @@
18#include "eeprom.h" 18#include "eeprom.h"
19#include "mcu.h" 19#include "mcu.h"
20#include "initvals.h" 20#include "initvals.h"
21#include "../mt76x02_phy.h"
21 22
22static void mt76x0_vht_cap_mask(struct ieee80211_supported_band *sband) 23static void mt76x0_vht_cap_mask(struct ieee80211_supported_band *sband)
23{ 24{
@@ -262,27 +263,24 @@ int mt76x0_init_hardware(struct mt76x02_dev *dev)
262} 263}
263EXPORT_SYMBOL_GPL(mt76x0_init_hardware); 264EXPORT_SYMBOL_GPL(mt76x0_init_hardware);
264 265
265struct mt76x02_dev * 266static void
266mt76x0_alloc_device(struct device *pdev, 267mt76x0_init_txpower(struct mt76x02_dev *dev,
267 const struct mt76_driver_ops *drv_ops, 268 struct ieee80211_supported_band *sband)
268 const struct ieee80211_ops *ops)
269{ 269{
270 struct mt76x02_dev *dev; 270 struct ieee80211_channel *chan;
271 struct mt76_dev *mdev; 271 struct mt76_rate_power t;
272 272 s8 tp;
273 mdev = mt76_alloc_device(sizeof(*dev), ops); 273 int i;
274 if (!mdev)
275 return NULL;
276 274
277 mdev->dev = pdev; 275 for (i = 0; i < sband->n_channels; i++) {
278 mdev->drv = drv_ops; 276 chan = &sband->channels[i];
279 277
280 dev = container_of(mdev, struct mt76x02_dev, mt76); 278 mt76x0_get_tx_power_per_rate(dev, chan, &t);
281 mutex_init(&dev->phy_mutex); 279 mt76x0_get_power_info(dev, chan, &tp);
282 280
283 return dev; 281 chan->max_power = (mt76x02_get_max_rate_power(&t) + tp) / 2;
282 }
284} 283}
285EXPORT_SYMBOL_GPL(mt76x0_alloc_device);
286 284
287int mt76x0_register_device(struct mt76x02_dev *dev) 285int mt76x0_register_device(struct mt76x02_dev *dev)
288{ 286{
@@ -296,9 +294,14 @@ int mt76x0_register_device(struct mt76x02_dev *dev)
296 if (ret) 294 if (ret)
297 return ret; 295 return ret;
298 296
299 /* overwrite unsupported features */ 297 if (dev->mt76.cap.has_5ghz) {
300 if (dev->mt76.cap.has_5ghz) 298 /* overwrite unsupported features */
301 mt76x0_vht_cap_mask(&dev->mt76.sband_5g.sband); 299 mt76x0_vht_cap_mask(&dev->mt76.sband_5g.sband);
300 mt76x0_init_txpower(dev, &dev->mt76.sband_5g.sband);
301 }
302
303 if (dev->mt76.cap.has_2ghz)
304 mt76x0_init_txpower(dev, &dev->mt76.sband_2g.sband);
302 305
303 mt76x02_init_debugfs(dev); 306 mt76x02_init_debugfs(dev);
304 307
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
index 46629f61673b..51fbd75dff31 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
@@ -50,10 +50,6 @@ static inline bool is_mt7630(struct mt76x02_dev *dev)
50} 50}
51 51
52/* Init */ 52/* Init */
53struct mt76x02_dev *
54mt76x0_alloc_device(struct device *pdev,
55 const struct mt76_driver_ops *drv_ops,
56 const struct ieee80211_ops *ops);
57int mt76x0_init_hardware(struct mt76x02_dev *dev); 53int mt76x0_init_hardware(struct mt76x02_dev *dev);
58int mt76x0_register_device(struct mt76x02_dev *dev); 54int mt76x0_register_device(struct mt76x02_dev *dev);
59void mt76x0_chip_onoff(struct mt76x02_dev *dev, bool enable, bool reset); 55void mt76x0_chip_onoff(struct mt76x02_dev *dev, bool enable, bool reset);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
index 1472c8699b29..f302162036d0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
@@ -30,7 +30,7 @@ static int mt76x0e_start(struct ieee80211_hw *hw)
30 mt76x02_mac_start(dev); 30 mt76x02_mac_start(dev);
31 mt76x0_phy_calibrate(dev, true); 31 mt76x0_phy_calibrate(dev, true);
32 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work, 32 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work,
33 MT_CALIBRATE_INTERVAL); 33 MT_MAC_WORK_INTERVAL);
34 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, 34 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
35 MT_CALIBRATE_INTERVAL); 35 MT_CALIBRATE_INTERVAL);
36 set_bit(MT76_STATE_RUNNING, &dev->mt76.state); 36 set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
@@ -174,6 +174,7 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
174 .sta_remove = mt76x02_sta_remove, 174 .sta_remove = mt76x02_sta_remove,
175 }; 175 };
176 struct mt76x02_dev *dev; 176 struct mt76x02_dev *dev;
177 struct mt76_dev *mdev;
177 int ret; 178 int ret;
178 179
179 ret = pcim_enable_device(pdev); 180 ret = pcim_enable_device(pdev);
@@ -190,16 +191,20 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
190 if (ret) 191 if (ret)
191 return ret; 192 return ret;
192 193
193 dev = mt76x0_alloc_device(&pdev->dev, &drv_ops, &mt76x0e_ops); 194 mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt76x0e_ops,
194 if (!dev) 195 &drv_ops);
196 if (!mdev)
195 return -ENOMEM; 197 return -ENOMEM;
196 198
197 mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]); 199 dev = container_of(mdev, struct mt76x02_dev, mt76);
200 mutex_init(&dev->phy_mutex);
201
202 mt76_mmio_init(mdev, pcim_iomap_table(pdev)[0]);
198 203
199 dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION); 204 mdev->rev = mt76_rr(dev, MT_ASIC_VERSION);
200 dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev); 205 dev_info(mdev->dev, "ASIC revision: %08x\n", mdev->rev);
201 206
202 ret = devm_request_irq(dev->mt76.dev, pdev->irq, mt76x02_irq_handler, 207 ret = devm_request_irq(mdev->dev, pdev->irq, mt76x02_irq_handler,
203 IRQF_SHARED, KBUILD_MODNAME, dev); 208 IRQF_SHARED, KBUILD_MODNAME, dev);
204 if (ret) 209 if (ret)
205 goto error; 210 goto error;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
index 1117cdc15b04..3467a32f5fda 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
@@ -847,14 +847,15 @@ void mt76x0_phy_set_txpower(struct mt76x02_dev *dev)
847 struct mt76_rate_power *t = &dev->mt76.rate_power; 847 struct mt76_rate_power *t = &dev->mt76.rate_power;
848 s8 info; 848 s8 info;
849 849
850 mt76x0_get_tx_power_per_rate(dev); 850 mt76x0_get_tx_power_per_rate(dev, dev->mt76.chandef.chan, t);
851 mt76x0_get_power_info(dev, &info); 851 mt76x0_get_power_info(dev, dev->mt76.chandef.chan, &info);
852 852
853 mt76x02_add_rate_power_offset(t, info); 853 mt76x02_add_rate_power_offset(t, info);
854 mt76x02_limit_rate_power(t, dev->mt76.txpower_conf); 854 mt76x02_limit_rate_power(t, dev->mt76.txpower_conf);
855 dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t); 855 dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t);
856 mt76x02_add_rate_power_offset(t, -info); 856 mt76x02_add_rate_power_offset(t, -info);
857 857
858 dev->target_power = info;
858 mt76x02_phy_set_txpower(dev, info, info); 859 mt76x02_phy_set_txpower(dev, info, info);
859} 860}
860 861
@@ -1006,14 +1007,16 @@ int mt76x0_phy_set_channel(struct mt76x02_dev *dev,
1006 1007
1007 /* enable vco */ 1008 /* enable vco */
1008 mt76x0_rf_set(dev, MT_RF(0, 4), BIT(7)); 1009 mt76x0_rf_set(dev, MT_RF(0, 4), BIT(7));
1009 if (scan) 1010 if (scan) {
1011 mt76x02_edcca_init(dev, false);
1010 return 0; 1012 return 0;
1013 }
1011 1014
1012 mt76x02_init_agc_gain(dev); 1015 mt76x02_init_agc_gain(dev);
1013 mt76x0_phy_calibrate(dev, false); 1016 mt76x0_phy_calibrate(dev, false);
1014 mt76x0_phy_set_txpower(dev); 1017 mt76x0_phy_set_txpower(dev);
1015 1018
1016 mt76x02_edcca_init(dev); 1019 mt76x02_edcca_init(dev, true);
1017 1020
1018 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, 1021 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
1019 MT_CALIBRATE_INTERVAL); 1022 MT_CALIBRATE_INTERVAL);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
index 3987adaaf2bd..da9d05f6074d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
@@ -118,7 +118,7 @@ static int mt76x0u_start(struct ieee80211_hw *hw)
118 118
119 mt76x0_phy_calibrate(dev, true); 119 mt76x0_phy_calibrate(dev, true);
120 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work, 120 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work,
121 MT_CALIBRATE_INTERVAL); 121 MT_MAC_WORK_INTERVAL);
122 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, 122 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
123 MT_CALIBRATE_INTERVAL); 123 MT_CALIBRATE_INTERVAL);
124 set_bit(MT76_STATE_RUNNING, &dev->mt76.state); 124 set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
@@ -206,7 +206,7 @@ static int mt76x0u_register_device(struct mt76x02_dev *dev)
206 goto out_err; 206 goto out_err;
207 207
208 /* check hw sg support in order to enable AMSDU */ 208 /* check hw sg support in order to enable AMSDU */
209 if (mt76u_check_sg(&dev->mt76)) 209 if (dev->mt76.usb.sg_en)
210 hw->max_tx_fragments = MT_SG_MAX_SIZE; 210 hw->max_tx_fragments = MT_SG_MAX_SIZE;
211 else 211 else
212 hw->max_tx_fragments = 1; 212 hw->max_tx_fragments = 1;
@@ -233,14 +233,18 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
233 }; 233 };
234 struct usb_device *usb_dev = interface_to_usbdev(usb_intf); 234 struct usb_device *usb_dev = interface_to_usbdev(usb_intf);
235 struct mt76x02_dev *dev; 235 struct mt76x02_dev *dev;
236 struct mt76_dev *mdev;
236 u32 asic_rev, mac_rev; 237 u32 asic_rev, mac_rev;
237 int ret; 238 int ret;
238 239
239 dev = mt76x0_alloc_device(&usb_intf->dev, &drv_ops, 240 mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), &mt76x0u_ops,
240 &mt76x0u_ops); 241 &drv_ops);
241 if (!dev) 242 if (!mdev)
242 return -ENOMEM; 243 return -ENOMEM;
243 244
245 dev = container_of(mdev, struct mt76x02_dev, mt76);
246 mutex_init(&dev->phy_mutex);
247
244 /* Quirk for Archer T1U */ 248 /* Quirk for Archer T1U */
245 if (id->driver_info) 249 if (id->driver_info)
246 dev->no_2ghz = true; 250 dev->no_2ghz = true;
@@ -250,27 +254,27 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
250 254
251 usb_set_intfdata(usb_intf, dev); 255 usb_set_intfdata(usb_intf, dev);
252 256
253 mt76x02u_init_mcu(&dev->mt76); 257 mt76x02u_init_mcu(mdev);
254 ret = mt76u_init(&dev->mt76, usb_intf); 258 ret = mt76u_init(mdev, usb_intf);
255 if (ret) 259 if (ret)
256 goto err; 260 goto err;
257 261
258 /* Disable the HW, otherwise MCU fail to initalize on hot reboot */ 262 /* Disable the HW, otherwise MCU fail to initalize on hot reboot */
259 mt76x0_chip_onoff(dev, false, false); 263 mt76x0_chip_onoff(dev, false, false);
260 264
261 if (!mt76x02_wait_for_mac(&dev->mt76)) { 265 if (!mt76x02_wait_for_mac(mdev)) {
262 ret = -ETIMEDOUT; 266 ret = -ETIMEDOUT;
263 goto err; 267 goto err;
264 } 268 }
265 269
266 asic_rev = mt76_rr(dev, MT_ASIC_VERSION); 270 asic_rev = mt76_rr(dev, MT_ASIC_VERSION);
267 mac_rev = mt76_rr(dev, MT_MAC_CSR0); 271 mac_rev = mt76_rr(dev, MT_MAC_CSR0);
268 dev_info(dev->mt76.dev, "ASIC revision: %08x MAC revision: %08x\n", 272 dev_info(mdev->dev, "ASIC revision: %08x MAC revision: %08x\n",
269 asic_rev, mac_rev); 273 asic_rev, mac_rev);
270 274
271 /* Note: vendor driver skips this check for MT76X0U */ 275 /* Note: vendor driver skips this check for MT76X0U */
272 if (!(mt76_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL)) 276 if (!(mt76_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL))
273 dev_warn(dev->mt76.dev, "Warning: eFUSE not present\n"); 277 dev_warn(mdev->dev, "Warning: eFUSE not present\n");
274 278
275 ret = mt76x0u_register_device(dev); 279 ret = mt76x0u_register_device(dev);
276 if (ret < 0) 280 if (ret < 0)
@@ -282,7 +286,7 @@ err:
282 usb_set_intfdata(usb_intf, NULL); 286 usb_set_intfdata(usb_intf, NULL);
283 usb_put_dev(interface_to_usbdev(usb_intf)); 287 usb_put_dev(interface_to_usbdev(usb_intf));
284 288
285 ieee80211_free_hw(dev->mt76.hw); 289 ieee80211_free_hw(mdev->hw);
286 return ret; 290 return ret;
287} 291}
288 292
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c
index f391d2d21fbc..4a282761ca58 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c
@@ -140,12 +140,6 @@ static int mt76x0u_load_firmware(struct mt76x02_dev *dev)
140 FIELD_PREP(MT_USB_DMA_CFG_RX_BULK_AGG_TOUT, 0x20)); 140 FIELD_PREP(MT_USB_DMA_CFG_RX_BULK_AGG_TOUT, 0x20));
141 mt76x02u_mcu_fw_reset(dev); 141 mt76x02u_mcu_fw_reset(dev);
142 usleep_range(5000, 6000); 142 usleep_range(5000, 6000);
143/*
144 mt76x0_rmw(dev, MT_PBF_CFG, 0, (MT_PBF_CFG_TX0Q_EN |
145 MT_PBF_CFG_TX1Q_EN |
146 MT_PBF_CFG_TX2Q_EN |
147 MT_PBF_CFG_TX3Q_EN));
148*/
149 143
150 mt76_wr(dev, MT_FCE_PSE_CTRL, 1); 144 mt76_wr(dev, MT_FCE_PSE_CTRL, 1);
151 145
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index 6d96766a6ed3..3464b4ca2ea8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -27,6 +27,7 @@
27#include "mt76x02_dma.h" 27#include "mt76x02_dma.h"
28 28
29#define MT_CALIBRATE_INTERVAL HZ 29#define MT_CALIBRATE_INTERVAL HZ
30#define MT_MAC_WORK_INTERVAL (HZ / 10)
30 31
31#define MT_WATCHDOG_TIME (HZ / 10) 32#define MT_WATCHDOG_TIME (HZ / 10)
32#define MT_TX_HANG_TH 10 33#define MT_TX_HANG_TH 10
@@ -73,6 +74,8 @@ struct mt76x02_dev {
73 74
74 struct mutex phy_mutex; 75 struct mutex phy_mutex;
75 76
77 u16 vif_mask;
78
76 u8 txdone_seq; 79 u8 txdone_seq;
77 DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x02_tx_status); 80 DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x02_tx_status);
78 81
@@ -114,6 +117,7 @@ struct mt76x02_dev {
114 bool ed_monitor; 117 bool ed_monitor;
115 u8 ed_trigger; 118 u8 ed_trigger;
116 u8 ed_silent; 119 u8 ed_silent;
120 ktime_t ed_time;
117}; 121};
118 122
119extern struct ieee80211_rate mt76x02_rates[12]; 123extern struct ieee80211_rate mt76x02_rates[12];
@@ -128,8 +132,7 @@ void mt76x02_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
128 struct ieee80211_sta *sta); 132 struct ieee80211_sta *sta);
129 133
130void mt76x02_config_mac_addr_list(struct mt76x02_dev *dev); 134void mt76x02_config_mac_addr_list(struct mt76x02_dev *dev);
131void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif, 135
132 unsigned int idx);
133int mt76x02_add_interface(struct ieee80211_hw *hw, 136int mt76x02_add_interface(struct ieee80211_hw *hw,
134 struct ieee80211_vif *vif); 137 struct ieee80211_vif *vif);
135void mt76x02_remove_interface(struct ieee80211_hw *hw, 138void mt76x02_remove_interface(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
index 19fdcab746a0..e4649103efd4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
@@ -886,7 +886,7 @@ mt76x02_dfs_set_domain(struct mt76x02_dev *dev,
886 tasklet_disable(&dfs_pd->dfs_tasklet); 886 tasklet_disable(&dfs_pd->dfs_tasklet);
887 887
888 dev->ed_monitor = region == NL80211_DFS_ETSI; 888 dev->ed_monitor = region == NL80211_DFS_ETSI;
889 mt76x02_edcca_init(dev); 889 mt76x02_edcca_init(dev, true);
890 890
891 dfs_pd->region = region; 891 dfs_pd->region = region;
892 mt76x02_dfs_init_params(dev); 892 mt76x02_dfs_init_params(dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index 63fa27d2c404..be2979f34f31 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -291,6 +291,13 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
291 291
292 memset(txwi, 0, sizeof(*txwi)); 292 memset(txwi, 0, sizeof(*txwi));
293 293
294 if (!info->control.hw_key && wcid && wcid->hw_key_idx != 0xff &&
295 ieee80211_has_protected(hdr->frame_control)) {
296 wcid = NULL;
297 ieee80211_get_tx_rates(info->control.vif, sta, skb,
298 info->control.rates, 1);
299 }
300
294 if (wcid) 301 if (wcid)
295 txwi->wcid = wcid->idx; 302 txwi->wcid = wcid->idx;
296 else 303 else
@@ -307,7 +314,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
307 ccmp_pn[6] = pn >> 32; 314 ccmp_pn[6] = pn >> 32;
308 ccmp_pn[7] = pn >> 40; 315 ccmp_pn[7] = pn >> 40;
309 txwi->iv = *((__le32 *)&ccmp_pn[0]); 316 txwi->iv = *((__le32 *)&ccmp_pn[0]);
310 txwi->eiv = *((__le32 *)&ccmp_pn[1]); 317 txwi->eiv = *((__le32 *)&ccmp_pn[4]);
311 } 318 }
312 319
313 spin_lock_bh(&dev->mt76.lock); 320 spin_lock_bh(&dev->mt76.lock);
@@ -548,8 +555,11 @@ mt76x02_mac_process_rate(struct mt76x02_dev *dev,
548 return 0; 555 return 0;
549} 556}
550 557
551void mt76x02_mac_setaddr(struct mt76x02_dev *dev, u8 *addr) 558void mt76x02_mac_setaddr(struct mt76x02_dev *dev, const u8 *addr)
552{ 559{
560 static const u8 null_addr[ETH_ALEN] = {};
561 int i;
562
553 ether_addr_copy(dev->mt76.macaddr, addr); 563 ether_addr_copy(dev->mt76.macaddr, addr);
554 564
555 if (!is_valid_ether_addr(dev->mt76.macaddr)) { 565 if (!is_valid_ether_addr(dev->mt76.macaddr)) {
@@ -563,6 +573,16 @@ void mt76x02_mac_setaddr(struct mt76x02_dev *dev, u8 *addr)
563 mt76_wr(dev, MT_MAC_ADDR_DW1, 573 mt76_wr(dev, MT_MAC_ADDR_DW1,
564 get_unaligned_le16(dev->mt76.macaddr + 4) | 574 get_unaligned_le16(dev->mt76.macaddr + 4) |
565 FIELD_PREP(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff)); 575 FIELD_PREP(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff));
576
577 mt76_wr(dev, MT_MAC_BSSID_DW0,
578 get_unaligned_le32(dev->mt76.macaddr));
579 mt76_wr(dev, MT_MAC_BSSID_DW1,
580 get_unaligned_le16(dev->mt76.macaddr + 4) |
581 FIELD_PREP(MT_MAC_BSSID_DW1_MBSS_MODE, 3) | /* 8 APs + 8 STAs */
582 MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT);
583
584 for (i = 0; i < 16; i++)
585 mt76x02_mac_set_bssid(dev, i, null_addr);
566} 586}
567EXPORT_SYMBOL_GPL(mt76x02_mac_setaddr); 587EXPORT_SYMBOL_GPL(mt76x02_mac_setaddr);
568 588
@@ -588,7 +608,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
588 u16 rate = le16_to_cpu(rxwi->rate); 608 u16 rate = le16_to_cpu(rxwi->rate);
589 u16 tid_sn = le16_to_cpu(rxwi->tid_sn); 609 u16 tid_sn = le16_to_cpu(rxwi->tid_sn);
590 bool unicast = rxwi->rxinfo & cpu_to_le32(MT_RXINFO_UNICAST); 610 bool unicast = rxwi->rxinfo & cpu_to_le32(MT_RXINFO_UNICAST);
591 int i, pad_len = 0, nstreams = dev->mt76.chainmask & 0xf; 611 int pad_len = 0, nstreams = dev->mt76.chainmask & 0xf;
592 s8 signal; 612 s8 signal;
593 u8 pn_len; 613 u8 pn_len;
594 u8 wcid; 614 u8 wcid;
@@ -648,12 +668,13 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
648 668
649 status->chains = BIT(0); 669 status->chains = BIT(0);
650 signal = mt76x02_mac_get_rssi(dev, rxwi->rssi[0], 0); 670 signal = mt76x02_mac_get_rssi(dev, rxwi->rssi[0], 0);
651 for (i = 0; i < nstreams; i++) { 671 status->chain_signal[0] = signal;
652 status->chains |= BIT(i); 672 if (nstreams > 1) {
653 status->chain_signal[i] = mt76x02_mac_get_rssi(dev, 673 status->chains |= BIT(1);
654 rxwi->rssi[i], 674 status->chain_signal[1] = mt76x02_mac_get_rssi(dev,
655 i); 675 rxwi->rssi[1],
656 signal = max_t(s8, signal, status->chain_signal[i]); 676 1);
677 signal = max_t(s8, signal, status->chain_signal[1]);
657 } 678 }
658 status->signal = signal; 679 status->signal = signal;
659 status->freq = dev->mt76.chandef.chan->center_freq; 680 status->freq = dev->mt76.chandef.chan->center_freq;
@@ -871,12 +892,12 @@ mt76x02_edcca_tx_enable(struct mt76x02_dev *dev, bool enable)
871 dev->ed_tx_blocked = !enable; 892 dev->ed_tx_blocked = !enable;
872} 893}
873 894
874void mt76x02_edcca_init(struct mt76x02_dev *dev) 895void mt76x02_edcca_init(struct mt76x02_dev *dev, bool enable)
875{ 896{
876 dev->ed_trigger = 0; 897 dev->ed_trigger = 0;
877 dev->ed_silent = 0; 898 dev->ed_silent = 0;
878 899
879 if (dev->ed_monitor) { 900 if (dev->ed_monitor && enable) {
880 struct ieee80211_channel *chan = dev->mt76.chandef.chan; 901 struct ieee80211_channel *chan = dev->mt76.chandef.chan;
881 u8 ed_th = chan->band == NL80211_BAND_5GHZ ? 0x0e : 0x20; 902 u8 ed_th = chan->band == NL80211_BAND_5GHZ ? 0x0e : 0x20;
882 903
@@ -899,17 +920,27 @@ void mt76x02_edcca_init(struct mt76x02_dev *dev)
899 } 920 }
900 } 921 }
901 mt76x02_edcca_tx_enable(dev, true); 922 mt76x02_edcca_tx_enable(dev, true);
923
924 /* clear previous CCA timer value */
925 mt76_rr(dev, MT_ED_CCA_TIMER);
926 dev->ed_time = ktime_get_boottime();
902} 927}
903EXPORT_SYMBOL_GPL(mt76x02_edcca_init); 928EXPORT_SYMBOL_GPL(mt76x02_edcca_init);
904 929
905#define MT_EDCCA_TH 90 930#define MT_EDCCA_TH 92
906#define MT_EDCCA_BLOCK_TH 2 931#define MT_EDCCA_BLOCK_TH 2
907static void mt76x02_edcca_check(struct mt76x02_dev *dev) 932static void mt76x02_edcca_check(struct mt76x02_dev *dev)
908{ 933{
909 u32 val, busy; 934 ktime_t cur_time;
935 u32 active, val, busy;
910 936
937 cur_time = ktime_get_boottime();
911 val = mt76_rr(dev, MT_ED_CCA_TIMER); 938 val = mt76_rr(dev, MT_ED_CCA_TIMER);
912 busy = (val * 100) / jiffies_to_usecs(MT_CALIBRATE_INTERVAL); 939
940 active = ktime_to_us(ktime_sub(cur_time, dev->ed_time));
941 dev->ed_time = cur_time;
942
943 busy = (val * 100) / active;
913 busy = min_t(u32, busy, 100); 944 busy = min_t(u32, busy, 100);
914 945
915 if (busy > MT_EDCCA_TH) { 946 if (busy > MT_EDCCA_TH) {
@@ -955,7 +986,7 @@ void mt76x02_mac_work(struct work_struct *work)
955 mt76_tx_status_check(&dev->mt76, NULL, false); 986 mt76_tx_status_check(&dev->mt76, NULL, false);
956 987
957 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work, 988 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
958 MT_CALIBRATE_INTERVAL); 989 MT_MAC_WORK_INTERVAL);
959} 990}
960 991
961void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) 992void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr)
@@ -1047,8 +1078,9 @@ int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx,
1047 return 0; 1078 return 0;
1048} 1079}
1049 1080
1050void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, 1081static void
1051 u8 vif_idx, bool val) 1082__mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, u8 vif_idx,
1083 bool val, struct sk_buff *skb)
1052{ 1084{
1053 u8 old_mask = dev->beacon_mask; 1085 u8 old_mask = dev->beacon_mask;
1054 bool en; 1086 bool en;
@@ -1056,6 +1088,8 @@ void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
1056 1088
1057 if (val) { 1089 if (val) {
1058 dev->beacon_mask |= BIT(vif_idx); 1090 dev->beacon_mask |= BIT(vif_idx);
1091 if (skb)
1092 mt76x02_mac_set_beacon(dev, vif_idx, skb);
1059 } else { 1093 } else {
1060 dev->beacon_mask &= ~BIT(vif_idx); 1094 dev->beacon_mask &= ~BIT(vif_idx);
1061 mt76x02_mac_set_beacon(dev, vif_idx, NULL); 1095 mt76x02_mac_set_beacon(dev, vif_idx, NULL);
@@ -1066,14 +1100,34 @@ void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
1066 1100
1067 en = dev->beacon_mask; 1101 en = dev->beacon_mask;
1068 1102
1069 mt76_rmw_field(dev, MT_INT_TIMER_EN, MT_INT_TIMER_EN_PRE_TBTT_EN, en);
1070 reg = MT_BEACON_TIME_CFG_BEACON_TX | 1103 reg = MT_BEACON_TIME_CFG_BEACON_TX |
1071 MT_BEACON_TIME_CFG_TBTT_EN | 1104 MT_BEACON_TIME_CFG_TBTT_EN |
1072 MT_BEACON_TIME_CFG_TIMER_EN; 1105 MT_BEACON_TIME_CFG_TIMER_EN;
1073 mt76_rmw(dev, MT_BEACON_TIME_CFG, reg, reg * en); 1106 mt76_rmw(dev, MT_BEACON_TIME_CFG, reg, reg * en);
1074 1107
1108 if (mt76_is_usb(dev))
1109 return;
1110
1111 mt76_rmw_field(dev, MT_INT_TIMER_EN, MT_INT_TIMER_EN_PRE_TBTT_EN, en);
1075 if (en) 1112 if (en)
1076 mt76x02_irq_enable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT); 1113 mt76x02_irq_enable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT);
1077 else 1114 else
1078 mt76x02_irq_disable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT); 1115 mt76x02_irq_disable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT);
1079} 1116}
1117
1118void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
1119 struct ieee80211_vif *vif, bool val)
1120{
1121 u8 vif_idx = ((struct mt76x02_vif *)vif->drv_priv)->idx;
1122 struct sk_buff *skb = NULL;
1123
1124 if (mt76_is_mmio(dev))
1125 tasklet_disable(&dev->pre_tbtt_tasklet);
1126 else if (val)
1127 skb = ieee80211_beacon_get(mt76_hw(dev), vif);
1128
1129 __mt76x02_mac_set_beacon_enable(dev, vif_idx, val, skb);
1130
1131 if (mt76_is_mmio(dev))
1132 tasklet_enable(&dev->pre_tbtt_tasklet);
1133}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
index 940c07f665cd..6b1f25d2f64c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
@@ -191,7 +191,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
191void mt76x02_mac_set_tx_protection(struct mt76x02_dev *dev, bool legacy_prot, 191void mt76x02_mac_set_tx_protection(struct mt76x02_dev *dev, bool legacy_prot,
192 int ht_mode); 192 int ht_mode);
193void mt76x02_mac_set_rts_thresh(struct mt76x02_dev *dev, u32 val); 193void mt76x02_mac_set_rts_thresh(struct mt76x02_dev *dev, u32 val);
194void mt76x02_mac_setaddr(struct mt76x02_dev *dev, u8 *addr); 194void mt76x02_mac_setaddr(struct mt76x02_dev *dev, const u8 *addr);
195void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, 195void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
196 struct sk_buff *skb, struct mt76_wcid *wcid, 196 struct sk_buff *skb, struct mt76_wcid *wcid,
197 struct ieee80211_sta *sta, int len); 197 struct ieee80211_sta *sta, int len);
@@ -204,8 +204,8 @@ void mt76x02_mac_work(struct work_struct *work);
204void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr); 204void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr);
205int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx, 205int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx,
206 struct sk_buff *skb); 206 struct sk_buff *skb);
207void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, u8 vif_idx, 207void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
208 bool val); 208 struct ieee80211_vif *vif, bool val);
209 209
210void mt76x02_edcca_init(struct mt76x02_dev *dev); 210void mt76x02_edcca_init(struct mt76x02_dev *dev, bool enable);
211#endif 211#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
index b7f4edb729e3..4752c104abf3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
@@ -21,70 +21,13 @@
21 21
22#include "mt76x02_mcu.h" 22#include "mt76x02_mcu.h"
23 23
24static struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len)
25{
26 struct sk_buff *skb;
27
28 skb = alloc_skb(len, GFP_KERNEL);
29 if (!skb)
30 return NULL;
31 memcpy(skb_put(skb, len), data, len);
32
33 return skb;
34}
35
36static struct sk_buff *
37mt76x02_mcu_get_response(struct mt76x02_dev *dev, unsigned long expires)
38{
39 unsigned long timeout;
40
41 if (!time_is_after_jiffies(expires))
42 return NULL;
43
44 timeout = expires - jiffies;
45 wait_event_timeout(dev->mt76.mmio.mcu.wait,
46 !skb_queue_empty(&dev->mt76.mmio.mcu.res_q),
47 timeout);
48 return skb_dequeue(&dev->mt76.mmio.mcu.res_q);
49}
50
51static int
52mt76x02_tx_queue_mcu(struct mt76x02_dev *dev, enum mt76_txq_id qid,
53 struct sk_buff *skb, int cmd, int seq)
54{
55 struct mt76_queue *q = &dev->mt76.q_tx[qid];
56 struct mt76_queue_buf buf;
57 dma_addr_t addr;
58 u32 tx_info;
59
60 tx_info = MT_MCU_MSG_TYPE_CMD |
61 FIELD_PREP(MT_MCU_MSG_CMD_TYPE, cmd) |
62 FIELD_PREP(MT_MCU_MSG_CMD_SEQ, seq) |
63 FIELD_PREP(MT_MCU_MSG_PORT, CPU_TX_PORT) |
64 FIELD_PREP(MT_MCU_MSG_LEN, skb->len);
65
66 addr = dma_map_single(dev->mt76.dev, skb->data, skb->len,
67 DMA_TO_DEVICE);
68 if (dma_mapping_error(dev->mt76.dev, addr))
69 return -ENOMEM;
70
71 buf.addr = addr;
72 buf.len = skb->len;
73
74 spin_lock_bh(&q->lock);
75 mt76_queue_add_buf(dev, q, &buf, 1, tx_info, skb, NULL);
76 mt76_queue_kick(dev, q);
77 spin_unlock_bh(&q->lock);
78
79 return 0;
80}
81
82int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data, 24int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data,
83 int len, bool wait_resp) 25 int len, bool wait_resp)
84{ 26{
85 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 27 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
86 unsigned long expires = jiffies + HZ; 28 unsigned long expires = jiffies + HZ;
87 struct sk_buff *skb; 29 struct sk_buff *skb;
30 u32 tx_info;
88 int ret; 31 int ret;
89 u8 seq; 32 u8 seq;
90 33
@@ -98,7 +41,13 @@ int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data,
98 if (!seq) 41 if (!seq)
99 seq = ++mdev->mmio.mcu.msg_seq & 0xf; 42 seq = ++mdev->mmio.mcu.msg_seq & 0xf;
100 43
101 ret = mt76x02_tx_queue_mcu(dev, MT_TXQ_MCU, skb, cmd, seq); 44 tx_info = MT_MCU_MSG_TYPE_CMD |
45 FIELD_PREP(MT_MCU_MSG_CMD_TYPE, cmd) |
46 FIELD_PREP(MT_MCU_MSG_CMD_SEQ, seq) |
47 FIELD_PREP(MT_MCU_MSG_PORT, CPU_TX_PORT) |
48 FIELD_PREP(MT_MCU_MSG_LEN, skb->len);
49
50 ret = mt76_tx_queue_skb_raw(dev, MT_TXQ_MCU, skb, tx_info);
102 if (ret) 51 if (ret)
103 goto out; 52 goto out;
104 53
@@ -106,7 +55,7 @@ int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data,
106 u32 *rxfce; 55 u32 *rxfce;
107 bool check_seq = false; 56 bool check_seq = false;
108 57
109 skb = mt76x02_mcu_get_response(dev, expires); 58 skb = mt76_mcu_get_response(&dev->mt76, expires);
110 if (!skb) { 59 if (!skb) {
111 dev_err(mdev->dev, 60 dev_err(mdev->dev,
112 "MCU message %d (seq %d) timed out\n", cmd, 61 "MCU message %d (seq %d) timed out\n", cmd,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.h
index 7e4004120102..a7b0d3e5df1d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.h
@@ -96,6 +96,12 @@ struct mt76x02_patch_header {
96 u8 pad[2]; 96 u8 pad[2];
97}; 97};
98 98
99static inline struct sk_buff *
100mt76x02_mcu_msg_alloc(const void *data, int len)
101{
102 return mt76_mcu_msg_alloc(data, 0, len, 0);
103}
104
99int mt76x02_mcu_cleanup(struct mt76x02_dev *dev); 105int mt76x02_mcu_cleanup(struct mt76x02_dev *dev);
100int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type, u32 param); 106int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type, u32 param);
101int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data, 107int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c b/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c
index a5413a309a0a..94f47248c59f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c
@@ -22,7 +22,6 @@
22void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, 22void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
23 struct sk_buff *skb) 23 struct sk_buff *skb)
24{ 24{
25 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
26 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 25 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
27 struct mt76x02_dev *dev = hw->priv; 26 struct mt76x02_dev *dev = hw->priv;
28 struct ieee80211_vif *vif = info->control.vif; 27 struct ieee80211_vif *vif = info->control.vif;
@@ -33,13 +32,7 @@ void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
33 32
34 msta = (struct mt76x02_sta *)control->sta->drv_priv; 33 msta = (struct mt76x02_sta *)control->sta->drv_priv;
35 wcid = &msta->wcid; 34 wcid = &msta->wcid;
36 /* sw encrypted frames */ 35 } else if (vif) {
37 if (!info->control.hw_key && wcid->hw_key_idx != 0xff &&
38 ieee80211_has_protected(hdr->frame_control))
39 control->sta = NULL;
40 }
41
42 if (vif && !control->sta) {
43 struct mt76x02_vif *mvif; 36 struct mt76x02_vif *mvif;
44 37
45 mvif = (struct mt76x02_vif *)vif->drv_priv; 38 mvif = (struct mt76x02_vif *)vif->drv_priv;
@@ -58,8 +51,7 @@ void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
58 51
59 if (q == MT_RXQ_MCU) { 52 if (q == MT_RXQ_MCU) {
60 /* this is used just by mmio code */ 53 /* this is used just by mmio code */
61 skb_queue_tail(&mdev->mmio.mcu.res_q, skb); 54 mt76_mcu_rx_event(&dev->mt76, skb);
62 wake_up(&mdev->mmio.mcu.wait);
63 return; 55 return;
64 } 56 }
65 57
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
index 098d05e109e7..43f07461c8d3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
@@ -49,7 +49,12 @@ int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
49 FIELD_PREP(MT_TXD_INFO_DPORT, port) | flags; 49 FIELD_PREP(MT_TXD_INFO_DPORT, port) | flags;
50 put_unaligned_le32(info, skb_push(skb, sizeof(info))); 50 put_unaligned_le32(info, skb_push(skb, sizeof(info)));
51 51
52 /* Add zero pad of 4 - 7 bytes */
52 pad = round_up(skb->len, 4) + 4 - skb->len; 53 pad = round_up(skb->len, 4) + 4 - skb->len;
54
55 /* First packet of a A-MSDU burst keeps track of the whole burst
56 * length, need to update lenght of it and the last packet.
57 */
53 skb_walk_frags(skb, iter) { 58 skb_walk_frags(skb, iter) {
54 last = iter; 59 last = iter;
55 if (!iter->next) { 60 if (!iter->next) {
@@ -59,11 +64,10 @@ int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
59 } 64 }
60 } 65 }
61 66
62 if (unlikely(pad)) { 67 if (skb_pad(last, pad))
63 if (skb_pad(last, pad)) 68 return -ENOMEM;
64 return -ENOMEM; 69 __skb_put(last, pad);
65 __skb_put(last, pad); 70
66 }
67 return 0; 71 return 0;
68} 72}
69 73
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
index 6db789f90269..e469e383cb88 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
@@ -28,21 +28,6 @@
28 28
29#define MT_TX_CPU_FROM_FCE_CPU_DESC_IDX 0x09a8 29#define MT_TX_CPU_FROM_FCE_CPU_DESC_IDX 0x09a8
30 30
31static struct sk_buff *
32mt76x02u_mcu_msg_alloc(const void *data, int len)
33{
34 struct sk_buff *skb;
35
36 skb = alloc_skb(MT_CMD_HDR_LEN + len + 8, GFP_KERNEL);
37 if (!skb)
38 return NULL;
39
40 skb_reserve(skb, MT_CMD_HDR_LEN);
41 skb_put_data(skb, data, len);
42
43 return skb;
44}
45
46static void 31static void
47mt76x02u_multiple_mcu_reads(struct mt76_dev *dev, u8 *data, int len) 32mt76x02u_multiple_mcu_reads(struct mt76_dev *dev, u8 *data, int len)
48{ 33{
@@ -78,9 +63,9 @@ static int mt76x02u_mcu_wait_resp(struct mt76_dev *dev, u8 seq)
78 struct mt76_usb *usb = &dev->usb; 63 struct mt76_usb *usb = &dev->usb;
79 struct mt76u_buf *buf = &usb->mcu.res; 64 struct mt76u_buf *buf = &usb->mcu.res;
80 struct urb *urb = buf->urb; 65 struct urb *urb = buf->urb;
66 u8 *data = buf->buf;
81 int i, ret; 67 int i, ret;
82 u32 rxfce; 68 u32 rxfce;
83 u8 *data;
84 69
85 for (i = 0; i < 5; i++) { 70 for (i = 0; i < 5; i++) {
86 if (!wait_for_completion_timeout(&usb->mcu.cmpl, 71 if (!wait_for_completion_timeout(&usb->mcu.cmpl,
@@ -90,7 +75,6 @@ static int mt76x02u_mcu_wait_resp(struct mt76_dev *dev, u8 seq)
90 if (urb->status) 75 if (urb->status)
91 return -EIO; 76 return -EIO;
92 77
93 data = sg_virt(&urb->sg[0]);
94 if (usb->mcu.rp) 78 if (usb->mcu.rp)
95 mt76x02u_multiple_mcu_reads(dev, data + 4, 79 mt76x02u_multiple_mcu_reads(dev, data + 4,
96 urb->actual_length - 8); 80 urb->actual_length - 8);
@@ -121,18 +105,14 @@ static int
121__mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb, 105__mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
122 int cmd, bool wait_resp) 106 int cmd, bool wait_resp)
123{ 107{
124 struct usb_interface *intf = to_usb_interface(dev->dev);
125 struct usb_device *udev = interface_to_usbdev(intf);
126 struct mt76_usb *usb = &dev->usb; 108 struct mt76_usb *usb = &dev->usb;
127 unsigned int pipe; 109 int ret;
128 int ret, sent;
129 u8 seq = 0; 110 u8 seq = 0;
130 u32 info; 111 u32 info;
131 112
132 if (test_bit(MT76_REMOVED, &dev->state)) 113 if (test_bit(MT76_REMOVED, &dev->state))
133 return 0; 114 return 0;
134 115
135 pipe = usb_sndbulkpipe(udev, usb->out_ep[MT_EP_OUT_INBAND_CMD]);
136 if (wait_resp) { 116 if (wait_resp) {
137 seq = ++usb->mcu.msg_seq & 0xf; 117 seq = ++usb->mcu.msg_seq & 0xf;
138 if (!seq) 118 if (!seq)
@@ -146,7 +126,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
146 if (ret) 126 if (ret)
147 return ret; 127 return ret;
148 128
149 ret = usb_bulk_msg(udev, pipe, skb->data, skb->len, &sent, 500); 129 ret = mt76u_bulk_msg(dev, skb->data, skb->len, 500);
150 if (ret) 130 if (ret)
151 return ret; 131 return ret;
152 132
@@ -166,7 +146,7 @@ mt76x02u_mcu_send_msg(struct mt76_dev *dev, int cmd, const void *data,
166 struct sk_buff *skb; 146 struct sk_buff *skb;
167 int err; 147 int err;
168 148
169 skb = mt76x02u_mcu_msg_alloc(data, len); 149 skb = mt76_mcu_msg_alloc(data, MT_CMD_HDR_LEN, len, 8);
170 if (!skb) 150 if (!skb)
171 return -ENOMEM; 151 return -ENOMEM;
172 152
@@ -268,14 +248,12 @@ void mt76x02u_mcu_fw_reset(struct mt76x02_dev *dev)
268EXPORT_SYMBOL_GPL(mt76x02u_mcu_fw_reset); 248EXPORT_SYMBOL_GPL(mt76x02u_mcu_fw_reset);
269 249
270static int 250static int
271__mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, struct mt76u_buf *buf, 251__mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, u8 *data,
272 const void *fw_data, int len, u32 dst_addr) 252 const void *fw_data, int len, u32 dst_addr)
273{ 253{
274 u8 *data = sg_virt(&buf->urb->sg[0]);
275 DECLARE_COMPLETION_ONSTACK(cmpl);
276 __le32 info; 254 __le32 info;
277 u32 val; 255 u32 val;
278 int err; 256 int err, data_len;
279 257
280 info = cpu_to_le32(FIELD_PREP(MT_MCU_MSG_PORT, CPU_TX_PORT) | 258 info = cpu_to_le32(FIELD_PREP(MT_MCU_MSG_PORT, CPU_TX_PORT) |
281 FIELD_PREP(MT_MCU_MSG_LEN, len) | 259 FIELD_PREP(MT_MCU_MSG_LEN, len) |
@@ -291,25 +269,12 @@ __mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, struct mt76u_buf *buf,
291 mt76u_single_wr(&dev->mt76, MT_VEND_WRITE_FCE, 269 mt76u_single_wr(&dev->mt76, MT_VEND_WRITE_FCE,
292 MT_FCE_DMA_LEN, len << 16); 270 MT_FCE_DMA_LEN, len << 16);
293 271
294 buf->len = MT_CMD_HDR_LEN + len + sizeof(info); 272 data_len = MT_CMD_HDR_LEN + len + sizeof(info);
295 err = mt76u_submit_buf(&dev->mt76, USB_DIR_OUT,
296 MT_EP_OUT_INBAND_CMD,
297 buf, GFP_KERNEL,
298 mt76u_mcu_complete_urb, &cmpl);
299 if (err < 0)
300 return err;
301
302 if (!wait_for_completion_timeout(&cmpl,
303 msecs_to_jiffies(1000))) {
304 dev_err(dev->mt76.dev, "firmware upload timed out\n");
305 usb_kill_urb(buf->urb);
306 return -ETIMEDOUT;
307 }
308 273
309 if (mt76u_urb_error(buf->urb)) { 274 err = mt76u_bulk_msg(&dev->mt76, data, data_len, 1000);
310 dev_err(dev->mt76.dev, "firmware upload failed: %d\n", 275 if (err) {
311 buf->urb->status); 276 dev_err(dev->mt76.dev, "firmware upload failed: %d\n", err);
312 return buf->urb->status; 277 return err;
313 } 278 }
314 279
315 val = mt76_rr(dev, MT_TX_CPU_FROM_FCE_CPU_DESC_IDX); 280 val = mt76_rr(dev, MT_TX_CPU_FROM_FCE_CPU_DESC_IDX);
@@ -322,17 +287,16 @@ __mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, struct mt76u_buf *buf,
322int mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, const void *data, 287int mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, const void *data,
323 int data_len, u32 max_payload, u32 offset) 288 int data_len, u32 max_payload, u32 offset)
324{ 289{
325 int err, len, pos = 0, max_len = max_payload - 8; 290 int len, err = 0, pos = 0, max_len = max_payload - 8;
326 struct mt76u_buf buf; 291 u8 *buf;
327 292
328 err = mt76u_buf_alloc(&dev->mt76, &buf, 1, max_payload, max_payload, 293 buf = kmalloc(max_payload, GFP_KERNEL);
329 GFP_KERNEL); 294 if (!buf)
330 if (err < 0) 295 return -ENOMEM;
331 return err;
332 296
333 while (data_len > 0) { 297 while (data_len > 0) {
334 len = min_t(int, data_len, max_len); 298 len = min_t(int, data_len, max_len);
335 err = __mt76x02u_mcu_fw_send_data(dev, &buf, data + pos, 299 err = __mt76x02u_mcu_fw_send_data(dev, buf, data + pos,
336 len, offset + pos); 300 len, offset + pos);
337 if (err < 0) 301 if (err < 0)
338 break; 302 break;
@@ -341,7 +305,7 @@ int mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, const void *data,
341 pos += len; 305 pos += len;
342 usleep_range(5000, 10000); 306 usleep_range(5000, 10000);
343 } 307 }
344 mt76u_buf_free(&buf); 308 kfree(buf);
345 309
346 return err; 310 return err;
347} 311}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 062614ad0d51..11b5f664f5b1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -140,10 +140,16 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
140 hw->max_rate_tries = 1; 140 hw->max_rate_tries = 1;
141 hw->extra_tx_headroom = 2; 141 hw->extra_tx_headroom = 2;
142 142
143 wiphy->interface_modes =
144 BIT(NL80211_IFTYPE_STATION) |
145#ifdef CONFIG_MAC80211_MESH
146 BIT(NL80211_IFTYPE_MESH_POINT) |
147#endif
148 BIT(NL80211_IFTYPE_ADHOC);
149
143 if (mt76_is_usb(dev)) { 150 if (mt76_is_usb(dev)) {
144 hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) + 151 hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) +
145 MT_DMA_HDR_LEN; 152 MT_DMA_HDR_LEN;
146 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
147 } else { 153 } else {
148 INIT_DELAYED_WORK(&dev->wdt_work, mt76x02_wdt_work); 154 INIT_DELAYED_WORK(&dev->wdt_work, mt76x02_wdt_work);
149 155
@@ -152,18 +158,9 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
152 wiphy->reg_notifier = mt76x02_regd_notifier; 158 wiphy->reg_notifier = mt76x02_regd_notifier;
153 wiphy->iface_combinations = mt76x02_if_comb; 159 wiphy->iface_combinations = mt76x02_if_comb;
154 wiphy->n_iface_combinations = ARRAY_SIZE(mt76x02_if_comb); 160 wiphy->n_iface_combinations = ARRAY_SIZE(mt76x02_if_comb);
155 wiphy->interface_modes = 161 wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP);
156 BIT(NL80211_IFTYPE_STATION) |
157 BIT(NL80211_IFTYPE_AP) |
158#ifdef CONFIG_MAC80211_MESH
159 BIT(NL80211_IFTYPE_MESH_POINT) |
160#endif
161 BIT(NL80211_IFTYPE_ADHOC);
162
163 wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; 162 wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
164 163
165 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
166
167 /* init led callbacks */ 164 /* init led callbacks */
168 if (IS_ENABLED(CONFIG_MT76_LEDS)) { 165 if (IS_ENABLED(CONFIG_MT76_LEDS)) {
169 dev->mt76.led_cdev.brightness_set = 166 dev->mt76.led_cdev.brightness_set =
@@ -172,6 +169,8 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
172 } 169 }
173 } 170 }
174 171
172 wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
173
175 hw->sta_data_size = sizeof(struct mt76x02_sta); 174 hw->sta_data_size = sizeof(struct mt76x02_sta);
176 hw->vif_data_size = sizeof(struct mt76x02_vif); 175 hw->vif_data_size = sizeof(struct mt76x02_vif);
177 176
@@ -268,8 +267,9 @@ void mt76x02_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
268} 267}
269EXPORT_SYMBOL_GPL(mt76x02_sta_remove); 268EXPORT_SYMBOL_GPL(mt76x02_sta_remove);
270 269
271void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif, 270static void
272 unsigned int idx) 271mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
272 unsigned int idx)
273{ 273{
274 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; 274 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
275 struct mt76_txq *mtxq; 275 struct mt76_txq *mtxq;
@@ -282,7 +282,6 @@ void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif,
282 282
283 mt76_txq_init(&dev->mt76, vif->txq); 283 mt76_txq_init(&dev->mt76, vif->txq);
284} 284}
285EXPORT_SYMBOL_GPL(mt76x02_vif_init);
286 285
287int 286int
288mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 287mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
@@ -309,6 +308,15 @@ mt76x02_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
309 if (vif->type == NL80211_IFTYPE_STATION) 308 if (vif->type == NL80211_IFTYPE_STATION)
310 idx += 8; 309 idx += 8;
311 310
311 if (dev->vif_mask & BIT(idx))
312 return -EBUSY;
313
314 /* Allow to change address in HW if we create first interface. */
315 if (!dev->vif_mask && !ether_addr_equal(dev->mt76.macaddr, vif->addr))
316 mt76x02_mac_setaddr(dev, vif->addr);
317
318 dev->vif_mask |= BIT(idx);
319
312 mt76x02_vif_init(dev, vif, idx); 320 mt76x02_vif_init(dev, vif, idx);
313 return 0; 321 return 0;
314} 322}
@@ -318,8 +326,10 @@ void mt76x02_remove_interface(struct ieee80211_hw *hw,
318 struct ieee80211_vif *vif) 326 struct ieee80211_vif *vif)
319{ 327{
320 struct mt76x02_dev *dev = hw->priv; 328 struct mt76x02_dev *dev = hw->priv;
329 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
321 330
322 mt76_txq_remove(&dev->mt76, vif->txq); 331 mt76_txq_remove(&dev->mt76, vif->txq);
332 dev->vif_mask &= ~BIT(mvif->idx);
323} 333}
324EXPORT_SYMBOL_GPL(mt76x02_remove_interface); 334EXPORT_SYMBOL_GPL(mt76x02_remove_interface);
325 335
@@ -421,7 +431,7 @@ int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
421 } else { 431 } else {
422 if (idx == wcid->hw_key_idx) { 432 if (idx == wcid->hw_key_idx) {
423 wcid->hw_key_idx = -1; 433 wcid->hw_key_idx = -1;
424 wcid->sw_iv = true; 434 wcid->sw_iv = false;
425 } 435 }
426 436
427 key = NULL; 437 key = NULL;
@@ -657,29 +667,26 @@ static void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev)
657 667
658void mt76x02_init_beacon_config(struct mt76x02_dev *dev) 668void mt76x02_init_beacon_config(struct mt76x02_dev *dev)
659{ 669{
660 static const u8 null_addr[ETH_ALEN] = {};
661 int i; 670 int i;
662 671
663 mt76_wr(dev, MT_MAC_BSSID_DW0, 672 if (mt76_is_mmio(dev)) {
664 get_unaligned_le32(dev->mt76.macaddr)); 673 /* Fire a pre-TBTT interrupt 8 ms before TBTT */
665 mt76_wr(dev, MT_MAC_BSSID_DW1, 674 mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_PRE_TBTT,
666 get_unaligned_le16(dev->mt76.macaddr + 4) | 675 8 << 4);
667 FIELD_PREP(MT_MAC_BSSID_DW1_MBSS_MODE, 3) | /* 8 beacons */ 676 mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_GP_TIMER,
668 MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT); 677 MT_DFS_GP_INTERVAL);
669 678 mt76_wr(dev, MT_INT_TIMER_EN, 0);
670 /* Fire a pre-TBTT interrupt 8 ms before TBTT */ 679 }
671 mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_PRE_TBTT,
672 8 << 4);
673 mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_GP_TIMER,
674 MT_DFS_GP_INTERVAL);
675 mt76_wr(dev, MT_INT_TIMER_EN, 0);
676 680
681 mt76_clear(dev, MT_BEACON_TIME_CFG, (MT_BEACON_TIME_CFG_TIMER_EN |
682 MT_BEACON_TIME_CFG_SYNC_MODE |
683 MT_BEACON_TIME_CFG_TBTT_EN |
684 MT_BEACON_TIME_CFG_BEACON_TX));
677 mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff); 685 mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff);
678 686
679 for (i = 0; i < 8; i++) { 687 for (i = 0; i < 8; i++)
680 mt76x02_mac_set_bssid(dev, i, null_addr);
681 mt76x02_mac_set_beacon(dev, i, NULL); 688 mt76x02_mac_set_beacon(dev, i, NULL);
682 } 689
683 mt76x02_set_beacon_offsets(dev); 690 mt76x02_set_beacon_offsets(dev);
684} 691}
685EXPORT_SYMBOL_GPL(mt76x02_init_beacon_config); 692EXPORT_SYMBOL_GPL(mt76x02_init_beacon_config);
@@ -697,12 +704,8 @@ void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
697 if (changed & BSS_CHANGED_BSSID) 704 if (changed & BSS_CHANGED_BSSID)
698 mt76x02_mac_set_bssid(dev, mvif->idx, info->bssid); 705 mt76x02_mac_set_bssid(dev, mvif->idx, info->bssid);
699 706
700 if (changed & BSS_CHANGED_BEACON_ENABLED) { 707 if (changed & BSS_CHANGED_BEACON_ENABLED)
701 tasklet_disable(&dev->pre_tbtt_tasklet); 708 mt76x02_mac_set_beacon_enable(dev, vif, info->enable_beacon);
702 mt76x02_mac_set_beacon_enable(dev, mvif->idx,
703 info->enable_beacon);
704 tasklet_enable(&dev->pre_tbtt_tasklet);
705 }
706 709
707 if (changed & BSS_CHANGED_HT || changed & BSS_CHANGED_ERP_CTS_PROT) 710 if (changed & BSS_CHANGED_HT || changed & BSS_CHANGED_ERP_CTS_PROT)
708 mt76x02_mac_set_tx_protection(dev, info->use_cts_prot, 711 mt76x02_mac_set_tx_protection(dev, info->use_cts_prot,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
index 28ec19acf9db..6c619f1c65c9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
@@ -49,7 +49,6 @@ static inline bool mt76x2_channel_silent(struct mt76x02_dev *dev)
49 49
50extern const struct ieee80211_ops mt76x2_ops; 50extern const struct ieee80211_ops mt76x2_ops;
51 51
52struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev);
53int mt76x2_register_device(struct mt76x02_dev *dev); 52int mt76x2_register_device(struct mt76x02_dev *dev);
54 53
55void mt76x2_phy_power_on(struct mt76x02_dev *dev); 54void mt76x2_phy_power_on(struct mt76x02_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2u.h b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2u.h
index 0b0075411b34..787cdfdf5db5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2u.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2u.h
@@ -29,7 +29,6 @@
29 29
30extern const struct ieee80211_ops mt76x2u_ops; 30extern const struct ieee80211_ops mt76x2u_ops;
31 31
32struct mt76x02_dev *mt76x2u_alloc_device(struct device *pdev);
33int mt76x2u_register_device(struct mt76x02_dev *dev); 32int mt76x2u_register_device(struct mt76x02_dev *dev);
34int mt76x2u_init_hardware(struct mt76x02_dev *dev); 33int mt76x2u_init_hardware(struct mt76x02_dev *dev);
35void mt76x2u_cleanup(struct mt76x02_dev *dev); 34void mt76x2u_cleanup(struct mt76x02_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
index 92432fe97312..6274655e1f7e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
@@ -30,7 +30,19 @@ static const struct pci_device_id mt76pci_device_table[] = {
30static int 30static int
31mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 31mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
32{ 32{
33 static const struct mt76_driver_ops drv_ops = {
34 .txwi_size = sizeof(struct mt76x02_txwi),
35 .update_survey = mt76x02_update_channel,
36 .tx_prepare_skb = mt76x02_tx_prepare_skb,
37 .tx_complete_skb = mt76x02_tx_complete_skb,
38 .rx_skb = mt76x02_queue_rx_skb,
39 .rx_poll_complete = mt76x02_rx_poll_complete,
40 .sta_ps = mt76x02_sta_ps,
41 .sta_add = mt76x02_sta_add,
42 .sta_remove = mt76x02_sta_remove,
43 };
33 struct mt76x02_dev *dev; 44 struct mt76x02_dev *dev;
45 struct mt76_dev *mdev;
34 int ret; 46 int ret;
35 47
36 ret = pcim_enable_device(pdev); 48 ret = pcim_enable_device(pdev);
@@ -47,17 +59,19 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
47 if (ret) 59 if (ret)
48 return ret; 60 return ret;
49 61
50 dev = mt76x2_alloc_device(&pdev->dev); 62 mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt76x2_ops,
51 if (!dev) 63 &drv_ops);
64 if (!mdev)
52 return -ENOMEM; 65 return -ENOMEM;
53 66
54 mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]); 67 dev = container_of(mdev, struct mt76x02_dev, mt76);
68 mt76_mmio_init(mdev, pcim_iomap_table(pdev)[0]);
55 mt76x2_reset_wlan(dev, false); 69 mt76x2_reset_wlan(dev, false);
56 70
57 dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION); 71 mdev->rev = mt76_rr(dev, MT_ASIC_VERSION);
58 dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev); 72 dev_info(mdev->dev, "ASIC revision: %08x\n", mdev->rev);
59 73
60 ret = devm_request_irq(dev->mt76.dev, pdev->irq, mt76x02_irq_handler, 74 ret = devm_request_irq(mdev->dev, pdev->irq, mt76x02_irq_handler,
61 IRQF_SHARED, KBUILD_MODNAME, dev); 75 IRQF_SHARED, KBUILD_MODNAME, dev);
62 if (ret) 76 if (ret)
63 goto error; 77 goto error;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
index 4347d5e7a915..d4e3d7c11d74 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
@@ -119,9 +119,7 @@ static int mt76x2_mac_reset(struct mt76x02_dev *dev, bool hard)
119 mt76_wr(dev, MT_MCU_CLOCK_CTL, 0x1401); 119 mt76_wr(dev, MT_MCU_CLOCK_CTL, 0x1401);
120 mt76_clear(dev, MT_FCE_L2_STUFF, MT_FCE_L2_STUFF_WR_MPDU_LEN_EN); 120 mt76_clear(dev, MT_FCE_L2_STUFF, MT_FCE_L2_STUFF_WR_MPDU_LEN_EN);
121 121
122 mt76_wr(dev, MT_MAC_ADDR_DW0, get_unaligned_le32(macaddr)); 122 mt76x02_mac_setaddr(dev, macaddr);
123 mt76_wr(dev, MT_MAC_ADDR_DW1, get_unaligned_le16(macaddr + 4));
124
125 mt76x02_init_beacon_config(dev); 123 mt76x02_init_beacon_config(dev);
126 if (!hard) 124 if (!hard)
127 return 0; 125 return 0;
@@ -315,33 +313,6 @@ void mt76x2_cleanup(struct mt76x02_dev *dev)
315 mt76x02_mcu_cleanup(dev); 313 mt76x02_mcu_cleanup(dev);
316} 314}
317 315
318struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev)
319{
320 static const struct mt76_driver_ops drv_ops = {
321 .txwi_size = sizeof(struct mt76x02_txwi),
322 .update_survey = mt76x02_update_channel,
323 .tx_prepare_skb = mt76x02_tx_prepare_skb,
324 .tx_complete_skb = mt76x02_tx_complete_skb,
325 .rx_skb = mt76x02_queue_rx_skb,
326 .rx_poll_complete = mt76x02_rx_poll_complete,
327 .sta_ps = mt76x02_sta_ps,
328 .sta_add = mt76x02_sta_add,
329 .sta_remove = mt76x02_sta_remove,
330 };
331 struct mt76x02_dev *dev;
332 struct mt76_dev *mdev;
333
334 mdev = mt76_alloc_device(sizeof(*dev), &mt76x2_ops);
335 if (!mdev)
336 return NULL;
337
338 dev = container_of(mdev, struct mt76x02_dev, mt76);
339 mdev->dev = pdev;
340 mdev->drv = &drv_ops;
341
342 return dev;
343}
344
345int mt76x2_register_device(struct mt76x02_dev *dev) 316int mt76x2_register_device(struct mt76x02_dev *dev)
346{ 317{
347 int ret; 318 int ret;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
index 06a26a152ba4..878ce92405ed 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
@@ -33,7 +33,7 @@ mt76x2_start(struct ieee80211_hw *hw)
33 goto out; 33 goto out;
34 34
35 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work, 35 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
36 MT_CALIBRATE_INTERVAL); 36 MT_MAC_WORK_INTERVAL);
37 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->wdt_work, 37 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->wdt_work,
38 MT_WATCHDOG_TIME); 38 MT_WATCHDOG_TIME);
39 39
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
index 65ed62229a5b..97ec575699d0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
@@ -240,8 +240,10 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
240 mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070); 240 mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070);
241 mt76_wr(dev, MT_TXOP_CTRL_CFG, 0x04101B3F); 241 mt76_wr(dev, MT_TXOP_CTRL_CFG, 0x04101B3F);
242 242
243 if (scan) 243 if (scan) {
244 mt76x02_edcca_init(dev, false);
244 return 0; 245 return 0;
246 }
245 247
246 mt76x2_phy_channel_calibrate(dev, true); 248 mt76x2_phy_channel_calibrate(dev, true);
247 mt76x02_init_agc_gain(dev); 249 mt76x02_init_agc_gain(dev);
@@ -254,7 +256,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
254 0x38); 256 0x38);
255 } 257 }
256 258
257 mt76x02_edcca_init(dev); 259 mt76x02_edcca_init(dev, true);
258 260
259 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work, 261 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
260 MT_CALIBRATE_INTERVAL); 262 MT_CALIBRATE_INTERVAL);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
index e2ee5e498da7..1848e8ab2e21 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
@@ -241,7 +241,7 @@ void mt76x2_phy_tssi_compensate(struct mt76x02_dev *dev)
241 t.offset1 = txp.chain[1].tssi_offset; 241 t.offset1 = txp.chain[1].tssi_offset;
242 mt76x2_mcu_tssi_comp(dev, &t); 242 mt76x2_mcu_tssi_comp(dev, &t);
243 243
244 if (t.pa_mode || dev->cal.dpd_cal_done) 244 if (t.pa_mode || dev->cal.dpd_cal_done || dev->ed_tx_blocked)
245 return; 245 return;
246 246
247 usleep_range(10000, 20000); 247 usleep_range(10000, 20000);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
index 4d1788eb3812..f81a85e96922 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
@@ -36,24 +36,36 @@ static const struct usb_device_id mt76x2u_device_table[] = {
36static int mt76x2u_probe(struct usb_interface *intf, 36static int mt76x2u_probe(struct usb_interface *intf,
37 const struct usb_device_id *id) 37 const struct usb_device_id *id)
38{ 38{
39 static const struct mt76_driver_ops drv_ops = {
40 .tx_prepare_skb = mt76x02u_tx_prepare_skb,
41 .tx_complete_skb = mt76x02u_tx_complete_skb,
42 .tx_status_data = mt76x02_tx_status_data,
43 .rx_skb = mt76x02_queue_rx_skb,
44 .sta_add = mt76x02_sta_add,
45 .sta_remove = mt76x02_sta_remove,
46 };
39 struct usb_device *udev = interface_to_usbdev(intf); 47 struct usb_device *udev = interface_to_usbdev(intf);
40 struct mt76x02_dev *dev; 48 struct mt76x02_dev *dev;
49 struct mt76_dev *mdev;
41 int err; 50 int err;
42 51
43 dev = mt76x2u_alloc_device(&intf->dev); 52 mdev = mt76_alloc_device(&intf->dev, sizeof(*dev), &mt76x2u_ops,
44 if (!dev) 53 &drv_ops);
54 if (!mdev)
45 return -ENOMEM; 55 return -ENOMEM;
46 56
57 dev = container_of(mdev, struct mt76x02_dev, mt76);
58
47 udev = usb_get_dev(udev); 59 udev = usb_get_dev(udev);
48 usb_reset_device(udev); 60 usb_reset_device(udev);
49 61
50 mt76x02u_init_mcu(&dev->mt76); 62 mt76x02u_init_mcu(mdev);
51 err = mt76u_init(&dev->mt76, intf); 63 err = mt76u_init(mdev, intf);
52 if (err < 0) 64 if (err < 0)
53 goto err; 65 goto err;
54 66
55 dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION); 67 mdev->rev = mt76_rr(dev, MT_ASIC_VERSION);
56 dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev); 68 dev_info(mdev->dev, "ASIC revision: %08x\n", mdev->rev);
57 69
58 err = mt76x2u_register_device(dev); 70 err = mt76x2u_register_device(dev);
59 if (err < 0) 71 if (err < 0)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
index 0be3784f44fb..090aaf71b3ef 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
@@ -134,30 +134,6 @@ static int mt76x2u_init_eeprom(struct mt76x02_dev *dev)
134 return 0; 134 return 0;
135} 135}
136 136
137struct mt76x02_dev *mt76x2u_alloc_device(struct device *pdev)
138{
139 static const struct mt76_driver_ops drv_ops = {
140 .tx_prepare_skb = mt76x02u_tx_prepare_skb,
141 .tx_complete_skb = mt76x02u_tx_complete_skb,
142 .tx_status_data = mt76x02_tx_status_data,
143 .rx_skb = mt76x02_queue_rx_skb,
144 .sta_add = mt76x02_sta_add,
145 .sta_remove = mt76x02_sta_remove,
146 };
147 struct mt76x02_dev *dev;
148 struct mt76_dev *mdev;
149
150 mdev = mt76_alloc_device(sizeof(*dev), &mt76x2u_ops);
151 if (!mdev)
152 return NULL;
153
154 dev = container_of(mdev, struct mt76x02_dev, mt76);
155 mdev->dev = pdev;
156 mdev->drv = &drv_ops;
157
158 return dev;
159}
160
161int mt76x2u_init_hardware(struct mt76x02_dev *dev) 137int mt76x2u_init_hardware(struct mt76x02_dev *dev)
162{ 138{
163 int i, k, err; 139 int i, k, err;
@@ -207,11 +183,7 @@ int mt76x2u_init_hardware(struct mt76x02_dev *dev)
207 mt76x02_mac_shared_key_setup(dev, i, k, NULL); 183 mt76x02_mac_shared_key_setup(dev, i, k, NULL);
208 } 184 }
209 185
210 mt76_clear(dev, MT_BEACON_TIME_CFG, 186 mt76x02_init_beacon_config(dev);
211 MT_BEACON_TIME_CFG_TIMER_EN |
212 MT_BEACON_TIME_CFG_SYNC_MODE |
213 MT_BEACON_TIME_CFG_TBTT_EN |
214 MT_BEACON_TIME_CFG_BEACON_TX);
215 187
216 mt76_rmw(dev, MT_US_CYC_CFG, MT_US_CYC_CNT, 0x1e); 188 mt76_rmw(dev, MT_US_CYC_CFG, MT_US_CYC_CNT, 0x1e);
217 mt76_wr(dev, MT_TXOP_CTRL_CFG, 0x583f); 189 mt76_wr(dev, MT_TXOP_CTRL_CFG, 0x583f);
@@ -256,7 +228,7 @@ int mt76x2u_register_device(struct mt76x02_dev *dev)
256 goto fail; 228 goto fail;
257 229
258 /* check hw sg support in order to enable AMSDU */ 230 /* check hw sg support in order to enable AMSDU */
259 if (mt76u_check_sg(&dev->mt76)) 231 if (dev->mt76.usb.sg_en)
260 hw->max_tx_fragments = MT_SG_MAX_SIZE; 232 hw->max_tx_fragments = MT_SG_MAX_SIZE;
261 else 233 else
262 hw->max_tx_fragments = 1; 234 hw->max_tx_fragments = 1;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
index 286c7f451090..10633b8de8e8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
@@ -28,7 +28,7 @@ static int mt76x2u_start(struct ieee80211_hw *hw)
28 goto out; 28 goto out;
29 29
30 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work, 30 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
31 MT_CALIBRATE_INTERVAL); 31 MT_MAC_WORK_INTERVAL);
32 set_bit(MT76_STATE_RUNNING, &dev->mt76.state); 32 set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
33 33
34out: 34out:
@@ -46,19 +46,6 @@ static void mt76x2u_stop(struct ieee80211_hw *hw)
46 mutex_unlock(&dev->mt76.mutex); 46 mutex_unlock(&dev->mt76.mutex);
47} 47}
48 48
49static int mt76x2u_add_interface(struct ieee80211_hw *hw,
50 struct ieee80211_vif *vif)
51{
52 struct mt76x02_dev *dev = hw->priv;
53 unsigned int idx = 8;
54
55 if (!ether_addr_equal(dev->mt76.macaddr, vif->addr))
56 mt76x02_mac_setaddr(dev, vif->addr);
57
58 mt76x02_vif_init(dev, vif, idx);
59 return 0;
60}
61
62static int 49static int
63mt76x2u_set_channel(struct mt76x02_dev *dev, 50mt76x2u_set_channel(struct mt76x02_dev *dev,
64 struct cfg80211_chan_def *chandef) 51 struct cfg80211_chan_def *chandef)
@@ -125,7 +112,7 @@ const struct ieee80211_ops mt76x2u_ops = {
125 .tx = mt76x02_tx, 112 .tx = mt76x02_tx,
126 .start = mt76x2u_start, 113 .start = mt76x2u_start,
127 .stop = mt76x2u_stop, 114 .stop = mt76x2u_stop,
128 .add_interface = mt76x2u_add_interface, 115 .add_interface = mt76x02_add_interface,
129 .remove_interface = mt76x02_remove_interface, 116 .remove_interface = mt76x02_remove_interface,
130 .sta_state = mt76_sta_state, 117 .sta_state = mt76_sta_state,
131 .set_key = mt76x02_set_key, 118 .set_key = mt76x02_set_key,
diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index ef38e8626da9..5a349fe3e576 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -205,9 +205,6 @@ mt76_tx_status_skb_get(struct mt76_dev *dev, struct mt76_wcid *wcid, int pktid,
205{ 205{
206 struct sk_buff *skb, *tmp; 206 struct sk_buff *skb, *tmp;
207 207
208 if (pktid == MT_PACKET_ID_NO_ACK)
209 return NULL;
210
211 skb_queue_walk_safe(&dev->status_list, skb, tmp) { 208 skb_queue_walk_safe(&dev->status_list, skb, tmp) {
212 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb); 209 struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
213 210
@@ -217,7 +214,7 @@ mt76_tx_status_skb_get(struct mt76_dev *dev, struct mt76_wcid *wcid, int pktid,
217 if (cb->pktid == pktid) 214 if (cb->pktid == pktid)
218 return skb; 215 return skb;
219 216
220 if (!pktid && 217 if (pktid >= 0 &&
221 !time_after(jiffies, cb->jiffies + MT_TX_STATUS_SKB_TIMEOUT)) 218 !time_after(jiffies, cb->jiffies + MT_TX_STATUS_SKB_TIMEOUT))
222 continue; 219 continue;
223 220
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index 6a2507524c6c..78191968b4fa 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -22,6 +22,10 @@
22#define MT_VEND_REQ_MAX_RETRY 10 22#define MT_VEND_REQ_MAX_RETRY 10
23#define MT_VEND_REQ_TOUT_MS 300 23#define MT_VEND_REQ_TOUT_MS 300
24 24
25static bool disable_usb_sg;
26module_param_named(disable_usb_sg, disable_usb_sg, bool, 0644);
27MODULE_PARM_DESC(disable_usb_sg, "Disable usb scatter-gather support");
28
25/* should be called with usb_ctrl_mtx locked */ 29/* should be called with usb_ctrl_mtx locked */
26static int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, 30static int __mt76u_vendor_request(struct mt76_dev *dev, u8 req,
27 u8 req_type, u16 val, u16 offset, 31 u8 req_type, u16 val, u16 offset,
@@ -241,6 +245,16 @@ mt76u_rd_rp(struct mt76_dev *dev, u32 base,
241 return mt76u_req_rd_rp(dev, base, data, n); 245 return mt76u_req_rd_rp(dev, base, data, n);
242} 246}
243 247
248static bool mt76u_check_sg(struct mt76_dev *dev)
249{
250 struct usb_interface *intf = to_usb_interface(dev->dev);
251 struct usb_device *udev = interface_to_usbdev(intf);
252
253 return (!disable_usb_sg && udev->bus->sg_tablesize > 0 &&
254 (udev->bus->no_sg_constraint ||
255 udev->speed == USB_SPEED_WIRELESS));
256}
257
244static int 258static int
245mt76u_set_endpoints(struct usb_interface *intf, 259mt76u_set_endpoints(struct usb_interface *intf,
246 struct mt76_usb *usb) 260 struct mt76_usb *usb)
@@ -309,8 +323,9 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf,
309 return i ? : -ENOMEM; 323 return i ? : -ENOMEM;
310} 324}
311 325
312int mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf, 326static int
313 int nsgs, int len, int sglen, gfp_t gfp) 327mt76u_buf_alloc_sg(struct mt76_dev *dev, struct mt76u_buf *buf,
328 int nsgs, int len, int sglen, gfp_t gfp)
314{ 329{
315 buf->urb = usb_alloc_urb(0, gfp); 330 buf->urb = usb_alloc_urb(0, gfp);
316 if (!buf->urb) 331 if (!buf->urb)
@@ -326,15 +341,42 @@ int mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf,
326 341
327 return mt76u_fill_rx_sg(dev, buf, nsgs, len, sglen); 342 return mt76u_fill_rx_sg(dev, buf, nsgs, len, sglen);
328} 343}
329EXPORT_SYMBOL_GPL(mt76u_buf_alloc); 344
345int mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf,
346 int len, int data_len, gfp_t gfp)
347{
348 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
349
350 buf->urb = usb_alloc_urb(0, gfp);
351 if (!buf->urb)
352 return -ENOMEM;
353
354 buf->buf = page_frag_alloc(&q->rx_page, len, gfp);
355 if (!buf->buf)
356 return -ENOMEM;
357
358 buf->len = data_len;
359 buf->dev = dev;
360
361 return 0;
362}
330 363
331void mt76u_buf_free(struct mt76u_buf *buf) 364void mt76u_buf_free(struct mt76u_buf *buf)
332{ 365{
333 struct urb *urb = buf->urb; 366 struct urb *urb = buf->urb;
367 struct scatterlist *sg;
334 int i; 368 int i;
335 369
336 for (i = 0; i < urb->num_sgs; i++) 370 for (i = 0; i < urb->num_sgs; i++) {
337 skb_free_frag(sg_virt(&urb->sg[i])); 371 sg = &urb->sg[i];
372 if (!sg)
373 continue;
374
375 skb_free_frag(sg_virt(sg));
376 }
377 if (buf->buf)
378 skb_free_frag(buf->buf);
379
338 usb_free_urb(buf->urb); 380 usb_free_urb(buf->urb);
339} 381}
340EXPORT_SYMBOL_GPL(mt76u_buf_free); 382EXPORT_SYMBOL_GPL(mt76u_buf_free);
@@ -345,6 +387,7 @@ int mt76u_submit_buf(struct mt76_dev *dev, int dir, int index,
345{ 387{
346 struct usb_interface *intf = to_usb_interface(dev->dev); 388 struct usb_interface *intf = to_usb_interface(dev->dev);
347 struct usb_device *udev = interface_to_usbdev(intf); 389 struct usb_device *udev = interface_to_usbdev(intf);
390 u8 *data = buf->urb->num_sgs ? NULL : buf->buf;
348 unsigned int pipe; 391 unsigned int pipe;
349 392
350 if (dir == USB_DIR_IN) 393 if (dir == USB_DIR_IN)
@@ -352,7 +395,7 @@ int mt76u_submit_buf(struct mt76_dev *dev, int dir, int index,
352 else 395 else
353 pipe = usb_sndbulkpipe(udev, dev->usb.out_ep[index]); 396 pipe = usb_sndbulkpipe(udev, dev->usb.out_ep[index]);
354 397
355 usb_fill_bulk_urb(buf->urb, udev, pipe, NULL, buf->len, 398 usb_fill_bulk_urb(buf->urb, udev, pipe, data, buf->len,
356 complete_fn, context); 399 complete_fn, context);
357 trace_submit_urb(dev, buf->urb); 400 trace_submit_urb(dev, buf->urb);
358 401
@@ -393,10 +436,11 @@ static int mt76u_get_rx_entry_len(u8 *data, u32 data_len)
393} 436}
394 437
395static int 438static int
396mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb) 439mt76u_process_rx_entry(struct mt76_dev *dev, struct mt76u_buf *buf)
397{ 440{
398 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN]; 441 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
399 u8 *data = sg_virt(&urb->sg[0]); 442 struct urb *urb = buf->urb;
443 u8 *data = urb->num_sgs ? sg_virt(&urb->sg[0]) : buf->buf;
400 int data_len, len, nsgs = 1; 444 int data_len, len, nsgs = 1;
401 struct sk_buff *skb; 445 struct sk_buff *skb;
402 446
@@ -407,7 +451,8 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
407 if (len < 0) 451 if (len < 0)
408 return 0; 452 return 0;
409 453
410 data_len = min_t(int, len, urb->sg[0].length - MT_DMA_HDR_LEN); 454 data_len = urb->num_sgs ? urb->sg[0].length : buf->len;
455 data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN);
411 if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) 456 if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size))
412 return 0; 457 return 0;
413 458
@@ -419,7 +464,7 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
419 __skb_put(skb, data_len); 464 __skb_put(skb, data_len);
420 len -= data_len; 465 len -= data_len;
421 466
422 while (len > 0) { 467 while (len > 0 && urb->num_sgs) {
423 data_len = min_t(int, len, urb->sg[nsgs].length); 468 data_len = min_t(int, len, urb->sg[nsgs].length);
424 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, 469 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
425 sg_page(&urb->sg[nsgs]), 470 sg_page(&urb->sg[nsgs]),
@@ -447,7 +492,8 @@ static void mt76u_complete_rx(struct urb *urb)
447 case -ENOENT: 492 case -ENOENT:
448 return; 493 return;
449 default: 494 default:
450 dev_err(dev->dev, "rx urb failed: %d\n", urb->status); 495 dev_err_ratelimited(dev->dev, "rx urb failed: %d\n",
496 urb->status);
451 /* fall through */ 497 /* fall through */
452 case 0: 498 case 0:
453 break; 499 break;
@@ -464,12 +510,26 @@ out:
464 spin_unlock_irqrestore(&q->lock, flags); 510 spin_unlock_irqrestore(&q->lock, flags);
465} 511}
466 512
513static int
514mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
515 struct mt76u_buf *buf, int nsgs)
516{
517 if (dev->usb.sg_en) {
518 return mt76u_fill_rx_sg(dev, buf, nsgs, q->buf_size,
519 SKB_WITH_OVERHEAD(q->buf_size));
520 } else {
521 buf->buf = page_frag_alloc(&q->rx_page, q->buf_size,
522 GFP_ATOMIC);
523 return buf->buf ? 0 : -ENOMEM;
524 }
525}
526
467static void mt76u_rx_tasklet(unsigned long data) 527static void mt76u_rx_tasklet(unsigned long data)
468{ 528{
469 struct mt76_dev *dev = (struct mt76_dev *)data; 529 struct mt76_dev *dev = (struct mt76_dev *)data;
470 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN]; 530 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
471 int err, nsgs, buf_len = q->buf_size;
472 struct mt76u_buf *buf; 531 struct mt76u_buf *buf;
532 int err, count;
473 533
474 rcu_read_lock(); 534 rcu_read_lock();
475 535
@@ -478,11 +538,9 @@ static void mt76u_rx_tasklet(unsigned long data)
478 if (!buf) 538 if (!buf)
479 break; 539 break;
480 540
481 nsgs = mt76u_process_rx_entry(dev, buf->urb); 541 count = mt76u_process_rx_entry(dev, buf);
482 if (nsgs > 0) { 542 if (count > 0) {
483 err = mt76u_fill_rx_sg(dev, buf, nsgs, 543 err = mt76u_refill_rx(dev, q, buf, count);
484 buf_len,
485 SKB_WITH_OVERHEAD(buf_len));
486 if (err < 0) 544 if (err < 0)
487 break; 545 break;
488 } 546 }
@@ -520,7 +578,7 @@ EXPORT_SYMBOL_GPL(mt76u_submit_rx_buffers);
520static int mt76u_alloc_rx(struct mt76_dev *dev) 578static int mt76u_alloc_rx(struct mt76_dev *dev)
521{ 579{
522 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN]; 580 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
523 int i, err, nsgs; 581 int i, err;
524 582
525 spin_lock_init(&q->rx_page_lock); 583 spin_lock_init(&q->rx_page_lock);
526 spin_lock_init(&q->lock); 584 spin_lock_init(&q->lock);
@@ -530,23 +588,22 @@ static int mt76u_alloc_rx(struct mt76_dev *dev)
530 if (!q->entry) 588 if (!q->entry)
531 return -ENOMEM; 589 return -ENOMEM;
532 590
533 if (mt76u_check_sg(dev)) { 591 q->buf_size = dev->usb.sg_en ? MT_RX_BUF_SIZE : PAGE_SIZE;
534 q->buf_size = MT_RX_BUF_SIZE; 592 q->ndesc = MT_NUM_RX_ENTRIES;
535 nsgs = MT_SG_MAX_SIZE; 593 for (i = 0; i < q->ndesc; i++) {
536 } else { 594 if (dev->usb.sg_en)
537 q->buf_size = PAGE_SIZE; 595 err = mt76u_buf_alloc_sg(dev, &q->entry[i].ubuf,
538 nsgs = 1; 596 MT_SG_MAX_SIZE, q->buf_size,
539 } 597 SKB_WITH_OVERHEAD(q->buf_size),
540 598 GFP_KERNEL);
541 for (i = 0; i < MT_NUM_RX_ENTRIES; i++) { 599 else
542 err = mt76u_buf_alloc(dev, &q->entry[i].ubuf, 600 err = mt76u_buf_alloc(dev, &q->entry[i].ubuf,
543 nsgs, q->buf_size, 601 q->buf_size,
544 SKB_WITH_OVERHEAD(q->buf_size), 602 SKB_WITH_OVERHEAD(q->buf_size),
545 GFP_KERNEL); 603 GFP_KERNEL);
546 if (err < 0) 604 if (err < 0)
547 return err; 605 return err;
548 } 606 }
549 q->ndesc = MT_NUM_RX_ENTRIES;
550 607
551 return mt76u_submit_rx_buffers(dev); 608 return mt76u_submit_rx_buffers(dev);
552} 609}
@@ -691,7 +748,7 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
691{ 748{
692 struct usb_interface *intf = to_usb_interface(dev->dev); 749 struct usb_interface *intf = to_usb_interface(dev->dev);
693 struct usb_device *udev = interface_to_usbdev(intf); 750 struct usb_device *udev = interface_to_usbdev(intf);
694 u8 ep = q2ep(q->hw_idx); 751 u8 *data = NULL, ep = q2ep(q->hw_idx);
695 struct mt76u_buf *buf; 752 struct mt76u_buf *buf;
696 u16 idx = q->tail; 753 u16 idx = q->tail;
697 unsigned int pipe; 754 unsigned int pipe;
@@ -708,12 +765,16 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
708 buf = &q->entry[idx].ubuf; 765 buf = &q->entry[idx].ubuf;
709 buf->done = false; 766 buf->done = false;
710 767
711 err = mt76u_tx_build_sg(skb, buf->urb); 768 if (dev->usb.sg_en) {
712 if (err < 0) 769 err = mt76u_tx_build_sg(skb, buf->urb);
713 return err; 770 if (err < 0)
771 return err;
772 } else {
773 data = skb->data;
774 }
714 775
715 pipe = usb_sndbulkpipe(udev, dev->usb.out_ep[ep]); 776 pipe = usb_sndbulkpipe(udev, dev->usb.out_ep[ep]);
716 usb_fill_bulk_urb(buf->urb, udev, pipe, NULL, skb->len, 777 usb_fill_bulk_urb(buf->urb, udev, pipe, data, skb->len,
717 mt76u_complete_tx, buf); 778 mt76u_complete_tx, buf);
718 779
719 q->tail = (q->tail + 1) % q->ndesc; 780 q->tail = (q->tail + 1) % q->ndesc;
@@ -749,10 +810,8 @@ static int mt76u_alloc_tx(struct mt76_dev *dev)
749{ 810{
750 struct mt76u_buf *buf; 811 struct mt76u_buf *buf;
751 struct mt76_queue *q; 812 struct mt76_queue *q;
752 size_t size;
753 int i, j; 813 int i, j;
754 814
755 size = MT_SG_MAX_SIZE * sizeof(struct scatterlist);
756 for (i = 0; i < IEEE80211_NUM_ACS; i++) { 815 for (i = 0; i < IEEE80211_NUM_ACS; i++) {
757 q = &dev->q_tx[i]; 816 q = &dev->q_tx[i];
758 spin_lock_init(&q->lock); 817 spin_lock_init(&q->lock);
@@ -774,9 +833,15 @@ static int mt76u_alloc_tx(struct mt76_dev *dev)
774 if (!buf->urb) 833 if (!buf->urb)
775 return -ENOMEM; 834 return -ENOMEM;
776 835
777 buf->urb->sg = devm_kzalloc(dev->dev, size, GFP_KERNEL); 836 if (dev->usb.sg_en) {
778 if (!buf->urb->sg) 837 size_t size = MT_SG_MAX_SIZE *
779 return -ENOMEM; 838 sizeof(struct scatterlist);
839
840 buf->urb->sg = devm_kzalloc(dev->dev, size,
841 GFP_KERNEL);
842 if (!buf->urb->sg)
843 return -ENOMEM;
844 }
780 } 845 }
781 } 846 }
782 return 0; 847 return 0;
@@ -838,16 +903,9 @@ int mt76u_alloc_queues(struct mt76_dev *dev)
838 903
839 err = mt76u_alloc_rx(dev); 904 err = mt76u_alloc_rx(dev);
840 if (err < 0) 905 if (err < 0)
841 goto err; 906 return err;
842
843 err = mt76u_alloc_tx(dev);
844 if (err < 0)
845 goto err;
846 907
847 return 0; 908 return mt76u_alloc_tx(dev);
848err:
849 mt76u_queues_deinit(dev);
850 return err;
851} 909}
852EXPORT_SYMBOL_GPL(mt76u_alloc_queues); 910EXPORT_SYMBOL_GPL(mt76u_alloc_queues);
853 911
@@ -882,6 +940,8 @@ int mt76u_init(struct mt76_dev *dev,
882 dev->bus = &mt76u_ops; 940 dev->bus = &mt76u_ops;
883 dev->queue_ops = &usb_queue_ops; 941 dev->queue_ops = &usb_queue_ops;
884 942
943 usb->sg_en = mt76u_check_sg(dev);
944
885 return mt76u_set_endpoints(intf, usb); 945 return mt76u_set_endpoints(intf, usb);
886} 946}
887EXPORT_SYMBOL_GPL(mt76u_init); 947EXPORT_SYMBOL_GPL(mt76u_init);
diff --git a/drivers/net/wireless/mediatek/mt76/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/usb_mcu.c
index 036be4163e69..72c8607da4b4 100644
--- a/drivers/net/wireless/mediatek/mt76/usb_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/usb_mcu.c
@@ -29,9 +29,8 @@ int mt76u_mcu_init_rx(struct mt76_dev *dev)
29 struct mt76_usb *usb = &dev->usb; 29 struct mt76_usb *usb = &dev->usb;
30 int err; 30 int err;
31 31
32 err = mt76u_buf_alloc(dev, &usb->mcu.res, 1, 32 err = mt76u_buf_alloc(dev, &usb->mcu.res, MCU_RESP_URB_SIZE,
33 MCU_RESP_URB_SIZE, MCU_RESP_URB_SIZE, 33 MCU_RESP_URB_SIZE, GFP_KERNEL);
34 GFP_KERNEL);
35 if (err < 0) 34 if (err < 0)
36 return err; 35 return err;
37 36
@@ -48,9 +47,11 @@ EXPORT_SYMBOL_GPL(mt76u_mcu_init_rx);
48 47
49void mt76u_mcu_deinit(struct mt76_dev *dev) 48void mt76u_mcu_deinit(struct mt76_dev *dev)
50{ 49{
51 struct mt76_usb *usb = &dev->usb; 50 struct mt76u_buf *buf = &dev->usb.mcu.res;
52 51
53 usb_kill_urb(usb->mcu.res.urb); 52 if (buf->urb) {
54 mt76u_buf_free(&usb->mcu.res); 53 usb_kill_urb(buf->urb);
54 mt76u_buf_free(buf);
55 }
55} 56}
56EXPORT_SYMBOL_GPL(mt76u_mcu_deinit); 57EXPORT_SYMBOL_GPL(mt76u_mcu_deinit);
diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
index 45f4cef7de9c..dcb0991432f4 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
@@ -53,9 +53,11 @@ static const u32 qtnf_cipher_suites[] = {
53static const struct ieee80211_txrx_stypes 53static const struct ieee80211_txrx_stypes
54qtnf_mgmt_stypes[NUM_NL80211_IFTYPES] = { 54qtnf_mgmt_stypes[NUM_NL80211_IFTYPES] = {
55 [NL80211_IFTYPE_STATION] = { 55 [NL80211_IFTYPE_STATION] = {
56 .tx = BIT(IEEE80211_STYPE_ACTION >> 4), 56 .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
57 BIT(IEEE80211_STYPE_AUTH >> 4),
57 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | 58 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
58 BIT(IEEE80211_STYPE_PROBE_REQ >> 4), 59 BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
60 BIT(IEEE80211_STYPE_AUTH >> 4),
59 }, 61 },
60 [NL80211_IFTYPE_AP] = { 62 [NL80211_IFTYPE_AP] = {
61 .tx = BIT(IEEE80211_STYPE_ACTION >> 4), 63 .tx = BIT(IEEE80211_STYPE_ACTION >> 4),
@@ -636,6 +638,12 @@ qtnf_connect(struct wiphy *wiphy, struct net_device *dev,
636 if (vif->wdev.iftype != NL80211_IFTYPE_STATION) 638 if (vif->wdev.iftype != NL80211_IFTYPE_STATION)
637 return -EOPNOTSUPP; 639 return -EOPNOTSUPP;
638 640
641 if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
642 !(sme->flags & CONNECT_REQ_EXTERNAL_AUTH_SUPPORT)) {
643 pr_err("can not offload authentication to userspace\n");
644 return -EOPNOTSUPP;
645 }
646
639 if (sme->bssid) 647 if (sme->bssid)
640 ether_addr_copy(vif->bssid, sme->bssid); 648 ether_addr_copy(vif->bssid, sme->bssid);
641 else 649 else
@@ -653,6 +661,30 @@ out:
653} 661}
654 662
655static int 663static int
664qtnf_external_auth(struct wiphy *wiphy, struct net_device *dev,
665 struct cfg80211_external_auth_params *auth)
666{
667 struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);
668 int ret;
669
670 if (vif->wdev.iftype != NL80211_IFTYPE_STATION)
671 return -EOPNOTSUPP;
672
673 if (!ether_addr_equal(vif->bssid, auth->bssid))
674 pr_warn("unexpected bssid: %pM", auth->bssid);
675
676 ret = qtnf_cmd_send_external_auth(vif, auth);
677 if (ret) {
678 pr_err("VIF%u.%u: failed to report external auth\n",
679 vif->mac->macid, vif->vifid);
680 goto out;
681 }
682
683out:
684 return ret;
685}
686
687static int
656qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, 688qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev,
657 u16 reason_code) 689 u16 reason_code)
658{ 690{
@@ -946,6 +978,7 @@ static struct cfg80211_ops qtn_cfg80211_ops = {
946 .set_default_mgmt_key = qtnf_set_default_mgmt_key, 978 .set_default_mgmt_key = qtnf_set_default_mgmt_key,
947 .scan = qtnf_scan, 979 .scan = qtnf_scan,
948 .connect = qtnf_connect, 980 .connect = qtnf_connect,
981 .external_auth = qtnf_external_auth,
949 .disconnect = qtnf_disconnect, 982 .disconnect = qtnf_disconnect,
950 .dump_survey = qtnf_dump_survey, 983 .dump_survey = qtnf_dump_survey,
951 .get_channel = qtnf_get_channel, 984 .get_channel = qtnf_get_channel,
@@ -1125,6 +1158,9 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)
1125 if (!(hw_info->hw_capab & QLINK_HW_CAPAB_OBSS_SCAN)) 1158 if (!(hw_info->hw_capab & QLINK_HW_CAPAB_OBSS_SCAN))
1126 wiphy->features |= NL80211_FEATURE_NEED_OBSS_SCAN; 1159 wiphy->features |= NL80211_FEATURE_NEED_OBSS_SCAN;
1127 1160
1161 if (hw_info->hw_capab & QLINK_HW_CAPAB_SAE)
1162 wiphy->features |= NL80211_FEATURE_SAE;
1163
1128#ifdef CONFIG_PM 1164#ifdef CONFIG_PM
1129 if (macinfo->wowlan) 1165 if (macinfo->wowlan)
1130 wiphy->wowlan = macinfo->wowlan; 1166 wiphy->wowlan = macinfo->wowlan;
diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c
index 0f48f541de41..85a2a58f4c16 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c
@@ -2322,6 +2322,35 @@ out:
2322 return ret; 2322 return ret;
2323} 2323}
2324 2324
2325int qtnf_cmd_send_external_auth(struct qtnf_vif *vif,
2326 struct cfg80211_external_auth_params *auth)
2327{
2328 struct sk_buff *cmd_skb;
2329 struct qlink_cmd_external_auth *cmd;
2330 int ret;
2331
2332 cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid,
2333 QLINK_CMD_EXTERNAL_AUTH,
2334 sizeof(*cmd));
2335 if (!cmd_skb)
2336 return -ENOMEM;
2337
2338 cmd = (struct qlink_cmd_external_auth *)cmd_skb->data;
2339
2340 ether_addr_copy(cmd->bssid, auth->bssid);
2341 cmd->status = cpu_to_le16(auth->status);
2342
2343 qtnf_bus_lock(vif->mac->bus);
2344 ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
2345 if (ret)
2346 goto out;
2347
2348out:
2349 qtnf_bus_unlock(vif->mac->bus);
2350
2351 return ret;
2352}
2353
2325int qtnf_cmd_send_disconnect(struct qtnf_vif *vif, u16 reason_code) 2354int qtnf_cmd_send_disconnect(struct qtnf_vif *vif, u16 reason_code)
2326{ 2355{
2327 struct sk_buff *cmd_skb; 2356 struct sk_buff *cmd_skb;
diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.h b/drivers/net/wireless/quantenna/qtnfmac/commands.h
index 96dff643bbc4..64f0b9dc8a14 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/commands.h
+++ b/drivers/net/wireless/quantenna/qtnfmac/commands.h
@@ -51,6 +51,8 @@ int qtnf_cmd_send_del_sta(struct qtnf_vif *vif,
51int qtnf_cmd_send_scan(struct qtnf_wmac *mac); 51int qtnf_cmd_send_scan(struct qtnf_wmac *mac);
52int qtnf_cmd_send_connect(struct qtnf_vif *vif, 52int qtnf_cmd_send_connect(struct qtnf_vif *vif,
53 struct cfg80211_connect_params *sme); 53 struct cfg80211_connect_params *sme);
54int qtnf_cmd_send_external_auth(struct qtnf_vif *vif,
55 struct cfg80211_external_auth_params *auth);
54int qtnf_cmd_send_disconnect(struct qtnf_vif *vif, 56int qtnf_cmd_send_disconnect(struct qtnf_vif *vif,
55 u16 reason_code); 57 u16 reason_code);
56int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, 58int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif,
diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c
index 3fd1a9217737..6c1b886339ac 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/event.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/event.c
@@ -150,6 +150,13 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,
150 struct cfg80211_chan_def chandef; 150 struct cfg80211_chan_def chandef;
151 struct cfg80211_bss *bss = NULL; 151 struct cfg80211_bss *bss = NULL;
152 u8 *ie = NULL; 152 u8 *ie = NULL;
153 size_t payload_len;
154 u16 tlv_type;
155 u16 tlv_value_len;
156 size_t tlv_full_len;
157 const struct qlink_tlv_hdr *tlv;
158 const u8 *rsp_ies = NULL;
159 size_t rsp_ies_len = 0;
153 160
154 if (unlikely(len < sizeof(*join_info))) { 161 if (unlikely(len < sizeof(*join_info))) {
155 pr_err("VIF%u.%u: payload is too short (%u < %zu)\n", 162 pr_err("VIF%u.%u: payload is too short (%u < %zu)\n",
@@ -167,67 +174,118 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,
167 pr_debug("VIF%u.%u: BSSID:%pM status:%u\n", 174 pr_debug("VIF%u.%u: BSSID:%pM status:%u\n",
168 vif->mac->macid, vif->vifid, join_info->bssid, status); 175 vif->mac->macid, vif->vifid, join_info->bssid, status);
169 176
170 if (status == WLAN_STATUS_SUCCESS) { 177 if (status != WLAN_STATUS_SUCCESS)
171 qlink_chandef_q2cfg(wiphy, &join_info->chan, &chandef); 178 goto done;
172 if (!cfg80211_chandef_valid(&chandef)) { 179
173 pr_warn("MAC%u.%u: bad channel freq=%u cf1=%u cf2=%u bw=%u\n", 180 qlink_chandef_q2cfg(wiphy, &join_info->chan, &chandef);
181 if (!cfg80211_chandef_valid(&chandef)) {
182 pr_warn("MAC%u.%u: bad channel freq=%u cf1=%u cf2=%u bw=%u\n",
183 vif->mac->macid, vif->vifid,
184 chandef.chan->center_freq,
185 chandef.center_freq1,
186 chandef.center_freq2,
187 chandef.width);
188 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
189 goto done;
190 }
191
192 bss = cfg80211_get_bss(wiphy, chandef.chan, join_info->bssid,
193 NULL, 0, IEEE80211_BSS_TYPE_ESS,
194 IEEE80211_PRIVACY_ANY);
195 if (!bss) {
196 pr_warn("VIF%u.%u: add missing BSS:%pM chan:%u\n",
197 vif->mac->macid, vif->vifid,
198 join_info->bssid, chandef.chan->hw_value);
199
200 if (!vif->wdev.ssid_len) {
201 pr_warn("VIF%u.%u: SSID unknown for BSS:%pM\n",
174 vif->mac->macid, vif->vifid, 202 vif->mac->macid, vif->vifid,
175 chandef.chan->center_freq, 203 join_info->bssid);
176 chandef.center_freq1,
177 chandef.center_freq2,
178 chandef.width);
179 status = WLAN_STATUS_UNSPECIFIED_FAILURE; 204 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
180 goto done; 205 goto done;
181 } 206 }
182 207
183 bss = cfg80211_get_bss(wiphy, chandef.chan, join_info->bssid, 208 ie = kzalloc(2 + vif->wdev.ssid_len, GFP_KERNEL);
184 NULL, 0, IEEE80211_BSS_TYPE_ESS, 209 if (!ie) {
185 IEEE80211_PRIVACY_ANY); 210 pr_warn("VIF%u.%u: IE alloc failed for BSS:%pM\n",
211 vif->mac->macid, vif->vifid,
212 join_info->bssid);
213 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
214 goto done;
215 }
216
217 ie[0] = WLAN_EID_SSID;
218 ie[1] = vif->wdev.ssid_len;
219 memcpy(ie + 2, vif->wdev.ssid, vif->wdev.ssid_len);
220
221 bss = cfg80211_inform_bss(wiphy, chandef.chan,
222 CFG80211_BSS_FTYPE_UNKNOWN,
223 join_info->bssid, 0,
224 WLAN_CAPABILITY_ESS, 100,
225 ie, 2 + vif->wdev.ssid_len,
226 0, GFP_KERNEL);
186 if (!bss) { 227 if (!bss) {
187 pr_warn("VIF%u.%u: add missing BSS:%pM chan:%u\n", 228 pr_warn("VIF%u.%u: can't connect to unknown BSS: %pM\n",
188 vif->mac->macid, vif->vifid, 229 vif->mac->macid, vif->vifid,
189 join_info->bssid, chandef.chan->hw_value); 230 join_info->bssid);
231 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
232 goto done;
233 }
234 }
190 235
191 if (!vif->wdev.ssid_len) { 236 payload_len = len - sizeof(*join_info);
192 pr_warn("VIF%u.%u: SSID unknown for BSS:%pM\n", 237 tlv = (struct qlink_tlv_hdr *)join_info->ies;
193 vif->mac->macid, vif->vifid, 238
194 join_info->bssid); 239 while (payload_len >= sizeof(struct qlink_tlv_hdr)) {
195 status = WLAN_STATUS_UNSPECIFIED_FAILURE; 240 tlv_type = le16_to_cpu(tlv->type);
196 goto done; 241 tlv_value_len = le16_to_cpu(tlv->len);
197 } 242 tlv_full_len = tlv_value_len + sizeof(struct qlink_tlv_hdr);
198 243
199 ie = kzalloc(2 + vif->wdev.ssid_len, GFP_KERNEL); 244 if (payload_len < tlv_full_len) {
200 if (!ie) { 245 pr_warn("invalid %u TLV\n", tlv_type);
201 pr_warn("VIF%u.%u: IE alloc failed for BSS:%pM\n", 246 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
202 vif->mac->macid, vif->vifid, 247 goto done;
203 join_info->bssid); 248 }
249
250 if (tlv_type == QTN_TLV_ID_IE_SET) {
251 const struct qlink_tlv_ie_set *ie_set;
252 unsigned int ie_len;
253
254 if (payload_len < sizeof(*ie_set)) {
255 pr_warn("invalid IE_SET TLV\n");
204 status = WLAN_STATUS_UNSPECIFIED_FAILURE; 256 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
205 goto done; 257 goto done;
206 } 258 }
207 259
208 ie[0] = WLAN_EID_SSID; 260 ie_set = (const struct qlink_tlv_ie_set *)tlv;
209 ie[1] = vif->wdev.ssid_len; 261 ie_len = tlv_value_len -
210 memcpy(ie + 2, vif->wdev.ssid, vif->wdev.ssid_len); 262 (sizeof(*ie_set) - sizeof(ie_set->hdr));
211 263
212 bss = cfg80211_inform_bss(wiphy, chandef.chan, 264 switch (ie_set->type) {
213 CFG80211_BSS_FTYPE_UNKNOWN, 265 case QLINK_IE_SET_ASSOC_RESP:
214 join_info->bssid, 0, 266 if (ie_len) {
215 WLAN_CAPABILITY_ESS, 100, 267 rsp_ies = ie_set->ie_data;
216 ie, 2 + vif->wdev.ssid_len, 268 rsp_ies_len = ie_len;
217 0, GFP_KERNEL); 269 }
218 if (!bss) { 270 break;
219 pr_warn("VIF%u.%u: can't connect to unknown BSS: %pM\n", 271 default:
220 vif->mac->macid, vif->vifid, 272 pr_warn("unexpected IE type: %u\n",
221 join_info->bssid); 273 ie_set->type);
222 status = WLAN_STATUS_UNSPECIFIED_FAILURE; 274 break;
223 goto done;
224 } 275 }
225 } 276 }
277
278 payload_len -= tlv_full_len;
279 tlv = (struct qlink_tlv_hdr *)(tlv->val + tlv_value_len);
226 } 280 }
227 281
282 if (payload_len)
283 pr_warn("VIF%u.%u: unexpected remaining payload: %zu\n",
284 vif->mac->macid, vif->vifid, payload_len);
285
228done: 286done:
229 cfg80211_connect_result(vif->netdev, join_info->bssid, NULL, 0, NULL, 287 cfg80211_connect_result(vif->netdev, join_info->bssid, NULL, 0, rsp_ies,
230 0, status, GFP_KERNEL); 288 rsp_ies_len, status, GFP_KERNEL);
231 if (bss) { 289 if (bss) {
232 if (!ether_addr_equal(vif->bssid, join_info->bssid)) 290 if (!ether_addr_equal(vif->bssid, join_info->bssid))
233 ether_addr_copy(vif->bssid, join_info->bssid); 291 ether_addr_copy(vif->bssid, join_info->bssid);
@@ -516,6 +574,43 @@ static int qtnf_event_handle_radar(struct qtnf_vif *vif,
516 return 0; 574 return 0;
517} 575}
518 576
577static int
578qtnf_event_handle_external_auth(struct qtnf_vif *vif,
579 const struct qlink_event_external_auth *ev,
580 u16 len)
581{
582 struct cfg80211_external_auth_params auth = {0};
583 struct wiphy *wiphy = priv_to_wiphy(vif->mac);
584 int ret;
585
586 if (len < sizeof(*ev)) {
587 pr_err("MAC%u: payload is too short\n", vif->mac->macid);
588 return -EINVAL;
589 }
590
591 if (!wiphy->registered || !vif->netdev)
592 return 0;
593
594 if (ev->ssid_len) {
595 memcpy(auth.ssid.ssid, ev->ssid, ev->ssid_len);
596 auth.ssid.ssid_len = ev->ssid_len;
597 }
598
599 auth.key_mgmt_suite = le32_to_cpu(ev->akm_suite);
600 ether_addr_copy(auth.bssid, ev->bssid);
601 auth.action = ev->action;
602
603 pr_info("%s: external auth bss=%pM action=%u akm=%u\n",
604 vif->netdev->name, auth.bssid, auth.action,
605 auth.key_mgmt_suite);
606
607 ret = cfg80211_external_auth_request(vif->netdev, &auth, GFP_KERNEL);
608 if (ret)
609 pr_warn("failed to offload external auth request\n");
610
611 return ret;
612}
613
519static int qtnf_event_parse(struct qtnf_wmac *mac, 614static int qtnf_event_parse(struct qtnf_wmac *mac,
520 const struct sk_buff *event_skb) 615 const struct sk_buff *event_skb)
521{ 616{
@@ -574,6 +669,10 @@ static int qtnf_event_parse(struct qtnf_wmac *mac,
574 ret = qtnf_event_handle_radar(vif, (const void *)event, 669 ret = qtnf_event_handle_radar(vif, (const void *)event,
575 event_len); 670 event_len);
576 break; 671 break;
672 case QLINK_EVENT_EXTERNAL_AUTH:
673 ret = qtnf_event_handle_external_auth(vif, (const void *)event,
674 event_len);
675 break;
577 default: 676 default:
578 pr_warn("unknown event type: %x\n", event_id); 677 pr_warn("unknown event type: %x\n", event_id);
579 break; 678 break;
diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h
index 27fdb5b01ee3..7798edcf7980 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h
+++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h
@@ -68,6 +68,7 @@ enum qlink_hw_capab {
68 QLINK_HW_CAPAB_PWR_MGMT = BIT(4), 68 QLINK_HW_CAPAB_PWR_MGMT = BIT(4),
69 QLINK_HW_CAPAB_OBSS_SCAN = BIT(5), 69 QLINK_HW_CAPAB_OBSS_SCAN = BIT(5),
70 QLINK_HW_CAPAB_SCAN_DWELL = BIT(6), 70 QLINK_HW_CAPAB_SCAN_DWELL = BIT(6),
71 QLINK_HW_CAPAB_SAE = BIT(8),
71}; 72};
72 73
73enum qlink_iface_type { 74enum qlink_iface_type {
@@ -250,6 +251,7 @@ enum qlink_cmd_type {
250 QLINK_CMD_DISCONNECT = 0x0061, 251 QLINK_CMD_DISCONNECT = 0x0061,
251 QLINK_CMD_PM_SET = 0x0062, 252 QLINK_CMD_PM_SET = 0x0062,
252 QLINK_CMD_WOWLAN_SET = 0x0063, 253 QLINK_CMD_WOWLAN_SET = 0x0063,
254 QLINK_CMD_EXTERNAL_AUTH = 0x0066,
253}; 255};
254 256
255/** 257/**
@@ -481,6 +483,20 @@ struct qlink_cmd_connect {
481} __packed; 483} __packed;
482 484
483/** 485/**
486 * struct qlink_cmd_external_auth - data for QLINK_CMD_EXTERNAL_AUTH command
487 *
488 * @bssid: BSSID of the BSS to connect to
489 * @status: authentication status code
490 * @payload: variable portion of connection request.
491 */
492struct qlink_cmd_external_auth {
493 struct qlink_cmd chdr;
494 u8 bssid[ETH_ALEN];
495 __le16 status;
496 u8 payload[0];
497} __packed;
498
499/**
484 * struct qlink_cmd_disconnect - data for QLINK_CMD_DISCONNECT command 500 * struct qlink_cmd_disconnect - data for QLINK_CMD_DISCONNECT command
485 * 501 *
486 * @reason: code of the reason of disconnect, see &enum ieee80211_reasoncode. 502 * @reason: code of the reason of disconnect, see &enum ieee80211_reasoncode.
@@ -925,6 +941,7 @@ enum qlink_event_type {
925 QLINK_EVENT_BSS_LEAVE = 0x0027, 941 QLINK_EVENT_BSS_LEAVE = 0x0027,
926 QLINK_EVENT_FREQ_CHANGE = 0x0028, 942 QLINK_EVENT_FREQ_CHANGE = 0x0028,
927 QLINK_EVENT_RADAR = 0x0029, 943 QLINK_EVENT_RADAR = 0x0029,
944 QLINK_EVENT_EXTERNAL_AUTH = 0x0030,
928}; 945};
929 946
930/** 947/**
@@ -984,6 +1001,7 @@ struct qlink_event_bss_join {
984 struct qlink_chandef chan; 1001 struct qlink_chandef chan;
985 u8 bssid[ETH_ALEN]; 1002 u8 bssid[ETH_ALEN];
986 __le16 status; 1003 __le16 status;
1004 u8 ies[0];
987} __packed; 1005} __packed;
988 1006
989/** 1007/**
@@ -1099,6 +1117,24 @@ struct qlink_event_radar {
1099 u8 rsvd[3]; 1117 u8 rsvd[3];
1100} __packed; 1118} __packed;
1101 1119
1120/**
1121 * struct qlink_event_external_auth - data for QLINK_EVENT_EXTERNAL_AUTH event
1122 *
1123 * @ssid: SSID announced by BSS
1124 * @ssid_len: SSID length
1125 * @bssid: BSSID of the BSS to connect to
1126 * @akm_suite: AKM suite for external authentication
1127 * @action: action type/trigger for external authentication
1128 */
1129struct qlink_event_external_auth {
1130 struct qlink_event ehdr;
1131 u8 ssid[IEEE80211_MAX_SSID_LEN];
1132 u8 ssid_len;
1133 u8 bssid[ETH_ALEN];
1134 __le32 akm_suite;
1135 u8 action;
1136} __packed;
1137
1102/* QLINK TLVs (Type-Length Values) definitions 1138/* QLINK TLVs (Type-Length Values) definitions
1103 */ 1139 */
1104 1140
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 7f813f6f8792..a03b5284a050 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -2966,6 +2966,7 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
2966 struct channel_info *info) 2966 struct channel_info *info)
2967{ 2967{
2968 u8 rfcsr; 2968 u8 rfcsr;
2969 int idx = rf->channel-1;
2969 2970
2970 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); 2971 rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1);
2971 rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); 2972 rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3);
@@ -3003,60 +3004,56 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
3003 3004
3004 rt2800_freq_cal_mode1(rt2x00dev); 3005 rt2800_freq_cal_mode1(rt2x00dev);
3005 3006
3006 if (rf->channel <= 14) { 3007 if (rt2x00_has_cap_bt_coexist(rt2x00dev)) {
3007 int idx = rf->channel-1; 3008 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
3008 3009 /* r55/r59 value array of channel 1~14 */
3009 if (rt2x00_has_cap_bt_coexist(rt2x00dev)) { 3010 static const char r55_bt_rev[] = {0x83, 0x83,
3010 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { 3011 0x83, 0x73, 0x73, 0x63, 0x53, 0x53,
3011 /* r55/r59 value array of channel 1~14 */ 3012 0x53, 0x43, 0x43, 0x43, 0x43, 0x43};
3012 static const char r55_bt_rev[] = {0x83, 0x83, 3013 static const char r59_bt_rev[] = {0x0e, 0x0e,
3013 0x83, 0x73, 0x73, 0x63, 0x53, 0x53, 3014 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09,
3014 0x53, 0x43, 0x43, 0x43, 0x43, 0x43}; 3015 0x07, 0x07, 0x07, 0x07, 0x07, 0x07};
3015 static const char r59_bt_rev[] = {0x0e, 0x0e, 3016
3016 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09, 3017 rt2800_rfcsr_write(rt2x00dev, 55,
3017 0x07, 0x07, 0x07, 0x07, 0x07, 0x07}; 3018 r55_bt_rev[idx]);
3018 3019 rt2800_rfcsr_write(rt2x00dev, 59,
3019 rt2800_rfcsr_write(rt2x00dev, 55, 3020 r59_bt_rev[idx]);
3020 r55_bt_rev[idx]);
3021 rt2800_rfcsr_write(rt2x00dev, 59,
3022 r59_bt_rev[idx]);
3023 } else {
3024 static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
3025 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
3026 0x88, 0x88, 0x86, 0x85, 0x84};
3027
3028 rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
3029 }
3030 } else { 3021 } else {
3031 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { 3022 static const char r59_bt[] = {0x8b, 0x8b, 0x8b,
3032 static const char r55_nonbt_rev[] = {0x23, 0x23, 3023 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89,
3033 0x23, 0x23, 0x13, 0x13, 0x03, 0x03, 3024 0x88, 0x88, 0x86, 0x85, 0x84};
3034 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}; 3025
3035 static const char r59_nonbt_rev[] = {0x07, 0x07, 3026 rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]);
3036 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 3027 }
3037 0x07, 0x07, 0x06, 0x05, 0x04, 0x04}; 3028 } else {
3038 3029 if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
3039 rt2800_rfcsr_write(rt2x00dev, 55, 3030 static const char r55_nonbt_rev[] = {0x23, 0x23,
3040 r55_nonbt_rev[idx]); 3031 0x23, 0x23, 0x13, 0x13, 0x03, 0x03,
3041 rt2800_rfcsr_write(rt2x00dev, 59, 3032 0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
3042 r59_nonbt_rev[idx]); 3033 static const char r59_nonbt_rev[] = {0x07, 0x07,
3043 } else if (rt2x00_rt(rt2x00dev, RT5390) || 3034 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
3044 rt2x00_rt(rt2x00dev, RT5392) || 3035 0x07, 0x07, 0x06, 0x05, 0x04, 0x04};
3045 rt2x00_rt(rt2x00dev, RT6352)) { 3036
3046 static const char r59_non_bt[] = {0x8f, 0x8f, 3037 rt2800_rfcsr_write(rt2x00dev, 55,
3047 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d, 3038 r55_nonbt_rev[idx]);
3048 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86}; 3039 rt2800_rfcsr_write(rt2x00dev, 59,
3049 3040 r59_nonbt_rev[idx]);
3050 rt2800_rfcsr_write(rt2x00dev, 59, 3041 } else if (rt2x00_rt(rt2x00dev, RT5390) ||
3051 r59_non_bt[idx]); 3042 rt2x00_rt(rt2x00dev, RT5392) ||
3052 } else if (rt2x00_rt(rt2x00dev, RT5350)) { 3043 rt2x00_rt(rt2x00dev, RT6352)) {
3053 static const char r59_non_bt[] = {0x0b, 0x0b, 3044 static const char r59_non_bt[] = {0x8f, 0x8f,
3054 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 3045 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d,
3055 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06}; 3046 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86};
3056 3047
3057 rt2800_rfcsr_write(rt2x00dev, 59, 3048 rt2800_rfcsr_write(rt2x00dev, 59,
3058 r59_non_bt[idx]); 3049 r59_non_bt[idx]);
3059 } 3050 } else if (rt2x00_rt(rt2x00dev, RT5350)) {
3051 static const char r59_non_bt[] = {0x0b, 0x0b,
3052 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
3053 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
3054
3055 rt2800_rfcsr_write(rt2x00dev, 59,
3056 r59_non_bt[idx]);
3060 } 3057 }
3061 } 3058 }
3062} 3059}
@@ -3861,10 +3858,12 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
3861 if (rt2x00_rt(rt2x00dev, RT3572)) 3858 if (rt2x00_rt(rt2x00dev, RT3572))
3862 rt2800_rfcsr_write(rt2x00dev, 8, 0); 3859 rt2800_rfcsr_write(rt2x00dev, 8, 0);
3863 3860
3864 if (rt2x00_rt(rt2x00dev, RT6352)) 3861 if (rt2x00_rt(rt2x00dev, RT6352)) {
3865 tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG); 3862 tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG);
3866 else 3863 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFRX_EN, 1);
3864 } else {
3867 tx_pin = 0; 3865 tx_pin = 0;
3866 }
3868 3867
3869 switch (rt2x00dev->default_ant.tx_chain_num) { 3868 switch (rt2x00dev->default_ant.tx_chain_num) {
3870 case 3: 3869 case 3:
@@ -3896,24 +3895,29 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
3896 switch (rt2x00dev->default_ant.rx_chain_num) { 3895 switch (rt2x00dev->default_ant.rx_chain_num) {
3897 case 3: 3896 case 3:
3898 /* Turn on tertiary LNAs */ 3897 /* Turn on tertiary LNAs */
3899 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1); 3898 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN,
3900 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1); 3899 rf->channel > 14);
3900 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN,
3901 rf->channel <= 14);
3901 /* fall-through */ 3902 /* fall-through */
3902 case 2: 3903 case 2:
3903 /* Turn on secondary LNAs */ 3904 /* Turn on secondary LNAs */
3904 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1); 3905 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN,
3905 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1); 3906 rf->channel > 14);
3907 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN,
3908 rf->channel <= 14);
3906 /* fall-through */ 3909 /* fall-through */
3907 case 1: 3910 case 1:
3908 /* Turn on primary LNAs */ 3911 /* Turn on primary LNAs */
3909 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1); 3912 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN,
3910 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1); 3913 rf->channel > 14);
3914 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN,
3915 rf->channel <= 14);
3911 break; 3916 break;
3912 } 3917 }
3913 3918
3914 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1); 3919 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
3915 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1); 3920 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
3916 rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFRX_EN, 1); /* mt7620 */
3917 3921
3918 rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); 3922 rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
3919 3923
@@ -3985,13 +3989,12 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
3985 rt2800_bbp_write(rt2x00dev, 195, 141); 3989 rt2800_bbp_write(rt2x00dev, 195, 141);
3986 rt2800_bbp_write(rt2x00dev, 196, reg); 3990 rt2800_bbp_write(rt2x00dev, 196, reg);
3987 3991
3988 /* AGC init */ 3992 /* AGC init.
3989 if (rt2x00_rt(rt2x00dev, RT6352)) 3993 * Despite the vendor driver using different values here for
3990 reg = 0x04; 3994 * RT6352 chip, we use 0x1c for now. This may have to be changed
3991 else 3995 * once TSSI got implemented.
3992 reg = rf->channel <= 14 ? 0x1c : 0x24; 3996 */
3993 3997 reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain;
3994 reg += 2 * rt2x00dev->lna_gain;
3995 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); 3998 rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
3996 3999
3997 rt2800_iq_calibrate(rt2x00dev, rf->channel); 4000 rt2800_iq_calibrate(rt2x00dev, rf->channel);
diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
index e2b1bfbcfbd4..d5f65372356b 100644
--- a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
@@ -1723,8 +1723,8 @@ static int rtl8180_probe(struct pci_dev *pdev,
1723{ 1723{
1724 struct ieee80211_hw *dev; 1724 struct ieee80211_hw *dev;
1725 struct rtl8180_priv *priv; 1725 struct rtl8180_priv *priv;
1726 unsigned long mem_addr, mem_len; 1726 unsigned long mem_len;
1727 unsigned int io_addr, io_len; 1727 unsigned int io_len;
1728 int err; 1728 int err;
1729 const char *chip_name, *rf_name = NULL; 1729 const char *chip_name, *rf_name = NULL;
1730 u32 reg; 1730 u32 reg;
@@ -1743,9 +1743,7 @@ static int rtl8180_probe(struct pci_dev *pdev,
1743 goto err_disable_dev; 1743 goto err_disable_dev;
1744 } 1744 }
1745 1745
1746 io_addr = pci_resource_start(pdev, 0);
1747 io_len = pci_resource_len(pdev, 0); 1746 io_len = pci_resource_len(pdev, 0);
1748 mem_addr = pci_resource_start(pdev, 1);
1749 mem_len = pci_resource_len(pdev, 1); 1747 mem_len = pci_resource_len(pdev, 1);
1750 1748
1751 if (mem_len < sizeof(struct rtl818x_csr) || 1749 if (mem_len < sizeof(struct rtl818x_csr) ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
index 7aa68fe5d791..672c0b73cb65 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "wifi.h" 4#include "wifi.h"
27#include "rc.h" 5#include "rc.h"
@@ -2311,11 +2289,10 @@ static void rtl_c2h_content_parsing(struct ieee80211_hw *hw,
2311 struct rtl_priv *rtlpriv = rtl_priv(hw); 2289 struct rtl_priv *rtlpriv = rtl_priv(hw);
2312 struct rtl_hal_ops *hal_ops = rtlpriv->cfg->ops; 2290 struct rtl_hal_ops *hal_ops = rtlpriv->cfg->ops;
2313 const struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops; 2291 const struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops;
2314 u8 cmd_id, cmd_seq, cmd_len; 2292 u8 cmd_id, cmd_len;
2315 u8 *cmd_buf = NULL; 2293 u8 *cmd_buf = NULL;
2316 2294
2317 cmd_id = GET_C2H_CMD_ID(skb->data); 2295 cmd_id = GET_C2H_CMD_ID(skb->data);
2318 cmd_seq = GET_C2H_SEQ(skb->data);
2319 cmd_len = skb->len - C2H_DATA_OFFSET; 2296 cmd_len = skb->len - C2H_DATA_OFFSET;
2320 cmd_buf = GET_C2H_DATA_PTR(skb->data); 2297 cmd_buf = GET_C2H_DATA_PTR(skb->data);
2321 2298
diff --git a/drivers/net/wireless/realtek/rtlwifi/base.h b/drivers/net/wireless/realtek/rtlwifi/base.h
index a7ae40eaa3cd..99565ad09cdc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.h
+++ b/drivers/net/wireless/realtek/rtlwifi/base.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_BASE_H__ 4#ifndef __RTL_BASE_H__
27#define __RTL_BASE_H__ 5#define __RTL_BASE_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h
index 02dff4c3f664..30a25480752d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbt_precomp.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2007-2011 Realtek Corporation.*/
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 ******************************************************************************/
24 3
25#ifndef __HALBT_PRECOMP_H__ 4#ifndef __HALBT_PRECOMP_H__
26#define __HALBT_PRECOMP_H__ 5#define __HALBT_PRECOMP_H__
@@ -49,8 +28,6 @@
49#include "halbtc8821a2ant.h" 28#include "halbtc8821a2ant.h"
50#include "halbtc8821a1ant.h" 29#include "halbtc8821a1ant.h"
51 30
52#define GetDefaultAdapter(padapter) padapter
53
54#define BIT0 0x00000001 31#define BIT0 0x00000001
55#define BIT1 0x00000002 32#define BIT1 0x00000002
56#define BIT2 0x00000004 33#define BIT2 0x00000004
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
index f22fec093f1d..3ebc7c93b1e9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
@@ -1,36 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25/**************************************************************
26 * Description:
27 *
28 * This file is for RTL8192E Co-exist mechanism
29 *
30 * History
31 * 2012/11/15 Cosa first check in.
32 *
33 **************************************************************/
34 3
35/************************************************************** 4/**************************************************************
36 * include files 5 * include files
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.h
index b8c95c7afc06..41ac0d5dcc9c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25/***************************************************************** 4/*****************************************************************
26 * The following is for 8192E 2Ant BT Co-exist definition 5 * The following is for 8192E 2Ant BT Co-exist definition
27 *****************************************************************/ 6 *****************************************************************/
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c
index 59553db020ef..5f5739904edf 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26/*************************************************************** 4/***************************************************************
27 * Description: 5 * Description:
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.h
index 934f27893c16..9d41e11388ad 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25/********************************************************************** 4/**********************************************************************
26 * The following is for 8723B 1ANT BT Co-exist definition 5 * The following is for 8723B 1ANT BT Co-exist definition
27 **********************************************************************/ 6 **********************************************************************/
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 6597f7cb3411..9f7b9af5bdcd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -1,27 +1,6 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25/*************************************************************** 4/***************************************************************
26 * Description: 5 * Description:
27 * 6 *
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
index aa24da402fb9..08aad6ef4046 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef _HAL8723B_2_ANT 4#ifndef _HAL8723B_2_ANT
26#define _HAL8723B_2_ANT 5#define _HAL8723B_2_ANT
27 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c
index b5d65872db84..fa5b73f81c57 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26/************************************************************** 4/**************************************************************
27 * Description: 5 * Description:
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.h
index a498ff5b1b9c..a63fb79a971a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26/*=========================================== 4/*===========================================
27 * The following is for 8821A 1ANT BT Co-exist definition 5 * The following is for 8821A 1ANT BT Co-exist definition
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index 01a9d303603b..e9e211fda264 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26/************************************************************ 4/************************************************************
27 * Description: 5 * Description:
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.h
index ce3e58c4e660..3df0ee8bd37b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2012 Realtek Corporation.*/
3 * Copyright(c) 2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26/*=========================================== 4/*===========================================
27 * The following is for 8821A 2Ant BT Co-exist definition 5 * The following is for 8821A 2Ant BT Co-exist definition
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.c
index 951b8c1e0153..145d6f9c017a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.c
@@ -1,17 +1,6 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2016-2017 Realtek Corporation.*/
3 * Copyright(c) 2016-2017 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 *****************************************************************************/
15#include "halbt_precomp.h" 4#include "halbt_precomp.h"
16 5
17void ex_hal8822b_wifi_only_hw_config(struct wifi_only_cfg *wifionlycfg) 6void ex_hal8822b_wifi_only_hw_config(struct wifi_only_cfg *wifionlycfg)
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.h
index 6ec356542eea..5fc66cea74b2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822bwifionly.h
@@ -1,17 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2016-2017 Realtek Corporation.*/
3 * Copyright(c) 2016-2017 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 *****************************************************************************/
15#ifndef __INC_HAL8822BWIFIONLYHWCFG_H 4#ifndef __INC_HAL8822BWIFIONLYHWCFG_H
16#define __INC_HAL8822BWIFIONLYHWCFG_H 5#define __INC_HAL8822BWIFIONLYHWCFG_H
17 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index d748aab66aa2..2ac0481b29ef 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2007-2013 Realtek Corporation.*/
3 * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 ******************************************************************************/
25 3
26#include "halbt_precomp.h" 4#include "halbt_precomp.h"
27 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
index 9eae87d19120..ee9aeddf1ebc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __HALBTC_OUT_SRC_H__ 4#ifndef __HALBTC_OUT_SRC_H__
26#define __HALBTC_OUT_SRC_H__ 5#define __HALBTC_OUT_SRC_H__
27 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
index cce4a37ea408..0e509c33e9e6 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.c
@@ -1,27 +1,6 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#include "../wifi.h" 4#include "../wifi.h"
26#include <linux/vmalloc.h> 5#include <linux/vmalloc.h>
27#include <linux/module.h> 6#include <linux/module.h>
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
index 8c996055de71..bf2cf8505aca 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/rtl_btc.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 *****************************************************************************/
24 3
25#ifndef __RTL_BTC_H__ 4#ifndef __RTL_BTC_H__
26#define __RTL_BTC_H__ 5#define __RTL_BTC_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/cam.c b/drivers/net/wireless/realtek/rtlwifi/cam.c
index f7a7dcbf945e..bf0e0bb1f99b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/cam.c
+++ b/drivers/net/wireless/realtek/rtlwifi/cam.c
@@ -1,27 +1,6 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#include "wifi.h" 4#include "wifi.h"
26#include "cam.h" 5#include "cam.h"
27#include <linux/export.h> 6#include <linux/export.h>
diff --git a/drivers/net/wireless/realtek/rtlwifi/cam.h b/drivers/net/wireless/realtek/rtlwifi/cam.h
index e2e647d511c1..2461fa9afda0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/cam.h
+++ b/drivers/net/wireless/realtek/rtlwifi/cam.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_CAM_H_ 4#ifndef __RTL_CAM_H_
27#define __RTL_CAM_H_ 5#define __RTL_CAM_H_
diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
index ce23339bf9fb..0913f02b7ff1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "wifi.h" 4#include "wifi.h"
27#include "core.h" 5#include "core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/core.h b/drivers/net/wireless/realtek/rtlwifi/core.h
index 782ac2fc4b28..7447ff456710 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.h
+++ b/drivers/net/wireless/realtek/rtlwifi/core.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_CORE_H__ 4#ifndef __RTL_CORE_H__
27#define __RTL_CORE_H__ 5#define __RTL_CORE_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.c b/drivers/net/wireless/realtek/rtlwifi/debug.c
index 8186650efc56..a051de16284d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/debug.c
+++ b/drivers/net/wireless/realtek/rtlwifi/debug.c
@@ -1,26 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *****************************************************************************/
24 3
25#include "wifi.h" 4#include "wifi.h"
26#include "cam.h" 5#include "cam.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.h b/drivers/net/wireless/realtek/rtlwifi/debug.h
index ad6834af618b..69f169d4d4ae 100644
--- a/drivers/net/wireless/realtek/rtlwifi/debug.h
+++ b/drivers/net/wireless/realtek/rtlwifi/debug.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *****************************************************************************/
24 3
25#ifndef __RTL_DEBUG_H__ 4#ifndef __RTL_DEBUG_H__
26#define __RTL_DEBUG_H__ 5#define __RTL_DEBUG_H__
@@ -157,7 +136,7 @@ enum dbgp_flag_e {
157 FEEPROM = 11, 136 FEEPROM = 11,
158 FPWR = 12, 137 FPWR = 12,
159 FDM = 13, 138 FDM = 13,
160 FDBGCtrl = 14, 139 FDBGCTRL = 14,
161 FC2H = 15, 140 FC2H = 15,
162 FBT = 16, 141 FBT = 16,
163 FINIT = 17, 142 FINIT = 17,
diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c b/drivers/net/wireless/realtek/rtlwifi/efuse.c
index 9729e51fce38..de0437b3cb95 100644
--- a/drivers/net/wireless/realtek/rtlwifi/efuse.c
+++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c
@@ -1,27 +1,6 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Tmis program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * Tme full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#include "wifi.h" 4#include "wifi.h"
26#include "efuse.h" 5#include "efuse.h"
27#include "pci.h" 6#include "pci.h"
@@ -386,20 +365,20 @@ bool efuse_shadow_update_chk(struct ieee80211_hw *hw)
386{ 365{
387 struct rtl_priv *rtlpriv = rtl_priv(hw); 366 struct rtl_priv *rtlpriv = rtl_priv(hw);
388 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 367 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
389 u8 section_idx, i, Base; 368 u8 section_idx, i, base;
390 u16 words_need = 0, hdr_num = 0, totalbytes, efuse_used; 369 u16 words_need = 0, hdr_num = 0, totalbytes, efuse_used;
391 bool wordchanged, result = true; 370 bool wordchanged, result = true;
392 371
393 for (section_idx = 0; section_idx < 16; section_idx++) { 372 for (section_idx = 0; section_idx < 16; section_idx++) {
394 Base = section_idx * 8; 373 base = section_idx * 8;
395 wordchanged = false; 374 wordchanged = false;
396 375
397 for (i = 0; i < 8; i = i + 2) { 376 for (i = 0; i < 8; i = i + 2) {
398 if ((rtlefuse->efuse_map[EFUSE_INIT_MAP][Base + i] != 377 if (rtlefuse->efuse_map[EFUSE_INIT_MAP][base + i] !=
399 rtlefuse->efuse_map[EFUSE_MODIFY_MAP][Base + i]) || 378 rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base + i] ||
400 (rtlefuse->efuse_map[EFUSE_INIT_MAP][Base + i + 1] != 379 rtlefuse->efuse_map[EFUSE_INIT_MAP][base + i + 1] !=
401 rtlefuse->efuse_map[EFUSE_MODIFY_MAP][Base + i + 380 rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base + i +
402 1])) { 381 1]) {
403 words_need++; 382 words_need++;
404 wordchanged = true; 383 wordchanged = true;
405 } 384 }
@@ -540,7 +519,7 @@ void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw)
540} 519}
541EXPORT_SYMBOL(rtl_efuse_shadow_map_update); 520EXPORT_SYMBOL(rtl_efuse_shadow_map_update);
542 521
543void efuse_force_write_vendor_Id(struct ieee80211_hw *hw) 522void efuse_force_write_vendor_id(struct ieee80211_hw *hw)
544{ 523{
545 u8 tmpdata[8] = { 0xFF, 0xFF, 0xEC, 0x10, 0xFF, 0xFF, 0xFF, 0xFF }; 524 u8 tmpdata[8] = { 0xFF, 0xFF, 0xEC, 0x10, 0xFF, 0xFF, 0xFF, 0xFF };
546 525
@@ -1132,7 +1111,7 @@ void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
1132 struct rtl_priv *rtlpriv = rtl_priv(hw); 1111 struct rtl_priv *rtlpriv = rtl_priv(hw);
1133 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1112 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1134 u8 tempval; 1113 u8 tempval;
1135 u16 tmpV16; 1114 u16 tmpv16;
1136 1115
1137 if (pwrstate && (rtlhal->hw_type != HARDWARE_TYPE_RTL8192SE)) { 1116 if (pwrstate && (rtlhal->hw_type != HARDWARE_TYPE_RTL8192SE)) {
1138 1117
@@ -1141,31 +1120,31 @@ void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
1141 rtl_write_byte(rtlpriv, 1120 rtl_write_byte(rtlpriv,
1142 rtlpriv->cfg->maps[EFUSE_ACCESS], 0x69); 1121 rtlpriv->cfg->maps[EFUSE_ACCESS], 0x69);
1143 } else { 1122 } else {
1144 tmpV16 = 1123 tmpv16 =
1145 rtl_read_word(rtlpriv, 1124 rtl_read_word(rtlpriv,
1146 rtlpriv->cfg->maps[SYS_ISO_CTRL]); 1125 rtlpriv->cfg->maps[SYS_ISO_CTRL]);
1147 if (!(tmpV16 & rtlpriv->cfg->maps[EFUSE_PWC_EV12V])) { 1126 if (!(tmpv16 & rtlpriv->cfg->maps[EFUSE_PWC_EV12V])) {
1148 tmpV16 |= rtlpriv->cfg->maps[EFUSE_PWC_EV12V]; 1127 tmpv16 |= rtlpriv->cfg->maps[EFUSE_PWC_EV12V];
1149 rtl_write_word(rtlpriv, 1128 rtl_write_word(rtlpriv,
1150 rtlpriv->cfg->maps[SYS_ISO_CTRL], 1129 rtlpriv->cfg->maps[SYS_ISO_CTRL],
1151 tmpV16); 1130 tmpv16);
1152 } 1131 }
1153 } 1132 }
1154 tmpV16 = rtl_read_word(rtlpriv, 1133 tmpv16 = rtl_read_word(rtlpriv,
1155 rtlpriv->cfg->maps[SYS_FUNC_EN]); 1134 rtlpriv->cfg->maps[SYS_FUNC_EN]);
1156 if (!(tmpV16 & rtlpriv->cfg->maps[EFUSE_FEN_ELDR])) { 1135 if (!(tmpv16 & rtlpriv->cfg->maps[EFUSE_FEN_ELDR])) {
1157 tmpV16 |= rtlpriv->cfg->maps[EFUSE_FEN_ELDR]; 1136 tmpv16 |= rtlpriv->cfg->maps[EFUSE_FEN_ELDR];
1158 rtl_write_word(rtlpriv, 1137 rtl_write_word(rtlpriv,
1159 rtlpriv->cfg->maps[SYS_FUNC_EN], tmpV16); 1138 rtlpriv->cfg->maps[SYS_FUNC_EN], tmpv16);
1160 } 1139 }
1161 1140
1162 tmpV16 = rtl_read_word(rtlpriv, rtlpriv->cfg->maps[SYS_CLK]); 1141 tmpv16 = rtl_read_word(rtlpriv, rtlpriv->cfg->maps[SYS_CLK]);
1163 if ((!(tmpV16 & rtlpriv->cfg->maps[EFUSE_LOADER_CLK_EN])) || 1142 if ((!(tmpv16 & rtlpriv->cfg->maps[EFUSE_LOADER_CLK_EN])) ||
1164 (!(tmpV16 & rtlpriv->cfg->maps[EFUSE_ANA8M]))) { 1143 (!(tmpv16 & rtlpriv->cfg->maps[EFUSE_ANA8M]))) {
1165 tmpV16 |= (rtlpriv->cfg->maps[EFUSE_LOADER_CLK_EN] | 1144 tmpv16 |= (rtlpriv->cfg->maps[EFUSE_LOADER_CLK_EN] |
1166 rtlpriv->cfg->maps[EFUSE_ANA8M]); 1145 rtlpriv->cfg->maps[EFUSE_ANA8M]);
1167 rtl_write_word(rtlpriv, 1146 rtl_write_word(rtlpriv,
1168 rtlpriv->cfg->maps[SYS_CLK], tmpV16); 1147 rtlpriv->cfg->maps[SYS_CLK], tmpv16);
1169 } 1148 }
1170 } 1149 }
1171 1150
diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.h b/drivers/net/wireless/realtek/rtlwifi/efuse.h
index dfa31c13fc7a..1ec59f439382 100644
--- a/drivers/net/wireless/realtek/rtlwifi/efuse.h
+++ b/drivers/net/wireless/realtek/rtlwifi/efuse.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_EFUSE_H_ 4#ifndef __RTL_EFUSE_H_
27#define __RTL_EFUSE_H_ 5#define __RTL_EFUSE_H_
@@ -107,7 +85,7 @@ void efuse_shadow_write(struct ieee80211_hw *hw, u8 type,
107bool efuse_shadow_update(struct ieee80211_hw *hw); 85bool efuse_shadow_update(struct ieee80211_hw *hw);
108bool efuse_shadow_update_chk(struct ieee80211_hw *hw); 86bool efuse_shadow_update_chk(struct ieee80211_hw *hw);
109void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); 87void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw);
110void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); 88void efuse_force_write_vendor_id(struct ieee80211_hw *hw);
111void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx); 89void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx);
112void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate); 90void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate);
113int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv, 91int rtl_get_hwinfo(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv,
diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 5d1fda16fc8c..48ca52102cef 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "wifi.h" 4#include "wifi.h"
27#include "core.h" 5#include "core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.h b/drivers/net/wireless/realtek/rtlwifi/pci.h
index 3fb56c845a61..866861626a0a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.h
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_PCI_H__ 4#ifndef __RTL_PCI_H__
27#define __RTL_PCI_H__ 5#define __RTL_PCI_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c
index 479a4cfc245d..dca70d239760 100644
--- a/drivers/net/wireless/realtek/rtlwifi/ps.c
+++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "wifi.h" 4#include "wifi.h"
27#include "base.h" 5#include "base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.h b/drivers/net/wireless/realtek/rtlwifi/ps.h
index 0df2b5203030..aaa2ed2bbe16 100644
--- a/drivers/net/wireless/realtek/rtlwifi/ps.h
+++ b/drivers/net/wireless/realtek/rtlwifi/ps.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __REALTEK_RTL_PCI_PS_H__ 4#ifndef __REALTEK_RTL_PCI_PS_H__
27#define __REALTEK_RTL_PCI_PS_H__ 5#define __REALTEK_RTL_PCI_PS_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/pwrseqcmd.h b/drivers/net/wireless/realtek/rtlwifi/pwrseqcmd.h
index 17ce0cb2c35c..db1765c6fef6 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pwrseqcmd.h
+++ b/drivers/net/wireless/realtek/rtlwifi/pwrseqcmd.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_PWRSEQCMD_H__ 4#ifndef __RTL8723E_PWRSEQCMD_H__
27#define __RTL8723E_PWRSEQCMD_H__ 5#define __RTL8723E_PWRSEQCMD_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c
index 6c78c6dabbdf..8fa76eab61d2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rc.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "wifi.h" 4#include "wifi.h"
27#include "base.h" 5#include "base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.h b/drivers/net/wireless/realtek/rtlwifi/rc.h
index f29643d60d6b..1c0a17370093 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rc.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_RC_H__ 4#ifndef __RTL_RC_H__
27#define __RTL_RC_H__ 5#define __RTL_RC_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/regd.c b/drivers/net/wireless/realtek/rtlwifi/regd.c
index 1bf3eb25c1da..c7048830decd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/regd.c
+++ b/drivers/net/wireless/realtek/rtlwifi/regd.c
@@ -1,32 +1,10 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "wifi.h" 4#include "wifi.h"
27#include "regd.h" 5#include "regd.h"
28 6
29static struct country_code_to_enum_rd allCountries[] = { 7static struct country_code_to_enum_rd all_countries[] = {
30 {COUNTRY_CODE_FCC, "US"}, 8 {COUNTRY_CODE_FCC, "US"},
31 {COUNTRY_CODE_IC, "US"}, 9 {COUNTRY_CODE_IC, "US"},
32 {COUNTRY_CODE_ETSI, "EC"}, 10 {COUNTRY_CODE_ETSI, "EC"},
@@ -391,9 +369,9 @@ static struct country_code_to_enum_rd *_rtl_regd_find_country(u16 countrycode)
391{ 369{
392 int i; 370 int i;
393 371
394 for (i = 0; i < ARRAY_SIZE(allCountries); i++) { 372 for (i = 0; i < ARRAY_SIZE(all_countries); i++) {
395 if (allCountries[i].countrycode == countrycode) 373 if (all_countries[i].countrycode == countrycode)
396 return &allCountries[i]; 374 return &all_countries[i];
397 } 375 }
398 return NULL; 376 return NULL;
399} 377}
diff --git a/drivers/net/wireless/realtek/rtlwifi/regd.h b/drivers/net/wireless/realtek/rtlwifi/regd.h
index f7f15bce35dd..3ba068511e34 100644
--- a/drivers/net/wireless/realtek/rtlwifi/regd.h
+++ b/drivers/net/wireless/realtek/rtlwifi/regd.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_REGD_H__ 4#ifndef __RTL_REGD_H__
27#define __RTL_REGD_H__ 5#define __RTL_REGD_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/def.h
index 45c866d3ca88..fa2e1b063f68 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/def.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_DEF_H__ 4#ifndef __RTL92C_DEF_H__
27#define __RTL92C_DEF_H__ 5#define __RTL92C_DEF_H__
@@ -123,9 +101,6 @@
123 101
124#define IS_92C_SERIAL(version) \ 102#define IS_92C_SERIAL(version) \
125 ((IS_81XXC(version) && IS_2T2R(version)) ? true : false) 103 ((IS_81XXC(version) && IS_2T2R(version)) ? true : false)
126#define IS_81xxC_VENDOR_UMC_A_CUT(version) \
127 (IS_81XXC(version) ? ((IS_CHIP_VENDOR_UMC(version)) ? \
128 ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) : false)
129#define IS_81XXC_VENDOR_UMC_B_CUT(version) \ 104#define IS_81XXC_VENDOR_UMC_B_CUT(version) \
130 (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \ 105 (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \
131 ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true \ 106 ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true \
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
index e05af7d60830..85360353f557 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.h
index 50f26a9a97db..eb8090caeec2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL88E_DM_H__ 4#ifndef __RTL88E_DM_H__
27#define __RTL88E_DM_H__ 5#define __RTL88E_DM_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c
index 63874512598b..203e7b574e84 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.h
index b884c30c7b37..39ddb7afea9d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 *****************************************************************************/
24 3
25#ifndef __RTL92C__FW__H__ 4#ifndef __RTL92C__FW__H__
26#define __RTL92C__FW__H__ 5#define __RTL92C__FW__H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
index cfc8762c55f4..454bab38b165 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.h
index 214cd2a32018..fd09b0712d17 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_HW_H__ 4#ifndef __RTL92CE_HW_H__
27#define __RTL92CE_HW_H__ 5#define __RTL92CE_HW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c
index df3e214460db..4ef6d5907521 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h
index 4b325b75faaf..67d3dc389ba0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/led.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_LED_H__ 4#ifndef __RTL92CE_LED_H__
27#define __RTL92CE_LED_H__ 5#define __RTL92CE_LED_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c
index 14a256062614..96d8f25b120f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.h
index b29bd77210f4..8157ef419eeb 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_PHY_H__ 4#ifndef __RTL92C_PHY_H__
27#define __RTL92C_PHY_H__ 5#define __RTL92C_PHY_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.c
index 02013df968a0..d69497bf5d19 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../pwrseqcmd.h" 4#include "../pwrseqcmd.h"
27#include "pwrseq.h" 5#include "pwrseq.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.h
index 8379a3e5198c..42e222c1795f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/pwrseq.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_PWRSEQ_H__ 4#ifndef __RTL8723E_PWRSEQ_H__
27#define __RTL8723E_PWRSEQ_H__ 5#define __RTL8723E_PWRSEQ_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/reg.h
index 0c0d64aea651..0fc8db8916fa 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/reg.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_REG_H__ 4#ifndef __RTL92C_REG_H__
27#define __RTL92C_REG_H__ 5#define __RTL92C_REG_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c
index 30798b12a363..0f401ad92c2e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.h
index 0eca030e3238..05e27b40b2a9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rf.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_RF_H__ 4#ifndef __RTL92C_RF_H__
27#define __RTL92C_RF_H__ 5#define __RTL92C_RF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
index 8c15ffd3568b..eab48fed61ed 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.h
index 22398c3753a6..1407151503f8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_SW_H__ 4#ifndef __RTL92CE_SW_H__
27#define __RTL92CE_SW_H__ 5#define __RTL92CE_SW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c
index 68bcb7fe6a65..a3c312c3ed9a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.c
@@ -1,29 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#include "table.h" 4#include "table.h"
29u32 RTL8188EEPHY_REG_1TARRAY[] = { 5u32 RTL8188EEPHY_REG_1TARRAY[] = {
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.h
index 403c4ddd236f..df6065602401 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/table.h
@@ -1,29 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#ifndef __RTL92CE_TABLE__H_ 4#ifndef __RTL92CE_TABLE__H_
29#define __RTL92CE_TABLE__H_ 5#define __RTL92CE_TABLE__H_
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
index 14dcb0816bc0..106011a24827 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -415,7 +393,7 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
415 (GET_RX_DESC_FAGGR(pdesc) == 1)); 393 (GET_RX_DESC_FAGGR(pdesc) == 1));
416 if (status->packet_report_type == NORMAL_RX) 394 if (status->packet_report_type == NORMAL_RX)
417 status->timestamp_low = GET_RX_DESC_TSFL(pdesc); 395 status->timestamp_low = GET_RX_DESC_TSFL(pdesc);
418 status->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); 396 status->rx_is40mhzpacket = (bool)GET_RX_DESC_BW(pdesc);
419 status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); 397 status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc);
420 398
421 status->is_cck = RTL8188_RX_HAL_IS_CCK_RATE(status->rate); 399 status->is_cck = RTL8188_RX_HAL_IS_CCK_RATE(status->rate);
@@ -442,7 +420,7 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
442 if (status->crc) 420 if (status->crc)
443 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 421 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
444 422
445 if (status->rx_is40Mhzpacket) 423 if (status->rx_is40mhzpacket)
446 rx_status->bw = RATE_INFO_BW_40; 424 rx_status->bw = RATE_INFO_BW_40;
447 425
448 if (status->is_ht) 426 if (status->is_ht)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
index 127ba977206f..c29d9bfa5bd4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/trx.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2013 Realtek Corporation.*/
3 * Copyright(c) 2009-2013 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_TRX_H__ 4#ifndef __RTL92CE_TRX_H__
27#define __RTL92CE_TRX_H__ 5#define __RTL92CE_TRX_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c
index 0b5a06ffa482..2f633118c717 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include <linux/export.h> 4#include <linux/export.h>
27#include "dm_common.h" 5#include "dm_common.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h
index 441604ff5858..c4ce9fc96163 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92COMMON_DM_H__ 4#ifndef __RTL92COMMON_DM_H__
27#define __RTL92COMMON_DM_H__ 5#define __RTL92COMMON_DM_H__
@@ -49,7 +27,7 @@
49#define DM_DIG_FA_TH1 0x100 27#define DM_DIG_FA_TH1 0x100
50#define DM_DIG_FA_TH2 0x200 28#define DM_DIG_FA_TH2 0x200
51 29
52#define RXPATHSELECTION_SS_TH_lOW 30 30#define RXPATHSELECTION_SS_TH_LOW 30
53#define RXPATHSELECTION_DIFF_TH 18 31#define RXPATHSELECTION_DIFF_TH 18
54 32
55#define DM_RATR_STA_INIT 0 33#define DM_RATR_STA_INIT 0
@@ -60,7 +38,7 @@
60#define CTS2SELF_THVAL 30 38#define CTS2SELF_THVAL 30
61#define REGC38_TH 20 39#define REGC38_TH 20
62 40
63#define WAIOTTHVal 25 41#define WAIOTTHVAL 25
64 42
65#define TXHIGHPWRLEVEL_NORMAL 0 43#define TXHIGHPWRLEVEL_NORMAL 0
66#define TXHIGHPWRLEVEL_LEVEL1 1 44#define TXHIGHPWRLEVEL_LEVEL1 1
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
index f3bff66e85d0..6af72799e09c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -79,27 +57,27 @@ static void _rtl92c_write_fw(struct ieee80211_hw *hw,
79 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "FW size is %d bytes,\n", size); 57 RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "FW size is %d bytes,\n", size);
80 is_version_b = IS_NORMAL_CHIP(version); 58 is_version_b = IS_NORMAL_CHIP(version);
81 if (is_version_b) { 59 if (is_version_b) {
82 u32 pageNums, remainsize; 60 u32 pagenums, remainsize;
83 u32 page, offset; 61 u32 page, offset;
84 62
85 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE) 63 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE)
86 rtl_fill_dummy(bufferptr, &size); 64 rtl_fill_dummy(bufferptr, &size);
87 65
88 pageNums = size / FW_8192C_PAGE_SIZE; 66 pagenums = size / FW_8192C_PAGE_SIZE;
89 remainsize = size % FW_8192C_PAGE_SIZE; 67 remainsize = size % FW_8192C_PAGE_SIZE;
90 68
91 if (pageNums > 4) 69 if (pagenums > 4)
92 pr_err("Page numbers should not greater then 4\n"); 70 pr_err("Page numbers should not greater then 4\n");
93 71
94 for (page = 0; page < pageNums; page++) { 72 for (page = 0; page < pagenums; page++) {
95 offset = page * FW_8192C_PAGE_SIZE; 73 offset = page * FW_8192C_PAGE_SIZE;
96 rtl_fw_page_write(hw, page, (bufferptr + offset), 74 rtl_fw_page_write(hw, page, (bufferptr + offset),
97 FW_8192C_PAGE_SIZE); 75 FW_8192C_PAGE_SIZE);
98 } 76 }
99 77
100 if (remainsize) { 78 if (remainsize) {
101 offset = pageNums * FW_8192C_PAGE_SIZE; 79 offset = pagenums * FW_8192C_PAGE_SIZE;
102 page = pageNums; 80 page = pagenums;
103 rtl_fw_page_write(hw, page, (bufferptr + offset), 81 rtl_fw_page_write(hw, page, (bufferptr + offset),
104 remainsize); 82 remainsize);
105 } 83 }
@@ -118,7 +96,7 @@ static int _rtl92c_fw_free_to_go(struct ieee80211_hw *hw)
118 do { 96 do {
119 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); 97 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
120 } while ((counter++ < FW_8192C_POLLING_TIMEOUT_COUNT) && 98 } while ((counter++ < FW_8192C_POLLING_TIMEOUT_COUNT) &&
121 (!(value32 & FWDL_ChkSum_rpt))); 99 (!(value32 & FWDL_CHKSUM_RPT)));
122 100
123 if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) { 101 if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) {
124 pr_err("chksum report fail! REG_MCUFWDL:0x%08x .\n", 102 pr_err("chksum report fail! REG_MCUFWDL:0x%08x .\n",
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.h
index c5fa14bda387..888d9fc94bc2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C__FW__COMMON__H__ 4#ifndef __RTL92C__FW__COMMON__H__
27#define __RTL92C__FW__COMMON__H__ 5#define __RTL92C__FW__COMMON__H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/main.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/main.c
index 889bd1301154..e8af1952d243 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/main.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/main.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include <linux/module.h> 5#include <linux/module.h>
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c
index 7c6e5d91439d..c6a3ed441c3f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../rtl8192ce/reg.h" 5#include "../rtl8192ce/reg.h"
@@ -239,7 +217,7 @@ bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw)
239 217
240EXPORT_SYMBOL(_rtl92c_phy_bb8192c_config_parafile); 218EXPORT_SYMBOL(_rtl92c_phy_bb8192c_config_parafile);
241 219
242void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, 220void _rtl92c_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw,
243 u32 regaddr, u32 bitmask, 221 u32 regaddr, u32 bitmask,
244 u32 data) 222 u32 data)
245{ 223{
@@ -393,7 +371,7 @@ void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
393 rtlphy->pwrgroup_cnt++; 371 rtlphy->pwrgroup_cnt++;
394 } 372 }
395} 373}
396EXPORT_SYMBOL(_rtl92c_store_pwrIndex_diffrate_offset); 374EXPORT_SYMBOL(_rtl92c_store_pwrindex_diffrate_offset);
397 375
398void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw) 376void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
399{ 377{
@@ -452,10 +430,10 @@ void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw)
452 rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset = 430 rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset =
453 RFPGA0_XB_LSSIPARAMETER; 431 RFPGA0_XB_LSSIPARAMETER;
454 432
455 rtlphy->phyreg_def[RF90_PATH_A].rflssi_select = rFPGA0_XAB_RFPARAMETER; 433 rtlphy->phyreg_def[RF90_PATH_A].rflssi_select = RFPGA0_XAB_RFPARAMETER;
456 rtlphy->phyreg_def[RF90_PATH_B].rflssi_select = rFPGA0_XAB_RFPARAMETER; 434 rtlphy->phyreg_def[RF90_PATH_B].rflssi_select = RFPGA0_XAB_RFPARAMETER;
457 rtlphy->phyreg_def[RF90_PATH_C].rflssi_select = rFPGA0_XCD_RFPARAMETER; 435 rtlphy->phyreg_def[RF90_PATH_C].rflssi_select = RFPGA0_XCD_RFPARAMETER;
458 rtlphy->phyreg_def[RF90_PATH_D].rflssi_select = rFPGA0_XCD_RFPARAMETER; 436 rtlphy->phyreg_def[RF90_PATH_D].rflssi_select = RFPGA0_XCD_RFPARAMETER;
459 437
460 rtlphy->phyreg_def[RF90_PATH_A].rftxgain_stage = RFPGA0_TXGAINSTAGE; 438 rtlphy->phyreg_def[RF90_PATH_A].rftxgain_stage = RFPGA0_TXGAINSTAGE;
461 rtlphy->phyreg_def[RF90_PATH_B].rftxgain_stage = RFPGA0_TXGAINSTAGE; 439 rtlphy->phyreg_def[RF90_PATH_B].rftxgain_stage = RFPGA0_TXGAINSTAGE;
@@ -1120,19 +1098,19 @@ static void _rtl92c_phy_reload_mac_registers(struct ieee80211_hw *hw,
1120static void _rtl92c_phy_path_adda_on(struct ieee80211_hw *hw, 1098static void _rtl92c_phy_path_adda_on(struct ieee80211_hw *hw,
1121 u32 *addareg, bool is_patha_on, bool is2t) 1099 u32 *addareg, bool is_patha_on, bool is2t)
1122{ 1100{
1123 u32 pathOn; 1101 u32 pathon;
1124 u32 i; 1102 u32 i;
1125 1103
1126 pathOn = is_patha_on ? 0x04db25a4 : 0x0b1b25a4; 1104 pathon = is_patha_on ? 0x04db25a4 : 0x0b1b25a4;
1127 if (false == is2t) { 1105 if (false == is2t) {
1128 pathOn = 0x0bdb25a0; 1106 pathon = 0x0bdb25a0;
1129 rtl_set_bbreg(hw, addareg[0], MASKDWORD, 0x0b1b25a0); 1107 rtl_set_bbreg(hw, addareg[0], MASKDWORD, 0x0b1b25a0);
1130 } else { 1108 } else {
1131 rtl_set_bbreg(hw, addareg[0], MASKDWORD, pathOn); 1109 rtl_set_bbreg(hw, addareg[0], MASKDWORD, pathon);
1132 } 1110 }
1133 1111
1134 for (i = 1; i < IQK_ADDA_REG_NUM; i++) 1112 for (i = 1; i < IQK_ADDA_REG_NUM; i++)
1135 rtl_set_bbreg(hw, addareg[i], MASKDWORD, pathOn); 1113 rtl_set_bbreg(hw, addareg[i], MASKDWORD, pathon);
1136} 1114}
1137 1115
1138static void _rtl92c_phy_mac_setting_calibration(struct ieee80211_hw *hw, 1116static void _rtl92c_phy_mac_setting_calibration(struct ieee80211_hw *hw,
@@ -1361,7 +1339,7 @@ static void _rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw,
1361 1339
1362 if (is_hal_stop(rtlhal)) { 1340 if (is_hal_stop(rtlhal)) {
1363 rtl_set_bbreg(hw, REG_LEDCFG0, BIT(23), 0x01); 1341 rtl_set_bbreg(hw, REG_LEDCFG0, BIT(23), 0x01);
1364 rtl_set_bbreg(hw, rFPGA0_XAB_RFPARAMETER, BIT(13), 0x01); 1342 rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(13), 0x01);
1365 } 1343 }
1366 if (is2t) { 1344 if (is2t) {
1367 if (bmain) 1345 if (bmain)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h
index d11261e05a2e..75afa6253ad0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_PHY_COMMON_H__ 4#ifndef __RTL92C_PHY_COMMON_H__
27#define __RTL92C_PHY_COMMON_H__ 5#define __RTL92C_PHY_COMMON_H__
@@ -44,9 +22,9 @@
44 22
45#define LOOP_LIMIT 5 23#define LOOP_LIMIT 5
46#define MAX_STALL_TIME 50 24#define MAX_STALL_TIME 50
47#define AntennaDiversityValue 0x80 25#define ANTENNADIVERSITYVALUE 0x80
48#define MAX_TXPWR_IDX_NMODE_92S 63 26#define MAX_TXPWR_IDX_NMODE_92S 63
49#define Reset_Cnt_Limit 3 27#define RESET_CNT_LIMIT 3
50 28
51#define IQK_ADDA_REG_NUM 16 29#define IQK_ADDA_REG_NUM 16
52#define IQK_MAC_REG_NUM 4 30#define IQK_MAC_REG_NUM 4
@@ -242,7 +220,7 @@ void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
242 enum radio_path rfpath, u32 offset, 220 enum radio_path rfpath, u32 offset,
243 u32 data); 221 u32 data);
244bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); 222bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw);
245void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, 223void _rtl92c_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw,
246 u32 regaddr, u32 bitmask, 224 u32 regaddr, u32 bitmask,
247 u32 data); 225 u32 data);
248bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); 226bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/def.h
index d2005d7e9ad2..147bf2407f8f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/def.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_DEF_H__ 4#ifndef __RTL92C_DEF_H__
27#define __RTL92C_DEF_H__ 5#define __RTL92C_DEF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.c
index 2c8205e46be4..a3e2c8a60967 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.h
index 9761d0ca31b0..eab42c1bd470 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/dm.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_DM_H__ 4#ifndef __RTL92C_DM_H__
27#define __RTL92C_DM_H__ 5#define __RTL92C_DM_H__
@@ -44,7 +22,7 @@
44#define DM_DIG_FA_TH1 0x100 22#define DM_DIG_FA_TH1 0x100
45#define DM_DIG_FA_TH2 0x200 23#define DM_DIG_FA_TH2 0x200
46 24
47#define RXPATHSELECTION_SS_TH_lOW 30 25#define RXPATHSELECTION_SS_TH_LOW 30
48#define RXPATHSELECTION_DIFF_TH 18 26#define RXPATHSELECTION_DIFF_TH 18
49 27
50#define DM_RATR_STA_INIT 0 28#define DM_RATR_STA_INIT 0
@@ -55,7 +33,7 @@
55#define CTS2SELF_THVAL 30 33#define CTS2SELF_THVAL 30
56#define REGC38_TH 20 34#define REGC38_TH 20
57 35
58#define WAIOTTHVal 25 36#define WAIOTTHVAL 25
59 37
60#define TXHIGHPWRLEVEL_NORMAL 0 38#define TXHIGHPWRLEVEL_NORMAL 0
61#define TXHIGHPWRLEVEL_LEVEL1 1 39#define TXHIGHPWRLEVEL_LEVEL1 1
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
index 4a81e0ef4b8e..d8f496e2d68b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
@@ -104,13 +82,13 @@ void rtl92ce_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
104 *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; 82 *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state;
105 break; 83 break;
106 case HW_VAR_FWLPS_RF_ON:{ 84 case HW_VAR_FWLPS_RF_ON:{
107 enum rf_pwrstate rfState; 85 enum rf_pwrstate rfstate;
108 u32 val_rcr; 86 u32 val_rcr;
109 87
110 rtlpriv->cfg->ops->get_hw_reg(hw, 88 rtlpriv->cfg->ops->get_hw_reg(hw,
111 HW_VAR_RF_STATE, 89 HW_VAR_RF_STATE,
112 (u8 *) (&rfState)); 90 (u8 *)(&rfstate));
113 if (rfState == ERFOFF) { 91 if (rfstate == ERFOFF) {
114 *((bool *) (val)) = true; 92 *((bool *) (val)) = true;
115 } else { 93 } else {
116 val_rcr = rtl_read_dword(rtlpriv, REG_RCR); 94 val_rcr = rtl_read_dword(rtlpriv, REG_RCR);
@@ -336,13 +314,13 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
336 if (acm) { 314 if (acm) {
337 switch (e_aci) { 315 switch (e_aci) {
338 case AC0_BE: 316 case AC0_BE:
339 acm_ctrl |= AcmHw_BeqEn; 317 acm_ctrl |= ACMHW_BEQEN;
340 break; 318 break;
341 case AC2_VI: 319 case AC2_VI:
342 acm_ctrl |= AcmHw_ViqEn; 320 acm_ctrl |= ACMHW_VIQEN;
343 break; 321 break;
344 case AC3_VO: 322 case AC3_VO:
345 acm_ctrl |= AcmHw_VoqEn; 323 acm_ctrl |= ACMHW_VOQEN;
346 break; 324 break;
347 default: 325 default:
348 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 326 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
@@ -353,13 +331,13 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
353 } else { 331 } else {
354 switch (e_aci) { 332 switch (e_aci) {
355 case AC0_BE: 333 case AC0_BE:
356 acm_ctrl &= (~AcmHw_BeqEn); 334 acm_ctrl &= (~ACMHW_BEQEN);
357 break; 335 break;
358 case AC2_VI: 336 case AC2_VI:
359 acm_ctrl &= (~AcmHw_ViqEn); 337 acm_ctrl &= (~ACMHW_VIQEN);
360 break; 338 break;
361 case AC3_VO: 339 case AC3_VO:
362 acm_ctrl &= (~AcmHw_VoqEn); 340 acm_ctrl &= (~ACMHW_VOQEN);
363 break; 341 break;
364 default: 342 default:
365 pr_err("switch case %#x not processed\n", 343 pr_err("switch case %#x not processed\n",
@@ -584,23 +562,23 @@ static bool _rtl92ce_llt_table_init(struct ieee80211_hw *hw)
584 struct rtl_priv *rtlpriv = rtl_priv(hw); 562 struct rtl_priv *rtlpriv = rtl_priv(hw);
585 unsigned short i; 563 unsigned short i;
586 u8 txpktbuf_bndy; 564 u8 txpktbuf_bndy;
587 u8 maxPage; 565 u8 maxpage;
588 bool status; 566 bool status;
589 567
590#if LLT_CONFIG == 1 568#if LLT_CONFIG == 1
591 maxPage = 255; 569 maxpage = 255;
592 txpktbuf_bndy = 252; 570 txpktbuf_bndy = 252;
593#elif LLT_CONFIG == 2 571#elif LLT_CONFIG == 2
594 maxPage = 127; 572 maxpage = 127;
595 txpktbuf_bndy = 124; 573 txpktbuf_bndy = 124;
596#elif LLT_CONFIG == 3 574#elif LLT_CONFIG == 3
597 maxPage = 255; 575 maxpage = 255;
598 txpktbuf_bndy = 174; 576 txpktbuf_bndy = 174;
599#elif LLT_CONFIG == 4 577#elif LLT_CONFIG == 4
600 maxPage = 255; 578 maxpage = 255;
601 txpktbuf_bndy = 246; 579 txpktbuf_bndy = 246;
602#elif LLT_CONFIG == 5 580#elif LLT_CONFIG == 5
603 maxPage = 255; 581 maxpage = 255;
604 txpktbuf_bndy = 246; 582 txpktbuf_bndy = 246;
605#endif 583#endif
606 584
@@ -639,13 +617,13 @@ static bool _rtl92ce_llt_table_init(struct ieee80211_hw *hw)
639 if (true != status) 617 if (true != status)
640 return status; 618 return status;
641 619
642 for (i = txpktbuf_bndy; i < maxPage; i++) { 620 for (i = txpktbuf_bndy; i < maxpage; i++) {
643 status = _rtl92ce_llt_write(hw, i, (i + 1)); 621 status = _rtl92ce_llt_write(hw, i, (i + 1));
644 if (true != status) 622 if (true != status)
645 return status; 623 return status;
646 } 624 }
647 625
648 status = _rtl92ce_llt_write(hw, maxPage, txpktbuf_bndy); 626 status = _rtl92ce_llt_write(hw, maxpage, txpktbuf_bndy);
649 if (true != status) 627 if (true != status)
650 return status; 628 return status;
651 629
@@ -908,11 +886,11 @@ void rtl92ce_enable_hw_security_config(struct ieee80211_hw *hw)
908 return; 886 return;
909 } 887 }
910 888
911 sec_reg_value = SCR_TxEncEnable | SCR_RxDecEnable; 889 sec_reg_value = SCR_TXENCENABLE | SCR_RXDECENABLE;
912 890
913 if (rtlpriv->sec.use_defaultkey) { 891 if (rtlpriv->sec.use_defaultkey) {
914 sec_reg_value |= SCR_TxUseDK; 892 sec_reg_value |= SCR_TXUSEDK;
915 sec_reg_value |= SCR_RxUseDK; 893 sec_reg_value |= SCR_RXUSEDK;
916 } 894 }
917 895
918 sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); 896 sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.h
index 6711ea1a75d9..fa1049d16cb7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/hw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_HW_H__ 4#ifndef __RTL92CE_HW_H__
27#define __RTL92CE_HW_H__ 5#define __RTL92CE_HW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c
index 7edf5af9046e..d6933d36ada2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h
index f6edb9cd9b67..97ab1e00af5f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/led.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_LED_H__ 4#ifndef __RTL92CE_LED_H__
27#define __RTL92CE_LED_H__ 5#define __RTL92CE_LED_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.c
index 7c6d7fc1ef9a..8d18210dd5c8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -104,7 +82,7 @@ bool rtl92c_phy_bb_config(struct ieee80211_hw *hw)
104 rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB); 82 rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB);
105 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 83 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN,
106 FEN_PPLL | FEN_PCIEA | FEN_DIO_PCIE | 84 FEN_PPLL | FEN_PCIEA | FEN_DIO_PCIE |
107 FEN_BB_GLB_RSTn | FEN_BBRSTB); 85 FEN_BB_GLB_RSTN | FEN_BBRSTB);
108 rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80); 86 rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80);
109 regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0); 87 regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0);
110 rtl_write_dword(rtlpriv, REG_LEDCFG0, regvaldw | BIT(23)); 88 rtl_write_dword(rtlpriv, REG_LEDCFG0, regvaldw | BIT(23));
@@ -236,7 +214,7 @@ bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
236 for (i = 0; i < phy_regarray_pg_len; i = i + 3) { 214 for (i = 0; i < phy_regarray_pg_len; i = i + 3) {
237 rtl_addr_delay(phy_regarray_table_pg[i]); 215 rtl_addr_delay(phy_regarray_table_pg[i]);
238 216
239 _rtl92c_store_pwrIndex_diffrate_offset(hw, 217 _rtl92c_store_pwrindex_diffrate_offset(hw,
240 phy_regarray_table_pg[i], 218 phy_regarray_table_pg[i],
241 phy_regarray_table_pg[i + 1], 219 phy_regarray_table_pg[i + 1],
242 phy_regarray_table_pg[i + 2]); 220 phy_regarray_table_pg[i + 2]);
@@ -464,13 +442,13 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
464 if ((ppsc->rfpwr_state == ERFOFF) && 442 if ((ppsc->rfpwr_state == ERFOFF) &&
465 RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { 443 RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) {
466 bool rtstatus; 444 bool rtstatus;
467 u32 InitializeCount = 0; 445 u32 initializecount = 0;
468 do { 446 do {
469 InitializeCount++; 447 initializecount++;
470 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 448 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
471 "IPS Set eRf nic enable\n"); 449 "IPS Set eRf nic enable\n");
472 rtstatus = rtl_ps_enable_nic(hw); 450 rtstatus = rtl_ps_enable_nic(hw);
473 } while (!rtstatus && (InitializeCount < 10)); 451 } while (!rtstatus && (initializecount < 10));
474 RT_CLEAR_PS_LEVEL(ppsc, 452 RT_CLEAR_PS_LEVEL(ppsc,
475 RT_RF_OFF_LEVL_HALT_NIC); 453 RT_RF_OFF_LEVL_HALT_NIC);
476 } else { 454 } else {
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h
index 93f3bc0197b4..7582a162bd11 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/phy.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_PHY_H__ 4#ifndef __RTL92C_PHY_H__
27#define __RTL92C_PHY_H__ 5#define __RTL92C_PHY_H__
@@ -44,9 +22,9 @@
44 22
45#define LOOP_LIMIT 5 23#define LOOP_LIMIT 5
46#define MAX_STALL_TIME 50 24#define MAX_STALL_TIME 50
47#define AntennaDiversityValue 0x80 25#define ANTENNADIVERSITYVALUE 0x80
48#define MAX_TXPWR_IDX_NMODE_92S 63 26#define MAX_TXPWR_IDX_NMODE_92S 63
49#define Reset_Cnt_Limit 3 27#define RESET_CNT_LIMIT 3
50 28
51#define IQK_ADDA_REG_NUM 16 29#define IQK_ADDA_REG_NUM 16
52#define IQK_MAC_REG_NUM 4 30#define IQK_MAC_REG_NUM 4
@@ -122,7 +100,7 @@ void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
122void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, 100void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
123 enum radio_path rfpath, u32 offset, 101 enum radio_path rfpath, u32 offset,
124 u32 data); 102 u32 data);
125void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, 103void _rtl92c_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw,
126 u32 regaddr, u32 bitmask, u32 data); 104 u32 regaddr, u32 bitmask, u32 data);
127bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); 105bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
128void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); 106void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/reg.h
index 9e3b58a5d2bb..431277ef1c98 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/reg.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_REG_H__ 4#ifndef __RTL92C_REG_H__
27#define __RTL92C_REG_H__ 5#define __RTL92C_REG_H__
@@ -702,7 +680,7 @@
702#define PWC_EV12V BIT(15) 680#define PWC_EV12V BIT(15)
703 681
704#define FEN_BBRSTB BIT(0) 682#define FEN_BBRSTB BIT(0)
705#define FEN_BB_GLB_RSTn BIT(1) 683#define FEN_BB_GLB_RSTN BIT(1)
706#define FEN_USBA BIT(2) 684#define FEN_USBA BIT(2)
707#define FEN_UPLL BIT(3) 685#define FEN_UPLL BIT(3)
708#define FEN_USBD BIT(4) 686#define FEN_USBD BIT(4)
@@ -722,7 +700,7 @@
722#define PFM_ALDN BIT(1) 700#define PFM_ALDN BIT(1)
723#define PFM_LDKP BIT(2) 701#define PFM_LDKP BIT(2)
724#define PFM_WOWL BIT(3) 702#define PFM_WOWL BIT(3)
725#define EnPDN BIT(4) 703#define ENPDN BIT(4)
726#define PDN_PL BIT(5) 704#define PDN_PL BIT(5)
727#define APFM_ONMAC BIT(8) 705#define APFM_ONMAC BIT(8)
728#define APFM_OFF BIT(9) 706#define APFM_OFF BIT(9)
@@ -837,19 +815,19 @@
837#define LDOE25_EN BIT(31) 815#define LDOE25_EN BIT(31)
838 816
839#define RSM_EN BIT(0) 817#define RSM_EN BIT(0)
840#define Timer_EN BIT(4) 818#define TIMER_EN BIT(4)
841 819
842#define TRSW0EN BIT(2) 820#define TRSW0EN BIT(2)
843#define TRSW1EN BIT(3) 821#define TRSW1EN BIT(3)
844#define EROM_EN BIT(4) 822#define EROM_EN BIT(4)
845#define EnBT BIT(5) 823#define ENBT BIT(5)
846#define EnUart BIT(8) 824#define ENUART BIT(8)
847#define Uart_910 BIT(9) 825#define UART_910 BIT(9)
848#define EnPMAC BIT(10) 826#define ENPMAC BIT(10)
849#define SIC_SWRST BIT(11) 827#define SIC_SWRST BIT(11)
850#define EnSIC BIT(12) 828#define ENSIC BIT(12)
851#define SIC_23 BIT(13) 829#define SIC_23 BIT(13)
852#define EnHDP BIT(14) 830#define ENHDP BIT(14)
853#define SIC_LBK BIT(15) 831#define SIC_LBK BIT(15)
854 832
855#define LED0PL BIT(4) 833#define LED0PL BIT(4)
@@ -858,7 +836,7 @@
858 836
859#define MCUFWDL_EN BIT(0) 837#define MCUFWDL_EN BIT(0)
860#define MCUFWDL_RDY BIT(1) 838#define MCUFWDL_RDY BIT(1)
861#define FWDL_ChkSum_rpt BIT(2) 839#define FWDL_CHKSUM_RPT BIT(2)
862#define MACINI_RDY BIT(3) 840#define MACINI_RDY BIT(3)
863#define BBINI_RDY BIT(4) 841#define BBINI_RDY BIT(4)
864#define RFINI_RDY BIT(5) 842#define RFINI_RDY BIT(5)
@@ -1076,13 +1054,13 @@
1076#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4) 1054#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4)
1077#define DIS_TSF_UDT0_TEST_CHIP BIT(5) 1055#define DIS_TSF_UDT0_TEST_CHIP BIT(5)
1078 1056
1079#define AcmHw_HwEn BIT(0) 1057#define ACMHW_HWEN BIT(0)
1080#define AcmHw_BeqEn BIT(1) 1058#define ACMHW_BEQEN BIT(1)
1081#define AcmHw_ViqEn BIT(2) 1059#define ACMHW_VIQEN BIT(2)
1082#define AcmHw_VoqEn BIT(3) 1060#define ACMHW_VOQEN BIT(3)
1083#define AcmHw_BeqStatus BIT(4) 1061#define ACMHW_BEQSTATUS BIT(4)
1084#define AcmHw_ViqStatus BIT(5) 1062#define ACMHW_VIQSTATUS BIT(5)
1085#define AcmHw_VoqStatus BIT(6) 1063#define ACMHW_VOQSTATUS BIT(6)
1086 1064
1087#define APSDOFF BIT(6) 1065#define APSDOFF BIT(6)
1088#define APSDOFF_STATUS BIT(7) 1066#define APSDOFF_STATUS BIT(7)
@@ -1121,7 +1099,7 @@
1121#define BM_DATA_EN BIT(17) 1099#define BM_DATA_EN BIT(17)
1122#define MFBEN BIT(22) 1100#define MFBEN BIT(22)
1123#define LSIGEN BIT(23) 1101#define LSIGEN BIT(23)
1124#define EnMBID BIT(24) 1102#define ENMBID BIT(24)
1125#define APP_BASSN BIT(27) 1103#define APP_BASSN BIT(27)
1126#define APP_PHYSTS BIT(28) 1104#define APP_PHYSTS BIT(28)
1127#define APP_ICV BIT(29) 1105#define APP_ICV BIT(29)
@@ -1150,12 +1128,12 @@
1150#define RXERR_RPT_RST BIT(27) 1128#define RXERR_RPT_RST BIT(27)
1151#define _RXERR_RPT_SEL(type) ((type) << 28) 1129#define _RXERR_RPT_SEL(type) ((type) << 28)
1152 1130
1153#define SCR_TxUseDK BIT(0) 1131#define SCR_TXUSEDK BIT(0)
1154#define SCR_RxUseDK BIT(1) 1132#define SCR_RXUSEDK BIT(1)
1155#define SCR_TxEncEnable BIT(2) 1133#define SCR_TXENCENABLE BIT(2)
1156#define SCR_RxDecEnable BIT(3) 1134#define SCR_RXDECENABLE BIT(3)
1157#define SCR_SKByA2 BIT(4) 1135#define SCR_SKBYA2 BIT(4)
1158#define SCR_NoSKMC BIT(5) 1136#define SCR_NOSKMC BIT(5)
1159#define SCR_TXBCUSEDK BIT(6) 1137#define SCR_TXBCUSEDK BIT(6)
1160#define SCR_RXBCUSEDK BIT(7) 1138#define SCR_RXBCUSEDK BIT(7)
1161 1139
@@ -1208,7 +1186,7 @@
1208#define RPMAC_CCKPLCPHEADER 0x144 1186#define RPMAC_CCKPLCPHEADER 0x144
1209#define RPMAC_CCKCRC16 0x148 1187#define RPMAC_CCKCRC16 0x148
1210#define RPMAC_OFDMRXCRC32OK 0x170 1188#define RPMAC_OFDMRXCRC32OK 0x170
1211#define RPMAC_OFDMRXCRC32Er 0x174 1189#define RPMAC_OFDMRXCRC32ER 0x174
1212#define RPMAC_OFDMRXPARITYER 0x178 1190#define RPMAC_OFDMRXPARITYER 0x178
1213#define RPMAC_OFDMRXCRC8ER 0x17c 1191#define RPMAC_OFDMRXCRC8ER 0x17c
1214#define RPMAC_CCKCRXRC16ER 0x180 1192#define RPMAC_CCKCRXRC16ER 0x180
@@ -1246,8 +1224,8 @@
1246#define RFPGA0_XAB_RFINTERFACESW 0x870 1224#define RFPGA0_XAB_RFINTERFACESW 0x870
1247#define RFPGA0_XCD_RFINTERFACESW 0x874 1225#define RFPGA0_XCD_RFINTERFACESW 0x874
1248 1226
1249#define rFPGA0_XAB_RFPARAMETER 0x878 1227#define RFPGA0_XAB_RFPARAMETER 0x878
1250#define rFPGA0_XCD_RFPARAMETER 0x87c 1228#define RFPGA0_XCD_RFPARAMETER 0x87c
1251 1229
1252#define RFPGA0_ANALOGPARAMETER1 0x880 1230#define RFPGA0_ANALOGPARAMETER1 0x880
1253#define RFPGA0_ANALOGPARAMETER2 0x884 1231#define RFPGA0_ANALOGPARAMETER2 0x884
@@ -1521,8 +1499,8 @@
1521#define BCCKTXCRC16 0xffff 1499#define BCCKTXCRC16 0xffff
1522#define BCCKTXSTATUS 0x1 1500#define BCCKTXSTATUS 0x1
1523#define BOFDMTXSTATUS 0x2 1501#define BOFDMTXSTATUS 0x2
1524#define IS_BB_REG_OFFSET_92S(_Offset) \ 1502#define IS_BB_REG_OFFSET_92S(_offset) \
1525 ((_Offset >= 0x800) && (_Offset <= 0xfff)) 1503 (((_offset) >= 0x800) && ((_offset) <= 0xfff))
1526 1504
1527#define BRFMOD 0x1 1505#define BRFMOD 0x1
1528#define BJAPANMODE 0x2 1506#define BJAPANMODE 0x2
@@ -1715,7 +1693,6 @@
1715#define BCCK_RF_EXTEND 0x20000000 1693#define BCCK_RF_EXTEND 0x20000000
1716#define BCCK_RXAGC_SATLEVEL 0x1f000000 1694#define BCCK_RXAGC_SATLEVEL 0x1f000000
1717#define BCCK_RXAGC_SATCOUNT 0xe0 1695#define BCCK_RXAGC_SATCOUNT 0xe0
1718#define bCCKRxRFSettle 0x1f
1719#define BCCK_FIXED_RXAGC 0x8000 1696#define BCCK_FIXED_RXAGC 0x8000
1720#define BCCK_ANTENNA_POLARITY 0x2000 1697#define BCCK_ANTENNA_POLARITY 0x2000
1721#define BCCK_TXFILTER_TYPE 0x0c00 1698#define BCCK_TXFILTER_TYPE 0x0c00
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.c
index e68ed7f37c79..713859488744 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
@@ -150,18 +128,18 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
150 struct rtl_priv *rtlpriv = rtl_priv(hw); 128 struct rtl_priv *rtlpriv = rtl_priv(hw);
151 struct rtl_phy *rtlphy = &(rtlpriv->phy); 129 struct rtl_phy *rtlphy = &(rtlpriv->phy);
152 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 130 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
153 u32 powerBase0, powerBase1; 131 u32 powerbase0, powerbase1;
154 u8 legacy_pwrdiff, ht20_pwrdiff; 132 u8 legacy_pwrdiff, ht20_pwrdiff;
155 u8 i, powerlevel[2]; 133 u8 i, powerlevel[2];
156 134
157 for (i = 0; i < 2; i++) { 135 for (i = 0; i < 2; i++) {
158 powerlevel[i] = ppowerlevel[i]; 136 powerlevel[i] = ppowerlevel[i];
159 legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1]; 137 legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1];
160 powerBase0 = powerlevel[i] + legacy_pwrdiff; 138 powerbase0 = powerlevel[i] + legacy_pwrdiff;
161 139
162 powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) | 140 powerbase0 = (powerbase0 << 24) | (powerbase0 << 16) |
163 (powerBase0 << 8) | powerBase0; 141 (powerbase0 << 8) | powerbase0;
164 *(ofdmbase + i) = powerBase0; 142 *(ofdmbase + i) = powerbase0;
165 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 143 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
166 " [OFDM power base index rf(%c) = 0x%x]\n", 144 " [OFDM power base index rf(%c) = 0x%x]\n",
167 i == 0 ? 'A' : 'B', *(ofdmbase + i)); 145 i == 0 ? 'A' : 'B', *(ofdmbase + i));
@@ -172,11 +150,11 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
172 ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1]; 150 ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1];
173 powerlevel[i] += ht20_pwrdiff; 151 powerlevel[i] += ht20_pwrdiff;
174 } 152 }
175 powerBase1 = powerlevel[i]; 153 powerbase1 = powerlevel[i];
176 powerBase1 = (powerBase1 << 24) | 154 powerbase1 = (powerbase1 << 24) |
177 (powerBase1 << 16) | (powerBase1 << 8) | powerBase1; 155 (powerbase1 << 16) | (powerbase1 << 8) | powerbase1;
178 156
179 *(mcsbase + i) = powerBase1; 157 *(mcsbase + i) = powerbase1;
180 158
181 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 159 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
182 " [MCS power base index rf(%c) = 0x%x]\n", 160 " [MCS power base index rf(%c) = 0x%x]\n",
@@ -186,37 +164,37 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
186 164
187static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw, 165static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
188 u8 channel, u8 index, 166 u8 channel, u8 index,
189 u32 *powerBase0, 167 u32 *powerbase0,
190 u32 *powerBase1, 168 u32 *powerbase1,
191 u32 *p_outwriteval) 169 u32 *p_outwriteval)
192{ 170{
193 struct rtl_priv *rtlpriv = rtl_priv(hw); 171 struct rtl_priv *rtlpriv = rtl_priv(hw);
194 struct rtl_phy *rtlphy = &(rtlpriv->phy); 172 struct rtl_phy *rtlphy = &(rtlpriv->phy);
195 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 173 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
196 u8 i, chnlgroup = 0, pwr_diff_limit[4]; 174 u8 i, chnlgroup = 0, pwr_diff_limit[4];
197 u32 writeVal, customer_limit, rf; 175 u32 writeval, customer_limit, rf;
198 176
199 for (rf = 0; rf < 2; rf++) { 177 for (rf = 0; rf < 2; rf++) {
200 switch (rtlefuse->eeprom_regulatory) { 178 switch (rtlefuse->eeprom_regulatory) {
201 case 0: 179 case 0:
202 chnlgroup = 0; 180 chnlgroup = 0;
203 181
204 writeVal = rtlphy->mcs_offset[chnlgroup][index + 182 writeval = rtlphy->mcs_offset[chnlgroup][index +
205 (rf ? 8 : 0)] 183 (rf ? 8 : 0)]
206 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 184 + ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
207 185
208 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 186 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
209 "RTK better performance, writeVal(%c) = 0x%x\n", 187 "RTK better performance, writeval(%c) = 0x%x\n",
210 rf == 0 ? 'A' : 'B', writeVal); 188 rf == 0 ? 'A' : 'B', writeval);
211 break; 189 break;
212 case 1: 190 case 1:
213 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { 191 if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
214 writeVal = ((index < 2) ? powerBase0[rf] : 192 writeval = ((index < 2) ? powerbase0[rf] :
215 powerBase1[rf]); 193 powerbase1[rf]);
216 194
217 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 195 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
218 "Realtek regulatory, 40MHz, writeVal(%c) = 0x%x\n", 196 "Realtek regulatory, 40MHz, writeval(%c) = 0x%x\n",
219 rf == 0 ? 'A' : 'B', writeVal); 197 rf == 0 ? 'A' : 'B', writeval);
220 } else { 198 } else {
221 if (rtlphy->pwrgroup_cnt == 1) 199 if (rtlphy->pwrgroup_cnt == 1)
222 chnlgroup = 0; 200 chnlgroup = 0;
@@ -231,23 +209,23 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
231 chnlgroup++; 209 chnlgroup++;
232 } 210 }
233 211
234 writeVal = rtlphy->mcs_offset[chnlgroup] 212 writeval = rtlphy->mcs_offset[chnlgroup]
235 [index + (rf ? 8 : 0)] + ((index < 2) ? 213 [index + (rf ? 8 : 0)] + ((index < 2) ?
236 powerBase0[rf] : 214 powerbase0[rf] :
237 powerBase1[rf]); 215 powerbase1[rf]);
238 216
239 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 217 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
240 "Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", 218 "Realtek regulatory, 20MHz, writeval(%c) = 0x%x\n",
241 rf == 0 ? 'A' : 'B', writeVal); 219 rf == 0 ? 'A' : 'B', writeval);
242 } 220 }
243 break; 221 break;
244 case 2: 222 case 2:
245 writeVal = 223 writeval =
246 ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 224 ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
247 225
248 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 226 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
249 "Better regulatory, writeVal(%c) = 0x%x\n", 227 "Better regulatory, writeval(%c) = 0x%x\n",
250 rf == 0 ? 'A' : 'B', writeVal); 228 rf == 0 ? 'A' : 'B', writeval);
251 break; 229 break;
252 case 3: 230 case 3:
253 chnlgroup = 0; 231 chnlgroup = 0;
@@ -297,36 +275,36 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
297 "Customer's limit rf(%c) = 0x%x\n", 275 "Customer's limit rf(%c) = 0x%x\n",
298 rf == 0 ? 'A' : 'B', customer_limit); 276 rf == 0 ? 'A' : 'B', customer_limit);
299 277
300 writeVal = customer_limit + 278 writeval = customer_limit +
301 ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 279 ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
302 280
303 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 281 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
304 "Customer, writeVal rf(%c)= 0x%x\n", 282 "Customer, writeval rf(%c)= 0x%x\n",
305 rf == 0 ? 'A' : 'B', writeVal); 283 rf == 0 ? 'A' : 'B', writeval);
306 break; 284 break;
307 default: 285 default:
308 chnlgroup = 0; 286 chnlgroup = 0;
309 writeVal = rtlphy->mcs_offset[chnlgroup] 287 writeval = rtlphy->mcs_offset[chnlgroup]
310 [index + (rf ? 8 : 0)] 288 [index + (rf ? 8 : 0)]
311 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 289 + ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
312 290
313 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 291 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
314 "RTK better performance, writeVal rf(%c) = 0x%x\n", 292 "RTK better performance, writeval rf(%c) = 0x%x\n",
315 rf == 0 ? 'A' : 'B', writeVal); 293 rf == 0 ? 'A' : 'B', writeval);
316 break; 294 break;
317 } 295 }
318 296
319 if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1) 297 if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1)
320 writeVal = writeVal - 0x06060606; 298 writeval = writeval - 0x06060606;
321 else if (rtlpriv->dm.dynamic_txhighpower_lvl == 299 else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
322 TXHIGHPWRLEVEL_BT2) 300 TXHIGHPWRLEVEL_BT2)
323 writeVal = writeVal - 0x0c0c0c0c; 301 writeval = writeval - 0x0c0c0c0c;
324 *(p_outwriteval + rf) = writeVal; 302 *(p_outwriteval + rf) = writeval;
325 } 303 }
326} 304}
327 305
328static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw, 306static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
329 u8 index, u32 *pValue) 307 u8 index, u32 *value)
330{ 308{
331 struct rtl_priv *rtlpriv = rtl_priv(hw); 309 struct rtl_priv *rtlpriv = rtl_priv(hw);
332 struct rtl_phy *rtlphy = &(rtlpriv->phy); 310 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -342,29 +320,29 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
342 RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12 320 RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12
343 }; 321 };
344 u8 i, rf, pwr_val[4]; 322 u8 i, rf, pwr_val[4];
345 u32 writeVal; 323 u32 writeval;
346 u16 regoffset; 324 u16 regoffset;
347 325
348 for (rf = 0; rf < 2; rf++) { 326 for (rf = 0; rf < 2; rf++) {
349 writeVal = pValue[rf]; 327 writeval = value[rf];
350 for (i = 0; i < 4; i++) { 328 for (i = 0; i < 4; i++) {
351 pwr_val[i] = (u8) ((writeVal & (0x7f << 329 pwr_val[i] = (u8)((writeval & (0x7f <<
352 (i * 8))) >> (i * 8)); 330 (i * 8))) >> (i * 8));
353 331
354 if (pwr_val[i] > RF6052_MAX_TX_PWR) 332 if (pwr_val[i] > RF6052_MAX_TX_PWR)
355 pwr_val[i] = RF6052_MAX_TX_PWR; 333 pwr_val[i] = RF6052_MAX_TX_PWR;
356 } 334 }
357 writeVal = (pwr_val[3] << 24) | (pwr_val[2] << 16) | 335 writeval = (pwr_val[3] << 24) | (pwr_val[2] << 16) |
358 (pwr_val[1] << 8) | pwr_val[0]; 336 (pwr_val[1] << 8) | pwr_val[0];
359 337
360 if (rf == 0) 338 if (rf == 0)
361 regoffset = regoffset_a[index]; 339 regoffset = regoffset_a[index];
362 else 340 else
363 regoffset = regoffset_b[index]; 341 regoffset = regoffset_b[index];
364 rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal); 342 rtl_set_bbreg(hw, regoffset, MASKDWORD, writeval);
365 343
366 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 344 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
367 "Set 0x%x = %08x\n", regoffset, writeVal); 345 "Set 0x%x = %08x\n", regoffset, writeval);
368 346
369 if (((get_rf_type(rtlphy) == RF_2T2R) && 347 if (((get_rf_type(rtlphy) == RF_2T2R) &&
370 (regoffset == RTXAGC_A_MCS15_MCS12 || 348 (regoffset == RTXAGC_A_MCS15_MCS12 ||
@@ -373,7 +351,7 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
373 (regoffset == RTXAGC_A_MCS07_MCS04 || 351 (regoffset == RTXAGC_A_MCS07_MCS04 ||
374 regoffset == RTXAGC_B_MCS07_MCS04))) { 352 regoffset == RTXAGC_B_MCS07_MCS04))) {
375 353
376 writeVal = pwr_val[3]; 354 writeval = pwr_val[3];
377 if (regoffset == RTXAGC_A_MCS15_MCS12 || 355 if (regoffset == RTXAGC_A_MCS15_MCS12 ||
378 regoffset == RTXAGC_A_MCS07_MCS04) 356 regoffset == RTXAGC_A_MCS07_MCS04)
379 regoffset = 0xc90; 357 regoffset = 0xc90;
@@ -382,9 +360,9 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
382 regoffset = 0xc98; 360 regoffset = 0xc98;
383 361
384 for (i = 0; i < 3; i++) { 362 for (i = 0; i < 3; i++) {
385 writeVal = (writeVal > 6) ? (writeVal - 6) : 0; 363 writeval = (writeval > 6) ? (writeval - 6) : 0;
386 rtl_write_byte(rtlpriv, (u32) (regoffset + i), 364 rtl_write_byte(rtlpriv, (u32) (regoffset + i),
387 (u8) writeVal); 365 (u8)writeval);
388 } 366 }
389 } 367 }
390 } 368 }
@@ -393,20 +371,20 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
393void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 371void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
394 u8 *ppowerlevel, u8 channel) 372 u8 *ppowerlevel, u8 channel)
395{ 373{
396 u32 writeVal[2], powerBase0[2], powerBase1[2]; 374 u32 writeval[2], powerbase0[2], powerbase1[2];
397 u8 index; 375 u8 index;
398 376
399 rtl92c_phy_get_power_base(hw, ppowerlevel, 377 rtl92c_phy_get_power_base(hw, ppowerlevel,
400 channel, &powerBase0[0], &powerBase1[0]); 378 channel, &powerbase0[0], &powerbase1[0]);
401 379
402 for (index = 0; index < 6; index++) { 380 for (index = 0; index < 6; index++) {
403 _rtl92c_get_txpower_writeval_by_regulatory(hw, 381 _rtl92c_get_txpower_writeval_by_regulatory(hw,
404 channel, index, 382 channel, index,
405 &powerBase0[0], 383 &powerbase0[0],
406 &powerBase1[0], 384 &powerbase1[0],
407 &writeVal[0]); 385 &writeval[0]);
408 386
409 _rtl92c_write_ofdm_power_reg(hw, index, &writeVal[0]); 387 _rtl92c_write_ofdm_power_reg(hw, index, &writeval[0]);
410 } 388 }
411} 389}
412 390
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.h
index 22c5e6f51331..6fa70224d2d4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rf.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_RF_H__ 4#ifndef __RTL92C_RF_H__
27#define __RTL92C_RF_H__ 5#define __RTL92C_RF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
index 71a6761d3648..a9c0111444bc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.h
index 9a1c89cbbda1..f2d121a60159 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_SW_H__ 4#ifndef __RTL92CE_SW_H__
27#define __RTL92CE_SW_H__ 5#define __RTL92CE_SW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.c
index 98b06d48a2dd..e258b0803699 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.c
@@ -1,29 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#include "table.h" 4#include "table.h"
29 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.h
index 51e4e07396a6..473af27f80d9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/table.h
@@ -1,29 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#ifndef __RTL92CE_TABLE__H_ 4#ifndef __RTL92CE_TABLE__H_
29#define __RTL92CE_TABLE__H_ 5#define __RTL92CE_TABLE__H_
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
index d36e0060cc7a..b08fb1bf6709 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -354,7 +332,7 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
354 stats->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) 332 stats->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1)
355 && (GET_RX_DESC_FAGGR(pdesc) == 1)); 333 && (GET_RX_DESC_FAGGR(pdesc) == 1));
356 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); 334 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
357 stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); 335 stats->rx_is40mhzpacket = (bool)GET_RX_DESC_BW(pdesc);
358 stats->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); 336 stats->is_ht = (bool)GET_RX_DESC_RXHT(pdesc);
359 337
360 stats->is_cck = RX_HAL_IS_CCK_RATE(pdesc->rxmcs); 338 stats->is_cck = RX_HAL_IS_CCK_RATE(pdesc->rxmcs);
@@ -368,7 +346,7 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
368 if (stats->crc) 346 if (stats->crc)
369 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 347 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
370 348
371 if (stats->rx_is40Mhzpacket) 349 if (stats->rx_is40mhzpacket)
372 rx_status->bw = RATE_INFO_BW_40; 350 rx_status->bw = RATE_INFO_BW_40;
373 351
374 if (stats->is_ht) 352 if (stats->is_ht)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h
index 91f0bd6b752f..fb1d4444a52f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_TRX_H__ 4#ifndef __RTL92CE_TRX_H__
27#define __RTL92CE_TRX_H__ 5#define __RTL92CE_TRX_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h
index 316fe9990b6d..91e4427ab022 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/def.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../rtl8192ce/def.h" 4#include "../rtl8192ce/def.h"
27 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.c
index 00fc0685317a..9d1167ff3b50 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.h
index ce71433792e3..2befc2f4e3fd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../rtl8192ce/dm.h" 4#include "../rtl8192ce/dm.h"
27 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
index 1e60f70481f5..52ee713d50f5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
@@ -53,9 +31,9 @@ static void _rtl92cu_phy_param_tab_init(struct ieee80211_hw *hw)
53 rtlphy->hwparam_tables[MAC_REG].pdata = RTL8192CUMAC_2T_ARRAY; 31 rtlphy->hwparam_tables[MAC_REG].pdata = RTL8192CUMAC_2T_ARRAY;
54 if (IS_HIGHT_PA(rtlefuse->board_type)) { 32 if (IS_HIGHT_PA(rtlefuse->board_type)) {
55 rtlphy->hwparam_tables[PHY_REG_PG].length = 33 rtlphy->hwparam_tables[PHY_REG_PG].length =
56 RTL8192CUPHY_REG_Array_PG_HPLength; 34 RTL8192CUPHY_REG_ARRAY_PG_HPLENGTH;
57 rtlphy->hwparam_tables[PHY_REG_PG].pdata = 35 rtlphy->hwparam_tables[PHY_REG_PG].pdata =
58 RTL8192CUPHY_REG_Array_PG_HP; 36 RTL8192CUPHY_REG_ARRAY_PG_HP;
59 } else { 37 } else {
60 rtlphy->hwparam_tables[PHY_REG_PG].length = 38 rtlphy->hwparam_tables[PHY_REG_PG].length =
61 RTL8192CUPHY_REG_ARRAY_PGLENGTH; 39 RTL8192CUPHY_REG_ARRAY_PGLENGTH;
@@ -82,21 +60,21 @@ static void _rtl92cu_phy_param_tab_init(struct ieee80211_hw *hw)
82 /* 1T */ 60 /* 1T */
83 if (IS_HIGHT_PA(rtlefuse->board_type)) { 61 if (IS_HIGHT_PA(rtlefuse->board_type)) {
84 rtlphy->hwparam_tables[PHY_REG_1T].length = 62 rtlphy->hwparam_tables[PHY_REG_1T].length =
85 RTL8192CUPHY_REG_1T_HPArrayLength; 63 RTL8192CUPHY_REG_1T_HPARRAYLENGTH;
86 rtlphy->hwparam_tables[PHY_REG_1T].pdata = 64 rtlphy->hwparam_tables[PHY_REG_1T].pdata =
87 RTL8192CUPHY_REG_1T_HPArray; 65 RTL8192CUPHY_REG_1T_HPARRAY;
88 rtlphy->hwparam_tables[RADIOA_1T].length = 66 rtlphy->hwparam_tables[RADIOA_1T].length =
89 RTL8192CURadioA_1T_HPArrayLength; 67 RTL8192CURADIOA_1T_HPARRAYLENGTH;
90 rtlphy->hwparam_tables[RADIOA_1T].pdata = 68 rtlphy->hwparam_tables[RADIOA_1T].pdata =
91 RTL8192CURadioA_1T_HPArray; 69 RTL8192CURADIOA_1T_HPARRAY;
92 rtlphy->hwparam_tables[RADIOB_1T].length = 70 rtlphy->hwparam_tables[RADIOB_1T].length =
93 RTL8192CURADIOB_1TARRAYLENGTH; 71 RTL8192CURADIOB_1TARRAYLENGTH;
94 rtlphy->hwparam_tables[RADIOB_1T].pdata = 72 rtlphy->hwparam_tables[RADIOB_1T].pdata =
95 RTL8192CU_RADIOB_1TARRAY; 73 RTL8192CU_RADIOB_1TARRAY;
96 rtlphy->hwparam_tables[AGCTAB_1T].length = 74 rtlphy->hwparam_tables[AGCTAB_1T].length =
97 RTL8192CUAGCTAB_1T_HPArrayLength; 75 RTL8192CUAGCTAB_1T_HPARRAYLENGTH;
98 rtlphy->hwparam_tables[AGCTAB_1T].pdata = 76 rtlphy->hwparam_tables[AGCTAB_1T].pdata =
99 Rtl8192CUAGCTAB_1T_HPArray; 77 RTL8192CUAGCTAB_1T_HPARRAY;
100 } else { 78 } else {
101 rtlphy->hwparam_tables[PHY_REG_1T].length = 79 rtlphy->hwparam_tables[PHY_REG_1T].length =
102 RTL8192CUPHY_REG_1TARRAY_LENGTH; 80 RTL8192CUPHY_REG_1TARRAY_LENGTH;
@@ -323,16 +301,16 @@ static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents)
323{ 301{
324 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 302 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
325 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 303 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
326 u8 boardType; 304 u8 boardtype;
327 305
328 if (IS_NORMAL_CHIP(rtlhal->version)) { 306 if (IS_NORMAL_CHIP(rtlhal->version)) {
329 boardType = ((contents[EEPROM_RF_OPT1]) & 307 boardtype = ((contents[EEPROM_RF_OPT1]) &
330 BOARD_TYPE_NORMAL_MASK) >> 5; /*bit[7:5]*/ 308 BOARD_TYPE_NORMAL_MASK) >> 5; /*bit[7:5]*/
331 } else { 309 } else {
332 boardType = contents[EEPROM_RF_OPT4]; 310 boardtype = contents[EEPROM_RF_OPT4];
333 boardType &= BOARD_TYPE_TEST_MASK; 311 boardtype &= BOARD_TYPE_TEST_MASK;
334 } 312 }
335 rtlefuse->board_type = boardType; 313 rtlefuse->board_type = boardtype;
336 if (IS_HIGHT_PA(rtlefuse->board_type)) 314 if (IS_HIGHT_PA(rtlefuse->board_type))
337 rtlefuse->external_pa = 1; 315 rtlefuse->external_pa = 1;
338 pr_info("Board Type %x\n", rtlefuse->board_type); 316 pr_info("Board Type %x\n", rtlefuse->board_type);
@@ -442,7 +420,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
442 u16 value16; 420 u16 value16;
443 u8 value8; 421 u8 value8;
444 /* polling autoload done. */ 422 /* polling autoload done. */
445 u32 pollingCount = 0; 423 u32 pollingcount = 0;
446 424
447 do { 425 do {
448 if (rtl_read_byte(rtlpriv, REG_APS_FSMCO) & PFM_ALDN) { 426 if (rtl_read_byte(rtlpriv, REG_APS_FSMCO) & PFM_ALDN) {
@@ -450,7 +428,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
450 "Autoload Done!\n"); 428 "Autoload Done!\n");
451 break; 429 break;
452 } 430 }
453 if (pollingCount++ > 100) { 431 if (pollingcount++ > 100) {
454 pr_err("Failed to polling REG_APS_FSMCO[PFM_ALDN] done!\n"); 432 pr_err("Failed to polling REG_APS_FSMCO[PFM_ALDN] done!\n");
455 return -ENODEV; 433 return -ENODEV;
456 } 434 }
@@ -474,7 +452,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
474 rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL, value8); 452 rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL, value8);
475 } 453 }
476 /* auto enable WLAN */ 454 /* auto enable WLAN */
477 pollingCount = 0; 455 pollingcount = 0;
478 value16 = rtl_read_word(rtlpriv, REG_APS_FSMCO); 456 value16 = rtl_read_word(rtlpriv, REG_APS_FSMCO);
479 value16 |= APFM_ONMAC; 457 value16 |= APFM_ONMAC;
480 rtl_write_word(rtlpriv, REG_APS_FSMCO, value16); 458 rtl_write_word(rtlpriv, REG_APS_FSMCO, value16);
@@ -483,7 +461,7 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
483 pr_info("MAC auto ON okay!\n"); 461 pr_info("MAC auto ON okay!\n");
484 break; 462 break;
485 } 463 }
486 if (pollingCount++ > 1000) { 464 if (pollingcount++ > 1000) {
487 pr_err("Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n"); 465 pr_err("Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n");
488 return -ENODEV; 466 return -ENODEV;
489 } 467 }
@@ -495,12 +473,12 @@ static int _rtl92cu_init_power_on(struct ieee80211_hw *hw)
495 value16 &= ~ISO_DIOR; 473 value16 &= ~ISO_DIOR;
496 rtl_write_word(rtlpriv, REG_SYS_ISO_CTRL, value16); 474 rtl_write_word(rtlpriv, REG_SYS_ISO_CTRL, value16);
497 /* Reconsider when to do this operation after asking HWSD. */ 475 /* Reconsider when to do this operation after asking HWSD. */
498 pollingCount = 0; 476 pollingcount = 0;
499 rtl_write_byte(rtlpriv, REG_APSD_CTRL, (rtl_read_byte(rtlpriv, 477 rtl_write_byte(rtlpriv, REG_APSD_CTRL, (rtl_read_byte(rtlpriv,
500 REG_APSD_CTRL) & ~BIT(6))); 478 REG_APSD_CTRL) & ~BIT(6)));
501 do { 479 do {
502 pollingCount++; 480 pollingcount++;
503 } while ((pollingCount < 200) && 481 } while ((pollingcount < 200) &&
504 (rtl_read_byte(rtlpriv, REG_APSD_CTRL) & BIT(7))); 482 (rtl_read_byte(rtlpriv, REG_APSD_CTRL) & BIT(7)));
505 /* Enable MAC DMA/WMAC/SCHEDULE/SEC block */ 483 /* Enable MAC DMA/WMAC/SCHEDULE/SEC block */
506 value16 = rtl_read_word(rtlpriv, REG_CR); 484 value16 = rtl_read_word(rtlpriv, REG_CR);
@@ -517,60 +495,60 @@ static void _rtl92cu_init_queue_reserved_page(struct ieee80211_hw *hw,
517{ 495{
518 struct rtl_priv *rtlpriv = rtl_priv(hw); 496 struct rtl_priv *rtlpriv = rtl_priv(hw);
519 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 497 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
520 bool isChipN = IS_NORMAL_CHIP(rtlhal->version); 498 bool ischipn = IS_NORMAL_CHIP(rtlhal->version);
521 u32 outEPNum = (u32)out_ep_num; 499 u32 outepnum = (u32)out_ep_num;
522 u32 numHQ = 0; 500 u32 numhq = 0;
523 u32 numLQ = 0; 501 u32 numlq = 0;
524 u32 numNQ = 0; 502 u32 numnq = 0;
525 u32 numPubQ; 503 u32 numpubq;
526 u32 value32; 504 u32 value32;
527 u8 value8; 505 u8 value8;
528 u32 txQPageNum, txQPageUnit, txQRemainPage; 506 u32 txqpagenum, txqpageunit, txqremaininpage;
529 507
530 if (!wmm_enable) { 508 if (!wmm_enable) {
531 numPubQ = (isChipN) ? CHIP_B_PAGE_NUM_PUBQ : 509 numpubq = (ischipn) ? CHIP_B_PAGE_NUM_PUBQ :
532 CHIP_A_PAGE_NUM_PUBQ; 510 CHIP_A_PAGE_NUM_PUBQ;
533 txQPageNum = TX_TOTAL_PAGE_NUMBER - numPubQ; 511 txqpagenum = TX_TOTAL_PAGE_NUMBER - numpubq;
534 512
535 txQPageUnit = txQPageNum/outEPNum; 513 txqpageunit = txqpagenum / outepnum;
536 txQRemainPage = txQPageNum % outEPNum; 514 txqremaininpage = txqpagenum % outepnum;
537 if (queue_sel & TX_SELE_HQ) 515 if (queue_sel & TX_SELE_HQ)
538 numHQ = txQPageUnit; 516 numhq = txqpageunit;
539 if (queue_sel & TX_SELE_LQ) 517 if (queue_sel & TX_SELE_LQ)
540 numLQ = txQPageUnit; 518 numlq = txqpageunit;
541 /* HIGH priority queue always present in the configuration of 519 /* HIGH priority queue always present in the configuration of
542 * 2 out-ep. Remainder pages have assigned to High queue */ 520 * 2 out-ep. Remainder pages have assigned to High queue */
543 if ((outEPNum > 1) && (txQRemainPage)) 521 if (outepnum > 1 && txqremaininpage)
544 numHQ += txQRemainPage; 522 numhq += txqremaininpage;
545 /* NOTE: This step done before writting REG_RQPN. */ 523 /* NOTE: This step done before writting REG_RQPN. */
546 if (isChipN) { 524 if (ischipn) {
547 if (queue_sel & TX_SELE_NQ) 525 if (queue_sel & TX_SELE_NQ)
548 numNQ = txQPageUnit; 526 numnq = txqpageunit;
549 value8 = (u8)_NPQ(numNQ); 527 value8 = (u8)_NPQ(numnq);
550 rtl_write_byte(rtlpriv, REG_RQPN_NPQ, value8); 528 rtl_write_byte(rtlpriv, REG_RQPN_NPQ, value8);
551 } 529 }
552 } else { 530 } else {
553 /* for WMM ,number of out-ep must more than or equal to 2! */ 531 /* for WMM ,number of out-ep must more than or equal to 2! */
554 numPubQ = isChipN ? WMM_CHIP_B_PAGE_NUM_PUBQ : 532 numpubq = ischipn ? WMM_CHIP_B_PAGE_NUM_PUBQ :
555 WMM_CHIP_A_PAGE_NUM_PUBQ; 533 WMM_CHIP_A_PAGE_NUM_PUBQ;
556 if (queue_sel & TX_SELE_HQ) { 534 if (queue_sel & TX_SELE_HQ) {
557 numHQ = isChipN ? WMM_CHIP_B_PAGE_NUM_HPQ : 535 numhq = ischipn ? WMM_CHIP_B_PAGE_NUM_HPQ :
558 WMM_CHIP_A_PAGE_NUM_HPQ; 536 WMM_CHIP_A_PAGE_NUM_HPQ;
559 } 537 }
560 if (queue_sel & TX_SELE_LQ) { 538 if (queue_sel & TX_SELE_LQ) {
561 numLQ = isChipN ? WMM_CHIP_B_PAGE_NUM_LPQ : 539 numlq = ischipn ? WMM_CHIP_B_PAGE_NUM_LPQ :
562 WMM_CHIP_A_PAGE_NUM_LPQ; 540 WMM_CHIP_A_PAGE_NUM_LPQ;
563 } 541 }
564 /* NOTE: This step done before writting REG_RQPN. */ 542 /* NOTE: This step done before writting REG_RQPN. */
565 if (isChipN) { 543 if (ischipn) {
566 if (queue_sel & TX_SELE_NQ) 544 if (queue_sel & TX_SELE_NQ)
567 numNQ = WMM_CHIP_B_PAGE_NUM_NPQ; 545 numnq = WMM_CHIP_B_PAGE_NUM_NPQ;
568 value8 = (u8)_NPQ(numNQ); 546 value8 = (u8)_NPQ(numnq);
569 rtl_write_byte(rtlpriv, REG_RQPN_NPQ, value8); 547 rtl_write_byte(rtlpriv, REG_RQPN_NPQ, value8);
570 } 548 }
571 } 549 }
572 /* TX DMA */ 550 /* TX DMA */
573 value32 = _HPQ(numHQ) | _LPQ(numLQ) | _PUBQ(numPubQ) | LD_RQPN; 551 value32 = _HPQ(numhq) | _LPQ(numlq) | _PUBQ(numpubq) | LD_RQPN;
574 rtl_write_dword(rtlpriv, REG_RQPN, value32); 552 rtl_write_dword(rtlpriv, REG_RQPN, value32);
575} 553}
576 554
@@ -597,20 +575,20 @@ static void _rtl92c_init_trx_buffer(struct ieee80211_hw *hw, bool wmm_enable)
597 rtl_write_byte(rtlpriv, REG_PBP, value8); 575 rtl_write_byte(rtlpriv, REG_PBP, value8);
598} 576}
599 577
600static void _rtl92c_init_chipN_reg_priority(struct ieee80211_hw *hw, u16 beQ, 578static void _rtl92c_init_chipn_reg_priority(struct ieee80211_hw *hw, u16 beq,
601 u16 bkQ, u16 viQ, u16 voQ, 579 u16 bkq, u16 viq, u16 voq,
602 u16 mgtQ, u16 hiQ) 580 u16 mgtq, u16 hiq)
603{ 581{
604 struct rtl_priv *rtlpriv = rtl_priv(hw); 582 struct rtl_priv *rtlpriv = rtl_priv(hw);
605 u16 value16 = (rtl_read_word(rtlpriv, REG_TRXDMA_CTRL) & 0x7); 583 u16 value16 = (rtl_read_word(rtlpriv, REG_TRXDMA_CTRL) & 0x7);
606 584
607 value16 |= _TXDMA_BEQ_MAP(beQ) | _TXDMA_BKQ_MAP(bkQ) | 585 value16 |= _TXDMA_BEQ_MAP(beq) | _TXDMA_BKQ_MAP(bkq) |
608 _TXDMA_VIQ_MAP(viQ) | _TXDMA_VOQ_MAP(voQ) | 586 _TXDMA_VIQ_MAP(viq) | _TXDMA_VOQ_MAP(voq) |
609 _TXDMA_MGQ_MAP(mgtQ) | _TXDMA_HIQ_MAP(hiQ); 587 _TXDMA_MGQ_MAP(mgtq) | _TXDMA_HIQ_MAP(hiq);
610 rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, value16); 588 rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, value16);
611} 589}
612 590
613static void _rtl92cu_init_chipN_one_out_ep_priority(struct ieee80211_hw *hw, 591static void _rtl92cu_init_chipn_one_out_ep_priority(struct ieee80211_hw *hw,
614 bool wmm_enable, 592 bool wmm_enable,
615 u8 queue_sel) 593 u8 queue_sel)
616{ 594{
@@ -630,96 +608,96 @@ static void _rtl92cu_init_chipN_one_out_ep_priority(struct ieee80211_hw *hw,
630 WARN_ON(1); /* Shall not reach here! */ 608 WARN_ON(1); /* Shall not reach here! */
631 break; 609 break;
632 } 610 }
633 _rtl92c_init_chipN_reg_priority(hw, value, value, value, value, 611 _rtl92c_init_chipn_reg_priority(hw, value, value, value, value,
634 value, value); 612 value, value);
635 pr_info("Tx queue select: 0x%02x\n", queue_sel); 613 pr_info("Tx queue select: 0x%02x\n", queue_sel);
636} 614}
637 615
638static void _rtl92cu_init_chipN_two_out_ep_priority(struct ieee80211_hw *hw, 616static void _rtl92cu_init_chipn_two_out_ep_priority(struct ieee80211_hw *hw,
639 bool wmm_enable, 617 bool wmm_enable,
640 u8 queue_sel) 618 u8 queue_sel)
641{ 619{
642 u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; 620 u16 beq, bkq, viq, voq, mgtq, hiq;
643 u16 uninitialized_var(valueHi); 621 u16 uninitialized_var(valuehi);
644 u16 uninitialized_var(valueLow); 622 u16 uninitialized_var(valuelow);
645 623
646 switch (queue_sel) { 624 switch (queue_sel) {
647 case (TX_SELE_HQ | TX_SELE_LQ): 625 case (TX_SELE_HQ | TX_SELE_LQ):
648 valueHi = QUEUE_HIGH; 626 valuehi = QUEUE_HIGH;
649 valueLow = QUEUE_LOW; 627 valuelow = QUEUE_LOW;
650 break; 628 break;
651 case (TX_SELE_NQ | TX_SELE_LQ): 629 case (TX_SELE_NQ | TX_SELE_LQ):
652 valueHi = QUEUE_NORMAL; 630 valuehi = QUEUE_NORMAL;
653 valueLow = QUEUE_LOW; 631 valuelow = QUEUE_LOW;
654 break; 632 break;
655 case (TX_SELE_HQ | TX_SELE_NQ): 633 case (TX_SELE_HQ | TX_SELE_NQ):
656 valueHi = QUEUE_HIGH; 634 valuehi = QUEUE_HIGH;
657 valueLow = QUEUE_NORMAL; 635 valuelow = QUEUE_NORMAL;
658 break; 636 break;
659 default: 637 default:
660 WARN_ON(1); 638 WARN_ON(1);
661 break; 639 break;
662 } 640 }
663 if (!wmm_enable) { 641 if (!wmm_enable) {
664 beQ = valueLow; 642 beq = valuelow;
665 bkQ = valueLow; 643 bkq = valuelow;
666 viQ = valueHi; 644 viq = valuehi;
667 voQ = valueHi; 645 voq = valuehi;
668 mgtQ = valueHi; 646 mgtq = valuehi;
669 hiQ = valueHi; 647 hiq = valuehi;
670 } else {/* for WMM ,CONFIG_OUT_EP_WIFI_MODE */ 648 } else {/* for WMM ,CONFIG_OUT_EP_WIFI_MODE */
671 beQ = valueHi; 649 beq = valuehi;
672 bkQ = valueLow; 650 bkq = valuelow;
673 viQ = valueLow; 651 viq = valuelow;
674 voQ = valueHi; 652 voq = valuehi;
675 mgtQ = valueHi; 653 mgtq = valuehi;
676 hiQ = valueHi; 654 hiq = valuehi;
677 } 655 }
678 _rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ); 656 _rtl92c_init_chipn_reg_priority(hw, beq, bkq, viq, voq, mgtq, hiq);
679 pr_info("Tx queue select: 0x%02x\n", queue_sel); 657 pr_info("Tx queue select: 0x%02x\n", queue_sel);
680} 658}
681 659
682static void _rtl92cu_init_chipN_three_out_ep_priority(struct ieee80211_hw *hw, 660static void _rtl92cu_init_chipn_three_out_ep_priority(struct ieee80211_hw *hw,
683 bool wmm_enable, 661 bool wmm_enable,
684 u8 queue_sel) 662 u8 queue_sel)
685{ 663{
686 u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; 664 u16 beq, bkq, viq, voq, mgtq, hiq;
687 665
688 if (!wmm_enable) { /* typical setting */ 666 if (!wmm_enable) { /* typical setting */
689 beQ = QUEUE_LOW; 667 beq = QUEUE_LOW;
690 bkQ = QUEUE_LOW; 668 bkq = QUEUE_LOW;
691 viQ = QUEUE_NORMAL; 669 viq = QUEUE_NORMAL;
692 voQ = QUEUE_HIGH; 670 voq = QUEUE_HIGH;
693 mgtQ = QUEUE_HIGH; 671 mgtq = QUEUE_HIGH;
694 hiQ = QUEUE_HIGH; 672 hiq = QUEUE_HIGH;
695 } else { /* for WMM */ 673 } else { /* for WMM */
696 beQ = QUEUE_LOW; 674 beq = QUEUE_LOW;
697 bkQ = QUEUE_NORMAL; 675 bkq = QUEUE_NORMAL;
698 viQ = QUEUE_NORMAL; 676 viq = QUEUE_NORMAL;
699 voQ = QUEUE_HIGH; 677 voq = QUEUE_HIGH;
700 mgtQ = QUEUE_HIGH; 678 mgtq = QUEUE_HIGH;
701 hiQ = QUEUE_HIGH; 679 hiq = QUEUE_HIGH;
702 } 680 }
703 _rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ); 681 _rtl92c_init_chipn_reg_priority(hw, beq, bkq, viq, voq, mgtq, hiq);
704 pr_info("Tx queue select :0x%02x..\n", queue_sel); 682 pr_info("Tx queue select :0x%02x..\n", queue_sel);
705} 683}
706 684
707static void _rtl92cu_init_chipN_queue_priority(struct ieee80211_hw *hw, 685static void _rtl92cu_init_chipn_queue_priority(struct ieee80211_hw *hw,
708 bool wmm_enable, 686 bool wmm_enable,
709 u8 out_ep_num, 687 u8 out_ep_num,
710 u8 queue_sel) 688 u8 queue_sel)
711{ 689{
712 switch (out_ep_num) { 690 switch (out_ep_num) {
713 case 1: 691 case 1:
714 _rtl92cu_init_chipN_one_out_ep_priority(hw, wmm_enable, 692 _rtl92cu_init_chipn_one_out_ep_priority(hw, wmm_enable,
715 queue_sel); 693 queue_sel);
716 break; 694 break;
717 case 2: 695 case 2:
718 _rtl92cu_init_chipN_two_out_ep_priority(hw, wmm_enable, 696 _rtl92cu_init_chipn_two_out_ep_priority(hw, wmm_enable,
719 queue_sel); 697 queue_sel);
720 break; 698 break;
721 case 3: 699 case 3:
722 _rtl92cu_init_chipN_three_out_ep_priority(hw, wmm_enable, 700 _rtl92cu_init_chipn_three_out_ep_priority(hw, wmm_enable,
723 queue_sel); 701 queue_sel);
724 break; 702 break;
725 default: 703 default:
@@ -728,7 +706,7 @@ static void _rtl92cu_init_chipN_queue_priority(struct ieee80211_hw *hw,
728 } 706 }
729} 707}
730 708
731static void _rtl92cu_init_chipT_queue_priority(struct ieee80211_hw *hw, 709static void _rtl92cu_init_chipt_queue_priority(struct ieee80211_hw *hw,
732 bool wmm_enable, 710 bool wmm_enable,
733 u8 out_ep_num, 711 u8 out_ep_num,
734 u8 queue_sel) 712 u8 queue_sel)
@@ -770,10 +748,10 @@ static void _rtl92cu_init_queue_priority(struct ieee80211_hw *hw,
770{ 748{
771 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 749 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
772 if (IS_NORMAL_CHIP(rtlhal->version)) 750 if (IS_NORMAL_CHIP(rtlhal->version))
773 _rtl92cu_init_chipN_queue_priority(hw, wmm_enable, out_ep_num, 751 _rtl92cu_init_chipn_queue_priority(hw, wmm_enable, out_ep_num,
774 queue_sel); 752 queue_sel);
775 else 753 else
776 _rtl92cu_init_chipT_queue_priority(hw, wmm_enable, out_ep_num, 754 _rtl92cu_init_chipt_queue_priority(hw, wmm_enable, out_ep_num,
777 queue_sel); 755 queue_sel);
778} 756}
779 757
@@ -889,10 +867,10 @@ void rtl92cu_enable_hw_security_config(struct ieee80211_hw *hw)
889 "not open sw encryption\n"); 867 "not open sw encryption\n");
890 return; 868 return;
891 } 869 }
892 sec_reg_value = SCR_TxEncEnable | SCR_RxDecEnable; 870 sec_reg_value = SCR_TXENCENABLE | SCR_RXDECENABLE;
893 if (rtlpriv->sec.use_defaultkey) { 871 if (rtlpriv->sec.use_defaultkey) {
894 sec_reg_value |= SCR_TxUseDK; 872 sec_reg_value |= SCR_TXUSEDK;
895 sec_reg_value |= SCR_RxUseDK; 873 sec_reg_value |= SCR_RXUSEDK;
896 } 874 }
897 if (IS_NORMAL_CHIP(rtlhal->version)) 875 if (IS_NORMAL_CHIP(rtlhal->version))
898 sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); 876 sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK);
@@ -921,7 +899,7 @@ static void _rtl92cu_hw_configure(struct ieee80211_hw *hw)
921 rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8)rtlusb->reg_bcn_ctrl_val); 899 rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8)rtlusb->reg_bcn_ctrl_val);
922} 900}
923 901
924static void _InitPABias(struct ieee80211_hw *hw) 902static void _initpabias(struct ieee80211_hw *hw)
925{ 903{
926 struct rtl_priv *rtlpriv = rtl_priv(hw); 904 struct rtl_priv *rtlpriv = rtl_priv(hw);
927 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 905 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -1017,14 +995,14 @@ int rtl92cu_hw_init(struct ieee80211_hw *hw)
1017 rtl92c_phy_lc_calibrate(hw); 995 rtl92c_phy_lc_calibrate(hw);
1018 } 996 }
1019 _rtl92cu_hw_configure(hw); 997 _rtl92cu_hw_configure(hw);
1020 _InitPABias(hw); 998 _initpabias(hw);
1021 rtl92c_dm_init(hw); 999 rtl92c_dm_init(hw);
1022exit: 1000exit:
1023 local_irq_restore(flags); 1001 local_irq_restore(flags);
1024 return err; 1002 return err;
1025} 1003}
1026 1004
1027static void _DisableRFAFEAndResetBB(struct ieee80211_hw *hw) 1005static void disable_rfafeandresetbb(struct ieee80211_hw *hw)
1028{ 1006{
1029 struct rtl_priv *rtlpriv = rtl_priv(hw); 1007 struct rtl_priv *rtlpriv = rtl_priv(hw);
1030/************************************** 1008/**************************************
@@ -1034,20 +1012,20 @@ c. APSD_CTRL 0x600[7:0] = 0x40
1034d. SYS_FUNC_EN 0x02[7:0] = 0x16 reset BB state machine 1012d. SYS_FUNC_EN 0x02[7:0] = 0x16 reset BB state machine
1035e. SYS_FUNC_EN 0x02[7:0] = 0x14 reset BB state machine 1013e. SYS_FUNC_EN 0x02[7:0] = 0x14 reset BB state machine
1036***************************************/ 1014***************************************/
1037 u8 eRFPath = 0, value8 = 0; 1015 u8 erfpath = 0, value8 = 0;
1038 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); 1016 rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF);
1039 rtl_set_rfreg(hw, (enum radio_path)eRFPath, 0x0, MASKBYTE0, 0x0); 1017 rtl_set_rfreg(hw, (enum radio_path)erfpath, 0x0, MASKBYTE0, 0x0);
1040 1018
1041 value8 |= APSDOFF; 1019 value8 |= APSDOFF;
1042 rtl_write_byte(rtlpriv, REG_APSD_CTRL, value8); /*0x40*/ 1020 rtl_write_byte(rtlpriv, REG_APSD_CTRL, value8); /*0x40*/
1043 value8 = 0; 1021 value8 = 0;
1044 value8 |= (FEN_USBD | FEN_USBA | FEN_BB_GLB_RSTn); 1022 value8 |= (FEN_USBD | FEN_USBA | FEN_BB_GLB_RSTN);
1045 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, value8);/*0x16*/ 1023 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, value8);/*0x16*/
1046 value8 &= (~FEN_BB_GLB_RSTn); 1024 value8 &= (~FEN_BB_GLB_RSTN);
1047 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, value8); /*0x14*/ 1025 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, value8); /*0x14*/
1048} 1026}
1049 1027
1050static void _ResetDigitalProcedure1(struct ieee80211_hw *hw, bool bWithoutHWSM) 1028static void _resetdigitalprocedure1(struct ieee80211_hw *hw, bool withouthwsm)
1051{ 1029{
1052 struct rtl_priv *rtlpriv = rtl_priv(hw); 1030 struct rtl_priv *rtlpriv = rtl_priv(hw);
1053 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1031 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -1098,7 +1076,7 @@ static void _ResetDigitalProcedure1(struct ieee80211_hw *hw, bool bWithoutHWSM)
1098 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, 0x54); 1076 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, 0x54);
1099 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0); 1077 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0);
1100 } 1078 }
1101 if (bWithoutHWSM) { 1079 if (withouthwsm) {
1102 /***************************** 1080 /*****************************
1103 Without HW auto state machine 1081 Without HW auto state machine
1104 g.SYS_CLKR 0x08[15:0] = 0x30A3 disable MAC clock 1082 g.SYS_CLKR 0x08[15:0] = 0x30A3 disable MAC clock
@@ -1113,7 +1091,7 @@ static void _ResetDigitalProcedure1(struct ieee80211_hw *hw, bool bWithoutHWSM)
1113 } 1091 }
1114} 1092}
1115 1093
1116static void _ResetDigitalProcedure2(struct ieee80211_hw *hw) 1094static void _resetdigitalprocedure2(struct ieee80211_hw *hw)
1117{ 1095{
1118 struct rtl_priv *rtlpriv = rtl_priv(hw); 1096 struct rtl_priv *rtlpriv = rtl_priv(hw);
1119/***************************** 1097/*****************************
@@ -1125,7 +1103,7 @@ m. SYS_ISO_CTRL 0x01[7:0] = 0x83 isolated ELDR to PON
1125 rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL+1, 0x82); 1103 rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL+1, 0x82);
1126} 1104}
1127 1105
1128static void _DisableGPIO(struct ieee80211_hw *hw) 1106static void _disablegpio(struct ieee80211_hw *hw)
1129{ 1107{
1130 struct rtl_priv *rtlpriv = rtl_priv(hw); 1108 struct rtl_priv *rtlpriv = rtl_priv(hw);
1131/*************************************** 1109/***************************************
@@ -1155,13 +1133,13 @@ n. LEDCFG 0x4C[15:0] = 0x8080
1155 rtl_write_word(rtlpriv, REG_LEDCFG0, 0x8080); 1133 rtl_write_word(rtlpriv, REG_LEDCFG0, 0x8080);
1156} 1134}
1157 1135
1158static void _DisableAnalog(struct ieee80211_hw *hw, bool bWithoutHWSM) 1136static void disable_analog(struct ieee80211_hw *hw, bool withouthwsm)
1159{ 1137{
1160 struct rtl_priv *rtlpriv = rtl_priv(hw); 1138 struct rtl_priv *rtlpriv = rtl_priv(hw);
1161 u16 value16 = 0; 1139 u16 value16 = 0;
1162 u8 value8 = 0; 1140 u8 value8 = 0;
1163 1141
1164 if (bWithoutHWSM) { 1142 if (withouthwsm) {
1165 /***************************** 1143 /*****************************
1166 n. LDOA15_CTRL 0x20[7:0] = 0x04 disable A15 power 1144 n. LDOA15_CTRL 0x20[7:0] = 0x04 disable A15 power
1167 o. LDOV12D_CTRL 0x21[7:0] = 0x54 disable digital core power 1145 o. LDOV12D_CTRL 0x21[7:0] = 0x54 disable digital core power
@@ -1184,30 +1162,30 @@ i. APS_FSMCO 0x04[15:0] = 0x4802 set USB suspend
1184 rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0E); 1162 rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0E);
1185} 1163}
1186 1164
1187static void _CardDisableHWSM(struct ieee80211_hw *hw) 1165static void carddisable_hwsm(struct ieee80211_hw *hw)
1188{ 1166{
1189 /* ==== RF Off Sequence ==== */ 1167 /* ==== RF Off Sequence ==== */
1190 _DisableRFAFEAndResetBB(hw); 1168 disable_rfafeandresetbb(hw);
1191 /* ==== Reset digital sequence ====== */ 1169 /* ==== Reset digital sequence ====== */
1192 _ResetDigitalProcedure1(hw, false); 1170 _resetdigitalprocedure1(hw, false);
1193 /* ==== Pull GPIO PIN to balance level and LED control ====== */ 1171 /* ==== Pull GPIO PIN to balance level and LED control ====== */
1194 _DisableGPIO(hw); 1172 _disablegpio(hw);
1195 /* ==== Disable analog sequence === */ 1173 /* ==== Disable analog sequence === */
1196 _DisableAnalog(hw, false); 1174 disable_analog(hw, false);
1197} 1175}
1198 1176
1199static void _CardDisableWithoutHWSM(struct ieee80211_hw *hw) 1177static void carddisablewithout_hwsm(struct ieee80211_hw *hw)
1200{ 1178{
1201 /*==== RF Off Sequence ==== */ 1179 /*==== RF Off Sequence ==== */
1202 _DisableRFAFEAndResetBB(hw); 1180 disable_rfafeandresetbb(hw);
1203 /* ==== Reset digital sequence ====== */ 1181 /* ==== Reset digital sequence ====== */
1204 _ResetDigitalProcedure1(hw, true); 1182 _resetdigitalprocedure1(hw, true);
1205 /* ==== Pull GPIO PIN to balance level and LED control ====== */ 1183 /* ==== Pull GPIO PIN to balance level and LED control ====== */
1206 _DisableGPIO(hw); 1184 _disablegpio(hw);
1207 /* ==== Reset digital sequence ====== */ 1185 /* ==== Reset digital sequence ====== */
1208 _ResetDigitalProcedure2(hw); 1186 _resetdigitalprocedure2(hw);
1209 /* ==== Disable analog sequence === */ 1187 /* ==== Disable analog sequence === */
1210 _DisableAnalog(hw, true); 1188 disable_analog(hw, true);
1211} 1189}
1212 1190
1213static void _rtl92cu_set_bcn_ctrl_reg(struct ieee80211_hw *hw, 1191static void _rtl92cu_set_bcn_ctrl_reg(struct ieee80211_hw *hw,
@@ -1353,10 +1331,10 @@ void rtl92cu_card_disable(struct ieee80211_hw *hw)
1353 _rtl92cu_set_media_status(hw, opmode); 1331 _rtl92cu_set_media_status(hw, opmode);
1354 rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); 1332 rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF);
1355 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); 1333 RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
1356 if (rtlusb->disableHWSM) 1334 if (rtlusb->disablehwsm)
1357 _CardDisableHWSM(hw); 1335 carddisable_hwsm(hw);
1358 else 1336 else
1359 _CardDisableWithoutHWSM(hw); 1337 carddisablewithout_hwsm(hw);
1360 1338
1361 /* after power off we should do iqk again */ 1339 /* after power off we should do iqk again */
1362 rtlpriv->phy.iqk_initialized = false; 1340 rtlpriv->phy.iqk_initialized = false;
@@ -1498,12 +1476,12 @@ void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1498 *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; 1476 *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state;
1499 break; 1477 break;
1500 case HW_VAR_FWLPS_RF_ON:{ 1478 case HW_VAR_FWLPS_RF_ON:{
1501 enum rf_pwrstate rfState; 1479 enum rf_pwrstate rfstate;
1502 u32 val_rcr; 1480 u32 val_rcr;
1503 1481
1504 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE, 1482 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE,
1505 (u8 *)(&rfState)); 1483 (u8 *)(&rfstate));
1506 if (rfState == ERFOFF) { 1484 if (rfstate == ERFOFF) {
1507 *((bool *) (val)) = true; 1485 *((bool *) (val)) = true;
1508 } else { 1486 } else {
1509 val_rcr = rtl_read_dword(rtlpriv, REG_RCR); 1487 val_rcr = rtl_read_dword(rtlpriv, REG_RCR);
@@ -1630,7 +1608,7 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1630 &e_aci); 1608 &e_aci);
1631 } else { 1609 } else {
1632 u8 sifstime = 0; 1610 u8 sifstime = 0;
1633 u8 u1bAIFS; 1611 u8 u1baifs;
1634 1612
1635 if (IS_WIRELESS_MODE_A(wirelessmode) || 1613 if (IS_WIRELESS_MODE_A(wirelessmode) ||
1636 IS_WIRELESS_MODE_N_24G(wirelessmode) || 1614 IS_WIRELESS_MODE_N_24G(wirelessmode) ||
@@ -1638,15 +1616,15 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
1638 sifstime = 16; 1616 sifstime = 16;
1639 else 1617 else
1640 sifstime = 10; 1618 sifstime = 10;
1641 u1bAIFS = sifstime + (2 * val[0]); 1619 u1baifs = sifstime + (2 * val[0]);
1642 rtl_write_byte(rtlpriv, REG_EDCA_VO_PARAM, 1620 rtl_write_byte(rtlpriv, REG_EDCA_VO_PARAM,
1643 u1bAIFS); 1621 u1baifs);
1644 rtl_write_byte(rtlpriv, REG_EDCA_VI_PARAM, 1622 rtl_write_byte(rtlpriv, REG_EDCA_VI_PARAM,
1645 u1bAIFS); 1623 u1baifs);
1646 rtl_write_byte(rtlpriv, REG_EDCA_BE_PARAM, 1624 rtl_write_byte(rtlpriv, REG_EDCA_BE_PARAM,
1647 u1bAIFS); 1625 u1baifs);
1648 rtl_write_byte(rtlpriv, REG_EDCA_BK_PARAM, 1626 rtl_write_byte(rtlpriv, REG_EDCA_BK_PARAM,
1649 u1bAIFS); 1627 u1baifs);
1650 } 1628 }
1651 break; 1629 break;
1652 } 1630 }
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.h
index ebd168400d45..0ccc47e36652 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CU_HW_H__ 4#ifndef __RTL92CU_HW_H__
27#define __RTL92CU_HW_H__ 5#define __RTL92CU_HW_H__
@@ -71,14 +49,14 @@
71/* should be renamed and moved to another file */ 49/* should be renamed and moved to another file */
72enum _BOARD_TYPE_8192CUSB { 50enum _BOARD_TYPE_8192CUSB {
73 BOARD_USB_DONGLE = 0, /* USB dongle */ 51 BOARD_USB_DONGLE = 0, /* USB dongle */
74 BOARD_USB_High_PA = 1, /* USB dongle - high power PA */ 52 BOARD_USB_HIGH_PA = 1, /* USB dongle - high power PA */
75 BOARD_MINICARD = 2, /* Minicard */ 53 BOARD_MINICARD = 2, /* Minicard */
76 BOARD_USB_SOLO = 3, /* USB solo-Slim module */ 54 BOARD_USB_SOLO = 3, /* USB solo-Slim module */
77 BOARD_USB_COMBO = 4, /* USB Combo-Slim module */ 55 BOARD_USB_COMBO = 4, /* USB Combo-Slim module */
78}; 56};
79 57
80#define IS_HIGHT_PA(boardtype) \ 58#define IS_HIGHT_PA(boardtype) \
81 ((boardtype == BOARD_USB_High_PA) ? true : false) 59 ((boardtype == BOARD_USB_HIGH_PA) ? true : false)
82 60
83#define RTL92C_DRIVER_INFO_SIZE 4 61#define RTL92C_DRIVER_INFO_SIZE 4
84void rtl92cu_read_eeprom_info(struct ieee80211_hw *hw); 62void rtl92cu_read_eeprom_info(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c
index 66d2784de67d..cc13a4a8f856 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.c
@@ -1,25 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 *****************************************************************************/
23 3
24#include "../wifi.h" 4#include "../wifi.h"
25#include "../usb.h" 5#include "../usb.h"
@@ -34,7 +14,7 @@ static void _rtl92cu_init_led(struct ieee80211_hw *hw,
34 pled->ledon = false; 14 pled->ledon = false;
35} 15}
36 16
37static void _rtl92cu_deInit_led(struct rtl_led *pled) 17static void rtl92cu_deinit_led(struct rtl_led *pled)
38{ 18{
39} 19}
40 20
@@ -108,8 +88,8 @@ void rtl92cu_deinit_sw_leds(struct ieee80211_hw *hw)
108{ 88{
109 struct rtl_priv *rtlpriv = rtl_priv(hw); 89 struct rtl_priv *rtlpriv = rtl_priv(hw);
110 90
111 _rtl92cu_deInit_led(&rtlpriv->ledctl.sw_led0); 91 rtl92cu_deinit_led(&rtlpriv->ledctl.sw_led0);
112 _rtl92cu_deInit_led(&rtlpriv->ledctl.sw_led1); 92 rtl92cu_deinit_led(&rtlpriv->ledctl.sw_led1);
113} 93}
114 94
115static void _rtl92cu_sw_led_control(struct ieee80211_hw *hw, 95static void _rtl92cu_sw_led_control(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h
index 551deb8afb6f..3fc1e7c8f78b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.h
@@ -1,25 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 *****************************************************************************/
23 3
24#ifndef __RTL92CU_LED_H__ 4#ifndef __RTL92CU_LED_H__
25#define __RTL92CU_LED_H__ 5#define __RTL92CU_LED_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
index 5657b1e34ad0..cc2ba74bff81 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h
index 8573b7e257d9..62eb3c5adec1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_MAC_H__ 4#ifndef __RTL92C_MAC_H__
27#define __RTL92C_MAC_H__ 5#define __RTL92C_MAC_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.c
index f068dd5317a7..9cd028cb2239 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -125,7 +103,7 @@ bool rtl92cu_phy_bb_config(struct ieee80211_hw *hw)
125 rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb); 103 rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb);
126 rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB); 104 rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB);
127 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | 105 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD |
128 FEN_BB_GLB_RSTn | FEN_BBRSTB); 106 FEN_BB_GLB_RSTN | FEN_BBRSTB);
129 regval32 = rtl_read_dword(rtlpriv, 0x87c); 107 regval32 = rtl_read_dword(rtlpriv, 0x87c);
130 rtl_write_dword(rtlpriv, 0x87c, regval32 & (~BIT(31))); 108 rtl_write_dword(rtlpriv, 0x87c, regval32 & (~BIT(31)));
131 rtl_write_byte(rtlpriv, REG_LDOHCI12_CTRL, 0x0f); 109 rtl_write_byte(rtlpriv, REG_LDOHCI12_CTRL, 0x0f);
@@ -143,7 +121,7 @@ bool _rtl92cu_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
143 u32 arraylength; 121 u32 arraylength;
144 u32 *ptrarray; 122 u32 *ptrarray;
145 123
146 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n"); 124 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_ARRAY\n");
147 arraylength = rtlphy->hwparam_tables[MAC_REG].length ; 125 arraylength = rtlphy->hwparam_tables[MAC_REG].length ;
148 ptrarray = rtlphy->hwparam_tables[MAC_REG].pdata; 126 ptrarray = rtlphy->hwparam_tables[MAC_REG].pdata;
149 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CUMAC_2T_ARRAY\n"); 127 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CUMAC_2T_ARRAY\n");
@@ -181,7 +159,7 @@ bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
181 phy_regarray_table[i + 1]); 159 phy_regarray_table[i + 1]);
182 udelay(1); 160 udelay(1);
183 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 161 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
184 "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", 162 "The phy_regarray_table[0] is %x Rtl819XPHY_REGARRAY[1] is %x\n",
185 phy_regarray_table[i], 163 phy_regarray_table[i],
186 phy_regarray_table[i + 1]); 164 phy_regarray_table[i + 1]);
187 } 165 }
@@ -191,7 +169,7 @@ bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
191 agctab_array_table[i + 1]); 169 agctab_array_table[i + 1]);
192 udelay(1); 170 udelay(1);
193 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 171 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
194 "The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", 172 "The agctab_array_table[0] is %x Rtl819XPHY_REGARRAY[1] is %x\n",
195 agctab_array_table[i], 173 agctab_array_table[i],
196 agctab_array_table[i + 1]); 174 agctab_array_table[i + 1]);
197 } 175 }
@@ -214,7 +192,7 @@ bool _rtl92cu_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
214 if (configtype == BASEBAND_CONFIG_PHY_REG) { 192 if (configtype == BASEBAND_CONFIG_PHY_REG) {
215 for (i = 0; i < phy_regarray_pg_len; i = i + 3) { 193 for (i = 0; i < phy_regarray_pg_len; i = i + 3) {
216 rtl_addr_delay(phy_regarray_table_pg[i]); 194 rtl_addr_delay(phy_regarray_table_pg[i]);
217 _rtl92c_store_pwrIndex_diffrate_offset(hw, 195 _rtl92c_store_pwrindex_diffrate_offset(hw,
218 phy_regarray_table_pg[i], 196 phy_regarray_table_pg[i],
219 phy_regarray_table_pg[i + 1], 197 phy_regarray_table_pg[i + 1],
220 phy_regarray_table_pg[i + 2]); 198 phy_regarray_table_pg[i + 2]);
@@ -408,14 +386,14 @@ static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw,
408 if ((ppsc->rfpwr_state == ERFOFF) && 386 if ((ppsc->rfpwr_state == ERFOFF) &&
409 RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { 387 RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) {
410 bool rtstatus; 388 bool rtstatus;
411 u32 InitializeCount = 0; 389 u32 init_count = 0;
412 390
413 do { 391 do {
414 InitializeCount++; 392 init_count++;
415 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 393 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
416 "IPS Set eRf nic enable\n"); 394 "IPS Set eRf nic enable\n");
417 rtstatus = rtl_ps_enable_nic(hw); 395 rtstatus = rtl_ps_enable_nic(hw);
418 } while (!rtstatus && (InitializeCount < 10)); 396 } while (!rtstatus && (init_count < 10));
419 RT_CLEAR_PS_LEVEL(ppsc, 397 RT_CLEAR_PS_LEVEL(ppsc,
420 RT_RF_OFF_LEVL_HALT_NIC); 398 RT_RF_OFF_LEVL_HALT_NIC);
421 } else { 399 } else {
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.h
index a422c4db1a41..a3cc980c42fe 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../rtl8192ce/phy.h" 4#include "../rtl8192ce/phy.h"
27 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/reg.h
index 8185886daa8e..b4b6cde23341 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/reg.h
@@ -1,26 +1,4 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../rtl8192ce/reg.h" 4#include "../rtl8192ce/reg.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c
index cf551785eb08..f3a336e0ea98 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
@@ -148,17 +126,17 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
148 struct rtl_priv *rtlpriv = rtl_priv(hw); 126 struct rtl_priv *rtlpriv = rtl_priv(hw);
149 struct rtl_phy *rtlphy = &(rtlpriv->phy); 127 struct rtl_phy *rtlphy = &(rtlpriv->phy);
150 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 128 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
151 u32 powerBase0, powerBase1; 129 u32 powerbase0, powerbase1;
152 u8 legacy_pwrdiff = 0, ht20_pwrdiff = 0; 130 u8 legacy_pwrdiff = 0, ht20_pwrdiff = 0;
153 u8 i, powerlevel[2]; 131 u8 i, powerlevel[2];
154 132
155 for (i = 0; i < 2; i++) { 133 for (i = 0; i < 2; i++) {
156 powerlevel[i] = ppowerlevel[i]; 134 powerlevel[i] = ppowerlevel[i];
157 legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1]; 135 legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1];
158 powerBase0 = powerlevel[i] + legacy_pwrdiff; 136 powerbase0 = powerlevel[i] + legacy_pwrdiff;
159 powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) | 137 powerbase0 = (powerbase0 << 24) | (powerbase0 << 16) |
160 (powerBase0 << 8) | powerBase0; 138 (powerbase0 << 8) | powerbase0;
161 *(ofdmbase + i) = powerBase0; 139 *(ofdmbase + i) = powerbase0;
162 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 140 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
163 " [OFDM power base index rf(%c) = 0x%x]\n", 141 " [OFDM power base index rf(%c) = 0x%x]\n",
164 i == 0 ? 'A' : 'B', *(ofdmbase + i)); 142 i == 0 ? 'A' : 'B', *(ofdmbase + i));
@@ -168,10 +146,10 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
168 ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1]; 146 ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1];
169 powerlevel[i] += ht20_pwrdiff; 147 powerlevel[i] += ht20_pwrdiff;
170 } 148 }
171 powerBase1 = powerlevel[i]; 149 powerbase1 = powerlevel[i];
172 powerBase1 = (powerBase1 << 24) | 150 powerbase1 = (powerbase1 << 24) |
173 (powerBase1 << 16) | (powerBase1 << 8) | powerBase1; 151 (powerbase1 << 16) | (powerbase1 << 8) | powerbase1;
174 *(mcsbase + i) = powerBase1; 152 *(mcsbase + i) = powerbase1;
175 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 153 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
176 " [MCS power base index rf(%c) = 0x%x]\n", 154 " [MCS power base index rf(%c) = 0x%x]\n",
177 i == 0 ? 'A' : 'B', *(mcsbase + i)); 155 i == 0 ? 'A' : 'B', *(mcsbase + i));
@@ -180,26 +158,26 @@ static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw,
180 158
181static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw, 159static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
182 u8 channel, u8 index, 160 u8 channel, u8 index,
183 u32 *powerBase0, 161 u32 *powerbase0,
184 u32 *powerBase1, 162 u32 *powerbase1,
185 u32 *p_outwriteval) 163 u32 *p_outwriteval)
186{ 164{
187 struct rtl_priv *rtlpriv = rtl_priv(hw); 165 struct rtl_priv *rtlpriv = rtl_priv(hw);
188 struct rtl_phy *rtlphy = &(rtlpriv->phy); 166 struct rtl_phy *rtlphy = &(rtlpriv->phy);
189 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 167 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
190 u8 i, chnlgroup = 0, pwr_diff_limit[4]; 168 u8 i, chnlgroup = 0, pwr_diff_limit[4];
191 u32 writeVal, customer_limit, rf; 169 u32 writeval, customer_limit, rf;
192 170
193 for (rf = 0; rf < 2; rf++) { 171 for (rf = 0; rf < 2; rf++) {
194 switch (rtlefuse->eeprom_regulatory) { 172 switch (rtlefuse->eeprom_regulatory) {
195 case 0: 173 case 0:
196 chnlgroup = 0; 174 chnlgroup = 0;
197 writeVal = rtlphy->mcs_offset 175 writeval = rtlphy->mcs_offset
198 [chnlgroup][index + (rf ? 8 : 0)] 176 [chnlgroup][index + (rf ? 8 : 0)]
199 + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); 177 + ((index < 2) ? powerbase0[rf] : powerbase1[rf]);
200 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 178 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
201 "RTK better performance,writeVal(%c) = 0x%x\n", 179 "RTK better performance,writeval(%c) = 0x%x\n",
202 rf == 0 ? 'A' : 'B', writeVal); 180 rf == 0 ? 'A' : 'B', writeval);
203 break; 181 break;
204 case 1: 182 case 1:
205 if (rtlphy->pwrgroup_cnt == 1) 183 if (rtlphy->pwrgroup_cnt == 1)
@@ -217,20 +195,20 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
217 else 195 else
218 chnlgroup += 4; 196 chnlgroup += 4;
219 } 197 }
220 writeVal = rtlphy->mcs_offset[chnlgroup][index + 198 writeval = rtlphy->mcs_offset[chnlgroup][index +
221 (rf ? 8 : 0)] + 199 (rf ? 8 : 0)] +
222 ((index < 2) ? powerBase0[rf] : 200 ((index < 2) ? powerbase0[rf] :
223 powerBase1[rf]); 201 powerbase1[rf]);
224 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 202 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
225 "Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", 203 "Realtek regulatory, 20MHz, writeval(%c) = 0x%x\n",
226 rf == 0 ? 'A' : 'B', writeVal); 204 rf == 0 ? 'A' : 'B', writeval);
227 break; 205 break;
228 case 2: 206 case 2:
229 writeVal = ((index < 2) ? powerBase0[rf] : 207 writeval = ((index < 2) ? powerbase0[rf] :
230 powerBase1[rf]); 208 powerbase1[rf]);
231 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 209 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
232 "Better regulatory,writeVal(%c) = 0x%x\n", 210 "Better regulatory,writeval(%c) = 0x%x\n",
233 rf == 0 ? 'A' : 'B', writeVal); 211 rf == 0 ? 'A' : 'B', writeval);
234 break; 212 break;
235 case 3: 213 case 3:
236 chnlgroup = 0; 214 chnlgroup = 0;
@@ -275,36 +253,36 @@ static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw,
275 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 253 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
276 "Customer's limit rf(%c) = 0x%x\n", 254 "Customer's limit rf(%c) = 0x%x\n",
277 rf == 0 ? 'A' : 'B', customer_limit); 255 rf == 0 ? 'A' : 'B', customer_limit);
278 writeVal = customer_limit + ((index < 2) ? 256 writeval = customer_limit + ((index < 2) ?
279 powerBase0[rf] : powerBase1[rf]); 257 powerbase0[rf] : powerbase1[rf]);
280 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 258 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
281 "Customer, writeVal rf(%c)= 0x%x\n", 259 "Customer, writeval rf(%c)= 0x%x\n",
282 rf == 0 ? 'A' : 'B', writeVal); 260 rf == 0 ? 'A' : 'B', writeval);
283 break; 261 break;
284 default: 262 default:
285 chnlgroup = 0; 263 chnlgroup = 0;
286 writeVal = rtlphy->mcs_offset[chnlgroup] 264 writeval = rtlphy->mcs_offset[chnlgroup]
287 [index + (rf ? 8 : 0)] + ((index < 2) ? 265 [index + (rf ? 8 : 0)] + ((index < 2) ?
288 powerBase0[rf] : powerBase1[rf]); 266 powerbase0[rf] : powerbase1[rf]);
289 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 267 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
290 "RTK better performance, writeValrf(%c) = 0x%x\n", 268 "RTK better performance, writevalrf(%c) = 0x%x\n",
291 rf == 0 ? 'A' : 'B', writeVal); 269 rf == 0 ? 'A' : 'B', writeval);
292 break; 270 break;
293 } 271 }
294 if (rtlpriv->dm.dynamic_txhighpower_lvl == 272 if (rtlpriv->dm.dynamic_txhighpower_lvl ==
295 TXHIGHPWRLEVEL_LEVEL1) 273 TXHIGHPWRLEVEL_LEVEL1)
296 writeVal = 0x14141414; 274 writeval = 0x14141414;
297 else if (rtlpriv->dm.dynamic_txhighpower_lvl == 275 else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
298 TXHIGHPWRLEVEL_LEVEL2) 276 TXHIGHPWRLEVEL_LEVEL2)
299 writeVal = 0x00000000; 277 writeval = 0x00000000;
300 if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1) 278 if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1)
301 writeVal = writeVal - 0x06060606; 279 writeval = writeval - 0x06060606;
302 *(p_outwriteval + rf) = writeVal; 280 *(p_outwriteval + rf) = writeval;
303 } 281 }
304} 282}
305 283
306static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw, 284static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
307 u8 index, u32 *pValue) 285 u8 index, u32 *value)
308{ 286{
309 struct rtl_priv *rtlpriv = rtl_priv(hw); 287 struct rtl_priv *rtlpriv = rtl_priv(hw);
310 struct rtl_phy *rtlphy = &(rtlpriv->phy); 288 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -319,33 +297,33 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
319 RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12 297 RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12
320 }; 298 };
321 u8 i, rf, pwr_val[4]; 299 u8 i, rf, pwr_val[4];
322 u32 writeVal; 300 u32 writeval;
323 u16 regoffset; 301 u16 regoffset;
324 302
325 for (rf = 0; rf < 2; rf++) { 303 for (rf = 0; rf < 2; rf++) {
326 writeVal = pValue[rf]; 304 writeval = value[rf];
327 for (i = 0; i < 4; i++) { 305 for (i = 0; i < 4; i++) {
328 pwr_val[i] = (u8)((writeVal & (0x7f << (i * 8))) >> 306 pwr_val[i] = (u8)((writeval & (0x7f << (i * 8))) >>
329 (i * 8)); 307 (i * 8));
330 if (pwr_val[i] > RF6052_MAX_TX_PWR) 308 if (pwr_val[i] > RF6052_MAX_TX_PWR)
331 pwr_val[i] = RF6052_MAX_TX_PWR; 309 pwr_val[i] = RF6052_MAX_TX_PWR;
332 } 310 }
333 writeVal = (pwr_val[3] << 24) | (pwr_val[2] << 16) | 311 writeval = (pwr_val[3] << 24) | (pwr_val[2] << 16) |
334 (pwr_val[1] << 8) | pwr_val[0]; 312 (pwr_val[1] << 8) | pwr_val[0];
335 if (rf == 0) 313 if (rf == 0)
336 regoffset = regoffset_a[index]; 314 regoffset = regoffset_a[index];
337 else 315 else
338 regoffset = regoffset_b[index]; 316 regoffset = regoffset_b[index];
339 rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal); 317 rtl_set_bbreg(hw, regoffset, MASKDWORD, writeval);
340 RTPRINT(rtlpriv, FPHY, PHY_TXPWR, 318 RTPRINT(rtlpriv, FPHY, PHY_TXPWR,
341 "Set 0x%x = %08x\n", regoffset, writeVal); 319 "Set 0x%x = %08x\n", regoffset, writeval);
342 if (((get_rf_type(rtlphy) == RF_2T2R) && 320 if (((get_rf_type(rtlphy) == RF_2T2R) &&
343 (regoffset == RTXAGC_A_MCS15_MCS12 || 321 (regoffset == RTXAGC_A_MCS15_MCS12 ||
344 regoffset == RTXAGC_B_MCS15_MCS12)) || 322 regoffset == RTXAGC_B_MCS15_MCS12)) ||
345 ((get_rf_type(rtlphy) != RF_2T2R) && 323 ((get_rf_type(rtlphy) != RF_2T2R) &&
346 (regoffset == RTXAGC_A_MCS07_MCS04 || 324 (regoffset == RTXAGC_A_MCS07_MCS04 ||
347 regoffset == RTXAGC_B_MCS07_MCS04))) { 325 regoffset == RTXAGC_B_MCS07_MCS04))) {
348 writeVal = pwr_val[3]; 326 writeval = pwr_val[3];
349 if (regoffset == RTXAGC_A_MCS15_MCS12 || 327 if (regoffset == RTXAGC_A_MCS15_MCS12 ||
350 regoffset == RTXAGC_A_MCS07_MCS04) 328 regoffset == RTXAGC_A_MCS07_MCS04)
351 regoffset = 0xc90; 329 regoffset = 0xc90;
@@ -354,13 +332,13 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
354 regoffset = 0xc98; 332 regoffset = 0xc98;
355 for (i = 0; i < 3; i++) { 333 for (i = 0; i < 3; i++) {
356 if (i != 2) 334 if (i != 2)
357 writeVal = (writeVal > 8) ? 335 writeval = (writeval > 8) ?
358 (writeVal - 8) : 0; 336 (writeval - 8) : 0;
359 else 337 else
360 writeVal = (writeVal > 6) ? 338 writeval = (writeval > 6) ?
361 (writeVal - 6) : 0; 339 (writeval - 6) : 0;
362 rtl_write_byte(rtlpriv, (u32)(regoffset + i), 340 rtl_write_byte(rtlpriv, (u32)(regoffset + i),
363 (u8)writeVal); 341 (u8)writeval);
364 } 342 }
365 } 343 }
366 } 344 }
@@ -369,18 +347,18 @@ static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw,
369void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 347void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
370 u8 *ppowerlevel, u8 channel) 348 u8 *ppowerlevel, u8 channel)
371{ 349{
372 u32 writeVal[2], powerBase0[2], powerBase1[2]; 350 u32 writeval[2], powerbase0[2], powerbase1[2];
373 u8 index = 0; 351 u8 index = 0;
374 352
375 rtl92c_phy_get_power_base(hw, ppowerlevel, 353 rtl92c_phy_get_power_base(hw, ppowerlevel,
376 channel, &powerBase0[0], &powerBase1[0]); 354 channel, &powerbase0[0], &powerbase1[0]);
377 for (index = 0; index < 6; index++) { 355 for (index = 0; index < 6; index++) {
378 _rtl92c_get_txpower_writeval_by_regulatory(hw, 356 _rtl92c_get_txpower_writeval_by_regulatory(hw,
379 channel, index, 357 channel, index,
380 &powerBase0[0], 358 &powerbase0[0],
381 &powerBase1[0], 359 &powerbase1[0],
382 &writeVal[0]); 360 &writeval[0]);
383 _rtl92c_write_ofdm_power_reg(hw, index, &writeVal[0]); 361 _rtl92c_write_ofdm_power_reg(hw, index, &writeval[0]);
384 } 362 }
385} 363}
386 364
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.h
index 07aec0b20cc9..2661e5f8f6da 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CU_RF_H__ 4#ifndef __RTL92CU_RF_H__
27#define __RTL92CU_RF_H__ 5#define __RTL92CU_RF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
index 43e021b49260..c1c34dca39d2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.h
index 4ea2cb225580..662440c4cdc9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CU_SW_H__ 4#ifndef __RTL92CU_SW_H__
27#define __RTL92CU_SW_H__ 5#define __RTL92CU_SW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.c
index b3ac981d88c6..addeac90ee0c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "table.h" 4#include "table.h"
27 5
@@ -1269,7 +1247,7 @@ u32 RTL8192CUAGCTAB_1TARRAY[RTL8192CUAGCTAB_1TARRAYLENGTH] = {
1269 0xc78, 0x621f001e, 1247 0xc78, 0x621f001e,
1270}; 1248};
1271 1249
1272u32 RTL8192CUPHY_REG_1T_HPArray[RTL8192CUPHY_REG_1T_HPArrayLength] = { 1250u32 RTL8192CUPHY_REG_1T_HPARRAY[RTL8192CUPHY_REG_1T_HPARRAYLENGTH] = {
1273 0x024, 0x0011800f, 1251 0x024, 0x0011800f,
1274 0x028, 0x00ffdb83, 1252 0x028, 0x00ffdb83,
1275 0x040, 0x000c0004, 1253 0x040, 0x000c0004,
@@ -1461,7 +1439,7 @@ u32 RTL8192CUPHY_REG_1T_HPArray[RTL8192CUPHY_REG_1T_HPArrayLength] = {
1461 0xf00, 0x00000300, 1439 0xf00, 0x00000300,
1462}; 1440};
1463 1441
1464u32 RTL8192CUPHY_REG_Array_PG_HP[RTL8192CUPHY_REG_Array_PG_HPLength] = { 1442u32 RTL8192CUPHY_REG_ARRAY_PG_HP[RTL8192CUPHY_REG_ARRAY_PG_HPLENGTH] = {
1465 0xe00, 0xffffffff, 0x06080808, 1443 0xe00, 0xffffffff, 0x06080808,
1466 0xe04, 0xffffffff, 0x00040406, 1444 0xe04, 0xffffffff, 0x00040406,
1467 0xe08, 0x0000ff00, 0x00000000, 1445 0xe08, 0x0000ff00, 0x00000000,
@@ -1576,7 +1554,7 @@ u32 RTL8192CUPHY_REG_Array_PG_HP[RTL8192CUPHY_REG_Array_PG_HPLength] = {
1576 0x868, 0xffffffff, 0x00000000, 1554 0x868, 0xffffffff, 0x00000000,
1577}; 1555};
1578 1556
1579u32 RTL8192CURadioA_1T_HPArray[RTL8192CURadioA_1T_HPArrayLength] = { 1557u32 RTL8192CURADIOA_1T_HPARRAY[RTL8192CURADIOA_1T_HPARRAYLENGTH] = {
1580 0x000, 0x00030159, 1558 0x000, 0x00030159,
1581 0x001, 0x00031284, 1559 0x001, 0x00031284,
1582 0x002, 0x00098000, 1560 0x002, 0x00098000,
@@ -1720,7 +1698,7 @@ u32 RTL8192CURadioA_1T_HPArray[RTL8192CURadioA_1T_HPArrayLength] = {
1720 0x000, 0x00030159, 1698 0x000, 0x00030159,
1721}; 1699};
1722 1700
1723u32 Rtl8192CUAGCTAB_1T_HPArray[RTL8192CUAGCTAB_1T_HPArrayLength] = { 1701u32 RTL8192CUAGCTAB_1T_HPARRAY[RTL8192CUAGCTAB_1T_HPARRAYLENGTH] = {
1724 0xc78, 0x7b000001, 1702 0xc78, 0x7b000001,
1725 0xc78, 0x7b010001, 1703 0xc78, 0x7b010001,
1726 0xc78, 0x7b020001, 1704 0xc78, 0x7b020001,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.h
index 851bf53d246c..efc89f7db80f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CU_TABLE__H_ 4#ifndef __RTL92CU_TABLE__H_
27#define __RTL92CU_TABLE__H_ 5#define __RTL92CU_TABLE__H_
@@ -53,15 +31,15 @@ extern u32 RTL8192CUAGCTAB_2TARRAY[RTL8192CUAGCTAB_2TARRAYLENGTH];
53#define RTL8192CUAGCTAB_1TARRAYLENGTH 320 31#define RTL8192CUAGCTAB_1TARRAYLENGTH 320
54extern u32 RTL8192CUAGCTAB_1TARRAY[RTL8192CUAGCTAB_1TARRAYLENGTH]; 32extern u32 RTL8192CUAGCTAB_1TARRAY[RTL8192CUAGCTAB_1TARRAYLENGTH];
55 33
56#define RTL8192CUPHY_REG_1T_HPArrayLength 378 34#define RTL8192CUPHY_REG_1T_HPARRAYLENGTH 378
57extern u32 RTL8192CUPHY_REG_1T_HPArray[RTL8192CUPHY_REG_1T_HPArrayLength]; 35extern u32 RTL8192CUPHY_REG_1T_HPARRAY[RTL8192CUPHY_REG_1T_HPARRAYLENGTH];
58 36
59#define RTL8192CUPHY_REG_Array_PG_HPLength 336 37#define RTL8192CUPHY_REG_ARRAY_PG_HPLENGTH 336
60extern u32 RTL8192CUPHY_REG_Array_PG_HP[RTL8192CUPHY_REG_Array_PG_HPLength]; 38extern u32 RTL8192CUPHY_REG_ARRAY_PG_HP[RTL8192CUPHY_REG_ARRAY_PG_HPLENGTH];
61 39
62#define RTL8192CURadioA_1T_HPArrayLength 282 40#define RTL8192CURADIOA_1T_HPARRAYLENGTH 282
63extern u32 RTL8192CURadioA_1T_HPArray[RTL8192CURadioA_1T_HPArrayLength]; 41extern u32 RTL8192CURADIOA_1T_HPARRAY[RTL8192CURADIOA_1T_HPARRAYLENGTH];
64#define RTL8192CUAGCTAB_1T_HPArrayLength 320 42#define RTL8192CUAGCTAB_1T_HPARRAYLENGTH 320
65extern u32 Rtl8192CUAGCTAB_1T_HPArray[RTL8192CUAGCTAB_1T_HPArrayLength]; 43extern u32 RTL8192CUAGCTAB_1T_HPARRAY[RTL8192CUAGCTAB_1T_HPARRAYLENGTH];
66 44
67#endif 45#endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
index 9ab56827124e..4293d0640310 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../usb.h" 5#include "../usb.h"
@@ -36,7 +14,7 @@
36#include "trx.h" 14#include "trx.h"
37#include "../rtl8192c/fw_common.h" 15#include "../rtl8192c/fw_common.h"
38 16
39static int _ConfigVerTOutEP(struct ieee80211_hw *hw) 17static int configvertoutep(struct ieee80211_hw *hw)
40{ 18{
41 u8 ep_cfg, txqsele; 19 u8 ep_cfg, txqsele;
42 u8 ep_nums = 0; 20 u8 ep_nums = 0;
@@ -69,7 +47,7 @@ static int _ConfigVerTOutEP(struct ieee80211_hw *hw)
69 return (rtlusb->out_ep_nums == ep_nums) ? 0 : -EINVAL; 47 return (rtlusb->out_ep_nums == ep_nums) ? 0 : -EINVAL;
70} 48}
71 49
72static int _ConfigVerNOutEP(struct ieee80211_hw *hw) 50static int configvernoutep(struct ieee80211_hw *hw)
73{ 51{
74 u8 ep_cfg; 52 u8 ep_cfg;
75 u8 ep_nums = 0; 53 u8 ep_nums = 0;
@@ -98,7 +76,7 @@ static int _ConfigVerNOutEP(struct ieee80211_hw *hw)
98 return (rtlusb->out_ep_nums == ep_nums) ? 0 : -EINVAL; 76 return (rtlusb->out_ep_nums == ep_nums) ? 0 : -EINVAL;
99} 77}
100 78
101static void _TwoOutEpMapping(struct ieee80211_hw *hw, bool bIsChipB, 79static void twooutepmapping(struct ieee80211_hw *hw, bool is_chip8,
102 bool bwificfg, struct rtl_ep_map *ep_map) 80 bool bwificfg, struct rtl_ep_map *ep_map)
103{ 81{
104 struct rtl_priv *rtlpriv = rtl_priv(hw); 82 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -126,7 +104,7 @@ static void _TwoOutEpMapping(struct ieee80211_hw *hw, bool bIsChipB,
126 } 104 }
127} 105}
128 106
129static void _ThreeOutEpMapping(struct ieee80211_hw *hw, bool bwificfg, 107static void threeoutepmapping(struct ieee80211_hw *hw, bool bwificfg,
130 struct rtl_ep_map *ep_map) 108 struct rtl_ep_map *ep_map)
131{ 109{
132 struct rtl_priv *rtlpriv = rtl_priv(hw); 110 struct rtl_priv *rtlpriv = rtl_priv(hw);
@@ -153,7 +131,7 @@ static void _ThreeOutEpMapping(struct ieee80211_hw *hw, bool bwificfg,
153 } 131 }
154} 132}
155 133
156static void _OneOutEpMapping(struct ieee80211_hw *hw, struct rtl_ep_map *ep_map) 134static void oneoutepmapping(struct ieee80211_hw *hw, struct rtl_ep_map *ep_map)
157{ 135{
158 ep_map->ep_mapping[RTL_TXQ_BE] = 2; 136 ep_map->ep_mapping[RTL_TXQ_BE] = 2;
159 ep_map->ep_mapping[RTL_TXQ_BK] = 2; 137 ep_map->ep_mapping[RTL_TXQ_BK] = 2;
@@ -166,27 +144,27 @@ static void _OneOutEpMapping(struct ieee80211_hw *hw, struct rtl_ep_map *ep_map)
166static int _out_ep_mapping(struct ieee80211_hw *hw) 144static int _out_ep_mapping(struct ieee80211_hw *hw)
167{ 145{
168 int err = 0; 146 int err = 0;
169 bool bIsChipN, bwificfg = false; 147 bool ischipn, bwificfg = false;
170 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 148 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
171 struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw); 149 struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw);
172 struct rtl_usb *rtlusb = rtl_usbdev(usb_priv); 150 struct rtl_usb *rtlusb = rtl_usbdev(usb_priv);
173 struct rtl_ep_map *ep_map = &(rtlusb->ep_map); 151 struct rtl_ep_map *ep_map = &(rtlusb->ep_map);
174 152
175 bIsChipN = IS_NORMAL_CHIP(rtlhal->version); 153 ischipn = IS_NORMAL_CHIP(rtlhal->version);
176 switch (rtlusb->out_ep_nums) { 154 switch (rtlusb->out_ep_nums) {
177 case 2: 155 case 2:
178 _TwoOutEpMapping(hw, bIsChipN, bwificfg, ep_map); 156 twooutepmapping(hw, ischipn, bwificfg, ep_map);
179 break; 157 break;
180 case 3: 158 case 3:
181 /* Test chip doesn't support three out EPs. */ 159 /* Test chip doesn't support three out EPs. */
182 if (!bIsChipN) { 160 if (!ischipn) {
183 err = -EINVAL; 161 err = -EINVAL;
184 goto err_out; 162 goto err_out;
185 } 163 }
186 _ThreeOutEpMapping(hw, bIsChipN, ep_map); 164 threeoutepmapping(hw, ischipn, ep_map);
187 break; 165 break;
188 case 1: 166 case 1:
189 _OneOutEpMapping(hw, ep_map); 167 oneoutepmapping(hw, ep_map);
190 break; 168 break;
191 default: 169 default:
192 err = -EINVAL; 170 err = -EINVAL;
@@ -202,9 +180,9 @@ int rtl8192cu_endpoint_mapping(struct ieee80211_hw *hw)
202 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 180 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
203 int error = 0; 181 int error = 0;
204 if (likely(IS_NORMAL_CHIP(rtlhal->version))) 182 if (likely(IS_NORMAL_CHIP(rtlhal->version)))
205 error = _ConfigVerNOutEP(hw); 183 error = configvernoutep(hw);
206 else 184 else
207 error = _ConfigVerTOutEP(hw); 185 error = configvertoutep(hw);
208 if (error) 186 if (error)
209 goto err_out; 187 goto err_out;
210 error = _out_ep_mapping(hw); 188 error = _out_ep_mapping(hw);
@@ -320,7 +298,7 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
320 stats->isfirst_ampdu = (bool)((GET_RX_DESC_PAGGR(pdesc) == 1) 298 stats->isfirst_ampdu = (bool)((GET_RX_DESC_PAGGR(pdesc) == 1)
321 && (GET_RX_DESC_FAGGR(pdesc) == 1)); 299 && (GET_RX_DESC_FAGGR(pdesc) == 1));
322 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); 300 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
323 stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); 301 stats->rx_is40mhzpacket = (bool)GET_RX_DESC_BW(pdesc);
324 stats->is_ht = (bool)GET_RX_DESC_RX_HT(pdesc); 302 stats->is_ht = (bool)GET_RX_DESC_RX_HT(pdesc);
325 rx_status->freq = hw->conf.chandef.chan->center_freq; 303 rx_status->freq = hw->conf.chandef.chan->center_freq;
326 rx_status->band = hw->conf.chandef.chan->band; 304 rx_status->band = hw->conf.chandef.chan->band;
@@ -387,7 +365,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)
387 stats.isampdu = (bool) ((GET_RX_DESC_PAGGR(rxdesc) == 1) 365 stats.isampdu = (bool) ((GET_RX_DESC_PAGGR(rxdesc) == 1)
388 && (GET_RX_DESC_FAGGR(rxdesc) == 1)); 366 && (GET_RX_DESC_FAGGR(rxdesc) == 1));
389 stats.timestamp_low = GET_RX_DESC_TSFL(rxdesc); 367 stats.timestamp_low = GET_RX_DESC_TSFL(rxdesc);
390 stats.rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(rxdesc); 368 stats.rx_is40mhzpacket = (bool)GET_RX_DESC_BW(rxdesc);
391 stats.is_ht = (bool)GET_RX_DESC_RX_HT(rxdesc); 369 stats.is_ht = (bool)GET_RX_DESC_RX_HT(rxdesc);
392 /* TODO: is center_freq changed when doing scan? */ 370 /* TODO: is center_freq changed when doing scan? */
393 /* TODO: Shall we add protection or just skip those two step? */ 371 /* TODO: Shall we add protection or just skip those two step? */
@@ -610,28 +588,28 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
610 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "==>\n"); 588 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "==>\n");
611} 589}
612 590
613void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, 591void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 *pdesc,
614 u32 buffer_len, bool bIsPsPoll) 592 u32 buffer_len, bool is_pspoll)
615{ 593{
616 /* Clear all status */ 594 /* Clear all status */
617 memset(pDesc, 0, RTL_TX_HEADER_SIZE); 595 memset(pdesc, 0, RTL_TX_HEADER_SIZE);
618 SET_TX_DESC_FIRST_SEG(pDesc, 1); /* bFirstSeg; */ 596 SET_TX_DESC_FIRST_SEG(pdesc, 1); /* bFirstSeg; */
619 SET_TX_DESC_LAST_SEG(pDesc, 1); /* bLastSeg; */ 597 SET_TX_DESC_LAST_SEG(pdesc, 1); /* bLastSeg; */
620 SET_TX_DESC_OFFSET(pDesc, RTL_TX_HEADER_SIZE); /* Offset = 32 */ 598 SET_TX_DESC_OFFSET(pdesc, RTL_TX_HEADER_SIZE); /* Offset = 32 */
621 SET_TX_DESC_PKT_SIZE(pDesc, buffer_len); /* Buffer size + command hdr */ 599 SET_TX_DESC_PKT_SIZE(pdesc, buffer_len); /* Buffer size + command hdr */
622 SET_TX_DESC_QUEUE_SEL(pDesc, QSLT_MGNT); /* Fixed queue of Mgnt queue */ 600 SET_TX_DESC_QUEUE_SEL(pdesc, QSLT_MGNT); /* Fixed queue of Mgnt queue */
623 /* Set NAVUSEHDR to prevent Ps-poll AId filed to be changed to error 601 /* Set NAVUSEHDR to prevent Ps-poll AId filed to be changed to error
624 * vlaue by Hw. */ 602 * vlaue by Hw. */
625 if (bIsPsPoll) { 603 if (is_pspoll) {
626 SET_TX_DESC_NAV_USE_HDR(pDesc, 1); 604 SET_TX_DESC_NAV_USE_HDR(pdesc, 1);
627 } else { 605 } else {
628 SET_TX_DESC_HWSEQ_EN(pDesc, 1); /* Hw set sequence number */ 606 SET_TX_DESC_HWSEQ_EN(pdesc, 1); /* Hw set sequence number */
629 SET_TX_DESC_PKT_ID(pDesc, 0x100); /* set bit3 to 1. */ 607 SET_TX_DESC_PKT_ID(pdesc, 0x100); /* set bit3 to 1. */
630 } 608 }
631 SET_TX_DESC_USE_RATE(pDesc, 1); /* use data rate which is set by Sw */ 609 SET_TX_DESC_USE_RATE(pdesc, 1); /* use data rate which is set by Sw */
632 SET_TX_DESC_OWN(pDesc, 1); 610 SET_TX_DESC_OWN(pdesc, 1);
633 SET_TX_DESC_TX_RATE(pDesc, DESC_RATE1M); 611 SET_TX_DESC_TX_RATE(pdesc, DESC_RATE1M);
634 _rtl_tx_desc_checksum(pDesc); 612 _rtl_tx_desc_checksum(pdesc);
635} 613}
636 614
637void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw, 615void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h
index 15a66c547287..439ced0e18fa 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CU_TRX_H__ 4#ifndef __RTL92CU_TRX_H__
27#define __RTL92CU_TRX_H__ 5#define __RTL92CU_TRX_H__
@@ -397,8 +375,8 @@ void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw,
397 struct sk_buff *skb, 375 struct sk_buff *skb,
398 u8 queue_index, 376 u8 queue_index,
399 struct rtl_tcb_desc *tcb_desc); 377 struct rtl_tcb_desc *tcb_desc);
400void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, 378void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 *pdesc,
401 u32 buffer_len, bool bIsPsPoll); 379 u32 buffer_len, bool ispspoll);
402void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw, 380void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
403 u8 *pdesc, bool b_firstseg, 381 u8 *pdesc, bool b_firstseg,
404 bool b_lastseg, struct sk_buff *skb); 382 bool b_lastseg, struct sk_buff *skb);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/def.h
index cb7b9b727e3a..fa33b05db052 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/def.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92D_DEF_H__ 4#ifndef __RTL92D_DEF_H__
27#define __RTL92D_DEF_H__ 5#define __RTL92D_DEF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
index ac6d554b67c8..7cc86bb387a1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
@@ -864,7 +842,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
864 else 842 else
865 rf = 1; 843 rf = 1;
866 if (thermalvalue) { 844 if (thermalvalue) {
867 ele_d = rtl_get_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 845 ele_d = rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
868 MASKDWORD) & MASKOFDM_D; 846 MASKDWORD) & MASKOFDM_D;
869 for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { 847 for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {
870 if (ele_d == (ofdmswing_table[i] & MASKOFDM_D)) { 848 if (ele_d == (ofdmswing_table[i] & MASKOFDM_D)) {
@@ -872,13 +850,13 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
872 850
873 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, 851 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
874 "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n", 852 "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n",
875 ROFDM0_XATxIQIMBALANCE, 853 ROFDM0_XATXIQIMBALANCE,
876 ele_d, ofdm_index_old[0]); 854 ele_d, ofdm_index_old[0]);
877 break; 855 break;
878 } 856 }
879 } 857 }
880 if (is2t) { 858 if (is2t) {
881 ele_d = rtl_get_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 859 ele_d = rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBALANCE,
882 MASKDWORD) & MASKOFDM_D; 860 MASKDWORD) & MASKOFDM_D;
883 for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { 861 for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {
884 if (ele_d == 862 if (ele_d ==
@@ -887,7 +865,7 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
887 RT_TRACE(rtlpriv, COMP_POWER_TRACKING, 865 RT_TRACE(rtlpriv, COMP_POWER_TRACKING,
888 DBG_LOUD, 866 DBG_LOUD,
889 "Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n", 867 "Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n",
890 ROFDM0_XBTxIQIMBALANCE, ele_d, 868 ROFDM0_XBTXIQIMBALANCE, ele_d,
891 ofdm_index_old[1]); 869 ofdm_index_old[1]);
892 break; 870 break;
893 } 871 }
@@ -1059,11 +1037,11 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1059 * regC94, element B is always 0 */ 1037 * regC94, element B is always 0 */
1060 value32 = (ele_d << 22) | ((ele_c & 0x3F) << 1038 value32 = (ele_d << 22) | ((ele_c & 0x3F) <<
1061 16) | ele_a; 1039 16) | ele_a;
1062 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 1040 rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
1063 MASKDWORD, value32); 1041 MASKDWORD, value32);
1064 1042
1065 value32 = (ele_c & 0x000003C0) >> 6; 1043 value32 = (ele_c & 0x000003C0) >> 6;
1066 rtl_set_bbreg(hw, ROFDM0_XCTxAFE, MASKH4BITS, 1044 rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS,
1067 value32); 1045 value32);
1068 1046
1069 value32 = ((val_x * ele_d) >> 7) & 0x01; 1047 value32 = ((val_x * ele_d) >> 7) & 0x01;
@@ -1071,11 +1049,11 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1071 value32); 1049 value32);
1072 1050
1073 } else { 1051 } else {
1074 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 1052 rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
1075 MASKDWORD, 1053 MASKDWORD,
1076 ofdmswing_table 1054 ofdmswing_table
1077 [(u8)ofdm_index[0]]); 1055 [(u8)ofdm_index[0]]);
1078 rtl_set_bbreg(hw, ROFDM0_XCTxAFE, MASKH4BITS, 1056 rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS,
1079 0x00); 1057 0x00);
1080 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, 1058 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
1081 BIT(24), 0x00); 1059 BIT(24), 0x00);
@@ -1172,21 +1150,21 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1172 ((ele_c & 0x3F) << 16) | 1150 ((ele_c & 0x3F) << 16) |
1173 ele_a; 1151 ele_a;
1174 rtl_set_bbreg(hw, 1152 rtl_set_bbreg(hw,
1175 ROFDM0_XBTxIQIMBALANCE, 1153 ROFDM0_XBTXIQIMBALANCE,
1176 MASKDWORD, value32); 1154 MASKDWORD, value32);
1177 value32 = (ele_c & 0x000003C0) >> 6; 1155 value32 = (ele_c & 0x000003C0) >> 6;
1178 rtl_set_bbreg(hw, ROFDM0_XDTxAFE, 1156 rtl_set_bbreg(hw, ROFDM0_XDTXAFE,
1179 MASKH4BITS, value32); 1157 MASKH4BITS, value32);
1180 value32 = ((val_x * ele_d) >> 7) & 0x01; 1158 value32 = ((val_x * ele_d) >> 7) & 0x01;
1181 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, 1159 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
1182 BIT(28), value32); 1160 BIT(28), value32);
1183 } else { 1161 } else {
1184 rtl_set_bbreg(hw, 1162 rtl_set_bbreg(hw,
1185 ROFDM0_XBTxIQIMBALANCE, 1163 ROFDM0_XBTXIQIMBALANCE,
1186 MASKDWORD, 1164 MASKDWORD,
1187 ofdmswing_table 1165 ofdmswing_table
1188 [(u8) ofdm_index[1]]); 1166 [(u8) ofdm_index[1]]);
1189 rtl_set_bbreg(hw, ROFDM0_XDTxAFE, 1167 rtl_set_bbreg(hw, ROFDM0_XDTXAFE,
1190 MASKH4BITS, 0x00); 1168 MASKH4BITS, 0x00);
1191 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, 1169 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD,
1192 BIT(28), 0x00); 1170 BIT(28), 0x00);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.h
index 5d346ec366ce..939cc45bfebd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/dm.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_DM_H__ 4#ifndef __RTL92C_DM_H__
27#define __RTL92C_DM_H__ 5#define __RTL92C_DM_H__
@@ -44,7 +22,7 @@
44#define DM_DIG_FA_TH1 0x400 22#define DM_DIG_FA_TH1 0x400
45#define DM_DIG_FA_TH2 0x600 23#define DM_DIG_FA_TH2 0x600
46 24
47#define RXPATHSELECTION_SS_TH_lOW 30 25#define RXPATHSELECTION_SS_TH_LOW 30
48#define RXPATHSELECTION_DIFF_TH 18 26#define RXPATHSELECTION_DIFF_TH 18
49 27
50#define DM_RATR_STA_INIT 0 28#define DM_RATR_STA_INIT 0
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c
index 75bfa9dfef4a..2064813f9381 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -97,7 +75,7 @@ static int _rtl92d_fw_free_to_go(struct ieee80211_hw *hw)
97 do { 75 do {
98 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); 76 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
99 } while ((counter++ < FW_8192D_POLLING_TIMEOUT_COUNT) && 77 } while ((counter++ < FW_8192D_POLLING_TIMEOUT_COUNT) &&
100 (!(value32 & FWDL_ChkSum_rpt))); 78 (!(value32 & FWDL_CHKSUM_RPT)));
101 if (counter >= FW_8192D_POLLING_TIMEOUT_COUNT) { 79 if (counter >= FW_8192D_POLLING_TIMEOUT_COUNT) {
102 pr_err("chksum report fail! REG_MCUFWDL:0x%08x\n", 80 pr_err("chksum report fail! REG_MCUFWDL:0x%08x\n",
103 value32); 81 value32);
@@ -621,7 +599,7 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
621 struct sk_buff *skb = NULL; 599 struct sk_buff *skb = NULL;
622 u32 totalpacketlen; 600 u32 totalpacketlen;
623 bool rtstatus; 601 bool rtstatus;
624 u8 u1RsvdPageLoc[3] = { 0 }; 602 u8 u1rsvdpageloc[3] = { 0 };
625 bool dlok = false; 603 bool dlok = false;
626 u8 *beacon; 604 u8 *beacon;
627 u8 *p_pspoll; 605 u8 *p_pspoll;
@@ -640,7 +618,7 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
640 SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000)); 618 SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000));
641 SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid); 619 SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
642 SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr); 620 SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
643 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); 621 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1rsvdpageloc, PSPOLL_PG);
644 /*-------------------------------------------------------- 622 /*--------------------------------------------------------
645 (3) null data 623 (3) null data
646 ---------------------------------------------------------*/ 624 ---------------------------------------------------------*/
@@ -648,7 +626,7 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
648 SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid); 626 SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid);
649 SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); 627 SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
650 SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); 628 SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
651 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG); 629 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1rsvdpageloc, NULL_PG);
652 /*--------------------------------------------------------- 630 /*---------------------------------------------------------
653 (4) probe response 631 (4) probe response
654 ----------------------------------------------------------*/ 632 ----------------------------------------------------------*/
@@ -656,14 +634,14 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
656 SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid); 634 SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid);
657 SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr); 635 SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr);
658 SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid); 636 SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid);
659 SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG); 637 SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1rsvdpageloc, PROBERSP_PG);
660 totalpacketlen = TOTAL_RESERVED_PKT_LEN; 638 totalpacketlen = TOTAL_RESERVED_PKT_LEN;
661 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, 639 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD,
662 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL", 640 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
663 &reserved_page_packet[0], totalpacketlen); 641 &reserved_page_packet[0], totalpacketlen);
664 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 642 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
665 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL", 643 "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
666 u1RsvdPageLoc, 3); 644 u1rsvdpageloc, 3);
667 skb = dev_alloc_skb(totalpacketlen); 645 skb = dev_alloc_skb(totalpacketlen);
668 if (!skb) { 646 if (!skb) {
669 dlok = false; 647 dlok = false;
@@ -678,9 +656,9 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)
678 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 656 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
679 "Set RSVD page location to Fw\n"); 657 "Set RSVD page location to Fw\n");
680 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 658 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
681 "H2C_RSVDPAGE", u1RsvdPageLoc, 3); 659 "H2C_RSVDPAGE", u1rsvdpageloc, 3);
682 rtl92d_fill_h2c_cmd(hw, H2C_RSVDPAGE, 660 rtl92d_fill_h2c_cmd(hw, H2C_RSVDPAGE,
683 sizeof(u1RsvdPageLoc), u1RsvdPageLoc); 661 sizeof(u1rsvdpageloc), u1rsvdpageloc);
684 } else 662 } else
685 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 663 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
686 "Set RSVD page location to Fw FAIL!!!!!!\n"); 664 "Set RSVD page location to Fw FAIL!!!!!!\n");
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.h
index 6b435236a28e..bd8ea6d66dff 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92D__FW__H__ 4#ifndef __RTL92D__FW__H__
27#define __RTL92D__FW__H__ 5#define __RTL92D__FW__H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
index 80123fd97221..c7f29a9be50d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
@@ -124,12 +102,12 @@ void rtl92de_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
124 *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; 102 *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state;
125 break; 103 break;
126 case HW_VAR_FWLPS_RF_ON:{ 104 case HW_VAR_FWLPS_RF_ON:{
127 enum rf_pwrstate rfState; 105 enum rf_pwrstate rfstate;
128 u32 val_rcr; 106 u32 val_rcr;
129 107
130 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE, 108 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE,
131 (u8 *) (&rfState)); 109 (u8 *)(&rfstate));
132 if (rfState == ERFOFF) { 110 if (rfstate == ERFOFF) {
133 *((bool *) (val)) = true; 111 *((bool *) (val)) = true;
134 } else { 112 } else {
135 val_rcr = rtl_read_dword(rtlpriv, REG_RCR); 113 val_rcr = rtl_read_dword(rtlpriv, REG_RCR);
@@ -280,23 +258,23 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
280 } 258 }
281 case HW_VAR_AMPDU_FACTOR: { 259 case HW_VAR_AMPDU_FACTOR: {
282 u8 factor_toset; 260 u8 factor_toset;
283 u32 regtoSet; 261 u32 regtoset;
284 u8 *ptmp_byte = NULL; 262 u8 *ptmp_byte = NULL;
285 u8 index; 263 u8 index;
286 264
287 if (rtlhal->macphymode == DUALMAC_DUALPHY) 265 if (rtlhal->macphymode == DUALMAC_DUALPHY)
288 regtoSet = 0xb9726641; 266 regtoset = 0xb9726641;
289 else if (rtlhal->macphymode == DUALMAC_SINGLEPHY) 267 else if (rtlhal->macphymode == DUALMAC_SINGLEPHY)
290 regtoSet = 0x66626641; 268 regtoset = 0x66626641;
291 else 269 else
292 regtoSet = 0xb972a841; 270 regtoset = 0xb972a841;
293 factor_toset = *val; 271 factor_toset = *val;
294 if (factor_toset <= 3) { 272 if (factor_toset <= 3) {
295 factor_toset = (1 << (factor_toset + 2)); 273 factor_toset = (1 << (factor_toset + 2));
296 if (factor_toset > 0xf) 274 if (factor_toset > 0xf)
297 factor_toset = 0xf; 275 factor_toset = 0xf;
298 for (index = 0; index < 4; index++) { 276 for (index = 0; index < 4; index++) {
299 ptmp_byte = (u8 *) (&regtoSet) + index; 277 ptmp_byte = (u8 *)(&regtoset) + index;
300 if ((*ptmp_byte & 0xf0) > 278 if ((*ptmp_byte & 0xf0) >
301 (factor_toset << 4)) 279 (factor_toset << 4))
302 *ptmp_byte = (*ptmp_byte & 0x0f) 280 *ptmp_byte = (*ptmp_byte & 0x0f)
@@ -305,7 +283,7 @@ void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
305 *ptmp_byte = (*ptmp_byte & 0xf0) 283 *ptmp_byte = (*ptmp_byte & 0xf0)
306 | (factor_toset); 284 | (factor_toset);
307 } 285 }
308 rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, regtoSet); 286 rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, regtoset);
309 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, 287 RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
310 "Set HW_VAR_AMPDU_FACTOR: %#x\n", 288 "Set HW_VAR_AMPDU_FACTOR: %#x\n",
311 factor_toset); 289 factor_toset);
@@ -531,18 +509,18 @@ static bool _rtl92de_llt_table_init(struct ieee80211_hw *hw)
531 struct rtl_priv *rtlpriv = rtl_priv(hw); 509 struct rtl_priv *rtlpriv = rtl_priv(hw);
532 unsigned short i; 510 unsigned short i;
533 u8 txpktbuf_bndy; 511 u8 txpktbuf_bndy;
534 u8 maxPage; 512 u8 maxpage;
535 bool status; 513 bool status;
536 u32 value32; /* High+low page number */ 514 u32 value32; /* High+low page number */
537 u8 value8; /* normal page number */ 515 u8 value8; /* normal page number */
538 516
539 if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) { 517 if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) {
540 maxPage = 255; 518 maxpage = 255;
541 txpktbuf_bndy = 246; 519 txpktbuf_bndy = 246;
542 value8 = 0; 520 value8 = 0;
543 value32 = 0x80bf0d29; 521 value32 = 0x80bf0d29;
544 } else { 522 } else {
545 maxPage = 127; 523 maxpage = 127;
546 txpktbuf_bndy = 123; 524 txpktbuf_bndy = 123;
547 value8 = 0; 525 value8 = 0;
548 value32 = 0x80750005; 526 value32 = 0x80750005;
@@ -598,14 +576,14 @@ static bool _rtl92de_llt_table_init(struct ieee80211_hw *hw)
598 /* This ring buffer is used as beacon buffer if we */ 576 /* This ring buffer is used as beacon buffer if we */
599 /* config this MAC as two MAC transfer. */ 577 /* config this MAC as two MAC transfer. */
600 /* Otherwise used as local loopback buffer. */ 578 /* Otherwise used as local loopback buffer. */
601 for (i = txpktbuf_bndy; i < maxPage; i++) { 579 for (i = txpktbuf_bndy; i < maxpage; i++) {
602 status = _rtl92de_llt_write(hw, i, (i + 1)); 580 status = _rtl92de_llt_write(hw, i, (i + 1));
603 if (true != status) 581 if (true != status)
604 return status; 582 return status;
605 } 583 }
606 584
607 /* Let last entry point to the start entry of ring buffer */ 585 /* Let last entry point to the start entry of ring buffer */
608 status = _rtl92de_llt_write(hw, maxPage, txpktbuf_bndy); 586 status = _rtl92de_llt_write(hw, maxpage, txpktbuf_bndy);
609 if (true != status) 587 if (true != status)
610 return status; 588 return status;
611 589
@@ -1415,13 +1393,13 @@ void rtl92de_update_interrupt_mask(struct ieee80211_hw *hw,
1415} 1393}
1416 1394
1417static void _rtl92de_readpowervalue_fromprom(struct txpower_info *pwrinfo, 1395static void _rtl92de_readpowervalue_fromprom(struct txpower_info *pwrinfo,
1418 u8 *rom_content, bool autoLoadfail) 1396 u8 *rom_content, bool autoloadfail)
1419{ 1397{
1420 u32 rfpath, eeaddr, group, offset1, offset2; 1398 u32 rfpath, eeaddr, group, offset1, offset2;
1421 u8 i; 1399 u8 i;
1422 1400
1423 memset(pwrinfo, 0, sizeof(struct txpower_info)); 1401 memset(pwrinfo, 0, sizeof(struct txpower_info));
1424 if (autoLoadfail) { 1402 if (autoloadfail) {
1425 for (group = 0; group < CHANNEL_GROUP_MAX; group++) { 1403 for (group = 0; group < CHANNEL_GROUP_MAX; group++) {
1426 for (rfpath = 0; rfpath < RF6052_MAX_PATH; rfpath++) { 1404 for (rfpath = 0; rfpath < RF6052_MAX_PATH; rfpath++) {
1427 if (group < CHANNEL_GROUP_MAX_2G) { 1405 if (group < CHANNEL_GROUP_MAX_2G) {
@@ -1563,7 +1541,7 @@ static void _rtl92de_read_txpower_info(struct ieee80211_hw *hw,
1563 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 1541 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
1564 struct txpower_info pwrinfo; 1542 struct txpower_info pwrinfo;
1565 u8 tempval[2], i, pwr, diff; 1543 u8 tempval[2], i, pwr, diff;
1566 u32 ch, rfPath, group; 1544 u32 ch, rfpath, group;
1567 1545
1568 _rtl92de_readpowervalue_fromprom(&pwrinfo, hwinfo, autoload_fail); 1546 _rtl92de_readpowervalue_fromprom(&pwrinfo, hwinfo, autoload_fail);
1569 if (!autoload_fail) { 1547 if (!autoload_fail) {
@@ -1643,25 +1621,25 @@ static void _rtl92de_read_txpower_info(struct ieee80211_hw *hw,
1643 "Delta_IQK = 0x%x Delta_LCK = 0x%x\n", 1621 "Delta_IQK = 0x%x Delta_LCK = 0x%x\n",
1644 rtlefuse->delta_iqk, rtlefuse->delta_lck); 1622 rtlefuse->delta_iqk, rtlefuse->delta_lck);
1645 1623
1646 for (rfPath = 0; rfPath < RF6052_MAX_PATH; rfPath++) { 1624 for (rfpath = 0; rfpath < RF6052_MAX_PATH; rfpath++) {
1647 for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) { 1625 for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) {
1648 group = rtl92d_get_chnlgroup_fromarray((u8) ch); 1626 group = rtl92d_get_chnlgroup_fromarray((u8) ch);
1649 if (ch < CHANNEL_MAX_NUMBER_2G) 1627 if (ch < CHANNEL_MAX_NUMBER_2G)
1650 rtlefuse->txpwrlevel_cck[rfPath][ch] = 1628 rtlefuse->txpwrlevel_cck[rfpath][ch] =
1651 pwrinfo.cck_index[rfPath][group]; 1629 pwrinfo.cck_index[rfpath][group];
1652 rtlefuse->txpwrlevel_ht40_1s[rfPath][ch] = 1630 rtlefuse->txpwrlevel_ht40_1s[rfpath][ch] =
1653 pwrinfo.ht40_1sindex[rfPath][group]; 1631 pwrinfo.ht40_1sindex[rfpath][group];
1654 rtlefuse->txpwr_ht20diff[rfPath][ch] = 1632 rtlefuse->txpwr_ht20diff[rfpath][ch] =
1655 pwrinfo.ht20indexdiff[rfPath][group]; 1633 pwrinfo.ht20indexdiff[rfpath][group];
1656 rtlefuse->txpwr_legacyhtdiff[rfPath][ch] = 1634 rtlefuse->txpwr_legacyhtdiff[rfpath][ch] =
1657 pwrinfo.ofdmindexdiff[rfPath][group]; 1635 pwrinfo.ofdmindexdiff[rfpath][group];
1658 rtlefuse->pwrgroup_ht20[rfPath][ch] = 1636 rtlefuse->pwrgroup_ht20[rfpath][ch] =
1659 pwrinfo.ht20maxoffset[rfPath][group]; 1637 pwrinfo.ht20maxoffset[rfpath][group];
1660 rtlefuse->pwrgroup_ht40[rfPath][ch] = 1638 rtlefuse->pwrgroup_ht40[rfpath][ch] =
1661 pwrinfo.ht40maxoffset[rfPath][group]; 1639 pwrinfo.ht40maxoffset[rfpath][group];
1662 pwr = pwrinfo.ht40_1sindex[rfPath][group]; 1640 pwr = pwrinfo.ht40_1sindex[rfpath][group];
1663 diff = pwrinfo.ht40_2sindexdiff[rfPath][group]; 1641 diff = pwrinfo.ht40_2sindexdiff[rfpath][group];
1664 rtlefuse->txpwrlevel_ht40_2s[rfPath][ch] = 1642 rtlefuse->txpwrlevel_ht40_2s[rfpath][ch] =
1665 (pwr > diff) ? (pwr - diff) : 0; 1643 (pwr > diff) ? (pwr - diff) : 0;
1666 } 1644 }
1667 } 1645 }
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.h
index e6c702e69ecf..ea495216d394 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92DE_HW_H__ 4#ifndef __RTL92DE_HW_H__
27#define __RTL92DE_HW_H__ 5#define __RTL92DE_HW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c
index 8851038c9eba..2b76a025deb8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h
index 9874519704d3..7599c7e5ecc3 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/led.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_LED_H__ 4#ifndef __RTL92CE_LED_H__
27#define __RTL92CE_LED_H__ 5#define __RTL92CE_LED_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
index de98d88199d6..0ae6371b6318 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -506,16 +484,16 @@ static void _rtl92d_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw)
506 rtlphy->phyreg_def[RF90_PATH_D].rfrx_afe = ROFDM0_XDRXAFE; 484 rtlphy->phyreg_def[RF90_PATH_D].rfrx_afe = ROFDM0_XDRXAFE;
507 485
508 /* Tx AFE control 1 */ 486 /* Tx AFE control 1 */
509 rtlphy->phyreg_def[RF90_PATH_A].rftxiq_imbal = ROFDM0_XATxIQIMBALANCE; 487 rtlphy->phyreg_def[RF90_PATH_A].rftxiq_imbal = ROFDM0_XATXIQIMBALANCE;
510 rtlphy->phyreg_def[RF90_PATH_B].rftxiq_imbal = ROFDM0_XBTxIQIMBALANCE; 488 rtlphy->phyreg_def[RF90_PATH_B].rftxiq_imbal = ROFDM0_XBTXIQIMBALANCE;
511 rtlphy->phyreg_def[RF90_PATH_C].rftxiq_imbal = ROFDM0_XCTxIQIMBALANCE; 489 rtlphy->phyreg_def[RF90_PATH_C].rftxiq_imbal = ROFDM0_XCTXIQIMBALANCE;
512 rtlphy->phyreg_def[RF90_PATH_D].rftxiq_imbal = ROFDM0_XDTxIQIMBALANCE; 490 rtlphy->phyreg_def[RF90_PATH_D].rftxiq_imbal = ROFDM0_XDTXIQIMBALANCE;
513 491
514 /* Tx AFE control 2 */ 492 /* Tx AFE control 2 */
515 rtlphy->phyreg_def[RF90_PATH_A].rftx_afe = ROFDM0_XATxAFE; 493 rtlphy->phyreg_def[RF90_PATH_A].rftx_afe = ROFDM0_XATXAFE;
516 rtlphy->phyreg_def[RF90_PATH_B].rftx_afe = ROFDM0_XBTxAFE; 494 rtlphy->phyreg_def[RF90_PATH_B].rftx_afe = ROFDM0_XBTXAFE;
517 rtlphy->phyreg_def[RF90_PATH_C].rftx_afe = ROFDM0_XCTxAFE; 495 rtlphy->phyreg_def[RF90_PATH_C].rftx_afe = ROFDM0_XCTXAFE;
518 rtlphy->phyreg_def[RF90_PATH_D].rftx_afe = ROFDM0_XDTxAFE; 496 rtlphy->phyreg_def[RF90_PATH_D].rftx_afe = ROFDM0_XDTXAFE;
519 497
520 /* Tranceiver LSSI Readback SI mode */ 498 /* Tranceiver LSSI Readback SI mode */
521 rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RFPGA0_XA_LSSIREADBACK; 499 rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RFPGA0_XA_LSSIREADBACK;
@@ -764,7 +742,7 @@ bool rtl92d_phy_bb_config(struct ieee80211_hw *hw)
764 rtl_write_byte(rtlpriv, REG_RF_CTRL, value | RF_EN | RF_RSTB | 742 rtl_write_byte(rtlpriv, REG_RF_CTRL, value | RF_EN | RF_RSTB |
765 RF_SDMRSTB); 743 RF_SDMRSTB);
766 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, FEN_PPLL | FEN_PCIEA | 744 rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, FEN_PPLL | FEN_PCIEA |
767 FEN_DIO_PCIE | FEN_BB_GLB_RSTn | FEN_BBRSTB); 745 FEN_DIO_PCIE | FEN_BB_GLB_RSTN | FEN_BBRSTB);
768 rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80); 746 rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80);
769 if (!(IS_92D_SINGLEPHY(rtlpriv->rtlhal.version))) { 747 if (!(IS_92D_SINGLEPHY(rtlpriv->rtlhal.version))) {
770 regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0); 748 regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0);
@@ -1480,11 +1458,11 @@ static u8 _rtl92d_phy_patha_iqk_5g_normal(struct ieee80211_hw *hw,
1480 u8 result = 0; 1458 u8 result = 0;
1481 u8 i; 1459 u8 i;
1482 u8 retrycount = 2; 1460 u8 retrycount = 2;
1483 u32 TxOKBit = BIT(28), RxOKBit = BIT(27); 1461 u32 TXOKBIT = BIT(28), RXOKBIT = BIT(27);
1484 1462
1485 if (rtlhal->interfaceindex == 1) { /* PHY1 */ 1463 if (rtlhal->interfaceindex == 1) { /* PHY1 */
1486 TxOKBit = BIT(31); 1464 TXOKBIT = BIT(31);
1487 RxOKBit = BIT(30); 1465 RXOKBIT = BIT(30);
1488 } 1466 }
1489 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK!\n"); 1467 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK!\n");
1490 /* path-A IQK setting */ 1468 /* path-A IQK setting */
@@ -1526,7 +1504,7 @@ static u8 _rtl92d_phy_patha_iqk_5g_normal(struct ieee80211_hw *hw,
1526 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe9c = 0x%x\n", rege9c); 1504 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe9c = 0x%x\n", rege9c);
1527 regea4 = rtl_get_bbreg(hw, 0xea4, MASKDWORD); 1505 regea4 = rtl_get_bbreg(hw, 0xea4, MASKDWORD);
1528 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xea4 = 0x%x\n", regea4); 1506 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xea4 = 0x%x\n", regea4);
1529 if (!(regeac & TxOKBit) && 1507 if (!(regeac & TXOKBIT) &&
1530 (((rege94 & 0x03FF0000) >> 16) != 0x142)) { 1508 (((rege94 & 0x03FF0000) >> 16) != 0x142)) {
1531 result |= 0x01; 1509 result |= 0x01;
1532 } else { /* if Tx not OK, ignore Rx */ 1510 } else { /* if Tx not OK, ignore Rx */
@@ -1536,7 +1514,7 @@ static u8 _rtl92d_phy_patha_iqk_5g_normal(struct ieee80211_hw *hw,
1536 } 1514 }
1537 1515
1538 /* if Tx is OK, check whether Rx is OK */ 1516 /* if Tx is OK, check whether Rx is OK */
1539 if (!(regeac & RxOKBit) && 1517 if (!(regeac & RXOKBIT) &&
1540 (((regea4 & 0x03FF0000) >> 16) != 0x132)) { 1518 (((regea4 & 0x03FF0000) >> 16) != 0x132)) {
1541 result |= 0x02; 1519 result |= 0x02;
1542 break; 1520 break;
@@ -2165,7 +2143,7 @@ static void _rtl92d_phy_patha_fill_iqk_matrix(struct ieee80211_hw *hw,
2165 if (final_candidate == 0xFF) { 2143 if (final_candidate == 0xFF) {
2166 return; 2144 return;
2167 } else if (iqk_ok) { 2145 } else if (iqk_ok) {
2168 oldval_0 = (rtl_get_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 2146 oldval_0 = (rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
2169 MASKDWORD) >> 22) & 0x3FF; /* OFDM0_D */ 2147 MASKDWORD) >> 22) & 0x3FF; /* OFDM0_D */
2170 val_x = result[final_candidate][0]; 2148 val_x = result[final_candidate][0];
2171 if ((val_x & 0x00000200) != 0) 2149 if ((val_x & 0x00000200) != 0)
@@ -2174,7 +2152,7 @@ static void _rtl92d_phy_patha_fill_iqk_matrix(struct ieee80211_hw *hw,
2174 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2152 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2175 "X = 0x%x, tx0_a = 0x%x, oldval_0 0x%x\n", 2153 "X = 0x%x, tx0_a = 0x%x, oldval_0 0x%x\n",
2176 val_x, tx0_a, oldval_0); 2154 val_x, tx0_a, oldval_0);
2177 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 0x3FF, tx0_a); 2155 rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, 0x3FF, tx0_a);
2178 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(24), 2156 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(24),
2179 ((val_x * oldval_0 >> 7) & 0x1)); 2157 ((val_x * oldval_0 >> 7) & 0x1));
2180 val_y = result[final_candidate][1]; 2158 val_y = result[final_candidate][1];
@@ -2188,15 +2166,15 @@ static void _rtl92d_phy_patha_fill_iqk_matrix(struct ieee80211_hw *hw,
2188 RTPRINT(rtlpriv, FINIT, INIT_IQK, 2166 RTPRINT(rtlpriv, FINIT, INIT_IQK,
2189 "Y = 0x%lx, tx0_c = 0x%lx\n", 2167 "Y = 0x%lx, tx0_c = 0x%lx\n",
2190 val_y, tx0_c); 2168 val_y, tx0_c);
2191 rtl_set_bbreg(hw, ROFDM0_XCTxAFE, 0xF0000000, 2169 rtl_set_bbreg(hw, ROFDM0_XCTXAFE, 0xF0000000,
2192 ((tx0_c & 0x3C0) >> 6)); 2170 ((tx0_c & 0x3C0) >> 6));
2193 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 0x003F0000, 2171 rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, 0x003F0000,
2194 (tx0_c & 0x3F)); 2172 (tx0_c & 0x3F));
2195 if (is2t) 2173 if (is2t)
2196 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(26), 2174 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(26),
2197 ((val_y * oldval_0 >> 7) & 0x1)); 2175 ((val_y * oldval_0 >> 7) & 0x1));
2198 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xC80 = 0x%x\n", 2176 RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xC80 = 0x%x\n",
2199 rtl_get_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 2177 rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE,
2200 MASKDWORD)); 2178 MASKDWORD));
2201 if (txonly) { 2179 if (txonly) {
2202 RTPRINT(rtlpriv, FINIT, INIT_IQK, "only Tx OK\n"); 2180 RTPRINT(rtlpriv, FINIT, INIT_IQK, "only Tx OK\n");
@@ -2224,7 +2202,7 @@ static void _rtl92d_phy_pathb_fill_iqk_matrix(struct ieee80211_hw *hw,
2224 if (final_candidate == 0xFF) { 2202 if (final_candidate == 0xFF) {
2225 return; 2203 return;
2226 } else if (iqk_ok) { 2204 } else if (iqk_ok) {
2227 oldval_1 = (rtl_get_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 2205 oldval_1 = (rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBALANCE,
2228 MASKDWORD) >> 22) & 0x3FF; 2206 MASKDWORD) >> 22) & 0x3FF;
2229 val_x = result[final_candidate][4]; 2207 val_x = result[final_candidate][4];
2230 if ((val_x & 0x00000200) != 0) 2208 if ((val_x & 0x00000200) != 0)
@@ -2232,7 +2210,7 @@ static void _rtl92d_phy_pathb_fill_iqk_matrix(struct ieee80211_hw *hw,
2232 tx1_a = (val_x * oldval_1) >> 8; 2210 tx1_a = (val_x * oldval_1) >> 8;
2233 RTPRINT(rtlpriv, FINIT, INIT_IQK, "X = 0x%x, tx1_a = 0x%x\n", 2211 RTPRINT(rtlpriv, FINIT, INIT_IQK, "X = 0x%x, tx1_a = 0x%x\n",
2234 val_x, tx1_a); 2212 val_x, tx1_a);
2235 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 0x3FF, tx1_a); 2213 rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, 0x3FF, tx1_a);
2236 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(28), 2214 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(28),
2237 ((val_x * oldval_1 >> 7) & 0x1)); 2215 ((val_x * oldval_1 >> 7) & 0x1));
2238 val_y = result[final_candidate][5]; 2216 val_y = result[final_candidate][5];
@@ -2243,9 +2221,9 @@ static void _rtl92d_phy_pathb_fill_iqk_matrix(struct ieee80211_hw *hw,
2243 tx1_c = (val_y * oldval_1) >> 8; 2221 tx1_c = (val_y * oldval_1) >> 8;
2244 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Y = 0x%lx, tx1_c = 0x%lx\n", 2222 RTPRINT(rtlpriv, FINIT, INIT_IQK, "Y = 0x%lx, tx1_c = 0x%lx\n",
2245 val_y, tx1_c); 2223 val_y, tx1_c);
2246 rtl_set_bbreg(hw, ROFDM0_XDTxAFE, 0xF0000000, 2224 rtl_set_bbreg(hw, ROFDM0_XDTXAFE, 0xF0000000,
2247 ((tx1_c & 0x3C0) >> 6)); 2225 ((tx1_c & 0x3C0) >> 6));
2248 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 0x003F0000, 2226 rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, 0x003F0000,
2249 (tx1_c & 0x3F)); 2227 (tx1_c & 0x3F));
2250 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(30), 2228 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(30),
2251 ((val_y * oldval_1 >> 7) & 0x1)); 2229 ((val_y * oldval_1 >> 7) & 0x1));
@@ -3086,13 +3064,13 @@ bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw,
3086 if ((ppsc->rfpwr_state == ERFOFF) && 3064 if ((ppsc->rfpwr_state == ERFOFF) &&
3087 RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { 3065 RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) {
3088 bool rtstatus; 3066 bool rtstatus;
3089 u32 InitializeCount = 0; 3067 u32 initializecount = 0;
3090 do { 3068 do {
3091 InitializeCount++; 3069 initializecount++;
3092 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 3070 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
3093 "IPS Set eRf nic enable\n"); 3071 "IPS Set eRf nic enable\n");
3094 rtstatus = rtl_ps_enable_nic(hw); 3072 rtstatus = rtl_ps_enable_nic(hw);
3095 } while (!rtstatus && (InitializeCount < 10)); 3073 } while (!rtstatus && (initializecount < 10));
3096 3074
3097 RT_CLEAR_PS_LEVEL(ppsc, 3075 RT_CLEAR_PS_LEVEL(ppsc,
3098 RT_RF_OFF_LEVL_HALT_NIC); 3076 RT_RF_OFF_LEVL_HALT_NIC);
@@ -3387,9 +3365,9 @@ void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw)
3387 /* 5G LAN ON */ 3365 /* 5G LAN ON */
3388 rtl_set_bbreg(hw, 0xB30, 0x00F00000, 0xa); 3366 rtl_set_bbreg(hw, 0xB30, 0x00F00000, 0xa);
3389 /* TX BB gain shift*1,Just for testchip,0xc80,0xc88 */ 3367 /* TX BB gain shift*1,Just for testchip,0xc80,0xc88 */
3390 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, MASKDWORD, 3368 rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, MASKDWORD,
3391 0x40000100); 3369 0x40000100);
3392 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, MASKDWORD, 3370 rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, MASKDWORD,
3393 0x40000100); 3371 0x40000100);
3394 if (rtlhal->macphymode == DUALMAC_DUALPHY) { 3372 if (rtlhal->macphymode == DUALMAC_DUALPHY) {
3395 rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, 3373 rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW,
@@ -3443,16 +3421,16 @@ void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw)
3443 rtl_set_bbreg(hw, 0xB30, 0x00F00000, 0x0); 3421 rtl_set_bbreg(hw, 0xB30, 0x00F00000, 0x0);
3444 /* TX BB gain shift,Just for testchip,0xc80,0xc88 */ 3422 /* TX BB gain shift,Just for testchip,0xc80,0xc88 */
3445 if (rtlefuse->internal_pa_5g[0]) 3423 if (rtlefuse->internal_pa_5g[0])
3446 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, MASKDWORD, 3424 rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, MASKDWORD,
3447 0x2d4000b5); 3425 0x2d4000b5);
3448 else 3426 else
3449 rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, MASKDWORD, 3427 rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, MASKDWORD,
3450 0x20000080); 3428 0x20000080);
3451 if (rtlefuse->internal_pa_5g[1]) 3429 if (rtlefuse->internal_pa_5g[1])
3452 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, MASKDWORD, 3430 rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, MASKDWORD,
3453 0x2d4000b5); 3431 0x2d4000b5);
3454 else 3432 else
3455 rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, MASKDWORD, 3433 rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, MASKDWORD,
3456 0x20000080); 3434 0x20000080);
3457 if (rtlhal->macphymode == DUALMAC_DUALPHY) { 3435 if (rtlhal->macphymode == DUALMAC_DUALPHY) {
3458 rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, 3436 rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW,
@@ -3481,10 +3459,10 @@ void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw)
3481 /* update IQK related settings */ 3459 /* update IQK related settings */
3482 rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, MASKDWORD, 0x40000100); 3460 rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, MASKDWORD, 0x40000100);
3483 rtl_set_bbreg(hw, ROFDM0_XBRXIQIMBALANCE, MASKDWORD, 0x40000100); 3461 rtl_set_bbreg(hw, ROFDM0_XBRXIQIMBALANCE, MASKDWORD, 0x40000100);
3484 rtl_set_bbreg(hw, ROFDM0_XCTxAFE, 0xF0000000, 0x00); 3462 rtl_set_bbreg(hw, ROFDM0_XCTXAFE, 0xF0000000, 0x00);
3485 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(30) | BIT(28) | 3463 rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(30) | BIT(28) |
3486 BIT(26) | BIT(24), 0x00); 3464 BIT(26) | BIT(24), 0x00);
3487 rtl_set_bbreg(hw, ROFDM0_XDTxAFE, 0xF0000000, 0x00); 3465 rtl_set_bbreg(hw, ROFDM0_XDTXAFE, 0xF0000000, 0x00);
3488 rtl_set_bbreg(hw, 0xca0, 0xF0000000, 0x00); 3466 rtl_set_bbreg(hw, 0xca0, 0xF0000000, 0x00);
3489 rtl_set_bbreg(hw, ROFDM0_AGCRSSITABLE, 0x0000F000, 0x00); 3467 rtl_set_bbreg(hw, ROFDM0_AGCRSSITABLE, 0x0000F000, 0x00);
3490 3468
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h
index 58b56b523dbe..8d07c783a023 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92D_PHY_H__ 4#ifndef __RTL92D_PHY_H__
27#define __RTL92D_PHY_H__ 5#define __RTL92D_PHY_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/reg.h
index d4c4e76a9244..2783d7e7b227 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/reg.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92D_REG_H__ 4#ifndef __RTL92D_REG_H__
27#define __RTL92D_REG_H__ 5#define __RTL92D_REG_H__
@@ -752,7 +730,7 @@
752 730
753/* SYS_FUNC_EN */ 731/* SYS_FUNC_EN */
754#define FEN_BBRSTB BIT(0) 732#define FEN_BBRSTB BIT(0)
755#define FEN_BB_GLB_RSTn BIT(1) 733#define FEN_BB_GLB_RSTN BIT(1)
756#define FEN_USBA BIT(2) 734#define FEN_USBA BIT(2)
757#define FEN_UPLL BIT(3) 735#define FEN_UPLL BIT(3)
758#define FEN_USBD BIT(4) 736#define FEN_USBD BIT(4)
@@ -773,7 +751,7 @@
773#define PFM_ALDN BIT(1) 751#define PFM_ALDN BIT(1)
774#define PFM_LDKP BIT(2) 752#define PFM_LDKP BIT(2)
775#define PFM_WOWL BIT(3) 753#define PFM_WOWL BIT(3)
776#define EnPDN BIT(4) 754#define ENPDN BIT(4)
777#define PDN_PL BIT(5) 755#define PDN_PL BIT(5)
778#define APFM_ONMAC BIT(8) 756#define APFM_ONMAC BIT(8)
779#define APFM_OFF BIT(9) 757#define APFM_OFF BIT(9)
@@ -910,7 +888,7 @@
910/* MCUFWDL */ 888/* MCUFWDL */
911#define MCUFWDL_EN BIT(0) 889#define MCUFWDL_EN BIT(0)
912#define MCUFWDL_RDY BIT(1) 890#define MCUFWDL_RDY BIT(1)
913#define FWDL_ChkSum_rpt BIT(2) 891#define FWDL_CHKSUM_RPT BIT(2)
914#define MACINI_RDY BIT(3) 892#define MACINI_RDY BIT(3)
915#define BBINI_RDY BIT(4) 893#define BBINI_RDY BIT(4)
916#define RFINI_RDY BIT(5) 894#define RFINI_RDY BIT(5)
@@ -1033,7 +1011,7 @@
1033#define RFPGA0_XA_LSSIPARAMETER 0x840 1011#define RFPGA0_XA_LSSIPARAMETER 0x840
1034#define RFPGA0_XB_LSSIPARAMETER 0x844 1012#define RFPGA0_XB_LSSIPARAMETER 0x844
1035 1013
1036#define RFPGA0_RFWAkEUPPARAMETER 0x850 1014#define RFPGA0_RFWAKEUPPARAMETER 0x850
1037#define RFPGA0_RFSLEEPUPPARAMETER 0x854 1015#define RFPGA0_RFSLEEPUPPARAMETER 0x854
1038 1016
1039#define RFPGA0_XAB_SWITCHCONTROL 0x858 1017#define RFPGA0_XAB_SWITCHCONTROL 0x858
@@ -1135,14 +1113,14 @@
1135#define ROFDM0_AGCRSSITABLE 0xc78 1113#define ROFDM0_AGCRSSITABLE 0xc78
1136#define ROFDM0_HTSTFAGC 0xc7c 1114#define ROFDM0_HTSTFAGC 0xc7c
1137 1115
1138#define ROFDM0_XATxIQIMBALANCE 0xc80 1116#define ROFDM0_XATXIQIMBALANCE 0xc80
1139#define ROFDM0_XATxAFE 0xc84 1117#define ROFDM0_XATXAFE 0xc84
1140#define ROFDM0_XBTxIQIMBALANCE 0xc88 1118#define ROFDM0_XBTXIQIMBALANCE 0xc88
1141#define ROFDM0_XBTxAFE 0xc8c 1119#define ROFDM0_XBTXAFE 0xc8c
1142#define ROFDM0_XCTxIQIMBALANCE 0xc90 1120#define ROFDM0_XCTXIQIMBALANCE 0xc90
1143#define ROFDM0_XCTxAFE 0xc94 1121#define ROFDM0_XCTXAFE 0xc94
1144#define ROFDM0_XDTxIQIMBALANCE 0xc98 1122#define ROFDM0_XDTXIQIMBALANCE 0xc98
1145#define ROFDM0_XDTxAFE 0xc9c 1123#define ROFDM0_XDTXAFE 0xc9c
1146 1124
1147#define ROFDM0_RXHPPARAMETER 0xce0 1125#define ROFDM0_RXHPPARAMETER 0xce0
1148#define ROFDM0_TXPSEUDONOISEWGT 0xce4 1126#define ROFDM0_TXPSEUDONOISEWGT 0xce4
@@ -1186,7 +1164,7 @@
1186#define ROFDM_AGCREPORT 0xdd0 1164#define ROFDM_AGCREPORT 0xdd0
1187#define ROFDM_RXSNR 0xdd4 1165#define ROFDM_RXSNR 0xdd4
1188#define ROFDM_RXEVMCSI 0xdd8 1166#define ROFDM_RXEVMCSI 0xdd8
1189#define ROFDM_SIGReport 0xddc 1167#define ROFDM_SIGREPORT 0xddc
1190 1168
1191/* 8. PageE(0xE00) */ 1169/* 8. PageE(0xE00) */
1192#define RTXAGC_A_RATE18_06 0xe00 1170#define RTXAGC_A_RATE18_06 0xe00
@@ -1228,7 +1206,7 @@
1228#define RF_IPA 0x15 1206#define RF_IPA 0x15
1229#define RF_POW_ABILITY 0x17 1207#define RF_POW_ABILITY 0x17
1230#define RF_MODE_AG 0x18 1208#define RF_MODE_AG 0x18
1231#define rRfChannel 0x18 1209#define rfchannel 0x18
1232#define RF_CHNLBW 0x18 1210#define RF_CHNLBW 0x18
1233#define RF_TOP 0x19 1211#define RF_TOP 0x19
1234 1212
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c
index 021d3c538ac2..915a36f7af5e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.h
index c650a8dcdb26..4e646cc9ebc0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rf.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92D_RF_H__ 4#ifndef __RTL92D_RF_H__
27#define __RTL92D_RF_H__ 5#define __RTL92D_RF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
index d5ba2bace79b..99e5cd9a5c86 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.h
index fd7d036e9abc..19db4ce30e44 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92DE_SW_H__ 4#ifndef __RTL92DE_SW_H__
27#define __RTL92DE_SW_H__ 5#define __RTL92DE_SW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.c
index 4badb183cf35..9b35c65d91f2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.c
@@ -1,28 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 * Created on 2010/12/23, 6:38
25 *****************************************************************************/
26 3
27#include <linux/types.h> 4#include <linux/types.h>
28 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.h
index 7fefc483ec28..2a45082f441f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/table.h
@@ -1,28 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 * Created on 2010/ 5/18, 1:41
25 *****************************************************************************/
26 3
27#ifndef __RTL92DE_TABLE__H_ 4#ifndef __RTL92DE_TABLE__H_
28#define __RTL92DE_TABLE__H_ 5#define __RTL92DE_TABLE__H_
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
index d7b023cf7400..d162884a9e00 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -494,7 +472,7 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
494 stats->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) 472 stats->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1)
495 && (GET_RX_DESC_FAGGR(pdesc) == 1)); 473 && (GET_RX_DESC_FAGGR(pdesc) == 1));
496 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); 474 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
497 stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); 475 stats->rx_is40mhzpacket = (bool)GET_RX_DESC_BW(pdesc);
498 stats->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); 476 stats->is_ht = (bool)GET_RX_DESC_RXHT(pdesc);
499 rx_status->freq = hw->conf.chandef.chan->center_freq; 477 rx_status->freq = hw->conf.chandef.chan->center_freq;
500 rx_status->band = hw->conf.chandef.chan->band; 478 rx_status->band = hw->conf.chandef.chan->band;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
index f7f776539438..36820070fd76 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92DE_TRX_H__ 4#ifndef __RTL92DE_TRX_H__
27#define __RTL92DE_TRX_H__ 5#define __RTL92DE_TRX_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/def.h
index 9f7e7bb8610b..fe1b7cdab1d5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/def.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_DEF_H__ 4#ifndef __RTL92E_DEF_H__
27#define __RTL92E_DEF_H__ 5#define __RTL92E_DEF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c
index faed6e2dedf6..648f9108ed4b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.h
index 107d5a488fa8..ec48e5671b5b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/dm.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_DM_H__ 4#ifndef __RTL92E_DM_H__
27#define __RTL92E_DM_H__ 5#define __RTL92E_DM_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c
index 84a0d0eb72e1..7c5b54b71a92 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.h
index 6a2fbf20d579..cbfecea232a3 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 *****************************************************************************/
24 3
25#ifndef __RTL92E__FW__H__ 4#ifndef __RTL92E__FW__H__
26#define __RTL92E__FW__H__ 5#define __RTL92E__FW__H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
index 3f2295fdb02d..53011c2a44f5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.h
index 3a63bec9b0cc..fc224392615f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_HW_H__ 4#ifndef __RTL92E_HW_H__
27#define __RTL92E_HW_H__ 5#define __RTL92E_HW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c
index 96c64785108b..78202ad4036e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h
index 8ef640a2ef7f..6d775e14846f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/led.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_LED_H__ 4#ifndef __RTL92E_LED_H__
27#define __RTL92E_LED_H__ 5#define __RTL92E_LED_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c
index 8b072ee8e0d5..222abc41669c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h
index 49bd0e554c65..1a5dbc628379 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_PHY_H__ 4#ifndef __RTL92E_PHY_H__
27#define __RTL92E_PHY_H__ 5#define __RTL92E_PHY_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.c
index 1a701d007f0c..515c1c3d6b43 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "pwrseq.h" 4#include "pwrseq.h"
27 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.h
index c570801508cc..2ae8347f7ebb 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/pwrseq.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_PWRSEQ_H__ 4#ifndef __RTL92E_PWRSEQ_H__
27#define __RTL92E_PWRSEQ_H__ 5#define __RTL92E_PWRSEQ_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/reg.h
index 1eaa1fab550d..0164e006f43e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/reg.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_REG_H__ 4#ifndef __RTL92E_REG_H__
27#define __RTL92E_REG_H__ 5#define __RTL92E_REG_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c
index bc76a91da762..6b8ef680dc57 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.h
index 039c0133ad6b..d7b391599926 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/rf.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_RF_H__ 4#ifndef __RTL92E_RF_H__
27#define __RTL92E_RF_H__ 5#define __RTL92E_RF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
index 9ea62599ecbb..b6ee7dae5943 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.h
index 21433d0332d0..36e29a2da0fd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_SW_H__ 4#ifndef __RTL92E_SW_H__
27#define __RTL92E_SW_H__ 5#define __RTL92E_SW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.c
index abcdd0670fd8..fb66f610bf5d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.c
@@ -1,29 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#include "table.h" 4#include "table.h"
29u32 RTL8192EE_PHY_REG_ARRAY[] = { 5u32 RTL8192EE_PHY_REG_ARRAY[] = {
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.h
index bff9df88815d..0bc7ef58c3b9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/table.h
@@ -1,29 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#ifndef __RTL92E_TABLE__H_ 4#ifndef __RTL92E_TABLE__H_
29#define __RTL92E_TABLE__H_ 5#define __RTL92E_TABLE__H_
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
index 14d6e3fc5767..09cf8180e4ff 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -393,7 +371,7 @@ bool rtl92ee_rx_query_desc(struct ieee80211_hw *hw,
393 if (status->crc) 371 if (status->crc)
394 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 372 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
395 373
396 if (status->rx_is40Mhzpacket) 374 if (status->rx_is40mhzpacket)
397 rx_status->bw = RATE_INFO_BW_40; 375 rx_status->bw = RATE_INFO_BW_40;
398 376
399 if (status->is_ht) 377 if (status->is_ht)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
index 45df3e79f490..a9e5e620a653 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92E_TRX_H__ 4#ifndef __RTL92E_TRX_H__
27#define __RTL92E_TRX_H__ 5#define __RTL92E_TRX_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/def.h
index b5ba0554a0cd..bb6b60814762 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/def.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __REALTEK_92S_DEF_H__ 4#ifndef __REALTEK_92S_DEF_H__
26#define __REALTEK_92S_DEF_H__ 5#define __REALTEK_92S_DEF_H__
27 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.c
index 44f510a94b09..a6e4384ceea1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.h
index 3af07efed73a..b9c5a92c2bd0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/dm.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __RTL_92S_DM_H__ 4#ifndef __RTL_92S_DM_H__
26#define __RTL_92S_DM_H__ 5#define __RTL_92S_DM_H__
27 6
@@ -79,7 +58,7 @@ enum dm_ratr_sta {
79 58
80#define DM_DIG_HIGH_PWR_THRESH_HIGH 75 59#define DM_DIG_HIGH_PWR_THRESH_HIGH 75
81#define DM_DIG_HIGH_PWR_THRESH_LOW 70 60#define DM_DIG_HIGH_PWR_THRESH_LOW 70
82#define DM_DIG_MIN_Netcore 0x12 61#define DM_DIG_MIN_NETCORE 0x12
83 62
84void rtl92s_dm_watchdog(struct ieee80211_hw *hw); 63void rtl92s_dm_watchdog(struct ieee80211_hw *hw);
85void rtl92s_dm_init(struct ieee80211_hw *hw); 64void rtl92s_dm_init(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c
index e7b1d7c0f542..faa307a0b148 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -569,14 +547,14 @@ static bool _rtl92s_firmware_set_h2c_cmd(struct ieee80211_hw *hw, u8 h2c_cmd,
569 return true; 547 return true;
570} 548}
571 549
572void rtl92s_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 Mode) 550void rtl92s_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
573{ 551{
574 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 552 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
575 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 553 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
576 struct h2c_set_pwrmode_parm pwrmode; 554 struct h2c_set_pwrmode_parm pwrmode;
577 u16 max_wakeup_period = 0; 555 u16 max_wakeup_period = 0;
578 556
579 pwrmode.mode = Mode; 557 pwrmode.mode = mode;
580 pwrmode.flag_low_traffic_en = 0; 558 pwrmode.flag_low_traffic_en = 0;
581 pwrmode.flag_lpnav_en = 0; 559 pwrmode.flag_lpnav_en = 0;
582 pwrmode.flag_rf_low_snr_en = 0; 560 pwrmode.flag_rf_low_snr_en = 0;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.h
index 5827aa32cef0..99c6f7eefd85 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __REALTEK_FIRMWARE92S_H__ 4#ifndef __REALTEK_FIRMWARE92S_H__
26#define __REALTEK_FIRMWARE92S_H__ 5#define __REALTEK_FIRMWARE92S_H__
27 6
@@ -297,7 +276,7 @@ enum fw_h2c_cmd {
297 H2C_JOINBSS_CMD, 276 H2C_JOINBSS_CMD,
298 H2C_DISCONNECT_CMD, /*15*/ 277 H2C_DISCONNECT_CMD, /*15*/
299 H2C_CREATEBSS_CMD, 278 H2C_CREATEBSS_CMD,
300 H2C_SETOPMode_CMD, 279 H2C_SETOPMODE_CMD,
301 H2C_SITESURVEY_CMD, 280 H2C_SITESURVEY_CMD,
302 H2C_SETAUTH_CMD, 281 H2C_SETAUTH_CMD,
303 H2C_SETKEY_CMD, /*20*/ 282 H2C_SETKEY_CMD, /*20*/
@@ -336,10 +315,10 @@ enum fw_h2c_cmd {
336 315
337/* The following macros are used for FW 316/* The following macros are used for FW
338 * CMD map and parameter updated. */ 317 * CMD map and parameter updated. */
339#define FW_CMD_IO_CLR(rtlpriv, _Bit) \ 318#define FW_CMD_IO_CLR(rtlpriv, _bit) \
340 do { \ 319 do { \
341 udelay(1000); \ 320 udelay(1000); \
342 rtlpriv->rtlhal.fwcmd_iomap &= (~_Bit); \ 321 rtlpriv->rtlhal.fwcmd_iomap &= (~_bit); \
343 } while (0) 322 } while (0)
344 323
345#define FW_CMD_IO_UPDATE(rtlpriv, _val) \ 324#define FW_CMD_IO_UPDATE(rtlpriv, _val) \
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
index 30dea7b9bc17..6d6e8994460d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
@@ -258,7 +236,7 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
258 union aci_aifsn *p_aci_aifsn = (union aci_aifsn *)(&( 236 union aci_aifsn *p_aci_aifsn = (union aci_aifsn *)(&(
259 mac->ac[0].aifs)); 237 mac->ac[0].aifs));
260 u8 acm = p_aci_aifsn->f.acm; 238 u8 acm = p_aci_aifsn->f.acm;
261 u8 acm_ctrl = rtl_read_byte(rtlpriv, AcmHwCtrl); 239 u8 acm_ctrl = rtl_read_byte(rtlpriv, ACMHWCTRL);
262 240
263 acm_ctrl = acm_ctrl | ((rtlpci->acm_method == 2) ? 241 acm_ctrl = acm_ctrl | ((rtlpci->acm_method == 2) ?
264 0x0 : 0x1); 242 0x0 : 0x1);
@@ -266,13 +244,13 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
266 if (acm) { 244 if (acm) {
267 switch (e_aci) { 245 switch (e_aci) {
268 case AC0_BE: 246 case AC0_BE:
269 acm_ctrl |= AcmHw_BeqEn; 247 acm_ctrl |= ACMHW_BEQEN;
270 break; 248 break;
271 case AC2_VI: 249 case AC2_VI:
272 acm_ctrl |= AcmHw_ViqEn; 250 acm_ctrl |= ACMHW_VIQEN;
273 break; 251 break;
274 case AC3_VO: 252 case AC3_VO:
275 acm_ctrl |= AcmHw_VoqEn; 253 acm_ctrl |= ACMHW_VOQEN;
276 break; 254 break;
277 default: 255 default:
278 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, 256 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
@@ -283,13 +261,13 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
283 } else { 261 } else {
284 switch (e_aci) { 262 switch (e_aci) {
285 case AC0_BE: 263 case AC0_BE:
286 acm_ctrl &= (~AcmHw_BeqEn); 264 acm_ctrl &= (~ACMHW_BEQEN);
287 break; 265 break;
288 case AC2_VI: 266 case AC2_VI:
289 acm_ctrl &= (~AcmHw_ViqEn); 267 acm_ctrl &= (~ACMHW_VIQEN);
290 break; 268 break;
291 case AC3_VO: 269 case AC3_VO:
292 acm_ctrl &= (~AcmHw_VoqEn); 270 acm_ctrl &= (~ACMHW_VOQEN);
293 break; 271 break;
294 default: 272 default:
295 pr_err("switch case %#x not processed\n", 273 pr_err("switch case %#x not processed\n",
@@ -300,7 +278,7 @@ void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
300 278
301 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, 279 RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE,
302 "HW_VAR_ACM_CTRL Write 0x%X\n", acm_ctrl); 280 "HW_VAR_ACM_CTRL Write 0x%X\n", acm_ctrl);
303 rtl_write_byte(rtlpriv, AcmHwCtrl, acm_ctrl); 281 rtl_write_byte(rtlpriv, ACMHWCTRL, acm_ctrl);
304 break; 282 break;
305 } 283 }
306 case HW_VAR_RCR:{ 284 case HW_VAR_RCR:{
@@ -869,7 +847,7 @@ static void _rtl92se_macconfig_after_fwdownload(struct ieee80211_hw *hw)
869 /* 10. Power Save Control Register (Offset: 0x0260 - 0x02DF) */ 847 /* 10. Power Save Control Register (Offset: 0x0260 - 0x02DF) */
870 /* 11. General Purpose Register (Offset: 0x02E0 - 0x02FF) */ 848 /* 11. General Purpose Register (Offset: 0x02E0 - 0x02FF) */
871 /* 12. Host Interrupt Status Register (Offset: 0x0300 - 0x030F) */ 849 /* 12. Host Interrupt Status Register (Offset: 0x0300 - 0x030F) */
872 /* 13. Test Mode and Debug Control Register (Offset: 0x0310 - 0x034F) */ 850 /* 13. Test mode and Debug Control Register (Offset: 0x0310 - 0x034F) */
873 851
874 /* 14. Set driver info, we only accept PHY status now. */ 852 /* 14. Set driver info, we only accept PHY status now. */
875 rtl_write_byte(rtlpriv, RXDRVINFO_SZ, 4); 853 rtl_write_byte(rtlpriv, RXDRVINFO_SZ, 4);
@@ -1641,7 +1619,7 @@ void rtl92se_update_interrupt_mask(struct ieee80211_hw *hw,
1641 rtl92se_enable_interrupt(hw); 1619 rtl92se_enable_interrupt(hw);
1642} 1620}
1643 1621
1644static void _rtl8192se_get_IC_Inferiority(struct ieee80211_hw *hw) 1622static void _rtl8192se_get_ic_inferiority(struct ieee80211_hw *hw)
1645{ 1623{
1646 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 1624 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
1647 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1625 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -1704,7 +1682,7 @@ static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw)
1704 if (rtlefuse->autoload_failflag) 1682 if (rtlefuse->autoload_failflag)
1705 return; 1683 return;
1706 1684
1707 _rtl8192se_get_IC_Inferiority(hw); 1685 _rtl8192se_get_ic_inferiority(hw);
1708 1686
1709 /* Read IC Version && Channel Plan */ 1687 /* Read IC Version && Channel Plan */
1710 /* VID, DID SE 0xA-D */ 1688 /* VID, DID SE 0xA-D */
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.h
index fa836ceefc8f..5edbc1ecd261 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __REALTEK_PCI92SE_HW_H__ 4#ifndef __REALTEK_PCI92SE_HW_H__
26#define __REALTEK_PCI92SE_HW_H__ 5#define __REALTEK_PCI92SE_HW_H__
27 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c
index 33c307aca911..2d18bc1ee480 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h
index 90e265d9ffc6..c9e481a8d943 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/led.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __REALTEK_PCI92SE_LED_H__ 4#ifndef __REALTEK_PCI92SE_LED_H__
26#define __REALTEK_PCI92SE_LED_H__ 5#define __REALTEK_PCI92SE_LED_H__
27 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
index 86cb853f7169..d5c0eb462315 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -549,13 +527,13 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw,
549 RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { 527 RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) {
550 528
551 bool rtstatus; 529 bool rtstatus;
552 u32 InitializeCount = 0; 530 u32 initializecount = 0;
553 do { 531 do {
554 InitializeCount++; 532 initializecount++;
555 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 533 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
556 "IPS Set eRf nic enable\n"); 534 "IPS Set eRf nic enable\n");
557 rtstatus = rtl_ps_enable_nic(hw); 535 rtstatus = rtl_ps_enable_nic(hw);
558 } while (!rtstatus && (InitializeCount < 10)); 536 } while (!rtstatus && (initializecount < 10));
559 537
560 RT_CLEAR_PS_LEVEL(ppsc, 538 RT_CLEAR_PS_LEVEL(ppsc,
561 RT_RF_OFF_LEVL_HALT_NIC); 539 RT_RF_OFF_LEVL_HALT_NIC);
@@ -935,7 +913,7 @@ static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw)
935 913
936 if (!rtstatus) { 914 if (!rtstatus) {
937 pr_err("Write BB Reg Fail!!\n"); 915 pr_err("Write BB Reg Fail!!\n");
938 goto phy_BB8190_Config_ParaFile_Fail; 916 goto phy_bb8190_config_parafile_fail;
939 } 917 }
940 918
941 /* 2. If EEPROM or EFUSE autoload OK, We must config by 919 /* 2. If EEPROM or EFUSE autoload OK, We must config by
@@ -948,7 +926,7 @@ static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw)
948 } 926 }
949 if (!rtstatus) { 927 if (!rtstatus) {
950 pr_err("_rtl92s_phy_bb_config_parafile(): BB_PG Reg Fail!!\n"); 928 pr_err("_rtl92s_phy_bb_config_parafile(): BB_PG Reg Fail!!\n");
951 goto phy_BB8190_Config_ParaFile_Fail; 929 goto phy_bb8190_config_parafile_fail;
952 } 930 }
953 931
954 /* 3. BB AGC table Initialization */ 932 /* 3. BB AGC table Initialization */
@@ -956,7 +934,7 @@ static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw)
956 934
957 if (!rtstatus) { 935 if (!rtstatus) {
958 pr_err("%s(): AGC Table Fail\n", __func__); 936 pr_err("%s(): AGC Table Fail\n", __func__);
959 goto phy_BB8190_Config_ParaFile_Fail; 937 goto phy_bb8190_config_parafile_fail;
960 } 938 }
961 939
962 /* Check if the CCK HighPower is turned ON. */ 940 /* Check if the CCK HighPower is turned ON. */
@@ -964,7 +942,7 @@ static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw)
964 rtlphy->cck_high_power = (bool)(rtl92s_phy_query_bb_reg(hw, 942 rtlphy->cck_high_power = (bool)(rtl92s_phy_query_bb_reg(hw,
965 RFPGA0_XA_HSSIPARAMETER2, 0x200)); 943 RFPGA0_XA_HSSIPARAMETER2, 0x200));
966 944
967phy_BB8190_Config_ParaFile_Fail: 945phy_bb8190_config_parafile_fail:
968 return rtstatus; 946 return rtstatus;
969} 947}
970 948
@@ -1029,13 +1007,13 @@ bool rtl92s_phy_mac_config(struct ieee80211_hw *hw)
1029 struct rtl_priv *rtlpriv = rtl_priv(hw); 1007 struct rtl_priv *rtlpriv = rtl_priv(hw);
1030 u32 i; 1008 u32 i;
1031 u32 arraylength; 1009 u32 arraylength;
1032 u32 *ptraArray; 1010 u32 *ptrarray;
1033 1011
1034 arraylength = MAC_2T_ARRAYLENGTH; 1012 arraylength = MAC_2T_ARRAYLENGTH;
1035 ptraArray = rtl8192semac_2t_array; 1013 ptrarray = rtl8192semac_2t_array;
1036 1014
1037 for (i = 0; i < arraylength; i = i + 2) 1015 for (i = 0; i < arraylength; i = i + 2)
1038 rtl_write_byte(rtlpriv, ptraArray[i], (u8)ptraArray[i + 1]); 1016 rtl_write_byte(rtlpriv, ptrarray[i], (u8)ptrarray[i + 1]);
1039 1017
1040 return true; 1018 return true;
1041} 1019}
@@ -1128,7 +1106,7 @@ void rtl92s_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
1128} 1106}
1129 1107
1130static void _rtl92s_phy_get_txpower_index(struct ieee80211_hw *hw, u8 channel, 1108static void _rtl92s_phy_get_txpower_index(struct ieee80211_hw *hw, u8 channel,
1131 u8 *cckpowerlevel, u8 *ofdmpowerLevel) 1109 u8 *cckpowerlevel, u8 *ofdmpowerlevel)
1132{ 1110{
1133 struct rtl_priv *rtlpriv = rtl_priv(hw); 1111 struct rtl_priv *rtlpriv = rtl_priv(hw);
1134 struct rtl_phy *rtlphy = &(rtlpriv->phy); 1112 struct rtl_phy *rtlphy = &(rtlpriv->phy);
@@ -1144,15 +1122,15 @@ static void _rtl92s_phy_get_txpower_index(struct ieee80211_hw *hw, u8 channel,
1144 /* 2. OFDM for 1T or 2T */ 1122 /* 2. OFDM for 1T or 2T */
1145 if (rtlphy->rf_type == RF_1T2R || rtlphy->rf_type == RF_1T1R) { 1123 if (rtlphy->rf_type == RF_1T2R || rtlphy->rf_type == RF_1T1R) {
1146 /* Read HT 40 OFDM TX power */ 1124 /* Read HT 40 OFDM TX power */
1147 ofdmpowerLevel[0] = rtlefuse->txpwrlevel_ht40_1s[0][index]; 1125 ofdmpowerlevel[0] = rtlefuse->txpwrlevel_ht40_1s[0][index];
1148 ofdmpowerLevel[1] = rtlefuse->txpwrlevel_ht40_1s[1][index]; 1126 ofdmpowerlevel[1] = rtlefuse->txpwrlevel_ht40_1s[1][index];
1149 } else if (rtlphy->rf_type == RF_2T2R) { 1127 } else if (rtlphy->rf_type == RF_2T2R) {
1150 /* Read HT 40 OFDM TX power */ 1128 /* Read HT 40 OFDM TX power */
1151 ofdmpowerLevel[0] = rtlefuse->txpwrlevel_ht40_2s[0][index]; 1129 ofdmpowerlevel[0] = rtlefuse->txpwrlevel_ht40_2s[0][index];
1152 ofdmpowerLevel[1] = rtlefuse->txpwrlevel_ht40_2s[1][index]; 1130 ofdmpowerlevel[1] = rtlefuse->txpwrlevel_ht40_2s[1][index];
1153 } else { 1131 } else {
1154 ofdmpowerLevel[0] = 0; 1132 ofdmpowerlevel[0] = 0;
1155 ofdmpowerLevel[1] = 0; 1133 ofdmpowerlevel[1] = 0;
1156 } 1134 }
1157} 1135}
1158 1136
@@ -1171,7 +1149,7 @@ void rtl92s_phy_set_txpower(struct ieee80211_hw *hw, u8 channel)
1171 struct rtl_priv *rtlpriv = rtl_priv(hw); 1149 struct rtl_priv *rtlpriv = rtl_priv(hw);
1172 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); 1150 struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
1173 /* [0]:RF-A, [1]:RF-B */ 1151 /* [0]:RF-A, [1]:RF-B */
1174 u8 cckpowerlevel[2], ofdmpowerLevel[2]; 1152 u8 cckpowerlevel[2], ofdmpowerlevel[2];
1175 1153
1176 if (!rtlefuse->txpwr_fromeprom) 1154 if (!rtlefuse->txpwr_fromeprom)
1177 return; 1155 return;
@@ -1183,18 +1161,18 @@ void rtl92s_phy_set_txpower(struct ieee80211_hw *hw, u8 channel)
1183 * 1. For CCK. 1161 * 1. For CCK.
1184 * 2. For OFDM 1T or 2T */ 1162 * 2. For OFDM 1T or 2T */
1185 _rtl92s_phy_get_txpower_index(hw, channel, &cckpowerlevel[0], 1163 _rtl92s_phy_get_txpower_index(hw, channel, &cckpowerlevel[0],
1186 &ofdmpowerLevel[0]); 1164 &ofdmpowerlevel[0]);
1187 1165
1188 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1166 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1189 "Channel-%d, cckPowerLevel (A / B) = 0x%x / 0x%x, ofdmPowerLevel (A / B) = 0x%x / 0x%x\n", 1167 "Channel-%d, cckPowerLevel (A / B) = 0x%x / 0x%x, ofdmPowerLevel (A / B) = 0x%x / 0x%x\n",
1190 channel, cckpowerlevel[0], cckpowerlevel[1], 1168 channel, cckpowerlevel[0], cckpowerlevel[1],
1191 ofdmpowerLevel[0], ofdmpowerLevel[1]); 1169 ofdmpowerlevel[0], ofdmpowerlevel[1]);
1192 1170
1193 _rtl92s_phy_ccxpower_indexcheck(hw, channel, &cckpowerlevel[0], 1171 _rtl92s_phy_ccxpower_indexcheck(hw, channel, &cckpowerlevel[0],
1194 &ofdmpowerLevel[0]); 1172 &ofdmpowerlevel[0]);
1195 1173
1196 rtl92s_phy_rf6052_set_ccktxpower(hw, cckpowerlevel[0]); 1174 rtl92s_phy_rf6052_set_ccktxpower(hw, cckpowerlevel[0]);
1197 rtl92s_phy_rf6052_set_ofdmtxpower(hw, &ofdmpowerLevel[0], channel); 1175 rtl92s_phy_rf6052_set_ofdmtxpower(hw, &ofdmpowerlevel[0], channel);
1198 1176
1199} 1177}
1200 1178
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.h
index 7a3b6b623872..b8b5f097b67b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __RTL92S_PHY_H__ 4#ifndef __RTL92S_PHY_H__
26#define __RTL92S_PHY_H__ 5#define __RTL92S_PHY_H__
27 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/reg.h
index 5d445c2afcf3..45f968e0e57c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/reg.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __REALTEK_92S_REG_H__ 4#ifndef __REALTEK_92S_REG_H__
26#define __REALTEK_92S_REG_H__ 5#define __REALTEK_92S_REG_H__
27 6
@@ -190,7 +169,7 @@
190#define BCNTCFG 0x01E0 169#define BCNTCFG 0x01E0
191#define CWRR 0x01E2 170#define CWRR 0x01E2
192#define ACMAVG 0x01E4 171#define ACMAVG 0x01E4
193#define AcmHwCtrl 0x01E7 172#define ACMHWCTRL 0x01E7
194#define VO_ADMTM 0x01E8 173#define VO_ADMTM 0x01E8
195#define VI_ADMTM 0x01EC 174#define VI_ADMTM 0x01EC
196#define BE_ADMTM 0x01F0 175#define BE_ADMTM 0x01F0
@@ -256,7 +235,7 @@
256#define INTA_MASK 0x0300 235#define INTA_MASK 0x0300
257#define ISR 0x0308 236#define ISR 0x0308
258 237
259/* 13. Test Mode and Debug Control Registers */ 238/* 13. Test mode and Debug Control Registers */
260#define DBG_PORT_SWITCH 0x003A 239#define DBG_PORT_SWITCH 0x003A
261#define BIST 0x0310 240#define BIST 0x0310
262#define DBS 0x0314 241#define DBS 0x0314
@@ -346,9 +325,9 @@
346#define SYS_SWHW_SEL BIT(14) 325#define SYS_SWHW_SEL BIT(14)
347#define SYS_FWHW_SEL BIT(15) 326#define SYS_FWHW_SEL BIT(15)
348 327
349#define CmdEEPROM_En BIT(5) 328#define CMDEEPROM_EN BIT(5)
350#define CmdEERPOMSEL BIT(4) 329#define CMDEERPOMSEL BIT(4)
351#define Cmd9346CR_9356SEL BIT(4) 330#define CMD9346CR_9356SEL BIT(4)
352 331
353#define AFE_MBEN BIT(1) 332#define AFE_MBEN BIT(1)
354#define AFE_BGEN BIT(0) 333#define AFE_BGEN BIT(0)
@@ -369,9 +348,9 @@
369 348
370#define APLL_EN BIT(0) 349#define APLL_EN BIT(0)
371 350
372#define AFR_CardBEn BIT(0) 351#define AFR_CARDBEN BIT(0)
373#define AFR_CLKRUN_SEL BIT(1) 352#define AFR_CLKRUN_SEL BIT(1)
374#define AFR_FuncRegEn BIT(2) 353#define AFR_FUNCREGEN BIT(2)
375 354
376#define APSDOFF_STATUS BIT(15) 355#define APSDOFF_STATUS BIT(15)
377#define APSDOFF BIT(14) 356#define APSDOFF BIT(14)
@@ -387,13 +366,13 @@
387#define HCI_RXDMA_EN BIT(3) 366#define HCI_RXDMA_EN BIT(3)
388#define HCI_TXDMA_EN BIT(2) 367#define HCI_TXDMA_EN BIT(2)
389 368
390#define StopHCCA BIT(6) 369#define STOPHCCA BIT(6)
391#define StopHigh BIT(5) 370#define STOPHIGH BIT(5)
392#define StopMgt BIT(4) 371#define STOPMGT BIT(4)
393#define StopVO BIT(3) 372#define STOPVO BIT(3)
394#define StopVI BIT(2) 373#define STOPVI BIT(2)
395#define StopBE BIT(1) 374#define STOPBE BIT(1)
396#define StopBK BIT(0) 375#define STOPBK BIT(0)
397 376
398#define LBK_NORMAL 0x00 377#define LBK_NORMAL 0x00
399#define LBK_MAC_LB (BIT(0) | BIT(1) | BIT(3)) 378#define LBK_MAC_LB (BIT(0) | BIT(1) | BIT(3))
@@ -405,7 +384,7 @@
405#define TXDMAPRE2FULL BIT(23) 384#define TXDMAPRE2FULL BIT(23)
406#define DISCW BIT(20) 385#define DISCW BIT(20)
407#define TCRICV BIT(19) 386#define TCRICV BIT(19)
408#define CfendForm BIT(17) 387#define cfendform BIT(17)
409#define TCRCRC BIT(16) 388#define TCRCRC BIT(16)
410#define FAKE_IMEM_EN BIT(15) 389#define FAKE_IMEM_EN BIT(15)
411#define TSFRST BIT(9) 390#define TSFRST BIT(9)
@@ -530,7 +509,7 @@
530#define RRSR_MCS5 BIT(17) 509#define RRSR_MCS5 BIT(17)
531#define RRSR_MCS6 BIT(18) 510#define RRSR_MCS6 BIT(18)
532#define RRSR_MCS7 BIT(19) 511#define RRSR_MCS7 BIT(19)
533#define BRSR_AckShortPmb BIT(23) 512#define BRSR_ACKSHORTPMB BIT(23)
534 513
535#define RATR_1M 0x00000001 514#define RATR_1M 0x00000001
536#define RATR_2M 0x00000002 515#define RATR_2M 0x00000002
@@ -581,13 +560,13 @@
581#define AC_PARAM_ECW_MIN_OFFSET 8 560#define AC_PARAM_ECW_MIN_OFFSET 8
582#define AC_PARAM_AIFS_OFFSET 0 561#define AC_PARAM_AIFS_OFFSET 0
583 562
584#define AcmHw_HwEn BIT(0) 563#define ACMHW_HWEN BIT(0)
585#define AcmHw_BeqEn BIT(1) 564#define ACMHW_BEQEN BIT(1)
586#define AcmHw_ViqEn BIT(2) 565#define ACMHW_VIQEN BIT(2)
587#define AcmHw_VoqEn BIT(3) 566#define ACMHW_VOQEN BIT(3)
588#define AcmHw_BeqStatus BIT(4) 567#define ACMHW_BEQSTATUS BIT(4)
589#define AcmHw_ViqStatus BIT(5) 568#define ACMHW_VIQSTATUS BIT(5)
590#define AcmHw_VoqStatus BIT(6) 569#define ACMHW_VOQSTATUS BIT(6)
591 570
592#define RETRY_LIMIT_SHORT_SHIFT 8 571#define RETRY_LIMIT_SHORT_SHIFT 8
593#define RETRY_LIMIT_LONG_SHIFT 0 572#define RETRY_LIMIT_LONG_SHIFT 0
@@ -845,7 +824,7 @@
845#define TCR_SAT BIT(24) 824#define TCR_SAT BIT(24)
846#define RCR_MXDMA_OFFSET 8 825#define RCR_MXDMA_OFFSET 8
847#define RCR_FIFO_OFFSET 13 826#define RCR_FIFO_OFFSET 13
848#define RCR_OnlyErlPkt BIT(31) 827#define RCR_ONLYERLPKT BIT(31)
849#define CWR 0xDC 828#define CWR 0xDC
850#define RETRYCTR 0xDE 829#define RETRYCTR 0xDE
851 830
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c
index ea5b8ec45ec9..a37855f57e76 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.h
index e9ba283d05ad..a5959a228a35 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rf.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __INC_RTL92S_RF_H 4#ifndef __INC_RTL92S_RF_H
26#define __INC_RTL92S_RF_H 5#define __INC_RTL92S_RF_H
27 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
index d55554b7fa9a..d1d84e7d47a4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.h
index af449d6714e6..a31efba0e6b5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.h
@@ -1,25 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 *****************************************************************************/
23#ifndef __REALTEK_PCI92SE_SW_H__ 4#ifndef __REALTEK_PCI92SE_SW_H__
24#define __REALTEK_PCI92SE_SW_H__ 5#define __REALTEK_PCI92SE_SW_H__
25 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.c
index 162578f05c85..776e28e99d53 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.c
@@ -1,28 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 * Created on 2010/ 5/18, 1:41
25 *****************************************************************************/
26 3
27#include "table.h" 4#include "table.h"
28 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.h
index aa3c7687d226..4fd09f11f5bc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/table.h
@@ -1,20 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * Copyright(c) 2008 - 2012 Realtek Corporation. All rights reserved. 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * 3
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
6 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
7 * more details.
8 *
9 * The full GNU General Public License is included in this distribution in the
10 * file called LICENSE.
11 *
12 * Contact Information:
13 * wlanfae <wlanfae@realtek.com>
14 *
15 * Larry Finger <Larry.Finger@lwfinger.net>
16 *
17 ******************************************************************************/
18#ifndef __INC_HAL8192SE_FW_IMG_H 4#ifndef __INC_HAL8192SE_FW_IMG_H
19#define __INC_HAL8192SE_FW_IMG_H 5#define __INC_HAL8192SE_FW_IMG_H
20 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c
index e1904c39f147..efb432c6d785 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -275,7 +253,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
275 stats->isfirst_ampdu = (bool) ((GET_RX_STATUS_DESC_PAGGR(pdesc) == 1) 253 stats->isfirst_ampdu = (bool) ((GET_RX_STATUS_DESC_PAGGR(pdesc) == 1)
276 && (GET_RX_STATUS_DESC_FAGGR(pdesc) == 1)); 254 && (GET_RX_STATUS_DESC_FAGGR(pdesc) == 1));
277 stats->timestamp_low = GET_RX_STATUS_DESC_TSFL(pdesc); 255 stats->timestamp_low = GET_RX_STATUS_DESC_TSFL(pdesc);
278 stats->rx_is40Mhzpacket = (bool)GET_RX_STATUS_DESC_BW(pdesc); 256 stats->rx_is40mhzpacket = (bool)GET_RX_STATUS_DESC_BW(pdesc);
279 stats->is_ht = (bool)GET_RX_STATUS_DESC_RX_HT(pdesc); 257 stats->is_ht = (bool)GET_RX_STATUS_DESC_RX_HT(pdesc);
280 stats->is_cck = SE_RX_HAL_IS_CCK_RATE(pdesc); 258 stats->is_cck = SE_RX_HAL_IS_CCK_RATE(pdesc);
281 259
@@ -288,7 +266,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
288 if (stats->crc) 266 if (stats->crc)
289 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 267 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
290 268
291 if (stats->rx_is40Mhzpacket) 269 if (stats->rx_is40mhzpacket)
292 rx_status->bw = RATE_INFO_BW_40; 270 rx_status->bw = RATE_INFO_BW_40;
293 271
294 if (stats->is_ht) 272 if (stats->is_ht)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.h
index 81a5445c04a3..90aa12fc6a7f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.h
@@ -1,27 +1,6 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#ifndef __REALTEK_PCI92SE_TRX_H__ 4#ifndef __REALTEK_PCI92SE_TRX_H__
26#define __REALTEK_PCI92SE_TRX_H__ 5#define __REALTEK_PCI92SE_TRX_H__
27 6
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/btc.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/btc.h
index 06c448c010fd..20a67dcc59cb 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/btc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/btc.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 ** 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 ** Copyright(c) 2009-2012 Realtek Corporation.
4 **
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
7 ** published by the Free Software Foundation.
8 **
9 ** This program is distributed in the hope that it will be useful, but WITHOUT
10 ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 ** more details.
13 **
14 ** The full GNU General Public License is included in this distribution in the
15 ** file called LICENSE.
16 **
17 ** Contact Information:
18 ** wlanfae <wlanfae@realtek.com>
19 ** Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 ** Hsinchu 300, Taiwan.
21 ** Larry Finger <Larry.Finger@lwfinger.net>
22 **
23 ******************************************************************************/
24 3
25#ifndef __RTL8723E_BTC_H__ 4#ifndef __RTL8723E_BTC_H__
26#define __RTL8723E_BTC_H__ 5#define __RTL8723E_BTC_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/def.h
index 847544817549..42958df6b5d4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/def.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_DEF_H__ 4#ifndef __RTL8723E_DEF_H__
27#define __RTL8723E_DEF_H__ 5#define __RTL8723E_DEF_H__
@@ -116,7 +94,7 @@
116#define IS_VENDOR_8723A_B_CUT(version) ((IS_8723_SERIES(version))\ 94#define IS_VENDOR_8723A_B_CUT(version) ((IS_8723_SERIES(version))\
117 ? ((GET_CVID_CUT_VERSION(version) == \ 95 ? ((GET_CVID_CUT_VERSION(version) == \
118 B_CUT_VERSION) ? true : false) : false) 96 B_CUT_VERSION) ? true : false) : false)
119#define IS_81xxC_VENDOR_UMC_B_CUT(version) ((IS_CHIP_VENDOR_UMC(version))\ 97#define IS_81XXC_VENDOR_UMC_B_CUT(version) ((IS_CHIP_VENDOR_UMC(version))\
120 ? ((GET_CVID_CUT_VERSION(version) == \ 98 ? ((GET_CVID_CUT_VERSION(version) == \
121 B_CUT_VERSION) ? true : false) : false) 99 B_CUT_VERSION) ? true : false) : false)
122 100
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c
index acfd54c6f8dd..514891ea2c64 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.h
index a113780af08a..bcad516f0d28 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/dm.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_DM_H__ 4#ifndef __RTL8723E_DM_H__
27#define __RTL8723E_DM_H__ 5#define __RTL8723E_DM_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c
index bf9859f74b6f..be451a6f7dbe 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.h
index 2e668fcfc5c2..5c843736de8d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 *****************************************************************************/
24 3
25#ifndef __RTL92C__FW__H__ 4#ifndef __RTL92C__FW__H__
26#define __RTL92C__FW__H__ 5#define __RTL92C__FW__H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.c
index 5aac45d5a974..3ac31ec26517 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "hal_bt_coexist.h" 4#include "hal_bt_coexist.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.h
index 45719fdcb067..0455a3712f3e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_bt_coexist.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 *****************************************************************************/
24 3
25#ifndef __RTL8723E_HAL_BT_COEXIST_H__ 4#ifndef __RTL8723E_HAL_BT_COEXIST_H__
26#define __RTL8723E_HAL_BT_COEXIST_H__ 5#define __RTL8723E_HAL_BT_COEXIST_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c
index 788de88ab1ee..a6b31dae5691 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c
@@ -1,27 +1,6 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#include "hal_btc.h" 4#include "hal_btc.h"
26#include "../pci.h" 5#include "../pci.h"
27#include "phy.h" 6#include "phy.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.h
index 756868897d8b..620677128f11 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 *****************************************************************************/
24 3
25#ifndef __RTL8723E_HAL_BTC_H__ 4#ifndef __RTL8723E_HAL_BTC_H__
26#define __RTL8723E_HAL_BTC_H__ 5#define __RTL8723E_HAL_BTC_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
index f783e4a8083d..6bab162e1bb8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
@@ -698,7 +676,7 @@ static bool _rtl8712e_init_mac(struct ieee80211_hw *hw)
698 676
699 /* HW Power on sequence */ 677 /* HW Power on sequence */
700 if (!rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, 678 if (!rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
701 PWR_INTF_PCI_MSK, Rtl8723_NIC_ENABLE_FLOW)) 679 PWR_INTF_PCI_MSK, RTL8723_NIC_ENABLE_FLOW))
702 return false; 680 return false;
703 681
704 bytetmp = rtl_read_byte(rtlpriv, REG_PCIE_CTRL_REG+2); 682 bytetmp = rtl_read_byte(rtlpriv, REG_PCIE_CTRL_REG+2);
@@ -988,7 +966,7 @@ int rtl8723e_hw_init(struct ieee80211_hw *hw)
988 if (IS_VENDOR_UMC_A_CUT(rtlhal->version)) { 966 if (IS_VENDOR_UMC_A_CUT(rtlhal->version)) {
989 rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, 0x30255); 967 rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, 0x30255);
990 rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G2, MASKDWORD, 0x50a00); 968 rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G2, MASKDWORD, 0x50a00);
991 } else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) { 969 } else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version)) {
992 rtl_set_rfreg(hw, RF90_PATH_A, 0x0C, MASKDWORD, 0x894AE); 970 rtl_set_rfreg(hw, RF90_PATH_A, 0x0C, MASKDWORD, 0x894AE);
993 rtl_set_rfreg(hw, RF90_PATH_A, 0x0A, MASKDWORD, 0x1AF31); 971 rtl_set_rfreg(hw, RF90_PATH_A, 0x0A, MASKDWORD, 0x1AF31);
994 rtl_set_rfreg(hw, RF90_PATH_A, RF_IPA, MASKDWORD, 0x8F425); 972 rtl_set_rfreg(hw, RF90_PATH_A, RF_IPA, MASKDWORD, 0x8F425);
@@ -1284,7 +1262,7 @@ static void _rtl8723e_poweroff_adapter(struct ieee80211_hw *hw)
1284 /* Combo (PCIe + USB) Card and PCIe-MF Card */ 1262 /* Combo (PCIe + USB) Card and PCIe-MF Card */
1285 /* 1. Run LPS WL RFOFF flow */ 1263 /* 1. Run LPS WL RFOFF flow */
1286 rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, 1264 rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
1287 PWR_INTF_PCI_MSK, Rtl8723_NIC_LPS_ENTER_FLOW); 1265 PWR_INTF_PCI_MSK, RTL8723_NIC_LPS_ENTER_FLOW);
1288 1266
1289 /* 2. 0x1F[7:0] = 0 */ 1267 /* 2. 0x1F[7:0] = 0 */
1290 /* turn off RF */ 1268 /* turn off RF */
@@ -1304,7 +1282,7 @@ static void _rtl8723e_poweroff_adapter(struct ieee80211_hw *hw)
1304 1282
1305 /* HW card disable configuration. */ 1283 /* HW card disable configuration. */
1306 rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, 1284 rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
1307 PWR_INTF_PCI_MSK, Rtl8723_NIC_DISABLE_FLOW); 1285 PWR_INTF_PCI_MSK, RTL8723_NIC_DISABLE_FLOW);
1308 1286
1309 /* Reset MCU IO Wrapper */ 1287 /* Reset MCU IO Wrapper */
1310 u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1); 1288 u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.h
index c76e453f4f43..cf55f45d0779 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_HW_H__ 4#ifndef __RTL8723E_HW_H__
27#define __RTL8723E_HW_H__ 5#define __RTL8723E_HW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c
index d567b0df0e9f..5e503dbc463b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h
index c22b19f542a6..9f85845d23cd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/led.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92CE_LED_H__ 4#ifndef __RTL92CE_LED_H__
27#define __RTL92CE_LED_H__ 5#define __RTL92CE_LED_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c
index 3f3327878b51..54a3aec1dfa7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -905,7 +883,7 @@ static void _rtl8723e_phy_sw_rf_seting(struct ieee80211_hw *hw, u8 channel)
905 struct rtl_phy *rtlphy = &rtlpriv->phy; 883 struct rtl_phy *rtlphy = &rtlpriv->phy;
906 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 884 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
907 885
908 if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) { 886 if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version)) {
909 if (channel == 6 && rtlphy->current_chan_bw == 887 if (channel == 6 && rtlphy->current_chan_bw ==
910 HT_CHANNEL_WIDTH_20) 888 HT_CHANNEL_WIDTH_20)
911 rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, 889 rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.h
index b85f5c7c5c01..98bfe02f66d5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/phy.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL92C_PHY_H__ 4#ifndef __RTL92C_PHY_H__
27#define __RTL92C_PHY_H__ 5#define __RTL92C_PHY_H__
@@ -48,7 +26,7 @@
48#define MAX_STALL_TIME 50 26#define MAX_STALL_TIME 50
49#define ANTENNADIVERSITYVALUE 0x80 27#define ANTENNADIVERSITYVALUE 0x80
50#define MAX_TXPWR_IDX_NMODE_92S 63 28#define MAX_TXPWR_IDX_NMODE_92S 63
51#define Reset_Cnt_Limit 3 29#define reset_cnt_limit 3
52 30
53#define IQK_ADDA_REG_NUM 16 31#define IQK_ADDA_REG_NUM 16
54#define IQK_MAC_REG_NUM 4 32#define IQK_MAC_REG_NUM 4
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.c
index 2f7f81af8a55..041e3113a500 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../pwrseqcmd.h" 4#include "../pwrseqcmd.h"
27#include "pwrseq.h" 5#include "pwrseq.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.h
index e6c3aac3e9fd..d9247a8f3039 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/pwrseq.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_PWRSEQ_H__ 4#ifndef __RTL8723E_PWRSEQ_H__
27#define __RTL8723E_PWRSEQ_H__ 5#define __RTL8723E_PWRSEQ_H__
@@ -327,14 +305,14 @@ extern struct wlan_pwr_cfg rtl8723A_leave_lps_flow
327 [RTL8723A_TRANS_LPS_TO_ACT_STEPS + RTL8723A_TRANS_END_STEPS]; 305 [RTL8723A_TRANS_LPS_TO_ACT_STEPS + RTL8723A_TRANS_END_STEPS];
328 306
329/* RTL8723 Power Configuration CMDs for PCIe interface */ 307/* RTL8723 Power Configuration CMDs for PCIe interface */
330#define Rtl8723_NIC_PWR_ON_FLOW rtl8723A_power_on_flow 308#define RTL8723_NIC_PWR_ON_FLOW rtl8723A_power_on_flow
331#define Rtl8723_NIC_RF_OFF_FLOW rtl8723A_radio_off_flow 309#define RTL8723_NIC_RF_OFF_FLOW rtl8723A_radio_off_flow
332#define Rtl8723_NIC_DISABLE_FLOW rtl8723A_card_disable_flow 310#define RTL8723_NIC_DISABLE_FLOW rtl8723A_card_disable_flow
333#define Rtl8723_NIC_ENABLE_FLOW rtl8723A_card_enable_flow 311#define RTL8723_NIC_ENABLE_FLOW rtl8723A_card_enable_flow
334#define Rtl8723_NIC_SUSPEND_FLOW rtl8723A_suspend_flow 312#define RTL8723_NIC_SUSPEND_FLOW rtl8723A_suspend_flow
335#define Rtl8723_NIC_RESUME_FLOW rtl8723A_resume_flow 313#define RTL8723_NIC_RESUME_FLOW rtl8723A_resume_flow
336#define Rtl8723_NIC_PDN_FLOW rtl8723A_hwpdn_flow 314#define RTL8723_NIC_PDN_FLOW rtl8723A_hwpdn_flow
337#define Rtl8723_NIC_LPS_ENTER_FLOW rtl8723A_enter_lps_flow 315#define RTL8723_NIC_LPS_ENTER_FLOW rtl8723A_enter_lps_flow
338#define Rtl8723_NIC_LPS_LEAVE_FLOW rtl8723A_leave_lps_flow 316#define RTL8723_NIC_LPS_LEAVE_FLOW rtl8723A_leave_lps_flow
339 317
340#endif 318#endif
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/reg.h
index 30938cd9fce5..8696614c7cdd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/reg.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_REG_H__ 4#ifndef __RTL8723E_REG_H__
27#define __RTL8723E_REG_H__ 5#define __RTL8723E_REG_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c
index 89958b64b52d..9058527a7f94 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.h
index 7b44ebc0fac9..b445cfe65bf4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rf.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_RF_H__ 4#ifndef __RTL8723E_RF_H__
27#define __RTL8723E_RF_H__ 5#define __RTL8723E_RF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
index 3103151dda2b..4b370410c83c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
@@ -175,7 +153,7 @@ int rtl8723e_init_sw_vars(struct ieee80211_hw *hw)
175 return 1; 153 return 1;
176 } 154 }
177 155
178 if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) 156 if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version))
179 fw_name = "rtlwifi/rtl8723fw_B.bin"; 157 fw_name = "rtlwifi/rtl8723fw_B.bin";
180 158
181 rtlpriv->max_fw_size = 0x6000; 159 rtlpriv->max_fw_size = 0x6000;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.h
index 46478780d262..200ce39a0dd7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_SW_H__ 4#ifndef __RTL8723E_SW_H__
27#define __RTL8723E_SW_H__ 5#define __RTL8723E_SW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.c
index 1bbee0bfac23..d895694be023 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.c
@@ -1,29 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#include "table.h" 4#include "table.h"
29 5
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.h
index a044f3c456fa..4897dbc73b9f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/table.h
@@ -1,29 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#ifndef __RTL8723E_TABLE__H_ 4#ifndef __RTL8723E_TABLE__H_
29#define __RTL8723E_TABLE__H_ 5#define __RTL8723E_TABLE__H_
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c
index d461d0c9631f..90dc91b0d35b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -302,7 +280,7 @@ bool rtl8723e_rx_query_desc(struct ieee80211_hw *hw,
302 status->isfirst_ampdu = (bool)((GET_RX_DESC_PAGGR(pdesc) == 1) && 280 status->isfirst_ampdu = (bool)((GET_RX_DESC_PAGGR(pdesc) == 1) &&
303 (GET_RX_DESC_FAGGR(pdesc) == 1)); 281 (GET_RX_DESC_FAGGR(pdesc) == 1));
304 status->timestamp_low = GET_RX_DESC_TSFL(pdesc); 282 status->timestamp_low = GET_RX_DESC_TSFL(pdesc);
305 status->rx_is40Mhzpacket = (bool)GET_RX_DESC_BW(pdesc); 283 status->rx_is40mhzpacket = (bool)GET_RX_DESC_BW(pdesc);
306 status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); 284 status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc);
307 285
308 status->is_cck = RX_HAL_IS_CCK_RATE(status->rate); 286 status->is_cck = RX_HAL_IS_CCK_RATE(status->rate);
@@ -316,7 +294,7 @@ bool rtl8723e_rx_query_desc(struct ieee80211_hw *hw,
316 if (status->crc) 294 if (status->crc)
317 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 295 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
318 296
319 if (status->rx_is40Mhzpacket) 297 if (status->rx_is40mhzpacket)
320 rx_status->bw = RATE_INFO_BW_40; 298 rx_status->bw = RATE_INFO_BW_40;
321 299
322 if (status->is_ht) 300 if (status->is_ht)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h
index d592b08d4ac8..4a19ea76b290 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723E_TRX_H__ 4#ifndef __RTL8723E_TRX_H__
27#define __RTL8723E_TRX_H__ 5#define __RTL8723E_TRX_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/def.h
index 5e5403d69220..f4886c868df8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/def.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_DEF_H__ 4#ifndef __RTL8723BE_DEF_H__
27#define __RTL8723BE_DEF_H__ 5#define __RTL8723BE_DEF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c
index 47e87a21ae27..ef355aa88117 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.h
index f752a2cad63d..c4f36e951747 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.h
@@ -1,24 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * Contact Information:
15 * wlanfae <wlanfae@realtek.com>
16 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
17 * Hsinchu 300, Taiwan.
18 *
19 * Larry Finger <Larry.Finger@lwfinger.net>
20 *
21 *****************************************************************************/
22 3
23#ifndef __RTL8723BE_DM_H__ 4#ifndef __RTL8723BE_DM_H__
24#define __RTL8723BE_DM_H__ 5#define __RTL8723BE_DM_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c
index f2441fbb92f1..4d7fa27f55ca 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.h
index 948d28646364..97ea77464139 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 *****************************************************************************/
24 3
25#ifndef __RTL8723BE__FW__H__ 4#ifndef __RTL8723BE__FW__H__
26#define __RTL8723BE__FW__H__ 5#define __RTL8723BE__FW__H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
index b4f3f91b590e..979e5bfe5f45 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
@@ -319,12 +297,12 @@ void rtl8723be_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
319 *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; 297 *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state;
320 break; 298 break;
321 case HW_VAR_FWLPS_RF_ON:{ 299 case HW_VAR_FWLPS_RF_ON:{
322 enum rf_pwrstate rfState; 300 enum rf_pwrstate rfstate;
323 u32 val_rcr; 301 u32 val_rcr;
324 302
325 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE, 303 rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE,
326 (u8 *)(&rfState)); 304 (u8 *)(&rfstate));
327 if (rfState == ERFOFF) { 305 if (rfstate == ERFOFF) {
328 *((bool *)(val)) = true; 306 *((bool *)(val)) = true;
329 } else { 307 } else {
330 val_rcr = rtl_read_dword(rtlpriv, REG_RCR); 308 val_rcr = rtl_read_dword(rtlpriv, REG_RCR);
@@ -764,10 +742,10 @@ static bool _rtl8723be_llt_table_init(struct ieee80211_hw *hw)
764 struct rtl_priv *rtlpriv = rtl_priv(hw); 742 struct rtl_priv *rtlpriv = rtl_priv(hw);
765 unsigned short i; 743 unsigned short i;
766 u8 txpktbuf_bndy; 744 u8 txpktbuf_bndy;
767 u8 maxPage; 745 u8 maxpage;
768 bool status; 746 bool status;
769 747
770 maxPage = 255; 748 maxpage = 255;
771 txpktbuf_bndy = 245; 749 txpktbuf_bndy = 245;
772 750
773 rtl_write_dword(rtlpriv, REG_TRXFF_BNDY, 751 rtl_write_dword(rtlpriv, REG_TRXFF_BNDY,
@@ -792,13 +770,13 @@ static bool _rtl8723be_llt_table_init(struct ieee80211_hw *hw)
792 if (!status) 770 if (!status)
793 return status; 771 return status;
794 772
795 for (i = txpktbuf_bndy; i < maxPage; i++) { 773 for (i = txpktbuf_bndy; i < maxpage; i++) {
796 status = _rtl8723be_llt_write(hw, i, (i + 1)); 774 status = _rtl8723be_llt_write(hw, i, (i + 1));
797 if (!status) 775 if (!status)
798 return status; 776 return status;
799 } 777 }
800 778
801 status = _rtl8723be_llt_write(hw, maxPage, txpktbuf_bndy); 779 status = _rtl8723be_llt_write(hw, maxpage, txpktbuf_bndy);
802 if (!status) 780 if (!status)
803 return status; 781 return status;
804 782
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.h
index ae856a19e81a..eb797e9bb931 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_HW_H__ 4#ifndef __RTL8723BE_HW_H__
27#define __RTL8723BE_HW_H__ 5#define __RTL8723BE_HW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c
index 4f7890d62c21..525f2c47da5b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h
index c57de379ee8d..8ac59374b632 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/led.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_LED_H__ 4#ifndef __RTL8723BE_LED_H__
27#define __RTL8723BE_LED_H__ 5#define __RTL8723BE_LED_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
index 11f94b1a436f..aa8a0950fcea 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.h
index 9021d4745ab7..a59813ea7c72 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_PHY_H__ 4#ifndef __RTL8723BE_PHY_H__
27#define __RTL8723BE_PHY_H__ 5#define __RTL8723BE_PHY_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.c
index a1bb1f6116fb..95adac66676e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../pwrseqcmd.h" 4#include "../pwrseqcmd.h"
27#include "pwrseq.h" 5#include "pwrseq.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.h
index 3367cfbc9502..57eac4864184 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/pwrseq.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_PWRSEQ_H__ 4#ifndef __RTL8723BE_PWRSEQ_H__
27#define __RTL8723BE_PWRSEQ_H__ 5#define __RTL8723BE_PWRSEQ_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/reg.h
index 95c4f8e206c7..28fd22b2a792 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/reg.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_REG_H__ 4#ifndef __RTL8723BE_REG_H__
27#define __RTL8723BE_REG_H__ 5#define __RTL8723BE_REG_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c
index 48491454b878..af72e489e31c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.h
index f423e157020f..81537a1a4fdf 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_RF_H__ 4#ifndef __RTL8723BE_RF_H__
27#define __RTL8723BE_RF_H__ 5#define __RTL8723BE_RF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
index c9f7b042d9c6..00e6254bf82b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.h
index a7b25e769950..6ecacf9fbfd7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_SW_H__ 4#ifndef __RTL8723BE_SW_H__
27#define __RTL8723BE_SW_H__ 5#define __RTL8723BE_SW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.c
index 160fee8333ae..5864be89d187 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.c
@@ -1,29 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#include <linux/kernel.h> 4#include <linux/kernel.h>
29#include "table.h" 5#include "table.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.h
index 1deaffe22251..cf0c8d58cea1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/table.h
@@ -1,29 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#ifndef __RTL8723BE_TABLE__H_ 4#ifndef __RTL8723BE_TABLE__H_
29#define __RTL8723BE_TABLE__H_ 5#define __RTL8723BE_TABLE__H_
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c
index 9f8dfb5af774..9ada9a06c6ea 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -338,7 +316,7 @@ bool rtl8723be_rx_query_desc(struct ieee80211_hw *hw,
338 status->isampdu = (bool)(GET_RX_DESC_PAGGR(pdesc) == 1); 316 status->isampdu = (bool)(GET_RX_DESC_PAGGR(pdesc) == 1);
339 status->isfirst_ampdu = (bool)(GET_RX_DESC_PAGGR(pdesc) == 1); 317 status->isfirst_ampdu = (bool)(GET_RX_DESC_PAGGR(pdesc) == 1);
340 status->timestamp_low = GET_RX_DESC_TSFL(pdesc); 318 status->timestamp_low = GET_RX_DESC_TSFL(pdesc);
341 status->rx_is40Mhzpacket = (bool)GET_RX_DESC_BW(pdesc); 319 status->rx_is40mhzpacket = (bool)GET_RX_DESC_BW(pdesc);
342 status->bandwidth = (u8)GET_RX_DESC_BW(pdesc); 320 status->bandwidth = (u8)GET_RX_DESC_BW(pdesc);
343 status->macid = GET_RX_DESC_MACID(pdesc); 321 status->macid = GET_RX_DESC_MACID(pdesc);
344 status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); 322 status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc);
@@ -372,7 +350,7 @@ bool rtl8723be_rx_query_desc(struct ieee80211_hw *hw,
372 if (status->crc) 350 if (status->crc)
373 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 351 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
374 352
375 if (status->rx_is40Mhzpacket) 353 if (status->rx_is40mhzpacket)
376 rx_status->bw = RATE_INFO_BW_40; 354 rx_status->bw = RATE_INFO_BW_40;
377 355
378 if (status->is_ht) 356 if (status->is_ht)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h
index 609f7ad7f787..11e75a4e68bd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8723BE_TRX_H__ 4#ifndef __RTL8723BE_TRX_H__
27#define __RTL8723BE_TRX_H__ 5#define __RTL8723BE_TRX_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.c
index 064340641913..46ab90332eb7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "dm_common.h" 5#include "dm_common.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.h
index 5c1b94ce2f86..6300be65aba0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/dm_common.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __DM_COMMON_H__ 4#ifndef __DM_COMMON_H__
27#define __DM_COMMON_H__ 5#define __DM_COMMON_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c
index 521039c5d4ce..18ce2856a91b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.h
index 77c25a976233..b527fcbbdf08 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __FW_COMMON_H__ 4#ifndef __FW_COMMON_H__
27#define __FW_COMMON_H__ 5#define __FW_COMMON_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/main.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/main.c
index 9014a94fac6a..f5a9ecbf7363 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/main.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/main.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include <linux/module.h> 5#include <linux/module.h>
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c
index 43d24e1ee5e6..aae14c68bf69 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "phy_common.h" 5#include "phy_common.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h
index 83b891a9adb8..edf1c52f0ee2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2014 Realtek Corporation.*/
3 * Copyright(c) 2009-2014 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __PHY_COMMON__ 4#ifndef __PHY_COMMON__
27#define __PHY_COMMON__ 5#define __PHY_COMMON__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/def.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/def.h
index 3fe3aaa5fe3c..827bc5f35d2a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/def.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/def.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_DEF_H__ 4#ifndef __RTL8821AE_DEF_H__
27#define __RTL8821AE_DEF_H__ 5#define __RTL8821AE_DEF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
index 3be8c88971e2..49d05b631ba1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../base.h" 5#include "../base.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.h
index 625a6bbb21fc..137ed735d80d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_DM_H__ 4#ifndef __RTL8821AE_DM_H__
27#define __RTL8821AE_DM_H__ 5#define __RTL8821AE_DM_H__
@@ -92,11 +70,11 @@
92#define DM_REG_CCK_CCA_CNT_11N 0xA60 70#define DM_REG_CCK_CCA_CNT_11N 0xA60
93#define DM_REG_BB_PWR_SAV4_11N 0xA74 71#define DM_REG_BB_PWR_SAV4_11N 0xA74
94/*PAGE B */ 72/*PAGE B */
95#define DM_REG_LNA_SWITCH_11N 0xB2C 73#define DM_REG_LNA_SWITCH_11N 0XB2C
96#define DM_REG_PATH_SWITCH_11N 0xB30 74#define DM_REG_PATH_SWITCH_11N 0XB30
97#define DM_REG_RSSI_CTRL_11N 0xB38 75#define DM_REG_RSSI_CTRL_11N 0XB38
98#define DM_REG_CONFIG_ANTA_11N 0xB68 76#define DM_REG_CONFIG_ANTA_11N 0XB68
99#define DM_REG_RSSI_BT_11N 0xB9C 77#define DM_REG_RSSI_BT_11N 0XB9C
100/*PAGE C */ 78/*PAGE C */
101#define DM_REG_OFDM_FA_HOLDC_11N 0xC00 79#define DM_REG_OFDM_FA_HOLDC_11N 0xC00
102#define DM_REG_RX_PATH_11N 0xC04 80#define DM_REG_RX_PATH_11N 0xC04
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c
index d868a034659f..dc0eb692088f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -844,9 +822,9 @@ static u8 reserved_page_packet_8821[TOTAL_RESERVED_PKT_LEN_8821] = {
844 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 822 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
845 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 823 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
846 /* page 3: qos null data */ 824 /* page 3: qos null data */
847 0xC8, 0x01, 0x00, 0x00, 0x84, 0xC9, 0xB2, 0xA7, 825 0xC8, 0x01, 0x00, 0x00, 0x84, 0xC9, 0XB2, 0xA7,
848 0xB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 826 0XB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
849 0x84, 0xC9, 0xB2, 0xA7, 0xB3, 0x6E, 0x00, 0x00, 827 0x84, 0xC9, 0XB2, 0xA7, 0XB3, 0x6E, 0x00, 0x00,
850 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 828 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
851 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 829 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
852 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 830 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -877,9 +855,9 @@ static u8 reserved_page_packet_8821[TOTAL_RESERVED_PKT_LEN_8821] = {
877 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 855 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
878 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 856 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
879 /* page 4: BT qos null data */ 857 /* page 4: BT qos null data */
880 0xC8, 0x01, 0x00, 0x00, 0x84, 0xC9, 0xB2, 0xA7, 858 0xC8, 0x01, 0x00, 0x00, 0x84, 0xC9, 0XB2, 0xA7,
881 0xB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 859 0XB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
882 0x84, 0xC9, 0xB2, 0xA7, 0xB3, 0x6E, 0x00, 0x00, 860 0x84, 0xC9, 0XB2, 0xA7, 0XB3, 0x6E, 0x00, 0x00,
883 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 861 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
884 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 862 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
885 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 863 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -911,9 +889,9 @@ static u8 reserved_page_packet_8821[TOTAL_RESERVED_PKT_LEN_8821] = {
911 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 889 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
912 /* page 5~7 is for wowlan */ 890 /* page 5~7 is for wowlan */
913 /* page 5: ARP resp */ 891 /* page 5: ARP resp */
914 0x08, 0x01, 0x00, 0x00, 0x84, 0xC9, 0xB2, 0xA7, 892 0x08, 0x01, 0x00, 0x00, 0x84, 0xC9, 0XB2, 0xA7,
915 0xB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 893 0XB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
916 0x84, 0xC9, 0xB2, 0xA7, 0xB3, 0x6E, 0x00, 0x00, 894 0x84, 0xC9, 0XB2, 0xA7, 0XB3, 0x6E, 0x00, 0x00,
917 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06, 895 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06,
918 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x02, 896 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x02,
919 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 0x00, 0x00, 897 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 0x00, 0x00,
@@ -1015,7 +993,7 @@ static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
1015 /* page 0: beacon */ 993 /* page 0: beacon */
1016 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 994 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
1017 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 995 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
1018 0x84, 0xC9, 0xB2, 0xA7, 0xB3, 0x6E, 0x60, 0x00, 996 0x84, 0xC9, 0XB2, 0xA7, 0XB3, 0x6E, 0x60, 0x00,
1019 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 997 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1020 0x64, 0x00, 0x20, 0x04, 0x00, 0x03, 0x32, 0x31, 998 0x64, 0x00, 0x20, 0x04, 0x00, 0x03, 0x32, 0x31,
1021 0x35, 0x01, 0x08, 0x82, 0x84, 0x8B, 0x96, 0x0C, 999 0x35, 0x01, 0x08, 0x82, 0x84, 0x8B, 0x96, 0x0C,
@@ -1078,8 +1056,8 @@ static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
1078 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1056 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1079 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1057 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1080 /* page 1: ps-poll */ 1058 /* page 1: ps-poll */
1081 0xA4, 0x10, 0x09, 0xC0, 0x84, 0xC9, 0xB2, 0xA7, 1059 0xA4, 0x10, 0x09, 0xC0, 0x84, 0xC9, 0XB2, 0xA7,
1082 0xB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 1060 0XB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
1083 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1061 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1084 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1062 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1085 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1063 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1143,9 +1121,9 @@ static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
1143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1121 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1144 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1122 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1145 /* page 2: null data */ 1123 /* page 2: null data */
1146 0x48, 0x01, 0x00, 0x00, 0x84, 0xC9, 0xB2, 0xA7, 1124 0x48, 0x01, 0x00, 0x00, 0x84, 0xC9, 0XB2, 0xA7,
1147 0xB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 1125 0XB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
1148 0x84, 0xC9, 0xB2, 0xA7, 0xB3, 0x6E, 0x00, 0x00, 1126 0x84, 0xC9, 0XB2, 0xA7, 0XB3, 0x6E, 0x00, 0x00,
1149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1151 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1208,9 +1186,9 @@ static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
1208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1209 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1187 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1210 /* page 3: Qos null data */ 1188 /* page 3: Qos null data */
1211 0xC8, 0x01, 0x00, 0x00, 0x84, 0xC9, 0xB2, 0xA7, 1189 0xC8, 0x01, 0x00, 0x00, 0x84, 0xC9, 0XB2, 0xA7,
1212 0xB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 1190 0XB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
1213 0x84, 0xC9, 0xB2, 0xA7, 0xB3, 0x6E, 0x00, 0x00, 1191 0x84, 0xC9, 0XB2, 0xA7, 0XB3, 0x6E, 0x00, 0x00,
1214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1193 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1194 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1273,9 +1251,9 @@ static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
1273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1251 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1274 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1252 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1275 /* page 4: BT Qos null data */ 1253 /* page 4: BT Qos null data */
1276 0xC8, 0x01, 0x00, 0x00, 0x84, 0xC9, 0xB2, 0xA7, 1254 0xC8, 0x01, 0x00, 0x00, 0x84, 0xC9, 0XB2, 0xA7,
1277 0xB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 1255 0XB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
1278 0x84, 0xC9, 0xB2, 0xA7, 0xB3, 0x6E, 0x00, 0x00, 1256 0x84, 0xC9, 0XB2, 0xA7, 0XB3, 0x6E, 0x00, 0x00,
1279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1259 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1339,9 +1317,9 @@ static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = {
1339 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1317 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1340 /* page 5~7 is for wowlan */ 1318 /* page 5~7 is for wowlan */
1341 /* page 5: ARP resp */ 1319 /* page 5: ARP resp */
1342 0x08, 0x01, 0x00, 0x00, 0x84, 0xC9, 0xB2, 0xA7, 1320 0x08, 0x01, 0x00, 0x00, 0x84, 0xC9, 0XB2, 0xA7,
1343 0xB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 1321 0XB3, 0x6E, 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02,
1344 0x84, 0xC9, 0xB2, 0xA7, 0xB3, 0x6E, 0x00, 0x00, 1322 0x84, 0xC9, 0XB2, 0xA7, 0XB3, 0x6E, 0x00, 0x00,
1345 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06, 1323 0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06,
1346 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x02, 1324 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x02,
1347 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 0x00, 0x00, 1325 0x00, 0xE0, 0x4C, 0x02, 0x51, 0x02, 0x00, 0x00,
@@ -1543,8 +1521,8 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1543 struct sk_buff *skb = NULL; 1521 struct sk_buff *skb = NULL;
1544 u32 totalpacketlen; 1522 u32 totalpacketlen;
1545 bool rtstatus; 1523 bool rtstatus;
1546 u8 u1RsvdPageLoc[5] = { 0 }; 1524 u8 u1rsvdpageloc[5] = { 0 };
1547 u8 u1RsvdPageLoc2[7] = { 0 }; 1525 u8 u1rsvdpageloc2[7] = { 0 };
1548 bool b_dlok = false; 1526 bool b_dlok = false;
1549 u8 *beacon; 1527 u8 *beacon;
1550 u8 *p_pspoll; 1528 u8 *p_pspoll;
@@ -1574,7 +1552,7 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1574 SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid); 1552 SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
1575 SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr); 1553 SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
1576 1554
1577 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); 1555 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1rsvdpageloc, PSPOLL_PG);
1578 1556
1579 /*-------------------------------------------------------- 1557 /*--------------------------------------------------------
1580 * (3) null data 1558 * (3) null data
@@ -1585,7 +1563,7 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1585 SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); 1563 SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
1586 SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); 1564 SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
1587 1565
1588 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG); 1566 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1rsvdpageloc, NULL_PG);
1589 1567
1590 /*--------------------------------------------------------- 1568 /*---------------------------------------------------------
1591 * (4) Qos null data 1569 * (4) Qos null data
@@ -1596,7 +1574,7 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1596 SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr); 1574 SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr);
1597 SET_80211_HDR_ADDRESS3(qosnull, mac->bssid); 1575 SET_80211_HDR_ADDRESS3(qosnull, mac->bssid);
1598 1576
1599 SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1RsvdPageLoc, QOSNULL_PG); 1577 SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1rsvdpageloc, QOSNULL_PG);
1600 1578
1601 /*--------------------------------------------------------- 1579 /*---------------------------------------------------------
1602 * (5) BT Qos null data 1580 * (5) BT Qos null data
@@ -1607,7 +1585,7 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1607 SET_80211_HDR_ADDRESS2(btqosnull, mac->mac_addr); 1585 SET_80211_HDR_ADDRESS2(btqosnull, mac->mac_addr);
1608 SET_80211_HDR_ADDRESS3(btqosnull, mac->bssid); 1586 SET_80211_HDR_ADDRESS3(btqosnull, mac->bssid);
1609 1587
1610 SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(u1RsvdPageLoc, BT_QOSNULL_PG); 1588 SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(u1rsvdpageloc, BT_QOSNULL_PG);
1611 1589
1612 if (!dl_whole_packets) { 1590 if (!dl_whole_packets) {
1613 totalpacketlen = 512 * (BT_QOSNULL_PG + 1) - 40; 1591 totalpacketlen = 512 * (BT_QOSNULL_PG + 1) - 40;
@@ -1622,20 +1600,20 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1622 SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr); 1600 SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr);
1623 SET_80211_HDR_ADDRESS3(arpresp, mac->bssid); 1601 SET_80211_HDR_ADDRESS3(arpresp, mac->bssid);
1624 1602
1625 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1RsvdPageLoc2, ARPRESP_PG); 1603 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1rsvdpageloc2, ARPRESP_PG);
1626 1604
1627 /*--------------------------------------------------------- 1605 /*---------------------------------------------------------
1628 * (7) Remote Wake Ctrl 1606 * (7) Remote Wake Ctrl
1629 *---------------------------------------------------------- 1607 *----------------------------------------------------------
1630 */ 1608 */
1631 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1RsvdPageLoc2, 1609 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1rsvdpageloc2,
1632 REMOTE_PG); 1610 REMOTE_PG);
1633 1611
1634 /*--------------------------------------------------------- 1612 /*---------------------------------------------------------
1635 * (8) GTK Ext Memory 1613 * (8) GTK Ext Memory
1636 *---------------------------------------------------------- 1614 *----------------------------------------------------------
1637 */ 1615 */
1638 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1RsvdPageLoc2, GTKEXT_PG); 1616 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1rsvdpageloc2, GTKEXT_PG);
1639 1617
1640 totalpacketlen = TOTAL_RESERVED_PKT_LEN_8812 - 40; 1618 totalpacketlen = TOTAL_RESERVED_PKT_LEN_8812 - 40;
1641 1619
@@ -1654,14 +1632,14 @@ out:
1654 1632
1655 if (!b_dl_finished && b_dlok) { 1633 if (!b_dl_finished && b_dlok) {
1656 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 1634 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1657 "H2C_RSVDPAGE:\n", u1RsvdPageLoc, 5); 1635 "H2C_RSVDPAGE:\n", u1rsvdpageloc, 5);
1658 rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE, 1636 rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE,
1659 sizeof(u1RsvdPageLoc), u1RsvdPageLoc); 1637 sizeof(u1rsvdpageloc), u1rsvdpageloc);
1660 if (dl_whole_packets) { 1638 if (dl_whole_packets) {
1661 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 1639 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1662 "wowlan H2C_RSVDPAGE:\n", u1RsvdPageLoc2, 7); 1640 "wowlan H2C_RSVDPAGE:\n", u1rsvdpageloc2, 7);
1663 rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE, 1641 rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE,
1664 sizeof(u1RsvdPageLoc2), u1RsvdPageLoc2); 1642 sizeof(u1rsvdpageloc2), u1rsvdpageloc2);
1665 } 1643 }
1666 } 1644 }
1667 1645
@@ -1678,8 +1656,8 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1678 struct sk_buff *skb = NULL; 1656 struct sk_buff *skb = NULL;
1679 u32 totalpacketlen; 1657 u32 totalpacketlen;
1680 bool rtstatus; 1658 bool rtstatus;
1681 u8 u1RsvdPageLoc[5] = { 0 }; 1659 u8 u1rsvdpageloc[5] = { 0 };
1682 u8 u1RsvdPageLoc2[7] = { 0 }; 1660 u8 u1rsvdpageloc2[7] = { 0 };
1683 bool b_dlok = false; 1661 bool b_dlok = false;
1684 u8 *beacon; 1662 u8 *beacon;
1685 u8 *p_pspoll; 1663 u8 *p_pspoll;
@@ -1709,7 +1687,7 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1709 SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid); 1687 SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid);
1710 SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr); 1688 SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr);
1711 1689
1712 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); 1690 SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1rsvdpageloc, PSPOLL_PG);
1713 1691
1714 /*-------------------------------------------------------- 1692 /*--------------------------------------------------------
1715 * (3) null data 1693 * (3) null data
@@ -1720,7 +1698,7 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1720 SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); 1698 SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr);
1721 SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); 1699 SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid);
1722 1700
1723 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG); 1701 SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1rsvdpageloc, NULL_PG);
1724 1702
1725 /*--------------------------------------------------------- 1703 /*---------------------------------------------------------
1726 * (4) Qos null data 1704 * (4) Qos null data
@@ -1731,7 +1709,7 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1731 SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr); 1709 SET_80211_HDR_ADDRESS2(qosnull, mac->mac_addr);
1732 SET_80211_HDR_ADDRESS3(qosnull, mac->bssid); 1710 SET_80211_HDR_ADDRESS3(qosnull, mac->bssid);
1733 1711
1734 SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1RsvdPageLoc, QOSNULL_PG); 1712 SET_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(u1rsvdpageloc, QOSNULL_PG);
1735 1713
1736 /*--------------------------------------------------------- 1714 /*---------------------------------------------------------
1737 * (5) Qos null data 1715 * (5) Qos null data
@@ -1742,7 +1720,7 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1742 SET_80211_HDR_ADDRESS2(btqosnull, mac->mac_addr); 1720 SET_80211_HDR_ADDRESS2(btqosnull, mac->mac_addr);
1743 SET_80211_HDR_ADDRESS3(btqosnull, mac->bssid); 1721 SET_80211_HDR_ADDRESS3(btqosnull, mac->bssid);
1744 1722
1745 SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(u1RsvdPageLoc, BT_QOSNULL_PG); 1723 SET_H2CCMD_RSVDPAGE_LOC_BT_QOS_NULL_DATA(u1rsvdpageloc, BT_QOSNULL_PG);
1746 1724
1747 if (!dl_whole_packets) { 1725 if (!dl_whole_packets) {
1748 totalpacketlen = 256 * (BT_QOSNULL_PG + 1) - 40; 1726 totalpacketlen = 256 * (BT_QOSNULL_PG + 1) - 40;
@@ -1757,20 +1735,20 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
1757 SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr); 1735 SET_80211_HDR_ADDRESS2(arpresp, mac->mac_addr);
1758 SET_80211_HDR_ADDRESS3(arpresp, mac->bssid); 1736 SET_80211_HDR_ADDRESS3(arpresp, mac->bssid);
1759 1737
1760 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1RsvdPageLoc2, ARPRESP_PG); 1738 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(u1rsvdpageloc2, ARPRESP_PG);
1761 1739
1762 /*--------------------------------------------------------- 1740 /*---------------------------------------------------------
1763 * (7) Remote Wake Ctrl 1741 * (7) Remote Wake Ctrl
1764 *---------------------------------------------------------- 1742 *----------------------------------------------------------
1765 */ 1743 */
1766 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1RsvdPageLoc2, 1744 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(u1rsvdpageloc2,
1767 REMOTE_PG); 1745 REMOTE_PG);
1768 1746
1769 /*--------------------------------------------------------- 1747 /*---------------------------------------------------------
1770 * (8) GTK Ext Memory 1748 * (8) GTK Ext Memory
1771 *---------------------------------------------------------- 1749 *----------------------------------------------------------
1772 */ 1750 */
1773 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1RsvdPageLoc2, GTKEXT_PG); 1751 SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_EXT_MEM(u1rsvdpageloc2, GTKEXT_PG);
1774 1752
1775 totalpacketlen = TOTAL_RESERVED_PKT_LEN_8821 - 40; 1753 totalpacketlen = TOTAL_RESERVED_PKT_LEN_8821 - 40;
1776 1754
@@ -1792,16 +1770,16 @@ out:
1792 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, 1770 RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD,
1793 "Set RSVD page location to Fw.\n"); 1771 "Set RSVD page location to Fw.\n");
1794 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 1772 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1795 "H2C_RSVDPAGE:\n", u1RsvdPageLoc, 5); 1773 "H2C_RSVDPAGE:\n", u1rsvdpageloc, 5);
1796 rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE, 1774 rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE,
1797 sizeof(u1RsvdPageLoc), u1RsvdPageLoc); 1775 sizeof(u1rsvdpageloc), u1rsvdpageloc);
1798 if (dl_whole_packets) { 1776 if (dl_whole_packets) {
1799 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, 1777 RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG,
1800 "wowlan H2C_RSVDPAGE:\n", 1778 "wowlan H2C_RSVDPAGE:\n",
1801 u1RsvdPageLoc2, 7); 1779 u1rsvdpageloc2, 7);
1802 rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE, 1780 rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AOAC_RSVDPAGE,
1803 sizeof(u1RsvdPageLoc2), 1781 sizeof(u1rsvdpageloc2),
1804 u1RsvdPageLoc2); 1782 u1rsvdpageloc2);
1805 } 1783 }
1806 } 1784 }
1807 1785
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h
index 99c902ff0b84..e11e496b7277 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h
@@ -1,26 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 * Larry Finger <Larry.Finger@lwfinger.net>
22 *
23 *****************************************************************************/
24 3
25#ifndef __RTL8821AE__FW__H__ 4#ifndef __RTL8821AE__FW__H__
26#define __RTL8821AE__FW__H__ 5#define __RTL8821AE__FW__H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index ba258318ee9f..198d419ebb9c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../efuse.h" 5#include "../efuse.h"
@@ -2606,50 +2584,50 @@ static void _rtl8821ae_read_power_value_fromprom(struct ieee80211_hw *hw,
2606 u8 *hwinfo) 2584 u8 *hwinfo)
2607{ 2585{
2608 struct rtl_priv *rtlpriv = rtl_priv(hw); 2586 struct rtl_priv *rtlpriv = rtl_priv(hw);
2609 u32 rfPath, eeAddr = EEPROM_TX_PWR_INX, group, TxCount = 0; 2587 u32 rfpath, eeaddr = EEPROM_TX_PWR_INX, group, txcount = 0;
2610 2588
2611 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 2589 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
2612 "hal_ReadPowerValueFromPROM8821ae(): hwinfo[0x%x]=0x%x\n", 2590 "hal_ReadPowerValueFromPROM8821ae(): hwinfo[0x%x]=0x%x\n",
2613 (eeAddr+1), hwinfo[eeAddr+1]); 2591 (eeaddr + 1), hwinfo[eeaddr + 1]);
2614 if (0xFF == hwinfo[eeAddr+1]) /*YJ,add,120316*/ 2592 if (hwinfo[eeaddr + 1] == 0xFF) /*YJ,add,120316*/
2615 autoload_fail = true; 2593 autoload_fail = true;
2616 2594
2617 if (autoload_fail) { 2595 if (autoload_fail) {
2618 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 2596 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
2619 "auto load fail : Use Default value!\n"); 2597 "auto load fail : Use Default value!\n");
2620 for (rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) { 2598 for (rfpath = 0 ; rfpath < MAX_RF_PATH ; rfpath++) {
2621 /*2.4G default value*/ 2599 /*2.4G default value*/
2622 for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { 2600 for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
2623 pwrinfo24g->index_cck_base[rfPath][group] = 0x2D; 2601 pwrinfo24g->index_cck_base[rfpath][group] = 0x2D;
2624 pwrinfo24g->index_bw40_base[rfPath][group] = 0x2D; 2602 pwrinfo24g->index_bw40_base[rfpath][group] = 0x2D;
2625 } 2603 }
2626 for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { 2604 for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
2627 if (TxCount == 0) { 2605 if (txcount == 0) {
2628 pwrinfo24g->bw20_diff[rfPath][0] = 0x02; 2606 pwrinfo24g->bw20_diff[rfpath][0] = 0x02;
2629 pwrinfo24g->ofdm_diff[rfPath][0] = 0x04; 2607 pwrinfo24g->ofdm_diff[rfpath][0] = 0x04;
2630 } else { 2608 } else {
2631 pwrinfo24g->bw20_diff[rfPath][TxCount] = 0xFE; 2609 pwrinfo24g->bw20_diff[rfpath][txcount] = 0xFE;
2632 pwrinfo24g->bw40_diff[rfPath][TxCount] = 0xFE; 2610 pwrinfo24g->bw40_diff[rfpath][txcount] = 0xFE;
2633 pwrinfo24g->cck_diff[rfPath][TxCount] = 0xFE; 2611 pwrinfo24g->cck_diff[rfpath][txcount] = 0xFE;
2634 pwrinfo24g->ofdm_diff[rfPath][TxCount] = 0xFE; 2612 pwrinfo24g->ofdm_diff[rfpath][txcount] = 0xFE;
2635 } 2613 }
2636 } 2614 }
2637 /*5G default value*/ 2615 /*5G default value*/
2638 for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) 2616 for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++)
2639 pwrinfo5g->index_bw40_base[rfPath][group] = 0x2A; 2617 pwrinfo5g->index_bw40_base[rfpath][group] = 0x2A;
2640 2618
2641 for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { 2619 for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
2642 if (TxCount == 0) { 2620 if (txcount == 0) {
2643 pwrinfo5g->ofdm_diff[rfPath][0] = 0x04; 2621 pwrinfo5g->ofdm_diff[rfpath][0] = 0x04;
2644 pwrinfo5g->bw20_diff[rfPath][0] = 0x00; 2622 pwrinfo5g->bw20_diff[rfpath][0] = 0x00;
2645 pwrinfo5g->bw80_diff[rfPath][0] = 0xFE; 2623 pwrinfo5g->bw80_diff[rfpath][0] = 0xFE;
2646 pwrinfo5g->bw160_diff[rfPath][0] = 0xFE; 2624 pwrinfo5g->bw160_diff[rfpath][0] = 0xFE;
2647 } else { 2625 } else {
2648 pwrinfo5g->ofdm_diff[rfPath][0] = 0xFE; 2626 pwrinfo5g->ofdm_diff[rfpath][0] = 0xFE;
2649 pwrinfo5g->bw20_diff[rfPath][0] = 0xFE; 2627 pwrinfo5g->bw20_diff[rfpath][0] = 0xFE;
2650 pwrinfo5g->bw40_diff[rfPath][0] = 0xFE; 2628 pwrinfo5g->bw40_diff[rfpath][0] = 0xFE;
2651 pwrinfo5g->bw80_diff[rfPath][0] = 0xFE; 2629 pwrinfo5g->bw80_diff[rfpath][0] = 0xFE;
2652 pwrinfo5g->bw160_diff[rfPath][0] = 0xFE; 2630 pwrinfo5g->bw160_diff[rfpath][0] = 0xFE;
2653 } 2631 }
2654 } 2632 }
2655 } 2633 }
@@ -2658,112 +2636,112 @@ static void _rtl8821ae_read_power_value_fromprom(struct ieee80211_hw *hw,
2658 2636
2659 rtl_priv(hw)->efuse.txpwr_fromeprom = true; 2637 rtl_priv(hw)->efuse.txpwr_fromeprom = true;
2660 2638
2661 for (rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) { 2639 for (rfpath = 0 ; rfpath < MAX_RF_PATH ; rfpath++) {
2662 /*2.4G default value*/ 2640 /*2.4G default value*/
2663 for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { 2641 for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
2664 pwrinfo24g->index_cck_base[rfPath][group] = hwinfo[eeAddr++]; 2642 pwrinfo24g->index_cck_base[rfpath][group] = hwinfo[eeaddr++];
2665 if (pwrinfo24g->index_cck_base[rfPath][group] == 0xFF) 2643 if (pwrinfo24g->index_cck_base[rfpath][group] == 0xFF)
2666 pwrinfo24g->index_cck_base[rfPath][group] = 0x2D; 2644 pwrinfo24g->index_cck_base[rfpath][group] = 0x2D;
2667 } 2645 }
2668 for (group = 0 ; group < MAX_CHNL_GROUP_24G - 1; group++) { 2646 for (group = 0 ; group < MAX_CHNL_GROUP_24G - 1; group++) {
2669 pwrinfo24g->index_bw40_base[rfPath][group] = hwinfo[eeAddr++]; 2647 pwrinfo24g->index_bw40_base[rfpath][group] = hwinfo[eeaddr++];
2670 if (pwrinfo24g->index_bw40_base[rfPath][group] == 0xFF) 2648 if (pwrinfo24g->index_bw40_base[rfpath][group] == 0xFF)
2671 pwrinfo24g->index_bw40_base[rfPath][group] = 0x2D; 2649 pwrinfo24g->index_bw40_base[rfpath][group] = 0x2D;
2672 } 2650 }
2673 for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { 2651 for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
2674 if (TxCount == 0) { 2652 if (txcount == 0) {
2675 pwrinfo24g->bw40_diff[rfPath][TxCount] = 0; 2653 pwrinfo24g->bw40_diff[rfpath][txcount] = 0;
2676 /*bit sign number to 8 bit sign number*/ 2654 /*bit sign number to 8 bit sign number*/
2677 pwrinfo24g->bw20_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0xf0) >> 4; 2655 pwrinfo24g->bw20_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
2678 if (pwrinfo24g->bw20_diff[rfPath][TxCount] & BIT(3)) 2656 if (pwrinfo24g->bw20_diff[rfpath][txcount] & BIT(3))
2679 pwrinfo24g->bw20_diff[rfPath][TxCount] |= 0xF0; 2657 pwrinfo24g->bw20_diff[rfpath][txcount] |= 0xF0;
2680 /*bit sign number to 8 bit sign number*/ 2658 /*bit sign number to 8 bit sign number*/
2681 pwrinfo24g->ofdm_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); 2659 pwrinfo24g->ofdm_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
2682 if (pwrinfo24g->ofdm_diff[rfPath][TxCount] & BIT(3)) 2660 if (pwrinfo24g->ofdm_diff[rfpath][txcount] & BIT(3))
2683 pwrinfo24g->ofdm_diff[rfPath][TxCount] |= 0xF0; 2661 pwrinfo24g->ofdm_diff[rfpath][txcount] |= 0xF0;
2684 2662
2685 pwrinfo24g->cck_diff[rfPath][TxCount] = 0; 2663 pwrinfo24g->cck_diff[rfpath][txcount] = 0;
2686 eeAddr++; 2664 eeaddr++;
2687 } else { 2665 } else {
2688 pwrinfo24g->bw40_diff[rfPath][TxCount] = (hwinfo[eeAddr]&0xf0) >> 4; 2666 pwrinfo24g->bw40_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
2689 if (pwrinfo24g->bw40_diff[rfPath][TxCount] & BIT(3)) 2667 if (pwrinfo24g->bw40_diff[rfpath][txcount] & BIT(3))
2690 pwrinfo24g->bw40_diff[rfPath][TxCount] |= 0xF0; 2668 pwrinfo24g->bw40_diff[rfpath][txcount] |= 0xF0;
2691 2669
2692 pwrinfo24g->bw20_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); 2670 pwrinfo24g->bw20_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
2693 if (pwrinfo24g->bw20_diff[rfPath][TxCount] & BIT(3)) 2671 if (pwrinfo24g->bw20_diff[rfpath][txcount] & BIT(3))
2694 pwrinfo24g->bw20_diff[rfPath][TxCount] |= 0xF0; 2672 pwrinfo24g->bw20_diff[rfpath][txcount] |= 0xF0;
2695 2673
2696 eeAddr++; 2674 eeaddr++;
2697 2675
2698 pwrinfo24g->ofdm_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0xf0) >> 4; 2676 pwrinfo24g->ofdm_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
2699 if (pwrinfo24g->ofdm_diff[rfPath][TxCount] & BIT(3)) 2677 if (pwrinfo24g->ofdm_diff[rfpath][txcount] & BIT(3))
2700 pwrinfo24g->ofdm_diff[rfPath][TxCount] |= 0xF0; 2678 pwrinfo24g->ofdm_diff[rfpath][txcount] |= 0xF0;
2701 2679
2702 pwrinfo24g->cck_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); 2680 pwrinfo24g->cck_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
2703 if (pwrinfo24g->cck_diff[rfPath][TxCount] & BIT(3)) 2681 if (pwrinfo24g->cck_diff[rfpath][txcount] & BIT(3))
2704 pwrinfo24g->cck_diff[rfPath][TxCount] |= 0xF0; 2682 pwrinfo24g->cck_diff[rfpath][txcount] |= 0xF0;
2705 2683
2706 eeAddr++; 2684 eeaddr++;
2707 } 2685 }
2708 } 2686 }
2709 2687
2710 /*5G default value*/ 2688 /*5G default value*/
2711 for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) { 2689 for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) {
2712 pwrinfo5g->index_bw40_base[rfPath][group] = hwinfo[eeAddr++]; 2690 pwrinfo5g->index_bw40_base[rfpath][group] = hwinfo[eeaddr++];
2713 if (pwrinfo5g->index_bw40_base[rfPath][group] == 0xFF) 2691 if (pwrinfo5g->index_bw40_base[rfpath][group] == 0xFF)
2714 pwrinfo5g->index_bw40_base[rfPath][group] = 0xFE; 2692 pwrinfo5g->index_bw40_base[rfpath][group] = 0xFE;
2715 } 2693 }
2716 2694
2717 for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { 2695 for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
2718 if (TxCount == 0) { 2696 if (txcount == 0) {
2719 pwrinfo5g->bw40_diff[rfPath][TxCount] = 0; 2697 pwrinfo5g->bw40_diff[rfpath][txcount] = 0;
2720 2698
2721 pwrinfo5g->bw20_diff[rfPath][0] = (hwinfo[eeAddr] & 0xf0) >> 4; 2699 pwrinfo5g->bw20_diff[rfpath][0] = (hwinfo[eeaddr] & 0xf0) >> 4;
2722 if (pwrinfo5g->bw20_diff[rfPath][TxCount] & BIT(3)) 2700 if (pwrinfo5g->bw20_diff[rfpath][txcount] & BIT(3))
2723 pwrinfo5g->bw20_diff[rfPath][TxCount] |= 0xF0; 2701 pwrinfo5g->bw20_diff[rfpath][txcount] |= 0xF0;
2724 2702
2725 pwrinfo5g->ofdm_diff[rfPath][0] = (hwinfo[eeAddr] & 0x0f); 2703 pwrinfo5g->ofdm_diff[rfpath][0] = (hwinfo[eeaddr] & 0x0f);
2726 if (pwrinfo5g->ofdm_diff[rfPath][TxCount] & BIT(3)) 2704 if (pwrinfo5g->ofdm_diff[rfpath][txcount] & BIT(3))
2727 pwrinfo5g->ofdm_diff[rfPath][TxCount] |= 0xF0; 2705 pwrinfo5g->ofdm_diff[rfpath][txcount] |= 0xF0;
2728 2706
2729 eeAddr++; 2707 eeaddr++;
2730 } else { 2708 } else {
2731 pwrinfo5g->bw40_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0xf0) >> 4; 2709 pwrinfo5g->bw40_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
2732 if (pwrinfo5g->bw40_diff[rfPath][TxCount] & BIT(3)) 2710 if (pwrinfo5g->bw40_diff[rfpath][txcount] & BIT(3))
2733 pwrinfo5g->bw40_diff[rfPath][TxCount] |= 0xF0; 2711 pwrinfo5g->bw40_diff[rfpath][txcount] |= 0xF0;
2734 2712
2735 pwrinfo5g->bw20_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); 2713 pwrinfo5g->bw20_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
2736 if (pwrinfo5g->bw20_diff[rfPath][TxCount] & BIT(3)) 2714 if (pwrinfo5g->bw20_diff[rfpath][txcount] & BIT(3))
2737 pwrinfo5g->bw20_diff[rfPath][TxCount] |= 0xF0; 2715 pwrinfo5g->bw20_diff[rfpath][txcount] |= 0xF0;
2738 2716
2739 eeAddr++; 2717 eeaddr++;
2740 } 2718 }
2741 } 2719 }
2742 2720
2743 pwrinfo5g->ofdm_diff[rfPath][1] = (hwinfo[eeAddr] & 0xf0) >> 4; 2721 pwrinfo5g->ofdm_diff[rfpath][1] = (hwinfo[eeaddr] & 0xf0) >> 4;
2744 pwrinfo5g->ofdm_diff[rfPath][2] = (hwinfo[eeAddr] & 0x0f); 2722 pwrinfo5g->ofdm_diff[rfpath][2] = (hwinfo[eeaddr] & 0x0f);
2745 2723
2746 eeAddr++; 2724 eeaddr++;
2747 2725
2748 pwrinfo5g->ofdm_diff[rfPath][3] = (hwinfo[eeAddr] & 0x0f); 2726 pwrinfo5g->ofdm_diff[rfpath][3] = (hwinfo[eeaddr] & 0x0f);
2749 2727
2750 eeAddr++; 2728 eeaddr++;
2751 2729
2752 for (TxCount = 1; TxCount < MAX_TX_COUNT; TxCount++) { 2730 for (txcount = 1; txcount < MAX_TX_COUNT; txcount++) {
2753 if (pwrinfo5g->ofdm_diff[rfPath][TxCount] & BIT(3)) 2731 if (pwrinfo5g->ofdm_diff[rfpath][txcount] & BIT(3))
2754 pwrinfo5g->ofdm_diff[rfPath][TxCount] |= 0xF0; 2732 pwrinfo5g->ofdm_diff[rfpath][txcount] |= 0xF0;
2755 } 2733 }
2756 for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { 2734 for (txcount = 0; txcount < MAX_TX_COUNT; txcount++) {
2757 pwrinfo5g->bw80_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0xf0) >> 4; 2735 pwrinfo5g->bw80_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0xf0) >> 4;
2758 /* 4bit sign number to 8 bit sign number */ 2736 /* 4bit sign number to 8 bit sign number */
2759 if (pwrinfo5g->bw80_diff[rfPath][TxCount] & BIT(3)) 2737 if (pwrinfo5g->bw80_diff[rfpath][txcount] & BIT(3))
2760 pwrinfo5g->bw80_diff[rfPath][TxCount] |= 0xF0; 2738 pwrinfo5g->bw80_diff[rfpath][txcount] |= 0xF0;
2761 /* 4bit sign number to 8 bit sign number */ 2739 /* 4bit sign number to 8 bit sign number */
2762 pwrinfo5g->bw160_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); 2740 pwrinfo5g->bw160_diff[rfpath][txcount] = (hwinfo[eeaddr] & 0x0f);
2763 if (pwrinfo5g->bw160_diff[rfPath][TxCount] & BIT(3)) 2741 if (pwrinfo5g->bw160_diff[rfpath][txcount] & BIT(3))
2764 pwrinfo5g->bw160_diff[rfPath][TxCount] |= 0xF0; 2742 pwrinfo5g->bw160_diff[rfpath][txcount] |= 0xF0;
2765 2743
2766 eeAddr++; 2744 eeaddr++;
2767 } 2745 }
2768 } 2746 }
2769} 2747}
@@ -2930,8 +2908,8 @@ static void _rtl8812ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo,
2930 struct rtl_hal *rtlhal = rtl_hal(rtlpriv); 2908 struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
2931 2909
2932 if (!autoload_fail) { 2910 if (!autoload_fail) {
2933 rtlhal->pa_type_2g = hwinfo[0xBC]; 2911 rtlhal->pa_type_2g = hwinfo[0XBC];
2934 rtlhal->lna_type_2g = hwinfo[0xBD]; 2912 rtlhal->lna_type_2g = hwinfo[0XBD];
2935 if (rtlhal->pa_type_2g == 0xFF && rtlhal->lna_type_2g == 0xFF) { 2913 if (rtlhal->pa_type_2g == 0xFF && rtlhal->lna_type_2g == 0xFF) {
2936 rtlhal->pa_type_2g = 0; 2914 rtlhal->pa_type_2g = 0;
2937 rtlhal->lna_type_2g = 0; 2915 rtlhal->lna_type_2g = 0;
@@ -2943,8 +2921,8 @@ static void _rtl8812ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo,
2943 (rtlhal->lna_type_2g & BIT(3))) ? 2921 (rtlhal->lna_type_2g & BIT(3))) ?
2944 1 : 0; 2922 1 : 0;
2945 2923
2946 rtlhal->pa_type_5g = hwinfo[0xBC]; 2924 rtlhal->pa_type_5g = hwinfo[0XBC];
2947 rtlhal->lna_type_5g = hwinfo[0xBF]; 2925 rtlhal->lna_type_5g = hwinfo[0XBF];
2948 if (rtlhal->pa_type_5g == 0xFF && rtlhal->lna_type_5g == 0xFF) { 2926 if (rtlhal->pa_type_5g == 0xFF && rtlhal->lna_type_5g == 0xFF) {
2949 rtlhal->pa_type_5g = 0; 2927 rtlhal->pa_type_5g = 0;
2950 rtlhal->lna_type_5g = 0; 2928 rtlhal->lna_type_5g = 0;
@@ -2969,18 +2947,18 @@ static void _rtl8812ae_read_amplifier_type(struct ieee80211_hw *hw, u8 *hwinfo,
2969 struct rtl_priv *rtlpriv = rtl_priv(hw); 2947 struct rtl_priv *rtlpriv = rtl_priv(hw);
2970 struct rtl_hal *rtlhal = rtl_hal(rtlpriv); 2948 struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
2971 2949
2972 u8 ext_type_pa_2g_a = (hwinfo[0xBD] & BIT(2)) >> 2; /* 0xBD[2] */ 2950 u8 ext_type_pa_2g_a = (hwinfo[0XBD] & BIT(2)) >> 2; /* 0XBD[2] */
2973 u8 ext_type_pa_2g_b = (hwinfo[0xBD] & BIT(6)) >> 6; /* 0xBD[6] */ 2951 u8 ext_type_pa_2g_b = (hwinfo[0XBD] & BIT(6)) >> 6; /* 0XBD[6] */
2974 u8 ext_type_pa_5g_a = (hwinfo[0xBF] & BIT(2)) >> 2; /* 0xBF[2] */ 2952 u8 ext_type_pa_5g_a = (hwinfo[0XBF] & BIT(2)) >> 2; /* 0XBF[2] */
2975 u8 ext_type_pa_5g_b = (hwinfo[0xBF] & BIT(6)) >> 6; /* 0xBF[6] */ 2953 u8 ext_type_pa_5g_b = (hwinfo[0XBF] & BIT(6)) >> 6; /* 0XBF[6] */
2976 /* 0xBD[1:0] */ 2954 /* 0XBD[1:0] */
2977 u8 ext_type_lna_2g_a = (hwinfo[0xBD] & (BIT(1) | BIT(0))) >> 0; 2955 u8 ext_type_lna_2g_a = (hwinfo[0XBD] & (BIT(1) | BIT(0))) >> 0;
2978 /* 0xBD[5:4] */ 2956 /* 0XBD[5:4] */
2979 u8 ext_type_lna_2g_b = (hwinfo[0xBD] & (BIT(5) | BIT(4))) >> 4; 2957 u8 ext_type_lna_2g_b = (hwinfo[0XBD] & (BIT(5) | BIT(4))) >> 4;
2980 /* 0xBF[1:0] */ 2958 /* 0XBF[1:0] */
2981 u8 ext_type_lna_5g_a = (hwinfo[0xBF] & (BIT(1) | BIT(0))) >> 0; 2959 u8 ext_type_lna_5g_a = (hwinfo[0XBF] & (BIT(1) | BIT(0))) >> 0;
2982 /* 0xBF[5:4] */ 2960 /* 0XBF[5:4] */
2983 u8 ext_type_lna_5g_b = (hwinfo[0xBF] & (BIT(5) | BIT(4))) >> 4; 2961 u8 ext_type_lna_5g_b = (hwinfo[0XBF] & (BIT(5) | BIT(4))) >> 4;
2984 2962
2985 _rtl8812ae_read_pa_type(hw, hwinfo, autoload_fail); 2963 _rtl8812ae_read_pa_type(hw, hwinfo, autoload_fail);
2986 2964
@@ -3008,8 +2986,8 @@ static void _rtl8821ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo,
3008 struct rtl_hal *rtlhal = rtl_hal(rtlpriv); 2986 struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
3009 2987
3010 if (!autoload_fail) { 2988 if (!autoload_fail) {
3011 rtlhal->pa_type_2g = hwinfo[0xBC]; 2989 rtlhal->pa_type_2g = hwinfo[0XBC];
3012 rtlhal->lna_type_2g = hwinfo[0xBD]; 2990 rtlhal->lna_type_2g = hwinfo[0XBD];
3013 if (rtlhal->pa_type_2g == 0xFF && rtlhal->lna_type_2g == 0xFF) { 2991 if (rtlhal->pa_type_2g == 0xFF && rtlhal->lna_type_2g == 0xFF) {
3014 rtlhal->pa_type_2g = 0; 2992 rtlhal->pa_type_2g = 0;
3015 rtlhal->lna_type_2g = 0; 2993 rtlhal->lna_type_2g = 0;
@@ -3017,8 +2995,8 @@ static void _rtl8821ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo,
3017 rtlhal->external_pa_2g = (rtlhal->pa_type_2g & BIT(5)) ? 1 : 0; 2995 rtlhal->external_pa_2g = (rtlhal->pa_type_2g & BIT(5)) ? 1 : 0;
3018 rtlhal->external_lna_2g = (rtlhal->lna_type_2g & BIT(7)) ? 1 : 0; 2996 rtlhal->external_lna_2g = (rtlhal->lna_type_2g & BIT(7)) ? 1 : 0;
3019 2997
3020 rtlhal->pa_type_5g = hwinfo[0xBC]; 2998 rtlhal->pa_type_5g = hwinfo[0XBC];
3021 rtlhal->lna_type_5g = hwinfo[0xBF]; 2999 rtlhal->lna_type_5g = hwinfo[0XBF];
3022 if (rtlhal->pa_type_5g == 0xFF && rtlhal->lna_type_5g == 0xFF) { 3000 if (rtlhal->pa_type_5g == 0xFF && rtlhal->lna_type_5g == 0xFF) {
3023 rtlhal->pa_type_5g = 0; 3001 rtlhal->pa_type_5g = 0;
3024 rtlhal->lna_type_5g = 0; 3002 rtlhal->lna_type_5g = 0;
@@ -4033,10 +4011,10 @@ void rtl8821ae_add_wowlan_pattern(struct ieee80211_hw *hw,
4033 rtl_write_byte(rtlpriv, REG_PKT_BUFF_ACCESS_CTRL, RXPKT_BUF_SELECT); 4011 rtl_write_byte(rtlpriv, REG_PKT_BUFF_ACCESS_CTRL, RXPKT_BUF_SELECT);
4034 for (addr = 0; addr < WKFMCAM_ADDR_NUM; addr++) { 4012 for (addr = 0; addr < WKFMCAM_ADDR_NUM; addr++) {
4035 /* Set Rx packet buffer offset. 4013 /* Set Rx packet buffer offset.
4036 * RxBufer pointer increases 1, 4014 * RXBufer pointer increases 1,
4037 * we can access 8 bytes in Rx packet buffer. 4015 * we can access 8 bytes in Rx packet buffer.
4038 * CAM start offset (unit: 1 byte) = index*WKFMCAM_SIZE 4016 * CAM start offset (unit: 1 byte) = index*WKFMCAM_SIZE
4039 * RxBufer addr = (CAM start offset + 4017 * RXBufer addr = (CAM start offset +
4040 * per entry offset of a WKFM CAM)/8 4018 * per entry offset of a WKFM CAM)/8
4041 * * index: The index of the wake up frame mask 4019 * * index: The index of the wake up frame mask
4042 * * WKFMCAM_SIZE: the total size of one WKFM CAM 4020 * * WKFMCAM_SIZE: the total size of one WKFM CAM
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.h
index e2ab783a2ad9..fb0fb3a501d9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_HW_H__ 4#ifndef __RTL8821AE_HW_H__
27#define __RTL8821AE_HW_H__ 5#define __RTL8821AE_HW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c
index 405c7541b386..dd7553e80ab1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h
index 038e64e18ae8..249a37a8d9db 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/led.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_LED_H__ 4#ifndef __RTL8821AE_LED_H__
27#define __RTL8821AE_LED_H__ 5#define __RTL8821AE_LED_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index a75451c246fd..408af144098e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
@@ -475,7 +453,7 @@ u32 phy_get_tx_swing_8812A(struct ieee80211_hw *hw, u8 band,
475 const s8 auto_temp = -1; 453 const s8 auto_temp = -1;
476 454
477 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, 455 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
478 "===> PHY_GetTxBBSwing_8812A, bbSwing_2G: %d, bbSwing_5G: %d,autoload_failflag=%d.\n", 456 "===> PHY_GetTXBBSwing_8812A, bbSwing_2G: %d, bbSwing_5G: %d,autoload_failflag=%d.\n",
479 (int)swing_2g, (int)swing_5g, 457 (int)swing_2g, (int)swing_5g,
480 (int)rtlefuse->autoload_failflag); 458 (int)rtlefuse->autoload_failflag);
481 459
@@ -556,7 +534,7 @@ u32 phy_get_tx_swing_8812A(struct ieee80211_hw *hw, u8 band,
556 swing_a = (swing & 0x3) >> 0; /* 0xC6/C7[1:0] */ 534 swing_a = (swing & 0x3) >> 0; /* 0xC6/C7[1:0] */
557 swing_b = (swing & 0xC) >> 2; /* 0xC6/C7[3:2] */ 535 swing_b = (swing & 0xC) >> 2; /* 0xC6/C7[3:2] */
558 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, 536 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
559 "===> PHY_GetTxBBSwing_8812A, swingA: 0x%X, swingB: 0x%X\n", 537 "===> PHY_GetTXBBSwing_8812A, swingA: 0x%X, swingB: 0x%X\n",
560 swing_a, swing_b); 538 swing_a, swing_b);
561 539
562 /* 3 Path-A */ 540 /* 3 Path-A */
@@ -614,7 +592,7 @@ u32 phy_get_tx_swing_8812A(struct ieee80211_hw *hw, u8 band,
614 } 592 }
615 593
616 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, 594 RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
617 "<=== PHY_GetTxBBSwing_8812A, out = 0x%X\n", out); 595 "<=== PHY_GetTXBBSwing_8812A, out = 0x%X\n", out);
618 return out; 596 return out;
619} 597}
620 598
@@ -1078,52 +1056,52 @@ static void _rtl8821ae_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
1078{ 1056{
1079 struct rtl_priv *rtlpriv = rtl_priv(hw); 1057 struct rtl_priv *rtlpriv = rtl_priv(hw);
1080 struct rtl_phy *rtlphy = &rtlpriv->phy; 1058 struct rtl_phy *rtlphy = &rtlpriv->phy;
1081 u16 rawValue = 0; 1059 u16 rawvalue = 0;
1082 u8 base = 0, path = 0; 1060 u8 base = 0, path = 0;
1083 1061
1084 for (path = RF90_PATH_A; path <= RF90_PATH_B; ++path) { 1062 for (path = RF90_PATH_A; path <= RF90_PATH_B; ++path) {
1085 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][0] >> 24) & 0xFF; 1063 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][0] >> 24) & 0xFF;
1086 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1064 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1087 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, CCK, RF_1TX, base); 1065 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, CCK, RF_1TX, base);
1088 1066
1089 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][2] >> 24) & 0xFF; 1067 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][2] >> 24) & 0xFF;
1090 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1068 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1091 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, OFDM, RF_1TX, base); 1069 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, OFDM, RF_1TX, base);
1092 1070
1093 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][4] >> 24) & 0xFF; 1071 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][4] >> 24) & 0xFF;
1094 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1072 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1095 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, HT_MCS0_MCS7, RF_1TX, base); 1073 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, HT_MCS0_MCS7, RF_1TX, base);
1096 1074
1097 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_2TX][6] >> 24) & 0xFF; 1075 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_2TX][6] >> 24) & 0xFF;
1098 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1076 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1099 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, HT_MCS8_MCS15, RF_2TX, base); 1077 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, HT_MCS8_MCS15, RF_2TX, base);
1100 1078
1101 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][8] >> 24) & 0xFF; 1079 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_1TX][8] >> 24) & 0xFF;
1102 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1080 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1103 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, VHT_1SSMCS0_1SSMCS9, RF_1TX, base); 1081 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, VHT_1SSMCS0_1SSMCS9, RF_1TX, base);
1104 1082
1105 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_2TX][11] >> 8) & 0xFF; 1083 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][path][RF_2TX][11] >> 8) & 0xFF;
1106 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1084 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1107 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, VHT_2SSMCS0_2SSMCS9, RF_2TX, base); 1085 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_2_4G, path, VHT_2SSMCS0_2SSMCS9, RF_2TX, base);
1108 1086
1109 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][2] >> 24) & 0xFF; 1087 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][2] >> 24) & 0xFF;
1110 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1088 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1111 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, OFDM, RF_1TX, base); 1089 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, OFDM, RF_1TX, base);
1112 1090
1113 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][4] >> 24) & 0xFF; 1091 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][4] >> 24) & 0xFF;
1114 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1092 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1115 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, HT_MCS0_MCS7, RF_1TX, base); 1093 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, HT_MCS0_MCS7, RF_1TX, base);
1116 1094
1117 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_2TX][6] >> 24) & 0xFF; 1095 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_2TX][6] >> 24) & 0xFF;
1118 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1096 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1119 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, HT_MCS8_MCS15, RF_2TX, base); 1097 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, HT_MCS8_MCS15, RF_2TX, base);
1120 1098
1121 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][8] >> 24) & 0xFF; 1099 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_1TX][8] >> 24) & 0xFF;
1122 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1100 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1123 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, VHT_1SSMCS0_1SSMCS9, RF_1TX, base); 1101 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, VHT_1SSMCS0_1SSMCS9, RF_1TX, base);
1124 1102
1125 rawValue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_2TX][11] >> 8) & 0xFF; 1103 rawvalue = (u16)(rtlphy->tx_power_by_rate_offset[BAND_ON_5G][path][RF_2TX][11] >> 8) & 0xFF;
1126 base = (rawValue >> 4) * 10 + (rawValue & 0xF); 1104 base = (rawvalue >> 4) * 10 + (rawvalue & 0xF);
1127 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, VHT_2SSMCS0_2SSMCS9, RF_2TX, base); 1105 _rtl8821ae_phy_set_txpower_by_rate_base(hw, BAND_ON_5G, path, VHT_2SSMCS0_2SSMCS9, RF_2TX, base);
1128 } 1106 }
1129} 1107}
@@ -1380,7 +1358,7 @@ static void _rtl8812ae_phy_convert_txpower_limit_to_power_index(struct ieee80211
1380 } 1358 }
1381 1359
1382 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1360 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1383 "TxPwrLimit_2_4G[regulation %d][bw %d][rateSection %d][channel %d] = %d\n(TxPwrLimit in dBm %d - BW40PwrLmt2_4G[channel %d][rfPath %d] %d)\n", 1361 "TxPwrLimit_2_4G[regulation %d][bw %d][rateSection %d][channel %d] = %d\n(TxPwrLimit in dBm %d - BW40PwrLmt2_4G[channel %d][rfpath %d] %d)\n",
1384 regulation, bw, rate_section, channel, 1362 regulation, bw, rate_section, channel,
1385 rtlphy->txpwr_limit_2_4g[regulation][bw] 1363 rtlphy->txpwr_limit_2_4g[regulation][bw]
1386 [rate_section][channel][rf_path], (temp_pwrlmt == 63) 1364 [rate_section][channel][rf_path], (temp_pwrlmt == 63)
@@ -1445,7 +1423,7 @@ static void _rtl8812ae_phy_convert_txpower_limit_to_power_index(struct ieee80211
1445 } 1423 }
1446 1424
1447 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, 1425 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
1448 "TxPwrLimit_5G[regulation %d][bw %d][rateSection %d][channel %d] =%d\n(TxPwrLimit in dBm %d - BW40PwrLmt5G[chnl group %d][rfPath %d] %d)\n", 1426 "TxPwrLimit_5G[regulation %d][bw %d][rateSection %d][channel %d] =%d\n(TxPwrLimit in dBm %d - BW40PwrLmt5G[chnl group %d][rfpath %d] %d)\n",
1449 regulation, bw, rate_section, 1427 regulation, bw, rate_section,
1450 channel, rtlphy->txpwr_limit_5g[regulation] 1428 channel, rtlphy->txpwr_limit_5g[regulation]
1451 [bw][rate_section][channel][rf_path], 1429 [bw][rate_section][channel][rf_path],
@@ -1495,106 +1473,106 @@ static void _rtl8821ae_phy_convert_txpower_dbm_to_relative_value(struct ieee8021
1495{ 1473{
1496 struct rtl_priv *rtlpriv = rtl_priv(hw); 1474 struct rtl_priv *rtlpriv = rtl_priv(hw);
1497 struct rtl_phy *rtlphy = &rtlpriv->phy; 1475 struct rtl_phy *rtlphy = &rtlpriv->phy;
1498 u8 base = 0, rfPath = 0; 1476 u8 base = 0, rfpath = 0;
1499 1477
1500 for (rfPath = RF90_PATH_A; rfPath <= RF90_PATH_B; ++rfPath) { 1478 for (rfpath = RF90_PATH_A; rfpath <= RF90_PATH_B; ++rfpath) {
1501 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfPath, RF_1TX, CCK); 1479 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfpath, RF_1TX, CCK);
1502 _phy_convert_txpower_dbm_to_relative_value( 1480 _phy_convert_txpower_dbm_to_relative_value(
1503 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][0], 1481 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][0],
1504 0, 3, base); 1482 0, 3, base);
1505 1483
1506 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfPath, RF_1TX, OFDM); 1484 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfpath, RF_1TX, OFDM);
1507 _phy_convert_txpower_dbm_to_relative_value( 1485 _phy_convert_txpower_dbm_to_relative_value(
1508 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][1], 1486 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][1],
1509 0, 3, base); 1487 0, 3, base);
1510 _phy_convert_txpower_dbm_to_relative_value( 1488 _phy_convert_txpower_dbm_to_relative_value(
1511 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][2], 1489 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][2],
1512 0, 3, base); 1490 0, 3, base);
1513 1491
1514 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfPath, RF_1TX, HT_MCS0_MCS7); 1492 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfpath, RF_1TX, HT_MCS0_MCS7);
1515 _phy_convert_txpower_dbm_to_relative_value( 1493 _phy_convert_txpower_dbm_to_relative_value(
1516 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][3], 1494 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][3],
1517 0, 3, base); 1495 0, 3, base);
1518 _phy_convert_txpower_dbm_to_relative_value( 1496 _phy_convert_txpower_dbm_to_relative_value(
1519 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][4], 1497 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][4],
1520 0, 3, base); 1498 0, 3, base);
1521 1499
1522 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfPath, RF_2TX, HT_MCS8_MCS15); 1500 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfpath, RF_2TX, HT_MCS8_MCS15);
1523 1501
1524 _phy_convert_txpower_dbm_to_relative_value( 1502 _phy_convert_txpower_dbm_to_relative_value(
1525 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_2TX][5], 1503 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][5],
1526 0, 3, base); 1504 0, 3, base);
1527 1505
1528 _phy_convert_txpower_dbm_to_relative_value( 1506 _phy_convert_txpower_dbm_to_relative_value(
1529 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_2TX][6], 1507 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][6],
1530 0, 3, base); 1508 0, 3, base);
1531 1509
1532 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfPath, RF_1TX, VHT_1SSMCS0_1SSMCS9); 1510 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfpath, RF_1TX, VHT_1SSMCS0_1SSMCS9);
1533 _phy_convert_txpower_dbm_to_relative_value( 1511 _phy_convert_txpower_dbm_to_relative_value(
1534 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][7], 1512 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][7],
1535 0, 3, base); 1513 0, 3, base);
1536 _phy_convert_txpower_dbm_to_relative_value( 1514 _phy_convert_txpower_dbm_to_relative_value(
1537 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][8], 1515 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][8],
1538 0, 3, base); 1516 0, 3, base);
1539 _phy_convert_txpower_dbm_to_relative_value( 1517 _phy_convert_txpower_dbm_to_relative_value(
1540 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][9], 1518 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][9],
1541 0, 1, base); 1519 0, 1, base);
1542 1520
1543 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfPath, RF_2TX, VHT_2SSMCS0_2SSMCS9); 1521 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_2_4G, rfpath, RF_2TX, VHT_2SSMCS0_2SSMCS9);
1544 _phy_convert_txpower_dbm_to_relative_value( 1522 _phy_convert_txpower_dbm_to_relative_value(
1545 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_1TX][9], 1523 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_1TX][9],
1546 2, 3, base); 1524 2, 3, base);
1547 _phy_convert_txpower_dbm_to_relative_value( 1525 _phy_convert_txpower_dbm_to_relative_value(
1548 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_2TX][10], 1526 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][10],
1549 0, 3, base); 1527 0, 3, base);
1550 _phy_convert_txpower_dbm_to_relative_value( 1528 _phy_convert_txpower_dbm_to_relative_value(
1551 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfPath][RF_2TX][11], 1529 &rtlphy->tx_power_by_rate_offset[BAND_ON_2_4G][rfpath][RF_2TX][11],
1552 0, 3, base); 1530 0, 3, base);
1553 1531
1554 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfPath, RF_1TX, OFDM); 1532 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfpath, RF_1TX, OFDM);
1555 _phy_convert_txpower_dbm_to_relative_value( 1533 _phy_convert_txpower_dbm_to_relative_value(
1556 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_1TX][1], 1534 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][1],
1557 0, 3, base); 1535 0, 3, base);
1558 _phy_convert_txpower_dbm_to_relative_value( 1536 _phy_convert_txpower_dbm_to_relative_value(
1559 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_1TX][2], 1537 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][2],
1560 0, 3, base); 1538 0, 3, base);
1561 1539
1562 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfPath, RF_1TX, HT_MCS0_MCS7); 1540 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfpath, RF_1TX, HT_MCS0_MCS7);
1563 _phy_convert_txpower_dbm_to_relative_value( 1541 _phy_convert_txpower_dbm_to_relative_value(
1564 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_1TX][3], 1542 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][3],
1565 0, 3, base); 1543 0, 3, base);
1566 _phy_convert_txpower_dbm_to_relative_value( 1544 _phy_convert_txpower_dbm_to_relative_value(
1567 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_1TX][4], 1545 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][4],
1568 0, 3, base); 1546 0, 3, base);
1569 1547
1570 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfPath, RF_2TX, HT_MCS8_MCS15); 1548 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfpath, RF_2TX, HT_MCS8_MCS15);
1571 _phy_convert_txpower_dbm_to_relative_value( 1549 _phy_convert_txpower_dbm_to_relative_value(
1572 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_2TX][5], 1550 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][5],
1573 0, 3, base); 1551 0, 3, base);
1574 _phy_convert_txpower_dbm_to_relative_value( 1552 _phy_convert_txpower_dbm_to_relative_value(
1575 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_2TX][6], 1553 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][6],
1576 0, 3, base); 1554 0, 3, base);
1577 1555
1578 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfPath, RF_1TX, VHT_1SSMCS0_1SSMCS9); 1556 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfpath, RF_1TX, VHT_1SSMCS0_1SSMCS9);
1579 _phy_convert_txpower_dbm_to_relative_value( 1557 _phy_convert_txpower_dbm_to_relative_value(
1580 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_1TX][7], 1558 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][7],
1581 0, 3, base); 1559 0, 3, base);
1582 _phy_convert_txpower_dbm_to_relative_value( 1560 _phy_convert_txpower_dbm_to_relative_value(
1583 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_1TX][8], 1561 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][8],
1584 0, 3, base); 1562 0, 3, base);
1585 _phy_convert_txpower_dbm_to_relative_value( 1563 _phy_convert_txpower_dbm_to_relative_value(
1586 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_1TX][9], 1564 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][9],
1587 0, 1, base); 1565 0, 1, base);
1588 1566
1589 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfPath, RF_2TX, VHT_2SSMCS0_2SSMCS9); 1567 base = _rtl8821ae_phy_get_txpower_by_rate_base(hw, BAND_ON_5G, rfpath, RF_2TX, VHT_2SSMCS0_2SSMCS9);
1590 _phy_convert_txpower_dbm_to_relative_value( 1568 _phy_convert_txpower_dbm_to_relative_value(
1591 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_1TX][9], 1569 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_1TX][9],
1592 2, 3, base); 1570 2, 3, base);
1593 _phy_convert_txpower_dbm_to_relative_value( 1571 _phy_convert_txpower_dbm_to_relative_value(
1594 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_2TX][10], 1572 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][10],
1595 0, 3, base); 1573 0, 3, base);
1596 _phy_convert_txpower_dbm_to_relative_value( 1574 _phy_convert_txpower_dbm_to_relative_value(
1597 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfPath][RF_2TX][11], 1575 &rtlphy->tx_power_by_rate_offset[BAND_ON_5G][rfpath][RF_2TX][11],
1598 0, 3, base); 1576 0, 3, base);
1599 } 1577 }
1600 1578
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h
index 1285e1adfe9d..35b7d0f70125 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_PHY_H__ 4#ifndef __RTL8821AE_PHY_H__
27#define __RTL8821AE_PHY_H__ 5#define __RTL8821AE_PHY_H__
@@ -59,9 +37,9 @@
59 37
60#define LOOP_LIMIT 5 38#define LOOP_LIMIT 5
61#define MAX_STALL_TIME 50 39#define MAX_STALL_TIME 50
62#define AntennaDiversityValue 0x80 40#define ANTENNADIVERSITYVALUE 0x80
63#define MAX_TXPWR_IDX_NMODE_92S 63 41#define MAX_TXPWR_IDX_NMODE_92S 63
64#define Reset_Cnt_Limit 3 42#define RESET_CNT_LIMIT 3
65 43
66#define IQK_ADDA_REG_NUM 16 44#define IQK_ADDA_REG_NUM 16
67#define IQK_MAC_REG_NUM 4 45#define IQK_MAC_REG_NUM 4
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.c
index 9ddf78a187dd..1e7b3c770ac2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../pwrseqcmd.h" 4#include "../pwrseqcmd.h"
27#include "pwrseq.h" 5#include "pwrseq.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.h
index 6dd575435c63..d6f3cbab4abc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/pwrseq.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_PWRSEQ_H__ 4#ifndef __RTL8821AE_PWRSEQ_H__
27#define __RTL8821AE_PWRSEQ_H__ 5#define __RTL8821AE_PWRSEQ_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/reg.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/reg.h
index db8bc8a2de61..7d833b72c7ed 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/reg.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/reg.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_REG_H__ 4#ifndef __RTL8821AE_REG_H__
27#define __RTL8821AE_REG_H__ 5#define __RTL8821AE_REG_H__
@@ -696,7 +674,7 @@
696#define EEPROM_CHANNEL_PLAN_TELEC 0x8 674#define EEPROM_CHANNEL_PLAN_TELEC 0x8
697#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 675#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9
698#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA 676#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA
699#define EEPROM_CHANNEL_PLAN_NCC 0xB 677#define EEPROM_CHANNEL_PLAN_NCC 0XB
700#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 678#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80
701 679
702#define EEPROM_CID_DEFAULT 0x0 680#define EEPROM_CID_DEFAULT 0x0
@@ -718,10 +696,10 @@
718 696
719#define EEPROM_TX_PWR_INX 0x10 697#define EEPROM_TX_PWR_INX 0x10
720 698
721#define EEPROM_CHANNELPLAN 0xB8 699#define EEPROM_CHANNELPLAN 0XB8
722#define EEPROM_XTAL_8821AE 0xB9 700#define EEPROM_XTAL_8821AE 0XB9
723#define EEPROM_THERMAL_METER 0xBA 701#define EEPROM_THERMAL_METER 0XBA
724#define EEPROM_IQK_LCK_88E 0xBB 702#define EEPROM_IQK_LCK_88E 0XBB
725 703
726#define EEPROM_RF_BOARD_OPTION 0xC1 704#define EEPROM_RF_BOARD_OPTION 0xC1
727#define EEPROM_RF_FEATURE_OPTION_88E 0xC2 705#define EEPROM_RF_FEATURE_OPTION_88E 0xC2
@@ -1015,7 +993,7 @@
1015#define _LBMODE(x) (((x) & 0xF) << 24) 993#define _LBMODE(x) (((x) & 0xF) << 24)
1016#define MASK_LBMODE 0xF000000 994#define MASK_LBMODE 0xF000000
1017#define LOOPBACK_NORMAL 0x0 995#define LOOPBACK_NORMAL 0x0
1018#define LOOPBACK_IMMEDIATELY 0xB 996#define LOOPBACK_IMMEDIATELY 0XB
1019#define LOOPBACK_MAC_DELAY 0x3 997#define LOOPBACK_MAC_DELAY 0x3
1020#define LOOPBACK_PHY 0x1 998#define LOOPBACK_PHY 0x1
1021#define LOOPBACK_DMA 0x7 999#define LOOPBACK_DMA 0x7
@@ -1430,7 +1408,7 @@
1430#define RCCK0_FACOUNTERUPPER 0xa58 1408#define RCCK0_FACOUNTERUPPER 0xa58
1431#define RCCK0_CCA_CNT 0xa60 1409#define RCCK0_CCA_CNT 0xa60
1432 1410
1433/* PageB(0xB00) */ 1411/* PageB(0XB00) */
1434#define RPDP_ANTA 0xb00 1412#define RPDP_ANTA 0xb00
1435#define RPDP_ANTA_4 0xb04 1413#define RPDP_ANTA_4 0xb04
1436#define RPDP_ANTA_8 0xb08 1414#define RPDP_ANTA_8 0xb08
@@ -1477,16 +1455,16 @@
1477#define RPM_RX3_ANTB 0xbf8 1455#define RPM_RX3_ANTB 0xbf8
1478 1456
1479/*RSSI Dump*/ 1457/*RSSI Dump*/
1480#define RA_RSSI_DUMP 0xBF0 1458#define RA_RSSI_DUMP 0XBF0
1481#define RB_RSSI_DUMP 0xBF1 1459#define RB_RSSI_DUMP 0XBF1
1482#define RS1_RX_EVM_DUMP 0xBF4 1460#define RS1_RX_EVM_DUMP 0XBF4
1483#define RS2_RX_EVM_DUMP 0xBF5 1461#define RS2_RX_EVM_DUMP 0XBF5
1484#define RA_RX_SNR_DUMP 0xBF6 1462#define RA_RX_SNR_DUMP 0XBF6
1485#define RB_RX_SNR_DUMP 0xBF7 1463#define RB_RX_SNR_DUMP 0XBF7
1486#define RA_CFO_SHORT_DUMP 0xBF8 1464#define RA_CFO_SHORT_DUMP 0XBF8
1487#define RB_CFO_SHORT_DUMP 0xBFA 1465#define RB_CFO_SHORT_DUMP 0XBFA
1488#define RA_CFO_LONG_DUMP 0xBEC 1466#define RA_CFO_LONG_DUMP 0XBEC
1489#define RB_CFO_LONG_DUMP 0xBEE 1467#define RB_CFO_LONG_DUMP 0XBEE
1490 1468
1491/*Page C*/ 1469/*Page C*/
1492#define ROFDM0_LSTF 0xc00 1470#define ROFDM0_LSTF 0xc00
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c
index 95489f41f8a0..a6e56872e063 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "reg.h" 5#include "reg.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.h
index efd22bd0b139..6e3c8bfb2048 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rf.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_RF_H__ 4#ifndef __RTL8821AE_RF_H__
27#define __RTL8821AE_RF_H__ 5#define __RTL8821AE_RF_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
index 77f6401021c9..eec7c4ecf3ad 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../core.h" 5#include "../core.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.h
index d001e7ce3052..9d7610f84b20 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_SW_H__ 4#ifndef __RTL8821AE_SW_H__
27#define __RTL8821AE_SW_H__ 5#define __RTL8821AE_SW_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c
index f87f9d03b9fa..85093b3e5373 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c
@@ -1,29 +1,6 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27#include <linux/kernel.h> 4#include <linux/kernel.h>
28#include "table.h" 5#include "table.h"
29u32 RTL8812AE_PHY_REG_ARRAY[] = { 6u32 RTL8812AE_PHY_REG_ARRAY[] = {
@@ -134,30 +111,30 @@ u32 RTL8812AE_PHY_REG_ARRAY[] = {
134 0xA7C, 0x225B0606, 111 0xA7C, 0x225B0606,
135 0xA80, 0x218075B2, 112 0xA80, 0x218075B2,
136 0xA84, 0x001F8C80, 113 0xA84, 0x001F8C80,
137 0xB00, 0x03100000, 114 0XB00, 0x03100000,
138 0xB04, 0x0000B000, 115 0XB04, 0x0000B000,
139 0xB08, 0xAE0201EB, 116 0XB08, 0xAE0201EB,
140 0xB0C, 0x01003207, 117 0XB0C, 0x01003207,
141 0xB10, 0x00009807, 118 0XB10, 0x00009807,
142 0xB14, 0x01000000, 119 0XB14, 0x01000000,
143 0xB18, 0x00000002, 120 0XB18, 0x00000002,
144 0xB1C, 0x00000002, 121 0XB1C, 0x00000002,
145 0xB20, 0x0000001F, 122 0XB20, 0x0000001F,
146 0xB24, 0x03020100, 123 0XB24, 0x03020100,
147 0xB28, 0x07060504, 124 0XB28, 0x07060504,
148 0xB2C, 0x0B0A0908, 125 0XB2C, 0x0B0A0908,
149 0xB30, 0x0F0E0D0C, 126 0XB30, 0x0F0E0D0C,
150 0xB34, 0x13121110, 127 0XB34, 0x13121110,
151 0xB38, 0x17161514, 128 0XB38, 0x17161514,
152 0xB3C, 0x0000003A, 129 0XB3C, 0x0000003A,
153 0xB40, 0x00000000, 130 0XB40, 0x00000000,
154 0xB44, 0x00000000, 131 0XB44, 0x00000000,
155 0xB48, 0x13000032, 132 0XB48, 0x13000032,
156 0xB4C, 0x48080000, 133 0XB4C, 0x48080000,
157 0xB50, 0x00000000, 134 0XB50, 0x00000000,
158 0xB54, 0x00000000, 135 0XB54, 0x00000000,
159 0xB58, 0x00000000, 136 0XB58, 0x00000000,
160 0xB5C, 0x00000000, 137 0XB5C, 0x00000000,
161 0xC00, 0x00000007, 138 0xC00, 0x00000007,
162 0xC04, 0x00042020, 139 0xC04, 0x00042020,
163 0xC08, 0x80410231, 140 0xC08, 0x80410231,
@@ -197,7 +174,7 @@ u32 RTL8812AE_PHY_REG_ARRAY[] = {
197 0xC68, 0x59791979, 174 0xC68, 0x59791979,
198 0xA0000000, 0x00000000, 175 0xA0000000, 0x00000000,
199 0xC68, 0x59799979, 176 0xC68, 0x59799979,
200 0xB0000000, 0x00000000, 177 0XB0000000, 0x00000000,
201 0xC6C, 0x59795979, 178 0xC6C, 0x59795979,
202 0xC70, 0x19795979, 179 0xC70, 0x19795979,
203 0xC74, 0x19795979, 180 0xC74, 0x19795979,
@@ -367,30 +344,30 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = {
367 0xA7C, 0x225B0606, 344 0xA7C, 0x225B0606,
368 0xA80, 0x21805490, 345 0xA80, 0x21805490,
369 0xA84, 0x001F0000, 346 0xA84, 0x001F0000,
370 0xB00, 0x03100040, 347 0XB00, 0x03100040,
371 0xB04, 0x0000B000, 348 0XB04, 0x0000B000,
372 0xB08, 0xAE0201EB, 349 0XB08, 0xAE0201EB,
373 0xB0C, 0x01003207, 350 0XB0C, 0x01003207,
374 0xB10, 0x00009807, 351 0XB10, 0x00009807,
375 0xB14, 0x01000000, 352 0XB14, 0x01000000,
376 0xB18, 0x00000002, 353 0XB18, 0x00000002,
377 0xB1C, 0x00000002, 354 0XB1C, 0x00000002,
378 0xB20, 0x0000001F, 355 0XB20, 0x0000001F,
379 0xB24, 0x03020100, 356 0XB24, 0x03020100,
380 0xB28, 0x07060504, 357 0XB28, 0x07060504,
381 0xB2C, 0x0B0A0908, 358 0XB2C, 0x0B0A0908,
382 0xB30, 0x0F0E0D0C, 359 0XB30, 0x0F0E0D0C,
383 0xB34, 0x13121110, 360 0XB34, 0x13121110,
384 0xB38, 0x17161514, 361 0XB38, 0x17161514,
385 0xB3C, 0x0000003A, 362 0XB3C, 0x0000003A,
386 0xB40, 0x00000000, 363 0XB40, 0x00000000,
387 0xB44, 0x00000000, 364 0XB44, 0x00000000,
388 0xB48, 0x13000032, 365 0XB48, 0x13000032,
389 0xB4C, 0x48080000, 366 0XB4C, 0x48080000,
390 0xB50, 0x00000000, 367 0XB50, 0x00000000,
391 0xB54, 0x00000000, 368 0XB54, 0x00000000,
392 0xB58, 0x00000000, 369 0XB58, 0x00000000,
393 0xB5C, 0x00000000, 370 0XB5C, 0x00000000,
394 0xC00, 0x00000007, 371 0xC00, 0x00000007,
395 0xC04, 0x00042020, 372 0xC04, 0x00042020,
396 0xC08, 0x80410231, 373 0xC08, 0x80410231,
@@ -521,12 +498,12 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
521 0x086, 0x00014B3A, 498 0x086, 0x00014B3A,
522 0xA0000000, 0x00000000, 499 0xA0000000, 0x00000000,
523 0x086, 0x00014B38, 500 0x086, 0x00014B38,
524 0xB0000000, 0x00000000, 501 0XB0000000, 0x00000000,
525 0x80000004, 0x00000000, 0x40000000, 0x00000000, 502 0x80000004, 0x00000000, 0x40000000, 0x00000000,
526 0x08B, 0x00080180, 503 0x08B, 0x00080180,
527 0xA0000000, 0x00000000, 504 0xA0000000, 0x00000000,
528 0x08B, 0x00087180, 505 0x08B, 0x00087180,
529 0xB0000000, 0x00000000, 506 0XB0000000, 0x00000000,
530 0x0B1, 0x0001FC1A, 507 0x0B1, 0x0001FC1A,
531 0x0B3, 0x000F0810, 508 0x0B3, 0x000F0810,
532 0x0B4, 0x0001A78D, 509 0x0B4, 0x0001A78D,
@@ -557,7 +534,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
557 0x03B, 0x00018248, 534 0x03B, 0x00018248,
558 0x03B, 0x00010240, 535 0x03B, 0x00010240,
559 0x03B, 0x00008240, 536 0x03B, 0x00008240,
560 0xB0000000, 0x00000000, 537 0XB0000000, 0x00000000,
561 0x0EF, 0x00000100, 538 0x0EF, 0x00000100,
562 0x80000002, 0x00000000, 0x40000000, 0x00000000, 539 0x80000002, 0x00000000, 0x40000000, 0x00000000,
563 0x034, 0x0000A4EE, 540 0x034, 0x0000A4EE,
@@ -583,7 +560,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
583 0x034, 0x000024E7, 560 0x034, 0x000024E7,
584 0x034, 0x0000146B, 561 0x034, 0x0000146B,
585 0x034, 0x0000006D, 562 0x034, 0x0000006D,
586 0xB0000000, 0x00000000, 563 0XB0000000, 0x00000000,
587 0x0EF, 0x00000000, 564 0x0EF, 0x00000000,
588 0x0EF, 0x000020A2, 565 0x0EF, 0x000020A2,
589 0x0DF, 0x00000080, 566 0x0DF, 0x00000080,
@@ -712,7 +689,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
712 0x034, 0x000428C5, 689 0x034, 0x000428C5,
713 0x034, 0x000418C2, 690 0x034, 0x000418C2,
714 0x034, 0x000408C0, 691 0x034, 0x000408C0,
715 0xB0000000, 0x00000000, 692 0XB0000000, 0x00000000,
716 0x80000008, 0x00000000, 0x40000000, 0x00000000, 693 0x80000008, 0x00000000, 0x40000000, 0x00000000,
717 0x034, 0x0002A0B2, 694 0x034, 0x0002A0B2,
718 0x034, 0x000290AF, 695 0x034, 0x000290AF,
@@ -749,7 +726,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
749 0x034, 0x000228C5, 726 0x034, 0x000228C5,
750 0x034, 0x000218C2, 727 0x034, 0x000218C2,
751 0x034, 0x000208C0, 728 0x034, 0x000208C0,
752 0xB0000000, 0x00000000, 729 0XB0000000, 0x00000000,
753 0x80000008, 0x00000000, 0x40000000, 0x00000000, 730 0x80000008, 0x00000000, 0x40000000, 0x00000000,
754 0x034, 0x0000A0B2, 731 0x034, 0x0000A0B2,
755 0x034, 0x000090AF, 732 0x034, 0x000090AF,
@@ -786,7 +763,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
786 0x034, 0x000028C9, 763 0x034, 0x000028C9,
787 0x034, 0x000018C6, 764 0x034, 0x000018C6,
788 0x034, 0x000008C3, 765 0x034, 0x000008C3,
789 0xB0000000, 0x00000000, 766 0XB0000000, 0x00000000,
790 0x0EF, 0x00000000, 767 0x0EF, 0x00000000,
791 0x80000008, 0x00000000, 0x40000000, 0x00000000, 768 0x80000008, 0x00000000, 0x40000000, 0x00000000,
792 0x018, 0x0001712A, 769 0x018, 0x0001712A,
@@ -824,7 +801,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
824 0x035, 0x000401D8, 801 0x035, 0x000401D8,
825 0x035, 0x000481D8, 802 0x035, 0x000481D8,
826 0x035, 0x000501D8, 803 0x035, 0x000501D8,
827 0xB0000000, 0x00000000, 804 0XB0000000, 0x00000000,
828 0x0EF, 0x00000000, 805 0x0EF, 0x00000000,
829 0x80000008, 0x00000000, 0x40000000, 0x00000000, 806 0x80000008, 0x00000000, 0x40000000, 0x00000000,
830 0x018, 0x0001712A, 807 0x018, 0x0001712A,
@@ -871,7 +848,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
871 0x036, 0x000CCC35, 848 0x036, 0x000CCC35,
872 0x036, 0x000D4C35, 849 0x036, 0x000D4C35,
873 0x036, 0x000DCC35, 850 0x036, 0x000DCC35,
874 0xB0000000, 0x00000000, 851 0XB0000000, 0x00000000,
875 0x0EF, 0x00000000, 852 0x0EF, 0x00000000,
876 0x0EF, 0x00000008, 853 0x0EF, 0x00000008,
877 0x80000008, 0x00000000, 0x40000000, 0x00000000, 854 0x80000008, 0x00000000, 0x40000000, 0x00000000,
@@ -886,7 +863,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
886 0x03C, 0x000002A8, 863 0x03C, 0x000002A8,
887 0x03C, 0x000005A2, 864 0x03C, 0x000005A2,
888 0x03C, 0x00000880, 865 0x03C, 0x00000880,
889 0xB0000000, 0x00000000, 866 0XB0000000, 0x00000000,
890 0x0EF, 0x00000000, 867 0x0EF, 0x00000000,
891 0x018, 0x0001712A, 868 0x018, 0x0001712A,
892 0x0EF, 0x00000002, 869 0x0EF, 0x00000002,
@@ -910,7 +887,7 @@ u32 RTL8812AE_RADIOA_ARRAY[] = {
910 0x063, 0x000114EB, 887 0x063, 0x000114EB,
911 0x064, 0x000196AC, 888 0x064, 0x000196AC,
912 0x065, 0x000911D7, 889 0x065, 0x000911D7,
913 0xB0000000, 0x00000000, 890 0XB0000000, 0x00000000,
914 0x008, 0x00008400, 891 0x008, 0x00008400,
915 0x01C, 0x000739D2, 892 0x01C, 0x000739D2,
916 0x0B4, 0x0001E78D, 893 0x0B4, 0x0001E78D,
@@ -935,12 +912,12 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
935 0x086, 0x00014B3A, 912 0x086, 0x00014B3A,
936 0xA0000000, 0x00000000, 913 0xA0000000, 0x00000000,
937 0x086, 0x00014B38, 914 0x086, 0x00014B38,
938 0xB0000000, 0x00000000, 915 0XB0000000, 0x00000000,
939 0x80000004, 0x00000000, 0x40000000, 0x00000000, 916 0x80000004, 0x00000000, 0x40000000, 0x00000000,
940 0x08B, 0x00080180, 917 0x08B, 0x00080180,
941 0xA0000000, 0x00000000, 918 0xA0000000, 0x00000000,
942 0x08B, 0x00087180, 919 0x08B, 0x00087180,
943 0xB0000000, 0x00000000, 920 0XB0000000, 0x00000000,
944 0x018, 0x00000006, 921 0x018, 0x00000006,
945 0x0EF, 0x00002000, 922 0x0EF, 0x00002000,
946 0x80000001, 0x00000000, 0x40000000, 0x00000000, 923 0x80000001, 0x00000000, 0x40000000, 0x00000000,
@@ -967,7 +944,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
967 0x03B, 0x00018248, 944 0x03B, 0x00018248,
968 0x03B, 0x00010240, 945 0x03B, 0x00010240,
969 0x03B, 0x00008240, 946 0x03B, 0x00008240,
970 0xB0000000, 0x00000000, 947 0XB0000000, 0x00000000,
971 0x0EF, 0x00000100, 948 0x0EF, 0x00000100,
972 0x80000002, 0x00000000, 0x40000000, 0x00000000, 949 0x80000002, 0x00000000, 0x40000000, 0x00000000,
973 0x034, 0x0000A4EE, 950 0x034, 0x0000A4EE,
@@ -993,7 +970,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
993 0x034, 0x000024E7, 970 0x034, 0x000024E7,
994 0x034, 0x0000146B, 971 0x034, 0x0000146B,
995 0x034, 0x0000006D, 972 0x034, 0x0000006D,
996 0xB0000000, 0x00000000, 973 0XB0000000, 0x00000000,
997 0x0EF, 0x00000000, 974 0x0EF, 0x00000000,
998 0x0EF, 0x000020A2, 975 0x0EF, 0x000020A2,
999 0x0DF, 0x00000080, 976 0x0DF, 0x00000080,
@@ -1122,7 +1099,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
1122 0x034, 0x000428C5, 1099 0x034, 0x000428C5,
1123 0x034, 0x000418C2, 1100 0x034, 0x000418C2,
1124 0x034, 0x000408C0, 1101 0x034, 0x000408C0,
1125 0xB0000000, 0x00000000, 1102 0XB0000000, 0x00000000,
1126 0x80000008, 0x00000000, 0x40000000, 0x00000000, 1103 0x80000008, 0x00000000, 0x40000000, 0x00000000,
1127 0x034, 0x0002A0B2, 1104 0x034, 0x0002A0B2,
1128 0x034, 0x000290AF, 1105 0x034, 0x000290AF,
@@ -1159,7 +1136,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
1159 0x034, 0x000228C5, 1136 0x034, 0x000228C5,
1160 0x034, 0x000218C2, 1137 0x034, 0x000218C2,
1161 0x034, 0x000208C0, 1138 0x034, 0x000208C0,
1162 0xB0000000, 0x00000000, 1139 0XB0000000, 0x00000000,
1163 0x80000008, 0x00000000, 0x40000000, 0x00000000, 1140 0x80000008, 0x00000000, 0x40000000, 0x00000000,
1164 0x034, 0x0000A0B2, 1141 0x034, 0x0000A0B2,
1165 0x034, 0x000090AF, 1142 0x034, 0x000090AF,
@@ -1196,7 +1173,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
1196 0x034, 0x000028C9, 1173 0x034, 0x000028C9,
1197 0x034, 0x000018C6, 1174 0x034, 0x000018C6,
1198 0x034, 0x000008C3, 1175 0x034, 0x000008C3,
1199 0xB0000000, 0x00000000, 1176 0XB0000000, 0x00000000,
1200 0x0EF, 0x00000000, 1177 0x0EF, 0x00000000,
1201 0x80000008, 0x00000000, 0x40000000, 0x00000000, 1178 0x80000008, 0x00000000, 0x40000000, 0x00000000,
1202 0x018, 0x0001712A, 1179 0x018, 0x0001712A,
@@ -1237,7 +1214,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
1237 0x035, 0x000481D8, 1214 0x035, 0x000481D8,
1238 0x035, 0x000501D8, 1215 0x035, 0x000501D8,
1239 0x0EF, 0x00000000, 1216 0x0EF, 0x00000000,
1240 0xB0000000, 0x00000000, 1217 0XB0000000, 0x00000000,
1241 0x80000008, 0x00000000, 0x40000000, 0x00000000, 1218 0x80000008, 0x00000000, 0x40000000, 0x00000000,
1242 0x018, 0x0001712A, 1219 0x018, 0x0001712A,
1243 0x0EF, 0x00000010, 1220 0x0EF, 0x00000010,
@@ -1283,7 +1260,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
1283 0x036, 0x000CCC35, 1260 0x036, 0x000CCC35,
1284 0x036, 0x000D4C35, 1261 0x036, 0x000D4C35,
1285 0x036, 0x000DCC35, 1262 0x036, 0x000DCC35,
1286 0xB0000000, 0x00000000, 1263 0XB0000000, 0x00000000,
1287 0x0EF, 0x00000000, 1264 0x0EF, 0x00000000,
1288 0x0EF, 0x00000008, 1265 0x0EF, 0x00000008,
1289 0x80000008, 0x00000000, 0x40000000, 0x00000000, 1266 0x80000008, 0x00000000, 0x40000000, 0x00000000,
@@ -1298,7 +1275,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
1298 0x03C, 0x000002A8, 1275 0x03C, 0x000002A8,
1299 0x03C, 0x000005A2, 1276 0x03C, 0x000005A2,
1300 0x03C, 0x00000880, 1277 0x03C, 0x00000880,
1301 0xB0000000, 0x00000000, 1278 0XB0000000, 0x00000000,
1302 0x0EF, 0x00000000, 1279 0x0EF, 0x00000000,
1303 0x018, 0x0001712A, 1280 0x018, 0x0001712A,
1304 0x0EF, 0x00000002, 1281 0x0EF, 0x00000002,
@@ -1327,7 +1304,7 @@ u32 RTL8812AE_RADIOB_ARRAY[] = {
1327 0x063, 0x000114EB, 1304 0x063, 0x000114EB,
1328 0x064, 0x000196AC, 1305 0x064, 0x000196AC,
1329 0x065, 0x000911D7, 1306 0x065, 0x000911D7,
1330 0xB0000000, 0x00000000, 1307 0XB0000000, 0x00000000,
1331 0x008, 0x00008400, 1308 0x008, 0x00008400,
1332}; 1309};
1333 1310
@@ -1933,7 +1910,7 @@ u32 RTL8812AE_MAC_REG_ARRAY[] = {
1933 0x011, 0x00000066, 1910 0x011, 0x00000066,
1934 0xA0000000, 0x00000000, 1911 0xA0000000, 0x00000000,
1935 0x011, 0x0000005A, 1912 0x011, 0x0000005A,
1936 0xB0000000, 0x00000000, 1913 0XB0000000, 0x00000000,
1937 0x025, 0x0000000F, 1914 0x025, 0x0000000F,
1938 0x072, 0x00000000, 1915 0x072, 0x00000000,
1939 0x420, 0x00000080, 1916 0x420, 0x00000080,
@@ -2337,7 +2314,7 @@ u32 RTL8812AE_AGC_TAB_ARRAY[] = {
2337 0x81C, 0x417A0001, 2314 0x81C, 0x417A0001,
2338 0x81C, 0x417C0001, 2315 0x81C, 0x417C0001,
2339 0x81C, 0x417E0001, 2316 0x81C, 0x417E0001,
2340 0xB0000000, 0x00000000, 2317 0XB0000000, 0x00000000,
2341 0x80000004, 0x00000000, 0x40000000, 0x00000000, 2318 0x80000004, 0x00000000, 0x40000000, 0x00000000,
2342 0x81C, 0xFC800001, 2319 0x81C, 0xFC800001,
2343 0x81C, 0xFB820001, 2320 0x81C, 0xFB820001,
@@ -2468,7 +2445,7 @@ u32 RTL8812AE_AGC_TAB_ARRAY[] = {
2468 0x81C, 0x01FA0001, 2445 0x81C, 0x01FA0001,
2469 0x81C, 0x01FC0001, 2446 0x81C, 0x01FC0001,
2470 0x81C, 0x01FE0001, 2447 0x81C, 0x01FE0001,
2471 0xB0000000, 0x00000000, 2448 0XB0000000, 0x00000000,
2472 0xC50, 0x00000022, 2449 0xC50, 0x00000022,
2473 0xC50, 0x00000020, 2450 0xC50, 0x00000020,
2474 0xE50, 0x00000022, 2451 0xE50, 0x00000022,
@@ -2478,24 +2455,24 @@ u32 RTL8812AE_AGC_TAB_ARRAY[] = {
2478u32 RTL8812AE_AGC_TAB_1TARRAYLEN = ARRAY_SIZE(RTL8812AE_AGC_TAB_ARRAY); 2455u32 RTL8812AE_AGC_TAB_1TARRAYLEN = ARRAY_SIZE(RTL8812AE_AGC_TAB_ARRAY);
2479 2456
2480u32 RTL8821AE_AGC_TAB_ARRAY[] = { 2457u32 RTL8821AE_AGC_TAB_ARRAY[] = {
2481 0x81C, 0xBF000001, 2458 0x81C, 0XBF000001,
2482 0x81C, 0xBF020001, 2459 0x81C, 0XBF020001,
2483 0x81C, 0xBF040001, 2460 0x81C, 0XBF040001,
2484 0x81C, 0xBF060001, 2461 0x81C, 0XBF060001,
2485 0x81C, 0xBE080001, 2462 0x81C, 0XBE080001,
2486 0x81C, 0xBD0A0001, 2463 0x81C, 0XBD0A0001,
2487 0x81C, 0xBC0C0001, 2464 0x81C, 0XBC0C0001,
2488 0x81C, 0xBA0E0001, 2465 0x81C, 0XBA0E0001,
2489 0x81C, 0xB9100001, 2466 0x81C, 0XB9100001,
2490 0x81C, 0xB8120001, 2467 0x81C, 0XB8120001,
2491 0x81C, 0xB7140001, 2468 0x81C, 0XB7140001,
2492 0x81C, 0xB6160001, 2469 0x81C, 0XB6160001,
2493 0x81C, 0xB5180001, 2470 0x81C, 0XB5180001,
2494 0x81C, 0xB41A0001, 2471 0x81C, 0XB41A0001,
2495 0x81C, 0xB31C0001, 2472 0x81C, 0XB31C0001,
2496 0x81C, 0xB21E0001, 2473 0x81C, 0XB21E0001,
2497 0x81C, 0xB1200001, 2474 0x81C, 0XB1200001,
2498 0x81C, 0xB0220001, 2475 0x81C, 0XB0220001,
2499 0x81C, 0xAF240001, 2476 0x81C, 0xAF240001,
2500 0x81C, 0xAE260001, 2477 0x81C, 0xAE260001,
2501 0x81C, 0xAD280001, 2478 0x81C, 0xAD280001,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.h
index 36c2388b60bc..540159c25078 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.h
@@ -1,29 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Created on 2010/ 5/18, 1:41
23 *
24 * Larry Finger <Larry.Finger@lwfinger.net>
25 *
26 *****************************************************************************/
27 3
28#ifndef __RTL8821AE_TABLE__H_ 4#ifndef __RTL8821AE_TABLE__H_
29#define __RTL8821AE_TABLE__H_ 5#define __RTL8821AE_TABLE__H_
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c
index 0f2b7c619918..db5e628b17ed 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c
@@ -1,27 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#include "../wifi.h" 4#include "../wifi.h"
27#include "../pci.h" 5#include "../pci.h"
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h
index 4ff0968dba81..a3feecad645d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2010 Realtek Corporation.*/
3 * Copyright(c) 2009-2010 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL8821AE_TRX_H__ 4#ifndef __RTL8821AE_TRX_H__
27#define __RTL8821AE_TRX_H__ 5#define __RTL8821AE_TRX_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/stats.c b/drivers/net/wireless/realtek/rtlwifi/stats.c
index 61700fa05570..504ca587a16a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/stats.c
+++ b/drivers/net/wireless/realtek/rtlwifi/stats.c
@@ -1,27 +1,6 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. 3
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25#include "wifi.h" 4#include "wifi.h"
26#include "stats.h" 5#include "stats.h"
27#include <linux/export.h> 6#include <linux/export.h>
diff --git a/drivers/net/wireless/realtek/rtlwifi/stats.h b/drivers/net/wireless/realtek/rtlwifi/stats.h
index bd0108f93182..581590729b0f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/stats.h
+++ b/drivers/net/wireless/realtek/rtlwifi/stats.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_STATS_H__ 4#ifndef __RTL_STATS_H__
27#define __RTL_STATS_H__ 5#define __RTL_STATS_H__
diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
index 2ac5004d7a40..525f72bad433 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -1,25 +1,5 @@
1/****************************************************************************** 1// SPDX-License-Identifier: GPL-2.0
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 *****************************************************************************/
23 3
24#include "wifi.h" 4#include "wifi.h"
25#include "core.h" 5#include "core.h"
@@ -214,7 +194,7 @@ static void _usb_write32_async(struct rtl_priv *rtlpriv, u32 addr, u32 val)
214 _usb_write_async(to_usb_device(dev), addr, val, 4); 194 _usb_write_async(to_usb_device(dev), addr, val, 4);
215} 195}
216 196
217static void _usb_writeN_sync(struct rtl_priv *rtlpriv, u32 addr, void *data, 197static void _usb_writen_sync(struct rtl_priv *rtlpriv, u32 addr, void *data,
218 u16 len) 198 u16 len)
219{ 199{
220 struct device *dev = rtlpriv->io.dev; 200 struct device *dev = rtlpriv->io.dev;
@@ -249,7 +229,7 @@ static void _rtl_usb_io_handler_init(struct device *dev,
249 rtlpriv->io.read8_sync = _usb_read8_sync; 229 rtlpriv->io.read8_sync = _usb_read8_sync;
250 rtlpriv->io.read16_sync = _usb_read16_sync; 230 rtlpriv->io.read16_sync = _usb_read16_sync;
251 rtlpriv->io.read32_sync = _usb_read32_sync; 231 rtlpriv->io.read32_sync = _usb_read32_sync;
252 rtlpriv->io.writeN_sync = _usb_writeN_sync; 232 rtlpriv->io.writen_sync = _usb_writen_sync;
253} 233}
254 234
255static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw) 235static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw)
@@ -413,7 +393,7 @@ static void rtl_usb_init_sw(struct ieee80211_hw *hw)
413 rtlusb->irq_mask[0] = 0xFFFFFFFF; 393 rtlusb->irq_mask[0] = 0xFFFFFFFF;
414 /* HIMR_EX - turn all on */ 394 /* HIMR_EX - turn all on */
415 rtlusb->irq_mask[1] = 0xFFFFFFFF; 395 rtlusb->irq_mask[1] = 0xFFFFFFFF;
416 rtlusb->disableHWSM = true; 396 rtlusb->disablehwsm = true;
417} 397}
418 398
419static void _rtl_rx_completed(struct urb *urb); 399static void _rtl_rx_completed(struct urb *urb);
diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.h b/drivers/net/wireless/realtek/rtlwifi/usb.h
index c91cec04bfaf..09bbcdbe0dbf 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.h
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.h
@@ -1,25 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation. All rights reserved.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 *****************************************************************************/
23 3
24#ifndef __RTL_USB_H__ 4#ifndef __RTL_USB_H__
25#define __RTL_USB_H__ 5#define __RTL_USB_H__
@@ -104,7 +84,7 @@ struct rtl_usb {
104 /* Bcn control register setting */ 84 /* Bcn control register setting */
105 u32 reg_bcn_ctrl_val; 85 u32 reg_bcn_ctrl_val;
106 /* for 88/92cu card disable */ 86 /* for 88/92cu card disable */
107 u8 disableHWSM; 87 u8 disablehwsm;
108 /*QOS & EDCA */ 88 /*QOS & EDCA */
109 enum acm_method acm_method; 89 enum acm_method acm_method;
110 /* irq . HIMR,HIMR_EX */ 90 /* irq . HIMR,HIMR_EX */
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 87bc21bb5e8b..1ad71fb0ebf2 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -1,27 +1,5 @@
1/****************************************************************************** 1/* SPDX-License-Identifier: GPL-2.0 */
2 * 2/* Copyright(c) 2009-2012 Realtek Corporation.*/
3 * Copyright(c) 2009-2012 Realtek Corporation.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * The full GNU General Public License is included in this distribution in the
15 * file called LICENSE.
16 *
17 * Contact Information:
18 * wlanfae <wlanfae@realtek.com>
19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20 * Hsinchu 300, Taiwan.
21 *
22 * Larry Finger <Larry.Finger@lwfinger.net>
23 *
24 *****************************************************************************/
25 3
26#ifndef __RTL_WIFI_H__ 4#ifndef __RTL_WIFI_H__
27#define __RTL_WIFI_H__ 5#define __RTL_WIFI_H__
@@ -263,7 +241,7 @@ struct rtlwifi_firmware_header {
263 u8 date; 241 u8 date;
264 u8 hour; 242 u8 hour;
265 u8 minute; 243 u8 minute;
266 __le16 ramcodeSize; 244 __le16 ramcodesize;
267 __le16 rsvd2; 245 __le16 rsvd2;
268 __le32 svnindex; 246 __le32 svnindex;
269 __le32 rsvd3; 247 __le32 rsvd3;
@@ -465,11 +443,11 @@ enum hw_variables {
465 HW_VAR_MCS_RATE_AVAILABLE = 0x1f, 443 HW_VAR_MCS_RATE_AVAILABLE = 0x1f,
466 HW_VAR_AC_PARAM = 0x20, 444 HW_VAR_AC_PARAM = 0x20,
467 HW_VAR_ACM_CTRL = 0x21, 445 HW_VAR_ACM_CTRL = 0x21,
468 HW_VAR_DIS_Req_Qsize = 0x22, 446 HW_VAR_DIS_REQ_QSIZE = 0x22,
469 HW_VAR_CCX_CHNL_LOAD = 0x23, 447 HW_VAR_CCX_CHNL_LOAD = 0x23,
470 HW_VAR_CCX_NOISE_HISTOGRAM = 0x24, 448 HW_VAR_CCX_NOISE_HISTOGRAM = 0x24,
471 HW_VAR_CCX_CLM_NHM = 0x25, 449 HW_VAR_CCX_CLM_NHM = 0x25,
472 HW_VAR_TxOPLimit = 0x26, 450 HW_VAR_TXOPLIMIT = 0x26,
473 HW_VAR_TURBO_MODE = 0x27, 451 HW_VAR_TURBO_MODE = 0x27,
474 HW_VAR_RF_STATE = 0x28, 452 HW_VAR_RF_STATE = 0x28,
475 HW_VAR_RF_OFF_BY_HW = 0x29, 453 HW_VAR_RF_OFF_BY_HW = 0x29,
@@ -522,7 +500,7 @@ enum hw_variables {
522 HW_VAR_BCN_VALID = 0x55, 500 HW_VAR_BCN_VALID = 0x55,
523 HW_VAR_FWLPS_RF_ON = 0x56, 501 HW_VAR_FWLPS_RF_ON = 0x56,
524 HW_VAR_DUAL_TSF_RST = 0x57, 502 HW_VAR_DUAL_TSF_RST = 0x57,
525 HW_VAR_SWITCH_EPHY_WoWLAN = 0x58, 503 HW_VAR_SWITCH_EPHY_WOWLAN = 0x58,
526 HW_VAR_INT_MIGRATION = 0x59, 504 HW_VAR_INT_MIGRATION = 0x59,
527 HW_VAR_INT_AC = 0x5a, 505 HW_VAR_INT_AC = 0x5a,
528 HW_VAR_RF_TIMING = 0x5b, 506 HW_VAR_RF_TIMING = 0x5b,
@@ -814,8 +792,8 @@ enum _fw_ps_mode {
814 FW_PS_UAPSD_MODE = 6, 792 FW_PS_UAPSD_MODE = 6,
815 FW_PS_IBSS_MODE = 7, 793 FW_PS_IBSS_MODE = 7,
816 FW_PS_WWLAN_MODE = 8, 794 FW_PS_WWLAN_MODE = 8,
817 FW_PS_PM_Radio_Off = 9, 795 FW_PS_PM_RADIO_OFF = 9,
818 FW_PS_PM_Card_Disable = 10, 796 FW_PS_PM_CARD_DISABLE = 10,
819}; 797};
820 798
821enum rt_psmode { 799enum rt_psmode {
@@ -849,8 +827,8 @@ enum rtl_led_pin {
849/*QoS related.*/ 827/*QoS related.*/
850/*acm implementation method.*/ 828/*acm implementation method.*/
851enum acm_method { 829enum acm_method {
852 eAcmWay0_SwAndHw = 0, 830 EACMWAY0_SWANDHW = 0,
853 eAcmWay1_HW = 1, 831 EACMWAY1_HW = 1,
854 EACMWAY2_SW = 2, 832 EACMWAY2_SW = 2,
855}; 833};
856 834
@@ -1481,7 +1459,7 @@ struct rtl_io {
1481 void (*write8_async) (struct rtl_priv *rtlpriv, u32 addr, u8 val); 1459 void (*write8_async) (struct rtl_priv *rtlpriv, u32 addr, u8 val);
1482 void (*write16_async) (struct rtl_priv *rtlpriv, u32 addr, u16 val); 1460 void (*write16_async) (struct rtl_priv *rtlpriv, u32 addr, u16 val);
1483 void (*write32_async) (struct rtl_priv *rtlpriv, u32 addr, u32 val); 1461 void (*write32_async) (struct rtl_priv *rtlpriv, u32 addr, u32 val);
1484 void (*writeN_sync) (struct rtl_priv *rtlpriv, u32 addr, void *buf, 1462 void (*writen_sync)(struct rtl_priv *rtlpriv, u32 addr, void *buf,
1485 u16 len); 1463 u16 len);
1486 1464
1487 u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr); 1465 u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr);
@@ -1898,7 +1876,7 @@ struct rtl_dm {
1898 1876
1899struct rtl_efuse { 1877struct rtl_efuse {
1900 const struct rtl_efuse_ops *efuse_ops; 1878 const struct rtl_efuse_ops *efuse_ops;
1901 bool autoLoad_ok; 1879 bool autoload_ok;
1902 bool bootfromefuse; 1880 bool bootfromefuse;
1903 u16 max_physical_size; 1881 u16 max_physical_size;
1904 1882
@@ -2125,7 +2103,7 @@ struct rtl_stats {
2125 u8 rx_bufshift; 2103 u8 rx_bufshift;
2126 bool isampdu; 2104 bool isampdu;
2127 bool isfirst_ampdu; 2105 bool isfirst_ampdu;
2128 bool rx_is40Mhzpacket; 2106 bool rx_is40mhzpacket;
2129 u8 rx_packet_bw; 2107 u8 rx_packet_bw;
2130 u32 rx_pwdb_all; 2108 u32 rx_pwdb_all;
2131 u8 rx_mimo_signalstrength[4]; /*in 0~100 index */ 2109 u8 rx_mimo_signalstrength[4]; /*in 0~100 index */
@@ -2276,8 +2254,8 @@ struct rtl_hal_ops {
2276 struct ieee80211_sta *sta, 2254 struct ieee80211_sta *sta,
2277 struct sk_buff *skb, u8 hw_queue, 2255 struct sk_buff *skb, u8 hw_queue,
2278 struct rtl_tcb_desc *ptcb_desc); 2256 struct rtl_tcb_desc *ptcb_desc);
2279 void (*fill_fake_txdesc) (struct ieee80211_hw *hw, u8 *pDesc, 2257 void (*fill_fake_txdesc)(struct ieee80211_hw *hw, u8 *pdesc,
2280 u32 buffer_len, bool bIsPsPoll); 2258 u32 buffer_len, bool bsspspoll);
2281 void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc, 2259 void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc,
2282 bool firstseg, bool lastseg, 2260 bool firstseg, bool lastseg,
2283 struct sk_buff *skb); 2261 struct sk_buff *skb);
diff --git a/drivers/net/wireless/rsi/rsi_91x_debugfs.c b/drivers/net/wireless/rsi/rsi_91x_debugfs.c
index d0c35f3e2012..c71b41e45423 100644
--- a/drivers/net/wireless/rsi/rsi_91x_debugfs.c
+++ b/drivers/net/wireless/rsi/rsi_91x_debugfs.c
@@ -59,7 +59,7 @@ static int rsi_sdio_stats_read(struct seq_file *seq, void *data)
59} 59}
60 60
61/** 61/**
62 * rsi_sdio_stats_open() - This funtion calls single open function of seq_file 62 * rsi_sdio_stats_open() - This function calls single open function of seq_file
63 * to open file and read contents from it. 63 * to open file and read contents from it.
64 * @inode: Pointer to the inode structure. 64 * @inode: Pointer to the inode structure.
65 * @file: Pointer to the file structure. 65 * @file: Pointer to the file structure.
@@ -93,7 +93,7 @@ static int rsi_version_read(struct seq_file *seq, void *data)
93} 93}
94 94
95/** 95/**
96 * rsi_version_open() - This funtion calls single open function of seq_file to 96 * rsi_version_open() - This function calls single open function of seq_file to
97 * open file and read contents from it. 97 * open file and read contents from it.
98 * @inode: Pointer to the inode structure. 98 * @inode: Pointer to the inode structure.
99 * @file: Pointer to the file structure. 99 * @file: Pointer to the file structure.
@@ -178,7 +178,7 @@ static int rsi_stats_read(struct seq_file *seq, void *data)
178} 178}
179 179
180/** 180/**
181 * rsi_stats_open() - This funtion calls single open function of seq_file to 181 * rsi_stats_open() - This function calls single open function of seq_file to
182 * open file and read contents from it. 182 * open file and read contents from it.
183 * @inode: Pointer to the inode structure. 183 * @inode: Pointer to the inode structure.
184 * @file: Pointer to the file structure. 184 * @file: Pointer to the file structure.
@@ -207,7 +207,7 @@ static int rsi_debug_zone_read(struct seq_file *seq, void *data)
207} 207}
208 208
209/** 209/**
210 * rsi_debug_read() - This funtion calls single open function of seq_file to 210 * rsi_debug_read() - This function calls single open function of seq_file to
211 * open file and read contents from it. 211 * open file and read contents from it.
212 * @inode: Pointer to the inode structure. 212 * @inode: Pointer to the inode structure.
213 * @file: Pointer to the file structure. 213 * @file: Pointer to the file structure.
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index aded1ae4fad5..831046e760f8 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -239,6 +239,7 @@ static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw,
239 struct ieee80211_bss_conf *bss = &vif->bss_conf; 239 struct ieee80211_bss_conf *bss = &vif->bss_conf;
240 240
241 rsi_dbg(INFO_ZONE, "***** Hardware scan start *****\n"); 241 rsi_dbg(INFO_ZONE, "***** Hardware scan start *****\n");
242 common->mac_ops_resumed = false;
242 243
243 if (common->fsm_state != FSM_MAC_INIT_DONE) 244 if (common->fsm_state != FSM_MAC_INIT_DONE)
244 return -ENODEV; 245 return -ENODEV;
@@ -285,7 +286,7 @@ static void rsi_mac80211_cancel_hw_scan(struct ieee80211_hw *hw,
285 common->bgscan_en = false; 286 common->bgscan_en = false;
286 info.aborted = false; 287 info.aborted = false;
287 ieee80211_scan_completed(adapter->hw, &info); 288 ieee80211_scan_completed(adapter->hw, &info);
288 rsi_dbg(INFO_ZONE, "Back ground scan cancelled\b\n"); 289 rsi_dbg(INFO_ZONE, "Back ground scan cancelled\n");
289 } 290 }
290 common->hwscan = NULL; 291 common->hwscan = NULL;
291 mutex_unlock(&common->mutex); 292 mutex_unlock(&common->mutex);
@@ -370,6 +371,10 @@ static void rsi_mac80211_tx(struct ieee80211_hw *hw,
370{ 371{
371 struct rsi_hw *adapter = hw->priv; 372 struct rsi_hw *adapter = hw->priv;
372 struct rsi_common *common = adapter->priv; 373 struct rsi_common *common = adapter->priv;
374 struct ieee80211_hdr *wlh = (struct ieee80211_hdr *)skb->data;
375
376 if (ieee80211_is_auth(wlh->frame_control))
377 common->mac_ops_resumed = false;
373 378
374 rsi_core_xmit(common, skb); 379 rsi_core_xmit(common, skb);
375} 380}
@@ -677,7 +682,8 @@ static int rsi_mac80211_config(struct ieee80211_hw *hw,
677 } 682 }
678 683
679 /* Power save parameters */ 684 /* Power save parameters */
680 if (changed & IEEE80211_CONF_CHANGE_PS) { 685 if ((changed & IEEE80211_CONF_CHANGE_PS) &&
686 !common->mac_ops_resumed) {
681 struct ieee80211_vif *vif, *sta_vif = NULL; 687 struct ieee80211_vif *vif, *sta_vif = NULL;
682 unsigned long flags; 688 unsigned long flags;
683 int i, set_ps = 1; 689 int i, set_ps = 1;
@@ -810,15 +816,15 @@ static void rsi_mac80211_bss_info_changed(struct ieee80211_hw *hw,
810 adapter->ps_info.dtim_interval_duration = bss->dtim_period; 816 adapter->ps_info.dtim_interval_duration = bss->dtim_period;
811 adapter->ps_info.listen_interval = conf->listen_interval; 817 adapter->ps_info.listen_interval = conf->listen_interval;
812 818
813 /* If U-APSD is updated, send ps parameters to firmware */ 819 /* If U-APSD is updated, send ps parameters to firmware */
814 if (bss->assoc) { 820 if (bss->assoc) {
815 if (common->uapsd_bitmap) { 821 if (common->uapsd_bitmap) {
816 rsi_dbg(INFO_ZONE, "Configuring UAPSD\n"); 822 rsi_dbg(INFO_ZONE, "Configuring UAPSD\n");
817 rsi_conf_uapsd(adapter, vif); 823 rsi_conf_uapsd(adapter, vif);
824 }
825 } else {
826 common->uapsd_bitmap = 0;
818 } 827 }
819 } else {
820 common->uapsd_bitmap = 0;
821 }
822 } 828 }
823 829
824 if (changed & BSS_CHANGED_CQM) { 830 if (changed & BSS_CHANGED_CQM) {
@@ -1332,7 +1338,7 @@ static void rsi_fill_rx_status(struct ieee80211_hw *hw,
1332} 1338}
1333 1339
1334/** 1340/**
1335 * rsi_indicate_pkt_to_os() - This function sends recieved packet to mac80211. 1341 * rsi_indicate_pkt_to_os() - This function sends received packet to mac80211.
1336 * @common: Pointer to the driver private structure. 1342 * @common: Pointer to the driver private structure.
1337 * @skb: Pointer to the socket buffer structure. 1343 * @skb: Pointer to the socket buffer structure.
1338 * 1344 *
@@ -1895,6 +1901,10 @@ int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan)
1895 return 0; 1901 return 0;
1896 } 1902 }
1897 rsi_dbg(INFO_ZONE, "TRIGGERS %x\n", triggers); 1903 rsi_dbg(INFO_ZONE, "TRIGGERS %x\n", triggers);
1904
1905 if (common->coex_mode > 1)
1906 rsi_disable_ps(adapter, adapter->vifs[0]);
1907
1898 rsi_send_wowlan_request(common, triggers, 1); 1908 rsi_send_wowlan_request(common, triggers, 1);
1899 1909
1900 /** 1910 /**
@@ -1938,8 +1948,13 @@ static int rsi_mac80211_resume(struct ieee80211_hw *hw)
1938 1948
1939 rsi_dbg(INFO_ZONE, "%s: mac80211 resume\n", __func__); 1949 rsi_dbg(INFO_ZONE, "%s: mac80211 resume\n", __func__);
1940 1950
1941 if (common->hibernate_resume) 1951 if (common->hibernate_resume) {
1942 return 0; 1952 common->mac_ops_resumed = true;
1953 /* Device need a complete restart of all MAC operations.
1954 * returning 1 will serve this purpose.
1955 */
1956 return 1;
1957 }
1943 1958
1944 mutex_lock(&common->mutex); 1959 mutex_lock(&common->mutex);
1945 rsi_send_wowlan_request(common, 0, 0); 1960 rsi_send_wowlan_request(common, 0, 0);
diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c
index ca3a55ed72e4..29d83049c5f5 100644
--- a/drivers/net/wireless/rsi/rsi_91x_main.c
+++ b/drivers/net/wireless/rsi/rsi_91x_main.c
@@ -121,11 +121,8 @@ static struct sk_buff *rsi_prepare_skb(struct rsi_common *common,
121 u32 pkt_len, 121 u32 pkt_len,
122 u8 extended_desc) 122 u8 extended_desc)
123{ 123{
124 struct ieee80211_tx_info *info;
125 struct sk_buff *skb = NULL; 124 struct sk_buff *skb = NULL;
126 u8 payload_offset; 125 u8 payload_offset;
127 struct ieee80211_vif *vif;
128 struct ieee80211_hdr *wh;
129 126
130 if (WARN(!pkt_len, "%s: Dummy pkt received", __func__)) 127 if (WARN(!pkt_len, "%s: Dummy pkt received", __func__))
131 return NULL; 128 return NULL;
@@ -144,10 +141,7 @@ static struct sk_buff *rsi_prepare_skb(struct rsi_common *common,
144 payload_offset = (extended_desc + FRAME_DESC_SZ); 141 payload_offset = (extended_desc + FRAME_DESC_SZ);
145 skb_put(skb, pkt_len); 142 skb_put(skb, pkt_len);
146 memcpy((skb->data), (buffer + payload_offset), skb->len); 143 memcpy((skb->data), (buffer + payload_offset), skb->len);
147 wh = (struct ieee80211_hdr *)skb->data;
148 vif = rsi_get_vif(common->priv, wh->addr1);
149 144
150 info = IEEE80211_SKB_CB(skb);
151 return skb; 145 return skb;
152} 146}
153 147
diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index 404241424a62..8c17842ac507 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -409,8 +409,8 @@ static int rsi_load_radio_caps(struct rsi_common *common)
409 * rsi_mgmt_pkt_to_core() - This function is the entry point for Mgmt module. 409 * rsi_mgmt_pkt_to_core() - This function is the entry point for Mgmt module.
410 * @common: Pointer to the driver private structure. 410 * @common: Pointer to the driver private structure.
411 * @msg: Pointer to received packet. 411 * @msg: Pointer to received packet.
412 * @msg_len: Length of the recieved packet. 412 * @msg_len: Length of the received packet.
413 * @type: Type of recieved packet. 413 * @type: Type of received packet.
414 * 414 *
415 * Return: 0 on success, -1 on failure. 415 * Return: 0 on success, -1 on failure.
416 */ 416 */
@@ -1547,7 +1547,7 @@ int rsi_send_ps_request(struct rsi_hw *adapter, bool enable,
1547} 1547}
1548 1548
1549/** 1549/**
1550 * rsi_set_antenna() - This fuction send antenna configuration request 1550 * rsi_set_antenna() - This function send antenna configuration request
1551 * to device 1551 * to device
1552 * 1552 *
1553 * @common: Pointer to the driver private structure. 1553 * @common: Pointer to the driver private structure.
@@ -1955,7 +1955,7 @@ int rsi_handle_card_ready(struct rsi_common *common, u8 *msg)
1955 1955
1956/** 1956/**
1957 * rsi_mgmt_pkt_recv() - This function processes the management packets 1957 * rsi_mgmt_pkt_recv() - This function processes the management packets
1958 * recieved from the hardware. 1958 * received from the hardware.
1959 * @common: Pointer to the driver private structure. 1959 * @common: Pointer to the driver private structure.
1960 * @msg: Pointer to the received packet. 1960 * @msg: Pointer to the received packet.
1961 * 1961 *
@@ -2003,6 +2003,35 @@ int rsi_mgmt_pkt_recv(struct rsi_common *common, u8 *msg)
2003 return -1; 2003 return -1;
2004 rsi_send_beacon(common); 2004 rsi_send_beacon(common);
2005 break; 2005 break;
2006 case WOWLAN_WAKEUP_REASON:
2007 rsi_dbg(ERR_ZONE, "\n\nWakeup Type: %x\n", msg[15]);
2008 switch (msg[15]) {
2009 case RSI_UNICAST_MAGIC_PKT:
2010 rsi_dbg(ERR_ZONE,
2011 "*** Wakeup for Unicast magic packet ***\n");
2012 break;
2013 case RSI_BROADCAST_MAGICPKT:
2014 rsi_dbg(ERR_ZONE,
2015 "*** Wakeup for Broadcast magic packet ***\n");
2016 break;
2017 case RSI_EAPOL_PKT:
2018 rsi_dbg(ERR_ZONE,
2019 "*** Wakeup for GTK renewal ***\n");
2020 break;
2021 case RSI_DISCONNECT_PKT:
2022 rsi_dbg(ERR_ZONE,
2023 "*** Wakeup for Disconnect ***\n");
2024 break;
2025 case RSI_HW_BMISS_PKT:
2026 rsi_dbg(ERR_ZONE,
2027 "*** Wakeup for HW Beacon miss ***\n");
2028 break;
2029 default:
2030 rsi_dbg(ERR_ZONE,
2031 "##### Un-intentional Wakeup #####\n");
2032 break;
2033 }
2034 break;
2006 case RX_DOT11_MGMT: 2035 case RX_DOT11_MGMT:
2007 return rsi_mgmt_pkt_to_core(common, msg, msg_len); 2036 return rsi_mgmt_pkt_to_core(common, msg, msg_len);
2008 default: 2037 default:
diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index b412b65eb1f4..3430d7a0899e 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -138,7 +138,7 @@ static int rsi_issue_sdiocommand(struct sdio_func *func,
138} 138}
139 139
140/** 140/**
141 * rsi_handle_interrupt() - This function is called upon the occurence 141 * rsi_handle_interrupt() - This function is called upon the occurrence
142 * of an interrupt. 142 * of an interrupt.
143 * @function: Pointer to the sdio_func structure. 143 * @function: Pointer to the sdio_func structure.
144 * 144 *
@@ -875,7 +875,7 @@ static int rsi_init_sdio_interface(struct rsi_hw *adapter,
875 goto fail; 875 goto fail;
876 } 876 }
877 877
878 rsi_dbg(INIT_ZONE, "%s: Setup card succesfully\n", __func__); 878 rsi_dbg(INIT_ZONE, "%s: Setup card successfully\n", __func__);
879 879
880 status = rsi_init_sdio_slave_regs(adapter); 880 status = rsi_init_sdio_slave_regs(adapter);
881 if (status) { 881 if (status) {
@@ -1132,6 +1132,12 @@ static void rsi_disconnect(struct sdio_func *pfunction)
1132 rsi_mac80211_detach(adapter); 1132 rsi_mac80211_detach(adapter);
1133 mdelay(10); 1133 mdelay(10);
1134 1134
1135 if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 &&
1136 adapter->priv->bt_adapter) {
1137 rsi_bt_ops.detach(adapter->priv->bt_adapter);
1138 adapter->priv->bt_adapter = NULL;
1139 }
1140
1135 /* Reset Chip */ 1141 /* Reset Chip */
1136 rsi_reset_chip(adapter); 1142 rsi_reset_chip(adapter);
1137 1143
@@ -1308,6 +1314,12 @@ static int rsi_freeze(struct device *dev)
1308 rsi_dbg(ERR_ZONE, 1314 rsi_dbg(ERR_ZONE,
1309 "##### Device can not wake up through WLAN\n"); 1315 "##### Device can not wake up through WLAN\n");
1310 1316
1317 if (IS_ENABLED(CONFIG_RSI_COEX) && common->coex_mode > 1 &&
1318 common->bt_adapter) {
1319 rsi_bt_ops.detach(common->bt_adapter);
1320 common->bt_adapter = NULL;
1321 }
1322
1311 ret = rsi_sdio_disable_interrupts(pfunction); 1323 ret = rsi_sdio_disable_interrupts(pfunction);
1312 1324
1313 if (sdev->write_fail) 1325 if (sdev->write_fail)
@@ -1355,6 +1367,12 @@ static void rsi_shutdown(struct device *dev)
1355 if (rsi_config_wowlan(adapter, wowlan)) 1367 if (rsi_config_wowlan(adapter, wowlan))
1356 rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n"); 1368 rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");
1357 1369
1370 if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 &&
1371 adapter->priv->bt_adapter) {
1372 rsi_bt_ops.detach(adapter->priv->bt_adapter);
1373 adapter->priv->bt_adapter = NULL;
1374 }
1375
1358 rsi_sdio_disable_interrupts(sdev->pfunction); 1376 rsi_sdio_disable_interrupts(sdev->pfunction);
1359 1377
1360 if (sdev->write_fail) 1378 if (sdev->write_fail)
@@ -1378,7 +1396,7 @@ static int rsi_restore(struct device *dev)
1378 common->iface_down = true; 1396 common->iface_down = true;
1379 1397
1380 adapter->sc_nvifs = 0; 1398 adapter->sc_nvifs = 0;
1381 ieee80211_restart_hw(adapter->hw); 1399 adapter->ps_state = PS_NONE;
1382 1400
1383 common->wow_flags = 0; 1401 common->wow_flags = 0;
1384 common->iface_down = false; 1402 common->iface_down = false;
diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
index f360690396dd..ac0ef5ea6ffb 100644
--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
+++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
@@ -252,7 +252,7 @@ static int rsi_usb_reg_write(struct usb_device *usbdev,
252 252
253/** 253/**
254 * rsi_rx_done_handler() - This function is called when a packet is received 254 * rsi_rx_done_handler() - This function is called when a packet is received
255 * from USB stack. This is callback to recieve done. 255 * from USB stack. This is callback to receive done.
256 * @urb: Received URB. 256 * @urb: Received URB.
257 * 257 *
258 * Return: None. 258 * Return: None.
@@ -816,6 +816,13 @@ static void rsi_disconnect(struct usb_interface *pfunction)
816 return; 816 return;
817 817
818 rsi_mac80211_detach(adapter); 818 rsi_mac80211_detach(adapter);
819
820 if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 &&
821 adapter->priv->bt_adapter) {
822 rsi_bt_ops.detach(adapter->priv->bt_adapter);
823 adapter->priv->bt_adapter = NULL;
824 }
825
819 rsi_reset_card(adapter); 826 rsi_reset_card(adapter);
820 rsi_deinit_usb_interface(adapter); 827 rsi_deinit_usb_interface(adapter);
821 rsi_91x_deinit(adapter); 828 rsi_91x_deinit(adapter);
diff --git a/drivers/net/wireless/rsi/rsi_main.h b/drivers/net/wireless/rsi/rsi_main.h
index 4dc0c0123469..35d13f35e9b0 100644
--- a/drivers/net/wireless/rsi/rsi_main.h
+++ b/drivers/net/wireless/rsi/rsi_main.h
@@ -311,6 +311,7 @@ struct rsi_common {
311 struct cfg80211_scan_request *hwscan; 311 struct cfg80211_scan_request *hwscan;
312 struct rsi_bgscan_params bgscan; 312 struct rsi_bgscan_params bgscan;
313 u8 bgscan_en; 313 u8 bgscan_en;
314 u8 mac_ops_resumed;
314}; 315};
315 316
316struct eepromrw_info { 317struct eepromrw_info {
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 353fb722ab98..48703ec60d06 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2126,6 +2126,8 @@ ieee80211_he_oper_size(const u8 *he_oper_ie)
2126#define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0 2126#define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0
2127#define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1 2127#define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1
2128#define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2 2128#define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2
2129#define IEEE80211_SPCT_MSR_RPRT_TYPE_LCI 8
2130#define IEEE80211_SPCT_MSR_RPRT_TYPE_CIVIC 11
2129 2131
2130/* 802.11g ERP information element */ 2132/* 802.11g ERP information element */
2131#define WLAN_ERP_NON_ERP_PRESENT (1<<0) 2133#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 6674412f9270..459d355f6506 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -291,6 +291,12 @@ enum ieee80211_radiotap_he_bits {
291 291
292 IEEE80211_RADIOTAP_HE_DATA6_NSTS = 0x000f, 292 IEEE80211_RADIOTAP_HE_DATA6_NSTS = 0x000f,
293 IEEE80211_RADIOTAP_HE_DATA6_DOPPLER = 0x0010, 293 IEEE80211_RADIOTAP_HE_DATA6_DOPPLER = 0x0010,
294 IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN = 0x0020,
295 IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW = 0x00c0,
296 IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ = 0,
297 IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ = 1,
298 IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ = 2,
299 IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ = 3,
294 IEEE80211_RADIOTAP_HE_DATA6_TXOP = 0x7f00, 300 IEEE80211_RADIOTAP_HE_DATA6_TXOP = 0x7f00,
295 IEEE80211_RADIOTAP_HE_DATA6_MIDAMBLE_PDCTY = 0x8000, 301 IEEE80211_RADIOTAP_HE_DATA6_MIDAMBLE_PDCTY = 0x8000,
296}; 302};