Commit Graph
39 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau ba7a3da7c0 mt76: add mt76x02_get_rx_gain and mt76x02_get_lna_gain utility routines
Add mt76x02_get_rx_gain and mt76x02_get_lna_gain utility routines
for rx gain parsing. mt76x02_get_rx_gain and mt76x02_get_lna_gain
will be reused for eeprom parsing in mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-09-21 18:05:35 +02:00
Lorenzo BianconiandFelix Fietkau 7556cb9355 mt76: move mt76x2_ext_pa_enabled routine in mt76x02_eeprom.c
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]>
2018-09-21 18:05:35 +02:00
Lorenzo BianconiandFelix Fietkau 844daebc0d mt76: move mt76x2_get_efuse_data in mt76x02-lib module
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]>
2018-09-21 18:05:35 +02:00
Lorenzo BianconiandFelix Fietkau 611b8c7bff mt76: move mt76x2_eeprom_get in mt76x02_eeprom.h
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]>
2018-09-21 18:05:35 +02:00
Lorenzo BianconiandFelix Fietkau c9100cb925 mt76: move eeprom utility routines in mt76x02_eeprom.h
Move shared eeprom utility routines in mt76x02_eeprom.h and
remove duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-09-21 18:05:35 +02:00
Lorenzo BianconiandFelix Fietkau 4451f99549 mt76: move common eeprom definitions in mt76x02-lib module
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]>
2018-09-21 18:05:35 +02:00
Felix Fietkau 6cf6fbaadb mt76: add stbc entries to mt76_rate_power
Add stbc tx power eeprom parsing support for mt76x2 driver.
When writing power entries, make a distinction between rates that are
read from the same EEPROM value, but have separate register entries.

No effect on runtime behavior, but preparation for unification with mt76x0
and for placing restrictions on individual rate power limits

Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-09-21 18:05:15 +02:00
Lorenzo BianconiandFelix Fietkau d099694a3d mt76: introduce mt76x2-common module
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]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau a3e7740ab8 mt76x2: fix tx_alc_enabled check
Fix mt76x2_temp_tx_alc_enabled routine since in order to enable tx_alc
temperature compensation it necessary to take into account BIT(15) of
MT_EE_TX_POWER_EXT_PA_5G eeprom info

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-09 10:15:14 +02:00
Lorenzo BianconiandFelix Fietkau eb359f19b4 mt76x2: remove unnecessary len variable in mt76x2_eeprom_load()
Substitute unnecessary len variable in mt76x2_eeprom_load() with
MT7662_EEPROM_SIZE macro since len is used just to store eeprom
default size.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-19 21:39:09 +01:00
Lorenzo BianconiandFelix Fietkau 4ca8bba267 mt76x2: eeprom: fix typo in mt76x2_get_power_info_5g()
Fix typo in 5GHz power vs channel eeprom parsing

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2017-12-14 16:42:01 +01:00
Felix Fietkau 3bd7e76e2d mt76x2: initialize channel power limits
Signed-off-by: Felix Fietkau <[email protected]>
2017-11-30 12:33:47 +01:00
Felix Fietkau 11f42a8aab mt76x2: add channel argument to eeprom tx power functions
Preparation for exposing maximum power to mac80211

Signed-off-by: Felix Fietkau <[email protected]>
2017-11-30 12:16:39 +01:00
Kristian EvensenandFelix Fietkau f6a021d15a mt76x2: Support using PCI ID as chip ID
On some routers, the manufacturer has made a mistake and left the chip
ID part of the EEPROM empty (it is set to 0x0000). One such router is
the ZBT-WE1026-5G (equipped with MT7612), and the consequence is that
the EEPROM check fails and the 5GHz wifi does not work at all. When
setting the chip ID to 0x7612 manually, the 5GHz wifi works fine.

When looking at EEPROM of the WE1026 (and other devices equipped with
mt76x2), I see that the PCI ID is always set to a valid value (7612 or
7662). This PR works around the issue of an empty chip ID by using the
PCI ID, if chip ID is 0. After applying this PR/patch manually to mt76,
the 5GHz on the WE1026 works out of the box. Since the PCI ID is only
used if chip ID is empty, devices with correct EEPROMs are not affected.

Signed-off-by: Kristian Evensen <[email protected]>
2017-10-27 12:26:33 +02:00
Rosen PenevandFelix Fietkau e7647871da Fix errors found by cppcheck
Mismatching declarations as well as unused results.

Signed-off-by: Rosen Penev <[email protected]>
2017-10-27 12:15:53 +02:00
Felix Fietkau e5c58f6c64 mt76x2: fix size of the rssi offset eeprom field
Signed-off-by: Felix Fietkau <[email protected]>
2017-03-17 15:48:57 +01:00
Felix Fietkau a5eaeb27d6 revert mt76_eeprom_override call reordering
This call order is necessary for handling the device MAC address

Signed-off-by: Felix Fietkau <[email protected]>
2017-02-03 14:25:08 +01:00
Felix Fietkau 184e068b6f use wiphy_read_of_freq_limits to parse band capability overrides
Signed-off-by: Felix Fietkau <[email protected]>
2017-02-01 16:11:35 +01:00
Felix Fietkau 838d439f7b mt76x2: fix parsing of EEPROM board type
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-15 14:45:20 +02:00
Felix Fietkau 60a15e968d mt76x2: rename misnamed variable
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-15 14:44:52 +02:00
Felix Fietkau becce8bd46 mt76x2: fix more checkpatch errors
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-05 10:08:16 +02:00
Felix Fietkau d7f5112c09 mt76x2: fix checkpatch warnings
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-04 18:59:22 +02:00
Felix Fietkau b300bdc42e use the new bitfield accessor macros
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-04 17:37:26 +02:00
Felix Fietkau 53c1b7f6ac update my email address
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-04 17:33:28 +02:00
Felix Fietkau ced81a3458 relicense to ISC (except for util.h which is based on GPL'd kernel code
Signed-off-by: Felix Fietkau <[email protected]>
2016-07-12 08:38:46 +02:00
Felix Fietkau 267e959c84 move mt76 rate power struct to mt76.h
Signed-off-by: Felix Fietkau <[email protected]>
2016-06-17 12:45:39 +02:00
Felix Fietkau 6c4b37be98 move dev->chandef to mt76 struct
Signed-off-by: Felix Fietkau <[email protected]>
2016-06-15 15:47:49 +02:00
Felix Fietkau e4c05ba162 use nl80211_band instead of ieee80211_band
Signed-off-by: Felix Fietkau <[email protected]>
2016-05-14 16:51:44 +02:00
Felix Fietkau 13c29223ef Use NL80211_BAND_2GHZ instead of IEEE80211_BAND_2GHZ
Signed-off-by: Felix Fietkau <[email protected]>
2016-05-14 16:49:30 +02:00
Felix Fietkau 079ad90fe2 update copyright lines
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-25 18:09:13 +01:00
Felix Fietkau 02b9245b9e mt76x2: move efuse debugfs blob to core
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-22 08:47:26 +01:00
Felix Fietkau 7b86ce8772 mt76x2: fix interpreting LNA gain values
Signed-off-by: Felix Fietkau <[email protected]>
2016-01-14 12:55:45 +01:00
Felix Fietkau fc6653da51 mt76x2: filter out the local bit from the base address to fix beacon issues
Signed-off-by: Felix Fietkau <[email protected]>
2016-01-14 00:30:56 +01:00
Felix Fietkau 6ca2852f65 move mac address validation to core
Signed-off-by: Felix Fietkau <[email protected]>
2016-01-01 19:38:59 +01:00
Felix Fietkau 239b67204c move eeprom related code to common
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-16 02:09:26 +01:00
Felix Fietkau 38702fa03a move the struct device pointer to struct mt76_device
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 20:36:08 +01:00
Felix Fietkau b0f76bb5d9 move register poll functions to core
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 19:20:00 +01:00
Felix Fietkau e20a9c13a5 move mmio functions/init to mt76.ko
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 17:52:00 +01:00
Felix Fietkau a0ee20716f add a mt76x2_ prefix to all files
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 16:54:53 +01:00