* [PATCH] ath: add support for special 0x8000 regulatory domain
@ 2009-07-16 21:18 Luis R. Rodriguez
2009-07-19 12:35 ` Joerg Albert
0 siblings, 1 reply; 4+ messages in thread
From: Luis R. Rodriguez @ 2009-07-16 21:18 UTC (permalink / raw)
To: linville, jal2
Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez, Stephen Chen,
David Quan, Tony Yang
Two users of ar9170 devices have now reported their cards
have been programmed with a regulatory domain of 0x8000.
This is not a valid regulatory domain as such these users were
unable to use these devices. Since this doesn't seem to be
a device EEPROM corruption we must treat it specially.
We default these devices to the default Atheros 0x64 world
regulatory domain.
Reported-by: DavidFreeman on #linux-wireless
Reported-by: Joerg Albert <jal2@gmx.de>
Cc: Christian Lamparter <chunkeey@web.de>,
Cc: Stephen Chen <Stephen.Chen@atheros.com>
Cc: David Quan <David.Quan@atheros.com>
Cc: Tony Yang <Tony.Yang@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
David, or Joerg, can you please test this patch.
drivers/net/wireless/ath/regd.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index f37c832..62aa270 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -474,6 +474,21 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
return 0;
}
+/*
+ * Some users have reported their EEPROM programmed with
+ * 0x8000 set, this is not a supported regulatory domain
+ * but since we have more than one user with it we need
+ * a solution for them. We default to 0x64, which is the
+ * default Atheros world regulatory domain.
+ */
+static void ath_regd_sanitize(struct ath_regulatory *reg)
+{
+ if (reg->current_rd != CTRY_DEFAULT)
+ return;
+ printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n");
+ reg->current_rd = 0x64;
+}
+
int
ath_regd_init(struct ath_regulatory *reg,
struct wiphy *wiphy,
@@ -486,6 +501,8 @@ ath_regd_init(struct ath_regulatory *reg,
if (!reg)
return -EINVAL;
+ ath_regd_sanitize(reg);
+
printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd);
if (!ath_regd_is_eeprom_valid(reg)) {
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ath: add support for special 0x8000 regulatory domain
2009-07-16 21:18 [PATCH] ath: add support for special 0x8000 regulatory domain Luis R. Rodriguez
@ 2009-07-19 12:35 ` Joerg Albert
2009-07-20 15:27 ` Luis R. Rodriguez
0 siblings, 1 reply; 4+ messages in thread
From: Joerg Albert @ 2009-07-19 12:35 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: linville, linux-wireless, ath9k-devel, Stephen Chen, David Quan,
Tony Yang
On 07/16/2009 11:18 PM, Luis R. Rodriguez wrote:
> Two users of ar9170 devices have now reported their cards
> have been programmed with a regulatory domain of 0x8000.
> This is not a valid regulatory domain as such these users were
> unable to use these devices. Since this doesn't seem to be
> a device EEPROM corruption we must treat it specially.
>
> We default these devices to the default Atheros 0x64 world
> regulatory domain.
> ...
> David, or Joerg, can you please test this patch.
Hi Luis,
this patch doesn't work, I still get:
ath: EEPROM regdomain: 0x8000
ath: EEPROM indicates we should expect a country code
ath: No regulatory domain pair found, cannot continue
ar9170usb: probe of 1-1:1.0 failed with error -22
I guess that's due to reg->current_rd == 0x8000, while CTRY_DEFAULT
== 0 in ath_regd_sanitize().
Applying
diff --git a/drivers/net/wireless/ath/regd.c
b/drivers/net/wireless/ath/regd.c
index 62aa270..eae9a58 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -483,7 +483,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
*/
static void ath_regd_sanitize(struct ath_regulatory *reg)
{
- if (reg->current_rd != CTRY_DEFAULT)
+ if (reg->current_rd != (CTRY_DEFAULT|COUNTRY_ERD_FLAG))
return;
printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n");
reg->current_rd = 0x64;
on top of your patch worked:
ath: EEPROM regdomain sanitized
ath: EEPROM regdomain: 0x64
ath: EEPROM indicates we should expect a direct regpair map
ath: Country alpha2 being used: 00
ath: Regpair used: 0x64
Why do we handle a regdomain of 0x8000 differently from a regdomain
of 0?
0x8000 leads to regdomain 0x64 in ath_regd_sanitize() while 0 is
mapped into country code CTRY_UNITED_STATES.
With the above patch I don't see channels 12,13,100-140 in "iwlist
wlan0 channel", which are allowed in DE, but I guess that's due to
using regdomain WOR4_WORLD (0x64).
Do calibration data in the EEPROM really depend on the regdomain,
i.e. do manufacturers calibrate only for a subset of channels due to
the regdomain the device will be programmed with?
BTW, I bought this device refurbished in an U.K. webshop.
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ath: add support for special 0x8000 regulatory domain
2009-07-19 12:35 ` Joerg Albert
@ 2009-07-20 15:27 ` Luis R. Rodriguez
0 siblings, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2009-07-20 15:27 UTC (permalink / raw)
To: Joerg Albert
Cc: Luis Rodriguez, linville@tuxdriver.com,
linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org,
Stephen Chen, David Quan, Tony Yang
On Sun, Jul 19, 2009 at 05:35:45AM -0700, Joerg Albert wrote:
> On 07/16/2009 11:18 PM, Luis R. Rodriguez wrote:
> > Two users of ar9170 devices have now reported their cards
> > have been programmed with a regulatory domain of 0x8000.
> > This is not a valid regulatory domain as such these users were
> > unable to use these devices. Since this doesn't seem to be
> > a device EEPROM corruption we must treat it specially.
> >
> > We default these devices to the default Atheros 0x64 world
> > regulatory domain.
> > ...
> > David, or Joerg, can you please test this patch.
>
> Hi Luis,
>
> this patch doesn't work, I still get:
>
> ath: EEPROM regdomain: 0x8000
> ath: EEPROM indicates we should expect a country code
> ath: No regulatory domain pair found, cannot continue
> ar9170usb: probe of 1-1:1.0 failed with error -22
>
> I guess that's due to reg->current_rd == 0x8000, while CTRY_DEFAULT
> == 0 in ath_regd_sanitize().
>
> Applying
>
> diff --git a/drivers/net/wireless/ath/regd.c
> b/drivers/net/wireless/ath/regd.c
> index 62aa270..eae9a58 100644
> --- a/drivers/net/wireless/ath/regd.c
> +++ b/drivers/net/wireless/ath/regd.c
> @@ -483,7 +483,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
> */
> static void ath_regd_sanitize(struct ath_regulatory *reg)
> {
> - if (reg->current_rd != CTRY_DEFAULT)
> + if (reg->current_rd != (CTRY_DEFAULT|COUNTRY_ERD_FLAG))
Ah yes, it was the ERD flag.. will send another one.
> return;
> printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n");
> reg->current_rd = 0x64;
>
> on top of your patch worked:
>
> ath: EEPROM regdomain sanitized
> ath: EEPROM regdomain: 0x64
> ath: EEPROM indicates we should expect a direct regpair map
> ath: Country alpha2 being used: 00
> ath: Regpair used: 0x64
>
> Why do we handle a regdomain of 0x8000 differently from a regdomain
> of 0?
IMHO we should just be treating it as 0 as I believe that was the
manufacturer's intention but since we cannot get confirmation
of that in any way we have no other option but to treat this
as one of our world regulatory domain SKUs.
Will include this as part of the commit log.
> 0x8000 leads to regdomain 0x64 in ath_regd_sanitize() while 0 is
> mapped into country code CTRY_UNITED_STATES.
Right.
> With the above patch I don't see channels 12,13,100-140 in "iwlist
> wlan0 channel", which are allowed in DE, but I guess that's due to
> using regdomain WOR4_WORLD (0x64).
Yeap.
> Do calibration data in the EEPROM really depend on the regdomain,
> i.e. do manufacturers calibrate only for a subset of channels due to
> the regdomain the device will be programmed with?
Yeap, that is the idea.
> BTW, I bought this device refurbished in an U.K. webshop.
Good to know thanks, if we ever do get some sort of confirmation
from the vendor then this can be re-arranged, until then this
is what we will have to use.
Luis
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ath: add support for special 0x8000 regulatory domain
@ 2009-07-20 15:32 Luis R. Rodriguez
0 siblings, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2009-07-20 15:32 UTC (permalink / raw)
To: linville
Cc: linux-wireless, ath9k-devel, Luis R. Rodriguez, Stephen Chen,
David Quan, Tony Yang
Two users of ar9170 devices have now reported their cards
have been programmed with a regulatory domain of 0x8000.
This is not a valid regulatory domain as such these users were
unable to use these devices. Since this doesn't seem to be
a device EEPROM corruption we must treat it specially. It
may have been possible the manufacturer intended to use 0x0
as the regulatory domain and that would ultimately yield
to US but since we cannot get confirmationf or this we
default this special case to one of our world regulatory
domains, specifically 0x64.
Reported-by: DavidFreeman on #linux-wireless
Reported-by: Joerg Albert <jal2@gmx.de>
Cc: Christian Lamparter <chunkeey@web.de>,
Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: David Quan <david.quan@atheros.com>
Cc: Tony Yang <tony.yang@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
drivers/net/wireless/ath/regd.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index f37c832..077bcc1 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -474,6 +474,21 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
return 0;
}
+/*
+ * Some users have reported their EEPROM programmed with
+ * 0x8000 set, this is not a supported regulatory domain
+ * but since we have more than one user with it we need
+ * a solution for them. We default to 0x64, which is the
+ * default Atheros world regulatory domain.
+ */
+static void ath_regd_sanitize(struct ath_regulatory *reg)
+{
+ if (reg->current_rd != COUNTRY_ERD_FLAG)
+ return;
+ printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n");
+ reg->current_rd = 0x64;
+}
+
int
ath_regd_init(struct ath_regulatory *reg,
struct wiphy *wiphy,
@@ -486,6 +501,8 @@ ath_regd_init(struct ath_regulatory *reg,
if (!reg)
return -EINVAL;
+ ath_regd_sanitize(reg);
+
printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd);
if (!ath_regd_is_eeprom_valid(reg)) {
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-20 15:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-16 21:18 [PATCH] ath: add support for special 0x8000 regulatory domain Luis R. Rodriguez
2009-07-19 12:35 ` Joerg Albert
2009-07-20 15:27 ` Luis R. Rodriguez
-- strict thread matches above, loose matches on Subject: below --
2009-07-20 15:32 Luis R. Rodriguez
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).