qcacmn: Use function to attach HAL TX/RX ops

Assign th HAL TX/RX ops in a function instead of assining a structure
directly. This can be later extended to have default ops for a family of
chips and then override that with chip specific ops.

This also helps the case where a new hal_soc->ops needs to be added.
The new 'op' will need to be added to only a default ops initializer
(with assumption that it applies to all chips).

Change-Id: Iefa23d14110fa5252444fad89737a3b2b2fbab6f
CRs-Fixed: 2891049
This commit is contained in:
Mohit Khanna
2021-02-04 05:25:37 -08:00
committed by Manjunathappa Prakash
parent 606c708af6
commit 4e6a7cf1bf
10 changed files with 1020 additions and 999 deletions

View File

@@ -1399,6 +1399,12 @@ void *hal_attach(struct hif_opaque_softc *hif_handle, qdf_device_t qdf_dev)
qdf_spinlock_create(&hal->register_access_lock);
hal->register_window = 0;
hal->target_type = hal_get_target_type(hal_soc_to_hal_soc_handle(hal));
hal->ops = qdf_mem_malloc(sizeof(*hal->ops));
if (!hal->ops) {
hal_err("unable to allocable memory for HAL ops");
goto fail3;
}
hal_target_based_configure(hal);
@@ -1411,7 +1417,12 @@ void *hal_attach(struct hif_opaque_softc *hif_handle, qdf_device_t qdf_dev)
hal_delayed_tcl_reg_write_init(hal);
return (void *)hal;
fail3:
qdf_mem_free_consistent(qdf_dev, qdf_dev->dev,
sizeof(*hal->shadow_wrptr_mem_vaddr) *
HAL_MAX_LMAC_RINGS,
hal->shadow_wrptr_mem_vaddr,
hal->shadow_wrptr_mem_paddr, 0);
fail2:
qdf_mem_free_consistent(qdf_dev, qdf_dev->dev,
sizeof(*(hal->shadow_rdptr_mem_vaddr)) * HAL_SRNG_ID_MAX,
@@ -1460,6 +1471,7 @@ extern void hal_detach(void *hal_soc)
hal_delayed_reg_write_deinit(hal);
hal_delayed_tcl_reg_write_deinit(hal);
qdf_mem_free(hal->ops);
qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
sizeof(*(hal->shadow_rdptr_mem_vaddr)) * HAL_SRNG_ID_MAX,