Re: [PATCH v4 08/13] wifi: ath12k: add AHB driver support for IPQ5332
From: Raj Kumar Bhagat <hidden>
Date: 2025-01-29 18:29:32
Also in:
ath12k, linux-wireless, lkml
On 12/10/2024 8:17 PM, Krzysztof Kozlowski wrote:
On 10/12/2024 08:41, Raj Kumar Bhagat wrote:quoted
From: Balamurugan S <redacted> Add Initial Ath12k AHB driver support for IPQ5332. IPQ5332 is AHB based IEEE802.11be 2 GHz 2x2 WiFi device. 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: Balamurugan S <redacted> Co-developed-by: P Praneesh <redacted> Signed-off-by: P Praneesh <redacted> Co-developed-by: Raj Kumar Bhagat <redacted> Signed-off-by: Raj Kumar Bhagat <redacted> --- drivers/net/wireless/ath/ath12k/ahb.c | 878 +++++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/ahb.h | 37 ++ drivers/net/wireless/ath/ath12k/core.h | 4 + drivers/net/wireless/ath/ath12k/hal.h | 1 + drivers/net/wireless/ath/ath12k/hw.h | 1 + 5 files changed, 921 insertions(+) create mode 100644 drivers/net/wireless/ath/ath12k/ahb.c create mode 100644 drivers/net/wireless/ath/ath12k/ahb.hdiff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c new file mode 100644 index 000000000000..fcd949faea9f --- /dev/null +++ b/drivers/net/wireless/ath/ath12k/ahb.c@@ -0,0 +1,878 @@ +// SPDX-License-Identifier: BSD-3-Clause-Clear +/* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#include <linux/dma-mapping.h> +#include <linux/iommu.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h>You don't use this header.quoted
+#include <linux/of_device.h> +#include <linux/platform_device.h> +#include <linux/remoteproc.h>More headers here look unused.
sure, will remove unused headers in next version.
quoted
+#include <linux/soc/qcom/smem.h> +#include <linux/soc/qcom/smem_state.h> +#include "ahb.h" +#include "debug.h" +#include "hif.h" + +static const struct of_device_id ath12k_ahb_of_match[] = { + { .compatible = "qcom,ipq5332-wifi", + .data = (void *)ATH12K_HW_IPQ5332_HW10, + }, + { } +}; + +MODULE_DEVICE_TABLE(of, ath12k_ahb_of_match);This goes to driver struct declaration. It is really unusual to see it in some other places.quoted
+ +#define ATH12K_IRQ_CE0_OFFSET 4 +...quoted
+ +static int ath12k_ahb_probe(struct platform_device *pdev) +{ + struct ath12k_base *ab; + const struct ath12k_hif_ops *hif_ops; + struct device_node *mem_node; + enum ath12k_hw_rev hw_rev; + u32 addr; + int ret; + + hw_rev = ath12k_ahb_get_hw_rev(pdev); + switch (hw_rev) { + case ATH12K_HW_IPQ5332_HW10: + hif_ops = &ath12k_ahb_hif_ops_ipq5332; + break; + default: + dev_err(&pdev->dev, "Unsupported device type %d\n", hw_rev);You already print once in ath12k_ahb_get_hw_rev() and none of these can happen. No need to print impossible conditions at all. No need to print impossible things twice.
sure, will drop this print.
quoted
+ return -EOPNOTSUPP; + } +quoted
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "Failed to set 32-bit coherent dma\n"); + return ret; + } + + ab = ath12k_core_alloc(&pdev->dev, sizeof(struct ath12k_ahb), + ATH12K_BUS_AHB); + if (!ab) { + dev_err(&pdev->dev, "failed to allocate ath12k base\n"); + return -ENOMEM; + } + + ab->hif.ops = hif_ops; + ab->pdev = pdev; + ab->hw_rev = hw_rev; + platform_set_drvdata(pdev, ab); + + /* Set fixed_mem_region to true for platforms that support fixed memory + * reservation from DT. If memory is reserved from DT for FW, ath12k driver + * need not to allocate memory. + */ + if (!of_property_read_u32(ab->dev->of_node, "memory-region", &addr)) { + set_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags); + + /* If the platform supports fixed memory, then it should define/ + * reserve MLO global memory in DT to support Multi Link Operation + * (IEEE 802.11be). + * If MLO global memory is not reserved in fixed memory mode, then + * MLO cannot be supported. + */ + mem_node = of_find_node_by_name(NULL, "mlo_global_mem_0");NAK. Incorrect name, not conforming to coding style. Undocumented ABI. Drop all calls to of_find_node_by_name() or any other stuff like this.
Sure, will remove all calls to - of_find_node_by_name()
quoted
+ if (!mem_node) + ab->single_chip_mlo_supp = false; + } + + ret = ath12k_core_pre_init(ab); + if (ret) + goto err_core_free;Best regards, Krzysztof