aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-04-13 01:52:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-13 15:22:07 -0400
commit29bbfb2491316f9a3888e74b0de7fccdbde67aaa (patch)
tree9d5713e37d46cfae5618b0cd522b3ef0ee032630
parentce18f391aa872a910e7798c340b6cf22d02c77a2 (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>
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c32
-rw-r--r--drivers/net/wireless/ath/ath9k/wmi.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/wmi.h6
4 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index ec47be94b74f..9544cd7fd440 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -388,6 +388,9 @@ struct ath9k_htc_priv {
388 struct htc_target *htc; 388 struct htc_target *htc;
389 struct wmi *wmi; 389 struct wmi *wmi;
390 390
391 u16 fw_version_major;
392 u16 fw_version_minor;
393
391 enum htc_endpoint_id wmi_cmd_ep; 394 enum htc_endpoint_id wmi_cmd_ep;
392 enum htc_endpoint_id beacon_ep; 395 enum htc_endpoint_id beacon_ep;
393 enum htc_endpoint_id cab_ep; 396 enum htc_endpoint_id cab_ep;
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
785static 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
785static int ath9k_init_device(struct ath9k_htc_priv *priv, 811static 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:
861err_tx: 891err_tx:
862 /* Nothing */ 892 /* Nothing */
863err_regd: 893err_regd:
894 /* Nothing */
895err_fw:
864 ath9k_deinit_priv(priv); 896 ath9k_deinit_priv(priv);
865err_init: 897err_init:
866 return error; 898 return error;
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index d3d24904f62f..267a98fcf5f2 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -23,6 +23,8 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
23 return "WMI_ECHO_CMDID"; 23 return "WMI_ECHO_CMDID";
24 case WMI_ACCESS_MEMORY_CMDID: 24 case WMI_ACCESS_MEMORY_CMDID:
25 return "WMI_ACCESS_MEMORY_CMDID"; 25 return "WMI_ACCESS_MEMORY_CMDID";
26 case WMI_GET_FW_VERSION:
27 return "WMI_GET_FW_VERSION";
26 case WMI_DISABLE_INTR_CMDID: 28 case WMI_DISABLE_INTR_CMDID:
27 return "WMI_DISABLE_INTR_CMDID"; 29 return "WMI_DISABLE_INTR_CMDID";
28 case WMI_ENABLE_INTR_CMDID: 30 case WMI_ENABLE_INTR_CMDID:
diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/ath/ath9k/wmi.h
index 42084277522d..6a36572b6fb8 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.h
+++ b/drivers/net/wireless/ath/ath9k/wmi.h
@@ -31,11 +31,17 @@ struct wmi_cmd_hdr {
31 __be16 seq_no; 31 __be16 seq_no;
32} __packed; 32} __packed;
33 33
34struct wmi_fw_version {
35 __be16 major;
36 __be16 minor;
37
38} __packed;
34enum wmi_cmd_id { 39enum wmi_cmd_id {
35 WMI_ECHO_CMDID = 0x0001, 40 WMI_ECHO_CMDID = 0x0001,
36 WMI_ACCESS_MEMORY_CMDID, 41 WMI_ACCESS_MEMORY_CMDID,
37 42
38 /* Commands to Target */ 43 /* Commands to Target */
44 WMI_GET_FW_VERSION,
39 WMI_DISABLE_INTR_CMDID, 45 WMI_DISABLE_INTR_CMDID,
40 WMI_ENABLE_INTR_CMDID, 46 WMI_ENABLE_INTR_CMDID,
41 WMI_RX_LINK_CMDID, 47 WMI_RX_LINK_CMDID,