diff options
author | Samuel Ortiz <samuel.ortiz@intel.com> | 2009-01-23 16:45:15 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:01:35 -0500 |
commit | e6148917db2c223fa7edd3dfb64d99756a86b452 (patch) | |
tree | 814dc8d58d03d35e15904cc48d81c30f94dc07cf /drivers/net/wireless/iwlwifi/iwl3945-base.c | |
parent | a8e74e2774cd1aecfef0460de07e6e178df89232 (diff) |
iwl3945: Use iwl-eeprom.c routines
By adding the eeprom ops to the 3945 code, we can now use the iwlcore eeprom
routines (defined in iwl-eeprom.c).
We also removed the heavy eeprom39 reference from iwl_priv and use the eeprom
pointer instead.
Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 372 |
1 files changed, 28 insertions, 344 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 14f95238059a..b57c2b8c8dcf 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -257,7 +257,7 @@ static int iwl3945_set_rxon_channel(struct iwl_priv *priv, | |||
257 | enum ieee80211_band band, | 257 | enum ieee80211_band band, |
258 | u16 channel) | 258 | u16 channel) |
259 | { | 259 | { |
260 | if (!iwl3945_get_channel_info(priv, band, channel)) { | 260 | if (!iwl_get_channel_info(priv, band, channel)) { |
261 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", | 261 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", |
262 | channel, band); | 262 | channel, band); |
263 | return -EINVAL; | 263 | return -EINVAL; |
@@ -834,86 +834,6 @@ static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) | |||
834 | return rc; | 834 | return rc; |
835 | } | 835 | } |
836 | 836 | ||
837 | /****************************************************************************** | ||
838 | * | ||
839 | * EEPROM related functions | ||
840 | * | ||
841 | ******************************************************************************/ | ||
842 | |||
843 | static void get_eeprom_mac(struct iwl_priv *priv, u8 *mac) | ||
844 | { | ||
845 | memcpy(mac, priv->eeprom39.mac_address, 6); | ||
846 | } | ||
847 | |||
848 | /* | ||
849 | * Clear the OWNER_MSK, to establish driver (instead of uCode running on | ||
850 | * embedded controller) as EEPROM reader; each read is a series of pulses | ||
851 | * to/from the EEPROM chip, not a single event, so even reads could conflict | ||
852 | * if they weren't arbitrated by some ownership mechanism. Here, the driver | ||
853 | * simply claims ownership, which should be safe when this function is called | ||
854 | * (i.e. before loading uCode!). | ||
855 | */ | ||
856 | static inline int iwl3945_eeprom_acquire_semaphore(struct iwl_priv *priv) | ||
857 | { | ||
858 | _iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); | ||
859 | return 0; | ||
860 | } | ||
861 | |||
862 | /** | ||
863 | * iwl3945_eeprom_init - read EEPROM contents | ||
864 | * | ||
865 | * Load the EEPROM contents from adapter into priv->eeprom39 | ||
866 | * | ||
867 | * NOTE: This routine uses the non-debug IO access functions. | ||
868 | */ | ||
869 | int iwl3945_eeprom_init(struct iwl_priv *priv) | ||
870 | { | ||
871 | u16 *e = (u16 *)&priv->eeprom39; | ||
872 | u32 gp = iwl_read32(priv, CSR_EEPROM_GP); | ||
873 | int sz = sizeof(priv->eeprom39); | ||
874 | int ret; | ||
875 | u16 addr; | ||
876 | |||
877 | /* The EEPROM structure has several padding buffers within it | ||
878 | * and when adding new EEPROM maps is subject to programmer errors | ||
879 | * which may be very difficult to identify without explicitly | ||
880 | * checking the resulting size of the eeprom map. */ | ||
881 | BUILD_BUG_ON(sizeof(priv->eeprom39) != IWL_EEPROM_IMAGE_SIZE); | ||
882 | |||
883 | if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { | ||
884 | IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); | ||
885 | return -ENOENT; | ||
886 | } | ||
887 | |||
888 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ | ||
889 | ret = iwl3945_eeprom_acquire_semaphore(priv); | ||
890 | if (ret < 0) { | ||
891 | IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); | ||
892 | return -ENOENT; | ||
893 | } | ||
894 | |||
895 | /* eeprom is an array of 16bit values */ | ||
896 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | ||
897 | u32 r; | ||
898 | |||
899 | _iwl_write32(priv, CSR_EEPROM_REG, | ||
900 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); | ||
901 | _iwl_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD); | ||
902 | ret = iwl_poll_direct_bit(priv, CSR_EEPROM_REG, | ||
903 | CSR_EEPROM_REG_READ_VALID_MSK, | ||
904 | IWL_EEPROM_ACCESS_TIMEOUT); | ||
905 | if (ret < 0) { | ||
906 | IWL_ERR(priv, "Time out reading EEPROM[%d]\n", addr); | ||
907 | return ret; | ||
908 | } | ||
909 | |||
910 | r = _iwl_read_direct32(priv, CSR_EEPROM_REG); | ||
911 | e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); | ||
912 | } | ||
913 | |||
914 | return 0; | ||
915 | } | ||
916 | |||
917 | static void iwl3945_unset_hw_params(struct iwl_priv *priv) | 837 | static void iwl3945_unset_hw_params(struct iwl_priv *priv) |
918 | { | 838 | { |
919 | if (priv->shared_virt) | 839 | if (priv->shared_virt) |
@@ -1304,7 +1224,7 @@ static void iwl3945_connection_init_rx_config(struct iwl_priv *priv, | |||
1304 | priv->staging39_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 1224 | priv->staging39_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
1305 | #endif | 1225 | #endif |
1306 | 1226 | ||
1307 | ch_info = iwl3945_get_channel_info(priv, priv->band, | 1227 | ch_info = iwl_get_channel_info(priv, priv->band, |
1308 | le16_to_cpu(priv->active39_rxon.channel)); | 1228 | le16_to_cpu(priv->active39_rxon.channel)); |
1309 | 1229 | ||
1310 | if (!ch_info) | 1230 | if (!ch_info) |
@@ -1336,7 +1256,7 @@ static int iwl3945_set_mode(struct iwl_priv *priv, int mode) | |||
1336 | if (mode == NL80211_IFTYPE_ADHOC) { | 1256 | if (mode == NL80211_IFTYPE_ADHOC) { |
1337 | const struct iwl_channel_info *ch_info; | 1257 | const struct iwl_channel_info *ch_info; |
1338 | 1258 | ||
1339 | ch_info = iwl3945_get_channel_info(priv, | 1259 | ch_info = iwl_get_channel_info(priv, |
1340 | priv->band, | 1260 | priv->band, |
1341 | le16_to_cpu(priv->staging39_rxon.channel)); | 1261 | le16_to_cpu(priv->staging39_rxon.channel)); |
1342 | 1262 | ||
@@ -3349,258 +3269,6 @@ unplugged: | |||
3349 | return IRQ_NONE; | 3269 | return IRQ_NONE; |
3350 | } | 3270 | } |
3351 | 3271 | ||
3352 | /************************** EEPROM BANDS **************************** | ||
3353 | * | ||
3354 | * The iwl3945_eeprom_band definitions below provide the mapping from the | ||
3355 | * EEPROM contents to the specific channel number supported for each | ||
3356 | * band. | ||
3357 | * | ||
3358 | * For example, iwl3945_priv->eeprom39.band_3_channels[4] from the band_3 | ||
3359 | * definition below maps to physical channel 42 in the 5.2GHz spectrum. | ||
3360 | * The specific geography and calibration information for that channel | ||
3361 | * is contained in the eeprom map itself. | ||
3362 | * | ||
3363 | * During init, we copy the eeprom information and channel map | ||
3364 | * information into priv->channel_info_24/52 and priv->channel_map_24/52 | ||
3365 | * | ||
3366 | * channel_map_24/52 provides the index in the channel_info array for a | ||
3367 | * given channel. We have to have two separate maps as there is channel | ||
3368 | * overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and | ||
3369 | * band_2 | ||
3370 | * | ||
3371 | * A value of 0xff stored in the channel_map indicates that the channel | ||
3372 | * is not supported by the hardware at all. | ||
3373 | * | ||
3374 | * A value of 0xfe in the channel_map indicates that the channel is not | ||
3375 | * valid for Tx with the current hardware. This means that | ||
3376 | * while the system can tune and receive on a given channel, it may not | ||
3377 | * be able to associate or transmit any frames on that | ||
3378 | * channel. There is no corresponding channel information for that | ||
3379 | * entry. | ||
3380 | * | ||
3381 | *********************************************************************/ | ||
3382 | |||
3383 | /* 2.4 GHz */ | ||
3384 | static const u8 iwl3945_eeprom_band_1[14] = { | ||
3385 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 | ||
3386 | }; | ||
3387 | |||
3388 | /* 5.2 GHz bands */ | ||
3389 | static const u8 iwl3945_eeprom_band_2[] = { /* 4915-5080MHz */ | ||
3390 | 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 | ||
3391 | }; | ||
3392 | |||
3393 | static const u8 iwl3945_eeprom_band_3[] = { /* 5170-5320MHz */ | ||
3394 | 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 | ||
3395 | }; | ||
3396 | |||
3397 | static const u8 iwl3945_eeprom_band_4[] = { /* 5500-5700MHz */ | ||
3398 | 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 | ||
3399 | }; | ||
3400 | |||
3401 | static const u8 iwl3945_eeprom_band_5[] = { /* 5725-5825MHz */ | ||
3402 | 145, 149, 153, 157, 161, 165 | ||
3403 | }; | ||
3404 | |||
3405 | static void iwl3945_init_band_reference(const struct iwl_priv *priv, int band, | ||
3406 | int *eeprom_ch_count, | ||
3407 | const struct iwl_eeprom_channel | ||
3408 | **eeprom_ch_info, | ||
3409 | const u8 **eeprom_ch_index) | ||
3410 | { | ||
3411 | switch (band) { | ||
3412 | case 1: /* 2.4GHz band */ | ||
3413 | *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_1); | ||
3414 | *eeprom_ch_info = priv->eeprom39.band_1_channels; | ||
3415 | *eeprom_ch_index = iwl3945_eeprom_band_1; | ||
3416 | break; | ||
3417 | case 2: /* 4.9GHz band */ | ||
3418 | *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_2); | ||
3419 | *eeprom_ch_info = priv->eeprom39.band_2_channels; | ||
3420 | *eeprom_ch_index = iwl3945_eeprom_band_2; | ||
3421 | break; | ||
3422 | case 3: /* 5.2GHz band */ | ||
3423 | *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_3); | ||
3424 | *eeprom_ch_info = priv->eeprom39.band_3_channels; | ||
3425 | *eeprom_ch_index = iwl3945_eeprom_band_3; | ||
3426 | break; | ||
3427 | case 4: /* 5.5GHz band */ | ||
3428 | *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_4); | ||
3429 | *eeprom_ch_info = priv->eeprom39.band_4_channels; | ||
3430 | *eeprom_ch_index = iwl3945_eeprom_band_4; | ||
3431 | break; | ||
3432 | case 5: /* 5.7GHz band */ | ||
3433 | *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_5); | ||
3434 | *eeprom_ch_info = priv->eeprom39.band_5_channels; | ||
3435 | *eeprom_ch_index = iwl3945_eeprom_band_5; | ||
3436 | break; | ||
3437 | default: | ||
3438 | BUG(); | ||
3439 | return; | ||
3440 | } | ||
3441 | } | ||
3442 | |||
3443 | /** | ||
3444 | * iwl3945_get_channel_info - Find driver's private channel info | ||
3445 | * | ||
3446 | * Based on band and channel number. | ||
3447 | */ | ||
3448 | const struct iwl_channel_info * | ||
3449 | iwl3945_get_channel_info(const struct iwl_priv *priv, | ||
3450 | enum ieee80211_band band, u16 channel) | ||
3451 | { | ||
3452 | int i; | ||
3453 | |||
3454 | switch (band) { | ||
3455 | case IEEE80211_BAND_5GHZ: | ||
3456 | for (i = 14; i < priv->channel_count; i++) { | ||
3457 | if (priv->channel_info[i].channel == channel) | ||
3458 | return &priv->channel_info[i]; | ||
3459 | } | ||
3460 | break; | ||
3461 | |||
3462 | case IEEE80211_BAND_2GHZ: | ||
3463 | if (channel >= 1 && channel <= 14) | ||
3464 | return &priv->channel_info[channel - 1]; | ||
3465 | break; | ||
3466 | case IEEE80211_NUM_BANDS: | ||
3467 | WARN_ON(1); | ||
3468 | } | ||
3469 | |||
3470 | return NULL; | ||
3471 | } | ||
3472 | |||
3473 | #define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ | ||
3474 | ? # x " " : "") | ||
3475 | |||
3476 | /** | ||
3477 | * iwl3945_init_channel_map - Set up driver's info for all possible channels | ||
3478 | */ | ||
3479 | static int iwl3945_init_channel_map(struct iwl_priv *priv) | ||
3480 | { | ||
3481 | int eeprom_ch_count = 0; | ||
3482 | const u8 *eeprom_ch_index = NULL; | ||
3483 | const struct iwl_eeprom_channel *eeprom_ch_info = NULL; | ||
3484 | int band, ch; | ||
3485 | struct iwl_channel_info *ch_info; | ||
3486 | |||
3487 | if (priv->channel_count) { | ||
3488 | IWL_DEBUG_INFO("Channel map already initialized.\n"); | ||
3489 | return 0; | ||
3490 | } | ||
3491 | |||
3492 | if (priv->eeprom39.version < 0x2f) { | ||
3493 | IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", | ||
3494 | priv->eeprom39.version); | ||
3495 | return -EINVAL; | ||
3496 | } | ||
3497 | |||
3498 | IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n"); | ||
3499 | |||
3500 | priv->channel_count = | ||
3501 | ARRAY_SIZE(iwl3945_eeprom_band_1) + | ||
3502 | ARRAY_SIZE(iwl3945_eeprom_band_2) + | ||
3503 | ARRAY_SIZE(iwl3945_eeprom_band_3) + | ||
3504 | ARRAY_SIZE(iwl3945_eeprom_band_4) + | ||
3505 | ARRAY_SIZE(iwl3945_eeprom_band_5); | ||
3506 | |||
3507 | IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count); | ||
3508 | |||
3509 | priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) * | ||
3510 | priv->channel_count, GFP_KERNEL); | ||
3511 | if (!priv->channel_info) { | ||
3512 | IWL_ERR(priv, "Could not allocate channel_info\n"); | ||
3513 | priv->channel_count = 0; | ||
3514 | return -ENOMEM; | ||
3515 | } | ||
3516 | |||
3517 | ch_info = priv->channel_info; | ||
3518 | |||
3519 | /* Loop through the 5 EEPROM bands adding them in order to the | ||
3520 | * channel map we maintain (that contains additional information than | ||
3521 | * what just in the EEPROM) */ | ||
3522 | for (band = 1; band <= 5; band++) { | ||
3523 | |||
3524 | iwl3945_init_band_reference(priv, band, &eeprom_ch_count, | ||
3525 | &eeprom_ch_info, &eeprom_ch_index); | ||
3526 | |||
3527 | /* Loop through each band adding each of the channels */ | ||
3528 | for (ch = 0; ch < eeprom_ch_count; ch++) { | ||
3529 | ch_info->channel = eeprom_ch_index[ch]; | ||
3530 | ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ : | ||
3531 | IEEE80211_BAND_5GHZ; | ||
3532 | |||
3533 | /* permanently store EEPROM's channel regulatory flags | ||
3534 | * and max power in channel info database. */ | ||
3535 | ch_info->eeprom = eeprom_ch_info[ch]; | ||
3536 | |||
3537 | /* Copy the run-time flags so they are there even on | ||
3538 | * invalid channels */ | ||
3539 | ch_info->flags = eeprom_ch_info[ch].flags; | ||
3540 | |||
3541 | if (!(is_channel_valid(ch_info))) { | ||
3542 | IWL_DEBUG_INFO("Ch. %d Flags %x [%sGHz] - " | ||
3543 | "No traffic\n", | ||
3544 | ch_info->channel, | ||
3545 | ch_info->flags, | ||
3546 | is_channel_a_band(ch_info) ? | ||
3547 | "5.2" : "2.4"); | ||
3548 | ch_info++; | ||
3549 | continue; | ||
3550 | } | ||
3551 | |||
3552 | /* Initialize regulatory-based run-time data */ | ||
3553 | ch_info->max_power_avg = ch_info->curr_txpow = | ||
3554 | eeprom_ch_info[ch].max_power_avg; | ||
3555 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; | ||
3556 | ch_info->min_power = 0; | ||
3557 | |||
3558 | IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" | ||
3559 | " %ddBm): Ad-Hoc %ssupported\n", | ||
3560 | ch_info->channel, | ||
3561 | is_channel_a_band(ch_info) ? | ||
3562 | "5.2" : "2.4", | ||
3563 | CHECK_AND_PRINT(VALID), | ||
3564 | CHECK_AND_PRINT(IBSS), | ||
3565 | CHECK_AND_PRINT(ACTIVE), | ||
3566 | CHECK_AND_PRINT(RADAR), | ||
3567 | CHECK_AND_PRINT(WIDE), | ||
3568 | CHECK_AND_PRINT(DFS), | ||
3569 | eeprom_ch_info[ch].flags, | ||
3570 | eeprom_ch_info[ch].max_power_avg, | ||
3571 | ((eeprom_ch_info[ch]. | ||
3572 | flags & EEPROM_CHANNEL_IBSS) | ||
3573 | && !(eeprom_ch_info[ch]. | ||
3574 | flags & EEPROM_CHANNEL_RADAR)) | ||
3575 | ? "" : "not "); | ||
3576 | |||
3577 | /* Set the tx_power_user_lmt to the highest power | ||
3578 | * supported by any channel */ | ||
3579 | if (eeprom_ch_info[ch].max_power_avg > | ||
3580 | priv->tx_power_user_lmt) | ||
3581 | priv->tx_power_user_lmt = | ||
3582 | eeprom_ch_info[ch].max_power_avg; | ||
3583 | |||
3584 | ch_info++; | ||
3585 | } | ||
3586 | } | ||
3587 | |||
3588 | /* Set up txpower settings in driver for all channels */ | ||
3589 | if (iwl3945_txpower_set_from_eeprom(priv)) | ||
3590 | return -EIO; | ||
3591 | |||
3592 | return 0; | ||
3593 | } | ||
3594 | |||
3595 | /* | ||
3596 | * iwl3945_free_channel_map - undo allocations in iwl3945_init_channel_map | ||
3597 | */ | ||
3598 | static void iwl3945_free_channel_map(struct iwl_priv *priv) | ||
3599 | { | ||
3600 | kfree(priv->channel_info); | ||
3601 | priv->channel_count = 0; | ||
3602 | } | ||
3603 | |||
3604 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | 3272 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, |
3605 | enum ieee80211_band band, | 3273 | enum ieee80211_band band, |
3606 | u8 is_active, u8 n_probes, | 3274 | u8 is_active, u8 n_probes, |
@@ -3631,7 +3299,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | |||
3631 | 3299 | ||
3632 | scan_ch->channel = channels[i].hw_value; | 3300 | scan_ch->channel = channels[i].hw_value; |
3633 | 3301 | ||
3634 | ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel); | 3302 | ch_info = iwl_get_channel_info(priv, band, scan_ch->channel); |
3635 | if (!is_channel_valid(ch_info)) { | 3303 | if (!is_channel_valid(ch_info)) { |
3636 | IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n", | 3304 | IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n", |
3637 | scan_ch->channel); | 3305 | scan_ch->channel); |
@@ -3718,6 +3386,7 @@ static void iwl3945_init_hw_rates(struct iwl_priv *priv, | |||
3718 | /** | 3386 | /** |
3719 | * iwl3945_init_geos - Initialize mac80211's geo/channel info based from eeprom | 3387 | * iwl3945_init_geos - Initialize mac80211's geo/channel info based from eeprom |
3720 | */ | 3388 | */ |
3389 | #define IEEE80211_24GHZ_MAX_CHANNEL 14 | ||
3721 | static int iwl3945_init_geos(struct iwl_priv *priv) | 3390 | static int iwl3945_init_geos(struct iwl_priv *priv) |
3722 | { | 3391 | { |
3723 | struct iwl_channel_info *ch; | 3392 | struct iwl_channel_info *ch; |
@@ -3748,7 +3417,7 @@ static int iwl3945_init_geos(struct iwl_priv *priv) | |||
3748 | 3417 | ||
3749 | /* 5.2GHz channels start after the 2.4GHz channels */ | 3418 | /* 5.2GHz channels start after the 2.4GHz channels */ |
3750 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; | 3419 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; |
3751 | sband->channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)]; | 3420 | sband->channels = &channels[IEEE80211_24GHZ_MAX_CHANNEL]; |
3752 | /* just OFDM */ | 3421 | /* just OFDM */ |
3753 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; | 3422 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; |
3754 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; | 3423 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; |
@@ -5242,8 +4911,8 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
5242 | 4911 | ||
5243 | spin_lock_irqsave(&priv->lock, flags); | 4912 | spin_lock_irqsave(&priv->lock, flags); |
5244 | 4913 | ||
5245 | ch_info = iwl3945_get_channel_info(priv, conf->channel->band, | 4914 | ch_info = iwl_get_channel_info(priv, conf->channel->band, |
5246 | conf->channel->hw_value); | 4915 | conf->channel->hw_value); |
5247 | if (!is_channel_valid(ch_info)) { | 4916 | if (!is_channel_valid(ch_info)) { |
5248 | IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this band.\n", | 4917 | IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this band.\n", |
5249 | conf->channel->hw_value, conf->channel->band); | 4918 | conf->channel->hw_value, conf->channel->band); |
@@ -6423,6 +6092,7 @@ static struct ieee80211_ops iwl3945_hw_ops = { | |||
6423 | static int iwl3945_init_drv(struct iwl_priv *priv) | 6092 | static int iwl3945_init_drv(struct iwl_priv *priv) |
6424 | { | 6093 | { |
6425 | int ret; | 6094 | int ret; |
6095 | struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; | ||
6426 | 6096 | ||
6427 | priv->retry_rate = 1; | 6097 | priv->retry_rate = 1; |
6428 | priv->ibss_beacon = NULL; | 6098 | priv->ibss_beacon = NULL; |
@@ -6456,12 +6126,24 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
6456 | priv->power_mode = IWL39_POWER_AC; | 6126 | priv->power_mode = IWL39_POWER_AC; |
6457 | priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER; | 6127 | priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER; |
6458 | 6128 | ||
6459 | ret = iwl3945_init_channel_map(priv); | 6129 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { |
6130 | IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", | ||
6131 | eeprom->version); | ||
6132 | ret = -EINVAL; | ||
6133 | goto err; | ||
6134 | } | ||
6135 | ret = iwl_init_channel_map(priv); | ||
6460 | if (ret) { | 6136 | if (ret) { |
6461 | IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); | 6137 | IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); |
6462 | goto err; | 6138 | goto err; |
6463 | } | 6139 | } |
6464 | 6140 | ||
6141 | /* Set up txpower settings in driver for all channels */ | ||
6142 | if (iwl3945_txpower_set_from_eeprom(priv)) { | ||
6143 | ret = -EIO; | ||
6144 | goto err_free_channel_map; | ||
6145 | } | ||
6146 | |||
6465 | ret = iwl3945_init_geos(priv); | 6147 | ret = iwl3945_init_geos(priv); |
6466 | if (ret) { | 6148 | if (ret) { |
6467 | IWL_ERR(priv, "initializing geos failed: %d\n", ret); | 6149 | IWL_ERR(priv, "initializing geos failed: %d\n", ret); |
@@ -6471,7 +6153,7 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
6471 | return 0; | 6153 | return 0; |
6472 | 6154 | ||
6473 | err_free_channel_map: | 6155 | err_free_channel_map: |
6474 | iwl3945_free_channel_map(priv); | 6156 | iwl_free_channel_map(priv); |
6475 | err: | 6157 | err: |
6476 | return ret; | 6158 | return ret; |
6477 | } | 6159 | } |
@@ -6482,6 +6164,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
6482 | struct iwl_priv *priv; | 6164 | struct iwl_priv *priv; |
6483 | struct ieee80211_hw *hw; | 6165 | struct ieee80211_hw *hw; |
6484 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); | 6166 | struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); |
6167 | struct iwl3945_eeprom *eeprom; | ||
6485 | unsigned long flags; | 6168 | unsigned long flags; |
6486 | 6169 | ||
6487 | /*********************** | 6170 | /*********************** |
@@ -6597,13 +6280,14 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
6597 | * ********************/ | 6280 | * ********************/ |
6598 | 6281 | ||
6599 | /* Read the EEPROM */ | 6282 | /* Read the EEPROM */ |
6600 | err = iwl3945_eeprom_init(priv); | 6283 | err = iwl_eeprom_init(priv); |
6601 | if (err) { | 6284 | if (err) { |
6602 | IWL_ERR(priv, "Unable to init EEPROM\n"); | 6285 | IWL_ERR(priv, "Unable to init EEPROM\n"); |
6603 | goto out_remove_sysfs; | 6286 | goto out_remove_sysfs; |
6604 | } | 6287 | } |
6605 | /* MAC Address location in EEPROM same for 3945/4965 */ | 6288 | /* MAC Address location in EEPROM same for 3945/4965 */ |
6606 | get_eeprom_mac(priv, priv->mac_addr); | 6289 | eeprom = (struct iwl3945_eeprom *)priv->eeprom; |
6290 | memcpy(priv->mac_addr, eeprom->mac_address, ETH_ALEN); | ||
6607 | IWL_DEBUG_INFO("MAC address: %pM\n", priv->mac_addr); | 6291 | IWL_DEBUG_INFO("MAC address: %pM\n", priv->mac_addr); |
6608 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); | 6292 | SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); |
6609 | 6293 | ||
@@ -6776,7 +6460,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
6776 | pci_disable_device(pdev); | 6460 | pci_disable_device(pdev); |
6777 | pci_set_drvdata(pdev, NULL); | 6461 | pci_set_drvdata(pdev, NULL); |
6778 | 6462 | ||
6779 | iwl3945_free_channel_map(priv); | 6463 | iwl_free_channel_map(priv); |
6780 | iwl3945_free_geos(priv); | 6464 | iwl3945_free_geos(priv); |
6781 | kfree(priv->scan); | 6465 | kfree(priv->scan); |
6782 | if (priv->ibss_beacon) | 6466 | if (priv->ibss_beacon) |