ath9k: add support for 802.11n bonded out AR2427
[safe/jmp/linux-2.6] / drivers / net / wireless / ath / regd.c
index eef370b..039ac49 100644 (file)
@@ -450,7 +450,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
        const struct ieee80211_regdomain *regd;
 
        wiphy->reg_notifier = reg_notifier;
-       wiphy->strict_regulatory = true;
+       wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
 
        if (ath_is_world_regd(reg)) {
                /*
@@ -458,8 +458,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
                 * saved on the wiphy orig_* parameters
                 */
                regd = ath_world_regdomain(reg);
-               wiphy->custom_regulatory = true;
-               wiphy->strict_regulatory = false;
+               wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
        } else {
                /*
                 * This gets applied in the case of the absense of CRDA,
@@ -474,6 +473,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 +500,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)) {
@@ -569,7 +585,5 @@ u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
        default:
                return NO_CTL;
        }
-
-       return NO_CTL;
 }
 EXPORT_SYMBOL(ath_regd_get_band_ctl);