diff options
author | Sujith Manoharan <Sujith.Manoharan@atheros.com> | 2011-04-13 01:52:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-13 15:22:07 -0400 |
commit | 29bbfb2491316f9a3888e74b0de7fccdbde67aaa (patch) | |
tree | 9d5713e37d46cfae5618b0cd522b3ef0ee032630 /drivers/net/wireless/ath/ath9k/htc_drv_init.c | |
parent | ce18f391aa872a910e7798c340b6cf22d02c77a2 (diff) |
ath9k_htc: Add a WMI command to get the firmware version
Also, update the wiphy information and use the correct
device pointer when registering. This would fix ethtool.
Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/htc_drv_init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_init.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 8303b34bdc90..6bbfca58deda 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -782,6 +782,32 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv, | |||
782 | SET_IEEE80211_PERM_ADDR(hw, common->macaddr); | 782 | SET_IEEE80211_PERM_ADDR(hw, common->macaddr); |
783 | } | 783 | } |
784 | 784 | ||
785 | static int ath9k_init_firmware_version(struct ath9k_htc_priv *priv) | ||
786 | { | ||
787 | struct ieee80211_hw *hw = priv->hw; | ||
788 | struct wmi_fw_version cmd_rsp; | ||
789 | int ret; | ||
790 | |||
791 | memset(&cmd_rsp, 0, sizeof(cmd_rsp)); | ||
792 | |||
793 | WMI_CMD(WMI_GET_FW_VERSION); | ||
794 | if (ret) | ||
795 | return -EINVAL; | ||
796 | |||
797 | priv->fw_version_major = be16_to_cpu(cmd_rsp.major); | ||
798 | priv->fw_version_minor = be16_to_cpu(cmd_rsp.minor); | ||
799 | |||
800 | snprintf(hw->wiphy->fw_version, ETHTOOL_BUSINFO_LEN, "%d.%d", | ||
801 | priv->fw_version_major, | ||
802 | priv->fw_version_minor); | ||
803 | |||
804 | dev_info(priv->dev, "ath9k_htc: FW Version: %d.%d\n", | ||
805 | priv->fw_version_major, | ||
806 | priv->fw_version_minor); | ||
807 | |||
808 | return 0; | ||
809 | } | ||
810 | |||
785 | static int ath9k_init_device(struct ath9k_htc_priv *priv, | 811 | static int ath9k_init_device(struct ath9k_htc_priv *priv, |
786 | u16 devid, char *product, u32 drv_info) | 812 | u16 devid, char *product, u32 drv_info) |
787 | { | 813 | { |
@@ -801,6 +827,10 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv, | |||
801 | common = ath9k_hw_common(ah); | 827 | common = ath9k_hw_common(ah); |
802 | ath9k_set_hw_capab(priv, hw); | 828 | ath9k_set_hw_capab(priv, hw); |
803 | 829 | ||
830 | error = ath9k_init_firmware_version(priv); | ||
831 | if (error != 0) | ||
832 | goto err_fw; | ||
833 | |||
804 | /* Initialize regulatory */ | 834 | /* Initialize regulatory */ |
805 | error = ath_regd_init(&common->regulatory, priv->hw->wiphy, | 835 | error = ath_regd_init(&common->regulatory, priv->hw->wiphy, |
806 | ath9k_reg_notifier); | 836 | ath9k_reg_notifier); |
@@ -861,6 +891,8 @@ err_rx: | |||
861 | err_tx: | 891 | err_tx: |
862 | /* Nothing */ | 892 | /* Nothing */ |
863 | err_regd: | 893 | err_regd: |
894 | /* Nothing */ | ||
895 | err_fw: | ||
864 | ath9k_deinit_priv(priv); | 896 | ath9k_deinit_priv(priv); |
865 | err_init: | 897 | err_init: |
866 | return error; | 898 | return error; |