History log of /linux-master/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
Revision Date Author Comments
# b376d963 28-Sep-2022 Felix Fietkau <nbd@nbd.name>

wifi: mt76: move mt76_rate_power from core to mt76x02 driver code

Its layout and code is mt76x02 specific

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 633f77b5 21-Nov-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x02: introduce SAR support

Add SAR spec support to mt76x02 driver to allow configuring SAR power
limitations on the frequency ranges from the userland.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 48dbce5c 12-Nov-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move band capabilities in mt76_phy

This is a preliminary patch to move properly support mt7915 dbdc

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 328cecf3 21-Aug-2020 Lee Jones <lee.jones@linaro.org>

mt76: mt76x0: Move tables used only by init.c to their own header file

Taking the same approach as initvals_phy.h.

Fixes the following W=1 kernel build warning(s):

drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:218:35: warning: ‘mt76x0_dcoc_tab’ defined but not used [-Wunused-const-variable=]
218 | static const struct mt76_reg_pair mt76x0_dcoc_tab[] = {
| ^~~~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:86:35: warning: ‘mt76x0_bbp_init_tab’ defined but not used [-Wunused-const-variable=]
86 | static const struct mt76_reg_pair mt76x0_bbp_init_tab[] = {
| ^~~~~~~~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:48:35: warning: ‘mt76x0_mac_reg_table’ defined but not used [-Wunused-const-variable=]
48 | static const struct mt76_reg_pair mt76x0_mac_reg_table[] = {
| ^~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:14:35: warning: ‘common_mac_reg_table’ defined but not used [-Wunused-const-variable=]
14 | static const struct mt76_reg_pair common_mac_reg_table[] = {
| ^~~~~~~~~~~~~~~~~~~~

Cc: Felix Fietkau <nbd@nbd.name>
Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 65ba7fa4 25-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x0: enable MCS 8 and MCS9

Enable MCS8 and MCS9 for mt76x0{u,e} devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 96747a51 12-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: move channel state to struct mt76_phy

Add support for an extra wiphy in mt76_set_channel and mt76_get_survey
This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fdb96b06 12-Sep-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x02u: move mt76x02u_mac_start in mt76x02-usb module

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>


# d5b3be41 12-Sep-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x0u: reset counter starting the device

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>


# 7b37cce0 12-Sep-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x02: move mac_reset_counter in mt76x02_lib module

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>


# 09952572 31-May-2019 Felix Fietkau <nbd@nbd.name>

mt76: fix setting chan->max_power

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>


# 1802d0be 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174

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>


# cee646d6 27-Mar-2019 Felix Fietkau <nbd@nbd.name>

mt76: fix tx power issues

- 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>


# 8d71aef9 19-Mar-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: introduce mt76x02_beacon.c

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>


# 4606a26c 25-Feb-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x02: fix ED/CCA enabling/disabling

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>


# 1ffe410e 28-Jan-2019 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init: introduce mt76x0_init_txpower routine

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>


# fa235526 31-Jan-2019 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove mt76x0u_alloc_device routine

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>


# c0f7b25a 31-Jan-2019 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move alloc_device common code in mt76_alloc_device

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>


# 269906ac 06-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: introduce mt76x02_config_mac_addr_list routine

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>


# 3d2d61b5 26-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: remove wait argument from mt76x02_mcu_function_select

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>


# 24702cdb 28-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration

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>


# 48c76588 28-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init: use mt76x02_mac_shared_key_setup in mt76x0_init_hardware

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>


# fc245983 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: introduce mt76x02_init_beacon_config routine

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>


# 5cbace02 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_init_device in mt76x02-lib module

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>


# 00eccdd6 16-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init: simplify mt76x0_init_mac_registers

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>


# e0168dc6 17-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: usb: fix static tracepoints

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>


# 73556561 15-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: use mt76x02_mac_work as stats handler

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>


# 63f15d94 15-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: use shared debugfs implementation

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>


# 9c410782 14-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: phy: use proper name convention

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>


# f3727dae 08-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: reserve enough room for USB tx skbs

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>


# d87cf75f 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: use mt76x02_dev instead of mt76_dev in mt76x02_util.c

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>


# 499cd0aa 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mcu.c

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>


# 7a07adcd 05-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: rename mt76x02_util.h in mt76x02.h

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>


# b2d871c0 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: merge mt76x0_dev in mt76x02_dev

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>


# 46a74187 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove hw_atomic_mutex mutex in mt76x0_dev

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>


# 63cc936b 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove unused variable in mt76x0_dev

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>


# ac85ab8c 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: mac: use sta ewma estimation for rssi tracking

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>


# 5e6c49ec 01-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init: remove unnecessary configurations

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>


# b11e1969 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: add ieee80211_ops ops pointer to mt76x0_alloc_device signature

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>


# 2b2cb40b 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: pci: add hw initialization at bootstrap

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>


# faa605bd 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: usb: move initialization code in usb.c

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>


# a31821ab 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init rx filter in mt76x0_init_hardware

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>


# 512bd4b1 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init: remove MT_PBF_SYS_CTRL configuration in mt76x0_reset_csr_bbp

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>


# 00aaded0 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init: remove duplicated initialization

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>


# 3b11db26 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: use mt76x02 utility routines in mt76x0 init code

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>


# a6daf796 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_beacon_offset in mt76x02_util.c

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>


# 5b394355 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: use mt76_poll in mt76x0_set_wlan_state

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>


# 196e978c 11-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove unused usb header file

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>


# 28041571 11-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove mcu source file

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>


# 576ecf65 11-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: usb: move firmware loading to usb.c

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>


# 331419b2 09-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: remove mt76x0_burst_write_regs()

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>


# 17507157 09-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: usb: use common helpers for mcu_alloc_msg()/mcu_send_msg()

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>


# f1638c7c 09-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: add usb implementation of {wr,rd}_rp

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>


# 835123b7 06-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: make device allocation bus neutral

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>


# 6d1bced1 06-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: remove some usb specific code from mt76x0_register_device

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>


# c2a4d9fb 06-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: inital split between pci and usb

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>


# 1bee323a 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: use mt76_register_device for device registration

Use mt76_register_device routine for device registration.
mt76_register_device allows to enable VHT support on 5GHz band.
Overwrite unsupported vht features with mt76x0_vht_cap_mask routine.
Remove macaddr field of mt76x0_dev data structure and
use the mt76_dev one. Moreover remove following unused routines:
- mt76_init_sband
- mt76_init_sband_2g
- mt76_init_sband_5g

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 540399d5 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove has_{2,5}ghz fields of mt76x0_eeprom_params

Remove has_2ghz/has_5ghz fields of mt76x0_eeprom_params data
structure and use mt76_dev ones. This is a preliminary patch
to use shared routines for device allocation

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6f15ed16 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: do not free/alloc buffers during suspend/resume

Do not free/alloc {tx,rx} buffers during suspend/resume phases
but use the ones previously allocated during hw probe.
Move {tx,rx}/mcu buffers allocation from mt76x0_init_hardware routine
to mt76x0_register_device

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e30a655e 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: move mt76x0_init_hardware in mt76x0_register_device

Move mt76x0_init_hardware routine in mt76x0_register_device
during hw probe. This is a preliminary patch to avoid {tx/rx}
buffer allocation during resume/suspend

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b680d7fb 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: move stop related routines in mt76x0_mac_stop

Move tear-down routines in mt76x0_mac_stop function.
mt76x0_mac_stop routines will be reused in mt76x0_suspend

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# cb722aed 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: fix memory leak during hw probe

Fix memory leak during hw probe if mt76x0_register_device fails
since MT76_STATE_INITIALIZED has not set yet and mt76x0_cleanup
does not free tx/rx queues and mcu buffers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 58b5eb8c 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76 rate definitions in mt76x02-lib module

Move mt76x2_rate definition in mt76x02-lib module and rename it in
mt76x02_rates in order to be reused in mt76x0 driver.
Moreover remove unused mt76_rate definition

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7c7b1394 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove mt76x0_stop_hardware routine

Since it is actually used in a single place and it just
runs mt76x0_chip_onoff routine, remove mt76x0_stop_hardware
and use mt76x0_chip_onoff directly

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0ae976a1 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init hw capabilities

Enable hw capabilities supported by mt76-usb layer
- fast_xmit
- tx/rx amsdu
- MFP
- non-linear tx skbs

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 67f5e7a7 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: enable per-sta tx queueing

Initialize wake_tx_queue function pointer in ieee80211_ops
in order to enable per-sta tx queueing. Moreover set driver
private txq size

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7cbe4c76 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove unused stat_work

Remove unused definition of stat_work delayed_work definition and
related flush/cancel routines

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c1b6325d 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove unused endpoint definitions

remove unused usb endpoint definitions since mt76x0
uses mt76-usb ones. Moreover remove unused usb_ctrl mutex

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6d449d12 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove unused {tx/rx}_queue definitions

Remove unused tx_queue and rx_queue definitions since
now mt76x0 driver uses mt76-usb {tx/rx}_queues

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4220878b 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove unused stat work_queue

Remove unused tx_status workqueue since now tx feedbacks are
processed by mt76-usb layer

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 37d36366 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove unused dma.c source file

Remove unused dma.c source file since dma related routines are no
longer used

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c6687464 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: set max fragments size

Set maximum number of tx fragments according to usb controller
features

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 30ec9152 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: unify tx/rx datapath with mt76x2u driver

Use mt76/mt76-usb shared routine for tx/rx datapath.
Initialize mt76-usb tx/rx queues in mt76x0_init_hardware and
deallocate them in mt76x0_cleanup routine.
Moreover remove data padding in mt76_mac_process_rx routine.
Furthermore remove unused skb2q routine

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 95e507d2 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: use mt76_alloc_device for device allocation

Use mt76_alloc_device utility routine for mt76x0_dev/mt76_dev
allocation

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f2653a4e 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: init mt76_driver_ops callbacks

Init mt76_driver_ops callbacks in mt76x0_alloc_device.
mt76_driver_ops callbacks will be used by mt76-usb module

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7fd3c60c 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: disable usb rx bulk aggregation

In order to use zero-copying, disable usb rx bulk aggregation

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 493703aa 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: reserve enough space in mac80211

Allocate skg with enough headroom by mac80211 , this eliminate need
to add extra skb headroom by the mt76x0 driver.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5327b5ea 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify sta_rate_tbl_update and related helpers

Use common sta_rate_tbl_update on mt76x0 and mt76x2.
mt76x0 do not have support TPC (transmision power control) implmented,
msta->wcid.max_txpwr_adj is only set for mt76x2.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 36404c06 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: move wcid fields to common mt76_dev struct

All current MT devices including new MT7603 type chips support 128
WCIDs, we can unify wcid data in common mt76_dev structure.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6f4796b7 24-Aug-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: use mt76u_mcu_send_msg utility routine to send fw cmds

Use mt76u_mcu_send_msg/__mt76u_mcu_send_msg utility routines to
send commands to usb mcu. Remove following unused routines:
- mt76x0_mcu_wait_resp
- __mt76x0_mcu_msg_send
- mt76x0_mcu_msg_send
- mt76x0_dma_skb_wrap_cmd
- trace_mt_mcu_msg_send_cs
- mt76x0_mcu_cmd_deinit

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 795dbf0f 24-Aug-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: use mt76u_init for bus initialization

Use mt76u_init utility routine for usb initialization.
Moreover remove following unused routines:
- mt76x0_rr
- mt76x0_wr
- mt76x0_rmw
- mt76x0_wr_copy
- mt76x0_assign_pipes

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 16c8a792 29-Aug-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: use mt76x02_sta and mt76x02_tx_status

Use common mt76x02_sta and mt76x02_tx_status structures in mt76x0 sub-driver.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 98ff26e5 29-Aug-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify mt76x02_vif struct

Private vif structures definitions are the same for mt76x2 and mt76x0.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 108a4861 29-Aug-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: create new mt76x02-lib module for common mt76x{0,2} code

Move rxfilter and mutex to common structure. Create mt76x02-lib.ko
for mt76x0 and mt76x2 common functions and create new unified
mt76x02_configure_filter() function there.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 797ea240 29-Aug-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: merge mt76x0/regs.h into mt76x02_regs.h

Add missed definitions for mt76x0 into mt76x02_regs.h. Remove
mt76x0/regs.h and fixup mt76x0 code to adjust to some diffrent
registers/fields names.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 2735a6dd 29-Aug-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify wait_for_mac

Create new mt76x02_mac.h for common mac functions of mt76x0 and mt76x2
and unity wait_for_mac for both drivers.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 369bbecd 31-Jul-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: disable HW before probe

Disable HW before probe, otherwise after reboot we will fail
to initialize MCU.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 134b2d0d 31-Jul-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: init files

Add init files of mt76x0 driver.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>