linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76x0: use band parameter for LC calibration
@ 2018-10-25 16:18 Stanislaw Gruszka
  2018-10-29 14:30 ` Kalle Valo
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Stanislaw Gruszka @ 2018-10-25 16:18 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless

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>
---
This is for 4.20.

 drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
index c734987a344c..ca24b5716b58 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
@@ -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))
@@ -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)
@@ -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);
-- 
2.7.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76x0: use band parameter for LC calibration
  2018-10-25 16:18 [PATCH] mt76x0: use band parameter for LC calibration Stanislaw Gruszka
@ 2018-10-29 14:30 ` Kalle Valo
  2018-10-30 11:12 ` Lorenzo Bianconi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2018-10-29 14:30 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Felix Fietkau, Lorenzo Bianconi, linux-wireless

Stanislaw Gruszka <sgruszka@redhat.com> writes:

> 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>
> ---
> This is for 4.20.

This describes the symptoms better than the other 4.20 patch, thanks for
that. And at least to me looks ok for 4.20.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76x0: use band parameter for LC calibration
  2018-10-25 16:18 [PATCH] mt76x0: use band parameter for LC calibration Stanislaw Gruszka
  2018-10-29 14:30 ` Kalle Valo
@ 2018-10-30 11:12 ` Lorenzo Bianconi
  2018-10-30 13:20 ` Stanislaw Gruszka
  2018-11-05 17:01 ` Felix Fietkau
  3 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Bianconi @ 2018-10-30 11:12 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Felix Fietkau, linux-wireless

> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> index c734987a344c..ca24b5716b58 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> @@ -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))
> @@ -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)
> @@ -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);
> -- 
> 2.7.5
> 

Tested-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

Regards,
Lorenzo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76x0: use band parameter for LC calibration
  2018-10-25 16:18 [PATCH] mt76x0: use band parameter for LC calibration Stanislaw Gruszka
  2018-10-29 14:30 ` Kalle Valo
  2018-10-30 11:12 ` Lorenzo Bianconi
@ 2018-10-30 13:20 ` Stanislaw Gruszka
  2018-11-05 14:58   ` Kalle Valo
  2018-11-05 17:01 ` Felix Fietkau
  3 siblings, 1 reply; 7+ messages in thread
From: Stanislaw Gruszka @ 2018-10-30 13:20 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Lorenzo Bianconi, linux-wireless

On Thu, Oct 25, 2018 at 06:18:33PM +0200, Stanislaw Gruszka wrote:
> 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>
> ---
> This is for 4.20.

Actually it is not needed for 4.20, bacause the new calibrate code is
not use for USB in 4.20. It start to be used since:

commit e868a944c55b1f42303ab2941dc1aaada9a3570c
Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date:   Mon Oct 15 14:18:05 2018 +0200

    mt76x0: phy: unify calibration between mt76x0u and mt76x0e

Regards
Stanislaw

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76x0: use band parameter for LC calibration
  2018-10-30 13:20 ` Stanislaw Gruszka
@ 2018-11-05 14:58   ` Kalle Valo
  2018-11-05 15:00     ` Felix Fietkau
  0 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2018-11-05 14:58 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Felix Fietkau, Lorenzo Bianconi, linux-wireless

Stanislaw Gruszka <sgruszka@redhat.com> writes:

> On Thu, Oct 25, 2018 at 06:18:33PM +0200, Stanislaw Gruszka wrote:
>> 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>
>> ---
>> This is for 4.20.
>
> Actually it is not needed for 4.20, bacause the new calibrate code is
> not use for USB in 4.20. It start to be used since:
>
> commit e868a944c55b1f42303ab2941dc1aaada9a3570c
> Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> Date:   Mon Oct 15 14:18:05 2018 +0200
>
>     mt76x0: phy: unify calibration between mt76x0u and mt76x0e

So what should happen to this patch? Will Felix take it?

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76x0: use band parameter for LC calibration
  2018-11-05 14:58   ` Kalle Valo
@ 2018-11-05 15:00     ` Felix Fietkau
  0 siblings, 0 replies; 7+ messages in thread
From: Felix Fietkau @ 2018-11-05 15:00 UTC (permalink / raw)
  To: Kalle Valo, Stanislaw Gruszka; +Cc: Lorenzo Bianconi, linux-wireless

On 2018-11-05 15:58, Kalle Valo wrote:
> Stanislaw Gruszka <sgruszka@redhat.com> writes:
> 
>> On Thu, Oct 25, 2018 at 06:18:33PM +0200, Stanislaw Gruszka wrote:
>>> 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>
>>> ---
>>> This is for 4.20.
>>
>> Actually it is not needed for 4.20, bacause the new calibrate code is
>> not use for USB in 4.20. It start to be used since:
>>
>> commit e868a944c55b1f42303ab2941dc1aaada9a3570c
>> Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
>> Date:   Mon Oct 15 14:18:05 2018 +0200
>>
>>     mt76x0: phy: unify calibration between mt76x0u and mt76x0e
> 
> So what should happen to this patch? Will Felix take it?
Yes, I will take it.

- Felix

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mt76x0: use band parameter for LC calibration
  2018-10-25 16:18 [PATCH] mt76x0: use band parameter for LC calibration Stanislaw Gruszka
                   ` (2 preceding siblings ...)
  2018-10-30 13:20 ` Stanislaw Gruszka
@ 2018-11-05 17:01 ` Felix Fietkau
  3 siblings, 0 replies; 7+ messages in thread
From: Felix Fietkau @ 2018-11-05 17:01 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Lorenzo Bianconi, linux-wireless

On 2018-10-25 18:18, Stanislaw Gruszka wrote:
> 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>
Applied, thanks.

- Felix

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-05 17:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-25 16:18 [PATCH] mt76x0: use band parameter for LC calibration Stanislaw Gruszka
2018-10-29 14:30 ` Kalle Valo
2018-10-30 11:12 ` Lorenzo Bianconi
2018-10-30 13:20 ` Stanislaw Gruszka
2018-11-05 14:58   ` Kalle Valo
2018-11-05 15:00     ` Felix Fietkau
2018-11-05 17:01 ` Felix Fietkau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).