diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-ucode.c')
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-ucode.c | 67 | 
1 files changed, 30 insertions, 37 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c index 97de5d9de67..06304a681ed 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c @@ -39,6 +39,7 @@  #include "iwl-agn-hw.h"  #include "iwl-agn.h"  #include "iwl-agn-calib.h" +#include "iwl-trans.h"  #define IWL_AC_UNSET -1 @@ -143,7 +144,7 @@ static int iwlagn_load_section(struct iwl_priv *priv, const char *name,  		FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE	|  		FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); -	IWL_DEBUG_INFO(priv, "%s uCode section being loaded...\n", name); +	IWL_DEBUG_FW(priv, "%s uCode section being loaded...\n", name);  	ret = wait_event_interruptible_timeout(priv->wait_command_queue,  					priv->ucode_write_complete, 5 * HZ);  	if (ret == -ERESTARTSYS) { @@ -183,10 +184,7 @@ static int iwlagn_set_Xtal_calib(struct iwl_priv *priv)  	__le16 *xtal_calib =  		(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_XTAL); -	cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; -	cmd.hdr.first_group = 0; -	cmd.hdr.groups_num = 1; -	cmd.hdr.data_valid = 1; +	iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD);  	cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);  	cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]);  	return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL], @@ -197,15 +195,14 @@ static int iwlagn_set_temperature_offset_calib(struct iwl_priv *priv)  {  	struct iwl_calib_temperature_offset_cmd cmd;  	__le16 *offset_calib = -		(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE); -	cmd.hdr.op_code = IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD; -	cmd.hdr.first_group = 0; -	cmd.hdr.groups_num = 1; -	cmd.hdr.data_valid = 1; +		(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_TEMPERATURE); + +	memset(&cmd, 0, sizeof(cmd)); +	iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);  	cmd.radio_sensor_offset = le16_to_cpu(offset_calib[1]);  	if (!(cmd.radio_sensor_offset))  		cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; -	cmd.reserved = 0; +  	IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n",  			cmd.radio_sensor_offset);  	return iwl_calib_set(&priv->calib_results[IWL_CALIB_TEMP_OFFSET], @@ -227,7 +224,7 @@ static int iwlagn_send_calib_cfg(struct iwl_priv *priv)  	calib_cfg_cmd.ucd_calib_cfg.once.send_res = IWL_CALIB_INIT_CFG_ALL;  	calib_cfg_cmd.ucd_calib_cfg.flags = IWL_CALIB_INIT_CFG_ALL; -	return iwl_send_cmd(priv, &cmd); +	return trans_send_cmd(priv, &cmd);  }  void iwlagn_rx_calib_result(struct iwl_priv *priv, @@ -325,7 +322,8 @@ static int iwlagn_send_wimax_coex(struct iwl_priv *priv)  		/* coexistence is disabled */  		memset(&coex_cmd, 0, sizeof(coex_cmd));  	} -	return iwl_send_cmd_pdu(priv, COEX_PRIORITY_TABLE_CMD, +	return trans_send_cmd_pdu(priv, +				COEX_PRIORITY_TABLE_CMD, CMD_SYNC,  				sizeof(coex_cmd), &coex_cmd);  } @@ -357,7 +355,8 @@ void iwlagn_send_prio_tbl(struct iwl_priv *priv)  	memcpy(prio_tbl_cmd.prio_tbl, iwlagn_bt_prio_tbl,  		sizeof(iwlagn_bt_prio_tbl)); -	if (iwl_send_cmd_pdu(priv, REPLY_BT_COEX_PRIO_TABLE, +	if (trans_send_cmd_pdu(priv, +				REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC,  				sizeof(prio_tbl_cmd), &prio_tbl_cmd))  		IWL_ERR(priv, "failed to send BT prio tbl command\n");  } @@ -369,7 +368,8 @@ int iwlagn_send_bt_env(struct iwl_priv *priv, u8 action, u8 type)  	env_cmd.action = action;  	env_cmd.type = type; -	ret = iwl_send_cmd_pdu(priv, REPLY_BT_COEX_PROT_ENV, +	ret = trans_send_cmd_pdu(priv, +			       REPLY_BT_COEX_PROT_ENV, CMD_SYNC,  			       sizeof(env_cmd), &env_cmd);  	if (ret)  		IWL_ERR(priv, "failed to send BT env command\n"); @@ -390,11 +390,13 @@ static int iwlagn_alive_notify(struct iwl_priv *priv)  	spin_lock_irqsave(&priv->lock, flags);  	priv->scd_base_addr = iwl_read_prph(priv, IWLAGN_SCD_SRAM_BASE_ADDR); -	a = priv->scd_base_addr + IWLAGN_SCD_CONTEXT_DATA_OFFSET; -	for (; a < priv->scd_base_addr + IWLAGN_SCD_TX_STTS_BITMAP_OFFSET; +	a = priv->scd_base_addr + IWLAGN_SCD_CONTEXT_MEM_LOWER_BOUND; +	/* reset conext data memory */ +	for (; a < priv->scd_base_addr + IWLAGN_SCD_CONTEXT_MEM_UPPER_BOUND;  		a += 4)  		iwl_write_targ_mem(priv, a, 0); -	for (; a < priv->scd_base_addr + IWLAGN_SCD_TRANSLATE_TBL_OFFSET; +	/* reset tx status memory */ +	for (; a < priv->scd_base_addr + IWLAGN_SCD_TX_STTS_MEM_UPPER_BOUND;  		a += 4)  		iwl_write_targ_mem(priv, a, 0);  	for (; a < priv->scd_base_addr + @@ -405,7 +407,7 @@ static int iwlagn_alive_notify(struct iwl_priv *priv)  		       priv->scd_bc_tbls.dma >> 10);  	/* Enable DMA channel */ -	for (chan = 0; chan < FH50_TCSR_CHNL_NUM ; chan++) +	for (chan = 0; chan < FH_TCSR_CHNL_NUM ; chan++)  		iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(chan),  				FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |  				FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); @@ -508,7 +510,7 @@ static int iwlcore_verify_inst_sparse(struct iwl_priv *priv,  	u32 val;  	u32 i; -	IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); +	IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);  	for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) {  		/* read data comes through single port, auto-incr addr */ @@ -533,7 +535,7 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv,  	u32 offs;  	int errors = 0; -	IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); +	IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);  	iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR,  			   IWLAGN_RTC_INST_LOWER_BOUND); @@ -559,7 +561,7 @@ static void iwl_print_mismatch_inst(struct iwl_priv *priv,  static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_img *img)  {  	if (!iwlcore_verify_inst_sparse(priv, &img->code)) { -		IWL_DEBUG_INFO(priv, "uCode is good in inst SRAM\n"); +		IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n");  		return 0;  	} @@ -583,7 +585,7 @@ static void iwlagn_alive_fn(struct iwl_priv *priv,  	palive = &pkt->u.alive_frame; -	IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " +	IWL_DEBUG_FW(priv, "Alive ucode status 0x%08X revision "  		       "0x%01X 0x%01X\n",  		       palive->is_valid, palive->ver_type,  		       palive->ver_subtype); @@ -602,12 +604,12 @@ static void iwlagn_alive_fn(struct iwl_priv *priv,  int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,  				 struct fw_img *image, -				 int subtype, int alternate_subtype) +				 enum iwlagn_ucode_type ucode_type)  {  	struct iwl_notification_wait alive_wait;  	struct iwlagn_alive_data alive_data;  	int ret; -	enum iwlagn_ucode_subtype old_type; +	enum iwlagn_ucode_type old_type;  	ret = iwlagn_start_device(priv);  	if (ret) @@ -617,7 +619,7 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,  				      iwlagn_alive_fn, &alive_data);  	old_type = priv->ucode_type; -	priv->ucode_type = subtype; +	priv->ucode_type = ucode_type;  	ret = iwlagn_load_given_ucode(priv, image);  	if (ret) { @@ -645,15 +647,6 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,  		return -EIO;  	} -	if (alive_data.subtype != subtype && -	    alive_data.subtype != alternate_subtype) { -		IWL_ERR(priv, -			"Loaded ucode is not expected type (got %d, expected %d)!\n", -			alive_data.subtype, subtype); -		priv->ucode_type = old_type; -		return -EIO; -	} -  	ret = iwl_verify_ucode(priv, image);  	if (ret) {  		priv->ucode_type = old_type; @@ -685,7 +678,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)  	if (!priv->ucode_init.code.len)  		return 0; -	if (priv->ucode_type != UCODE_SUBTYPE_NONE_LOADED) +	if (priv->ucode_type != IWL_UCODE_NONE)  		return 0;  	iwlagn_init_notification_wait(priv, &calib_wait, @@ -694,7 +687,7 @@ int iwlagn_run_init_ucode(struct iwl_priv *priv)  	/* Will also start the device */  	ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init, -					   UCODE_SUBTYPE_INIT, -1); +					   IWL_UCODE_INIT);  	if (ret)  		goto error;  |