Skip to content

Commit

Permalink
mt76x0: use band parameter for LC calibration
Browse files Browse the repository at this point in the history
We use always 1 as band parameter for MCU_CAL_LC, this break 2GHz,
we should use 0 for this band instead.

Patch fixes problems happened sometimes when try to associate with 2GHz
AP and manifest by errors like below:

[14680.920823] wlan0: authenticate with 18:31:bf:c0:51:b0
[14681.109506] wlan0: send auth to 18:31:bf:c0:51:b0 (try 1/3)
[14681.310454] wlan0: send auth to 18:31:bf:c0:51:b0 (try 2/3)
[14681.518469] wlan0: send auth to 18:31:bf:c0:51:b0 (try 3/3)
[14681.726499] wlan0: authentication with 18:31:bf:c0:51:b0 timed out

Fixes: 9aec146d0f6b ("mt76x0: pci: introduce mt76x0_phy_calirate routine")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
  • Loading branch information
Stanislaw Gruszka authored and nbd168 committed Oct 25, 2018
1 parent ed17ba2 commit 14b6c59
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mt76x0/phy.c
Expand Up @@ -522,6 +522,7 @@ void mt76x0_phy_set_txpower(struct mt76x02_dev *dev)
void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on)
{
struct ieee80211_channel *chan = dev->mt76.chandef.chan;
int is_5ghz = (chan->band == NL80211_BAND_5GHZ) ? 1 : 0;
u32 val, tx_alc, reg_val;

if (is_mt7630(dev))
Expand All @@ -542,7 +543,7 @@ void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on)
reg_val = mt76_rr(dev, MT_BBP(IBI, 9));
mt76_wr(dev, MT_BBP(IBI, 9), 0xffffff7e);

if (chan->band == NL80211_BAND_5GHZ) {
if (is_5ghz) {
if (chan->hw_value < 100)
val = 0x701;
else if (chan->hw_value < 140)
Expand All @@ -555,7 +556,7 @@ void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on)

mt76x02_mcu_calibrate(dev, MCU_CAL_FULL, val, false);
msleep(350);
mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 1, false);
mt76x02_mcu_calibrate(dev, MCU_CAL_LC, is_5ghz, false);
usleep_range(15000, 20000);

mt76_wr(dev, MT_BBP(IBI, 9), reg_val);
Expand Down

0 comments on commit 14b6c59

Please sign in to comment.