From: Krzysztof Kozlowski <krzk@kernel.org>
To: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>, ath12k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org,
Balamurugan S <quic_bselvara@quicinc.com>,
P Praneesh <quic_ppranees@quicinc.com>
Subject: Re: [RFC PATCH 17/18] wifi: ath12k: add AHB driver support for IPQ5332
Date: Fri, 16 Aug 2024 07:47:50 +0200 [thread overview]
Message-ID: <68e114c3-0f0b-42a0-9397-69f8bc6d8f5b@kernel.org> (raw)
In-Reply-To: <20240814094323.3927603-18-quic_rajkbhag@quicinc.com>
On 14/08/2024 11:43, 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>
> ---
...
> +
> + of_id = of_match_device(ath12k_ahb_of_match, &pdev->dev);
> + if (!of_id) {
> + dev_err(&pdev->dev, "Failed to find matching device tree id\n");
> + return -EINVAL;
> + }
> +
> + hw_rev = (enum ath12k_hw_rev)of_id->data;
Just use wrapper to get match data.
> +
> + 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);
> + 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 consistent 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);
> + mem_node = of_find_node_by_name(NULL, "mlo_global_mem_0");
> + if (!mem_node)
> + ab->mlo_capable_flags = 0;
> + }
> +
> + ret = ath12k_core_pre_init(ab);
> + if (ret)
> + goto err_core_free;
> +
> + ret = ath12k_ahb_resource_init(ab);
> + if (ret)
> + goto err_core_free;
> +
> + ret = ath12k_hal_srng_init(ab);
> + if (ret)
> + goto err_resource_deinit;
> +
> + ret = ath12k_ce_alloc_pipes(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to allocate ce pipes: %d\n", ret);
> + goto err_hal_srng_deinit;
> + }
> +
> + ath12k_ahb_init_qmi_ce_config(ab);
> +
> + ret = ath12k_core_get_rproc(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to get rproc: %d\n", ret);
> + goto err_ce_free;
> + }
> +
> + ret = ath12k_ahb_config_irq(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to configure irq: %d\n", ret);
> + goto err_ce_free;
> + }
> +
> + ret = ath12k_core_init(ab);
> + if (ret) {
> + ath12k_err(ab, "failed to init core: %d\n", ret);
> + goto err_ce_free;
> + }
> +
> + return 0;
> +
> +err_ce_free:
> + ath12k_ce_free_pipes(ab);
> +
> +err_hal_srng_deinit:
> + ath12k_hal_srng_deinit(ab);
> +
> +err_resource_deinit:
> + ath12k_ahb_resource_deinit(ab);
> +
> +err_core_free:
> + ath12k_core_free(ab);
> + platform_set_drvdata(pdev, NULL);
> +
> + return ret;
> +}
> +
> +static void ath12k_ahb_remove_prepare(struct ath12k_base *ab)
> +{
> + unsigned long left;
> +
> + if (test_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags)) {
> + left = wait_for_completion_timeout(&ab->driver_recovery,
> + ATH12K_AHB_RECOVERY_TIMEOUT);
> + if (!left)
> + ath12k_warn(ab, "failed to receive recovery response completion\n");
> + }
> +
> + set_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags);
> + cancel_work_sync(&ab->restart_work);
> + cancel_work_sync(&ab->qmi.event_work);
> +}
> +
> +static void ath12k_ahb_free_resources(struct ath12k_base *ab)
> +{
> + struct platform_device *pdev = ab->pdev;
> +
> + ath12k_ahb_free_irq(ab);
> + ath12k_hal_srng_deinit(ab);
> + ath12k_ce_free_pipes(ab);
> + ath12k_ahb_resource_deinit(ab);
> + ath12k_core_free(ab);
> + platform_set_drvdata(pdev, NULL);
> +}
> +
> +static void ath12k_ahb_remove(struct platform_device *pdev)
> +{
> + struct ath12k_base *ab = platform_get_drvdata(pdev);
> +
> + if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) {
> + ath12k_ahb_power_down(ab, false);
> + ath12k_qmi_deinit_service(ab);
> + goto qmi_fail;
> + }
> +
> + ath12k_ahb_remove_prepare(ab);
> + ath12k_core_deinit(ab);
> +
> +qmi_fail:
> + ath12k_ahb_free_resources(ab);
> +}
> +
> +static void ath12k_ahb_shutdown(struct platform_device *pdev)
> +{
> + struct ath12k_base *ab = platform_get_drvdata(pdev);
> +
> + /* platform shutdown() & remove() are mutually exclusive.
> + * remove() is invoked during rmmod & shutdown() during
> + * system reboot/shutdown.
> + */
> + ath12k_ahb_remove_prepare(ab);
> +
> + if (!(test_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags)))
> + goto free_resources;
> +
> + ath12k_core_deinit(ab);
> +
> +free_resources:
> + ath12k_ahb_free_resources(ab);
Why? It's shutdown, we do not care about cleanup. Why do you need this
shutdown callback in the first place?
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-08-16 5:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 9:43 [RFC PATCH 00/18] wifi: ath12k: add Ath12k AHB driver support for IPQ5332 Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 01/18] dt-bindings: net: wireless: describe the ath12k AHB module Raj Kumar Bhagat
2024-08-16 5:42 ` Krzysztof Kozlowski
2024-09-04 7:23 ` Raj Kumar Bhagat
2024-09-04 7:38 ` Krzysztof Kozlowski
2024-09-04 11:28 ` Raj Kumar Bhagat
2024-09-04 11:42 ` Krzysztof Kozlowski
2024-09-05 18:33 ` Kalle Valo
2024-08-16 5:44 ` Krzysztof Kozlowski
2024-09-04 7:27 ` Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 02/18] arm64: dts: qcom: add wifi node for IPQ5332 based RDP441 Raj Kumar Bhagat
2024-08-16 5:44 ` Krzysztof Kozlowski
2024-08-14 9:43 ` [RFC PATCH 03/18] wifi: ath12k: add ath12k_hw_params for IPQ5332 Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 04/18] wifi: ath12k: refactor ath12k_hw_regs structure Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 05/18] wifi: ath12k: add ath12k_hw_regs for IPQ5332 Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 06/18] wifi: ath12k: add ath12k_hw_ring_mask " Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 07/18] wifi: ath12k: add CE configurations " Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 08/18] wifi: ath12k: add ath12k_hw_hal_params " Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 09/18] wifi: ath12k: avoid m3 firmware download in AHB device IPQ5332 Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 10/18] wifi: ath12k: add new CMEM read-write ath12k_hif_ops Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 11/18] wifi: ath12k: remap CMEM register space for IPQ5332 Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 12/18] wifi: ath12k: fix incorrect CE addresses Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 13/18] wifi: ath12k: remap CE register space for IPQ5332 Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 14/18] wifi: ath12k: add support for fixed QMI firmware memory Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 15/18] wifi: ath12k: add support to read board_id from device-tree Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 16/18] wifi: ath12k: convert tasklet to BH workqueue for CE interrupts Raj Kumar Bhagat
2024-08-14 9:43 ` [RFC PATCH 17/18] wifi: ath12k: add AHB driver support for IPQ5332 Raj Kumar Bhagat
2024-08-16 5:47 ` Krzysztof Kozlowski [this message]
2024-08-14 9:43 ` [RFC PATCH 18/18] wifi: ath12k: enable ath12k AHB support Raj Kumar Bhagat
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=68e114c3-0f0b-42a0-9397-69f8bc6d8f5b@kernel.org \
--to=krzk@kernel.org \
--cc=ath12k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_bselvara@quicinc.com \
--cc=quic_ppranees@quicinc.com \
--cc=quic_rajkbhag@quicinc.com \
/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