diff mbox series

mt76x0: phy: fix restore phase in mt76x0_phy_recalibrate_after_assoc

Message ID ff6672828b7e970124a425304ad734d58133a6ff.1539001391.git.lorenzo.bianconi@redhat.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series mt76x0: phy: fix restore phase in mt76x0_phy_recalibrate_after_assoc | expand

Commit Message

Lorenzo Bianconi Oct. 8, 2018, 12:40 p.m. UTC
Fix restore value configured in 0x2124 register in
mt76x0_phy_recalibrate_after_assoc routine.

Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Felix Fietkau Oct. 8, 2018, 6:11 p.m. UTC | #1
On 2018-10-08 14:40, Lorenzo Bianconi wrote:
> Fix restore value configured in 0x2124 register in
> mt76x0_phy_recalibrate_after_assoc routine.
> 
> Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> index 99e0a91a2f99..d18942e54048 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> @@ -734,8 +734,7 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev)
>  	usleep_range(500, 700);
>  
>  	reg_val = mt76_rr(dev, 0x2124);
> -	reg_val &= 0xffffff7e;
> -	mt76_wr(dev, 0x2124, reg_val);
> +	mt76_wr(dev, 0x2124, 0xffffff7e);
I'm pretty sure you can drop the mt76_rr as well. Also, you can refer to
0x2124 as MT_BBP(IBI, 9).

- Felix
Lorenzo Bianconi Oct. 8, 2018, 7:55 p.m. UTC | #2
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> > index 99e0a91a2f99..d18942e54048 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> > @@ -734,8 +734,7 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev)
> >       usleep_range(500, 700);
> >
> >       reg_val = mt76_rr(dev, 0x2124);
> > -     reg_val &= 0xffffff7e;
> > -     mt76_wr(dev, 0x2124, reg_val);
> > +     mt76_wr(dev, 0x2124, 0xffffff7e);
> I'm pretty sure you can drop the mt76_rr as well. Also, you can refer to
> 0x2124 as MT_BBP(IBI, 9).
>

Do you mean we do not need to reset the original value in MT_BBP(IBI, 9)?

Regards,
Lorenzo

> - Felix
Stanislaw Gruszka Oct. 9, 2018, 7:35 a.m. UTC | #3
On Mon, Oct 08, 2018 at 08:11:45PM +0200, Felix Fietkau wrote:
> On 2018-10-08 14:40, Lorenzo Bianconi wrote:
> > Fix restore value configured in 0x2124 register in
> > mt76x0_phy_recalibrate_after_assoc routine.
> > 
> > Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> > ---
> >  drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> > index 99e0a91a2f99..d18942e54048 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
> > @@ -734,8 +734,7 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev)
> >  	usleep_range(500, 700);
> >  
> >  	reg_val = mt76_rr(dev, 0x2124);
> > -	reg_val &= 0xffffff7e;
> > -	mt76_wr(dev, 0x2124, reg_val);
> > +	mt76_wr(dev, 0x2124, 0xffffff7e);
> I'm pretty sure you can drop the mt76_rr as well. Also, you can refer to
> 0x2124 as MT_BBP(IBI, 9).

I think is needed we do:

	reg_val = mt76_rr(dev, 0x2124); 
	mt76_wr(dev, 0x2124, 0xffffff7e);

	CALIBRATE

	mt76_wr(dev, 0x2124, reg_val);

so seems we have to restore orginal value after calibration.

Referencing as MT_BBP(IBI, 9) is obviously fine.

Thanks
Stanislaw
Felix Fietkau Oct. 9, 2018, 8:35 a.m. UTC | #4
On 2018-10-09 09:35, Stanislaw Gruszka wrote:
> On Mon, Oct 08, 2018 at 08:11:45PM +0200, Felix Fietkau wrote:
>> On 2018-10-08 14:40, Lorenzo Bianconi wrote:
>> > Fix restore value configured in 0x2124 register in
>> > mt76x0_phy_recalibrate_after_assoc routine.
>> > 
>> > Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
>> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
>> > ---
>> >  drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 3 +--
>> >  1 file changed, 1 insertion(+), 2 deletions(-)
>> > 
>> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
>> > index 99e0a91a2f99..d18942e54048 100644
>> > --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
>> > +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
>> > @@ -734,8 +734,7 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev)
>> >  	usleep_range(500, 700);
>> >  
>> >  	reg_val = mt76_rr(dev, 0x2124);
>> > -	reg_val &= 0xffffff7e;
>> > -	mt76_wr(dev, 0x2124, reg_val);
>> > +	mt76_wr(dev, 0x2124, 0xffffff7e);
>> I'm pretty sure you can drop the mt76_rr as well. Also, you can refer to
>> 0x2124 as MT_BBP(IBI, 9).
> 
> I think is needed we do:
> 
> 	reg_val = mt76_rr(dev, 0x2124); 
> 	mt76_wr(dev, 0x2124, 0xffffff7e);
> 
> 	CALIBRATE
> 
> 	mt76_wr(dev, 0x2124, reg_val);
> 
> so seems we have to restore orginal value after calibration.
> 
> Referencing as MT_BBP(IBI, 9) is obviously fine.
Yes, that makes more sense.

- Felix
Lorenzo Bianconi Oct. 9, 2018, 8:48 a.m. UTC | #5
> > I think is needed we do:
> > 
> > 	reg_val = mt76_rr(dev, 0x2124); 
> > 	mt76_wr(dev, 0x2124, 0xffffff7e);
> > 
> > 	CALIBRATE
> > 
> > 	mt76_wr(dev, 0x2124, reg_val);
> > 
> > so seems we have to restore orginal value after calibration.
> > 
> > Referencing as MT_BBP(IBI, 9) is obviously fine.
> Yes, that makes more sense.
> 
> - Felix

Ack, I will send v2 with proper register name.

Regards,
Lorenzo
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
index 99e0a91a2f99..d18942e54048 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
@@ -734,8 +734,7 @@  void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev)
 	usleep_range(500, 700);
 
 	reg_val = mt76_rr(dev, 0x2124);
-	reg_val &= 0xffffff7e;
-	mt76_wr(dev, 0x2124, reg_val);
+	mt76_wr(dev, 0x2124, 0xffffff7e);
 
 	mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 0, false);