Skip to content

Commit cabde4d

Browse files
committed
mac80211: ath11k: Support reading board_id from devicetree and
filesystem
1 parent 62dc0e2 commit cabde4d

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From 65e53c8d35592e719b20dd81dfcb3537f0cb67b2 Mon Sep 17 00:00:00 2001
2+
From: hzy <hzyitc@outlook.com>
3+
Date: Sat, 7 Oct 2023 22:19:31 +0800
4+
Subject: [PATCH 1/2] ath11k: Support reading board_id from devicetree
5+
6+
---
7+
drivers/net/wireless/ath/ath11k/qmi.c | 5 ++++-
8+
1 file changed, 4 insertions(+), 1 deletion(-)
9+
10+
diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
11+
index 194ae302..e4a28359 100644
12+
--- a/drivers/net/wireless/ath/ath11k/qmi.c
13+
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
14+
@@ -2217,6 +2217,7 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
15+
struct qmi_txn txn;
16+
int ret = 0;
17+
int r;
18+
+ u32 board_id;
19+
char *fw_build_id;
20+
int fw_build_id_mask_len;
21+
22+
@@ -2259,7 +2260,9 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
23+
ab->qmi.target.chip_family = resp.chip_info.chip_family;
24+
}
25+
26+
- if (resp.board_info_valid)
27+
+ if (!of_property_read_u32(ab->dev->of_node, "qcom,board_id", &board_id) && board_id != 0xFF)
28+
+ ab->qmi.target.board_id = board_id;
29+
+ else if (resp.board_info_valid)
30+
ab->qmi.target.board_id = resp.board_info.board_id;
31+
else
32+
ab->qmi.target.board_id = 0xFF;
33+
--
34+
2.40.1
35+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
From 50bdef1cc677f55240d1fb781a8ee81c15d9375b Mon Sep 17 00:00:00 2001
2+
From: hzy <hzyitc@outlook.com>
3+
Date: Sat, 7 Oct 2023 22:22:05 +0800
4+
Subject: [PATCH 2/2] ath11k: Support reading board_id from filesystem
5+
6+
---
7+
drivers/net/wireless/ath/ath11k/qmi.c | 28 ++++++++++++++++++++++++++-
8+
1 file changed, 27 insertions(+), 1 deletion(-)
9+
10+
diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
11+
index e4a28359..d50b6300 100644
12+
--- a/drivers/net/wireless/ath/ath11k/qmi.c
13+
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
14+
@@ -2210,6 +2210,30 @@ out:
15+
return ret;
16+
}
17+
18+
+static int ath11k_qmi_fetch_board_id_from_fs(struct ath11k_base *ab, u32 *board_id)
19+
+{
20+
+ const struct firmware *fw;
21+
+ char buf[64];
22+
+ int len;
23+
+ int ret;
24+
+
25+
+ snprintf(buf, sizeof(buf), "board_id-%s-%s",
26+
+ ath11k_bus_str(ab->hif.bus), dev_name(ab->dev));
27+
+
28+
+ fw = ath11k_core_firmware_request(ab, buf);
29+
+ if(IS_ERR(fw))
30+
+ return PTR_ERR(fw);
31+
+
32+
+ len = min(fw->size, sizeof(buf) - 1);
33+
+ memcpy(buf, fw->data, len);
34+
+ buf[len] = 0;
35+
+
36+
+ ret = kstrtouint(buf, 0, board_id);
37+
+
38+
+ release_firmware(fw);
39+
+ return ret;
40+
+}
41+
+
42+
static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
43+
{
44+
struct qmi_wlanfw_cap_req_msg_v01 req;
45+
@@ -2260,7 +2284,9 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
46+
ab->qmi.target.chip_family = resp.chip_info.chip_family;
47+
}
48+
49+
- if (!of_property_read_u32(ab->dev->of_node, "qcom,board_id", &board_id) && board_id != 0xFF)
50+
+ if (!ath11k_qmi_fetch_board_id_from_fs(ab, &board_id) && board_id != 0xFF)
51+
+ ab->qmi.target.board_id = board_id;
52+
+ else if (!of_property_read_u32(ab->dev->of_node, "qcom,board_id", &board_id) && board_id != 0xFF)
53+
ab->qmi.target.board_id = board_id;
54+
else if (resp.board_info_valid)
55+
ab->qmi.target.board_id = resp.board_info.board_id;
56+
--
57+
2.40.1
58+

0 commit comments

Comments
 (0)