30 #include <linux/kernel.h>
49 static inline const struct fw_img *
61 static int iwl_set_Xtal_calib(
struct iwl_priv *priv)
72 static int iwl_set_temperature_offset_calib(
struct iwl_priv *priv)
79 if (!(
cmd.radio_sensor_offset))
87 static int iwl_set_temperature_offset_calib_v2(
struct iwl_priv *priv)
93 cmd.radio_sensor_offset_high = priv->
eeprom_data->kelvin_temperature;
95 if (!
cmd.radio_sensor_offset_low) {
112 static int iwl_send_calib_cfg(
struct iwl_priv *priv)
118 .
data = { &calib_cfg_cmd, },
121 memset(&calib_cfg_cmd, 0,
sizeof(calib_cfg_cmd));
125 calib_cfg_cmd.ucd_calib_cfg.flags =
135 if (priv->
cfg->bt_params &&
136 priv->
cfg->bt_params->advanced_bt_coexist) {
150 ret = iwl_send_calib_cfg(priv);
158 if (priv->
cfg->need_temp_offset_calib) {
159 if (priv->
cfg->temp_offset_v2)
160 return iwl_set_temperature_offset_calib_v2(priv);
162 return iwl_set_temperature_offset_calib(priv);
168 static int iwl_send_wimax_coex(
struct iwl_priv *priv)
173 memset(&coex_cmd, 0,
sizeof(coex_cmd));
177 sizeof(coex_cmd), &coex_cmd);
207 sizeof(iwl_bt_prio_tbl));
210 sizeof(prio_tbl_cmd), &prio_tbl_cmd))
211 IWL_ERR(priv,
"failed to send BT prio tbl command\n");
223 sizeof(env_cmd), &env_cmd);
225 IWL_ERR(priv,
"failed to send BT env command\n");
229 static const u8 iwlagn_default_queue_to_tx_fifo[] = {
236 static const u8 iwlagn_ipan_queue_to_tx_fifo[] = {
250 static int iwl_alive_notify(
struct iwl_priv *priv)
252 const u8 *queue_to_txf;
257 iwl_trans_fw_alive(priv->
trans);
261 n_queues =
ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo);
262 queue_to_txf = iwlagn_ipan_queue_to_tx_fifo;
264 n_queues =
ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo);
265 queue_to_txf = iwlagn_default_queue_to_tx_fifo;
268 for (i = 0; i < n_queues; i++)
270 iwl_trans_ac_txq_enable(priv->
trans, i,
276 ret = iwl_send_wimax_coex(priv);
280 if (!priv->
cfg->no_xtal_calib) {
281 ret = iwl_set_Xtal_calib(priv);
295 static int iwl_verify_sec_sparse(
struct iwl_priv *priv,
303 IWL_DEBUG_FW(priv,
"ucode inst image size is %u\n", len);
305 for (i = 0; i <
len; i += 100, image += 100/
sizeof(
u32)) {
319 static void iwl_print_mismatch_sec(
struct iwl_priv *priv,
320 const struct fw_desc *fw_desc)
328 IWL_DEBUG_FW(priv,
"ucode inst image size is %u\n", len);
335 offs +=
sizeof(
u32), image++) {
339 IWL_ERR(priv,
"uCode INST section at "
340 "offset 0x%x, is 0x%x, s/b 0x%x\n",
351 static int iwl_verify_ucode(
struct iwl_priv *priv,
354 const struct fw_img *img = iwl_get_ucode_image(priv, ucode_type);
357 IWL_ERR(priv,
"Invalid ucode requested (%d)\n", ucode_type);
366 IWL_ERR(priv,
"UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n");
385 palive = (
void *)pkt->
data;
387 IWL_DEBUG_FW(priv,
"Alive ucode status 0x%08X revision "
403 #define UCODE_ALIVE_TIMEOUT HZ
404 #define UCODE_CALIB_TIMEOUT (2*HZ)
418 fw = iwl_get_ucode_image(priv, ucode_type);
427 iwl_alive_fn, &alive_data);
429 ret = iwl_trans_start_fw(priv->
trans, fw);
447 if (!alive_data.
valid) {
448 IWL_ERR(priv,
"Loaded ucode is not valid!\n");
459 ret = iwl_verify_ucode(priv, ucode_type);
469 ret = iwl_alive_notify(priv);
472 "Could not complete ALIVE transition: %d\n", ret);
501 IWL_ERR(priv,
"Failed to record calibration data %d\n",
510 static const u8 calib_complete[] = {
527 iwlagn_wait_calib, priv);
553 iwl_trans_stop_device(priv->
trans);