aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-10-24 02:48:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:02:25 -0400
commitf69f42a6bbefb311ccb1626fdb61f723160afbfd (patch)
tree3475e06e132914d4e43300e60e786ac7402767a9 /drivers
parent0ef2ca67b19e2286eed8eeb7ef7a35ce57d6d629 (diff)
iwlwifi: calibration command namespace renaming
Since calibration framework is not HW specific remove 5000 and 4965 prefix This patch doesn't provide any functional changes only code renaming and movement 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.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000-hw.h9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c42
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h69
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h15
5 files changed, 74 insertions, 69 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index f53cd2b096df..aad32a3ffd19 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -519,10 +519,10 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv)
519 struct iwl_chain_noise_data *data = &(priv->chain_noise_data); 519 struct iwl_chain_noise_data *data = &(priv->chain_noise_data);
520 520
521 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { 521 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) {
522 struct iwl4965_calibration_cmd cmd; 522 struct iwl_calib_diff_gain_cmd cmd;
523 523
524 memset(&cmd, 0, sizeof(cmd)); 524 memset(&cmd, 0, sizeof(cmd));
525 cmd.opCode = PHY_CALIBRATE_DIFF_GAIN_CMD; 525 cmd.opCode = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD;
526 cmd.diff_gain_a = 0; 526 cmd.diff_gain_a = 0;
527 cmd.diff_gain_b = 0; 527 cmd.diff_gain_b = 0;
528 cmd.diff_gain_c = 0; 528 cmd.diff_gain_c = 0;
@@ -569,11 +569,11 @@ static void iwl4965_gain_computation(struct iwl_priv *priv,
569 569
570 /* Differential gain gets sent to uCode only once */ 570 /* Differential gain gets sent to uCode only once */
571 if (!data->radio_write) { 571 if (!data->radio_write) {
572 struct iwl4965_calibration_cmd cmd; 572 struct iwl_calib_diff_gain_cmd cmd;
573 data->radio_write = 1; 573 data->radio_write = 1;
574 574
575 memset(&cmd, 0, sizeof(cmd)); 575 memset(&cmd, 0, sizeof(cmd));
576 cmd.opCode = PHY_CALIBRATE_DIFF_GAIN_CMD; 576 cmd.opCode = IWL_PHY_CALIBRATE_DIFF_GAIN_CMD;
577 cmd.diff_gain_a = data->delta_gain_code[0]; 577 cmd.diff_gain_a = data->delta_gain_code[0];
578 cmd.diff_gain_b = data->delta_gain_code[1]; 578 cmd.diff_gain_b = data->delta_gain_code[1];
579 cmd.diff_gain_c = data->delta_gain_code[2]; 579 cmd.diff_gain_c = data->delta_gain_code[2];
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
index 66ed993a7298..fa0644321e4f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
@@ -129,14 +129,5 @@ struct iwl5000_shared {
129 __le32 padding2; 129 __le32 padding2;
130} __attribute__ ((packed)); 130} __attribute__ ((packed));
131 131
132/* calibrations defined for 5000 */
133/* defines the order in which results should be sent to the runtime uCode */
134enum iwl5000_calib {
135 IWL5000_CALIB_XTAL,
136 IWL5000_CALIB_LO,
137 IWL5000_CALIB_TX_IQ,
138 IWL5000_CALIB_TX_IQ_PERD,
139};
140
141#endif /* __iwl_5000_hw_h__ */ 132#endif /* __iwl_5000_hw_h__ */
142 133
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index f3316d488240..b4b7e8b2a429 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -337,10 +337,10 @@ static void iwl5000_gain_computation(struct iwl_priv *priv,
337 data->delta_gain_code[1], data->delta_gain_code[2]); 337 data->delta_gain_code[1], data->delta_gain_code[2]);
338 338
339 if (!data->radio_write) { 339 if (!data->radio_write) {
340 struct iwl5000_calibration_chain_noise_gain_cmd cmd; 340 struct iwl_calib_chain_noise_gain_cmd cmd;
341 memset(&cmd, 0, sizeof(cmd)); 341 memset(&cmd, 0, sizeof(cmd));
342 342
343 cmd.op_code = IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD; 343 cmd.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD;
344 cmd.delta_gain_1 = data->delta_gain_code[1]; 344 cmd.delta_gain_1 = data->delta_gain_code[1];
345 cmd.delta_gain_2 = data->delta_gain_code[2]; 345 cmd.delta_gain_2 = data->delta_gain_code[2];
346 iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD, 346 iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD,
@@ -364,10 +364,10 @@ static void iwl5000_chain_noise_reset(struct iwl_priv *priv)
364 struct iwl_chain_noise_data *data = &priv->chain_noise_data; 364 struct iwl_chain_noise_data *data = &priv->chain_noise_data;
365 365
366 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) { 366 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl_is_associated(priv)) {
367 struct iwl5000_calibration_chain_noise_reset_cmd cmd; 367 struct iwl_calib_chain_noise_reset_cmd cmd;
368 368
369 memset(&cmd, 0, sizeof(cmd)); 369 memset(&cmd, 0, sizeof(cmd));
370 cmd.op_code = IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD; 370 cmd.op_code = IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD;
371 if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 371 if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
372 sizeof(cmd), &cmd)) 372 sizeof(cmd), &cmd))
373 IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); 373 IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n");
@@ -420,25 +420,25 @@ static const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv,
420 */ 420 */
421static int iwl5000_set_Xtal_calib(struct iwl_priv *priv) 421static int iwl5000_set_Xtal_calib(struct iwl_priv *priv)
422{ 422{
423 u8 data[sizeof(struct iwl5000_calib_hdr) + 423 u8 data[sizeof(struct iwl_calib_hdr) +
424 sizeof(struct iwl_cal_xtal_freq)]; 424 sizeof(struct iwl_cal_xtal_freq)];
425 struct iwl5000_calib_cmd *cmd = (struct iwl5000_calib_cmd *)data; 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; 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); 427 u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL);
428 428
429 cmd->hdr.op_code = IWL5000_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; 429 cmd->hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD;
430 xtal->cap_pin1 = (u8)xtal_calib[0]; 430 xtal->cap_pin1 = (u8)xtal_calib[0];
431 xtal->cap_pin2 = (u8)xtal_calib[1]; 431 xtal->cap_pin2 = (u8)xtal_calib[1];
432 return iwl_calib_set(&priv->calib_results[IWL5000_CALIB_XTAL], 432 return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL],
433 data, sizeof(data)); 433 data, sizeof(data));
434} 434}
435 435
436static int iwl5000_send_calib_cfg(struct iwl_priv *priv) 436static int iwl5000_send_calib_cfg(struct iwl_priv *priv)
437{ 437{
438 struct iwl5000_calib_cfg_cmd calib_cfg_cmd; 438 struct iwl_calib_cfg_cmd calib_cfg_cmd;
439 struct iwl_host_cmd cmd = { 439 struct iwl_host_cmd cmd = {
440 .id = CALIBRATION_CFG_CMD, 440 .id = CALIBRATION_CFG_CMD,
441 .len = sizeof(struct iwl5000_calib_cfg_cmd), 441 .len = sizeof(struct iwl_calib_cfg_cmd),
442 .data = &calib_cfg_cmd, 442 .data = &calib_cfg_cmd,
443 }; 443 };
444 444
@@ -455,7 +455,7 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv,
455 struct iwl_rx_mem_buffer *rxb) 455 struct iwl_rx_mem_buffer *rxb)
456{ 456{
457 struct iwl_rx_packet *pkt = (void *)rxb->skb->data; 457 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
458 struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw; 458 struct iwl_calib_hdr *hdr = (struct iwl_calib_hdr *)pkt->u.raw;
459 int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; 459 int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK;
460 int index; 460 int index;
461 461
@@ -466,14 +466,14 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv,
466 * uCode. iwl_send_calib_results sends them in a row according to their 466 * uCode. iwl_send_calib_results sends them in a row according to their
467 * index. We sort them here */ 467 * index. We sort them here */
468 switch (hdr->op_code) { 468 switch (hdr->op_code) {
469 case IWL5000_PHY_CALIBRATE_LO_CMD: 469 case IWL_PHY_CALIBRATE_LO_CMD:
470 index = IWL5000_CALIB_LO; 470 index = IWL_CALIB_LO;
471 break; 471 break;
472 case IWL5000_PHY_CALIBRATE_TX_IQ_CMD: 472 case IWL_PHY_CALIBRATE_TX_IQ_CMD:
473 index = IWL5000_CALIB_TX_IQ; 473 index = IWL_CALIB_TX_IQ;
474 break; 474 break;
475 case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD: 475 case IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD:
476 index = IWL5000_CALIB_TX_IQ_PERD; 476 index = IWL_CALIB_TX_IQ_PERD;
477 break; 477 break;
478 default: 478 default:
479 IWL_ERROR("Unknown calibration notification %d\n", 479 IWL_ERROR("Unknown calibration notification %d\n",
@@ -839,10 +839,10 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
839 case CSR_HW_REV_TYPE_5300: 839 case CSR_HW_REV_TYPE_5300:
840 case CSR_HW_REV_TYPE_5350: 840 case CSR_HW_REV_TYPE_5350:
841 priv->hw_params.calib_init_cfg = 841 priv->hw_params.calib_init_cfg =
842 BIT(IWL5000_CALIB_XTAL) | 842 BIT(IWL_CALIB_XTAL) |
843 BIT(IWL5000_CALIB_LO) | 843 BIT(IWL_CALIB_LO) |
844 BIT(IWL5000_CALIB_TX_IQ) | 844 BIT(IWL_CALIB_TX_IQ) |
845 BIT(IWL5000_CALIB_TX_IQ_PERD); 845 BIT(IWL_CALIB_TX_IQ_PERD);
846 break; 846 break;
847 case CSR_HW_REV_TYPE_5150: 847 case CSR_HW_REV_TYPE_5150:
848 priv->hw_params.calib_init_cfg = 0; 848 priv->hw_params.calib_init_cfg = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 8f8734fc4f39..56964eeb523e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -2875,36 +2875,25 @@ struct iwl_sensitivity_cmd {
2875 * 1-0: amount of gain, units of 1.5 dB 2875 * 1-0: amount of gain, units of 1.5 dB
2876 */ 2876 */
2877 2877
2878/* "Differential Gain" opcode used in REPLY_PHY_CALIBRATION_CMD. */ 2878/* Phy calibration command for series */
2879#define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
2880
2881struct iwl4965_calibration_cmd {
2882 u8 opCode; /* PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
2883 u8 flags; /* not used */
2884 __le16 reserved;
2885 s8 diff_gain_a; /* see above */
2886 s8 diff_gain_b;
2887 s8 diff_gain_c;
2888 u8 reserved1;
2889} __attribute__ ((packed));
2890
2891/* Phy calibration command for 5000 series */
2892 2879
2893enum { 2880enum {
2894 IWL5000_PHY_CALIBRATE_DC_CMD = 8, 2881 IWL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7,
2895 IWL5000_PHY_CALIBRATE_LO_CMD = 9, 2882 IWL_PHY_CALIBRATE_DC_CMD = 8,
2896 IWL5000_PHY_CALIBRATE_RX_BB_CMD = 10, 2883 IWL_PHY_CALIBRATE_LO_CMD = 9,
2897 IWL5000_PHY_CALIBRATE_TX_IQ_CMD = 11, 2884 IWL_PHY_CALIBRATE_RX_BB_CMD = 10,
2898 IWL5000_PHY_CALIBRATE_RX_IQ_CMD = 12, 2885 IWL_PHY_CALIBRATE_TX_IQ_CMD = 11,
2899 IWL5000_PHY_CALIBRATION_NOISE_CMD = 13, 2886 IWL_PHY_CALIBRATE_RX_IQ_CMD = 12,
2900 IWL5000_PHY_CALIBRATE_AGC_TABLE_CMD = 14, 2887 IWL_PHY_CALIBRATION_NOISE_CMD = 13,
2901 IWL5000_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, 2888 IWL_PHY_CALIBRATE_AGC_TABLE_CMD = 14,
2902 IWL5000_PHY_CALIBRATE_BASE_BAND_CMD = 16, 2889 IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15,
2903 IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, 2890 IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16,
2904 IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18, 2891 IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17,
2905 IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19, 2892 IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18,
2893 IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19,
2906}; 2894};
2907 2895
2896
2908struct iwl_cal_xtal_freq { 2897struct iwl_cal_xtal_freq {
2909 u8 cap_pin1; 2898 u8 cap_pin1;
2910 u8 cap_pin2; 2899 u8 cap_pin2;
@@ -2926,32 +2915,44 @@ struct iwl_calib_cfg_status_s {
2926 __le32 flags; 2915 __le32 flags;
2927} __attribute__ ((packed)); 2916} __attribute__ ((packed));
2928 2917
2929struct iwl5000_calib_cfg_cmd { 2918struct iwl_calib_cfg_cmd {
2930 struct iwl_calib_cfg_status_s ucd_calib_cfg; 2919 struct iwl_calib_cfg_status_s ucd_calib_cfg;
2931 struct iwl_calib_cfg_status_s drv_calib_cfg; 2920 struct iwl_calib_cfg_status_s drv_calib_cfg;
2932 __le32 reserved1; 2921 __le32 reserved1;
2933} __attribute__ ((packed)); 2922} __attribute__ ((packed));
2934 2923
2935struct iwl5000_calib_hdr { 2924struct iwl_calib_hdr {
2936 u8 op_code; 2925 u8 op_code;
2937 u8 first_group; 2926 u8 first_group;
2938 u8 groups_num; 2927 u8 groups_num;
2939 u8 data_valid; 2928 u8 data_valid;
2940} __attribute__ ((packed)); 2929} __attribute__ ((packed));
2941 2930
2942struct iwl5000_calib_cmd { 2931struct iwl_calib_cmd {
2943 struct iwl5000_calib_hdr hdr; 2932 struct iwl_calib_hdr hdr;
2944 u8 data[0]; 2933 u8 data[0];
2945} __attribute__ ((packed)); 2934} __attribute__ ((packed));
2946 2935
2947struct iwl5000_calibration_chain_noise_reset_cmd { 2936/* "Differential Gain" opcode used in REPLY_PHY_CALIBRATION_CMD. */
2948 u8 op_code; /* IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ 2937
2938struct iwl_calib_diff_gain_cmd {
2939 u8 opCode; /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
2940 u8 flags; /* not used */
2941 __le16 reserved;
2942 s8 diff_gain_a; /* see above */
2943 s8 diff_gain_b;
2944 s8 diff_gain_c;
2945 u8 reserved1;
2946} __attribute__ ((packed));
2947
2948struct iwl_calib_chain_noise_reset_cmd {
2949 u8 op_code; /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
2949 u8 flags; /* not used */ 2950 u8 flags; /* not used */
2950 __le16 reserved; 2951 __le16 reserved;
2951} __attribute__ ((packed)); 2952} __attribute__ ((packed));
2952 2953
2953struct iwl5000_calibration_chain_noise_gain_cmd { 2954struct iwl_calib_chain_noise_gain_cmd {
2954 u8 op_code; /* IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ 2955 u8 op_code; /* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */
2955 u8 flags; /* not used */ 2956 u8 flags; /* not used */
2956 __le16 reserved; 2957 __le16 reserved;
2957 u8 delta_gain_1; 2958 u8 delta_gain_1;
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 2f871f0c5d36..f546b7edce17 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -690,6 +690,20 @@ struct statistics_general_data {
690 u32 beacon_energy_c; 690 u32 beacon_energy_c;
691}; 691};
692 692
693
694/*
695 * enum iwl_calib
696 * defines the order in which results of initial calibrations
697 * should be sent to the runtime uCode
698 */
699enum iwl_calib {
700 IWL_CALIB_XTAL,
701 IWL_CALIB_LO,
702 IWL_CALIB_TX_IQ,
703 IWL_CALIB_TX_IQ_PERD,
704 IWL_CALIB_MAX
705};
706
693/* Opaque calibration results */ 707/* Opaque calibration results */
694struct iwl_calib_result { 708struct iwl_calib_result {
695 void *buf; 709 void *buf;
@@ -756,7 +770,6 @@ enum {
756 770
757 771
758#define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ 772#define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */
759#define IWL_CALIB_MAX 4
760 773
761struct iwl_priv { 774struct iwl_priv {
762 775