Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 003353b0 authored by Kalle Valo's avatar Kalle Valo
Browse files

ath6kl: add testmode support



This is port from the staging version of ath6kl. The interface to user space
is exactly same.

Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 4495ab16
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,5 +33,6 @@ ath6kl-y += txrx.o
ath6kl-y += wmi.o
ath6kl-y += node.o
ath6kl-y += sdio.o
ath6kl-$(CONFIG_NL80211_TESTMODE) += testmode.o

ccflags-y += -D__CHECK_ENDIAN__
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "cfg80211.h"
#include "debug.h"
#include "hif-ops.h"
#include "testmode.h"

#define RATETAB_ENT(_rate, _rateid, _flags) {   \
	.bitrate    = (_rate),                  \
@@ -1907,6 +1908,7 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
	.set_pmksa = ath6kl_set_pmksa,
	.del_pmksa = ath6kl_del_pmksa,
	.flush_pmksa = ath6kl_flush_pmksa,
	CFG80211_TESTMODE_CMD(ath6kl_tm_cmd)
#ifdef CONFIG_PM
	.suspend = ar6k_cfg80211_suspend,
#endif
+8 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@
#define AR6003_REV2_PATCH_DOWNLOAD_ADDRESS  0x57e910
#define AR6003_REV2_OTP_FILE                "ath6k/AR6003/hw2.0/otp.bin.z77"
#define AR6003_REV2_FIRMWARE_FILE           "ath6k/AR6003/hw2.0/athwlan.bin.z77"
#define AR6003_REV2_TCMD_FIRMWARE_FILE      "ath6k/AR6003/hw2.0/athtcmd_ram.bin"
#define AR6003_REV2_PATCH_FILE              "ath6k/AR6003/hw2.0/data.patch.bin"
#define AR6003_REV2_BOARD_DATA_FILE         "ath6k/AR6003/hw2.0/bdata.bin"
#define AR6003_REV2_DEFAULT_BOARD_DATA_FILE "ath6k/AR6003/hw2.0/bdata.SD31.bin"
@@ -72,6 +73,7 @@
#define AR6003_REV3_VERSION                 0x30000582
#define AR6003_REV3_OTP_FILE                "ath6k/AR6003/hw2.1.1/otp.bin"
#define AR6003_REV3_FIRMWARE_FILE           "ath6k/AR6003/hw2.1.1/athwlan.bin"
#define AR6003_REV3_TCMD_FIRMWARE_FILE    "ath6k/AR6003/hw2.1.1/athtcmd_ram.bin"
#define AR6003_REV3_PATCH_FILE            "ath6k/AR6003/hw2.1.1/data.patch.bin"
#define AR6003_REV3_BOARD_DATA_FILE       "ath6k/AR6003/hw2.1.1/bdata.bin"
#define AR6003_REV3_DEFAULT_BOARD_DATA_FILE	\
@@ -358,6 +360,7 @@ struct ath6kl_req_key {
#define NETDEV_REGISTERED    10
#define SKIP_SCAN	     11
#define WLAN_ENABLED	     12
#define TESTMODE	     13

struct ath6kl {
	struct device *dev;
@@ -431,6 +434,11 @@ struct ath6kl {
#define AR_MCAST_FILTER_MAC_ADDR_SIZE  4
	u8 auto_auth_stage;

	struct {
		void *rx_report;
		size_t rx_report_len;
	} tm;

	u16 conf_flags;
	wait_queue_head_t event_wq;
	struct ath6kl_mbox_info mbox_info;
+26 −0
Original line number Diff line number Diff line
@@ -23,8 +23,10 @@
#include "hif-ops.h"

unsigned int debug_mask;
static unsigned int testmode;

module_param(debug_mask, uint, 0644);
module_param(testmode, uint, 0644);

/*
 * Include definitions here that can be used to tune the WLAN module
@@ -901,6 +903,28 @@ static int ath6kl_upload_firmware(struct ath6kl *ar)
	u32 address;
	int ret;

	if (testmode) {
		switch (ar->version.target_ver) {
		case AR6003_REV2_VERSION:
			filename = AR6003_REV2_TCMD_FIRMWARE_FILE;
			break;
		case AR6003_REV3_VERSION:
			filename = AR6003_REV3_TCMD_FIRMWARE_FILE;
			break;
		case AR6004_REV1_VERSION:
			ath6kl_warn("testmode not supported with ar6004\n");
			return -EOPNOTSUPP;
		default:
			ath6kl_warn("unknown target version: 0x%x\n",
				       ar->version.target_ver);
			return -EINVAL;
		}

		set_bit(TESTMODE, &ar->flag);

		goto get_fw;
	}

	switch (ar->version.target_ver) {
	case AR6003_REV2_VERSION:
		filename = AR6003_REV2_FIRMWARE_FILE;
@@ -913,6 +937,8 @@ static int ath6kl_upload_firmware(struct ath6kl *ar)
		break;
	}

get_fw:

	if (ar->fw == NULL) {
		ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len);
		if (ret) {
+3 −2
Original line number Diff line number Diff line
@@ -915,9 +915,10 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
	set_bit(WMI_READY, &ar->flag);
	wake_up(&ar->event_wq);

	ath6kl_info("hw %s fw %s\n",
	ath6kl_info("hw %s fw %s%s\n",
		    get_hw_id_string(ar->wdev->wiphy->hw_version),
		    ar->wdev->wiphy->fw_version);
		    ar->wdev->wiphy->fw_version,
		    test_bit(TESTMODE, &ar->flag) ? " testmode" : "");
}

void ath6kl_scan_complete_evt(struct ath6kl *ar, int status)
Loading