diff mbox series

[RFC,15/18] wifi: ath12k: add support to read board_id from device-tree

Message ID 20240814094323.3927603-16-quic_rajkbhag@quicinc.com
State New
Headers show
Series wifi: ath12k: add Ath12k AHB driver support for IPQ5332 | expand

Commit Message

Raj Kumar Bhagat Aug. 14, 2024, 9:43 a.m. UTC
Currently, QMI target board_id is read from firmware during QMI
target capability request. If the board_id is not fused in WiFi
device, firmware responds with the default board id (0xFF). Due to
this, "board-2.bin" board data download fails if "board-2.bin" does
not have board data for the default board id (0xFF).

Hence, add support to read board_id from device-tree. If the board_id
is not fused in WiFi device, use device-tree to read board_id.

Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1

Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/qmi.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c
index 7a039659dbec..428d081f722f 100644
--- a/drivers/net/wireless/ath/ath12k/qmi.c
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
@@ -2566,7 +2566,8 @@  static int ath12k_qmi_request_target_cap(struct ath12k_base *ab)
 	struct qmi_wlanfw_cap_req_msg_v01 req = {};
 	struct qmi_wlanfw_cap_resp_msg_v01 resp = {};
 	struct qmi_txn txn;
-	unsigned int board_id = ATH12K_BOARD_ID_DEFAULT;
+	struct device *dev = ab->dev;
+	u32 board_id = ATH12K_BOARD_ID_DEFAULT;
 	int ret = 0;
 	int r;
 	int i;
@@ -2606,9 +2607,13 @@  static int ath12k_qmi_request_target_cap(struct ath12k_base *ab)
 	}
 
 	if (resp.board_info_valid)
-		ab->qmi.target.board_id = resp.board_info.board_id;
-	else
-		ab->qmi.target.board_id = board_id;
+		board_id = resp.board_info.board_id;
+	if (board_id == ATH12K_BOARD_ID_DEFAULT || ~board_id == 0)
+		of_property_read_u32(dev->of_node, "qcom,board_id", &board_id);
+	if (board_id == ATH12K_BOARD_ID_DEFAULT || ~board_id == 0)
+		ath12k_warn(ab, "unable to read board_id, using default board_id: 0x%x\n",
+			    board_id);
+	ab->qmi.target.board_id = board_id;
 
 	if (resp.soc_info_valid)
 		ab->qmi.target.soc_id = resp.soc_info.soc_id;