summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath12k/mhi.c
diff options
context:
space:
mode:
authorGanesh Babu Jothiram <quic_gjothira@quicinc.com>2024-01-29 12:27:23 +0530
committerKalle Valo <quic_kvalo@quicinc.com>2024-02-02 14:32:52 +0200
commitaf9bc78d14fbe77db6e7526efaced162060f27bc (patch)
tree598283861edf457aa813d5ba6ab9d54e00cebaa0 /drivers/net/wireless/ath/ath12k/mhi.c
parentafeee629e72eeed719eb3f2918d7c8f3ae33497f (diff)
wifi: ath12k: Read board id to support split-PHY QCN9274
QCN9274 can support single-PHY or split-PHY architecture. Currently, only the single-PHY architecture is supported in ath12k. The split-PHY QCN9274 requires different AMSS firmware binary "amss_dualmac.bin". Hence, add support to read board id from OTP. Based on board id decide whether single-mac / dual-mac firmware needs to be downloaded to the target. Also, update HW param max_radios to support split-PHY in QCN9274. Also, add new Firmware IE for firmware_N.bin "ATH11K_FW_IE_AMSS_DUALMAC_IMAGE" to support dualmac QCN9274. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00188-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Ganesh Babu Jothiram <quic_gjothira@quicinc.com> Co-developed-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com> Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://msgid.link/20240129065724.2310207-13-quic_rajkbhag@quicinc.com
Diffstat (limited to 'drivers/net/wireless/ath/ath12k/mhi.c')
-rw-r--r--drivers/net/wireless/ath/ath12k/mhi.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/ath/ath12k/mhi.c
index b7b31978a434..50b9e44504f7 100644
--- a/drivers/net/wireless/ath/ath12k/mhi.c
+++ b/drivers/net/wireless/ath/ath12k/mhi.c
@@ -14,6 +14,8 @@
#include "pci.h"
#define MHI_TIMEOUT_DEFAULT_MS 90000
+#define OTP_INVALID_BOARD_ID 0xFFFF
+#define OTP_VALID_DUALMAC_BOARD_ID_MASK 0x1000
static const struct mhi_channel_config ath12k_mhi_channels_qcn9274[] = {
{
@@ -359,7 +361,9 @@ int ath12k_mhi_register(struct ath12k_pci *ab_pci)
{
struct ath12k_base *ab = ab_pci->ab;
struct mhi_controller *mhi_ctrl;
+ unsigned int board_id;
int ret;
+ bool dualmac = false;
mhi_ctrl = mhi_alloc_controller();
if (!mhi_ctrl)
@@ -371,16 +375,43 @@ int ath12k_mhi_register(struct ath12k_pci *ab_pci)
mhi_ctrl->reg_len = ab->mem_len;
mhi_ctrl->rddm_size = ab->hw_params->rddm_size;
- if (ab->fw.amss_data && ab->fw.amss_len > 0) {
- /* use MHI firmware file from firmware-N.bin */
- mhi_ctrl->fw_data = ab->fw.amss_data;
- mhi_ctrl->fw_sz = ab->fw.amss_len;
+ if (ab->hw_params->otp_board_id_register) {
+ board_id =
+ ath12k_pci_read32(ab, ab->hw_params->otp_board_id_register);
+ board_id = u32_get_bits(board_id, OTP_BOARD_ID_MASK);
+
+ if (!board_id || (board_id == OTP_INVALID_BOARD_ID)) {
+ ath12k_dbg(ab, ATH12K_DBG_BOOT,
+ "failed to read board id\n");
+ } else if (board_id & OTP_VALID_DUALMAC_BOARD_ID_MASK) {
+ dualmac = true;
+ ath12k_dbg(ab, ATH12K_DBG_BOOT,
+ "dualmac fw selected for board id: %x\n", board_id);
+ }
+ }
+
+ if (dualmac) {
+ if (ab->fw.amss_dualmac_data && ab->fw.amss_dualmac_len > 0) {
+ /* use MHI firmware file from firmware-N.bin */
+ mhi_ctrl->fw_data = ab->fw.amss_dualmac_data;
+ mhi_ctrl->fw_sz = ab->fw.amss_dualmac_len;
+ } else {
+ ath12k_warn(ab, "dualmac firmware IE not present in firmware-N.bin\n");
+ ret = -ENOENT;
+ goto free_controller;
+ }
} else {
- /* use the old separate mhi.bin MHI firmware file */
- ath12k_core_create_firmware_path(ab, ATH12K_AMSS_FILE,
- ab_pci->amss_path,
- sizeof(ab_pci->amss_path));
- mhi_ctrl->fw_image = ab_pci->amss_path;
+ if (ab->fw.amss_data && ab->fw.amss_len > 0) {
+ /* use MHI firmware file from firmware-N.bin */
+ mhi_ctrl->fw_data = ab->fw.amss_data;
+ mhi_ctrl->fw_sz = ab->fw.amss_len;
+ } else {
+ /* use the old separate mhi.bin MHI firmware file */
+ ath12k_core_create_firmware_path(ab, ATH12K_AMSS_FILE,
+ ab_pci->amss_path,
+ sizeof(ab_pci->amss_path));
+ mhi_ctrl->fw_image = ab_pci->amss_path;
+ }
}
ret = ath12k_mhi_get_msi(ab_pci);