From patchwork Mon Dec 1 14:45:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 5412991 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4FC35BEEA8 for ; Mon, 1 Dec 2014 14:45:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FD7A2028D for ; Mon, 1 Dec 2014 14:45:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 747B120274 for ; Mon, 1 Dec 2014 14:45:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XvSEb-0007ir-Cx; Mon, 01 Dec 2014 14:45:53 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XvSEZ-0007aB-DD for ath10k@lists.infradead.org; Mon, 01 Dec 2014 14:45:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1417445151; x=1448981151; h=subject:to:from:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=71x+HBcHeyqa2mGe6RknwZeNmsB23OuAu5M0uhVlSQM=; b=FGllG7Iq7+DZFp5+0hTDOtQeZmF1TFbPX3Y9TI6CADJ9BkKcy04fNKRe eRegd7ZEPsVICruFgksUo2HviSJDhrVL5c+KgFja0OIAFmaS4mecWXI5X 9eXCv7uKsy+Y6PJt2HVCR/a/UVQ274zoPTa7V9PKNNjMJQp1aYyyoO+ER Q=; X-IronPort-AV: E=McAfee;i="5600,1067,7638"; a="181936247" Received: from ironmsg01-lv.qualcomm.com ([10.47.202.180]) by wolverine02.qualcomm.com with ESMTP; 01 Dec 2014 06:45:30 -0800 X-IronPort-AV: E=Sophos;i="5.07,494,1413270000"; d="scan'208";a="31889102" Received: from nasanexm01g.na.qualcomm.com ([10.85.0.33]) by ironmsg01-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 01 Dec 2014 06:45:29 -0800 Received: from potku.adurom.net (10.80.80.8) by NASANEXM01G.na.qualcomm.com (10.85.0.33) with Microsoft SMTP Server (TLS) id 15.0.913.22; Mon, 1 Dec 2014 06:45:28 -0800 Subject: [PATCH v3 2/7] ath10k: add ATH10K_FW_IE_WMI_OP_VERSION To: From: Kalle Valo Date: Mon, 1 Dec 2014 16:45:07 +0200 Message-ID: <20141201144507.18248.9856.stgit@potku.adurom.net> In-Reply-To: <20141201144400.18248.62714.stgit@potku.adurom.net> References: <20141201144400.18248.62714.stgit@potku.adurom.net> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanexm01a.na.qualcomm.com (10.85.0.81) To NASANEXM01G.na.qualcomm.com (10.85.0.33) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141201_064551_539073_B416C6F5 X-CRM114-Status: GOOD ( 13.57 ) X-Spam-Score: -5.1 (-----) Cc: linux-wireless@vger.kernel.org X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of using feature flags, add new 32 bit variable for managing different WMI versions. This makes it firmware interface tests a bit less convoluted, especially when we add one more interface. Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/core.c | 30 +++++++++++++++++++++++++++--- drivers/net/wireless/ath/ath10k/core.h | 8 +++++--- drivers/net/wireless/ath/ath10k/hw.h | 10 ++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index bd6315952ad0..f8ddc8087db9 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -447,7 +447,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) int ie_id, i, index, bit, ret; struct ath10k_fw_ie *hdr; const u8 *data; - __le32 *timestamp; + __le32 *timestamp, *version; /* first fetch the firmware file (firmware-*.bin) */ ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name); @@ -562,6 +562,17 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) ar->otp_len = ie_len; break; + case ATH10K_FW_IE_WMI_OP_VERSION: + if (ie_len != sizeof(u32)) + break; + + version = (__le32 *)data; + + ar->wmi.op_version = le32_to_cpup(version); + + ath10k_dbg(ar, ATH10K_DBG_BOOT, "found fw ie wmi op version %d\n", + ar->wmi.op_version); + break; default: ath10k_warn(ar, "Unknown FW IE: %u\n", le32_to_cpu(hdr->id)); @@ -801,11 +812,24 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar) } if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) { - ar->max_num_peers = TARGET_10X_NUM_PEERS; - ar->max_num_stations = TARGET_10X_NUM_STATIONS; + if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features)) + ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_10_2; + else + ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_10_1; } else { + ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_MAIN; + } + + switch (ar->wmi.op_version) { + case ATH10K_FW_WMI_OP_VERSION_MAIN: ar->max_num_peers = TARGET_NUM_PEERS; ar->max_num_stations = TARGET_NUM_STATIONS; + break; + case ATH10K_FW_WMI_OP_VERSION_10_1: + case ATH10K_FW_WMI_OP_VERSION_10_2: + ar->max_num_peers = TARGET_10X_NUM_PEERS; + ar->max_num_stations = TARGET_10X_NUM_STATIONS; + break; } return 0; diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 514c219263a5..92b04fe73151 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -120,6 +120,7 @@ struct ath10k_mem_chunk { }; struct ath10k_wmi { + unsigned int op_version; enum ath10k_htc_ep_id eid; struct completion service_ready; struct completion unified_ready; @@ -369,7 +370,7 @@ enum ath10k_fw_features { /* wmi_mgmt_rx_hdr contains extra RSSI information */ ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0, - /* firmware from 10X branch */ + /* Firmware from 10X branch. Deprecated, don't use in new code. */ ATH10K_FW_FEATURE_WMI_10X = 1, /* firmware support tx frame management over WMI, otherwise it's HTT */ @@ -378,8 +379,9 @@ enum ath10k_fw_features { /* Firmware does not support P2P */ ATH10K_FW_FEATURE_NO_P2P = 3, - /* Firmware 10.2 feature bit. The ATH10K_FW_FEATURE_WMI_10X feature bit - * is required to be set as well. + /* Firmware 10.2 feature bit. The ATH10K_FW_FEATURE_WMI_10X feature + * bit is required to be set as well. Deprecated, don't use in new + * code. */ ATH10K_FW_FEATURE_WMI_10_2 = 4, diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index dfedfd0e0f34..04aaf9af3ca0 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -58,6 +58,16 @@ enum ath10k_fw_ie_type { ATH10K_FW_IE_FEATURES = 2, ATH10K_FW_IE_FW_IMAGE = 3, ATH10K_FW_IE_OTP_IMAGE = 4, + + /* WMI "operations" interface version, 32 bit value. Supported from + * FW API 4 and above. */ + ATH10K_FW_IE_WMI_OP_VERSION = 5, +}; + +enum ath10k_fw_wmi_op_version { + ATH10K_FW_WMI_OP_VERSION_MAIN = 0, + ATH10K_FW_WMI_OP_VERSION_10_1 = 1, + ATH10K_FW_WMI_OP_VERSION_10_2 = 2, }; /* Known pecularities: