diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-11-25 16:36:01 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-05 09:32:11 -0500 |
commit | 0d950d84d9d16f7d4edf380a238c5b534ff00d11 (patch) | |
tree | 3127b67a67b82c131cd0ab63b6ab8dc245e4ceba /drivers | |
parent | 8e268e47b8ca5bddd189320884c3cc7d9ae489f4 (diff) |
iwlwifi: properly initialize calibration command header
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 35 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-commands.h | 34 |
3 files changed, 40 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index ab0b40531989..f90c9e92ef71 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -523,7 +523,7 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv) | |||
523 | struct iwl_calib_diff_gain_cmd cmd; | 523 | struct iwl_calib_diff_gain_cmd cmd; |
524 | 524 | ||
525 | memset(&cmd, 0, sizeof(cmd)); | 525 | memset(&cmd, 0, sizeof(cmd)); |
526 | cmd.opCode = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; | 526 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; |
527 | cmd.diff_gain_a = 0; | 527 | cmd.diff_gain_a = 0; |
528 | cmd.diff_gain_b = 0; | 528 | cmd.diff_gain_b = 0; |
529 | cmd.diff_gain_c = 0; | 529 | cmd.diff_gain_c = 0; |
@@ -574,7 +574,7 @@ static void iwl4965_gain_computation(struct iwl_priv *priv, | |||
574 | data->radio_write = 1; | 574 | data->radio_write = 1; |
575 | 575 | ||
576 | memset(&cmd, 0, sizeof(cmd)); | 576 | memset(&cmd, 0, sizeof(cmd)); |
577 | cmd.opCode = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; | 577 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD; |
578 | cmd.diff_gain_a = data->delta_gain_code[0]; | 578 | cmd.diff_gain_a = data->delta_gain_code[0]; |
579 | cmd.diff_gain_b = data->delta_gain_code[1]; | 579 | cmd.diff_gain_b = data->delta_gain_code[1]; |
580 | cmd.diff_gain_c = data->delta_gain_code[2]; | 580 | cmd.diff_gain_c = data->delta_gain_code[2]; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index a738886b434f..c3dce81aecc8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -338,9 +338,13 @@ static void iwl5000_gain_computation(struct iwl_priv *priv, | |||
338 | 338 | ||
339 | if (!data->radio_write) { | 339 | if (!data->radio_write) { |
340 | struct iwl_calib_chain_noise_gain_cmd cmd; | 340 | struct iwl_calib_chain_noise_gain_cmd cmd; |
341 | |||
341 | memset(&cmd, 0, sizeof(cmd)); | 342 | memset(&cmd, 0, sizeof(cmd)); |
342 | 343 | ||
343 | cmd.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; | 344 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; |
345 | cmd.hdr.first_group = 0; | ||
346 | cmd.hdr.groups_num = 1; | ||
347 | cmd.hdr.data_valid = 1; | ||
344 | cmd.delta_gain_1 = data->delta_gain_code[1]; | 348 | cmd.delta_gain_1 = data->delta_gain_code[1]; |
345 | cmd.delta_gain_2 = data->delta_gain_code[2]; | 349 | cmd.delta_gain_2 = data->delta_gain_code[2]; |
346 | iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, | 350 | iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, |
@@ -362,14 +366,19 @@ static void iwl5000_gain_computation(struct iwl_priv *priv, | |||
362 | static void iwl5000_chain_noise_reset(struct iwl_priv *priv) | 366 | static void iwl5000_chain_noise_reset(struct iwl_priv *priv) |
363 | { | 367 | { |
364 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; | 368 | struct iwl_chain_noise_data *data = &priv->chain_noise_data; |
369 | int ret; | ||
365 | 370 | ||
366 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { | 371 | if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { |
367 | struct iwl_calib_chain_noise_reset_cmd cmd; | 372 | struct iwl_calib_chain_noise_reset_cmd cmd; |
368 | |||
369 | memset(&cmd, 0, sizeof(cmd)); | 373 | memset(&cmd, 0, sizeof(cmd)); |
370 | cmd.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; | 374 | |
371 | if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | 375 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; |
372 | sizeof(cmd), &cmd)) | 376 | cmd.hdr.first_group = 0; |
377 | cmd.hdr.groups_num = 1; | ||
378 | cmd.hdr.data_valid = 1; | ||
379 | ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | ||
380 | sizeof(cmd), &cmd); | ||
381 | if (ret) | ||
373 | IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); | 382 | IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); |
374 | data->state = IWL_CHAIN_NOISE_ACCUMULATE; | 383 | data->state = IWL_CHAIN_NOISE_ACCUMULATE; |
375 | IWL_DEBUG_CALIB("Run chain_noise_calibrate\n"); | 384 | IWL_DEBUG_CALIB("Run chain_noise_calibrate\n"); |
@@ -420,17 +429,17 @@ static const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv, | |||
420 | */ | 429 | */ |
421 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) | 430 | static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) |
422 | { | 431 | { |
423 | u8 data[sizeof(struct iwl_calib_hdr) + | 432 | struct iwl_calib_xtal_freq_cmd cmd; |
424 | sizeof(struct iwl_cal_xtal_freq)]; | ||
425 | struct iwl_calib_cmd *cmd = (struct iwl_calib_cmd *)data; | ||
426 | struct iwl_cal_xtal_freq *xtal = (struct iwl_cal_xtal_freq *)cmd->data; | ||
427 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); | 433 | u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); |
428 | 434 | ||
429 | cmd->hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; | 435 | cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; |
430 | xtal->cap_pin1 = (u8)xtal_calib[0]; | 436 | cmd.hdr.first_group = 0; |
431 | xtal->cap_pin2 = (u8)xtal_calib[1]; | 437 | cmd.hdr.groups_num = 1; |
438 | cmd.hdr.data_valid = 1; | ||
439 | cmd.cap_pin1 = (u8)xtal_calib[0]; | ||
440 | cmd.cap_pin2 = (u8)xtal_calib[1]; | ||
432 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], | 441 | return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], |
433 | data, sizeof(data)); | 442 | (u8 *)&cmd, sizeof(cmd)); |
434 | } | 443 | } |
435 | 444 | ||
436 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) | 445 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 1fe83d45443a..77615045de69 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -2896,11 +2896,6 @@ enum { | |||
2896 | }; | 2896 | }; |
2897 | 2897 | ||
2898 | 2898 | ||
2899 | struct iwl_cal_xtal_freq { | ||
2900 | u8 cap_pin1; | ||
2901 | u8 cap_pin2; | ||
2902 | } __attribute__ ((packed)); | ||
2903 | |||
2904 | #define IWL_CALIB_INIT_CFG_ALL __constant_cpu_to_le32(0xffffffff) | 2899 | #define IWL_CALIB_INIT_CFG_ALL __constant_cpu_to_le32(0xffffffff) |
2905 | 2900 | ||
2906 | struct iwl_calib_cfg_elmnt_s { | 2901 | struct iwl_calib_cfg_elmnt_s { |
@@ -2935,31 +2930,34 @@ struct iwl_calib_cmd { | |||
2935 | u8 data[0]; | 2930 | u8 data[0]; |
2936 | } __attribute__ ((packed)); | 2931 | } __attribute__ ((packed)); |
2937 | 2932 | ||
2938 | /* "Differential Gain" opcode used in REPLY_PHY_CALIBRATION_CMD. */ | 2933 | /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ |
2939 | |||
2940 | struct iwl_calib_diff_gain_cmd { | 2934 | struct iwl_calib_diff_gain_cmd { |
2941 | u8 opCode; /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ | 2935 | struct iwl_calib_hdr hdr; |
2942 | u8 flags; /* not used */ | ||
2943 | __le16 reserved; | ||
2944 | s8 diff_gain_a; /* see above */ | 2936 | s8 diff_gain_a; /* see above */ |
2945 | s8 diff_gain_b; | 2937 | s8 diff_gain_b; |
2946 | s8 diff_gain_c; | 2938 | s8 diff_gain_c; |
2947 | u8 reserved1; | 2939 | u8 reserved1; |
2948 | } __attribute__ ((packed)); | 2940 | } __attribute__ ((packed)); |
2949 | 2941 | ||
2950 | struct iwl_calib_chain_noise_reset_cmd { | 2942 | struct iwl_calib_xtal_freq_cmd { |
2951 | u8 op_code; /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ | 2943 | struct iwl_calib_hdr hdr; |
2952 | u8 flags; /* not used */ | 2944 | u8 cap_pin1; |
2953 | __le16 reserved; | 2945 | u8 cap_pin2; |
2946 | u8 pad[2]; | ||
2954 | } __attribute__ ((packed)); | 2947 | } __attribute__ ((packed)); |
2955 | 2948 | ||
2949 | /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ | ||
2950 | struct iwl_calib_chain_noise_reset_cmd { | ||
2951 | struct iwl_calib_hdr hdr; | ||
2952 | u8 data[0]; | ||
2953 | }; | ||
2954 | |||
2955 | /* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ | ||
2956 | struct iwl_calib_chain_noise_gain_cmd { | 2956 | struct iwl_calib_chain_noise_gain_cmd { |
2957 | u8 op_code; /* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ | 2957 | struct iwl_calib_hdr hdr; |
2958 | u8 flags; /* not used */ | ||
2959 | __le16 reserved; | ||
2960 | u8 delta_gain_1; | 2958 | u8 delta_gain_1; |
2961 | u8 delta_gain_2; | 2959 | u8 delta_gain_2; |
2962 | __le16 reserved1; | 2960 | u8 pad[2]; |
2963 | } __attribute__ ((packed)); | 2961 | } __attribute__ ((packed)); |
2964 | 2962 | ||
2965 | /****************************************************************************** | 2963 | /****************************************************************************** |