-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: Add WiFi instructions and files
Signed-off-by: Lee Jones <lee.jones@linaro.org>
- Loading branch information
Lee Jones
committed
Aug 28, 2019
1 parent
50f9340
commit 6390943
Showing
21 changed files
with
1,397 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
1. Build a WiFi enabled kernel | ||
|
||
1.1 Fetch and apply 2 ath10k patches to a supported kernel | ||
|
||
**Note:** You can find a supported kernel [HERE](https://github.com/aarch64-laptops/linux/tree/gpu) | ||
|
||
``` | ||
$ wget https://lore.kernel.org/lkml/20190725063108.15790-1-bjorn.andersson@linaro.org/raw -O patch1.mbox | ||
$ wget https://lore.kernel.org/linux-arm-msm/20190725174755.23432-2-bjorn.andersson@linaro.org/raw -O patch2.mbox | ||
$ git am patch1.mbox | ||
$ git am patch2.mbox | ||
``` | ||
|
||
1.1. Build a *.deb to install | ||
|
||
**Note:** This are the commands to cross-compile. Compiling natively will work equally well. | ||
|
||
``` | ||
$ ccache make -j $(nproc) \ | ||
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \ | ||
KBUILD_OUTPUT=../build-arm64 \ | ||
dtbs | ||
$ ccache make -j $(nproc) \ | ||
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \ | ||
KBUILD_OUTPUT=../build-arm64 | ||
$ ccache make -j $(nproc) \ | ||
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \ | ||
KBUILD_OUTPUT=../build-arm64 \ | ||
bindeb-pkg | ||
``` | ||
|
||
This will result in a linux-image-*.deb in the parent directory that you can install with `dpkg -i`. | ||
|
||
2. Clone build and install the required userspace projects (on the device) | ||
|
||
``` | ||
$ sudo apt install git build-essential libudev-dev | ||
$ git clone https://github.com/andersson/qrtr.git | ||
$ git clone https://github.com/andersson/rmtfs.git | ||
$ git clone https://github.com/andersson/pd-mapper.git | ||
$ git clone https://github.com/andersson/tqftpserv.git | ||
$ pushd qrtr && make && sudo make install && popd | ||
$ pushd rmtfs && make && sudo make install && popd | ||
$ pushd pd-mapper && make && sudo make install && popd | ||
$ pushd tqftpserv && make && sudo make install && popd | ||
``` | ||
|
||
3. Fetch firmware-5.bin from kvalo/ath10k-firmware GitHub repo | ||
|
||
``` | ||
$ wget https://github.com/kvalo/ath10k-firmware/blob/master/WCN3990/hw1.0/HL2.0/WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1/firmware-5.bin | ||
``` | ||
|
||
4. Fetch required files from Windows (use search) | ||
|
||
bdwlan.b36 | ||
bdwlan.b37 | ||
bdwlan.b38 | ||
bdwlan.b3c | ||
bdwlan.b3f | ||
bdwlan.bin | ||
wlanmdsp.mbn | ||
qcdsp1v2850.mbn | ||
qcdsp2850.mbn | ||
|
||
5. Place wlanmdsp.mbn in the TFTP directory | ||
|
||
``` | ||
$ sudo mkdir -p /readonly/firmware/image | ||
$ sudo cp wlanmdsp.mbn /readonly/firmware/image | ||
``` | ||
|
||
6. Create board-2.bin | ||
|
||
6.1. Create required directory structure and cd into it | ||
|
||
``` | ||
$ mkdir -p creating-board-2.bin/bdf | ||
$ cd creating-board-2.bin | ||
``` | ||
|
||
6.2. Place bdwlan.* files into creating-board-2.bin/bdf | ||
|
||
``` | ||
$ cp bdwlan.* creating-board-2.bin/bdf | ||
``` | ||
|
||
6.3. Obtain helper script, make it executable and run it | ||
|
||
``` | ||
$ wget https://github.com/aarch64-laptops/build/blob/master/misc/lenovo-yoga-c630/wifi/create-board-2.bin/make-board-2.bin.sh | ||
$ chmod +x make-board-2.bin.sh | ||
$ ./make-board-2.bin.sh | ||
``` | ||
|
||
7. Copy firmwares into final location(s) (on the device) | ||
|
||
``` | ||
$ sudo mkdir -p /lib/firmware/ath10k/WCN3990/hw1.0 | ||
$ sudo cp board-2.bin /lib/firmware/ath10k/WCN3990/hw1.0 | ||
$ sudo cp firmware-5.bin /lib/firmware/ath10k/WCN3990/hw1.0 | ||
$ sudo mkdir /lib/firmware/qcom/c630 | ||
$ sudo cp qcdsp1v2850.mbn /lib/firmware/qcom/c630 | ||
$ sudo cp qcdsp2850.mbn /lib/firmware/qcom/c630/modem.mdt | ||
$ sudo cp wlanmdsp.mbn /lib/firmware/qcom/c630 | ||
``` | ||
|
||
8. Start the services | ||
|
||
``` | ||
$ sudo systemctrl start qrtr-ns | ||
$ sudo systemctrl start pd-mapper | ||
$ sudo systemctrl start tqftpserv | ||
$ sudo systemctrl start rmtfs | ||
``` | ||
|
||
9. Check running services (around 40 should be present) | ||
|
||
``` | ||
$ qrtr-lookup | ||
``` | ||
|
||
10. To enable services on automatically at boot time | ||
|
||
``` | ||
$ sudo systemctrl enable qrtr-ns | ||
$ sudo systemctrl enable pd-mapper | ||
$ sudo systemctrl enable tqftpserv | ||
$ sudo systemctrl enable rmtfs | ||
``` |
248 changes: 248 additions & 0 deletions
248
misc/lenovo-yoga-c630/wifi/ath10k-Fix-HOST-capability-QMI-incompatibility.mbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,248 @@ | ||
From mboxrd@z Thu Jan 1 00:00:00 1970 | ||
Return-Path: <SRS0=6YJq=VW=vger.kernel.org=linux-kernel-owner@kernel.org> | ||
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on | ||
aws-us-west-2-korg-lkml-1.web.codeaurora.org | ||
X-Spam-Level: | ||
X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, | ||
DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, | ||
SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable | ||
autolearn_force=no version=3.4.0 | ||
Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) | ||
by smtp.lore.kernel.org (Postfix) with ESMTP id 2CD2CC76194 | ||
for <linux-kernel@archiver.kernel.org>; Thu, 25 Jul 2019 06:31:15 +0000 (UTC) | ||
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) | ||
by mail.kernel.org (Postfix) with ESMTP id E81BA217D4 | ||
for <linux-kernel@archiver.kernel.org>; Thu, 25 Jul 2019 06:31:14 +0000 (UTC) | ||
Authentication-Results: mail.kernel.org; | ||
dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lDvH4bOZ" | ||
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand | ||
id S1728927AbfGYGbN (ORCPT | ||
<rfc822;linux-kernel@archiver.kernel.org>); | ||
Thu, 25 Jul 2019 02:31:13 -0400 | ||
Received: from mail-pl1-f194.google.com ([209.85.214.194]:33611 "EHLO | ||
mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org | ||
with ESMTP id S1728557AbfGYGbN (ORCPT | ||
<rfc822;linux-kernel@vger.kernel.org>); | ||
Thu, 25 Jul 2019 02:31:13 -0400 | ||
Received: by mail-pl1-f194.google.com with SMTP id c14so22933440plo.0 | ||
for <linux-kernel@vger.kernel.org>; Wed, 24 Jul 2019 23:31:12 -0700 (PDT) | ||
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; | ||
d=linaro.org; s=google; | ||
h=from:to:cc:subject:date:message-id; | ||
bh=8XFmRxjQUZHfVuRq3opWFethuoNp09CnP8B4IXsgP2g=; | ||
b=lDvH4bOZdi3rf06kd04Z6/z7aZTM9n3BDjMG1P4MiI9U2bq4ihnjOdRiMDojZC3cdQ | ||
wQVDtkyW1W70wY/r0o/WnUlce5m9eCRRyGMdpQ4C2L0z/2p2CMuMdijk7f2tAaaJa6MO | ||
Di5KFe+egyDw/zmlP597M+we8ZV9NleQEAOlCUnTEEEuClbE37sd0XDyZy/6kzhu15IE | ||
rB+OziPI0jqEn9heW52ZFS9rJC/mc8iS9f/OPH+vLM/DQVuniiQGxBZpcCSszPNt8CZc | ||
QF943y7g3Cn55w26SgFH4CQGfT0pPyz2G9P4yZ+5x+2pbuhPDtDJRrqtxFuQ+BYDAZWf | ||
iiCg== | ||
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; | ||
d=1e100.net; s=20161025; | ||
h=x-gm-message-state:from:to:cc:subject:date:message-id; | ||
bh=8XFmRxjQUZHfVuRq3opWFethuoNp09CnP8B4IXsgP2g=; | ||
b=T2fSoOWesfbxYE/w3r4G22Jr9DycOTA/vQKDKzuP3lsshfgvOnpo8oOY97qMr7E7qC | ||
zTxE41ina6ND+pPEu0OFGNC+1L+yIVDtT/Q6xzm+bpIOv7Mcd+NwBS52hl1X97jpAJHC | ||
OeNe4S4Hg26zlUsFaljOr2rIhhR9wZpxrZ6TOnt2Epm7nWcTI00Emtow32hdWpe2bZbq | ||
s56opvBUcjRKt0kr4oE4rqONDRG4PVd3aIBCnhskB/v6AKQRTelwgG5LW1AgFN1b9iYA | ||
+2fJIz+MC/6+RG1aj6GwKstjV1cUsBAkvBubUB87m1b6V4VbOZ36LLjJDVXIvg4ZAz1+ | ||
0hBw== | ||
X-Gm-Message-State: APjAAAVtqLb9hFpJQPYhkaOzSXXZvoJl+oc7yLHotJRD2ox+rMBf2Vx4 | ||
MJDSSskevrYlrlbSJuXoPsTgVA== | ||
X-Google-Smtp-Source: APXvYqz6+fZBBApCPKsAaDn53hy/LvF1r11aSW4WKDF6l32eyUiF7aK+w6f4RqwdNS/8CTcIi1LqWg== | ||
X-Received: by 2002:a17:902:7c90:: with SMTP id y16mr90845841pll.238.1564036272112; | ||
Wed, 24 Jul 2019 23:31:12 -0700 (PDT) | ||
Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) | ||
by smtp.gmail.com with ESMTPSA id w18sm61226317pfj.37.2019.07.24.23.31.10 | ||
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); | ||
Wed, 24 Jul 2019 23:31:11 -0700 (PDT) | ||
From: Bjorn Andersson <bjorn.andersson@linaro.org> | ||
To: Kalle Valo <kvalo@codeaurora.org>, | ||
"David S. Miller" <davem@davemloft.net>, | ||
Rob Herring <robh+dt@kernel.org>, | ||
Mark Rutland <mark.rutland@arm.com> | ||
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, | ||
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, | ||
ath10k@lists.infradead.org, stable@vger.kernel.org | ||
Subject: [PATCH] ath10k: Fix HOST capability QMI incompatibility | ||
Date: Wed, 24 Jul 2019 23:31:08 -0700 | ||
Message-Id: <20190725063108.15790-1-bjorn.andersson@linaro.org> | ||
X-Mailer: git-send-email 2.18.0 | ||
Sender: linux-kernel-owner@vger.kernel.org | ||
Precedence: bulk | ||
List-ID: <linux-kernel.vger.kernel.org> | ||
X-Mailing-List: linux-kernel@vger.kernel.org | ||
Archived-At: <https://lore.kernel.org/lkml/20190725063108.15790-1-bjorn.andersson@linaro.org/> | ||
List-Archive: <https://lore.kernel.org/lkml/> | ||
List-Post: <mailto:linux-kernel@vger.kernel.org> | ||
|
||
The introduction of 768ec4c012ac ("ath10k: update HOST capability QMI | ||
message") served the purpose of supporting the new and extended HOST | ||
capability QMI message. | ||
|
||
But while the new message adds a slew of optional members it changes the | ||
data type of the "daemon_support" member, which means that older | ||
versions of the firmware will fail to decode the incoming request | ||
message. | ||
|
||
There is no way to detect this breakage from Linux and there's no way to | ||
recover from sending the wrong message (i.e. we can't just try one | ||
format and then fallback to the other), so a quirk is introduced in | ||
DeviceTree to indicate to the driver that the firmware requires the 8bit | ||
version of this message. | ||
|
||
Cc: stable@vger.kernel.org | ||
Fixes: 768ec4c012ac ("ath10k: update HOST capability qmi message") | ||
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> | ||
--- | ||
.../bindings/net/wireless/qcom,ath10k.txt | 6 +++++ | ||
drivers/net/wireless/ath/ath10k/qmi.c | 13 ++++++++--- | ||
.../net/wireless/ath/ath10k/qmi_wlfw_v01.c | 22 +++++++++++++++++++ | ||
.../net/wireless/ath/ath10k/qmi_wlfw_v01.h | 1 + | ||
drivers/net/wireless/ath/ath10k/snoc.c | 11 ++++++++++ | ||
drivers/net/wireless/ath/ath10k/snoc.h | 1 + | ||
6 files changed, 51 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | ||
index ae661e65354e..f9499b20d840 100644 | ||
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | ||
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | ||
@@ -81,6 +81,12 @@ Optional properties: | ||
Definition: Name of external front end module used. Some valid FEM names | ||
for example: "microsemi-lx5586", "sky85703-11" | ||
and "sky85803" etc. | ||
+- qcom,snoc-host-cap-8bit-quirk: | ||
+ Usage: Optional | ||
+ Value type: <empty> | ||
+ Definition: Quirk specifying that the firmware expects the 8bit version | ||
+ of the host capability QMI request | ||
+ | ||
|
||
Example (to supply PCI based wifi block details): | ||
|
||
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c | ||
index 3b63b6257c43..545ac1f06997 100644 | ||
--- a/drivers/net/wireless/ath/ath10k/qmi.c | ||
+++ b/drivers/net/wireless/ath/ath10k/qmi.c | ||
@@ -581,22 +581,29 @@ static int ath10k_qmi_host_cap_send_sync(struct ath10k_qmi *qmi) | ||
{ | ||
struct wlfw_host_cap_resp_msg_v01 resp = {}; | ||
struct wlfw_host_cap_req_msg_v01 req = {}; | ||
+ struct qmi_elem_info *req_ei; | ||
struct ath10k *ar = qmi->ar; | ||
+ struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); | ||
struct qmi_txn txn; | ||
int ret; | ||
|
||
req.daemon_support_valid = 1; | ||
req.daemon_support = 0; | ||
|
||
- ret = qmi_txn_init(&qmi->qmi_hdl, &txn, | ||
- wlfw_host_cap_resp_msg_v01_ei, &resp); | ||
+ ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_host_cap_resp_msg_v01_ei, | ||
+ &resp); | ||
if (ret < 0) | ||
goto out; | ||
|
||
+ if (test_bit(ATH10K_SNOC_FLAG_8BIT_HOST_CAP_QUIRK, &ar_snoc->flags)) | ||
+ req_ei = wlfw_host_cap_8bit_req_msg_v01_ei; | ||
+ else | ||
+ req_ei = wlfw_host_cap_req_msg_v01_ei; | ||
+ | ||
ret = qmi_send_request(&qmi->qmi_hdl, NULL, &txn, | ||
QMI_WLFW_HOST_CAP_REQ_V01, | ||
WLFW_HOST_CAP_REQ_MSG_V01_MAX_MSG_LEN, | ||
- wlfw_host_cap_req_msg_v01_ei, &req); | ||
+ req_ei, &req); | ||
if (ret < 0) { | ||
qmi_txn_cancel(&txn); | ||
ath10k_err(ar, "failed to send host capability request: %d\n", ret); | ||
diff --git a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c | ||
index 1fe05c6218c3..86fcf4e1de5f 100644 | ||
--- a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c | ||
+++ b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c | ||
@@ -1988,6 +1988,28 @@ struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[] = { | ||
{} | ||
}; | ||
|
||
+struct qmi_elem_info wlfw_host_cap_8bit_req_msg_v01_ei[] = { | ||
+ { | ||
+ .data_type = QMI_OPT_FLAG, | ||
+ .elem_len = 1, | ||
+ .elem_size = sizeof(u8), | ||
+ .array_type = NO_ARRAY, | ||
+ .tlv_type = 0x10, | ||
+ .offset = offsetof(struct wlfw_host_cap_req_msg_v01, | ||
+ daemon_support_valid), | ||
+ }, | ||
+ { | ||
+ .data_type = QMI_UNSIGNED_1_BYTE, | ||
+ .elem_len = 1, | ||
+ .elem_size = sizeof(u8), | ||
+ .array_type = NO_ARRAY, | ||
+ .tlv_type = 0x10, | ||
+ .offset = offsetof(struct wlfw_host_cap_req_msg_v01, | ||
+ daemon_support), | ||
+ }, | ||
+ {} | ||
+}; | ||
+ | ||
struct qmi_elem_info wlfw_host_cap_resp_msg_v01_ei[] = { | ||
{ | ||
.data_type = QMI_STRUCT, | ||
diff --git a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h | ||
index bca1186e1560..4d107e1364a8 100644 | ||
--- a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h | ||
+++ b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h | ||
@@ -575,6 +575,7 @@ struct wlfw_host_cap_req_msg_v01 { | ||
|
||
#define WLFW_HOST_CAP_REQ_MSG_V01_MAX_MSG_LEN 189 | ||
extern struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[]; | ||
+extern struct qmi_elem_info wlfw_host_cap_8bit_req_msg_v01_ei[]; | ||
|
||
struct wlfw_host_cap_resp_msg_v01 { | ||
struct qmi_response_type_v01 resp; | ||
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c | ||
index b491361e6ed4..fc15a0037f0e 100644 | ||
--- a/drivers/net/wireless/ath/ath10k/snoc.c | ||
+++ b/drivers/net/wireless/ath/ath10k/snoc.c | ||
@@ -1261,6 +1261,15 @@ static int ath10k_snoc_resource_init(struct ath10k *ar) | ||
return ret; | ||
} | ||
|
||
+static void ath10k_snoc_quirks_init(struct ath10k *ar) | ||
+{ | ||
+ struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); | ||
+ struct device *dev = &ar_snoc->dev->dev; | ||
+ | ||
+ if (of_property_read_bool(dev->of_node, "qcom,snoc-host-cap-8bit-quirk")) | ||
+ set_bit(ATH10K_SNOC_FLAG_8BIT_HOST_CAP_QUIRK, &ar_snoc->flags); | ||
+} | ||
+ | ||
int ath10k_snoc_fw_indication(struct ath10k *ar, u64 type) | ||
{ | ||
struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); | ||
@@ -1678,6 +1687,8 @@ static int ath10k_snoc_probe(struct platform_device *pdev) | ||
ar->ce_priv = &ar_snoc->ce; | ||
msa_size = drv_data->msa_size; | ||
|
||
+ ath10k_snoc_quirks_init(ar); | ||
+ | ||
ret = ath10k_snoc_resource_init(ar); | ||
if (ret) { | ||
ath10k_warn(ar, "failed to initialize resource: %d\n", ret); | ||
diff --git a/drivers/net/wireless/ath/ath10k/snoc.h b/drivers/net/wireless/ath/ath10k/snoc.h | ||
index d62f53501fbb..9db823e46314 100644 | ||
--- a/drivers/net/wireless/ath/ath10k/snoc.h | ||
+++ b/drivers/net/wireless/ath/ath10k/snoc.h | ||
@@ -63,6 +63,7 @@ enum ath10k_snoc_flags { | ||
ATH10K_SNOC_FLAG_REGISTERED, | ||
ATH10K_SNOC_FLAG_UNREGISTERING, | ||
ATH10K_SNOC_FLAG_RECOVERY, | ||
+ ATH10K_SNOC_FLAG_8BIT_HOST_CAP_QUIRK, | ||
}; | ||
|
||
struct ath10k_snoc { | ||
-- | ||
2.18.0 | ||
|
||
|
Oops, something went wrong.