diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-03-01 18:36:04 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-06 17:09:45 -0500 |
commit | 8211ef78d9023a8772e5acf6b7934598156b2fc8 (patch) | |
tree | 2306bb8216c131adaea6b36f09ff35db9975193d | |
parent | 2acae16ee79386c73db10fa8e95c9cd42fbad272 (diff) |
iwlwifi: refactor init geos function
This patch refactors init geos function. It also fixes few minor bugs.
IWL_MAX_RATE -> IWL_RATE_COUNT (IWL_MAX_RATE included also MCS setting)
There are 9 and 13 rates for 4965 in 2.4 and 5.2 respectively (rate 60)
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-commands.h | 40 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-commands.h | 40 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 58 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 64 |
5 files changed, 115 insertions, 91 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h index 20fbb32c33bd..8b7ef9f1b57b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h | |||
@@ -666,26 +666,26 @@ struct iwl3945_rx_frame_hdr { | |||
666 | u8 payload[0]; | 666 | u8 payload[0]; |
667 | } __attribute__ ((packed)); | 667 | } __attribute__ ((packed)); |
668 | 668 | ||
669 | #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) | 669 | #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) |
670 | #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) | 670 | #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) |
671 | 671 | ||
672 | #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) | 672 | #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) |
673 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) | 673 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) |
674 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) | 674 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) |
675 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) | 675 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) |
676 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) | 676 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) |
677 | 677 | ||
678 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) | 678 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) |
679 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) | 679 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) |
680 | #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) | 680 | #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) |
681 | #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) | 681 | #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) |
682 | #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) | 682 | #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) |
683 | 683 | ||
684 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) | 684 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) |
685 | #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) | 685 | #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) |
686 | #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) | 686 | #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) |
687 | #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) | 687 | #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) |
688 | #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) | 688 | #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) |
689 | 689 | ||
690 | struct iwl3945_rx_frame_end { | 690 | struct iwl3945_rx_frame_end { |
691 | __le32 status; | 691 | __le32 status; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h index d5e9220f871d..3c61f08febe6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h | |||
@@ -36,8 +36,8 @@ struct iwl3945_rate_info { | |||
36 | u8 next_rs; /* next rate used in rs algo */ | 36 | u8 next_rs; /* next rate used in rs algo */ |
37 | u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ | 37 | u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ |
38 | u8 next_rs_tgg; /* next rate used in TGG rs algo */ | 38 | u8 next_rs_tgg; /* next rate used in TGG rs algo */ |
39 | u8 table_rs_index; /* index in rate scale table cmd */ | 39 | u8 table_rs_index; /* index in rate scale table cmd */ |
40 | u8 prev_table_rs; /* prev in rate table cmd */ | 40 | u8 prev_table_rs; /* prev in rate table cmd */ |
41 | }; | 41 | }; |
42 | 42 | ||
43 | /* | 43 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h index b21ffea325cf..327eabce182c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h | |||
@@ -875,26 +875,26 @@ struct iwl4965_rx_frame_hdr { | |||
875 | u8 payload[0]; | 875 | u8 payload[0]; |
876 | } __attribute__ ((packed)); | 876 | } __attribute__ ((packed)); |
877 | 877 | ||
878 | #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) | 878 | #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) |
879 | #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) | 879 | #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) |
880 | 880 | ||
881 | #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) | 881 | #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) |
882 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) | 882 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) |
883 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) | 883 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) |
884 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) | 884 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) |
885 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) | 885 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) |
886 | 886 | ||
887 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) | 887 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) |
888 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) | 888 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) |
889 | #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) | 889 | #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) |
890 | #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) | 890 | #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) |
891 | #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) | 891 | #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) |
892 | 892 | ||
893 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) | 893 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) |
894 | #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) | 894 | #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) |
895 | #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) | 895 | #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) |
896 | #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) | 896 | #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) |
897 | #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) | 897 | #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) |
898 | 898 | ||
899 | struct iwl4965_rx_frame_end { | 899 | struct iwl4965_rx_frame_end { |
900 | __le32 status; | 900 | __le32 status; |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 139a4a24bc00..0cafbd42d84c 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -5118,11 +5118,12 @@ static int iwl3945_init_channel_map(struct iwl3945_priv *priv) | |||
5118 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; | 5118 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; |
5119 | ch_info->min_power = 0; | 5119 | ch_info->min_power = 0; |
5120 | 5120 | ||
5121 | IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" | 5121 | IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x" |
5122 | " %ddBm): Ad-Hoc %ssupported\n", | 5122 | " %ddBm): Ad-Hoc %ssupported\n", |
5123 | ch_info->channel, | 5123 | ch_info->channel, |
5124 | is_channel_a_band(ch_info) ? | 5124 | is_channel_a_band(ch_info) ? |
5125 | "5.2" : "2.4", | 5125 | "5.2" : "2.4", |
5126 | CHECK_AND_PRINT(VALID), | ||
5126 | CHECK_AND_PRINT(IBSS), | 5127 | CHECK_AND_PRINT(IBSS), |
5127 | CHECK_AND_PRINT(ACTIVE), | 5128 | CHECK_AND_PRINT(ACTIVE), |
5128 | CHECK_AND_PRINT(RADAR), | 5129 | CHECK_AND_PRINT(RADAR), |
@@ -5332,7 +5333,7 @@ static void iwl3945_init_hw_rates(struct iwl3945_priv *priv, | |||
5332 | static int iwl3945_init_geos(struct iwl3945_priv *priv) | 5333 | static int iwl3945_init_geos(struct iwl3945_priv *priv) |
5333 | { | 5334 | { |
5334 | struct iwl3945_channel_info *ch; | 5335 | struct iwl3945_channel_info *ch; |
5335 | struct ieee80211_supported_band *band; | 5336 | struct ieee80211_supported_band *sband; |
5336 | struct ieee80211_channel *channels; | 5337 | struct ieee80211_channel *channels; |
5337 | struct ieee80211_channel *geo_ch; | 5338 | struct ieee80211_channel *geo_ch; |
5338 | struct ieee80211_rate *rates; | 5339 | struct ieee80211_rate *rates; |
@@ -5350,7 +5351,7 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv) | |||
5350 | if (!channels) | 5351 | if (!channels) |
5351 | return -ENOMEM; | 5352 | return -ENOMEM; |
5352 | 5353 | ||
5353 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_MAX_RATES + 1)), | 5354 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_RATE_COUNT + 1)), |
5354 | GFP_KERNEL); | 5355 | GFP_KERNEL); |
5355 | if (!rates) { | 5356 | if (!rates) { |
5356 | kfree(channels); | 5357 | kfree(channels); |
@@ -5358,38 +5359,38 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv) | |||
5358 | } | 5359 | } |
5359 | 5360 | ||
5360 | /* 5.2GHz channels start after the 2.4GHz channels */ | 5361 | /* 5.2GHz channels start after the 2.4GHz channels */ |
5361 | band = &priv->bands[IEEE80211_BAND_5GHZ]; | 5362 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; |
5362 | band->channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)]; | 5363 | sband->channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)]; |
5363 | band->bitrates = &rates[4]; | 5364 | /* just OFDM */ |
5364 | band->n_bitrates = 8; /* just OFDM */ | 5365 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; |
5365 | 5366 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; | |
5366 | band = &priv->bands[IEEE80211_BAND_2GHZ]; | 5367 | |
5367 | band->channels = channels; | 5368 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; |
5368 | band->bitrates = rates; | 5369 | sband->channels = channels; |
5369 | band->n_bitrates = 12; /* OFDM & CCK */ | 5370 | /* OFDM & CCK */ |
5371 | sband->bitrates = rates; | ||
5372 | sband->n_bitrates = IWL_RATE_COUNT; | ||
5370 | 5373 | ||
5371 | priv->ieee_channels = channels; | 5374 | priv->ieee_channels = channels; |
5372 | priv->ieee_rates = rates; | 5375 | priv->ieee_rates = rates; |
5373 | 5376 | ||
5374 | iwl3945_init_hw_rates(priv, rates); | 5377 | iwl3945_init_hw_rates(priv, rates); |
5375 | 5378 | ||
5376 | for (i = 0, geo_ch = channels; i < priv->channel_count; i++) { | 5379 | for (i = 0; i < priv->channel_count; i++) { |
5377 | ch = &priv->channel_info[i]; | 5380 | ch = &priv->channel_info[i]; |
5378 | 5381 | ||
5379 | if (!is_channel_valid(ch)) { | 5382 | /* FIXME: might be removed if scan is OK*/ |
5380 | IWL_DEBUG_INFO("Channel %d [%sGHz] is restricted -- " | 5383 | if (!is_channel_valid(ch)) |
5381 | "skipping.\n", | ||
5382 | ch->channel, is_channel_a_band(ch) ? | ||
5383 | "5.2" : "2.4"); | ||
5384 | continue; | 5384 | continue; |
5385 | } | ||
5386 | 5385 | ||
5387 | if (is_channel_a_band(ch)) | 5386 | if (is_channel_a_band(ch)) |
5388 | geo_ch = &priv->bands[IEEE80211_BAND_5GHZ].channels[priv->bands[IEEE80211_BAND_5GHZ].n_channels++]; | 5387 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; |
5389 | else | 5388 | else |
5390 | geo_ch = &priv->bands[IEEE80211_BAND_2GHZ].channels[priv->bands[IEEE80211_BAND_2GHZ].n_channels++]; | 5389 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; |
5391 | 5390 | ||
5392 | geo_ch->center_freq = ieee80211chan2mhz(ch->channel); | 5391 | geo_ch = &sband->channels[sband->n_channels++]; |
5392 | |||
5393 | geo_ch->center_freq = ieee80211_channel_to_frequency(ch->channel); | ||
5393 | geo_ch->max_power = ch->max_power_avg; | 5394 | geo_ch->max_power = ch->max_power_avg; |
5394 | geo_ch->max_antenna_gain = 0xff; | 5395 | geo_ch->max_antenna_gain = 0xff; |
5395 | geo_ch->hw_value = ch->channel; | 5396 | geo_ch->hw_value = ch->channel; |
@@ -5407,8 +5408,19 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv) | |||
5407 | if (ch->max_power_avg > priv->max_channel_txpower_limit) | 5408 | if (ch->max_power_avg > priv->max_channel_txpower_limit) |
5408 | priv->max_channel_txpower_limit = | 5409 | priv->max_channel_txpower_limit = |
5409 | ch->max_power_avg; | 5410 | ch->max_power_avg; |
5410 | } else | 5411 | } else { |
5411 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; | 5412 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; |
5413 | } | ||
5414 | |||
5415 | /* Save flags for reg domain usage */ | ||
5416 | geo_ch->orig_flags = geo_ch->flags; | ||
5417 | |||
5418 | IWL_DEBUG_INFO("Channel %d Freq=%d[%sGHz] %s flag=0%X\n", | ||
5419 | ch->channel, geo_ch->center_freq, | ||
5420 | is_channel_a_band(ch) ? "5.2" : "2.4", | ||
5421 | geo_ch->flags & IEEE80211_CHAN_DISABLED ? | ||
5422 | "restricted" : "valid", | ||
5423 | geo_ch->flags); | ||
5412 | } | 5424 | } |
5413 | 5425 | ||
5414 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && priv->is_abg) { | 5426 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && priv->is_abg) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 99a9f820bfd1..46a43ff51526 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -5501,11 +5501,12 @@ static int iwl4965_init_channel_map(struct iwl4965_priv *priv) | |||
5501 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; | 5501 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; |
5502 | ch_info->min_power = 0; | 5502 | ch_info->min_power = 0; |
5503 | 5503 | ||
5504 | IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" | 5504 | IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x" |
5505 | " %ddBm): Ad-Hoc %ssupported\n", | 5505 | " %ddBm): Ad-Hoc %ssupported\n", |
5506 | ch_info->channel, | 5506 | ch_info->channel, |
5507 | is_channel_a_band(ch_info) ? | 5507 | is_channel_a_band(ch_info) ? |
5508 | "5.2" : "2.4", | 5508 | "5.2" : "2.4", |
5509 | CHECK_AND_PRINT(VALID), | ||
5509 | CHECK_AND_PRINT(IBSS), | 5510 | CHECK_AND_PRINT(IBSS), |
5510 | CHECK_AND_PRINT(ACTIVE), | 5511 | CHECK_AND_PRINT(ACTIVE), |
5511 | CHECK_AND_PRINT(RADAR), | 5512 | CHECK_AND_PRINT(RADAR), |
@@ -5748,7 +5749,7 @@ static void iwl4965_init_hw_rates(struct iwl4965_priv *priv, | |||
5748 | static int iwl4965_init_geos(struct iwl4965_priv *priv) | 5749 | static int iwl4965_init_geos(struct iwl4965_priv *priv) |
5749 | { | 5750 | { |
5750 | struct iwl4965_channel_info *ch; | 5751 | struct iwl4965_channel_info *ch; |
5751 | struct ieee80211_supported_band *band; | 5752 | struct ieee80211_supported_band *sband; |
5752 | struct ieee80211_channel *channels; | 5753 | struct ieee80211_channel *channels; |
5753 | struct ieee80211_channel *geo_ch; | 5754 | struct ieee80211_channel *geo_ch; |
5754 | struct ieee80211_rate *rates; | 5755 | struct ieee80211_rate *rates; |
@@ -5766,7 +5767,7 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5766 | if (!channels) | 5767 | if (!channels) |
5767 | return -ENOMEM; | 5768 | return -ENOMEM; |
5768 | 5769 | ||
5769 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_MAX_RATES + 1)), | 5770 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_RATE_COUNT + 1)), |
5770 | GFP_KERNEL); | 5771 | GFP_KERNEL); |
5771 | if (!rates) { | 5772 | if (!rates) { |
5772 | kfree(channels); | 5773 | kfree(channels); |
@@ -5774,42 +5775,42 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5774 | } | 5775 | } |
5775 | 5776 | ||
5776 | /* 5.2GHz channels start after the 2.4GHz channels */ | 5777 | /* 5.2GHz channels start after the 2.4GHz channels */ |
5777 | band = &priv->bands[IEEE80211_BAND_5GHZ]; | 5778 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; |
5778 | band->channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)]; | 5779 | sband->channels = &channels[ARRAY_SIZE(iwl4965_eeprom_band_1)]; |
5779 | band->bitrates = &rates[4]; | 5780 | /* just OFDM */ |
5780 | band->n_bitrates = 8; /* just OFDM */ | 5781 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; |
5782 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; | ||
5781 | 5783 | ||
5782 | iwl4965_init_ht_hw_capab(&band->ht_info, IEEE80211_BAND_5GHZ); | 5784 | iwl4965_init_ht_hw_capab(&sband->ht_info, IEEE80211_BAND_5GHZ); |
5783 | 5785 | ||
5784 | band = &priv->bands[IEEE80211_BAND_2GHZ]; | 5786 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; |
5785 | band->channels = channels; | 5787 | sband->channels = channels; |
5786 | band->bitrates = rates; | 5788 | /* OFDM & CCK */ |
5787 | band->n_bitrates = 12; /* OFDM & CCK */ | 5789 | sband->bitrates = rates; |
5790 | sband->n_bitrates = IWL_RATE_COUNT; | ||
5788 | 5791 | ||
5789 | iwl4965_init_ht_hw_capab(&band->ht_info, IEEE80211_BAND_2GHZ); | 5792 | iwl4965_init_ht_hw_capab(&sband->ht_info, IEEE80211_BAND_2GHZ); |
5790 | 5793 | ||
5791 | priv->ieee_channels = channels; | 5794 | priv->ieee_channels = channels; |
5792 | priv->ieee_rates = rates; | 5795 | priv->ieee_rates = rates; |
5793 | 5796 | ||
5794 | iwl4965_init_hw_rates(priv, rates); | 5797 | iwl4965_init_hw_rates(priv, rates); |
5795 | 5798 | ||
5796 | for (i = 0, geo_ch = channels; i < priv->channel_count; i++) { | 5799 | for (i = 0; i < priv->channel_count; i++) { |
5797 | ch = &priv->channel_info[i]; | 5800 | ch = &priv->channel_info[i]; |
5798 | 5801 | ||
5799 | if (!is_channel_valid(ch)) { | 5802 | /* FIXME: might be removed if scan is OK */ |
5800 | IWL_DEBUG_INFO("Channel %d [%sGHz] is restricted -- " | 5803 | if (!is_channel_valid(ch)) |
5801 | "skipping.\n", | ||
5802 | ch->channel, is_channel_a_band(ch) ? | ||
5803 | "5.2" : "2.4"); | ||
5804 | continue; | 5804 | continue; |
5805 | } | ||
5806 | 5805 | ||
5807 | if (is_channel_a_band(ch)) { | 5806 | if (is_channel_a_band(ch)) |
5808 | geo_ch = &priv->bands[IEEE80211_BAND_5GHZ].channels[priv->bands[IEEE80211_BAND_5GHZ].n_channels++]; | 5807 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; |
5809 | } else | 5808 | else |
5810 | geo_ch = &priv->bands[IEEE80211_BAND_2GHZ].channels[priv->bands[IEEE80211_BAND_2GHZ].n_channels++]; | 5809 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; |
5811 | 5810 | ||
5812 | geo_ch->center_freq = ieee80211chan2mhz(ch->channel); | 5811 | geo_ch = &sband->channels[sband->n_channels++]; |
5812 | |||
5813 | geo_ch->center_freq = ieee80211_channel_to_frequency(ch->channel); | ||
5813 | geo_ch->max_power = ch->max_power_avg; | 5814 | geo_ch->max_power = ch->max_power_avg; |
5814 | geo_ch->max_antenna_gain = 0xff; | 5815 | geo_ch->max_antenna_gain = 0xff; |
5815 | geo_ch->hw_value = ch->channel; | 5816 | geo_ch->hw_value = ch->channel; |
@@ -5827,8 +5828,19 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv) | |||
5827 | if (ch->max_power_avg > priv->max_channel_txpower_limit) | 5828 | if (ch->max_power_avg > priv->max_channel_txpower_limit) |
5828 | priv->max_channel_txpower_limit = | 5829 | priv->max_channel_txpower_limit = |
5829 | ch->max_power_avg; | 5830 | ch->max_power_avg; |
5830 | } else | 5831 | } else { |
5831 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; | 5832 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; |
5833 | } | ||
5834 | |||
5835 | /* Save flags for reg domain usage */ | ||
5836 | geo_ch->orig_flags = geo_ch->flags; | ||
5837 | |||
5838 | IWL_DEBUG_INFO("Channel %d Freq=%d[%sGHz] %s flag=0%X\n", | ||
5839 | ch->channel, geo_ch->center_freq, | ||
5840 | is_channel_a_band(ch) ? "5.2" : "2.4", | ||
5841 | geo_ch->flags & IEEE80211_CHAN_DISABLED ? | ||
5842 | "restricted" : "valid", | ||
5843 | geo_ch->flags); | ||
5832 | } | 5844 | } |
5833 | 5845 | ||
5834 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && priv->is_abg) { | 5846 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && priv->is_abg) { |