Commit Graph
37 Commits
Author SHA1 Message Date
Felix Fietkau 33f29d2345 wifi: mt76: relicense to BSD-3-Clause-Clear
MediaTek has asked to switch from the ISC license to BSD-3-Clause-Clear,
in order to improve clarity and the legal integrity of the code.

The BSD-3-Clause license includes the "no endorsement" clause, which is
important for protecting the reputation of the original authors and
contributors by preventing unauthorized use of their names for endorsement
purposes.

This clause is absent in the BSD-2-Clause license, which is more permissive
but lacks this specific protection.

This change also cleans up the license of some Kconfig/Makefile files,
which were accidentally marked as GPL.

The GPL 2.0 remains in use on mt76x0, as well as two source files in mt7615
for which the license situation still needs to be clarified.

Signed-off-by: Felix Fietkau <[email protected]>
2025-10-13 11:11:19 +02:00
Rosen PenevandFelix Fietkau 9b770cb3da wifi: mt76: mt76_eeprom_override to int
mt76_eeprom_override has of_get_mac_address, which can return
-EPROBE_DEFER if the nvmem driver gets loaded after mt76 for some
reason.

Make sure this gets passed to probe so that nvmem mac overrides always
work.

Signed-off-by: Rosen Penev <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2025-09-15 09:52:25 +02:00
Paul FertserandFelix Fietkau 152608a40a wifi: mt76: mt7615: do not advertise 5 GHz on first phy of MT7615D (DBDC)
On DBDC devices the first (internal) phy is only capable of using
2.4 GHz band, and the 5 GHz band is exposed via a separate phy object,
so avoid the false advertising.

Reported-by: Rani Hod <[email protected]>
Closes: https://github.com/openwrt/openwrt/pull/12361
Fixes: 7660a1bd0c22 ("mt76: mt7615: register ext_phy if DBDC is detected")
Cc: [email protected]
Signed-off-by: Paul Fertser <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Acked-by: Felix Fietkau <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
2023-07-25 22:00:33 +02:00
Felix Fietkau a9ac73ed82 wifi: mt76: mt7615: increase eeprom size for mt7663
mt7663 efuse has 0x600 bytes instead of 0x400. Increase the size in order
to fix issues with incomplete calibration data

Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 19:55:31 +01:00
Felix Fietkau c71f609b39 mt76: sync with upstream changes
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-14 09:12:11 +02:00
Sander VanheuleandFelix Fietkau 2659f6c6ea mt76: mt7615: support loading EEPROM for MT7613BE
EEPROM blobs for MT7613BE radios start with (little endian) 0x7663,
which is also the PCI device ID for this device. The EEPROM is required
for the radio to work at useful power levels, otherwise only the lowest
power level is available.

Suggested-by: Georgi Vlaev <[email protected]>
Tested-by: Stijn Segers <[email protected]>
Signed-off-by: Sander Vanheule <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-02-14 11:23:30 +01:00
Lorenzo BianconiandFelix Fietkau 36cd48ab44 mt76: move chainmask in mt76_phy
Move chainmask from driver phy to mt76_phy since it is used by all
drivers. This is a preliminary patch to create a common mcu library used
by mt7615 and mt7921 drivers

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-01-14 11:14:59 +01:00
Lorenzo BianconiandFelix Fietkau 8aa24c91b1 mt76: move hw mac_addr in mt76_phy
This is a preliminary patch to properly support mt7915 dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-13 11:19:13 +01:00
Lorenzo BianconiandFelix Fietkau e881fd67c7 mt76: move band capabilities in mt76_phy
This is a preliminary patch to move properly support mt7915 dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-11-13 11:19:13 +01:00
Shayne ChenandFelix Fietkau 9980456037 mt76: mt7615: register ext_phy if DBDC is detected
MT_EE_WIFI_CONF field can be used to detect if the chipset is MT7615D.
Thus, add support to automatically register ext_phy if DBDC is detected.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:31:29 +02:00
Felix Fietkau ee13b78367 mt76: mt7615: fix EEPROM buffer size
Avoid adding MT7615_EEPROM_SIZE twice.
Rename MT7615_EEPROM_EXTRA_DATA to MT7615_EEPROM_FULL_SIZE, since it already
includes MT7615_EEPROM_SIZE

Fixes: ad380ad1ebbe ("mt76: mt7615: add support for applying DC offset calibration from EEPROM")
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 17:05:13 +02:00
DENG QingfangandFelix Fietkau 6e02acddcb mt76: mt7615: add support for MT7611N
MT7611N is basically the same as MT7615N, except it only supports 5GHz
It is used by some TP-Link and Mercury wireless routers

Signed-off-by: DENG Qingfang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-24 14:27:50 +02:00
Lorenzo BianconiandFelix Fietkau 3e6968593b mt76: mt7615: fix delta tx power for mt7663
Fix mt7663 eeprom definitions for delta tx power parsing

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:09 +02:00
Lorenzo BianconiandFelix Fietkau 83f2ba3101 mt76: mt7663: fix target power parsing
Fix target parsing from eeprom/efuse partition for 7663 chipsets

Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:09 +02:00
Lorenzo BianconiandFelix Fietkau 4ef1957cea mt76: mt7663: read tx streams from eeprom
Read tx stream configuration from eeprom/efuse

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:06 +02:00
Lorenzo BianconiandFelix Fietkau d4e6e225bc mt76: mt7615: move core shared code in mt7615-common module
Create mt7615-common module in order to collect shared code between usb
and mmio code. Move the following source files in mt7615-common module:
- main.c
- init.c
- mcu.c
- mac.c
- debugfs.c
- eeprom.c
- trace.c

Create the following source files for mmio only source code and move them
in mt7615e module:
- pci_init.c
- dma.c
- pci_mac.c

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-17 14:46:00 +02:00
Felix Fietkau 2b58998bb5 mt76: mt7615: add support for applying DC offset calibration from EEPROM
When the EEPROM data is read from flash, it can contain DC offset calibration
data. Add support for sending the data to the firmware.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:17 +02:00
Felix Fietkau d16a4698f1 mt76: mt7615: disable merge of OTP ROM data by default
The reference driver does not seem to enable it by default, only under certain
conditions, e.g. when a .bin file is loaded.
Make it opt-in via a device tree property for now, in case it is needed on some
boards.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:17 +02:00
Lorenzo BianconiandFelix Fietkau 02c9ec4a15 mt76: mt7615: add address parameter to mt7615_eeprom_init
Introduce address parameter to mt7615_eeprom_init routine in order to be
reused adding usb support to mt7615 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:12 +02:00
Lorenzo BianconiandFelix Fietkau 2097f74f66 mt76: mt7615: introduce mt7663e support
Introduce support for mt7663e 802.11ac 2x2:2 chipset to mt7615 driver.

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Co-developed-by: Ryder Lee <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-17 17:50:15 +01:00
Lorenzo BianconiandFelix Fietkau 28e22d07f8 mt76: mt7615: introduce mt7615_eeprom_parse_hw_band_cap routine
Introduce mt7615_eeprom_parse_hw_band_cap routine in order to configure
supported band for mt7663e and mt7622 devices since they do not rely on
eeprom data to enable 2GHz/5GHz bands

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-17 17:50:15 +01:00
Lorenzo BianconiandFelix Fietkau 2bbffd2cb3 mt76: mt7615: remove rx_mask in mt7615_eeprom_parse_hw_cap
Get rid of rx_mask in mt7615_eeprom_parse_hw_cap routine since it is not
actually used

Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-02-14 10:16:16 +01:00
Lorenzo BianconiandFelix Fietkau 9c43417db1 mt76: mt7615: fix max_nss in mt7615_eeprom_parse_hw_cap
Fix u8 cast reading max_nss from MT_TOP_STRAP_STA register in
mt7615_eeprom_parse_hw_cap routine

Fixes: acf5457fd99db ("mt76: mt7615: read {tx,rx} mask from eeprom")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-02-07 17:57:50 +01:00
Felix Fietkau fd3ae9a342 mt76: mt7615: disable 5 GHz on MT7622
It is not supported by the chip, so avoid issues with potentially wrong
EEPROM configurations.

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:40 +01:00
Felix Fietkau f0b02d8115 mt76: mt7615: add calibration free support for MT7622
MT7622 uses fewer efuse overrides than MT7615

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:40 +01:00
Felix Fietkau ab94a85efb mt76: mt7615: add eeprom support for MT7622
When sending EEPROM data to the MCU, MT7622 uses a longer buffer

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:33 +01:00
Felix Fietkau 993683d62f mt76: mt7615: add support for registering a second wiphy via debugfs
This is only used for testing for now. In the future it will be possible to
enable the second PHY through an proper API via device tree

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 849fefacc4 mt76: mt7615: rework chainmask handling
Move chainmask to struct mt7615_phy and instead of needlessly making the
format similar to values for older chips, make it refer to the actual chain
bits used for the rx/tx path.
This is important for multiple wiphy support, where for a secondary phy,
antenna_mask will start at 0, and chainmask will start at the chain offset
(bit 2)

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 9e95fa6208 mt76: move txpower and antenna mask to struct mt76_phy
Adds multiple wiphy support to mt76_get_txpower

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:58:37 +01:00
Felix Fietkau 9cda51d195 mt76: move chainmask back to driver specific structs
Nothing in the core uses it

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:55:24 +01:00
Lorenzo BianconiandFelix Fietkau faf5e6fedd mt76: mt7615: read {tx,rx} mask from eeprom
Parse configured {tx,rx} mask from eeprom data instead of just setting it
to four tx-rx streams

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:27:21 +01:00
Felix Fietkau 5c35bdf057 mt7615: apply calibration-free data from OTP
MT7615 chips usually come pre-calibrated, even when used on embedded boards.
In that case, the on-flash EEPROM data needs to be merged with some data
from OTP ROM.
Run this merge if the external EEPROM data is valid and OTP has valid fields.

Signed-off-by: Felix Fietkau <[email protected]>
2019-08-22 09:26:30 +02:00
Lorenzo BianconiandFelix Fietkau 160fdc05e2 mt76: mt7615: take into account extPA when configuring tx power
When TSSI calibration is disabled (which it means the device has been
equipped with an external power amplifier) we need to refer to
different eeprom fields in order to properly configure tx power

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-06-25 13:19:51 +02:00
Lorenzo BianconiandFelix Fietkau 514fb04492 mt76: mt7615: add the capability to configure tx power
Introduce mt7615_mcu_set_tx_power routine in order to cap tx power
according to the value configured by the user

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-06-07 19:00:05 +02:00
Lorenzo BianconiandFelix Fietkau 4bcb0577da mt76: mt7615: select wifi band according to eeprom
Select supported band according to the value read from
eeprom mtd/otp partition

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-06-07 19:00:05 +02:00
Lorenzo BianconiandFelix Fietkau 6960b6e2d1 mt76: mt7615: add support for mtd eeprom parsing
Calibration data are often available on a specific mtd partition on
embedded devices. Take into account eeprom calibration data if
available.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-06-07 19:00:05 +02:00
Ryder LeeandFelix Fietkau 334b4cedf2 mt76: add mac80211 driver for MT7615 PCIe-based chipsets
This driver is for a newer generation of MediaTek MT7615 4x4 802.11ac
PCIe-based chipsets, which support wave2 MU-MIMO up to 4 users/group
and also support up to 160MHz bandwidth.

The driver fully supports AP, station and monitor mode.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Roy Luo <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-25 12:04:34 +02:00