--- linux-3.8.13/drivers/net/wireless/ath/ar5523/ar5523.c.orig +++ linux-3.8.13/drivers/net/wireless/ath/ar5523/ar5523.c @@ -43,6 +43,10 @@ * UB51: AR5005UG 802.11b/g, UB52: AR5005UX 802.11a/b/g */ +static int ar5523_no_band = 0; +module_param_named(no_band, ar5523_no_band, int, S_IRUGO); +MODULE_PARM_DESC(no_band, " Disable band: 0 = none, 1 = 2GHz, 2 = 5GHz"); + static int ar5523_submit_rx_cmd(struct ar5523 *ar); static void ar5523_data_tx_pkt_put(struct ar5523 *ar); @@ -455,7 +459,7 @@ struct ar5523_cmd_reset reset; memset(&reset, 0, sizeof(reset)); - reset.flags |= cpu_to_be32(UATH_CHAN_2GHZ); + reset.flags |= cpu_to_be32((conf->channel->band==IEEE80211_BAND_5GHZ?UATH_CHAN_5GHZ:UATH_CHAN_2GHZ)); reset.flags |= cpu_to_be32(UATH_CHAN_OFDM); reset.freq = cpu_to_be32(conf->channel->center_freq); reset.maxrdpower = cpu_to_be32(50); /* XXX */ @@ -1154,6 +1158,8 @@ u32 sta_rate_set; band = ar->hw->wiphy->bands[ar->hw->conf.channel->band]; + if (band->band==IEEE80211_BAND_5GHZ) + return WLAN_MODE_11a; sta = ieee80211_find_sta(ar->vif, bss_conf->bssid); if (!sta) { ar5523_info(ar, "STA not found!\n"); @@ -1431,7 +1437,7 @@ * This is copied from rtl818x, but we should probably move this * to common code as in OpenBSD. */ -static const struct ieee80211_rate ar5523_rates[] = { +static struct ieee80211_rate ar5523_rates[] = { { .bitrate = 10, .hw_value = 2, }, { .bitrate = 20, .hw_value = 4 }, { .bitrate = 55, .hw_value = 11, }, @@ -1463,20 +1469,80 @@ { .center_freq = 2484 }, }; -static int ar5523_init_modes(struct ar5523 *ar) -{ - BUILD_BUG_ON(sizeof(ar->channels) != sizeof(ar5523_channels)); - BUILD_BUG_ON(sizeof(ar->rates) != sizeof(ar5523_rates)); +static struct ieee80211_channel ar5523_channels_5ghz[] = { + { .center_freq = 5170, .flags = IEEE80211_CHAN_PASSIVE_SCAN }, + { .center_freq = 5180 }, + { .center_freq = 5190, .flags = IEEE80211_CHAN_PASSIVE_SCAN }, + { .center_freq = 5200 }, + { .center_freq = 5210, .flags = IEEE80211_CHAN_PASSIVE_SCAN }, + { .center_freq = 5220 }, + { .center_freq = 5230, .flags = IEEE80211_CHAN_PASSIVE_SCAN }, + { .center_freq = 5240 }, + { .center_freq = 5260 }, + { .center_freq = 5280 }, + { .center_freq = 5300 }, + { .center_freq = 5320 }, +/* + { .center_freq = 5500 }, + { .center_freq = 5520 }, + { .center_freq = 5540 }, + { .center_freq = 5560 }, + { .center_freq = 5580 }, + { .center_freq = 5600 }, + { .center_freq = 5620 }, + { .center_freq = 5640 }, + { .center_freq = 5660 }, + { .center_freq = 5680 }, + { .center_freq = 5700 }, +*/ +}; - memcpy(ar->channels, ar5523_channels, sizeof(ar5523_channels)); - memcpy(ar->rates, ar5523_rates, sizeof(ar5523_rates)); +static struct ieee80211_supported_band ar5523_band_5ghz = { + .band = IEEE80211_BAND_5GHZ, + .channels = ar5523_channels_5ghz, + .n_channels = ARRAY_SIZE(ar5523_channels_5ghz), + .bitrates = ar5523_rates + 4, + .n_bitrates = ARRAY_SIZE(ar5523_rates) - 4, +}; - ar->band.band = IEEE80211_BAND_2GHZ; - ar->band.channels = ar->channels; - ar->band.n_channels = ARRAY_SIZE(ar5523_channels); - ar->band.bitrates = ar->rates; - ar->band.n_bitrates = ARRAY_SIZE(ar5523_rates); - ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar->band; +static const struct ieee80211_regdomain jp_regdom = { + .n_reg_rules = 3, + .alpha2 = "99", + .reg_rules = { + /* IEEE 802.11b/g, channels 1..13 */ + REG_RULE(2412-10, 2472+10, 40, 0, 20, 0), + /* IEEE 802.11b channel 14 + REG_RULE(2484-10, 2484+10, 20, 0, 20, NL80211_RRF_NO_OFDM), */ + /* IEEE 802.11a, channel 34..48 */ + REG_RULE(5170-10, 5240+10, 40, 0, 20, 0), + /* IEEE 802.11a, channel 52..64 */ + REG_RULE(5260-10, 5320+10, 40, 0, 20, NL80211_RRF_DFS), + /* IEEE 802.11a, channel 100..140 + REG_RULE(5500-10, 5700+10, 40, 0, 20, NL80211_RRF_DFS), */ + } +}; + +static int ar5523_init_modes(struct ar5523 *ar, int flags) +{ + if(!(ar5523_no_band & 0x1)) { + BUILD_BUG_ON(sizeof(ar->channels) != sizeof(ar5523_channels)); + BUILD_BUG_ON(sizeof(ar->rates) != sizeof(ar5523_rates)); + + memcpy(ar->channels, ar5523_channels, sizeof(ar5523_channels)); + memcpy(ar->rates, ar5523_rates, sizeof(ar5523_rates)); + + ar->band.band = IEEE80211_BAND_2GHZ; + ar->band.channels = ar->channels; + ar->band.n_channels = ARRAY_SIZE(ar5523_channels); + ar->band.bitrates = ar->rates; + ar->band.n_bitrates = ARRAY_SIZE(ar5523_rates); + ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar->band; + } + if((flags & AR5523_FLAG_ABG) && !((ar5523_no_band >> 1) & 0x1)) { + ar->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &ar5523_band_5ghz; + } + wiphy_apply_custom_regulatory(ar->hw->wiphy, &jp_regdom); + ar->hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; return 0; } @@ -1690,7 +1756,7 @@ hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); hw->queues = 1; - error = ar5523_init_modes(ar); + error = ar5523_init_modes(ar, id->driver_info); if (error) goto out_cancel_rx_cmd; @@ -1781,6 +1847,10 @@ AR5523_DEVICE_UG(0x1385, 0x4250), /* Netgear3 / WG111T (2) */ AR5523_DEVICE_UG(0x1385, 0x5f00), /* Netgear / WPN111 */ AR5523_DEVICE_UG(0x1385, 0x5f02), /* Netgear / WPN111 */ + AR5523_DEVICE_UX(0x1690, 0x0720), /* NTT / FT-STU-Sag */ + AR5523_DEVICE_UX(0x0409, 0x021c), /* NEC / Aterm WL54SU2 */ + AR5523_DEVICE_UX(0x0411, 0x0091), /* Melco / WLI-U2-KAMG54 */ + AR5523_DEVICE_UX(0x04bb, 0x0932), /* I-O DATA / WN-WAG/US */ { } }; MODULE_DEVICE_TABLE(usb, ar5523_id_table);