public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>, ath12k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, Kalle Valo <kvalo@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jeff Johnson <jjohnson@kernel.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Balamurugan S <quic_bselvara@quicinc.com>,
	P Praneesh <quic_ppranees@quicinc.com>
Subject: Re: [PATCH v4 08/13] wifi: ath12k: add AHB driver support for IPQ5332
Date: Tue, 10 Dec 2024 15:47:49 +0100	[thread overview]
Message-ID: <42feceb8-512a-4be3-aefa-116bbde000c1@kernel.org> (raw)
In-Reply-To: <20241210074159.2637933-9-quic_rajkbhag@quicinc.com>

On 10/12/2024 08:41, Raj Kumar Bhagat wrote:
> From: Balamurugan S <quic_bselvara@quicinc.com>
> 
> 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 <quic_bselvara@quicinc.com>
> Co-developed-by: P Praneesh <quic_ppranees@quicinc.com>
> Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
> Co-developed-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
> Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
> ---
>  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.h
> 
> diff --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.

> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +#include <linux/remoteproc.h>

More headers here look unused.

> +#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.


> +
> +#define ATH12K_IRQ_CE0_OFFSET 4
> +


...

> +
> +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.

> +		return -EOPNOTSUPP;
> +	}
> +

> +	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.

> +		if (!mem_node)
> +			ab->single_chip_mlo_supp = false;
> +	}
> +
> +	ret = ath12k_core_pre_init(ab);
> +	if (ret)
> +		goto err_core_free;

Best regards,
Krzysztof

  reply	other threads:[~2024-12-10 14:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10  7:41 [PATCH v4 00/13] wifi: ath12k: add Ath12k AHB driver support for IPQ5332 Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 01/13] dt-bindings: net: wireless: describe the ath12k AHB module Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 02/13] wifi: ath12k: fix incorrect CE addresses Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 03/13] wifi: ath12k: refactor ath12k_hw_regs structure Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 04/13] wifi: ath12k: add ath12k_hw_params for IPQ5332 Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 05/13] wifi: ath12k: avoid m3 firmware download in AHB device IPQ5332 Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 06/13] wifi: ath12k: Add hw_params to remap CE register space for IPQ5332 Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 07/13] wifi: ath12k: add support for fixed QMI firmware memory Raj Kumar Bhagat
2024-12-10 14:43   ` Krzysztof Kozlowski
2024-12-10 17:00     ` Raj Kumar Bhagat
2024-12-11  8:52       ` Krzysztof Kozlowski
2024-12-10  7:41 ` [PATCH v4 08/13] wifi: ath12k: add AHB driver support for IPQ5332 Raj Kumar Bhagat
2024-12-10 14:47   ` Krzysztof Kozlowski [this message]
2025-01-29 18:28     ` Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 09/13] wifi: ath12k: Power up root PD Raj Kumar Bhagat
2024-12-10 14:50   ` Krzysztof Kozlowski
2025-01-29 18:32     ` Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 10/13] wifi: ath12k: Register various userPD interrupts and save SMEM entries Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 11/13] wifi: ath12k: Power up userPD Raj Kumar Bhagat
2024-12-10 14:52   ` Krzysztof Kozlowski
2025-01-29 18:34     ` Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 12/13] wifi: ath12k: Power down userPD Raj Kumar Bhagat
2024-12-10  7:41 ` [PATCH v4 13/13] wifi: ath12k: enable ath12k AHB support Raj Kumar Bhagat
2024-12-10 15:08 ` [PATCH v4 00/13] wifi: ath12k: add Ath12k AHB driver support for IPQ5332 Krzysztof Kozlowski
2024-12-10 15:12   ` Krzysztof Kozlowski
2025-01-28  9:16     ` Raj Kumar Bhagat
2025-01-28  9:20       ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42feceb8-512a-4be3-aefa-116bbde000c1@kernel.org \
    --to=krzk@kernel.org \
    --cc=ath12k@lists.infradead.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jjohnson@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_bselvara@quicinc.com \
    --cc=quic_ppranees@quicinc.com \
    --cc=quic_rajkbhag@quicinc.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox