diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2012-01-08 09:33:58 -0500 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2012-02-02 17:36:58 -0500 |
commit | cf6142975bcbb731bc131ee9d2a68b7561076545 (patch) | |
tree | 7cec34553e1d121f0ae601cc603e33007ccd8269 /drivers/net/wireless/iwlwifi/iwl-ucode.c | |
parent | d48e2074e240192e8a0396e1ae0082dd0e78aa8e (diff) |
iwlwifi: consolidate the start_device flow
Now there is only one transport function that launch a specific fw:
trans_ops->start_fw. This one replaces trans_ops->start_device and
trans_ops->kick_nic. The code that actually loads the fw to the
device has been moved to the transport specific code.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-ucode.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-ucode.c | 87 |
1 files changed, 6 insertions, 81 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c index 793524a3ed70..87ce587d7d57 100644 --- a/drivers/net/wireless/iwlwifi/iwl-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c | |||
@@ -120,58 +120,6 @@ int iwl_alloc_fw_desc(struct iwl_trans *trans, struct fw_desc *desc, | |||
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
122 | 122 | ||
123 | /* | ||
124 | * ucode | ||
125 | */ | ||
126 | static int iwl_load_section(struct iwl_trans *trans, const char *name, | ||
127 | struct fw_desc *image, u32 dst_addr) | ||
128 | { | ||
129 | dma_addr_t phy_addr = image->p_addr; | ||
130 | u32 byte_cnt = image->len; | ||
131 | int ret; | ||
132 | |||
133 | trans->ucode_write_complete = 0; | ||
134 | |||
135 | iwl_write_direct32(trans, | ||
136 | FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), | ||
137 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE); | ||
138 | |||
139 | iwl_write_direct32(trans, | ||
140 | FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr); | ||
141 | |||
142 | iwl_write_direct32(trans, | ||
143 | FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), | ||
144 | phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); | ||
145 | |||
146 | iwl_write_direct32(trans, | ||
147 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), | ||
148 | (iwl_get_dma_hi_addr(phy_addr) | ||
149 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); | ||
150 | |||
151 | iwl_write_direct32(trans, | ||
152 | FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), | ||
153 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | | ||
154 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX | | ||
155 | FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID); | ||
156 | |||
157 | iwl_write_direct32(trans, | ||
158 | FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), | ||
159 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | | ||
160 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | | ||
161 | FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); | ||
162 | |||
163 | IWL_DEBUG_FW(trans, "%s uCode section being loaded...\n", name); | ||
164 | ret = wait_event_timeout(trans->shrd->wait_command_queue, | ||
165 | trans->ucode_write_complete, 5 * HZ); | ||
166 | if (!ret) { | ||
167 | IWL_ERR(trans, "Could not load the %s uCode section\n", | ||
168 | name); | ||
169 | return -ETIMEDOUT; | ||
170 | } | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, | 123 | static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, |
176 | enum iwl_ucode_type ucode_type) | 124 | enum iwl_ucode_type ucode_type) |
177 | { | 125 | { |
@@ -188,28 +136,6 @@ static inline struct fw_img *iwl_get_ucode_image(struct iwl_trans *trans, | |||
188 | return NULL; | 136 | return NULL; |
189 | } | 137 | } |
190 | 138 | ||
191 | static int iwl_load_given_ucode(struct iwl_trans *trans, | ||
192 | enum iwl_ucode_type ucode_type) | ||
193 | { | ||
194 | int ret = 0; | ||
195 | struct fw_img *image = iwl_get_ucode_image(trans, ucode_type); | ||
196 | |||
197 | |||
198 | if (!image) { | ||
199 | IWL_ERR(trans, "Invalid ucode requested (%d)\n", | ||
200 | ucode_type); | ||
201 | return -EINVAL; | ||
202 | } | ||
203 | |||
204 | ret = iwl_load_section(trans, "INST", &image->code, | ||
205 | IWLAGN_RTC_INST_LOWER_BOUND); | ||
206 | if (ret) | ||
207 | return ret; | ||
208 | |||
209 | return iwl_load_section(trans, "DATA", &image->data, | ||
210 | IWLAGN_RTC_DATA_LOWER_BOUND); | ||
211 | } | ||
212 | |||
213 | /* | 139 | /* |
214 | * Calibration | 140 | * Calibration |
215 | */ | 141 | */ |
@@ -646,28 +572,27 @@ int iwl_load_ucode_wait_alive(struct iwl_trans *trans, | |||
646 | { | 572 | { |
647 | struct iwl_notification_wait alive_wait; | 573 | struct iwl_notification_wait alive_wait; |
648 | struct iwl_alive_data alive_data; | 574 | struct iwl_alive_data alive_data; |
575 | struct fw_img *fw; | ||
649 | int ret; | 576 | int ret; |
650 | enum iwl_ucode_type old_type; | 577 | enum iwl_ucode_type old_type; |
651 | 578 | ||
652 | ret = iwl_trans_start_device(trans); | ||
653 | if (ret) | ||
654 | return ret; | ||
655 | |||
656 | iwl_init_notification_wait(trans->shrd, &alive_wait, REPLY_ALIVE, | 579 | iwl_init_notification_wait(trans->shrd, &alive_wait, REPLY_ALIVE, |
657 | iwl_alive_fn, &alive_data); | 580 | iwl_alive_fn, &alive_data); |
658 | 581 | ||
659 | old_type = trans->shrd->ucode_type; | 582 | old_type = trans->shrd->ucode_type; |
660 | trans->shrd->ucode_type = ucode_type; | 583 | trans->shrd->ucode_type = ucode_type; |
584 | fw = iwl_get_ucode_image(trans, ucode_type); | ||
661 | 585 | ||
662 | ret = iwl_load_given_ucode(trans, ucode_type); | 586 | if (!fw) |
587 | return -EINVAL; | ||
588 | |||
589 | ret = iwl_trans_start_fw(trans, fw); | ||
663 | if (ret) { | 590 | if (ret) { |
664 | trans->shrd->ucode_type = old_type; | 591 | trans->shrd->ucode_type = old_type; |
665 | iwl_remove_notification(trans->shrd, &alive_wait); | 592 | iwl_remove_notification(trans->shrd, &alive_wait); |
666 | return ret; | 593 | return ret; |
667 | } | 594 | } |
668 | 595 | ||
669 | iwl_trans_kick_nic(trans); | ||
670 | |||
671 | /* | 596 | /* |
672 | * Some things may run in the background now, but we | 597 | * Some things may run in the background now, but we |
673 | * just wait for the ALIVE notification here. | 598 | * just wait for the ALIVE notification here. |