aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt76x0/init.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-11-20mt76: mt76x02u: move mt76x02u_mac_start in mt76x02-usb moduleLorenzo Bianconi1-16/+0
Unify mt76x02u_mac_start between mt76x2u and mt76x0u since the code is shared between both drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: mt76x0u: reset counter starting the deviceLorenzo Bianconi1-2/+1
Remove mt76x02_mac_reset_counters from mt76x0_init_hardware since it will be run starting the device Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: mt76x02: move mac_reset_counter in mt76x02_lib moduleLorenzo Bianconi1-11/+1
Unify mac_reset_counter routine and move it in mt76x02_lib module since it is shared by all mt76x02 drivers (pci/usb) Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-30Merge tag 'mt76-for-kvalo-2019-06-27' of https://github.com/nbd168/wirelessKalle Valo1-2/+3
mt76 patches for 5.3 * use NAPI polling for tx cleanup on mt7603/mt7615 * various fixes for mt7615 * unify some code between mt7603 and mt7615 * fix locking issues on mt76x02 * add support for toggling edcca on mt7603 * fix reading target tx power with ext PA on mt7603/mt7615 * fix initalizing channel maximum power * fix rate control / tx status reporting issues on mt76x02/mt7603 * add support for eeprom calibration data from mtd on mt7615 * support configuring tx power on mt7615 * fix external PA support on mt76x0 * per-chain signal reporting on mt7615 * rx/tx buffer fixes for USB devices
2019-06-27mt76: fix setting chan->max_powerFelix Fietkau1-2/+3
When setting chan->max_power after registering the wiphy, chan->max_reg_power needs to be used as a limit Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174Thomas Gleixner1-9/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 655 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-01mt76: fix tx power issuesFelix Fietkau1-0/+1
- tx power is stored in the channels after ieee80211_register_hw, so chan->orig_mpwr needs to be updated as well - for non-TSSI devices, mt76x2e needs to use a different target power value from the EEPROM - fix a rounding error in a few places (need to round up, not down) Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-05-01mt76x02: introduce mt76x02_beacon.cStanislaw Gruszka1-1/+0
Move most of beaconing code into separate file and separate beacon initialization for USB and MMIO as pre TBTT implementation for USB will be different. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-02-26mt76: mt76x02: fix ED/CCA enabling/disablingFelix Fietkau1-0/+2
ED/CCA needs to be disable before stopping the MAC to avoid hangs from tx being blocked. It must only be enabled again after the MAC has been started again. In many places this wasn't done properly, so fix this by always clearing the relevant ED/CCA bits in mt76x2_mac_stop and set it up again after channel change or calibration is done Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-02-18mt76x0: init: introduce mt76x0_init_txpower routineLorenzo Bianconi1-2/+27
Add mt76x0_init_txpower in order to initialize max_power per channel at device bootstrap. Modify mt76x0_get_tx_power_per_rate and mt76x0_get_power_info signature in order to compute tx power for non-operating channels Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-02-18mt76x0: remove mt76x0u_alloc_device routineLorenzo Bianconi1-19/+0
Remove mt76x0u_alloc_device since it just runs mt76_alloc_device. Move mt76_alloc_device call in mt76x0u_probe and in mt76x0e_probe Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-02-18mt76: move alloc_device common code in mt76_alloc_deviceLorenzo Bianconi1-4/+1
Move mt76x{0,2} alloc_device common code in mt76_alloc_device and remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: introduce mt76x02_config_mac_addr_list routineLorenzo Bianconi1-0/+2
Add mt76x02_config_mac_addr_list routine in order to set the mac address list supported by the driver. Initialize wiphy->addresses/n_addresses for mt76x0e driver Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: remove wait argument from mt76x02_mcu_function_selectStanislaw Gruszka1-1/+1
Remove wait argument from mt76x02_mcu_function_select and wait for response when function is not Q_SELECT, what is the same behaviour like in vendor driver. Note this change behaviour for PCIe devices for Q_SELECT function form wait to no-wait, and for mt76x0u BW_SETTING from no-wait to wait. But the change is in align with vendor driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76x0: init: use mt76x02_mac_wcid_setup for wcid configurationLorenzo Bianconi1-43/+2
Use mt76x02_mac_wcid_setup utility routine for wcid init configuration and remove duplicated code. This patch fixes a mt76x0 AP issue since hw key table selection was set to pairwise by default Fixes: dbad2adcb2c7 ("mt76x0: pci: enable AP support") Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76x0: init: use mt76x02_mac_shared_key_setup in mt76x0_init_hardwareLorenzo Bianconi1-9/+4
Use mt76x02_mac_shared_key_setup utility routine for shared key initialization and remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: introduce mt76x02_init_beacon_config routineLorenzo Bianconi1-7/+1
Add mt76x02_init_beacon_config utility routine in mt76x02-lib module in order to be reused by mt76x0 driver configuring BSSID registers and remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: move mt76x02_init_device in mt76x02-lib moduleLorenzo Bianconi1-33/+3
Move mt76x02_init_device routine in mt76x02_util.c in order to be reused by mt76x0 driver and remove duplicated code. Move interface combo definition supported by the driver in mt76x02_init_device routine Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76x0: init: simplify mt76x0_init_mac_registersLorenzo Bianconi1-17/+10
Simplify mt76x0_init_mac_registers routine using mt76_set, mt76_clear and mt76_rmw utility routines Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76: usb: fix static tracepointsLorenzo Bianconi1-1/+0
Add submit_urb and rx_urb static tracepoints in mt76-usb module. Move trace_mac_txstat_fetch in mt76x02_mac_load_tx_status routine in order to be available to usb drivers. Moreover remove no longer used mt76x0/trace.{c,h} Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76x0: use mt76x02_mac_work as stats handlerLorenzo Bianconi1-2/+1
Use mt76x02_mac_work utility routine as stats workqueue handler and remove duplicated code. Moreover run mac stuck check in mt76x02_mac_work for client interfaces. Remove no longer used avg_ampdu_len and mt76x02_mac_stats data structure in mt76x02_dev Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76x0: use shared debugfs implementationLorenzo Bianconi1-1/+1
Use mt76x02 debugfs implementation and remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-11-30mt76x0: phy: use proper name conventionLorenzo Bianconi1-1/+1
Use mt76x0_phy as prefix for routines in mt76x0/phy.c Moreover use mt76x0_rf_set to enable vco calibration in mt76x0_phy_vco_cal Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-13mt76: reserve enough room for USB tx skbsStanislaw Gruszka1-1/+4
Reserve enough room for USB skb, so we don not need to check the room every time we send frame. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-13mt76: use mt76x02_dev instead of mt76_dev in mt76x02_util.cLorenzo Bianconi1-1/+1
Use mt76x02_dev data structure as reference in mt76x02_util.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-13mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mcu.cLorenzo Bianconi1-1/+1
Use mt76x02_dev data structure as reference in mt76x02_mcu.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76: rename mt76x02_util.h in mt76x02.hLorenzo Bianconi1-3/+0
Rename mt76x02_util.h header file in mt76x02.h since now contains all mt76x02 related definitions and not just utility routines declarations Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76x0: merge mt76x0_dev in mt76x02_devLorenzo Bianconi1-17/+17
Merge mt76x0_dev data structure in mt76x02_dev one and remove duplicated code. Remove unused definition in mt76x0.h. Moreover merge mt76x0_caldata and mt76x02_rx_freq_cal data structures. This is a preliminary patch for rxwi unification. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76x0: remove hw_atomic_mutex mutex in mt76x0_devLorenzo Bianconi1-5/+0
Remove hw_atomic_mutex mutex in mt76x0_dev data structure since mt76x0_phy_set_channel is already protected by mt76_dev mutex while mt76x0_chip_onoff is used just at device probe or cleanup Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76x0: remove unused variable in mt76x0_devLorenzo Bianconi1-1/+0
Remove no longer used mac_lock spinlock and data array in mt76x0_dev data structure Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76x0: mac: use sta ewma estimation for rssi trackingLorenzo Bianconi1-1/+0
Use shared mt76x02 utility routines for rssi tracking. Moreover remove no longer used con_mon_lock spinlock and following variable: - ap_bssid - bcn_freq_off - bcn_phy_mode - avg_rssi Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-05mt76x0: init: remove unnecessary configurationsLorenzo Bianconi1-6/+0
Remove leftover configuration for legacy devices in mt76x0_init_mac_registers routine. Moreover remove unnecessary msleep delay Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76x0: add ieee80211_ops ops pointer to mt76x0_alloc_device signatureLorenzo Bianconi1-29/+8
Add ieee80211_ops ops pointer to mt76x0_alloc_device routine signature in order to specify mac80211 callbacks and remove usb dependency from mt76x0 generic code. Move mt76x0_ops callbacks in usb module in order to remove leftover usb dependency in mt76x0 generic code. Introduce mt76x0e_ops mac80211 callbacks for pci code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76x0: pci: add hw initialization at bootstrapLorenzo Bianconi1-7/+3
Add mt76x0e_register_device routine in pci.c to initialize the device during hw probe. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76x0: usb: move initialization code in usb.cLorenzo Bianconi1-54/+0
Move usb initialization code in mt76x0-usb module in order to remove usb dependency from generic init code (not completed yet). Moreover fix a memory leak in usb probe if mt76x02_wait_for_mac fails Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76x0: init rx filter in mt76x0_init_hardwareLorenzo Bianconi1-8/+2
Initialize rxfilter mask at bootstrap an not at mac start. This is a preliminary patch to share mt76x2_mac_start routine between mt76x2e and mt76x0e drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76x0: init: remove MT_PBF_SYS_CTRL configuration in mt76x0_reset_csr_bbpLorenzo Bianconi1-9/+3
Remove MT_PBF_SYS_CTRL configuration in mt76x0_reset_csr_bbp since it is already initialized in mt76x0_init_mac_registers routine Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76x0: init: remove duplicated initializationLorenzo Bianconi1-3/+0
Remove MT_HEADER_TRANS_CTRL_REG/MT_TSO_CTRL configuration since they are already initialized in mt76x0_init_mac_registers routine Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76x0: use mt76x02 utility routines in mt76x0 init codeLorenzo Bianconi1-13/+6
Use mt76x02_wait_for_wpdma and mt76x02_wait_for_txrx_idle utility routines in mt76x0_init_hardware and mt76x0_mac_start and remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76: move mt76x02_beacon_offset in mt76x02_util.cLorenzo Bianconi1-27/+1
Move mt76x02_beacon_offset utility routine in mt76x02-lib module since it is shared between mt76x0 and mt76x2 driver and remove duplicated code. Moreover move beacon_offset data structure in mt76x02-lib module since it is shared between mt76x0 and mt76x2 drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-10-01mt76x0: use mt76_poll in mt76x0_set_wlan_stateLorenzo Bianconi1-15/+3
Use mt76_poll utility routine in mt76x0_set_wlan_state to check if the PLL/XTAL is ready Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76x0: remove unused usb header fileLorenzo Bianconi1-1/+0
Remove unused usb header file and move mt76x0 firmware definition in usb.c Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76x0: remove mcu source fileLorenzo Bianconi1-1/+1
Remove mcu.c source file since it contains just 'one-line' function that is shared between PCI and USB code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76x0: usb: move firmware loading to usb.cStanislaw Gruszka1-9/+0
Firmware loading is usb specific, move it to usb.c file. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76x0: remove mt76x0_burst_write_regs()Stanislaw Gruszka1-16/+9
We don't need to use custom burst write regs via MCU, we can use generic mt76_wr_copy() for the same purpose. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76: usb: use common helpers for mcu_alloc_msg()/mcu_send_msg()Lorenzo Bianconi1-3/+3
Use mcu common helpers instead of usb specific routines. Add static qualifier to the following functions: - mt76u_mcu_msg_alloc - __mt76u_mcu_send_msg - mt76u_mcu_send_msg - mt76u_mcu_wr_rp - mt76u_mcu_rd_rp - mt76u_wr_rp - mt76u_rd_rp This is a preliminary patch to move mt76x02 usb mcu code in mt76x02-usb module Acked-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76: add usb implementation of {wr,rd}_rpStanislaw Gruszka1-2/+3
Add USB implementation for read and write reg pair routines. The actual implementation can use mcu related routines according to MCU state Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76x0: make device allocation bus neutralStanislaw Gruszka1-8/+3
Remove some USB specific code form mt76x0_alloc_device. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76x0: remove some usb specific code from mt76x0_register_deviceStanislaw Gruszka1-8/+0
Initial effort to make mt76x0_register_device bus neutral. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-09-19mt76x0: inital split between pci and usbStanislaw Gruszka1-0/+6
For now pci driver can read ASIC version from the device :-) Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>