Commit 29bbfb24 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

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: default avatarSujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ce18f391
...@@ -388,6 +388,9 @@ struct ath9k_htc_priv { ...@@ -388,6 +388,9 @@ struct ath9k_htc_priv {
struct htc_target *htc; struct htc_target *htc;
struct wmi *wmi; struct wmi *wmi;
u16 fw_version_major;
u16 fw_version_minor;
enum htc_endpoint_id wmi_cmd_ep; enum htc_endpoint_id wmi_cmd_ep;
enum htc_endpoint_id beacon_ep; enum htc_endpoint_id beacon_ep;
enum htc_endpoint_id cab_ep; enum htc_endpoint_id cab_ep;
......
...@@ -782,6 +782,32 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv, ...@@ -782,6 +782,32 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
SET_IEEE80211_PERM_ADDR(hw, common->macaddr); SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
} }
static int ath9k_init_firmware_version(struct ath9k_htc_priv *priv)
{
struct ieee80211_hw *hw = priv->hw;
struct wmi_fw_version cmd_rsp;
int ret;
memset(&cmd_rsp, 0, sizeof(cmd_rsp));
WMI_CMD(WMI_GET_FW_VERSION);
if (ret)
return -EINVAL;
priv->fw_version_major = be16_to_cpu(cmd_rsp.major);
priv->fw_version_minor = be16_to_cpu(cmd_rsp.minor);
snprintf(hw->wiphy->fw_version, ETHTOOL_BUSINFO_LEN, "%d.%d",
priv->fw_version_major,
priv->fw_version_minor);
dev_info(priv->dev, "ath9k_htc: FW Version: %d.%d\n",
priv->fw_version_major,
priv->fw_version_minor);
return 0;
}
static int ath9k_init_device(struct ath9k_htc_priv *priv, static int ath9k_init_device(struct ath9k_htc_priv *priv,
u16 devid, char *product, u32 drv_info) u16 devid, char *product, u32 drv_info)
{ {
...@@ -801,6 +827,10 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv, ...@@ -801,6 +827,10 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv,
common = ath9k_hw_common(ah); common = ath9k_hw_common(ah);
ath9k_set_hw_capab(priv, hw); ath9k_set_hw_capab(priv, hw);
error = ath9k_init_firmware_version(priv);
if (error != 0)
goto err_fw;
/* Initialize regulatory */ /* Initialize regulatory */
error = ath_regd_init(&common->regulatory, priv->hw->wiphy, error = ath_regd_init(&common->regulatory, priv->hw->wiphy,
ath9k_reg_notifier); ath9k_reg_notifier);
...@@ -861,6 +891,8 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv, ...@@ -861,6 +891,8 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv,
err_tx: err_tx:
/* Nothing */ /* Nothing */
err_regd: err_regd:
/* Nothing */
err_fw:
ath9k_deinit_priv(priv); ath9k_deinit_priv(priv);
err_init: err_init:
return error; return error;
......
...@@ -23,6 +23,8 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd) ...@@ -23,6 +23,8 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
return "WMI_ECHO_CMDID"; return "WMI_ECHO_CMDID";
case WMI_ACCESS_MEMORY_CMDID: case WMI_ACCESS_MEMORY_CMDID:
return "WMI_ACCESS_MEMORY_CMDID"; return "WMI_ACCESS_MEMORY_CMDID";
case WMI_GET_FW_VERSION:
return "WMI_GET_FW_VERSION";
case WMI_DISABLE_INTR_CMDID: case WMI_DISABLE_INTR_CMDID:
return "WMI_DISABLE_INTR_CMDID"; return "WMI_DISABLE_INTR_CMDID";
case WMI_ENABLE_INTR_CMDID: case WMI_ENABLE_INTR_CMDID:
......
...@@ -31,11 +31,17 @@ struct wmi_cmd_hdr { ...@@ -31,11 +31,17 @@ struct wmi_cmd_hdr {
__be16 seq_no; __be16 seq_no;
} __packed; } __packed;
struct wmi_fw_version {
__be16 major;
__be16 minor;
} __packed;
enum wmi_cmd_id { enum wmi_cmd_id {
WMI_ECHO_CMDID = 0x0001, WMI_ECHO_CMDID = 0x0001,
WMI_ACCESS_MEMORY_CMDID, WMI_ACCESS_MEMORY_CMDID,
/* Commands to Target */ /* Commands to Target */
WMI_GET_FW_VERSION,
WMI_DISABLE_INTR_CMDID, WMI_DISABLE_INTR_CMDID,
WMI_ENABLE_INTR_CMDID, WMI_ENABLE_INTR_CMDID,
WMI_RX_LINK_CMDID, WMI_RX_LINK_CMDID,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment