diff mbox series

mt76x0: add quirk to disable 2.4GHz band for Archer T1U

Message ID 1537858188-7815-1-git-send-email-sgruszka@redhat.com (mailing list archive)
State Accepted
Delegated to: Kalle Valo
Headers show
Series mt76x0: add quirk to disable 2.4GHz band for Archer T1U | expand

Commit Message

Stanislaw Gruszka Sept. 25, 2018, 6:49 a.m. UTC
TP-LINK Archer T1U do not support 2.4GHz band despite EEPROM
reports that. Add quirk to mask out 2.4GHz support.

Reported-by: Sid Hayn <sidhayn@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c | 5 +++++
 drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 ++
 drivers/net/wireless/mediatek/mt76/mt76x0/usb.c    | 7 ++++++-
 3 files changed, 13 insertions(+), 1 deletion(-)

Comments

Lorenzo Bianconi Sept. 25, 2018, 7:54 a.m. UTC | #1
>  
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> index 76d607f73758..b7a1069ecd0e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> @@ -45,7 +45,8 @@
>  	{ USB_DEVICE(0x20f4, 0x806b) },	/* TRENDnet TEW-806UBH  */
>  	{ USB_DEVICE(0x7392, 0xc711) }, /* Devolo Wifi ac Stick */
>  	{ USB_DEVICE(0x0df6, 0x0079) }, /* Sitecom Europe B.V. ac  Stick */
> -	{ USB_DEVICE(0x2357, 0x0105) }, /* TP-LINK Archer T1U */
> +	{ USB_DEVICE(0x2357, 0x0105),
> +	  .driver_info = 1,	     }, /* TP-LINK Archer T1U */

Hi Stanislaw,

what about using 'ieee80211-freq-limit' OF property to limit available wireless
band? In this way we can take into account even the opposite case (no 5GHz).

Regards,
Lorenzo
Felix Fietkau Sept. 25, 2018, 8 a.m. UTC | #2
On 2018-09-25 09:54, Lorenzo Bianconi wrote:
>>  
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
>> index 76d607f73758..b7a1069ecd0e 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
>> @@ -45,7 +45,8 @@
>>  	{ USB_DEVICE(0x20f4, 0x806b) },	/* TRENDnet TEW-806UBH  */
>>  	{ USB_DEVICE(0x7392, 0xc711) }, /* Devolo Wifi ac Stick */
>>  	{ USB_DEVICE(0x0df6, 0x0079) }, /* Sitecom Europe B.V. ac  Stick */
>> -	{ USB_DEVICE(0x2357, 0x0105) }, /* TP-LINK Archer T1U */
>> +	{ USB_DEVICE(0x2357, 0x0105),
>> +	  .driver_info = 1,	     }, /* TP-LINK Archer T1U */
> 
> Hi Stanislaw,
> 
> what about using 'ieee80211-freq-limit' OF property to limit available wireless
> band? In this way we can take into account even the opposite case (no 5GHz).
That doesn't make sense for USB devices, which can be plugged into any
machine.

- Felix
Lorenzo Bianconi Sept. 25, 2018, 9:07 a.m. UTC | #3
On Sep 25, Felix Fietkau wrote:
> On 2018-09-25 09:54, Lorenzo Bianconi wrote:
> >>  
> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> >> index 76d607f73758..b7a1069ecd0e 100644
> >> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> >> @@ -45,7 +45,8 @@
> >>  	{ USB_DEVICE(0x20f4, 0x806b) },	/* TRENDnet TEW-806UBH  */
> >>  	{ USB_DEVICE(0x7392, 0xc711) }, /* Devolo Wifi ac Stick */
> >>  	{ USB_DEVICE(0x0df6, 0x0079) }, /* Sitecom Europe B.V. ac  Stick */
> >> -	{ USB_DEVICE(0x2357, 0x0105) }, /* TP-LINK Archer T1U */
> >> +	{ USB_DEVICE(0x2357, 0x0105),
> >> +	  .driver_info = 1,	     }, /* TP-LINK Archer T1U */
> > 
> > Hi Stanislaw,
> > 
> > what about using 'ieee80211-freq-limit' OF property to limit available wireless
> > band? In this way we can take into account even the opposite case (no 5GHz).
> That doesn't make sense for USB devices, which can be plugged into any
> machine.

Ack, right.
What about a more general solution like adding an enum { NO_5GHz = 1, NO_2GHz }?
Does it worth to implement it now?

Regards,
Lorenzo

> 
> - Felix
Stanislaw Gruszka Sept. 25, 2018, 9:48 a.m. UTC | #4
On Tue, Sep 25, 2018 at 11:07:47AM +0200, Lorenzo Bianconi wrote:
> On Sep 25, Felix Fietkau wrote:
> > On 2018-09-25 09:54, Lorenzo Bianconi wrote:
> > >>  
> > >> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> > >> index 76d607f73758..b7a1069ecd0e 100644
> > >> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> > >> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> > >> @@ -45,7 +45,8 @@
> > >>  	{ USB_DEVICE(0x20f4, 0x806b) },	/* TRENDnet TEW-806UBH  */
> > >>  	{ USB_DEVICE(0x7392, 0xc711) }, /* Devolo Wifi ac Stick */
> > >>  	{ USB_DEVICE(0x0df6, 0x0079) }, /* Sitecom Europe B.V. ac  Stick */
> > >> -	{ USB_DEVICE(0x2357, 0x0105) }, /* TP-LINK Archer T1U */
> > >> +	{ USB_DEVICE(0x2357, 0x0105),
> > >> +	  .driver_info = 1,	     }, /* TP-LINK Archer T1U */
> > > 
> > > Hi Stanislaw,
> > > 
> > > what about using 'ieee80211-freq-limit' OF property to limit available wireless
> > > band? In this way we can take into account even the opposite case (no 5GHz).
> > That doesn't make sense for USB devices, which can be plugged into any
> > machine.
> 
> Ack, right.
> What about a more general solution like adding an enum { NO_5GHz = 1, NO_2GHz }?
> Does it worth to implement it now?

I do not see reason for that. Basically band information should be
read from EEPROM, I do not expect need for more quirks like this.

Thanks
Stanislaw
Arend van Spriel Sept. 25, 2018, 9:55 a.m. UTC | #5
On 9/25/2018 11:48 AM, Stanislaw Gruszka wrote:
> On Tue, Sep 25, 2018 at 11:07:47AM +0200, Lorenzo Bianconi wrote:
>> On Sep 25, Felix Fietkau wrote:
>>> On 2018-09-25 09:54, Lorenzo Bianconi wrote:
>>>>>
>>>>> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
>>>>> index 76d607f73758..b7a1069ecd0e 100644
>>>>> --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
>>>>> +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
>>>>> @@ -45,7 +45,8 @@
>>>>>  	{ USB_DEVICE(0x20f4, 0x806b) },	/* TRENDnet TEW-806UBH  */
>>>>>  	{ USB_DEVICE(0x7392, 0xc711) }, /* Devolo Wifi ac Stick */
>>>>>  	{ USB_DEVICE(0x0df6, 0x0079) }, /* Sitecom Europe B.V. ac  Stick */
>>>>> -	{ USB_DEVICE(0x2357, 0x0105) }, /* TP-LINK Archer T1U */
>>>>> +	{ USB_DEVICE(0x2357, 0x0105),
>>>>> +	  .driver_info = 1,	     }, /* TP-LINK Archer T1U */
>>>>
>>>> Hi Stanislaw,
>>>>
>>>> what about using 'ieee80211-freq-limit' OF property to limit available wireless
>>>> band? In this way we can take into account even the opposite case (no 5GHz).
>>> That doesn't make sense for USB devices, which can be plugged into any
>>> machine.
>>
>> Ack, right.
>> What about a more general solution like adding an enum { NO_5GHz = 1, NO_2GHz }?
>> Does it worth to implement it now?
>
> I do not see reason for that. Basically band information should be
> read from EEPROM, I do not expect need for more quirks like this.

Well. Never say never :-p And the phrase "quirks like this" does seem to 
leave the door open for other quirks. Or did you mean "quirks using 
driver_info"?

Regards,
Arend
Stanislaw Gruszka Sept. 25, 2018, 10:01 a.m. UTC | #6
On Tue, Sep 25, 2018 at 11:55:48AM +0200, Arend van Spriel wrote:
> On 9/25/2018 11:48 AM, Stanislaw Gruszka wrote:
> >On Tue, Sep 25, 2018 at 11:07:47AM +0200, Lorenzo Bianconi wrote:
> >>On Sep 25, Felix Fietkau wrote:
> >>>On 2018-09-25 09:54, Lorenzo Bianconi wrote:
> >>>>>
> >>>>>diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> >>>>>index 76d607f73758..b7a1069ecd0e 100644
> >>>>>--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> >>>>>+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
> >>>>>@@ -45,7 +45,8 @@
> >>>>> 	{ USB_DEVICE(0x20f4, 0x806b) },	/* TRENDnet TEW-806UBH  */
> >>>>> 	{ USB_DEVICE(0x7392, 0xc711) }, /* Devolo Wifi ac Stick */
> >>>>> 	{ USB_DEVICE(0x0df6, 0x0079) }, /* Sitecom Europe B.V. ac  Stick */
> >>>>>-	{ USB_DEVICE(0x2357, 0x0105) }, /* TP-LINK Archer T1U */
> >>>>>+	{ USB_DEVICE(0x2357, 0x0105),
> >>>>>+	  .driver_info = 1,	     }, /* TP-LINK Archer T1U */
> >>>>
> >>>>Hi Stanislaw,
> >>>>
> >>>>what about using 'ieee80211-freq-limit' OF property to limit available wireless
> >>>>band? In this way we can take into account even the opposite case (no 5GHz).
> >>>That doesn't make sense for USB devices, which can be plugged into any
> >>>machine.
> >>
> >>Ack, right.
> >>What about a more general solution like adding an enum { NO_5GHz = 1, NO_2GHz }?
> >>Does it worth to implement it now?
> >
> >I do not see reason for that. Basically band information should be
> >read from EEPROM, I do not expect need for more quirks like this.
> 
> Well. Never say never :-p And the phrase "quirks like this" does
> seem to leave the door open for other quirks. Or did you mean
> "quirks using driver_info"?

I mean quirks that mask out band. Anyway if the need for any other
quirk will show up then the things can be modified. Do not see point
for doing it now, when we don't know if new stuff will be used
at all.

Thanks
Stanislaw
Felix Fietkau Sept. 26, 2018, 3:42 p.m. UTC | #7
On 2018-09-25 08:49, Stanislaw Gruszka wrote:
> TP-LINK Archer T1U do not support 2.4GHz band despite EEPROM
> reports that. Add quirk to mask out 2.4GHz support.
> 
> Reported-by: Sid Hayn <sidhayn@gmail.com>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Merged, thanks.

- Felix
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
index 18bd80adbb51..3d712f6d7078 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
@@ -62,6 +62,11 @@  static void mt76x0_set_chip_cap(struct mt76x0_dev *dev)
 	dev_dbg(dev->mt76.dev, "2GHz %d 5GHz %d\n",
 		dev->mt76.cap.has_2ghz, dev->mt76.cap.has_5ghz);
 
+	if (dev->no_2ghz) {
+		dev->mt76.cap.has_2ghz = false;
+		dev_dbg(dev->mt76.dev, "mask out 2GHz support\n");
+	}
+
 	if (!mt76x02_field_valid(nic_conf1 & 0xff))
 		nic_conf1 &= 0xff00;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
index 7e131241344b..242abab69cdb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
@@ -108,6 +108,8 @@  struct mt76x0_dev {
 	u8 agc_save;
 	u16 chainmask;
 
+	bool no_2ghz;
+
 	struct mac_stats stats;
 };
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
index 76d607f73758..b7a1069ecd0e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
@@ -45,7 +45,8 @@ 
 	{ USB_DEVICE(0x20f4, 0x806b) },	/* TRENDnet TEW-806UBH  */
 	{ USB_DEVICE(0x7392, 0xc711) }, /* Devolo Wifi ac Stick */
 	{ USB_DEVICE(0x0df6, 0x0079) }, /* Sitecom Europe B.V. ac  Stick */
-	{ USB_DEVICE(0x2357, 0x0105) }, /* TP-LINK Archer T1U */
+	{ USB_DEVICE(0x2357, 0x0105),
+	  .driver_info = 1,	     }, /* TP-LINK Archer T1U */
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x0E8D, 0x7630, 0xff, 0x2, 0xff)}, /* MT7630U */
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x0E8D, 0x7650, 0xff, 0x2, 0xff)}, /* MT7650U */
 	{ 0, }
@@ -222,6 +223,10 @@  static int mt76x0u_probe(struct usb_interface *usb_intf,
 	if (!dev)
 		return -ENOMEM;
 
+	/* Quirk for Archer T1U */
+	if (id->driver_info)
+		dev->no_2ghz = true;
+
 	usb_dev = usb_get_dev(usb_dev);
 	usb_reset_device(usb_dev);