* [PATCH 1/2] ath6kl: export firmware version to user space
2011-06-13 9:08 [PATCH 0/2] ath6kl: testmode and fw version for 3.1 Kalle Valo
@ 2011-06-13 9:08 ` Kalle Valo
2011-06-13 9:08 ` [PATCH 2/2] ath6kl: testmode support Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2011-06-13 9:08 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless
cfg80211 exports wiphy->fw_version to user space via ethtool interface.
The obligatory screenshot:
$ sudo ethtool -i wlan0
driver: ath6kl_hifdev
version: 2.6.39-rc4+
firmware-version: 3:1:1:149
bus-info: mmc0:0001:1
$
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/staging/ath6kl/os/linux/ar6000_drv.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index aa97efc..499b7a9 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -4133,6 +4133,13 @@ ar6000_ready_event(void *devt, u8 *datap, u8 phyCap, u32 sw_ver, u32 abi_ver)
ar->arVersion.wlan_ver = sw_ver;
ar->arVersion.abi_ver = abi_ver;
+ snprintf(ar->wdev->wiphy->fw_version, sizeof(ar->wdev->wiphy->fw_version),
+ "%u:%u:%u:%u",
+ (ar->arVersion.wlan_ver & 0xf0000000) >> 28,
+ (ar->arVersion.wlan_ver & 0x0f000000) >> 24,
+ (ar->arVersion.wlan_ver & 0x00ff0000) >> 16,
+ (ar->arVersion.wlan_ver & 0x0000ffff));
+
/* Indicate to the waiting thread that the ready event was received */
ar->arWmiReady = true;
wake_up(&arEvent);
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] ath6kl: testmode support
2011-06-13 9:08 [PATCH 0/2] ath6kl: testmode and fw version for 3.1 Kalle Valo
2011-06-13 9:08 ` [PATCH 1/2] ath6kl: export firmware version to user space Kalle Valo
@ 2011-06-13 9:08 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2011-06-13 9:08 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-wireless
Add testmode support for running low level hardware tests. The testmode
is enabled by setting testmode module parameter to 1.
For now only a simple command passing is supported. More advanced
support will be implemented later.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/staging/ath6kl/os/linux/cfg80211.c | 58 ++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/ath6kl/os/linux/cfg80211.c b/drivers/staging/ath6kl/os/linux/cfg80211.c
index 32e3197..b098c22 100644
--- a/drivers/staging/ath6kl/os/linux/cfg80211.c
+++ b/drivers/staging/ath6kl/os/linux/cfg80211.c
@@ -24,6 +24,7 @@
#include <linux/wireless.h>
#include <linux/ieee80211.h>
#include <net/cfg80211.h>
+#include <net/netlink.h>
#include "ar6000_drv.h"
@@ -1458,6 +1459,62 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
return 0;
}
+#ifdef CONFIG_NL80211_TESTMODE
+enum ar6k_testmode_attr {
+ __AR6K_TM_ATTR_INVALID = 0,
+ AR6K_TM_ATTR_CMD = 1,
+ AR6K_TM_ATTR_DATA = 2,
+
+ /* keep last */
+ __AR6K_TM_ATTR_AFTER_LAST,
+ AR6K_TM_ATTR_MAX = __AR6K_TM_ATTR_AFTER_LAST - 1
+};
+
+enum ar6k_testmode_cmd {
+ AR6K_TM_CMD_TCMD = 0,
+};
+
+#define AR6K_TM_DATA_MAX_LEN 5000
+
+static const struct nla_policy ar6k_testmode_policy[AR6K_TM_ATTR_MAX + 1] = {
+ [AR6K_TM_ATTR_CMD] = { .type = NLA_U32 },
+ [AR6K_TM_ATTR_DATA] = { .type = NLA_BINARY,
+ .len = AR6K_TM_DATA_MAX_LEN },
+};
+
+static int ar6k_testmode_cmd(struct wiphy *wiphy, void *data, int len)
+{
+ struct ar6_softc *ar = wiphy_priv(wiphy);
+ struct nlattr *tb[AR6K_TM_ATTR_MAX + 1];
+ int err, buf_len;
+ void *buf;
+
+ err = nla_parse(tb, AR6K_TM_ATTR_MAX, data, len,
+ ar6k_testmode_policy);
+ if (err)
+ return err;
+
+ if (!tb[AR6K_TM_ATTR_CMD])
+ return -EINVAL;
+
+ switch (nla_get_u32(tb[AR6K_TM_ATTR_CMD])) {
+ case AR6K_TM_CMD_TCMD:
+ if (!tb[AR6K_TM_ATTR_DATA])
+ return -EINVAL;
+
+ buf = nla_data(tb[AR6K_TM_ATTR_DATA]);
+ buf_len = nla_len(tb[AR6K_TM_ATTR_DATA]);
+
+ wmi_test_cmd(ar->arWmi, buf, buf_len);
+
+ return 0;
+
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+#endif
static const
u32 cipher_suites[] = {
@@ -1633,6 +1690,7 @@ cfg80211_ops ar6k_cfg80211_ops = {
.join_ibss = ar6k_cfg80211_join_ibss,
.leave_ibss = ar6k_cfg80211_leave_ibss,
.get_station = ar6k_get_station,
+ CFG80211_TESTMODE_CMD(ar6k_testmode_cmd)
};
struct wireless_dev *
^ permalink raw reply related [flat|nested] 3+ messages in thread