]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ath11k: add simple PCI client driver for QCA6390 chipset
authorGovind Singh <govinds@codeaurora.org>
Thu, 13 Aug 2020 09:04:20 +0000 (12:04 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 17 Aug 2020 10:07:00 +0000 (13:07 +0300)
QCA6390 is a PCI based 11ax chipset, split AHB into own kernel module
ath11k_ahb.ko and add ath11k_pci.ko for PCI devices.

Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01238-QCAHKSWPL_SILICONZ-2

Signed-off-by: Govind Singh <govinds@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1597309466-19688-5-git-send-email-kvalo@codeaurora.org
drivers/net/wireless/ath/ath11k/Kconfig
drivers/net/wireless/ath/ath11k/Makefile
drivers/net/wireless/ath/ath11k/ahb.c
drivers/net/wireless/ath/ath11k/ce.c
drivers/net/wireless/ath/ath11k/core.c
drivers/net/wireless/ath/ath11k/debug.c
drivers/net/wireless/ath/ath11k/dp.c
drivers/net/wireless/ath/ath11k/hal.c
drivers/net/wireless/ath/ath11k/hif.h
drivers/net/wireless/ath/ath11k/pci.c [new file with mode: 0644]

index 0fd44d83e0e9c3c5eebc9f563812f4d1a1024a89..2a792ddd6fea580dbd3dea68051b6843a89be2a0 100644 (file)
@@ -12,6 +12,18 @@ config ATH11K
 
          If you choose to build a module, it'll be called ath11k.
 
+config ATH11K_AHB
+       tristate "Atheros ath11k AHB support"
+       depends on ATH11K
+       help
+         This module adds support for AHB bus
+
+config ATH11K_PCI
+       tristate "Atheros ath11k PCI support"
+       depends on ATH11K && PCI
+       help
+         This module adds support for PCIE bus
+
 config ATH11K_DEBUG
        bool "QCA ath11k debugging"
        depends on ATH11K
index ee13a3becbcf9fdcf4b285adb8f3ae0462451fca..4d1807f52d9208f38b4c3cca62458a9cb45a3eb3 100644 (file)
@@ -4,7 +4,6 @@ ath11k-y += core.o \
            hal.o \
            hal_tx.o \
            hal_rx.o \
-           ahb.o \
            wmi.o \
            mac.o \
            reg.o \
@@ -25,5 +24,11 @@ ath11k-$(CONFIG_ATH11K_TRACING) += trace.o
 ath11k-$(CONFIG_THERMAL) += thermal.o
 ath11k-$(CONFIG_ATH11K_SPECTRAL) += spectral.o
 
+obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o
+ath11k_ahb-y += ahb.o
+
+obj-$(CONFIG_ATH11K_PCI) += ath11k_pci.o
+ath11k_pci-y += pci.o
+
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
index e3228a4f485fb170a0e7f5079094b0299c763812..042019de0a8133c1fa4493dd09df1eb8c5ae7d07 100644 (file)
@@ -952,5 +952,5 @@ static void ath11k_ahb_exit(void)
 }
 module_exit(ath11k_ahb_exit);
 
-MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax wireless chip");
+MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN AHB devices");
 MODULE_LICENSE("Dual BSD/GPL");
index cdd40c8fc8671a1640c05435950d8817267b8eed..7ae1bef0ab300ce6c4aff6a6f78ceba4e0fb99af 100644 (file)
@@ -752,6 +752,7 @@ void ath11k_ce_free_pipes(struct ath11k_base *ab)
                }
        }
 }
+EXPORT_SYMBOL(ath11k_ce_free_pipes);
 
 int ath11k_ce_alloc_pipes(struct ath11k_base *ab)
 {
@@ -806,3 +807,4 @@ int ath11k_ce_get_attr_flags(int ce_id)
 
        return host_ce_config_wlan[ce_id].flags;
 }
+EXPORT_SYMBOL(ath11k_ce_get_attr_flags);
index 5638f0731634f6adef2a416cbe6a6737a6196038..2dfbe4276514e38da08bb87ec43ce8724777097e 100644 (file)
@@ -14,6 +14,7 @@
 #include "hif.h"
 
 unsigned int ath11k_debug_mask;
+EXPORT_SYMBOL(ath11k_debug_mask);
 module_param_named(debug_mask, ath11k_debug_mask, uint, 0644);
 MODULE_PARM_DESC(debug_mask, "Debugging mask");
 
@@ -788,11 +789,13 @@ void ath11k_core_deinit(struct ath11k_base *ab)
        ath11k_mac_destroy(ab);
        ath11k_core_soc_destroy(ab);
 }
+EXPORT_SYMBOL(ath11k_core_deinit);
 
 void ath11k_core_free(struct ath11k_base *ab)
 {
        kfree(ab);
 }
+EXPORT_SYMBOL(ath11k_core_free);
 
 struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
                                      enum ath11k_bus bus)
@@ -825,3 +828,7 @@ err_sc_free:
        kfree(ab);
        return NULL;
 }
+EXPORT_SYMBOL(ath11k_core_alloc);
+
+MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11ax wireless LAN cards.");
+MODULE_LICENSE("Dual BSD/GPL");
index 62a1aa0565a90a6fe0bfdeb3ef26412457ab6617..60b961e591897dfa0d8ae40c43b2e15f7b6c2e83 100644 (file)
@@ -62,6 +62,7 @@ void ath11k_info(struct ath11k_base *ab, const char *fmt, ...)
        /* TODO: Trace the log */
        va_end(args);
 }
+EXPORT_SYMBOL(ath11k_info);
 
 void ath11k_err(struct ath11k_base *ab, const char *fmt, ...)
 {
@@ -76,6 +77,7 @@ void ath11k_err(struct ath11k_base *ab, const char *fmt, ...)
        /* TODO: Trace the log */
        va_end(args);
 }
+EXPORT_SYMBOL(ath11k_err);
 
 void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...)
 {
@@ -90,6 +92,7 @@ void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...)
        /* TODO: Trace the log */
        va_end(args);
 }
+EXPORT_SYMBOL(ath11k_warn);
 
 #ifdef CONFIG_ATH11K_DEBUG
 void __ath11k_dbg(struct ath11k_base *ab, enum ath11k_debug_mask mask,
@@ -110,6 +113,7 @@ void __ath11k_dbg(struct ath11k_base *ab, enum ath11k_debug_mask mask,
 
        va_end(args);
 }
+EXPORT_SYMBOL(__ath11k_dbg);
 
 void ath11k_dbg_dump(struct ath11k_base *ab,
                     enum ath11k_debug_mask mask,
@@ -138,6 +142,7 @@ void ath11k_dbg_dump(struct ath11k_base *ab,
                }
        }
 }
+EXPORT_SYMBOL(ath11k_dbg_dump);
 
 #endif
 
index 73fcb4f7f3c47433e7af0c712fe566ab084b4c46..d6a2fd5e641c5443ec3d2acf5d3eb398320344db 100644 (file)
@@ -7,6 +7,7 @@
 #include "core.h"
 #include "dp_tx.h"
 #include "hal_tx.h"
+#include "hif.h"
 #include "debug.h"
 #include "dp_rx.h"
 #include "peer.h"
index d63785178afab3e962841632d59d51d079b52dc2..c7b26478d3e76d102d602594ce932a55f14781a1 100644 (file)
@@ -1133,6 +1133,7 @@ void ath11k_hal_srng_deinit(struct ath11k_base *ab)
        ath11k_hal_free_cont_rdp(ab);
        ath11k_hal_free_cont_wrp(ab);
 }
+EXPORT_SYMBOL(ath11k_hal_srng_deinit);
 
 void ath11k_hal_dump_srng_stats(struct ath11k_base *ab)
 {
index 165f7e51c2382945bc2400482fad25461379920a..48ee55cebc811f37a01ccd8890a66a16368d3273 100644 (file)
@@ -3,6 +3,9 @@
  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
  */
 
+#ifndef _HIF_H_
+#define _HIF_H_
+
 #include "core.h"
 
 struct ath11k_hif_ops {
@@ -63,3 +66,4 @@ static inline int ath11k_hif_map_service_to_pipe(struct ath11k_base *sc, u16 ser
 {
        return sc->hif.ops->map_service_to_pipe(sc, service_id, ul_pipe, dl_pipe);
 }
+#endif /* _HIF_H_ */
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
new file mode 100644 (file)
index 0000000..a88536d
--- /dev/null
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: BSD-3-Clause-Clear
+/*
+ * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/module.h>
+#include <linux/pci.h>
+
+#include "core.h"
+#include "debug.h"
+
+#define QCA6390_DEVICE_ID              0x1101
+
+static const struct pci_device_id ath11k_pci_id_table[] = {
+       { PCI_VDEVICE(QCOM, QCA6390_DEVICE_ID) },
+       {0}
+};
+
+MODULE_DEVICE_TABLE(pci, ath11k_pci_id_table);
+
+static int ath11k_pci_probe(struct pci_dev *pdev,
+                           const struct pci_device_id *pci_dev)
+{
+       struct ath11k_base *ab;
+       enum ath11k_hw_rev hw_rev;
+
+       dev_warn(&pdev->dev, "WARNING: ath11k PCI support is experimental!\n");
+
+       switch (pci_dev->device) {
+       case QCA6390_DEVICE_ID:
+               hw_rev = ATH11K_HW_QCA6390_HW20;
+               break;
+       default:
+               dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n",
+                       pci_dev->device);
+               return -ENOTSUPP;
+       }
+
+       ab = ath11k_core_alloc(&pdev->dev, 0, ATH11K_BUS_PCI);
+       if (!ab) {
+               dev_err(&pdev->dev, "failed to allocate ath11k base\n");
+               return -ENOMEM;
+       }
+
+       ab->dev = &pdev->dev;
+       ab->hw_rev = hw_rev;
+       pci_set_drvdata(pdev, ab);
+
+       return 0;
+}
+
+static void ath11k_pci_remove(struct pci_dev *pdev)
+{
+       struct ath11k_base *ab = pci_get_drvdata(pdev);
+
+       set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
+       ath11k_core_free(ab);
+}
+
+static struct pci_driver ath11k_pci_driver = {
+       .name = "ath11k_pci",
+       .id_table = ath11k_pci_id_table,
+       .probe = ath11k_pci_probe,
+       .remove = ath11k_pci_remove,
+};
+
+static int ath11k_pci_init(void)
+{
+       int ret;
+
+       ret = pci_register_driver(&ath11k_pci_driver);
+       if (ret)
+               pr_err("failed to register ath11k pci driver: %d\n",
+                      ret);
+
+       return ret;
+}
+module_init(ath11k_pci_init);
+
+static void ath11k_pci_exit(void)
+{
+       pci_unregister_driver(&ath11k_pci_driver);
+}
+
+module_exit(ath11k_pci_exit);
+
+MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN PCIe devices");
+MODULE_LICENSE("Dual BSD/GPL");