linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U
@ 2018-09-25  6:49 Stanislaw Gruszka
  2018-09-25  7:54 ` Lorenzo Bianconi
  2018-09-26 15:42 ` Felix Fietkau
  0 siblings, 2 replies; 8+ messages in thread
From: Stanislaw Gruszka @ 2018-09-25  6:49 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, Lorenzo Bianconi, Sid Hayn

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(-)

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);
 
-- 
1.9.3


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

* Re: [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U
  2018-09-25  6:49 [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U Stanislaw Gruszka
@ 2018-09-25  7:54 ` Lorenzo Bianconi
  2018-09-25  8:00   ` Felix Fietkau
  2018-09-26 15:42 ` Felix Fietkau
  1 sibling, 1 reply; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-09-25  7:54 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Felix Fietkau, linux-wireless, Sid Hayn

>  
> 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

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

* Re: [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U
  2018-09-25  7:54 ` Lorenzo Bianconi
@ 2018-09-25  8:00   ` Felix Fietkau
  2018-09-25  9:07     ` Lorenzo Bianconi
  0 siblings, 1 reply; 8+ messages in thread
From: Felix Fietkau @ 2018-09-25  8:00 UTC (permalink / raw)
  To: Lorenzo Bianconi, Stanislaw Gruszka; +Cc: linux-wireless, Sid Hayn

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

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

* Re: [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U
  2018-09-25  8:00   ` Felix Fietkau
@ 2018-09-25  9:07     ` Lorenzo Bianconi
  2018-09-25  9:48       ` Stanislaw Gruszka
  0 siblings, 1 reply; 8+ messages in thread
From: Lorenzo Bianconi @ 2018-09-25  9:07 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Stanislaw Gruszka, linux-wireless, Sid Hayn

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

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

* Re: [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U
  2018-09-25  9:07     ` Lorenzo Bianconi
@ 2018-09-25  9:48       ` Stanislaw Gruszka
  2018-09-25  9:55         ` Arend van Spriel
  0 siblings, 1 reply; 8+ messages in thread
From: Stanislaw Gruszka @ 2018-09-25  9:48 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: Felix Fietkau, linux-wireless, Sid Hayn

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 

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

* Re: [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U
  2018-09-25  9:48       ` Stanislaw Gruszka
@ 2018-09-25  9:55         ` Arend van Spriel
  2018-09-25 10:01           ` Stanislaw Gruszka
  0 siblings, 1 reply; 8+ messages in thread
From: Arend van Spriel @ 2018-09-25  9:55 UTC (permalink / raw)
  To: Stanislaw Gruszka, Lorenzo Bianconi
  Cc: Felix Fietkau, linux-wireless, Sid Hayn

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


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

* Re: [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U
  2018-09-25  9:55         ` Arend van Spriel
@ 2018-09-25 10:01           ` Stanislaw Gruszka
  0 siblings, 0 replies; 8+ messages in thread
From: Stanislaw Gruszka @ 2018-09-25 10:01 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Lorenzo Bianconi, Felix Fietkau, linux-wireless, Sid Hayn

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


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

* Re: [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U
  2018-09-25  6:49 [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U Stanislaw Gruszka
  2018-09-25  7:54 ` Lorenzo Bianconi
@ 2018-09-26 15:42 ` Felix Fietkau
  1 sibling, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2018-09-26 15:42 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-wireless, Lorenzo Bianconi, Sid Hayn

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

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

end of thread, other threads:[~2018-09-26 15:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-25  6:49 [PATCH] mt76x0: add quirk to disable 2.4GHz band for Archer T1U Stanislaw Gruszka
2018-09-25  7:54 ` Lorenzo Bianconi
2018-09-25  8:00   ` Felix Fietkau
2018-09-25  9:07     ` Lorenzo Bianconi
2018-09-25  9:48       ` Stanislaw Gruszka
2018-09-25  9:55         ` Arend van Spriel
2018-09-25 10:01           ` Stanislaw Gruszka
2018-09-26 15:42 ` 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).