mirror of
https://github.com/hzyitc/openwrt-redmi-ax3000.git
synced 2025-12-16 08:22:16 +00:00
mac80211: ath11k: Support reading board_id from devicetree and
filesystem
This commit is contained in:
parent
8c04a80d72
commit
0228c90e69
@ -0,0 +1,35 @@
|
||||
From 1b4a1cc8a00a1497f0afa782f1ae844db8eab3d4 Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Sat, 7 Oct 2023 22:19:31 +0800
|
||||
Subject: [PATCH 1/2] ath11k: Support reading board_id from devicetree
|
||||
|
||||
---
|
||||
drivers/net/wireless/ath/ath11k/qmi.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
|
||||
index 801d5880..a9aa40dd 100644
|
||||
--- a/drivers/net/wireless/ath/ath11k/qmi.c
|
||||
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
|
||||
@@ -2200,6 +2200,7 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
|
||||
struct qmi_txn txn;
|
||||
int ret = 0;
|
||||
int r;
|
||||
+ u32 board_id;
|
||||
char *fw_build_id;
|
||||
int fw_build_id_mask_len;
|
||||
|
||||
@@ -2242,7 +2243,9 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
|
||||
ab->qmi.target.chip_family = resp.chip_info.chip_family;
|
||||
}
|
||||
|
||||
- if (resp.board_info_valid)
|
||||
+ if (!of_property_read_u32(ab->dev->of_node, "qcom,board_id", &board_id) && board_id != 0xFF)
|
||||
+ ab->qmi.target.board_id = board_id;
|
||||
+ else if (resp.board_info_valid)
|
||||
ab->qmi.target.board_id = resp.board_info.board_id;
|
||||
else
|
||||
ab->qmi.target.board_id = 0xFF;
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
From e99fe9e7929eb55618e468c1bfbe64aa41fb9420 Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Sat, 7 Oct 2023 22:22:05 +0800
|
||||
Subject: [PATCH 2/2] ath11k: Support reading board_id from filesystem
|
||||
|
||||
---
|
||||
drivers/net/wireless/ath/ath11k/qmi.c | 28 ++++++++++++++++++++++++++-
|
||||
1 file changed, 27 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
|
||||
index a9aa40dd..ebf99a9a 100644
|
||||
--- a/drivers/net/wireless/ath/ath11k/qmi.c
|
||||
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
|
||||
@@ -2193,6 +2193,30 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int ath11k_qmi_fetch_board_id_from_fs(struct ath11k_base *ab, u32 *board_id)
|
||||
+{
|
||||
+ const struct firmware *fw;
|
||||
+ char buf[64];
|
||||
+ int len;
|
||||
+ int ret;
|
||||
+
|
||||
+ snprintf(buf, sizeof(buf), "board_id-%s-%s",
|
||||
+ ath11k_bus_str(ab->hif.bus), dev_name(ab->dev));
|
||||
+
|
||||
+ fw = ath11k_core_firmware_request(ab, buf);
|
||||
+ if(IS_ERR(fw))
|
||||
+ return PTR_ERR(fw);
|
||||
+
|
||||
+ len = min(fw->size, sizeof(buf) - 1);
|
||||
+ memcpy(buf, fw->data, len);
|
||||
+ buf[len] = 0;
|
||||
+
|
||||
+ ret = kstrtouint(buf, 0, board_id);
|
||||
+
|
||||
+ release_firmware(fw);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
|
||||
{
|
||||
struct qmi_wlanfw_cap_req_msg_v01 req;
|
||||
@@ -2243,7 +2267,9 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
|
||||
ab->qmi.target.chip_family = resp.chip_info.chip_family;
|
||||
}
|
||||
|
||||
- if (!of_property_read_u32(ab->dev->of_node, "qcom,board_id", &board_id) && board_id != 0xFF)
|
||||
+ if (!ath11k_qmi_fetch_board_id_from_fs(ab, &board_id) && board_id != 0xFF)
|
||||
+ ab->qmi.target.board_id = board_id;
|
||||
+ else if (!of_property_read_u32(ab->dev->of_node, "qcom,board_id", &board_id) && board_id != 0xFF)
|
||||
ab->qmi.target.board_id = board_id;
|
||||
else if (resp.board_info_valid)
|
||||
ab->qmi.target.board_id = resp.board_info.board_id;
|
||||
--
|
||||
2.40.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user