Move mt76x2_ext_pa_enabled utility routine in mt76x02_eeprom.c
and remove duplicated code. This is a preliminary patch to
unify eeprom code between mt76x2 and mt76x0 driver
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Move mt76x2_efuse_read and mt76x2_get_efuse_data in mt76x02_eeprom.c
in order to be reused in mt76x0 driver for eeprom parsing
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Move mt76x02_mac_setaddr utility routine in mt76x02-lib
module and remove duplicated code. This is a preliminary patch
to unify eeprom code between mt76x2 and mt76x0 driver
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Move mt76x2_eeprom_get utility routine in mt76x02_eeprom.h since
it will be used to parse mt76x0 eeprom in order to unify eeprom
support between mt76x2 and mt76x0 drivers
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Move mt76x2 and mt76x0 common definitions in mt76x02_eeprom.h
and remove duplicated code
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Move seq_put_array utility routine in mt76-core module
in order to be reused in mt76x0 driver
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Add mt7650 PCI id found on ASUS rt-51ac to pci_device_id table
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Fix tx power configuration for VHT 1SS/STBC mcs 9 since
in MT_TX_PWR_CFG_{8,9} mcs 8,9 bits are GENMASK(21,16) and
GENMASK(29,24) while GENMASK(15,6) are marked as reserved
Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Remove mt76_fw dependency from mt76x0u_upload_firmware routine since
it does not define firmware layout properly. Moreover use mt76_poll_msec
utility routine to check if the fw is properly running
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Remove unused usb header file and move mt76x0 firmware definition
in usb.c
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Cleanup {tx,rx} and mcu queues if resume operation fails
Fixes: ee676cd5017c ("mt76: add driver code for MT76x2u based devices")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move mt76x2_phy_tssi_compensate routine in mt76x2-common module
since it is shared between mt76x2 and mt76x2u drivers
Signed-off-by: Lorenzo Bianconi <[email protected]>
Move mcu_calibrate routine in mt76x02-lib module since it is
shared between USB and PCI code. Moreover remove duplicated
code
Signed-off-by: Lorenzo Bianconi <[email protected]>
Use mcu common helpers instead of mt76x2 specific routines for
mcu_alloc_msg()/mcu_send_msg(). This is a preliminary patch to
unify mt76e and mt76u mcu code
Signed-off-by: Lorenzo Bianconi <[email protected]>
Use mt76_dev data structure instead of mt76x2_dev one in mt76x2_mcu_msg_send
and mt76x2_mcu_get_response routines. Moreover add wait_resp parameter to
mt76x2_mcu_msg_send signature. This is a preliminary patch in order to unify
mcu_msg_alloc()/mcu_msg_send() between pcie and usb code
Signed-off-by: Lorenzo Bianconi <[email protected]>
Introduce mt76_mmio data structure in mt76_dev and
move mt76x2_mcu in mt76_mmio. This is a preliminary
patch to unify mcu code between mt76x02{e,u} drivers
Signed-off-by: Lorenzo Bianconi <[email protected]>
Use mt76_dev data structure instead of mt76x2_dev one in
mt76x2_tx_queue_mcu routine. This is a preliminary patch
to share mcu code between mt76x2e and mt76x0e
Signed-off-by: Lorenzo Bianconi <[email protected]>
Remove mt76_mcu_msg_alloc return value check since it is already
evaluated in __mt76x02u_mcu_send_msg
Signed-off-by: Lorenzo Bianconi <[email protected]>
Add static qualifier to mt76x02_remove_dma_hdr routine and
do not export the symbol since it is only used in mt76x02_util.c
Signed-off-by: Lorenzo Bianconi <[email protected]>
Move mt76u_skb_dma_info routine in mt76x02-usb module and rename it in
mt76x02u_skb_dma_info. Moreover move mt76x02u_set_txinfo in
mt76x02_usb_core.c. This is a preliminary patch to move MT_TXD_INFO,
MT_MCU_MSG and MT_RX_FCE_INFO defs in mt76x02-lib module since other
chipsets (e.g. mt7603) use different dma definitions
Acked-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Introduce mt76x02_usb_mcu.c in order to contain mt76x02u mcu related
code. Add mt76x02-usb module as a container for mt76x02 usb code.
This is a preliminary patch to move MT_TXD_INFO, MT_MCU_MSG and
MT_RX_FCE_INFO defs in mt76x02-lib module since other chipsets (e.g.
mt7603) use different dma definitions
Acked-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
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 <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Introduce mt76_mcu_ops data structure to contain mcu related function
pointers. This is a preliminary patch to move mt76x02 usb mcu code in
mt76x02-usb module
Acked-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
According to vendor sdk, vco calibration has to be executed
for each channel configuration whereas mcu calibration has to be
performed during channel scanning. This patch fixes the mt76x0
monitor mode issue since in that configuration vco calibration
was never executed
Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
Tested-by: Sid Hayn <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Move tear-down routines in mt76x0_mac_stop function.
mt76x0_mac_stop routines will be reused in mt76x0_suspend
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
swap mt76u_mcu_init_rx and mt76x0_mcu_function_select in
mt76x0_mcu_cmd_init routine in order to allocate mcu buffers
first and then send mcu commands
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Remove unused tx_status workqueue since now tx feedbacks are
processed by mt76-usb layer
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Remove unused dma.c source file since dma related routines are no
longer used
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Set maximum number of tx fragments according to usb controller
features
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Introduce mt76x0_queue_rx_skb routine as mt76x0 driver
frame rx handler. mt76x0_queue_rx_skb will be run by mt76-usb layer
rx datapath
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Set MT76_STATE_RUNNING flag in mt76x0_start routine and
clear it in mt76x0_stop one
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
In order to use zero-copying, disable usb rx bulk aggregation
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
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 <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Move mt76x2u_tx_status_data routine in mt76x02-lib module and rename it
in mt76x02_tx_status_data in order to be reused in mt76x0 driver
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Add mt76x0_tx_prepare_skb routine as tx txwi handler.
mt76x0_tx_prepare_skb will be used by mt76-usb layer
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Move mt76x2u_set_txinfo routine in mt76x02-lib module and rename it in
mt76x02_set_txinfo in order to be reused in mt76x0 driver
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Move mt76_qsel definition in dma.h in order to be reused in mt76x0
driver. Moreover remove empty mt76x2_dma.h header file
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Move mt76x2u_tx_complete_skb routine in mt76x02-lib module
and rename it in mt76x02_tx_complete_skb in order to be reused
in mt76x0 driver
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Move mt76x2u_remove_dma_hdr in mt76x02-lib module and rename it in
mt76x02_remove_dma_hdr. Moreover use mt76x02_remove_hdr_pad routine
in mt76x02_remove_dma_hdr function.
Furthermore remove mt76x0_tx_skb_remove_dma_overhead routine
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Move mt76x2_tx_complete routine in mt76x02-lib module and rename it in
mt76x02_tx_complete in order to be used in mt76x0 driver
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Use mt76_dev instead of mt76x2_dev in mt76x2_tx_complete signature
in order to be reused in mt76x0 driver
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Verify if evt field is set to EVT_CMD_DONE in usb mcu
response messages. This is a preliminary patch for usb_mcu layer
unification between mt76x0u and mt76x2u driver.
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Remove the following unused routines for usb buffer
allocation/free/submit:
- mt76x0_usb_alloc_buf
- mt76x0_usb_free_buf
- mt76x0_usb_submit_buf
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Use mt76u_mcu_fw_send_data utility routine for firmware uploading and
remove unused __mt76x0_dma_fw/mt76x0_dma_fw functions
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
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 <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Delete core.c source file since, removing mt76x0_wait_asic_ready
routine, it is no longer needed
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Remove mt76x0_vendor_request routine and use
mt76u_vendor_request utility function from mt76-usb
layer in mt76x0_upload_firmware
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Remove mt76x0_complete_urb routine and use mt76u_mcu_complete_urb utility
function as usb mcu completion handler
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Use mt76 usb shared completion data structure in
mt76x0_mcu_wait_resp routine and remove mt76x0
private one
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Remove mt76x0_mcu_msg_alloc duplicated routine and use mt76u_mcu_msg_alloc
utility function for usb mcu message allocation
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Remove mt76x0_vendor_single_wr routine and use mt76u_single_wr
utility function for mcu firmware loading
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Remove mt76x0_vendor_reset duplicated routine and use mt76u_mcu_fw_reset
utility function for mcu fw reset
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
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 <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Introduce multiple regs read support to mcu layer in mt76-usb module.
Multiple regs read will be reused by mt76x0 driver in usb mcu layer
unification between mt76x0 and mt76x2u drivers
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move mt76x2u_mcu_deinit routine in usb_mcu layer in order to
be reused by mt76x0 driver in usb mcu layer unification between
mt76x0 and mt76x2u drivers
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Split __mt76u_mcu_send_msg and mt76u_mcu_send_msg in order to be reused
by mt76x0 driver in usb mcu layer unification between mt76x0 and
mt76x2u drivers
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move common definition of mt76_reg_pair in mt76.h
and remove duplicated code in mt76x2_init_common.c
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
MT76x2u is a 2x2 USB 802.11ac chipset by MediaTek. This driver currently
support station mode
Tested-by: <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move mt76x2_debugfs code in mt76-common module since it is shared
between mt76x2 and mt76x2u
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move phy related code shared between mt76x2 and mt76x2u in
mt76x2-common module
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move core related code shared between mt76x2 and mt76x2u in
mt76x2-common module
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move init related code shared between mt76x2 and mt76x2u in
mt76x2-common module
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move mac related code shared between mt76x2 and mt76x2u in
mt76x2-common module
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move tx related code shared between mt76x2 and mt76x2u in mt76x2-common
module
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
In order to remove usb dependency from pcie code, add mt76x2-common as
a container of shared code between mt76x2 and mt76x2u. Add eeprom code
to mt76x2-common module
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Add tx_queue_skb function pointer in mt76_bus_ops since mt76x2u based
devices do not map mt76x2_txwi on dma buffers and it is not possible
to reuse mt76_dma_tx_queue_skb() routine to enqueue tx frames to
hw buffers
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Move mt76_dma_tx_queue_skb routine in dma.c.
Remove static qualifier from mt76_get_txwi definition
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Add frame length to mt76x2_mac_write_txwi routine signature and do not
fetch it from skb since txwi data structure is added at the beginning of
the skb for usb based devices and mt76x2_mac_write_txwi will be shared
between pci and usb related code
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
in order to reuse mt76_rx_complete routine supporting mt76x2u based
devices add napi struct to mt76_rx_poll_complete and mt76_rx_complete
routine signatures and do not fetch it according to the rx queue index
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Add mt76x2_mac_load_tx_status routine since tx stats register map is
shared between usb and pci based devices but usb devices do not have a
tx stat irq line as pcie ones and it is necessary to load tx statistics
using a workqueue
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>