wlan-ap-Telecominfraproject/feeds/wifi-ax/mac80211/patches/qca/321-001-qgic-api-compile-fix.patch
John Crispin d29c4e49b3 mac80211-qsdk: update to ath11.5-cs
Signed-off-by: John Crispin <john@phrozen.org>
2022-05-17 07:45:32 +02:00

383 lines
12 KiB
Diff

From aa2f204ed12b5543aa5f1dfb2b1bb6b458a9dba5 Mon Sep 17 00:00:00 2001
From: Tamizh Chelvam <tamizhr@codeaurora.org>
Date: Thu, 27 May 2021 17:24:24 +0530
Subject: [PATCH 2/2] ath1k: Fix kernel API related compilation error
Signed-off-by: Tamizh Chelvam <tamizhr@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/ahb.c | 53 +++++++-----------------------
drivers/net/wireless/ath/ath11k/ce.c | 7 ++++
drivers/net/wireless/ath/ath11k/core.h | 5 ++-
drivers/net/wireless/ath/ath11k/coredump.c | 4 +++
drivers/net/wireless/ath/ath11k/debugfs.c | 1 +
drivers/net/wireless/ath/ath11k/pci.c | 50 ++++------------------------
drivers/net/wireless/ath/ath11k/pci.h | 2 --
drivers/net/wireless/ath/ath11k/pktlog.c | 8 +++++
drivers/net/wireless/ath/ath11k/qmi.c | 14 ++++----
9 files changed, 46 insertions(+), 98 deletions(-)
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -14,7 +14,6 @@
#include "qmi.h"
#include "pci.h"
#include <linux/remoteproc.h>
-#include <soc/qcom/qgic2m.h>
static const struct of_device_id ath11k_ahb_of_match[] = {
/* TODO: Should we change the compatible string to something similar
@@ -610,55 +609,21 @@ static int ath11k_ahb_ext_irq_config(str
static void ath11k_internal_pci_free_irq(struct ath11k_base *ab)
{
ath11k_pci_free_irq(ab);
- qgic2_disable_msi(ab->ipci.qgicm_id);
-}
-
-struct qgic2_msi *ath11k_qgic2_enable_msi(struct ath11k_base *ab, int qgicm_id)
-{
- struct qgic2_msi *qgic2_msi;
-
- ab->ipci.msi_cfg = &ath11k_msi_config[ATH11K_MSI_CONFIG_QCN6122];
- qgic2_msi = qgic2_enable_msi(qgicm_id,
- ab->ipci.msi_cfg->total_vectors);
- if (IS_ERR(qgic2_msi)) {
- ath11k_err(ab, "qgic2_enable_msi fails %ld\n", PTR_ERR(qgic2_msi));
- return NULL;
- }
-
- return qgic2_msi;
}
static int ath11k_config_irq_internal_pci(struct ath11k_base *ab)
{
int ret;
- if (ab->userpd_id == QCN6122_USERPD_0) {
- ab->ipci.qgicm_id = APCS_QGIC2M_0;
- } else if (ab->userpd_id == QCN6122_USERPD_1) {
- ab->ipci.qgicm_id = APCS_QGIC2M_1;
- } else {
+ if (ab->userpd_id != QCN6122_USERPD_0 &&
+ ab->userpd_id != QCN6122_USERPD_1) {
ath11k_warn(ab, "ath11k userpd invalid %d\n", ab->userpd_id);
return -ENODEV;
}
- ab->ipci.qgic2_msi =
- ath11k_qgic2_enable_msi(ab, ab->ipci.qgicm_id);
- if (!ab->ipci.qgic2_msi) {
- ath11k_err(ab, "qgic2_msi fails: dev %d\n", ab->hw_rev);
- return -ENODEV;
- }
- ab->ipci.qgic_enabled = 1;
- wake_up(&ab->ipci.qgic_msi_waitq);
+ ab->ipci.gic_enabled = 1;
+ wake_up(&ab->ipci.gic_msi_waitq);
- /* qcn6122 is seen as ahb based device by driver but internallly it is pci
- * Hence configuring pci irq for qcn6122
- */
- ret = ath11k_pci_config_qgic_msi_irq(ab);
- if (ret) {
- ath11k_err(ab, "internal pci msi configuration failed: dev %d\n",
- ab->hw_rev);
- qgic2_disable_msi(ab->ipci.qgicm_id);
- }
return ret;
}
@@ -772,18 +737,20 @@ static const struct ath11k_hif_ops ath11
.config_static_window = ath11k_pci_config_static_window,
.free_irq = ath11k_internal_pci_free_irq,
.config_irq = ath11k_config_irq_internal_pci,
- .get_msi_irq = ath11k_pci_get_qgic_msi_irq,
};
static int ath11k_core_get_rproc(struct ath11k_base *ab)
{
struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab);
struct device *dev = ab->dev;
+#if LINUX_VERSION_IS_LESS(5,4,0)
+ bool multi_pd_arch;
const char *name;
+#endif
struct rproc *prproc;
phandle rproc_phandle;
- bool multi_pd_arch;
+#if LINUX_VERSION_IS_LESS(5,4,0)
multi_pd_arch = of_property_read_bool(dev->of_node, "qcom,multipd_arch");
if (multi_pd_arch) {
if (of_property_read_string(dev->of_node, "qcom,userpd-subsys-name", &name))
@@ -795,6 +762,7 @@ static int ath11k_core_get_rproc(struct
return -EINVAL;
}
} else {
+#endif
if (of_property_read_u32(dev->of_node, "qcom,rproc", &rproc_phandle)) {
ath11k_err(ab, "failed to get q6_rproc handle\n");
return -ENOENT;
@@ -805,7 +773,9 @@ static int ath11k_core_get_rproc(struct
ath11k_err(ab, "failed to get rproc\n");
return -EINVAL;
}
+#if LINUX_VERSION_IS_LESS(5,4,0)
}
+#endif
ab_ahb->tgt_rproc = prproc;
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -1107,10 +1107,17 @@ void ce_update_tasklet_time_duration_sta
{
s64 sched_us, exec_us;
+#if LINUX_VERSION_IS_LESS(5,4,0)
sched_us = (ce_pipe->tasklet_ts.exec_entry_ts.tv64 -
ce_pipe->tasklet_ts.sched_entry_ts.tv64);
exec_us = (ce_pipe->tasklet_ts.exec_complete_ts.tv64 -
ce_pipe->tasklet_ts.exec_entry_ts.tv64);
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ sched_us = (ce_pipe->tasklet_ts.exec_entry_ts -
+ ce_pipe->tasklet_ts.sched_entry_ts);
+ exec_us = (ce_pipe->tasklet_ts.exec_complete_ts -
+ ce_pipe->tasklet_ts.exec_entry_ts);
+#endif
sched_us = div_s64(sched_us, CE_TIME_DURATION_USEC * NSEC_PER_USEC);
if (sched_us > CE_TIME_DURATION_USEC_500) {
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -848,10 +848,9 @@ struct ath11k_num_vdevs_peers {
struct ath11k_internal_pci {
int qgicm_id;
- bool qgic_enabled;
- struct qgic2_msi *qgic2_msi;
const struct ath11k_msi_config *msi_cfg;
- wait_queue_head_t qgic_msi_waitq;
+ bool gic_enabled;
+ wait_queue_head_t gic_msi_waitq;
};
struct ath11k_memory_stats {
--- a/drivers/net/wireless/ath/ath11k/coredump.c
+++ b/drivers/net/wireless/ath/ath11k/coredump.c
@@ -174,7 +174,11 @@ void ath11k_coredump_download_rddm(struc
struct ath11k_dump_segment *segment, *seg_info;
int i, rem_seg_cnt = 0, len, num_seg, seg_sz, qdss_seg_cnt = 1;
+#if LINUX_VERSION_IS_LESS(5,4,0)
mhi_download_rddm_img(mhi_ctrl, false);
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ mhi_download_rddm_image(mhi_ctrl, false);
+#endif
rddm_img = mhi_ctrl->rddm_image;
fw_img = mhi_ctrl->fbc_image;
--- a/drivers/net/wireless/ath/ath11k/debugfs.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs.c
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
*/
+#include <linux/of.h>
#include "debugfs.h"
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -14,7 +14,6 @@
#include "debug.h"
#include "qmi.h"
#include <linux/of.h>
-#include <soc/qcom/qgic2m.h>
#define ATH11K_PCI_BAR_NUM 0
@@ -438,23 +437,6 @@ static void ath11k_pci_sw_reset(struct a
#define MAX_MSI_IRQS 32
-int ath11k_pci_get_qgic_msi_irq(struct ath11k_base *ab, unsigned int vector)
-{
- struct qgic2_msi *qgic2_msi = ab->ipci.qgic2_msi;
-
- if (!qgic2_msi) {
- ath11k_err(ab, "qgic2_msi is NULL\n");
- return -EINVAL;
- }
-
- if (vector >= MAX_MSI_IRQS) {
- ath11k_err(ab, "irq vector greater than MAX MSI IRQ\n");
- return -EINVAL;
- }
- return qgic2_msi->msi[vector];
-}
-EXPORT_SYMBOL(ath11k_pci_get_qgic_msi_irq);
-
int ath11k_pci_get_msi_irq(struct ath11k_base *ab, unsigned int vector)
{
struct device *dev = ab->dev;
@@ -483,13 +465,7 @@ void ath11k_pci_get_msi_address(struct a
void ath11k_pci_get_qgic_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo,
u32 *msi_addr_hi)
{
- struct qgic2_msi *qgic2_msi = ab->ipci.qgic2_msi;
-
- if (!qgic2_msi) {
- ath11k_err(ab, "qgic2_msi is NULL\n");
- return;
- }
- *msi_addr_lo = qgic2_msi->msi_gicm_addr;
+ *msi_addr_lo = 0;
*msi_addr_hi = 0;
}
EXPORT_SYMBOL(ath11k_pci_get_qgic_msi_address);
@@ -557,13 +533,7 @@ int ath11k_get_user_qgic_msi_assignment(
int *num_vectors, u32 *user_base_data,
u32 *base_vector)
{
- struct qgic2_msi *qgic2_msi = ab->ipci.qgic2_msi;
- struct ath11k_msi_config *msi_cfg = ab->ipci.msi_cfg;
-
- return ath11k_pci_get_user_msi_assignment(ab, msi_cfg,
- qgic2_msi->msi_gicm_base, user_name,
- num_vectors, user_base_data,
- base_vector);
+ return 0;
}
EXPORT_SYMBOL(ath11k_get_user_qgic_msi_assignment);
@@ -974,7 +944,11 @@ static int ath11k_pci_enable_msi(struct
num_vectors = pci_alloc_irq_vectors(ab_pci->pdev,
msi_config->total_vectors,
msi_config->total_vectors,
+#if LINUX_VERSION_IS_LESS(5,4,0)
PCI_IRQ_NOMSIX);
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ PCI_IRQ_LEGACY|PCI_IRQ_MSI);
+#endif
if (num_vectors != msi_config->total_vectors) {
ath11k_err(ab, "failed to get %d MSI vectors, only %d available",
msi_config->total_vectors, num_vectors);
@@ -1313,18 +1287,6 @@ static const struct ath11k_hif_ops ath11
.get_msi_irq = ath11k_pci_get_msi_irq,
};
-int ath11k_pci_config_qgic_msi_irq(struct ath11k_base *ab)
-{
- int ret = 0;
- struct qgic2_msi *qgic2_msi = ab->ipci.qgic2_msi;
- struct ath11k_msi_config *msi_cfg = ab->ipci.msi_cfg;
-
- ret = ath11k_config_msi_irq(ab, msi_cfg,
- qgic2_msi->msi_gicm_base);
- return ret;
-}
-EXPORT_SYMBOL(ath11k_pci_config_qgic_msi_irq);
-
static int ath11k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pci_dev)
{
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -169,7 +169,6 @@ int ath11k_pci_get_user_msi_assignment(s
int ath11k_pci_get_msi_irq(struct ath11k_base *ab, unsigned int vector);
void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value);
u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset);
-int ath11k_pci_config_qgic_msi_irq(struct ath11k_base *ab);
int ath11k_pci_start(struct ath11k_base *ab);
void ath11k_pci_stop(struct ath11k_base *ab);
void ath11k_pci_ext_irq_enable(struct ath11k_base *ab);
@@ -187,7 +186,6 @@ void ath11k_pci_get_ce_msi_idx(struct at
u32 *msi_idx);
void ath11k_pci_config_static_window(struct ath11k_base *ab);
void ath11k_pci_free_irq(struct ath11k_base *ab);
-int ath11k_pci_get_qgic_msi_irq(struct ath11k_base *ab, unsigned int vector);
int ath11k_ipci_start(struct ath11k_base *ab);
void ath11k_ipci_write32(struct ath11k_base *ab, u32 offset, u32 value);
u32 ath11k_ipci_read32(struct ath11k_base *ab, u32 offset);
--- a/drivers/net/wireless/ath/ath11k/pktlog.c
+++ b/drivers/net/wireless/ath/ath11k/pktlog.c
@@ -157,7 +157,11 @@ static char *ath_pktlog_getbuf(struct at
static int pktlog_pgfault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
+#if LINUX_VERSION_IS_LESS(5,4,0)
unsigned long address = (unsigned long)vmf->virtual_address;
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ unsigned long address = vmf->address;
+#endif
if (address == 0UL)
return VM_FAULT_NOPAGE;
@@ -167,7 +171,11 @@ static int pktlog_pgfault(struct vm_are
get_page(virt_to_page(address));
vmf->page = virt_to_page(address);
+#if LINUX_VERSION_IS_LESS(5,4,0)
return VM_FAULT_MINOR;
+#elif LINUX_VERSION_IS_GEQ(5,4,0)
+ return 0;
+#endif
}
static struct vm_operations_struct pktlog_vmops = {
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -4408,18 +4408,18 @@ static const struct qmi_ops ath11k_qmi_o
.del_server = ath11k_qmi_ops_del_server,
};
-static int ath11k_wait_for_qgic_msi(struct ath11k_base *ab)
+static int ath11k_wait_for_gic_msi(struct ath11k_base *ab)
{
int timeout;
if (ab->hw_rev != ATH11K_HW_QCN6122)
return 0;
- timeout = wait_event_timeout(ab->ipci.qgic_msi_waitq,
- (ab->ipci.qgic_enabled == 1),
- ATH11K_RCV_QGIC_MSI_HDLR_DELAY);
+ timeout = wait_event_timeout(ab->ipci.gic_msi_waitq,
+ (ab->ipci.gic_enabled == 1),
+ ATH11K_RCV_GIC_MSI_HDLR_DELAY);
if (timeout <= 0) {
- ath11k_warn(ab, "Receive qgic msi handler timed out\n");
+ ath11k_warn(ab, "Receive gic msi handler timed out\n");
return -ETIMEDOUT;
}
return 0;
@@ -4478,7 +4478,7 @@ static void ath11k_qmi_driver_event_work
clear_bit(ATH11K_FLAG_CRASH_FLUSH,
&ab->dev_flags);
clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
- ret = ath11k_wait_for_qgic_msi(ab);
+ ret = ath11k_wait_for_gic_msi(ab);
if (ret) {
ath11k_warn(ab,
"Failed to get qgic handler for dev %d ret: %d\n",
@@ -4607,7 +4607,7 @@ int ath11k_qmi_init_service(struct ath11
destroy_workqueue(ab->qmi.event_wq);
return ret;
}
- init_waitqueue_head(&ab->ipci.qgic_msi_waitq);
+ init_waitqueue_head(&ab->ipci.gic_msi_waitq);
return ret;
}
--- a/drivers/net/wireless/ath/ath11k/qmi.h
+++ b/drivers/net/wireless/ath/ath11k/qmi.h
@@ -63,7 +63,7 @@
#define QCN6122_USERPD_0 1
#define QCN6122_USERPD_1 2
#define QCN6122_DEVICE_BAR_SIZE 0x200000
-#define ATH11K_RCV_QGIC_MSI_HDLR_DELAY (3 * HZ)
+#define ATH11K_RCV_GIC_MSI_HDLR_DELAY (3 * HZ)
struct ath11k_base;
extern unsigned int ath11k_host_ddr_addr;