summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl/init.c
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2011-10-30 21:16:15 +0200
committerKalle Valo <kvalo@qca.qualcomm.com>2011-11-11 12:58:59 +0200
commit5fe4dffbc12b22507d2416667720cbd4b27c693b (patch)
tree4504c6eb6420b663227884c7f71dda66027a3e0f /drivers/net/wireless/ath/ath6kl/init.c
parent32a07e4448f78158a75f7c1f0056289647d83946 (diff)
ath6kl: power down hardware when interface is down
The benefit from this is that user space can control hardware's power state by putting interface up and down. This is handy if firmware gets to some weird state. The downside will be that putting interface up takes a bit longer, I was measuring ~500 ms during interface up. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/init.c')
-rw-r--r--drivers/net/wireless/ath/ath6kl/init.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 2ee6a5eced6..237b73c6f42 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1421,11 +1421,13 @@ static int ath6kl_init_hw_params(struct ath6kl *ar)
return 0;
}
-static int ath6kl_hw_start(struct ath6kl *ar)
+int ath6kl_init_hw_start(struct ath6kl *ar)
{
long timeleft;
int ret, i;
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "hw start\n");
+
ret = ath6kl_hif_power_on(ar);
if (ret)
return ret;
@@ -1517,6 +1519,25 @@ err_power_off:
return ret;
}
+int ath6kl_init_hw_stop(struct ath6kl *ar)
+{
+ int ret;
+
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "hw stop\n");
+
+ ath6kl_htc_stop(ar->htc_target);
+
+ ath6kl_hif_stop(ar);
+
+ ath6kl_bmi_reset(ar);
+
+ ret = ath6kl_hif_power_off(ar);
+ if (ret)
+ ath6kl_warn("failed to power off hif: %d\n", ret);
+
+ return 0;
+}
+
int ath6kl_core_init(struct ath6kl *ar)
{
struct ath6kl_bmi_target_info targ_info;
@@ -1629,9 +1650,11 @@ int ath6kl_core_init(struct ath6kl *ar)
ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM |
WIPHY_FLAG_HAVE_AP_SME;
- ret = ath6kl_hw_start(ar);
+ set_bit(FIRST_BOOT, &ar->flag);
+
+ ret = ath6kl_init_hw_start(ar);
if (ret) {
- ath6kl_err("Failed to boot hardware: %d\n", ret);
+ ath6kl_err("Failed to start hardware: %d\n", ret);
goto err_rxbuf_cleanup;
}
@@ -1641,6 +1664,12 @@ int ath6kl_core_init(struct ath6kl *ar)
*/
memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);
+ ret = ath6kl_init_hw_stop(ar);
+ if (ret) {
+ ath6kl_err("Failed to stop hardware: %d\n", ret);
+ goto err_htc_cleanup;
+ }
+
return ret;
err_rxbuf_cleanup: