All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add PCI client driver for QCA6390 chipset
@ 2020-05-08  8:58 ` Govind Singh
  0 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Govind Singh

QCA6390 chipsets is PCI based 11ax chipset to be supported in ath11k.

Add PCI client driver for QCA6390 chipset with enumeration/resource initialization/msi vector mapping.
With these changes driver is splitted in two modules(bus layer module/ common core module).
This is required due to following reasons.

 1) PCI based transport layer for QCA6390 chipsets.
 2) FW loading based on MHI protocol unlike rproc in IPQ8074A.
 3) MSI based data path/CE/fw RAM dump interrupt.
 4) CE assignments is different.
 5) Different boot up sequence due to requirement of voltage regulators/bootstrap
    pinctrls for QCA6390.
 6) Clear separation in bus level operation.


For AHB based devices:
ath11k_ahb.ko
ath11k_ko

For PCI based devices:
ath11k_pci.ko
ath11k.ko

Tested HW:
	IPQ8074A
	X86 + QCA6390: pci probe/resource setup

Govind Singh (4):
  ath11k: Add PCI client driver for QCA6390 chipset
  ath11k: setup pci resource for QCA6390 target
  ath11k: Add msi config init for QCA6390
  ath11k: Register mhi controller device for qca6390

 drivers/net/wireless/ath/ath11k/Kconfig  |  13 +-
 drivers/net/wireless/ath/ath11k/Makefile |   7 +-
 drivers/net/wireless/ath/ath11k/ahb.c    |  71 -----
 drivers/net/wireless/ath/ath11k/ce.c     |   2 +
 drivers/net/wireless/ath/ath11k/core.c   |   7 +
 drivers/net/wireless/ath/ath11k/core.h   |  11 +-
 drivers/net/wireless/ath/ath11k/debug.c  |   6 +-
 drivers/net/wireless/ath/ath11k/debug.h  |   1 +
 drivers/net/wireless/ath/ath11k/dp.c     |   1 +
 drivers/net/wireless/ath/ath11k/hal.c    |   1 +
 drivers/net/wireless/ath/ath11k/hif.h    |  77 ++++-
 drivers/net/wireless/ath/ath11k/mhi.c    | 379 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/mhi.h    |  28 ++
 drivers/net/wireless/ath/ath11k/pci.c    | 385 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/pci.h    |  49 +++
 15 files changed, 954 insertions(+), 84 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.c
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.h
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.c
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.h

-- 
2.22.0

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/4] Add PCI client driver for QCA6390 chipset
@ 2020-05-08  8:58 ` Govind Singh
  0 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: Govind Singh, linux-wireless

QCA6390 chipsets is PCI based 11ax chipset to be supported in ath11k.

Add PCI client driver for QCA6390 chipset with enumeration/resource initialization/msi vector mapping.
With these changes driver is splitted in two modules(bus layer module/ common core module).
This is required due to following reasons.

 1) PCI based transport layer for QCA6390 chipsets.
 2) FW loading based on MHI protocol unlike rproc in IPQ8074A.
 3) MSI based data path/CE/fw RAM dump interrupt.
 4) CE assignments is different.
 5) Different boot up sequence due to requirement of voltage regulators/bootstrap
    pinctrls for QCA6390.
 6) Clear separation in bus level operation.


For AHB based devices:
ath11k_ahb.ko
ath11k_ko

For PCI based devices:
ath11k_pci.ko
ath11k.ko

Tested HW:
	IPQ8074A
	X86 + QCA6390: pci probe/resource setup

Govind Singh (4):
  ath11k: Add PCI client driver for QCA6390 chipset
  ath11k: setup pci resource for QCA6390 target
  ath11k: Add msi config init for QCA6390
  ath11k: Register mhi controller device for qca6390

 drivers/net/wireless/ath/ath11k/Kconfig  |  13 +-
 drivers/net/wireless/ath/ath11k/Makefile |   7 +-
 drivers/net/wireless/ath/ath11k/ahb.c    |  71 -----
 drivers/net/wireless/ath/ath11k/ce.c     |   2 +
 drivers/net/wireless/ath/ath11k/core.c   |   7 +
 drivers/net/wireless/ath/ath11k/core.h   |  11 +-
 drivers/net/wireless/ath/ath11k/debug.c  |   6 +-
 drivers/net/wireless/ath/ath11k/debug.h  |   1 +
 drivers/net/wireless/ath/ath11k/dp.c     |   1 +
 drivers/net/wireless/ath/ath11k/hal.c    |   1 +
 drivers/net/wireless/ath/ath11k/hif.h    |  77 ++++-
 drivers/net/wireless/ath/ath11k/mhi.c    | 379 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/mhi.h    |  28 ++
 drivers/net/wireless/ath/ath11k/pci.c    | 385 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/pci.h    |  49 +++
 15 files changed, 954 insertions(+), 84 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.c
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.h
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.c
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.h

-- 
2.22.0

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/4] ath11k: Add PCI client driver for QCA6390 chipset
  2020-05-08  8:58 ` Govind Singh
@ 2020-05-08  8:58   ` Govind Singh
  -1 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Govind Singh

QCA6390 is PCI based 11ax chipset, add
pci client driver for QCA6390 target.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/Kconfig  | 12 ++++
 drivers/net/wireless/ath/ath11k/Makefile |  7 +-
 drivers/net/wireless/ath/ath11k/ahb.c    | 71 -------------------
 drivers/net/wireless/ath/ath11k/ce.c     |  2 +
 drivers/net/wireless/ath/ath11k/core.c   |  6 ++
 drivers/net/wireless/ath/ath11k/core.h   | 11 +--
 drivers/net/wireless/ath/ath11k/debug.c  |  6 +-
 drivers/net/wireless/ath/ath11k/dp.c     |  1 +
 drivers/net/wireless/ath/ath11k/hal.c    |  1 +
 drivers/net/wireless/ath/ath11k/hif.h    | 77 +++++++++++++++++++-
 drivers/net/wireless/ath/ath11k/pci.c    | 90 ++++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/pci.h    | 10 +++
 12 files changed, 211 insertions(+), 83 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.c
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.h

diff --git a/drivers/net/wireless/ath/ath11k/Kconfig b/drivers/net/wireless/ath/ath11k/Kconfig
index 738f99090d83..320b3b151bce 100644
--- a/drivers/net/wireless/ath/ath11k/Kconfig
+++ b/drivers/net/wireless/ath/ath11k/Kconfig
@@ -13,6 +13,18 @@ config ATH11K
 
 	  If you choose to build a module, it'll be called ath11k.
 
+config ATH11K_AHB
+	tristate "Qualcomm Technologies 802.11ax chipset AHB support"
+	depends on ATH11K
+	---help---
+	  This module adds support for AHB bus
+
+config ATH11K_PCI
+	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
+	depends on ATH11K && PCI
+	---help---
+	  This module adds support for PCIE bus
+
 config ATH11K_DEBUG
 	bool "QCA ath11k debugging"
 	depends on ATH11K
diff --git a/drivers/net/wireless/ath/ath11k/Makefile b/drivers/net/wireless/ath/ath11k/Makefile
index fe7736e53583..933fcb2fd55d 100644
--- a/drivers/net/wireless/ath/ath11k/Makefile
+++ b/drivers/net/wireless/ath/ath11k/Makefile
@@ -4,7 +4,6 @@ ath11k-y += core.o \
 	    hal.o \
 	    hal_tx.o \
 	    hal_rx.o \
-	    ahb.o \
 	    wmi.o \
 	    mac.o \
 	    reg.o \
@@ -22,5 +21,11 @@ ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o
 ath11k-$(CONFIG_ATH11K_TRACING) += trace.o
 ath11k-$(CONFIG_THERMAL) += thermal.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)
diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c
index 19cda6bfe9b7..43950367fc1a 100644
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -321,77 +321,6 @@ static const char *irq_name[ATH11K_IRQ_NUM_MAX] = {
 	"tcl2host-status-ring",
 };
 
-#define ATH11K_TX_RING_MASK_0 0x1
-#define ATH11K_TX_RING_MASK_1 0x2
-#define ATH11K_TX_RING_MASK_2 0x4
-
-#define ATH11K_RX_RING_MASK_0 0x1
-#define ATH11K_RX_RING_MASK_1 0x2
-#define ATH11K_RX_RING_MASK_2 0x4
-#define ATH11K_RX_RING_MASK_3 0x8
-
-#define ATH11K_RX_ERR_RING_MASK_0 0x1
-
-#define ATH11K_RX_WBM_REL_RING_MASK_0 0x1
-
-#define ATH11K_REO_STATUS_RING_MASK_0 0x1
-
-#define ATH11K_RXDMA2HOST_RING_MASK_0 0x1
-#define ATH11K_RXDMA2HOST_RING_MASK_1 0x2
-#define ATH11K_RXDMA2HOST_RING_MASK_2 0x4
-
-#define ATH11K_HOST2RXDMA_RING_MASK_0 0x1
-#define ATH11K_HOST2RXDMA_RING_MASK_1 0x2
-#define ATH11K_HOST2RXDMA_RING_MASK_2 0x4
-
-#define ATH11K_RX_MON_STATUS_RING_MASK_0 0x1
-#define ATH11K_RX_MON_STATUS_RING_MASK_1 0x2
-#define ATH11K_RX_MON_STATUS_RING_MASK_2 0x4
-
-const u8 ath11k_tx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_TX_RING_MASK_0,
-	ATH11K_TX_RING_MASK_1,
-	ATH11K_TX_RING_MASK_2,
-};
-
-const u8 rx_mon_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	0, 0, 0, 0,
-	ATH11K_RX_MON_STATUS_RING_MASK_0,
-	ATH11K_RX_MON_STATUS_RING_MASK_1,
-	ATH11K_RX_MON_STATUS_RING_MASK_2,
-};
-
-const u8 ath11k_rx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	0, 0, 0, 0, 0, 0, 0,
-	ATH11K_RX_RING_MASK_0,
-	ATH11K_RX_RING_MASK_1,
-	ATH11K_RX_RING_MASK_2,
-	ATH11K_RX_RING_MASK_3,
-};
-
-const u8 ath11k_rx_err_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_RX_ERR_RING_MASK_0,
-};
-
-const u8 ath11k_rx_wbm_rel_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_RX_WBM_REL_RING_MASK_0,
-};
-
-const u8 ath11k_reo_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_REO_STATUS_RING_MASK_0,
-};
-
-const u8 ath11k_rxdma2host_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_RXDMA2HOST_RING_MASK_0,
-	ATH11K_RXDMA2HOST_RING_MASK_1,
-	ATH11K_RXDMA2HOST_RING_MASK_2,
-};
-
-const u8 ath11k_host2rxdma_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_HOST2RXDMA_RING_MASK_0,
-	ATH11K_HOST2RXDMA_RING_MASK_1,
-	ATH11K_HOST2RXDMA_RING_MASK_2,
-};
 
 /* enum ext_irq_num - irq numbers that can be used by external modules
  * like datapath
diff --git a/drivers/net/wireless/ath/ath11k/ce.c b/drivers/net/wireless/ath/ath11k/ce.c
index cdd40c8fc867..7ae1bef0ab30 100644
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -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);
diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 02501cc154fe..8d07a2bb31bb 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -749,11 +749,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)
@@ -786,3 +788,7 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 	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");
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index e04f0e711779..757302992ce5 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -88,6 +88,8 @@ struct ath11k_skb_rxcb {
 
 enum ath11k_hw_rev {
 	ATH11K_HW_IPQ8074,
+	ATH11K_HW_QCA6290,
+	ATH11K_HW_QCA6390,
 };
 
 enum ath11k_firmware_mode {
@@ -102,15 +104,6 @@ enum ath11k_firmware_mode {
 #define ATH11K_EXT_IRQ_GRP_NUM_MAX 11
 #define ATH11K_EXT_IRQ_NUM_MAX	16
 
-extern const u8 ath11k_reo_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_tx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_rx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_rx_err_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_rx_wbm_rel_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_rxdma2host_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_host2rxdma_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 rx_mon_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-
 struct ath11k_ext_irq_grp {
 	struct ath11k_base *ab;
 	u32 irqs[ATH11K_EXT_IRQ_NUM_MAX];
diff --git a/drivers/net/wireless/ath/ath11k/debug.c b/drivers/net/wireless/ath/ath11k/debug.c
index 3fd6b5af073b..eba7a5471ead 100644
--- a/drivers/net/wireless/ath/ath11k/debug.c
+++ b/drivers/net/wireless/ath/ath11k/debug.c
@@ -25,6 +25,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, ...)
 {
@@ -39,6 +40,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, ...)
 {
@@ -53,6 +55,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,
@@ -73,6 +76,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,
@@ -101,7 +105,7 @@ void ath11k_dbg_dump(struct ath11k_base *ab,
 		}
 	}
 }
-
+EXPORT_SYMBOL(ath11k_dbg_dump);
 #endif
 
 #ifdef CONFIG_ATH11K_DEBUGFS
diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c
index 9ae743e528af..30e78a96ef6d 100644
--- a/drivers/net/wireless/ath/ath11k/dp.c
+++ b/drivers/net/wireless/ath/ath11k/dp.c
@@ -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"
diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c
index d63785178afa..c7b26478d3e7 100644
--- a/drivers/net/wireless/ath/ath11k/hal.c
+++ b/drivers/net/wireless/ath/ath11k/hal.c
@@ -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)
 {
diff --git a/drivers/net/wireless/ath/ath11k/hif.h b/drivers/net/wireless/ath/ath11k/hif.h
index 165f7e51c238..7e74be42e0fb 100644
--- a/drivers/net/wireless/ath/ath11k/hif.h
+++ b/drivers/net/wireless/ath/ath11k/hif.h
@@ -3,7 +3,81 @@
  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
  */
 
-#include "core.h"
+#ifndef _HIF_H_
+#define _HIF_H_
+
+#define ATH11K_TX_RING_MASK_0 0x1
+#define ATH11K_TX_RING_MASK_1 0x2
+#define ATH11K_TX_RING_MASK_2 0x4
+
+#define ATH11K_RX_RING_MASK_0 0x1
+#define ATH11K_RX_RING_MASK_1 0x2
+#define ATH11K_RX_RING_MASK_2 0x4
+#define ATH11K_RX_RING_MASK_3 0x8
+
+#define ATH11K_RX_ERR_RING_MASK_0 0x1
+
+#define ATH11K_RX_WBM_REL_RING_MASK_0 0x1
+
+#define ATH11K_REO_STATUS_RING_MASK_0 0x1
+
+#define ATH11K_RXDMA2HOST_RING_MASK_0 0x1
+#define ATH11K_RXDMA2HOST_RING_MASK_1 0x2
+#define ATH11K_RXDMA2HOST_RING_MASK_2 0x4
+
+#define ATH11K_HOST2RXDMA_RING_MASK_0 0x1
+#define ATH11K_HOST2RXDMA_RING_MASK_1 0x2
+#define ATH11K_HOST2RXDMA_RING_MASK_2 0x4
+
+#define ATH11K_RX_MON_STATUS_RING_MASK_0 0x1
+#define ATH11K_RX_MON_STATUS_RING_MASK_1 0x2
+#define ATH11K_RX_MON_STATUS_RING_MASK_2 0x4
+
+static const u8 ath11k_tx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_TX_RING_MASK_0,
+	ATH11K_TX_RING_MASK_1,
+	ATH11K_TX_RING_MASK_2,
+};
+
+static const u8 rx_mon_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	0, 0, 0, 0,
+	ATH11K_RX_MON_STATUS_RING_MASK_0,
+	ATH11K_RX_MON_STATUS_RING_MASK_1,
+	ATH11K_RX_MON_STATUS_RING_MASK_2,
+};
+
+static const u8 ath11k_rx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	0, 0, 0, 0, 0, 0, 0,
+	ATH11K_RX_RING_MASK_0,
+	ATH11K_RX_RING_MASK_1,
+	ATH11K_RX_RING_MASK_2,
+	ATH11K_RX_RING_MASK_3,
+};
+
+static const u8 ath11k_rx_err_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_RX_ERR_RING_MASK_0,
+};
+
+static const u8 ath11k_rx_wbm_rel_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_RX_WBM_REL_RING_MASK_0,
+};
+
+static const u8 ath11k_reo_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_REO_STATUS_RING_MASK_0,
+};
+
+static const u8 ath11k_rxdma2host_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_RXDMA2HOST_RING_MASK_0,
+	ATH11K_RXDMA2HOST_RING_MASK_1,
+	ATH11K_RXDMA2HOST_RING_MASK_2,
+};
+
+static const u8 ath11k_host2rxdma_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_HOST2RXDMA_RING_MASK_0,
+	ATH11K_HOST2RXDMA_RING_MASK_1,
+	ATH11K_HOST2RXDMA_RING_MASK_2,
+};
+
 
 struct ath11k_hif_ops {
 	u32 (*read32)(struct ath11k_base *sc, u32 address);
@@ -63,3 +137,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
index 000000000000..582e7cd3c56e
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -0,0 +1,90 @@
+// 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 "pci.h"
+#include "debug.h"
+
+static const struct pci_device_id ath11k_pci_id_table[] = {
+	{ QCA6290_VENDOR_ID, QCA6290_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+	{ QCA6390_VENDOR_ID, QCA6390_DEVICE_ID, PCI_ANY_ID, PCI_ANY_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;
+	int ret;
+
+	switch (pci_dev->device) {
+	case QCA6290_DEVICE_ID:
+		hw_rev = ATH11K_HW_QCA6290;
+	case QCA6390_DEVICE_ID:
+		hw_rev = ATH11K_HW_QCA6390;
+		break;
+	default:
+		dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n",
+			pci_dev->device);
+		WARN_ON(1);
+		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 ret;
+}
+
+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 Atheros 802.11ax WLAN PCIe devices");
+MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath11k/pci.h b/drivers/net/wireless/ath/ath11k/pci.h
new file mode 100644
index 000000000000..790b8993d225
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ */
+
+#define QCA6290_VENDOR_ID		0x17CB
+#define QCA6290_DEVICE_ID		0x1100
+#define QCA6390_VENDOR_ID		0x17CB
+#define QCA6390_DEVICE_ID		0x1101
+
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 1/4] ath11k: Add PCI client driver for QCA6390 chipset
@ 2020-05-08  8:58   ` Govind Singh
  0 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: Govind Singh, linux-wireless

QCA6390 is PCI based 11ax chipset, add
pci client driver for QCA6390 target.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/Kconfig  | 12 ++++
 drivers/net/wireless/ath/ath11k/Makefile |  7 +-
 drivers/net/wireless/ath/ath11k/ahb.c    | 71 -------------------
 drivers/net/wireless/ath/ath11k/ce.c     |  2 +
 drivers/net/wireless/ath/ath11k/core.c   |  6 ++
 drivers/net/wireless/ath/ath11k/core.h   | 11 +--
 drivers/net/wireless/ath/ath11k/debug.c  |  6 +-
 drivers/net/wireless/ath/ath11k/dp.c     |  1 +
 drivers/net/wireless/ath/ath11k/hal.c    |  1 +
 drivers/net/wireless/ath/ath11k/hif.h    | 77 +++++++++++++++++++-
 drivers/net/wireless/ath/ath11k/pci.c    | 90 ++++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/pci.h    | 10 +++
 12 files changed, 211 insertions(+), 83 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.c
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.h

diff --git a/drivers/net/wireless/ath/ath11k/Kconfig b/drivers/net/wireless/ath/ath11k/Kconfig
index 738f99090d83..320b3b151bce 100644
--- a/drivers/net/wireless/ath/ath11k/Kconfig
+++ b/drivers/net/wireless/ath/ath11k/Kconfig
@@ -13,6 +13,18 @@ config ATH11K
 
 	  If you choose to build a module, it'll be called ath11k.
 
+config ATH11K_AHB
+	tristate "Qualcomm Technologies 802.11ax chipset AHB support"
+	depends on ATH11K
+	---help---
+	  This module adds support for AHB bus
+
+config ATH11K_PCI
+	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
+	depends on ATH11K && PCI
+	---help---
+	  This module adds support for PCIE bus
+
 config ATH11K_DEBUG
 	bool "QCA ath11k debugging"
 	depends on ATH11K
diff --git a/drivers/net/wireless/ath/ath11k/Makefile b/drivers/net/wireless/ath/ath11k/Makefile
index fe7736e53583..933fcb2fd55d 100644
--- a/drivers/net/wireless/ath/ath11k/Makefile
+++ b/drivers/net/wireless/ath/ath11k/Makefile
@@ -4,7 +4,6 @@ ath11k-y += core.o \
 	    hal.o \
 	    hal_tx.o \
 	    hal_rx.o \
-	    ahb.o \
 	    wmi.o \
 	    mac.o \
 	    reg.o \
@@ -22,5 +21,11 @@ ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o
 ath11k-$(CONFIG_ATH11K_TRACING) += trace.o
 ath11k-$(CONFIG_THERMAL) += thermal.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)
diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c
index 19cda6bfe9b7..43950367fc1a 100644
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -321,77 +321,6 @@ static const char *irq_name[ATH11K_IRQ_NUM_MAX] = {
 	"tcl2host-status-ring",
 };
 
-#define ATH11K_TX_RING_MASK_0 0x1
-#define ATH11K_TX_RING_MASK_1 0x2
-#define ATH11K_TX_RING_MASK_2 0x4
-
-#define ATH11K_RX_RING_MASK_0 0x1
-#define ATH11K_RX_RING_MASK_1 0x2
-#define ATH11K_RX_RING_MASK_2 0x4
-#define ATH11K_RX_RING_MASK_3 0x8
-
-#define ATH11K_RX_ERR_RING_MASK_0 0x1
-
-#define ATH11K_RX_WBM_REL_RING_MASK_0 0x1
-
-#define ATH11K_REO_STATUS_RING_MASK_0 0x1
-
-#define ATH11K_RXDMA2HOST_RING_MASK_0 0x1
-#define ATH11K_RXDMA2HOST_RING_MASK_1 0x2
-#define ATH11K_RXDMA2HOST_RING_MASK_2 0x4
-
-#define ATH11K_HOST2RXDMA_RING_MASK_0 0x1
-#define ATH11K_HOST2RXDMA_RING_MASK_1 0x2
-#define ATH11K_HOST2RXDMA_RING_MASK_2 0x4
-
-#define ATH11K_RX_MON_STATUS_RING_MASK_0 0x1
-#define ATH11K_RX_MON_STATUS_RING_MASK_1 0x2
-#define ATH11K_RX_MON_STATUS_RING_MASK_2 0x4
-
-const u8 ath11k_tx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_TX_RING_MASK_0,
-	ATH11K_TX_RING_MASK_1,
-	ATH11K_TX_RING_MASK_2,
-};
-
-const u8 rx_mon_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	0, 0, 0, 0,
-	ATH11K_RX_MON_STATUS_RING_MASK_0,
-	ATH11K_RX_MON_STATUS_RING_MASK_1,
-	ATH11K_RX_MON_STATUS_RING_MASK_2,
-};
-
-const u8 ath11k_rx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	0, 0, 0, 0, 0, 0, 0,
-	ATH11K_RX_RING_MASK_0,
-	ATH11K_RX_RING_MASK_1,
-	ATH11K_RX_RING_MASK_2,
-	ATH11K_RX_RING_MASK_3,
-};
-
-const u8 ath11k_rx_err_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_RX_ERR_RING_MASK_0,
-};
-
-const u8 ath11k_rx_wbm_rel_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_RX_WBM_REL_RING_MASK_0,
-};
-
-const u8 ath11k_reo_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_REO_STATUS_RING_MASK_0,
-};
-
-const u8 ath11k_rxdma2host_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_RXDMA2HOST_RING_MASK_0,
-	ATH11K_RXDMA2HOST_RING_MASK_1,
-	ATH11K_RXDMA2HOST_RING_MASK_2,
-};
-
-const u8 ath11k_host2rxdma_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
-	ATH11K_HOST2RXDMA_RING_MASK_0,
-	ATH11K_HOST2RXDMA_RING_MASK_1,
-	ATH11K_HOST2RXDMA_RING_MASK_2,
-};
 
 /* enum ext_irq_num - irq numbers that can be used by external modules
  * like datapath
diff --git a/drivers/net/wireless/ath/ath11k/ce.c b/drivers/net/wireless/ath/ath11k/ce.c
index cdd40c8fc867..7ae1bef0ab30 100644
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -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);
diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 02501cc154fe..8d07a2bb31bb 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -749,11 +749,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)
@@ -786,3 +788,7 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 	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");
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index e04f0e711779..757302992ce5 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -88,6 +88,8 @@ struct ath11k_skb_rxcb {
 
 enum ath11k_hw_rev {
 	ATH11K_HW_IPQ8074,
+	ATH11K_HW_QCA6290,
+	ATH11K_HW_QCA6390,
 };
 
 enum ath11k_firmware_mode {
@@ -102,15 +104,6 @@ enum ath11k_firmware_mode {
 #define ATH11K_EXT_IRQ_GRP_NUM_MAX 11
 #define ATH11K_EXT_IRQ_NUM_MAX	16
 
-extern const u8 ath11k_reo_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_tx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_rx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_rx_err_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_rx_wbm_rel_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_rxdma2host_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 ath11k_host2rxdma_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-extern const u8 rx_mon_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX];
-
 struct ath11k_ext_irq_grp {
 	struct ath11k_base *ab;
 	u32 irqs[ATH11K_EXT_IRQ_NUM_MAX];
diff --git a/drivers/net/wireless/ath/ath11k/debug.c b/drivers/net/wireless/ath/ath11k/debug.c
index 3fd6b5af073b..eba7a5471ead 100644
--- a/drivers/net/wireless/ath/ath11k/debug.c
+++ b/drivers/net/wireless/ath/ath11k/debug.c
@@ -25,6 +25,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, ...)
 {
@@ -39,6 +40,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, ...)
 {
@@ -53,6 +55,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,
@@ -73,6 +76,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,
@@ -101,7 +105,7 @@ void ath11k_dbg_dump(struct ath11k_base *ab,
 		}
 	}
 }
-
+EXPORT_SYMBOL(ath11k_dbg_dump);
 #endif
 
 #ifdef CONFIG_ATH11K_DEBUGFS
diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c
index 9ae743e528af..30e78a96ef6d 100644
--- a/drivers/net/wireless/ath/ath11k/dp.c
+++ b/drivers/net/wireless/ath/ath11k/dp.c
@@ -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"
diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c
index d63785178afa..c7b26478d3e7 100644
--- a/drivers/net/wireless/ath/ath11k/hal.c
+++ b/drivers/net/wireless/ath/ath11k/hal.c
@@ -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)
 {
diff --git a/drivers/net/wireless/ath/ath11k/hif.h b/drivers/net/wireless/ath/ath11k/hif.h
index 165f7e51c238..7e74be42e0fb 100644
--- a/drivers/net/wireless/ath/ath11k/hif.h
+++ b/drivers/net/wireless/ath/ath11k/hif.h
@@ -3,7 +3,81 @@
  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
  */
 
-#include "core.h"
+#ifndef _HIF_H_
+#define _HIF_H_
+
+#define ATH11K_TX_RING_MASK_0 0x1
+#define ATH11K_TX_RING_MASK_1 0x2
+#define ATH11K_TX_RING_MASK_2 0x4
+
+#define ATH11K_RX_RING_MASK_0 0x1
+#define ATH11K_RX_RING_MASK_1 0x2
+#define ATH11K_RX_RING_MASK_2 0x4
+#define ATH11K_RX_RING_MASK_3 0x8
+
+#define ATH11K_RX_ERR_RING_MASK_0 0x1
+
+#define ATH11K_RX_WBM_REL_RING_MASK_0 0x1
+
+#define ATH11K_REO_STATUS_RING_MASK_0 0x1
+
+#define ATH11K_RXDMA2HOST_RING_MASK_0 0x1
+#define ATH11K_RXDMA2HOST_RING_MASK_1 0x2
+#define ATH11K_RXDMA2HOST_RING_MASK_2 0x4
+
+#define ATH11K_HOST2RXDMA_RING_MASK_0 0x1
+#define ATH11K_HOST2RXDMA_RING_MASK_1 0x2
+#define ATH11K_HOST2RXDMA_RING_MASK_2 0x4
+
+#define ATH11K_RX_MON_STATUS_RING_MASK_0 0x1
+#define ATH11K_RX_MON_STATUS_RING_MASK_1 0x2
+#define ATH11K_RX_MON_STATUS_RING_MASK_2 0x4
+
+static const u8 ath11k_tx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_TX_RING_MASK_0,
+	ATH11K_TX_RING_MASK_1,
+	ATH11K_TX_RING_MASK_2,
+};
+
+static const u8 rx_mon_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	0, 0, 0, 0,
+	ATH11K_RX_MON_STATUS_RING_MASK_0,
+	ATH11K_RX_MON_STATUS_RING_MASK_1,
+	ATH11K_RX_MON_STATUS_RING_MASK_2,
+};
+
+static const u8 ath11k_rx_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	0, 0, 0, 0, 0, 0, 0,
+	ATH11K_RX_RING_MASK_0,
+	ATH11K_RX_RING_MASK_1,
+	ATH11K_RX_RING_MASK_2,
+	ATH11K_RX_RING_MASK_3,
+};
+
+static const u8 ath11k_rx_err_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_RX_ERR_RING_MASK_0,
+};
+
+static const u8 ath11k_rx_wbm_rel_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_RX_WBM_REL_RING_MASK_0,
+};
+
+static const u8 ath11k_reo_status_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_REO_STATUS_RING_MASK_0,
+};
+
+static const u8 ath11k_rxdma2host_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_RXDMA2HOST_RING_MASK_0,
+	ATH11K_RXDMA2HOST_RING_MASK_1,
+	ATH11K_RXDMA2HOST_RING_MASK_2,
+};
+
+static const u8 ath11k_host2rxdma_ring_mask[ATH11K_EXT_IRQ_GRP_NUM_MAX] = {
+	ATH11K_HOST2RXDMA_RING_MASK_0,
+	ATH11K_HOST2RXDMA_RING_MASK_1,
+	ATH11K_HOST2RXDMA_RING_MASK_2,
+};
+
 
 struct ath11k_hif_ops {
 	u32 (*read32)(struct ath11k_base *sc, u32 address);
@@ -63,3 +137,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
index 000000000000..582e7cd3c56e
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -0,0 +1,90 @@
+// 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 "pci.h"
+#include "debug.h"
+
+static const struct pci_device_id ath11k_pci_id_table[] = {
+	{ QCA6290_VENDOR_ID, QCA6290_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID },
+	{ QCA6390_VENDOR_ID, QCA6390_DEVICE_ID, PCI_ANY_ID, PCI_ANY_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;
+	int ret;
+
+	switch (pci_dev->device) {
+	case QCA6290_DEVICE_ID:
+		hw_rev = ATH11K_HW_QCA6290;
+	case QCA6390_DEVICE_ID:
+		hw_rev = ATH11K_HW_QCA6390;
+		break;
+	default:
+		dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n",
+			pci_dev->device);
+		WARN_ON(1);
+		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 ret;
+}
+
+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 Atheros 802.11ax WLAN PCIe devices");
+MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath11k/pci.h b/drivers/net/wireless/ath/ath11k/pci.h
new file mode 100644
index 000000000000..790b8993d225
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ */
+
+#define QCA6290_VENDOR_ID		0x17CB
+#define QCA6290_DEVICE_ID		0x1100
+#define QCA6390_VENDOR_ID		0x17CB
+#define QCA6390_DEVICE_ID		0x1101
+
-- 
2.22.0

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/4] ath11k: setup pci resource for QCA6390 target
  2020-05-08  8:58 ` Govind Singh
@ 2020-05-08  8:58   ` Govind Singh
  -1 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Govind Singh

Add support for setting up pci region and dma mask
for QCA6390 target.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/core.c |   1 +
 drivers/net/wireless/ath/ath11k/pci.c  | 109 ++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath11k/pci.h  |  12 +++
 3 files changed, 121 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 8d07a2bb31bb..4c3f5a9d0d8a 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -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");
 
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index 582e7cd3c56e..6ab9e25c4ff9 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -6,6 +6,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 
+#include "ahb.h"
 #include "core.h"
 #include "pci.h"
 #include "debug.h"
@@ -18,10 +19,98 @@ static const struct pci_device_id ath11k_pci_id_table[] = {
 
 MODULE_DEVICE_TABLE(pci, ath11k_pci_id_table);
 
+static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab)
+{
+	return (struct ath11k_pci *)ab->drv_priv;
+}
+
+static int ath11k_pci_claim(struct ath11k_pci *ab_pci, struct pci_dev *pdev)
+{
+	u32 pci_dma_mask = PCI_DMA_MASK_32_BIT;
+	struct ath11k_base *ab = ab_pci->ab;
+	u16 device_id;
+	int ret = 0;
+
+	pci_read_config_word(pdev, PCI_DEVICE_ID, &device_id);
+	if (device_id != ab_pci->dev_id)  {
+		ath11k_err(ab, "pci device id mismatch, config ID: 0x%x, probe ID: 0x%x\n",
+			   device_id, ab_pci->dev_id);
+		ret = -EIO;
+		goto out;
+	}
+
+	ret = pci_assign_resource(pdev, PCI_BAR_NUM);
+	if (ret) {
+		ath11k_err(ab, "failed to assign pci resource, err = %d\n", ret);
+		goto out;
+	}
+
+	ret = pci_enable_device(pdev);
+	if (ret) {
+		ath11k_err(ab, "failed to enable pci device, err = %d\n", ret);
+		goto out;
+	}
+
+	ret = pci_request_region(pdev, PCI_BAR_NUM, "ath11k_pci");
+	if (ret) {
+		ath11k_err(ab, "failed to request pci region, err = %d\n", ret);
+		goto disable_device;
+	}
+
+	ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(pci_dma_mask));
+	if (ret) {
+		ath11k_err(ab, "failed to set pci dma mask (%d), err = %d\n",
+			   ret, pci_dma_mask);
+		goto release_region;
+	}
+
+	ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(pci_dma_mask));
+	if (ret) {
+		ath11k_err(ab, "failed to set pci consistent dma mask (%d), err = %d\n",
+			   ret, pci_dma_mask);
+		goto release_region;
+	}
+
+	pci_set_master(pdev);
+
+	ab_pci->mem_len = pci_resource_len(pdev, PCI_BAR_NUM);
+	ab_pci->mem = pci_iomap(pdev, PCI_BAR_NUM, 0);
+	if (!ab_pci->mem) {
+		ath11k_err(ab, "failed to map pci bar, bar = %d\n", PCI_BAR_NUM);
+		ret = -EIO;
+		goto clear_master;
+	}
+
+	ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab_pci->mem);
+	return 0;
+
+clear_master:
+	pci_clear_master(pdev);
+release_region:
+	pci_release_region(pdev, PCI_BAR_NUM);
+disable_device:
+	pci_disable_device(pdev);
+out:
+	return ret;
+}
+
+static void ath11k_pci_free_region(struct ath11k_pci *ab_pci)
+{
+	struct pci_dev *pci_dev = ab_pci->pdev;
+
+	pci_iounmap(pci_dev, ab_pci->mem);
+	ab_pci->mem = NULL;
+	pci_clear_master(pci_dev);
+	pci_release_region(pci_dev, PCI_BAR_NUM);
+	if (pci_is_enabled(pci_dev))
+		pci_disable_device(pci_dev);
+}
+
 static int ath11k_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *pci_dev)
 {
 	struct ath11k_base *ab;
+	struct ath11k_pci *ab_pci;
 	enum ath11k_hw_rev hw_rev;
 	int ret;
 
@@ -38,24 +127,42 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 		return -ENOTSUPP;
 	}
 
-	ab = ath11k_core_alloc(&pdev->dev, 0, ATH11K_BUS_PCI);
+	ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), 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);
+	ab_pci = ath11k_pci_priv(ab);
+	ab_pci->dev_id = pci_dev->device;
+	ab_pci->ab = ab;
 	ab->dev = &pdev->dev;
 	ab->hw_rev = hw_rev;
 	pci_set_drvdata(pdev, ab);
 
+	ret = ath11k_pci_claim(ab_pci, pdev);
+	if (ret) {
+		ath11k_err(ab, "failed to claim device: %d\n", ret);
+		goto err_free_core;
+	}
+
+	return 0;
+
+err_free_core:
+	ath11k_core_free(ab);
 	return ret;
 }
 
 static void ath11k_pci_remove(struct pci_dev *pdev)
 {
 	struct ath11k_base *ab = pci_get_drvdata(pdev);
+	struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
 
 	set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
+	ath11k_pci_free_region(ab_pci);
 	ath11k_core_free(ab);
 }
 
diff --git a/drivers/net/wireless/ath/ath11k/pci.h b/drivers/net/wireless/ath/ath11k/pci.h
index 790b8993d225..5e6f2b5059a8 100644
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -7,4 +7,16 @@
 #define QCA6290_DEVICE_ID		0x1100
 #define QCA6390_VENDOR_ID		0x17CB
 #define QCA6390_DEVICE_ID		0x1101
+#define PCI_BAR_NUM			0
+#define PCI_DMA_MASK_64_BIT		64
+#define PCI_DMA_MASK_32_BIT		32
 
+struct ath11k_pci {
+	struct pci_dev *pdev;
+	struct device *dev;
+	struct ath11k_base *ab;
+	void __iomem *mem;
+	size_t mem_len;
+	u16 dev_id;
+	u32 chip_id;
+};
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/4] ath11k: setup pci resource for QCA6390 target
@ 2020-05-08  8:58   ` Govind Singh
  0 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: Govind Singh, linux-wireless

Add support for setting up pci region and dma mask
for QCA6390 target.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/core.c |   1 +
 drivers/net/wireless/ath/ath11k/pci.c  | 109 ++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath11k/pci.h  |  12 +++
 3 files changed, 121 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 8d07a2bb31bb..4c3f5a9d0d8a 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -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");
 
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index 582e7cd3c56e..6ab9e25c4ff9 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -6,6 +6,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 
+#include "ahb.h"
 #include "core.h"
 #include "pci.h"
 #include "debug.h"
@@ -18,10 +19,98 @@ static const struct pci_device_id ath11k_pci_id_table[] = {
 
 MODULE_DEVICE_TABLE(pci, ath11k_pci_id_table);
 
+static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab)
+{
+	return (struct ath11k_pci *)ab->drv_priv;
+}
+
+static int ath11k_pci_claim(struct ath11k_pci *ab_pci, struct pci_dev *pdev)
+{
+	u32 pci_dma_mask = PCI_DMA_MASK_32_BIT;
+	struct ath11k_base *ab = ab_pci->ab;
+	u16 device_id;
+	int ret = 0;
+
+	pci_read_config_word(pdev, PCI_DEVICE_ID, &device_id);
+	if (device_id != ab_pci->dev_id)  {
+		ath11k_err(ab, "pci device id mismatch, config ID: 0x%x, probe ID: 0x%x\n",
+			   device_id, ab_pci->dev_id);
+		ret = -EIO;
+		goto out;
+	}
+
+	ret = pci_assign_resource(pdev, PCI_BAR_NUM);
+	if (ret) {
+		ath11k_err(ab, "failed to assign pci resource, err = %d\n", ret);
+		goto out;
+	}
+
+	ret = pci_enable_device(pdev);
+	if (ret) {
+		ath11k_err(ab, "failed to enable pci device, err = %d\n", ret);
+		goto out;
+	}
+
+	ret = pci_request_region(pdev, PCI_BAR_NUM, "ath11k_pci");
+	if (ret) {
+		ath11k_err(ab, "failed to request pci region, err = %d\n", ret);
+		goto disable_device;
+	}
+
+	ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(pci_dma_mask));
+	if (ret) {
+		ath11k_err(ab, "failed to set pci dma mask (%d), err = %d\n",
+			   ret, pci_dma_mask);
+		goto release_region;
+	}
+
+	ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(pci_dma_mask));
+	if (ret) {
+		ath11k_err(ab, "failed to set pci consistent dma mask (%d), err = %d\n",
+			   ret, pci_dma_mask);
+		goto release_region;
+	}
+
+	pci_set_master(pdev);
+
+	ab_pci->mem_len = pci_resource_len(pdev, PCI_BAR_NUM);
+	ab_pci->mem = pci_iomap(pdev, PCI_BAR_NUM, 0);
+	if (!ab_pci->mem) {
+		ath11k_err(ab, "failed to map pci bar, bar = %d\n", PCI_BAR_NUM);
+		ret = -EIO;
+		goto clear_master;
+	}
+
+	ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab_pci->mem);
+	return 0;
+
+clear_master:
+	pci_clear_master(pdev);
+release_region:
+	pci_release_region(pdev, PCI_BAR_NUM);
+disable_device:
+	pci_disable_device(pdev);
+out:
+	return ret;
+}
+
+static void ath11k_pci_free_region(struct ath11k_pci *ab_pci)
+{
+	struct pci_dev *pci_dev = ab_pci->pdev;
+
+	pci_iounmap(pci_dev, ab_pci->mem);
+	ab_pci->mem = NULL;
+	pci_clear_master(pci_dev);
+	pci_release_region(pci_dev, PCI_BAR_NUM);
+	if (pci_is_enabled(pci_dev))
+		pci_disable_device(pci_dev);
+}
+
 static int ath11k_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *pci_dev)
 {
 	struct ath11k_base *ab;
+	struct ath11k_pci *ab_pci;
 	enum ath11k_hw_rev hw_rev;
 	int ret;
 
@@ -38,24 +127,42 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 		return -ENOTSUPP;
 	}
 
-	ab = ath11k_core_alloc(&pdev->dev, 0, ATH11K_BUS_PCI);
+	ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), 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);
+	ab_pci = ath11k_pci_priv(ab);
+	ab_pci->dev_id = pci_dev->device;
+	ab_pci->ab = ab;
 	ab->dev = &pdev->dev;
 	ab->hw_rev = hw_rev;
 	pci_set_drvdata(pdev, ab);
 
+	ret = ath11k_pci_claim(ab_pci, pdev);
+	if (ret) {
+		ath11k_err(ab, "failed to claim device: %d\n", ret);
+		goto err_free_core;
+	}
+
+	return 0;
+
+err_free_core:
+	ath11k_core_free(ab);
 	return ret;
 }
 
 static void ath11k_pci_remove(struct pci_dev *pdev)
 {
 	struct ath11k_base *ab = pci_get_drvdata(pdev);
+	struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
 
 	set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
+	ath11k_pci_free_region(ab_pci);
 	ath11k_core_free(ab);
 }
 
diff --git a/drivers/net/wireless/ath/ath11k/pci.h b/drivers/net/wireless/ath/ath11k/pci.h
index 790b8993d225..5e6f2b5059a8 100644
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -7,4 +7,16 @@
 #define QCA6290_DEVICE_ID		0x1100
 #define QCA6390_VENDOR_ID		0x17CB
 #define QCA6390_DEVICE_ID		0x1101
+#define PCI_BAR_NUM			0
+#define PCI_DMA_MASK_64_BIT		64
+#define PCI_DMA_MASK_32_BIT		32
 
+struct ath11k_pci {
+	struct pci_dev *pdev;
+	struct device *dev;
+	struct ath11k_base *ab;
+	void __iomem *mem;
+	size_t mem_len;
+	u16 dev_id;
+	u32 chip_id;
+};
-- 
2.22.0

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/4] ath11k: Add msi config init for QCA6390
  2020-05-08  8:58 ` Govind Singh
@ 2020-05-08  8:58   ` Govind Singh
  -1 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Govind Singh

QCA6390 uses PCI msi for CE/MHI/DP interrupt.
Add msi vector mapping and msi enable/disable ops.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/debug.h |  1 +
 drivers/net/wireless/ath/ath11k/pci.c   | 91 +++++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/pci.h   | 14 ++++
 3 files changed, 106 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless/ath/ath11k/debug.h
index c30085406bfb..1cfe54859388 100644
--- a/drivers/net/wireless/ath/ath11k/debug.h
+++ b/drivers/net/wireless/ath/ath11k/debug.h
@@ -25,6 +25,7 @@ enum ath11k_debug_mask {
 	ATH11K_DBG_REG		= 0x00000200,
 	ATH11K_DBG_TESTMODE	= 0x00000400,
 	ATH11k_DBG_HAL		= 0x00000800,
+	ATH11K_DBG_PCI		= 0x00001000,
 	ATH11K_DBG_ANY		= 0xffffffff,
 };
 
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index 6ab9e25c4ff9..d89dcb5fe81e 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/msi.h>
 #include <linux/pci.h>
 
 #include "ahb.h"
@@ -19,11 +20,88 @@ static const struct pci_device_id ath11k_pci_id_table[] = {
 
 MODULE_DEVICE_TABLE(pci, ath11k_pci_id_table);
 
+static struct ath11k_msi_config msi_config = {
+	.total_vectors = 32,
+	.total_users = 4,
+	.users = (struct ath11k_msi_user[]) {
+		{ .name = "MHI", .num_vectors = 3, .base_vector = 0 },
+		{ .name = "CE", .num_vectors = 10, .base_vector = 3 },
+		{ .name = "WAKE", .num_vectors = 1, .base_vector = 13 },
+		{ .name = "DP", .num_vectors = 18, .base_vector = 14 },
+	},
+};
+
+static int ath11k_pci_get_msi_assignment(struct ath11k_pci *ab_pci)
+{
+	ab_pci->msi_config = &msi_config;
+
+	return 0;
+}
+
 static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab)
 {
 	return (struct ath11k_pci *)ab->drv_priv;
 }
 
+static int ath11k_pci_enable_msi(struct ath11k_pci *ab_pci)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	struct ath11k_msi_config *msi_config;
+	struct msi_desc *msi_desc;
+	int num_vectors;
+	int ret;
+
+	ret = ath11k_pci_get_msi_assignment(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to get MSI assignment, err = %d\n", ret);
+		goto out;
+	}
+
+	msi_config = ab_pci->msi_config;
+	if (!msi_config) {
+		ath11k_err(ab, "msi_config is NULL!\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
+	num_vectors = pci_alloc_irq_vectors(ab_pci->pdev,
+					    msi_config->total_vectors,
+					    msi_config->total_vectors,
+					    PCI_IRQ_MSI);
+	if (num_vectors != msi_config->total_vectors) {
+		ath11k_err(ab, "failed to get enough MSI vectors (%d), available vectors = %d",
+			   msi_config->total_vectors, num_vectors);
+		if (num_vectors >= 0)
+			ret = -EINVAL;
+		goto reset_msi_config;
+	}
+
+	msi_desc = irq_get_msi_desc(ab_pci->pdev->irq);
+	if (!msi_desc) {
+		ath11k_err(ab, "msi_desc is NULL!\n");
+		ret = -EINVAL;
+		goto free_msi_vector;
+	}
+
+	ab_pci->msi_ep_base_data = msi_desc->msg.data;
+
+	ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", ab_pci->msi_ep_base_data);
+
+	return 0;
+
+free_msi_vector:
+	pci_free_irq_vectors(ab_pci->pdev);
+reset_msi_config:
+	ab_pci->msi_config = NULL;
+out:
+	return ret;
+}
+
+static void ath11k_pci_disable_msi(struct ath11k_pci *ab_pci)
+{
+	pci_free_irq_vectors(ab_pci->pdev);
+}
+
 static int ath11k_pci_claim(struct ath11k_pci *ab_pci, struct pci_dev *pdev)
 {
 	u32 pci_dma_mask = PCI_DMA_MASK_32_BIT;
@@ -139,6 +217,8 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 	ab_pci = ath11k_pci_priv(ab);
 	ab_pci->dev_id = pci_dev->device;
 	ab_pci->ab = ab;
+	ab_pci->dev = &pdev->dev;
+	ab_pci->pdev = pdev;
 	ab->dev = &pdev->dev;
 	ab->hw_rev = hw_rev;
 	pci_set_drvdata(pdev, ab);
@@ -149,10 +229,20 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 		goto err_free_core;
 	}
 
+	ret = ath11k_pci_enable_msi(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to enable  msi: %d\n", ret);
+		goto err_pci_free_region;
+	}
+
 	return 0;
 
+err_pci_free_region:
+	ath11k_pci_free_region(ab_pci);
+
 err_free_core:
 	ath11k_core_free(ab);
+
 	return ret;
 }
 
@@ -162,6 +252,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)
 	struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
 
 	set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
+	ath11k_pci_disable_msi(ab_pci);
 	ath11k_pci_free_region(ab_pci);
 	ath11k_core_free(ab);
 }
diff --git a/drivers/net/wireless/ath/ath11k/pci.h b/drivers/net/wireless/ath/ath11k/pci.h
index 5e6f2b5059a8..7c7fa1965aa6 100644
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -11,6 +11,18 @@
 #define PCI_DMA_MASK_64_BIT		64
 #define PCI_DMA_MASK_32_BIT		32
 
+struct ath11k_msi_user {
+	char *name;
+	int num_vectors;
+	u32 base_vector;
+};
+
+struct ath11k_msi_config {
+	int total_vectors;
+	int total_users;
+	struct ath11k_msi_user *users;
+};
+
 struct ath11k_pci {
 	struct pci_dev *pdev;
 	struct device *dev;
@@ -19,4 +31,6 @@ struct ath11k_pci {
 	size_t mem_len;
 	u16 dev_id;
 	u32 chip_id;
+	struct ath11k_msi_config *msi_config;
+	u32 msi_ep_base_data;
 };
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/4] ath11k: Add msi config init for QCA6390
@ 2020-05-08  8:58   ` Govind Singh
  0 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: Govind Singh, linux-wireless

QCA6390 uses PCI msi for CE/MHI/DP interrupt.
Add msi vector mapping and msi enable/disable ops.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/debug.h |  1 +
 drivers/net/wireless/ath/ath11k/pci.c   | 91 +++++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/pci.h   | 14 ++++
 3 files changed, 106 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless/ath/ath11k/debug.h
index c30085406bfb..1cfe54859388 100644
--- a/drivers/net/wireless/ath/ath11k/debug.h
+++ b/drivers/net/wireless/ath/ath11k/debug.h
@@ -25,6 +25,7 @@ enum ath11k_debug_mask {
 	ATH11K_DBG_REG		= 0x00000200,
 	ATH11K_DBG_TESTMODE	= 0x00000400,
 	ATH11k_DBG_HAL		= 0x00000800,
+	ATH11K_DBG_PCI		= 0x00001000,
 	ATH11K_DBG_ANY		= 0xffffffff,
 };
 
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index 6ab9e25c4ff9..d89dcb5fe81e 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/msi.h>
 #include <linux/pci.h>
 
 #include "ahb.h"
@@ -19,11 +20,88 @@ static const struct pci_device_id ath11k_pci_id_table[] = {
 
 MODULE_DEVICE_TABLE(pci, ath11k_pci_id_table);
 
+static struct ath11k_msi_config msi_config = {
+	.total_vectors = 32,
+	.total_users = 4,
+	.users = (struct ath11k_msi_user[]) {
+		{ .name = "MHI", .num_vectors = 3, .base_vector = 0 },
+		{ .name = "CE", .num_vectors = 10, .base_vector = 3 },
+		{ .name = "WAKE", .num_vectors = 1, .base_vector = 13 },
+		{ .name = "DP", .num_vectors = 18, .base_vector = 14 },
+	},
+};
+
+static int ath11k_pci_get_msi_assignment(struct ath11k_pci *ab_pci)
+{
+	ab_pci->msi_config = &msi_config;
+
+	return 0;
+}
+
 static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab)
 {
 	return (struct ath11k_pci *)ab->drv_priv;
 }
 
+static int ath11k_pci_enable_msi(struct ath11k_pci *ab_pci)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	struct ath11k_msi_config *msi_config;
+	struct msi_desc *msi_desc;
+	int num_vectors;
+	int ret;
+
+	ret = ath11k_pci_get_msi_assignment(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to get MSI assignment, err = %d\n", ret);
+		goto out;
+	}
+
+	msi_config = ab_pci->msi_config;
+	if (!msi_config) {
+		ath11k_err(ab, "msi_config is NULL!\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
+	num_vectors = pci_alloc_irq_vectors(ab_pci->pdev,
+					    msi_config->total_vectors,
+					    msi_config->total_vectors,
+					    PCI_IRQ_MSI);
+	if (num_vectors != msi_config->total_vectors) {
+		ath11k_err(ab, "failed to get enough MSI vectors (%d), available vectors = %d",
+			   msi_config->total_vectors, num_vectors);
+		if (num_vectors >= 0)
+			ret = -EINVAL;
+		goto reset_msi_config;
+	}
+
+	msi_desc = irq_get_msi_desc(ab_pci->pdev->irq);
+	if (!msi_desc) {
+		ath11k_err(ab, "msi_desc is NULL!\n");
+		ret = -EINVAL;
+		goto free_msi_vector;
+	}
+
+	ab_pci->msi_ep_base_data = msi_desc->msg.data;
+
+	ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", ab_pci->msi_ep_base_data);
+
+	return 0;
+
+free_msi_vector:
+	pci_free_irq_vectors(ab_pci->pdev);
+reset_msi_config:
+	ab_pci->msi_config = NULL;
+out:
+	return ret;
+}
+
+static void ath11k_pci_disable_msi(struct ath11k_pci *ab_pci)
+{
+	pci_free_irq_vectors(ab_pci->pdev);
+}
+
 static int ath11k_pci_claim(struct ath11k_pci *ab_pci, struct pci_dev *pdev)
 {
 	u32 pci_dma_mask = PCI_DMA_MASK_32_BIT;
@@ -139,6 +217,8 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 	ab_pci = ath11k_pci_priv(ab);
 	ab_pci->dev_id = pci_dev->device;
 	ab_pci->ab = ab;
+	ab_pci->dev = &pdev->dev;
+	ab_pci->pdev = pdev;
 	ab->dev = &pdev->dev;
 	ab->hw_rev = hw_rev;
 	pci_set_drvdata(pdev, ab);
@@ -149,10 +229,20 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 		goto err_free_core;
 	}
 
+	ret = ath11k_pci_enable_msi(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to enable  msi: %d\n", ret);
+		goto err_pci_free_region;
+	}
+
 	return 0;
 
+err_pci_free_region:
+	ath11k_pci_free_region(ab_pci);
+
 err_free_core:
 	ath11k_core_free(ab);
+
 	return ret;
 }
 
@@ -162,6 +252,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)
 	struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
 
 	set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
+	ath11k_pci_disable_msi(ab_pci);
 	ath11k_pci_free_region(ab_pci);
 	ath11k_core_free(ab);
 }
diff --git a/drivers/net/wireless/ath/ath11k/pci.h b/drivers/net/wireless/ath/ath11k/pci.h
index 5e6f2b5059a8..7c7fa1965aa6 100644
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -11,6 +11,18 @@
 #define PCI_DMA_MASK_64_BIT		64
 #define PCI_DMA_MASK_32_BIT		32
 
+struct ath11k_msi_user {
+	char *name;
+	int num_vectors;
+	u32 base_vector;
+};
+
+struct ath11k_msi_config {
+	int total_vectors;
+	int total_users;
+	struct ath11k_msi_user *users;
+};
+
 struct ath11k_pci {
 	struct pci_dev *pdev;
 	struct device *dev;
@@ -19,4 +31,6 @@ struct ath11k_pci {
 	size_t mem_len;
 	u16 dev_id;
 	u32 chip_id;
+	struct ath11k_msi_config *msi_config;
+	u32 msi_ep_base_data;
 };
-- 
2.22.0

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 4/4] ath11k: Register mhi controller device for qca6390
  2020-05-08  8:58 ` Govind Singh
@ 2020-05-08  8:58   ` Govind Singh
  -1 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Govind Singh

MHI is a communication protocol to communicate with external
Qualcomm modems and Wi-Fi chipsets over high speed peripheral buses. Even
though MHI doesn’t dictate underlying physical layer, protocol and mhi stack
is structured for PCIe based devices.

Register directly with mhi core layer as a mhi device driver for
firmware download.

Tested QCA6390 on X86 platform.
Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/Kconfig  |   5 +-
 drivers/net/wireless/ath/ath11k/Makefile |   2 +-
 drivers/net/wireless/ath/ath11k/mhi.c    | 379 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/mhi.h    |  28 ++
 drivers/net/wireless/ath/ath11k/pci.c    |  97 ++++++
 drivers/net/wireless/ath/ath11k/pci.h    |  13 +
 6 files changed, 520 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.c
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.h

diff --git a/drivers/net/wireless/ath/ath11k/Kconfig b/drivers/net/wireless/ath/ath11k/Kconfig
index 320b3b151bce..bd48796742bb 100644
--- a/drivers/net/wireless/ath/ath11k/Kconfig
+++ b/drivers/net/wireless/ath/ath11k/Kconfig
@@ -2,7 +2,6 @@
 config ATH11K
 	tristate "Qualcomm Technologies 802.11ax chipset support"
 	depends on MAC80211 && HAS_DMA
-	depends on REMOTEPROC
 	depends on CRYPTO_MICHAEL_MIC
 	depends on ARCH_QCOM || COMPILE_TEST
 	select ATH_COMMON
@@ -15,13 +14,13 @@ config ATH11K
 
 config ATH11K_AHB
 	tristate "Qualcomm Technologies 802.11ax chipset AHB support"
-	depends on ATH11K
+	depends on ATH11K && REMOTEPROC
 	---help---
 	  This module adds support for AHB bus
 
 config ATH11K_PCI
 	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
-	depends on ATH11K && PCI
+	depends on ATH11K && PCI && MHI_BUS
 	---help---
 	  This module adds support for PCIE bus
 
diff --git a/drivers/net/wireless/ath/ath11k/Makefile b/drivers/net/wireless/ath/ath11k/Makefile
index 933fcb2fd55d..8343c7dfaae3 100644
--- a/drivers/net/wireless/ath/ath11k/Makefile
+++ b/drivers/net/wireless/ath/ath11k/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o
 ath11k_ahb-y += ahb.o
 
 obj-$(CONFIG_ATH11K_PCI) += ath11k_pci.o
-ath11k_pci-y += pci.o
+ath11k_pci-y += mhi.o pci.o
 
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c
new file mode 100644
index 000000000000..1ca43243e265
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -0,0 +1,379 @@
+// SPDX-License-Identifier: BSD-3-Clause-Clear
+/* Copyright (c) 2020 The Linux Foundation. All rights reserved. */
+
+#include <linux/msi.h>
+#include <linux/pci.h>
+
+#include "debug.h"
+#include "mhi.h"
+
+#define MHI_TIMEOUT_DEFAULT_MS	90000
+
+static struct mhi_channel_config ath11k_mhi_channels[] = {
+	{
+		.num = 0,
+		.name = "LOOPBACK",
+		.num_elements = 32,
+		.event_ring = 0,
+		.dir = DMA_TO_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = false,
+		.auto_start = false,
+	},
+	{
+		.num = 1,
+		.name = "LOOPBACK",
+		.num_elements = 32,
+		.event_ring = 0,
+		.dir = DMA_FROM_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = false,
+		.auto_start = false,
+	},
+	{
+		.num = 20,
+		.name = "IPCR",
+		.num_elements = 64,
+		.event_ring = 1,
+		.dir = DMA_TO_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = false,
+		.auto_start = true,
+	},
+	{
+		.num = 21,
+		.name = "IPCR",
+		.num_elements = 64,
+		.event_ring = 1,
+		.dir = DMA_FROM_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = true,
+		.auto_start = true,
+	},
+};
+
+static struct mhi_event_config ath11k_mhi_events[] = {
+	{
+		.num_elements = 32,
+		.irq_moderation_ms = 0,
+		.irq = 1,
+		.mode = MHI_DB_BRST_DISABLE,
+		.hardware_event = false,
+		.client_managed = false,
+		.offload_channel = false,
+	},
+	{
+		.num_elements = 256,
+		.irq_moderation_ms = 1,
+		.irq = 2,
+		.mode = MHI_DB_BRST_DISABLE,
+		.priority = 1,
+		.hardware_event = false,
+		.client_managed = false,
+		.offload_channel = false,
+	},
+};
+
+static struct mhi_controller_config ath11k_mhi_config = {
+	.max_channels = 128,
+	.timeout_ms = 2000,
+	.use_bounce_buf = false,
+	.buf_len = 0,
+	.num_channels = ARRAY_SIZE(ath11k_mhi_channels),
+	.ch_cfg = ath11k_mhi_channels,
+	.num_events = ARRAY_SIZE(ath11k_mhi_events),
+	.event_cfg = ath11k_mhi_events,
+};
+
+static int ath11k_pci_get_mhi_msi(struct ath11k_pci *ab_pci)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	u32 user_base_data, base_vector;
+	int ret, num_vectors, i;
+	int *irq;
+
+	ret = ath11k_pci_get_user_msi_assignment(ab_pci,
+						 "MHI", &num_vectors,
+						 &user_base_data, &base_vector);
+	if (ret)
+		return ret;
+
+	ath11k_dbg(ab, ATH11K_DBG_PCI, "Number of assigned MSI for MHI is %d, base vector is %d\n",
+		   num_vectors, base_vector);
+
+	irq = kcalloc(num_vectors, sizeof(int), GFP_KERNEL);
+	if (!irq)
+		return -ENOMEM;
+
+	for (i = 0; i < num_vectors; i++)
+		irq[i] = ath11k_pci_get_msi_irq(ab_pci->dev,
+						base_vector + i);
+
+	ab_pci->mhi_ctrl->irq = irq;
+	ab_pci->mhi_ctrl->nr_irqs = num_vectors;
+
+	return 0;
+}
+
+int ath11k_pci_register_mhi(struct ath11k_pci *ab_pci)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	struct mhi_controller *mhi_ctrl;
+	int ret;
+
+	mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL);
+	if (!mhi_ctrl)
+		return PTR_ERR(mhi_ctrl);
+
+	ab_pci->mhi_ctrl = mhi_ctrl;
+	mhi_ctrl->fw_image = ATH11K_PCI_FW_FILE_NAME;
+	mhi_ctrl->regs = ab_pci->mem;
+
+	ret = ath11k_pci_get_mhi_msi(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to get msi for mhi\n");
+		kfree(mhi_ctrl);
+		return ret;
+	}
+
+	mhi_ctrl->iova_start = 0;
+	mhi_ctrl->iova_stop = 0xffffffff;
+	mhi_ctrl->sbl_size = SZ_512K;
+	mhi_ctrl->seg_len = SZ_512K;
+	mhi_ctrl->fbc_download = true;
+
+	ret = mhi_register_controller(mhi_ctrl, &ath11k_mhi_config);
+	if (ret) {
+		ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret);
+		kfree(mhi_ctrl);
+		return ret;
+	}
+
+	return 0;
+}
+
+void ath11k_pci_unregister_mhi(struct ath11k_pci *ab_pci)
+{
+	struct mhi_controller *mhi_ctrl = ab_pci->mhi_ctrl;
+
+	mhi_unregister_controller(mhi_ctrl);
+	kfree(mhi_ctrl->irq);
+}
+
+static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state)
+{
+	switch (mhi_state) {
+	case ATH11K_MHI_INIT:
+		return "INIT";
+	case ATH11K_MHI_DEINIT:
+		return "DEINIT";
+	case ATH11K_MHI_POWER_ON:
+		return "POWER_ON";
+	case ATH11K_MHI_POWER_OFF:
+		return "POWER_OFF";
+	case ATH11K_MHI_FORCE_POWER_OFF:
+		return "FORCE_POWER_OFF";
+	case ATH11K_MHI_SUSPEND:
+		return "SUSPEND";
+	case ATH11K_MHI_RESUME:
+		return "RESUME";
+	case ATH11K_MHI_TRIGGER_RDDM:
+		return "TRIGGER_RDDM";
+	case ATH11K_MHI_RDDM_DONE:
+		return "RDDM_DONE";
+	default:
+		return "UNKNOWN";
+	}
+};
+
+static void ath11k_pci_set_mhi_state_bit(struct ath11k_pci *ab_pci,
+					 enum ath11k_mhi_state mhi_state)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+
+	switch (mhi_state) {
+	case ATH11K_MHI_INIT:
+		set_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_DEINIT:
+		clear_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_POWER_ON:
+		set_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_POWER_OFF:
+	case ATH11K_MHI_FORCE_POWER_OFF:
+		clear_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state);
+		clear_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state);
+		clear_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_SUSPEND:
+		set_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_RESUME:
+		clear_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_TRIGGER_RDDM:
+		set_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_RDDM_DONE:
+		set_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state);
+		break;
+	default:
+		ath11k_err(ab, "unhandled mhi state (%d)\n", mhi_state);
+	}
+}
+
+static int ath11k_pci_check_mhi_state_bit(struct ath11k_pci *ab_pci,
+					  enum ath11k_mhi_state mhi_state)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+
+	switch (mhi_state) {
+	case ATH11K_MHI_INIT:
+		if (!test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_DEINIT:
+	case ATH11K_MHI_POWER_ON:
+		if (test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state) &&
+		    !test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_FORCE_POWER_OFF:
+		if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_POWER_OFF:
+	case ATH11K_MHI_SUSPEND:
+		if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state) &&
+		    !test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_RESUME:
+		if (test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_TRIGGER_RDDM:
+		if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state) &&
+		    !test_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_RDDM_DONE:
+		return 0;
+	default:
+		ath11k_err(ab, "unhandled mhi state: %s(%d)\n",
+			   ath11k_mhi_state_to_str(mhi_state), mhi_state);
+	}
+
+	ath11k_err(ab, "failed to set mhi state %s(%d) in current mhi state (0x%lx)\n",
+		   ath11k_mhi_state_to_str(mhi_state), mhi_state,
+		   ab_pci->mhi_state);
+
+	return -EINVAL;
+}
+
+static int ath11k_pci_set_mhi_state(struct ath11k_pci *ab_pci,
+				    enum ath11k_mhi_state mhi_state)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	int ret;
+
+	ret = ath11k_pci_check_mhi_state_bit(ab_pci, mhi_state);
+	if (ret)
+		goto out;
+
+	ath11k_dbg(ab, ATH11K_DBG_PCI, "setting mhi state: %s(%d)\n",
+		   ath11k_mhi_state_to_str(mhi_state), mhi_state);
+
+	switch (mhi_state) {
+	case ATH11K_MHI_INIT:
+		ret = mhi_prepare_for_power_up(ab_pci->mhi_ctrl);
+		break;
+	case ATH11K_MHI_DEINIT:
+		mhi_unprepare_after_power_down(ab_pci->mhi_ctrl);
+		ret = 0;
+		break;
+	case ATH11K_MHI_POWER_ON:
+		ret = mhi_async_power_up(ab_pci->mhi_ctrl);
+		break;
+	case ATH11K_MHI_POWER_OFF:
+		mhi_power_down(ab_pci->mhi_ctrl, true);
+		ret = 0;
+		break;
+	case ATH11K_MHI_FORCE_POWER_OFF:
+		mhi_power_down(ab_pci->mhi_ctrl, false);
+		ret = 0;
+		break;
+	case ATH11K_MHI_SUSPEND:
+		break;
+	case ATH11K_MHI_RESUME:
+		break;
+	case ATH11K_MHI_TRIGGER_RDDM:
+		ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl);
+		break;
+	case ATH11K_MHI_RDDM_DONE:
+		break;
+	default:
+		ath11k_err(ab, "unhandled MHI state (%d)\n", mhi_state);
+		ret = -EINVAL;
+	}
+
+	if (ret)
+		goto out;
+
+	ath11k_pci_set_mhi_state_bit(ab_pci, mhi_state);
+
+	return 0;
+
+out:
+	ath11k_err(ab, "failed to set mhi state: %s(%d)\n",
+		   ath11k_mhi_state_to_str(mhi_state), mhi_state);
+	return ret;
+}
+
+int ath11k_pci_start_mhi(struct ath11k_pci *ab_pci)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	int ret;
+
+	ab_pci->mhi_ctrl->timeout_ms = MHI_TIMEOUT_DEFAULT_MS;
+
+	ret = ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_INIT);
+	if (ret)
+		ath11k_err(ab, "failed to set mhi init state: %d\n", ret);
+
+	ret = ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_POWER_ON);
+	if (ret)
+		ath11k_err(ab, "failed to set mhi power on state: %d\n", ret);
+
+	return ret;
+}
+
+void ath11k_pci_stop_mhi(struct ath11k_pci *ab_pci)
+{
+	ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_RESUME);
+	ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_POWER_OFF);
+	ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_DEINIT);
+}
+
diff --git a/drivers/net/wireless/ath/ath11k/mhi.h b/drivers/net/wireless/ath/ath11k/mhi.h
new file mode 100644
index 000000000000..355de5a2c241
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/mhi.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2020 The Linux Foundation. All rights reserved.
+ */
+#ifndef _ATH11K_MHI_H
+#define _ATH11K_MHI_H
+
+#include "pci.h"
+#define ATH11K_PCI_FW_FILE_NAME		"amss.bin"
+
+enum ath11k_mhi_state {
+	ATH11K_MHI_INIT,
+	ATH11K_MHI_DEINIT,
+	ATH11K_MHI_POWER_ON,
+	ATH11K_MHI_POWER_OFF,
+	ATH11K_MHI_FORCE_POWER_OFF,
+	ATH11K_MHI_SUSPEND,
+	ATH11K_MHI_RESUME,
+	ATH11K_MHI_TRIGGER_RDDM,
+	ATH11K_MHI_RDDM,
+	ATH11K_MHI_RDDM_DONE,
+};
+
+int ath11k_pci_start_mhi(struct ath11k_pci *ar_pci);
+void ath11k_pci_stop_mhi(struct ath11k_pci *ar_pci);
+int ath11k_pci_register_mhi(struct ath11k_pci *ar_pci);
+void ath11k_pci_unregister_mhi(struct ath11k_pci *ar_pci);
+#endif
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index d89dcb5fe81e..938078ee8d80 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -9,6 +9,8 @@
 
 #include "ahb.h"
 #include "core.h"
+#include "hif.h"
+#include "mhi.h"
 #include "pci.h"
 #include "debug.h"
 
@@ -31,6 +33,60 @@ static struct ath11k_msi_config msi_config = {
 	},
 };
 
+int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector)
+{
+	struct pci_dev *pci_dev = to_pci_dev(dev);
+	int irq_num;
+
+	irq_num = pci_irq_vector(pci_dev, vector);
+
+	return irq_num;
+}
+
+int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ab_pci, char *user_name,
+				       int *num_vectors, u32 *user_base_data,
+				       u32 *base_vector)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	struct ath11k_msi_config *msi_config;
+	int idx;
+
+	msi_config = ab_pci->msi_config;
+	if (!msi_config) {
+		ath11k_err(ab, "MSI is not supported.\n");
+		return -EINVAL;
+	}
+
+	for (idx = 0; idx < msi_config->total_users; idx++) {
+		if (strcmp(user_name, msi_config->users[idx].name) == 0) {
+			*num_vectors = msi_config->users[idx].num_vectors;
+			*user_base_data = msi_config->users[idx].base_vector
+				+ ab_pci->msi_ep_base_data;
+			*base_vector = msi_config->users[idx].base_vector;
+
+			ath11k_dbg(ab, ATH11K_DBG_PCI, "Assign MSI to user: %s, num_vectors: %d, user_base_data: %u, base_vector: %u\n",
+				   user_name, *num_vectors, *user_base_data,
+				   *base_vector);
+
+			return 0;
+		}
+	}
+
+	ath11k_err(ab, "Failed to find MSI assignment for %s!\n", user_name);
+
+	return -EINVAL;
+}
+
+static int ath11k_pci_qca6x90_powerup(struct ath11k_pci *ab_pci)
+{
+	return ath11k_pci_start_mhi(ab_pci);
+}
+
+static void ath11k_pci_qca6x90_powerdown(struct ath11k_pci *ab_pci)
+{
+	ath11k_pci_stop_mhi(ab_pci);
+}
+
 static int ath11k_pci_get_msi_assignment(struct ath11k_pci *ab_pci)
 {
 	ab_pci->msi_config = &msi_config;
@@ -184,6 +240,34 @@ static void ath11k_pci_free_region(struct ath11k_pci *ab_pci)
 		pci_disable_device(pci_dev);
 }
 
+static int ath11k_pci_power_up(struct ath11k_base *ab)
+{
+	struct ath11k_pci *ab_pci;
+	int ret;
+
+	ab_pci = ath11k_pci_priv(ab);
+	ret = ath11k_pci_qca6x90_powerup(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to power on  mhi: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static void ath11k_pci_power_down(struct ath11k_base *ab)
+{
+	struct ath11k_pci *ab_pci;
+
+	ab_pci = ath11k_pci_priv(ab);
+	ath11k_pci_qca6x90_powerdown(ab_pci);
+}
+
+static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
+	.power_down = ath11k_pci_power_down,
+	.power_up = ath11k_pci_power_up,
+};
+
 static int ath11k_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *pci_dev)
 {
@@ -229,14 +313,26 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 		goto err_free_core;
 	}
 
+	ab->mem = ab_pci->mem;
+	ab->mem_len = ab_pci->mem_len;
+
 	ret = ath11k_pci_enable_msi(ab_pci);
 	if (ret) {
 		ath11k_err(ab, "failed to enable  msi: %d\n", ret);
 		goto err_pci_free_region;
 	}
 
+	ret = ath11k_pci_register_mhi(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to register  mhi: %d\n", ret);
+		goto err_pci_disable_msi;
+	}
+
 	return 0;
 
+err_pci_disable_msi:
+	ath11k_pci_disable_msi(ab_pci);
+
 err_pci_free_region:
 	ath11k_pci_free_region(ab_pci);
 
@@ -252,6 +348,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)
 	struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
 
 	set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
+	ath11k_pci_unregister_mhi(ab_pci);
 	ath11k_pci_disable_msi(ab_pci);
 	ath11k_pci_free_region(ab_pci);
 	ath11k_core_free(ab);
diff --git a/drivers/net/wireless/ath/ath11k/pci.h b/drivers/net/wireless/ath/ath11k/pci.h
index 7c7fa1965aa6..83b485be6c50 100644
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -2,6 +2,10 @@
 /*
  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
  */
+#ifndef _ATH11K_PCI_H
+#define _ATH11K_PCI_H
+
+#include <linux/mhi.h>
 
 #define QCA6290_VENDOR_ID		0x17CB
 #define QCA6290_DEVICE_ID		0x1100
@@ -33,4 +37,13 @@ struct ath11k_pci {
 	u32 chip_id;
 	struct ath11k_msi_config *msi_config;
 	u32 msi_ep_base_data;
+	struct mhi_controller *mhi_ctrl;
+	unsigned long mhi_state;
 };
+
+int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name,
+				       int *num_vectors, u32 *user_base_data,
+				       u32 *base_vector);
+
+int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector);
+#endif
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 4/4] ath11k: Register mhi controller device for qca6390
@ 2020-05-08  8:58   ` Govind Singh
  0 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:58 UTC (permalink / raw)
  To: ath11k; +Cc: Govind Singh, linux-wireless

MHI is a communication protocol to communicate with external
Qualcomm modems and Wi-Fi chipsets over high speed peripheral buses. Even
though MHI doesn’t dictate underlying physical layer, protocol and mhi stack
is structured for PCIe based devices.

Register directly with mhi core layer as a mhi device driver for
firmware download.

Tested QCA6390 on X86 platform.
Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.

Signed-off-by: Govind Singh <govinds@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/Kconfig  |   5 +-
 drivers/net/wireless/ath/ath11k/Makefile |   2 +-
 drivers/net/wireless/ath/ath11k/mhi.c    | 379 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/mhi.h    |  28 ++
 drivers/net/wireless/ath/ath11k/pci.c    |  97 ++++++
 drivers/net/wireless/ath/ath11k/pci.h    |  13 +
 6 files changed, 520 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.c
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.h

diff --git a/drivers/net/wireless/ath/ath11k/Kconfig b/drivers/net/wireless/ath/ath11k/Kconfig
index 320b3b151bce..bd48796742bb 100644
--- a/drivers/net/wireless/ath/ath11k/Kconfig
+++ b/drivers/net/wireless/ath/ath11k/Kconfig
@@ -2,7 +2,6 @@
 config ATH11K
 	tristate "Qualcomm Technologies 802.11ax chipset support"
 	depends on MAC80211 && HAS_DMA
-	depends on REMOTEPROC
 	depends on CRYPTO_MICHAEL_MIC
 	depends on ARCH_QCOM || COMPILE_TEST
 	select ATH_COMMON
@@ -15,13 +14,13 @@ config ATH11K
 
 config ATH11K_AHB
 	tristate "Qualcomm Technologies 802.11ax chipset AHB support"
-	depends on ATH11K
+	depends on ATH11K && REMOTEPROC
 	---help---
 	  This module adds support for AHB bus
 
 config ATH11K_PCI
 	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
-	depends on ATH11K && PCI
+	depends on ATH11K && PCI && MHI_BUS
 	---help---
 	  This module adds support for PCIE bus
 
diff --git a/drivers/net/wireless/ath/ath11k/Makefile b/drivers/net/wireless/ath/ath11k/Makefile
index 933fcb2fd55d..8343c7dfaae3 100644
--- a/drivers/net/wireless/ath/ath11k/Makefile
+++ b/drivers/net/wireless/ath/ath11k/Makefile
@@ -25,7 +25,7 @@ obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o
 ath11k_ahb-y += ahb.o
 
 obj-$(CONFIG_ATH11K_PCI) += ath11k_pci.o
-ath11k_pci-y += pci.o
+ath11k_pci-y += mhi.o pci.o
 
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c
new file mode 100644
index 000000000000..1ca43243e265
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -0,0 +1,379 @@
+// SPDX-License-Identifier: BSD-3-Clause-Clear
+/* Copyright (c) 2020 The Linux Foundation. All rights reserved. */
+
+#include <linux/msi.h>
+#include <linux/pci.h>
+
+#include "debug.h"
+#include "mhi.h"
+
+#define MHI_TIMEOUT_DEFAULT_MS	90000
+
+static struct mhi_channel_config ath11k_mhi_channels[] = {
+	{
+		.num = 0,
+		.name = "LOOPBACK",
+		.num_elements = 32,
+		.event_ring = 0,
+		.dir = DMA_TO_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = false,
+		.auto_start = false,
+	},
+	{
+		.num = 1,
+		.name = "LOOPBACK",
+		.num_elements = 32,
+		.event_ring = 0,
+		.dir = DMA_FROM_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = false,
+		.auto_start = false,
+	},
+	{
+		.num = 20,
+		.name = "IPCR",
+		.num_elements = 64,
+		.event_ring = 1,
+		.dir = DMA_TO_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = false,
+		.auto_start = true,
+	},
+	{
+		.num = 21,
+		.name = "IPCR",
+		.num_elements = 64,
+		.event_ring = 1,
+		.dir = DMA_FROM_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = true,
+		.auto_start = true,
+	},
+};
+
+static struct mhi_event_config ath11k_mhi_events[] = {
+	{
+		.num_elements = 32,
+		.irq_moderation_ms = 0,
+		.irq = 1,
+		.mode = MHI_DB_BRST_DISABLE,
+		.hardware_event = false,
+		.client_managed = false,
+		.offload_channel = false,
+	},
+	{
+		.num_elements = 256,
+		.irq_moderation_ms = 1,
+		.irq = 2,
+		.mode = MHI_DB_BRST_DISABLE,
+		.priority = 1,
+		.hardware_event = false,
+		.client_managed = false,
+		.offload_channel = false,
+	},
+};
+
+static struct mhi_controller_config ath11k_mhi_config = {
+	.max_channels = 128,
+	.timeout_ms = 2000,
+	.use_bounce_buf = false,
+	.buf_len = 0,
+	.num_channels = ARRAY_SIZE(ath11k_mhi_channels),
+	.ch_cfg = ath11k_mhi_channels,
+	.num_events = ARRAY_SIZE(ath11k_mhi_events),
+	.event_cfg = ath11k_mhi_events,
+};
+
+static int ath11k_pci_get_mhi_msi(struct ath11k_pci *ab_pci)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	u32 user_base_data, base_vector;
+	int ret, num_vectors, i;
+	int *irq;
+
+	ret = ath11k_pci_get_user_msi_assignment(ab_pci,
+						 "MHI", &num_vectors,
+						 &user_base_data, &base_vector);
+	if (ret)
+		return ret;
+
+	ath11k_dbg(ab, ATH11K_DBG_PCI, "Number of assigned MSI for MHI is %d, base vector is %d\n",
+		   num_vectors, base_vector);
+
+	irq = kcalloc(num_vectors, sizeof(int), GFP_KERNEL);
+	if (!irq)
+		return -ENOMEM;
+
+	for (i = 0; i < num_vectors; i++)
+		irq[i] = ath11k_pci_get_msi_irq(ab_pci->dev,
+						base_vector + i);
+
+	ab_pci->mhi_ctrl->irq = irq;
+	ab_pci->mhi_ctrl->nr_irqs = num_vectors;
+
+	return 0;
+}
+
+int ath11k_pci_register_mhi(struct ath11k_pci *ab_pci)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	struct mhi_controller *mhi_ctrl;
+	int ret;
+
+	mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL);
+	if (!mhi_ctrl)
+		return PTR_ERR(mhi_ctrl);
+
+	ab_pci->mhi_ctrl = mhi_ctrl;
+	mhi_ctrl->fw_image = ATH11K_PCI_FW_FILE_NAME;
+	mhi_ctrl->regs = ab_pci->mem;
+
+	ret = ath11k_pci_get_mhi_msi(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to get msi for mhi\n");
+		kfree(mhi_ctrl);
+		return ret;
+	}
+
+	mhi_ctrl->iova_start = 0;
+	mhi_ctrl->iova_stop = 0xffffffff;
+	mhi_ctrl->sbl_size = SZ_512K;
+	mhi_ctrl->seg_len = SZ_512K;
+	mhi_ctrl->fbc_download = true;
+
+	ret = mhi_register_controller(mhi_ctrl, &ath11k_mhi_config);
+	if (ret) {
+		ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret);
+		kfree(mhi_ctrl);
+		return ret;
+	}
+
+	return 0;
+}
+
+void ath11k_pci_unregister_mhi(struct ath11k_pci *ab_pci)
+{
+	struct mhi_controller *mhi_ctrl = ab_pci->mhi_ctrl;
+
+	mhi_unregister_controller(mhi_ctrl);
+	kfree(mhi_ctrl->irq);
+}
+
+static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state)
+{
+	switch (mhi_state) {
+	case ATH11K_MHI_INIT:
+		return "INIT";
+	case ATH11K_MHI_DEINIT:
+		return "DEINIT";
+	case ATH11K_MHI_POWER_ON:
+		return "POWER_ON";
+	case ATH11K_MHI_POWER_OFF:
+		return "POWER_OFF";
+	case ATH11K_MHI_FORCE_POWER_OFF:
+		return "FORCE_POWER_OFF";
+	case ATH11K_MHI_SUSPEND:
+		return "SUSPEND";
+	case ATH11K_MHI_RESUME:
+		return "RESUME";
+	case ATH11K_MHI_TRIGGER_RDDM:
+		return "TRIGGER_RDDM";
+	case ATH11K_MHI_RDDM_DONE:
+		return "RDDM_DONE";
+	default:
+		return "UNKNOWN";
+	}
+};
+
+static void ath11k_pci_set_mhi_state_bit(struct ath11k_pci *ab_pci,
+					 enum ath11k_mhi_state mhi_state)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+
+	switch (mhi_state) {
+	case ATH11K_MHI_INIT:
+		set_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_DEINIT:
+		clear_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_POWER_ON:
+		set_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_POWER_OFF:
+	case ATH11K_MHI_FORCE_POWER_OFF:
+		clear_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state);
+		clear_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state);
+		clear_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_SUSPEND:
+		set_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_RESUME:
+		clear_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_TRIGGER_RDDM:
+		set_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state);
+		break;
+	case ATH11K_MHI_RDDM_DONE:
+		set_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state);
+		break;
+	default:
+		ath11k_err(ab, "unhandled mhi state (%d)\n", mhi_state);
+	}
+}
+
+static int ath11k_pci_check_mhi_state_bit(struct ath11k_pci *ab_pci,
+					  enum ath11k_mhi_state mhi_state)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+
+	switch (mhi_state) {
+	case ATH11K_MHI_INIT:
+		if (!test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_DEINIT:
+	case ATH11K_MHI_POWER_ON:
+		if (test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state) &&
+		    !test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_FORCE_POWER_OFF:
+		if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_POWER_OFF:
+	case ATH11K_MHI_SUSPEND:
+		if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state) &&
+		    !test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_RESUME:
+		if (test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_TRIGGER_RDDM:
+		if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state) &&
+		    !test_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state))
+			return 0;
+		break;
+	case ATH11K_MHI_RDDM_DONE:
+		return 0;
+	default:
+		ath11k_err(ab, "unhandled mhi state: %s(%d)\n",
+			   ath11k_mhi_state_to_str(mhi_state), mhi_state);
+	}
+
+	ath11k_err(ab, "failed to set mhi state %s(%d) in current mhi state (0x%lx)\n",
+		   ath11k_mhi_state_to_str(mhi_state), mhi_state,
+		   ab_pci->mhi_state);
+
+	return -EINVAL;
+}
+
+static int ath11k_pci_set_mhi_state(struct ath11k_pci *ab_pci,
+				    enum ath11k_mhi_state mhi_state)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	int ret;
+
+	ret = ath11k_pci_check_mhi_state_bit(ab_pci, mhi_state);
+	if (ret)
+		goto out;
+
+	ath11k_dbg(ab, ATH11K_DBG_PCI, "setting mhi state: %s(%d)\n",
+		   ath11k_mhi_state_to_str(mhi_state), mhi_state);
+
+	switch (mhi_state) {
+	case ATH11K_MHI_INIT:
+		ret = mhi_prepare_for_power_up(ab_pci->mhi_ctrl);
+		break;
+	case ATH11K_MHI_DEINIT:
+		mhi_unprepare_after_power_down(ab_pci->mhi_ctrl);
+		ret = 0;
+		break;
+	case ATH11K_MHI_POWER_ON:
+		ret = mhi_async_power_up(ab_pci->mhi_ctrl);
+		break;
+	case ATH11K_MHI_POWER_OFF:
+		mhi_power_down(ab_pci->mhi_ctrl, true);
+		ret = 0;
+		break;
+	case ATH11K_MHI_FORCE_POWER_OFF:
+		mhi_power_down(ab_pci->mhi_ctrl, false);
+		ret = 0;
+		break;
+	case ATH11K_MHI_SUSPEND:
+		break;
+	case ATH11K_MHI_RESUME:
+		break;
+	case ATH11K_MHI_TRIGGER_RDDM:
+		ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl);
+		break;
+	case ATH11K_MHI_RDDM_DONE:
+		break;
+	default:
+		ath11k_err(ab, "unhandled MHI state (%d)\n", mhi_state);
+		ret = -EINVAL;
+	}
+
+	if (ret)
+		goto out;
+
+	ath11k_pci_set_mhi_state_bit(ab_pci, mhi_state);
+
+	return 0;
+
+out:
+	ath11k_err(ab, "failed to set mhi state: %s(%d)\n",
+		   ath11k_mhi_state_to_str(mhi_state), mhi_state);
+	return ret;
+}
+
+int ath11k_pci_start_mhi(struct ath11k_pci *ab_pci)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	int ret;
+
+	ab_pci->mhi_ctrl->timeout_ms = MHI_TIMEOUT_DEFAULT_MS;
+
+	ret = ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_INIT);
+	if (ret)
+		ath11k_err(ab, "failed to set mhi init state: %d\n", ret);
+
+	ret = ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_POWER_ON);
+	if (ret)
+		ath11k_err(ab, "failed to set mhi power on state: %d\n", ret);
+
+	return ret;
+}
+
+void ath11k_pci_stop_mhi(struct ath11k_pci *ab_pci)
+{
+	ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_RESUME);
+	ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_POWER_OFF);
+	ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_DEINIT);
+}
+
diff --git a/drivers/net/wireless/ath/ath11k/mhi.h b/drivers/net/wireless/ath/ath11k/mhi.h
new file mode 100644
index 000000000000..355de5a2c241
--- /dev/null
+++ b/drivers/net/wireless/ath/ath11k/mhi.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2020 The Linux Foundation. All rights reserved.
+ */
+#ifndef _ATH11K_MHI_H
+#define _ATH11K_MHI_H
+
+#include "pci.h"
+#define ATH11K_PCI_FW_FILE_NAME		"amss.bin"
+
+enum ath11k_mhi_state {
+	ATH11K_MHI_INIT,
+	ATH11K_MHI_DEINIT,
+	ATH11K_MHI_POWER_ON,
+	ATH11K_MHI_POWER_OFF,
+	ATH11K_MHI_FORCE_POWER_OFF,
+	ATH11K_MHI_SUSPEND,
+	ATH11K_MHI_RESUME,
+	ATH11K_MHI_TRIGGER_RDDM,
+	ATH11K_MHI_RDDM,
+	ATH11K_MHI_RDDM_DONE,
+};
+
+int ath11k_pci_start_mhi(struct ath11k_pci *ar_pci);
+void ath11k_pci_stop_mhi(struct ath11k_pci *ar_pci);
+int ath11k_pci_register_mhi(struct ath11k_pci *ar_pci);
+void ath11k_pci_unregister_mhi(struct ath11k_pci *ar_pci);
+#endif
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index d89dcb5fe81e..938078ee8d80 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -9,6 +9,8 @@
 
 #include "ahb.h"
 #include "core.h"
+#include "hif.h"
+#include "mhi.h"
 #include "pci.h"
 #include "debug.h"
 
@@ -31,6 +33,60 @@ static struct ath11k_msi_config msi_config = {
 	},
 };
 
+int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector)
+{
+	struct pci_dev *pci_dev = to_pci_dev(dev);
+	int irq_num;
+
+	irq_num = pci_irq_vector(pci_dev, vector);
+
+	return irq_num;
+}
+
+int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ab_pci, char *user_name,
+				       int *num_vectors, u32 *user_base_data,
+				       u32 *base_vector)
+{
+	struct ath11k_base *ab = ab_pci->ab;
+	struct ath11k_msi_config *msi_config;
+	int idx;
+
+	msi_config = ab_pci->msi_config;
+	if (!msi_config) {
+		ath11k_err(ab, "MSI is not supported.\n");
+		return -EINVAL;
+	}
+
+	for (idx = 0; idx < msi_config->total_users; idx++) {
+		if (strcmp(user_name, msi_config->users[idx].name) == 0) {
+			*num_vectors = msi_config->users[idx].num_vectors;
+			*user_base_data = msi_config->users[idx].base_vector
+				+ ab_pci->msi_ep_base_data;
+			*base_vector = msi_config->users[idx].base_vector;
+
+			ath11k_dbg(ab, ATH11K_DBG_PCI, "Assign MSI to user: %s, num_vectors: %d, user_base_data: %u, base_vector: %u\n",
+				   user_name, *num_vectors, *user_base_data,
+				   *base_vector);
+
+			return 0;
+		}
+	}
+
+	ath11k_err(ab, "Failed to find MSI assignment for %s!\n", user_name);
+
+	return -EINVAL;
+}
+
+static int ath11k_pci_qca6x90_powerup(struct ath11k_pci *ab_pci)
+{
+	return ath11k_pci_start_mhi(ab_pci);
+}
+
+static void ath11k_pci_qca6x90_powerdown(struct ath11k_pci *ab_pci)
+{
+	ath11k_pci_stop_mhi(ab_pci);
+}
+
 static int ath11k_pci_get_msi_assignment(struct ath11k_pci *ab_pci)
 {
 	ab_pci->msi_config = &msi_config;
@@ -184,6 +240,34 @@ static void ath11k_pci_free_region(struct ath11k_pci *ab_pci)
 		pci_disable_device(pci_dev);
 }
 
+static int ath11k_pci_power_up(struct ath11k_base *ab)
+{
+	struct ath11k_pci *ab_pci;
+	int ret;
+
+	ab_pci = ath11k_pci_priv(ab);
+	ret = ath11k_pci_qca6x90_powerup(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to power on  mhi: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static void ath11k_pci_power_down(struct ath11k_base *ab)
+{
+	struct ath11k_pci *ab_pci;
+
+	ab_pci = ath11k_pci_priv(ab);
+	ath11k_pci_qca6x90_powerdown(ab_pci);
+}
+
+static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
+	.power_down = ath11k_pci_power_down,
+	.power_up = ath11k_pci_power_up,
+};
+
 static int ath11k_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *pci_dev)
 {
@@ -229,14 +313,26 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
 		goto err_free_core;
 	}
 
+	ab->mem = ab_pci->mem;
+	ab->mem_len = ab_pci->mem_len;
+
 	ret = ath11k_pci_enable_msi(ab_pci);
 	if (ret) {
 		ath11k_err(ab, "failed to enable  msi: %d\n", ret);
 		goto err_pci_free_region;
 	}
 
+	ret = ath11k_pci_register_mhi(ab_pci);
+	if (ret) {
+		ath11k_err(ab, "failed to register  mhi: %d\n", ret);
+		goto err_pci_disable_msi;
+	}
+
 	return 0;
 
+err_pci_disable_msi:
+	ath11k_pci_disable_msi(ab_pci);
+
 err_pci_free_region:
 	ath11k_pci_free_region(ab_pci);
 
@@ -252,6 +348,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)
 	struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
 
 	set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
+	ath11k_pci_unregister_mhi(ab_pci);
 	ath11k_pci_disable_msi(ab_pci);
 	ath11k_pci_free_region(ab_pci);
 	ath11k_core_free(ab);
diff --git a/drivers/net/wireless/ath/ath11k/pci.h b/drivers/net/wireless/ath/ath11k/pci.h
index 7c7fa1965aa6..83b485be6c50 100644
--- a/drivers/net/wireless/ath/ath11k/pci.h
+++ b/drivers/net/wireless/ath/ath11k/pci.h
@@ -2,6 +2,10 @@
 /*
  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
  */
+#ifndef _ATH11K_PCI_H
+#define _ATH11K_PCI_H
+
+#include <linux/mhi.h>
 
 #define QCA6290_VENDOR_ID		0x17CB
 #define QCA6290_DEVICE_ID		0x1100
@@ -33,4 +37,13 @@ struct ath11k_pci {
 	u32 chip_id;
 	struct ath11k_msi_config *msi_config;
 	u32 msi_ep_base_data;
+	struct mhi_controller *mhi_ctrl;
+	unsigned long mhi_state;
 };
+
+int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name,
+				       int *num_vectors, u32 *user_base_data,
+				       u32 *base_vector);
+
+int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector);
+#endif
-- 
2.22.0

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/4] ath11k: Add PCI client driver for QCA6390 chipset
  2020-05-08  8:58   ` Govind Singh
@ 2020-05-11 17:59     ` Kalle Valo
  -1 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-11 17:59 UTC (permalink / raw)
  To: Govind Singh; +Cc: ath11k, linux-wireless

Govind Singh <govinds@codeaurora.org> writes:

> QCA6390 is PCI based 11ax chipset, add
> pci client driver for QCA6390 target.
>
> Signed-off-by: Govind Singh <govinds@codeaurora.org>

This patch had multiple problems, most important ones were:

* a break missing in ath11k_pci_probe()

* it's not possible to have static variables in .h files, I fixed by
  moving the ring variables to core.c in a separate patch:

  https://patchwork.kernel.org/patch/11541355/

* this patch didn't link (at least when compiling as modules), I fixed
  those by adding missing EXPORT_SYMBOL() macros

Please double check my changes:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=44a28b572070f578914367dc2469cef48ece13f4

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/4] ath11k: Add PCI client driver for QCA6390 chipset
@ 2020-05-11 17:59     ` Kalle Valo
  0 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-11 17:59 UTC (permalink / raw)
  To: Govind Singh; +Cc: linux-wireless, ath11k

Govind Singh <govinds@codeaurora.org> writes:

> QCA6390 is PCI based 11ax chipset, add
> pci client driver for QCA6390 target.
>
> Signed-off-by: Govind Singh <govinds@codeaurora.org>

This patch had multiple problems, most important ones were:

* a break missing in ath11k_pci_probe()

* it's not possible to have static variables in .h files, I fixed by
  moving the ring variables to core.c in a separate patch:

  https://patchwork.kernel.org/patch/11541355/

* this patch didn't link (at least when compiling as modules), I fixed
  those by adding missing EXPORT_SYMBOL() macros

Please double check my changes:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=44a28b572070f578914367dc2469cef48ece13f4

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
  2020-05-08  8:58   ` Govind Singh
@ 2020-05-11 18:03     ` Kalle Valo
  -1 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-11 18:03 UTC (permalink / raw)
  To: Govind Singh; +Cc: ath11k, linux-wireless, Manivannan Sadhasivam

+ mani

Govind Singh <govinds@codeaurora.org> writes:

> MHI is a communication protocol to communicate with external
> Qualcomm modems and Wi-Fi chipsets over high speed peripheral buses. Even
> though MHI doesn’t dictate underlying physical layer, protocol and mhi stack
> is structured for PCIe based devices.
>
> Register directly with mhi core layer as a mhi device driver for
> firmware download.
>
> Tested QCA6390 on X86 platform.
> Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.
>
> Signed-off-by: Govind Singh <govinds@codeaurora.org>

[...]

> --- a/drivers/net/wireless/ath/ath11k/Kconfig
> +++ b/drivers/net/wireless/ath/ath11k/Kconfig
> @@ -2,7 +2,6 @@
>  config ATH11K
>  	tristate "Qualcomm Technologies 802.11ax chipset support"
>  	depends on MAC80211 && HAS_DMA
> -	depends on REMOTEPROC
>  	depends on CRYPTO_MICHAEL_MIC
>  	depends on ARCH_QCOM || COMPILE_TEST
>  	select ATH_COMMON
> @@ -15,13 +14,13 @@ config ATH11K
>  
>  config ATH11K_AHB
>  	tristate "Qualcomm Technologies 802.11ax chipset AHB support"
> -	depends on ATH11K
> +	depends on ATH11K && REMOTEPROC
>  	---help---
>  	  This module adds support for AHB bus
>  
>  config ATH11K_PCI
>  	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
> -	depends on ATH11K && PCI
> +	depends on ATH11K && PCI && MHI_BUS
>  	---help---
>  	  This module adds support for PCIE bus

Currently ATH11K_PCI is not visible if MHI_BUS is disabled, which I'm
worried will confuse the users. I wonder if we should use 'select
MHI_BUS' instead? That way ATH11K_PCI would be visible even if MHI_BUS
is disabled.

And what about QRTR_MHI? Mani, any suggestions?

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
@ 2020-05-11 18:03     ` Kalle Valo
  0 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-11 18:03 UTC (permalink / raw)
  To: Govind Singh; +Cc: linux-wireless, ath11k, Manivannan Sadhasivam

+ mani

Govind Singh <govinds@codeaurora.org> writes:

> MHI is a communication protocol to communicate with external
> Qualcomm modems and Wi-Fi chipsets over high speed peripheral buses. Even
> though MHI doesn’t dictate underlying physical layer, protocol and mhi stack
> is structured for PCIe based devices.
>
> Register directly with mhi core layer as a mhi device driver for
> firmware download.
>
> Tested QCA6390 on X86 platform.
> Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.
>
> Signed-off-by: Govind Singh <govinds@codeaurora.org>

[...]

> --- a/drivers/net/wireless/ath/ath11k/Kconfig
> +++ b/drivers/net/wireless/ath/ath11k/Kconfig
> @@ -2,7 +2,6 @@
>  config ATH11K
>  	tristate "Qualcomm Technologies 802.11ax chipset support"
>  	depends on MAC80211 && HAS_DMA
> -	depends on REMOTEPROC
>  	depends on CRYPTO_MICHAEL_MIC
>  	depends on ARCH_QCOM || COMPILE_TEST
>  	select ATH_COMMON
> @@ -15,13 +14,13 @@ config ATH11K
>  
>  config ATH11K_AHB
>  	tristate "Qualcomm Technologies 802.11ax chipset AHB support"
> -	depends on ATH11K
> +	depends on ATH11K && REMOTEPROC
>  	---help---
>  	  This module adds support for AHB bus
>  
>  config ATH11K_PCI
>  	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
> -	depends on ATH11K && PCI
> +	depends on ATH11K && PCI && MHI_BUS
>  	---help---
>  	  This module adds support for PCIE bus

Currently ATH11K_PCI is not visible if MHI_BUS is disabled, which I'm
worried will confuse the users. I wonder if we should use 'select
MHI_BUS' instead? That way ATH11K_PCI would be visible even if MHI_BUS
is disabled.

And what about QRTR_MHI? Mani, any suggestions?

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
  2020-05-08  8:58   ` Govind Singh
@ 2020-05-11 18:08     ` Kalle Valo
  -1 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-11 18:08 UTC (permalink / raw)
  To: Govind Singh; +Cc: ath11k, linux-wireless

Govind Singh <govinds@codeaurora.org> writes:

> MHI is a communication protocol to communicate with external
> Qualcomm modems and Wi-Fi chipsets over high speed peripheral buses. Even
> though MHI doesn’t dictate underlying physical layer, protocol and mhi stack
> is structured for PCIe based devices.
>
> Register directly with mhi core layer as a mhi device driver for
> firmware download.
>
> Tested QCA6390 on X86 platform.
> Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.
>
> Signed-off-by: Govind Singh <govinds@codeaurora.org>

[...]

> +int ath11k_pci_start_mhi(struct ath11k_pci *ar_pci);
> +void ath11k_pci_stop_mhi(struct ath11k_pci *ar_pci);
> +int ath11k_pci_register_mhi(struct ath11k_pci *ar_pci);
> +void ath11k_pci_unregister_mhi(struct ath11k_pci *ar_pci);

The schema for filenames is this:

ath11k_<filename>_<functionname>

So I changed all functions in mhi.c to follow that.

> +static int ath11k_pci_qca6x90_powerup(struct ath11k_pci *ab_pci)
> +{
> +	return ath11k_pci_start_mhi(ab_pci);
> +}
> +
> +static void ath11k_pci_qca6x90_powerdown(struct ath11k_pci *ab_pci)
> +{
> +	ath11k_pci_stop_mhi(ab_pci);
> +}

These looked like useless functions so I removed them.

> +static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
> +	.power_down = ath11k_pci_power_down,
> +	.power_up = ath11k_pci_power_up,
> +};

I added __always_unused as a temporary solution to avoid a compiler
warning, but we should remove that once we really use this.

> @@ -229,14 +313,26 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
>  		goto err_free_core;
>  	}
>  
> +	ab->mem = ab_pci->mem;
> +	ab->mem_len = ab_pci->mem_len;
> +
>  	ret = ath11k_pci_enable_msi(ab_pci);
>  	if (ret) {
>  		ath11k_err(ab, "failed to enable  msi: %d\n", ret);
>  		goto err_pci_free_region;
>  	}
>  
> +	ret = ath11k_pci_register_mhi(ab_pci);
> +	if (ret) {
> +		ath11k_err(ab, "failed to register  mhi: %d\n", ret);
> +		goto err_pci_disable_msi;
> +	}
> +
>  	return 0;

I added a warning here that PCI is work-in-progress. Oh, I need to add
that also to Kconfig.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
@ 2020-05-11 18:08     ` Kalle Valo
  0 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-11 18:08 UTC (permalink / raw)
  To: Govind Singh; +Cc: linux-wireless, ath11k

Govind Singh <govinds@codeaurora.org> writes:

> MHI is a communication protocol to communicate with external
> Qualcomm modems and Wi-Fi chipsets over high speed peripheral buses. Even
> though MHI doesn’t dictate underlying physical layer, protocol and mhi stack
> is structured for PCIe based devices.
>
> Register directly with mhi core layer as a mhi device driver for
> firmware download.
>
> Tested QCA6390 on X86 platform.
> Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.
>
> Signed-off-by: Govind Singh <govinds@codeaurora.org>

[...]

> +int ath11k_pci_start_mhi(struct ath11k_pci *ar_pci);
> +void ath11k_pci_stop_mhi(struct ath11k_pci *ar_pci);
> +int ath11k_pci_register_mhi(struct ath11k_pci *ar_pci);
> +void ath11k_pci_unregister_mhi(struct ath11k_pci *ar_pci);

The schema for filenames is this:

ath11k_<filename>_<functionname>

So I changed all functions in mhi.c to follow that.

> +static int ath11k_pci_qca6x90_powerup(struct ath11k_pci *ab_pci)
> +{
> +	return ath11k_pci_start_mhi(ab_pci);
> +}
> +
> +static void ath11k_pci_qca6x90_powerdown(struct ath11k_pci *ab_pci)
> +{
> +	ath11k_pci_stop_mhi(ab_pci);
> +}

These looked like useless functions so I removed them.

> +static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
> +	.power_down = ath11k_pci_power_down,
> +	.power_up = ath11k_pci_power_up,
> +};

I added __always_unused as a temporary solution to avoid a compiler
warning, but we should remove that once we really use this.

> @@ -229,14 +313,26 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
>  		goto err_free_core;
>  	}
>  
> +	ab->mem = ab_pci->mem;
> +	ab->mem_len = ab_pci->mem_len;
> +
>  	ret = ath11k_pci_enable_msi(ab_pci);
>  	if (ret) {
>  		ath11k_err(ab, "failed to enable  msi: %d\n", ret);
>  		goto err_pci_free_region;
>  	}
>  
> +	ret = ath11k_pci_register_mhi(ab_pci);
> +	if (ret) {
> +		ath11k_err(ab, "failed to register  mhi: %d\n", ret);
> +		goto err_pci_disable_msi;
> +	}
> +
>  	return 0;

I added a warning here that PCI is work-in-progress. Oh, I need to add
that also to Kconfig.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/4] ath11k: Add PCI client driver for QCA6390 chipset
  2020-05-11 17:59     ` Kalle Valo
@ 2020-05-12  5:31       ` govinds
  -1 siblings, 0 replies; 30+ messages in thread
From: govinds @ 2020-05-12  5:31 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath11k

Hi Kalle,

On 2020-05-11 23:29, Kalle Valo wrote:
> Govind Singh <govinds@codeaurora.org> writes:
> 
>> QCA6390 is PCI based 11ax chipset, add
>> pci client driver for QCA6390 target.
>> 
>> Signed-off-by: Govind Singh <govinds@codeaurora.org>
> 
> This patch had multiple problems, most important ones were:
> 
> * a break missing in ath11k_pci_probe()
> 

My bad. Thanks for fixing same.

> * it's not possible to have static variables in .h files, I fixed by
>   moving the ring variables to core.c in a separate patch:
> 
>   https://patchwork.kernel.org/patch/11541355/
> 
> * this patch didn't link (at least when compiling as modules), I fixed
>   those by adding missing EXPORT_SYMBOL() macros
> 

Looks, this is required after moving the ring mask from ahb to core.

> Please double check my changes:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=44a28b572070f578914367dc2469cef48ece13f4

Looks good to me.

BR,
Govind

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/4] ath11k: Add PCI client driver for QCA6390 chipset
@ 2020-05-12  5:31       ` govinds
  0 siblings, 0 replies; 30+ messages in thread
From: govinds @ 2020-05-12  5:31 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, ath11k

Hi Kalle,

On 2020-05-11 23:29, Kalle Valo wrote:
> Govind Singh <govinds@codeaurora.org> writes:
> 
>> QCA6390 is PCI based 11ax chipset, add
>> pci client driver for QCA6390 target.
>> 
>> Signed-off-by: Govind Singh <govinds@codeaurora.org>
> 
> This patch had multiple problems, most important ones were:
> 
> * a break missing in ath11k_pci_probe()
> 

My bad. Thanks for fixing same.

> * it's not possible to have static variables in .h files, I fixed by
>   moving the ring variables to core.c in a separate patch:
> 
>   https://patchwork.kernel.org/patch/11541355/
> 
> * this patch didn't link (at least when compiling as modules), I fixed
>   those by adding missing EXPORT_SYMBOL() macros
> 

Looks, this is required after moving the ring mask from ahb to core.

> Please double check my changes:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=44a28b572070f578914367dc2469cef48ece13f4

Looks good to me.

BR,
Govind

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
  2020-05-11 18:03     ` Kalle Valo
@ 2020-05-12  7:13       ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 30+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-12  7:13 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Govind Singh, ath11k, linux-wireless

Hi Kalle,

On Mon, May 11, 2020 at 09:03:56PM +0300, Kalle Valo wrote:
> + mani
> 
> Govind Singh <govinds@codeaurora.org> writes:
> 
> > MHI is a communication protocol to communicate with external
> > Qualcomm modems and Wi-Fi chipsets over high speed peripheral buses. Even
> > though MHI doesn’t dictate underlying physical layer, protocol and mhi stack
> > is structured for PCIe based devices.
> >
> > Register directly with mhi core layer as a mhi device driver for
> > firmware download.
> >
> > Tested QCA6390 on X86 platform.
> > Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.
> >
> > Signed-off-by: Govind Singh <govinds@codeaurora.org>
> 

Ah,finally!

> [...]
> 
> > --- a/drivers/net/wireless/ath/ath11k/Kconfig
> > +++ b/drivers/net/wireless/ath/ath11k/Kconfig
> > @@ -2,7 +2,6 @@
> >  config ATH11K
> >  	tristate "Qualcomm Technologies 802.11ax chipset support"
> >  	depends on MAC80211 && HAS_DMA
> > -	depends on REMOTEPROC
> >  	depends on CRYPTO_MICHAEL_MIC
> >  	depends on ARCH_QCOM || COMPILE_TEST
> >  	select ATH_COMMON
> > @@ -15,13 +14,13 @@ config ATH11K
> >  
> >  config ATH11K_AHB
> >  	tristate "Qualcomm Technologies 802.11ax chipset AHB support"
> > -	depends on ATH11K
> > +	depends on ATH11K && REMOTEPROC
> >  	---help---
> >  	  This module adds support for AHB bus
> >  
> >  config ATH11K_PCI
> >  	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
> > -	depends on ATH11K && PCI
> > +	depends on ATH11K && PCI && MHI_BUS
> >  	---help---
> >  	  This module adds support for PCIE bus
> 
> Currently ATH11K_PCI is not visible if MHI_BUS is disabled, which I'm
> worried will confuse the users. I wonder if we should use 'select
> MHI_BUS' instead? That way ATH11K_PCI would be visible even if MHI_BUS
> is disabled.
> 

Right, this sounds good to me.

> And what about QRTR_MHI? Mani, any suggestions?
> 

Are you asking for Kconfig dependency? If yes, then you need to select it here
also as you can't do much without it.

Btw, I'm not CCed for the patch so I haven't looked at it. But we have made few
changes to the MHI stack which will impact the controller drivers. So I'd
suggest you to rebase MHI controller patch on top of mhi-next [1]. The proposed
changes in MHI will hopefully land in 5.8.

Thanks,
Mani

[1] https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git/log/?h=mhi-next

> -- 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
@ 2020-05-12  7:13       ` Manivannan Sadhasivam
  0 siblings, 0 replies; 30+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-12  7:13 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Govind Singh, linux-wireless, ath11k

Hi Kalle,

On Mon, May 11, 2020 at 09:03:56PM +0300, Kalle Valo wrote:
> + mani
> 
> Govind Singh <govinds@codeaurora.org> writes:
> 
> > MHI is a communication protocol to communicate with external
> > Qualcomm modems and Wi-Fi chipsets over high speed peripheral buses. Even
> > though MHI doesn’t dictate underlying physical layer, protocol and mhi stack
> > is structured for PCIe based devices.
> >
> > Register directly with mhi core layer as a mhi device driver for
> > firmware download.
> >
> > Tested QCA6390 on X86 platform.
> > Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.
> >
> > Signed-off-by: Govind Singh <govinds@codeaurora.org>
> 

Ah,finally!

> [...]
> 
> > --- a/drivers/net/wireless/ath/ath11k/Kconfig
> > +++ b/drivers/net/wireless/ath/ath11k/Kconfig
> > @@ -2,7 +2,6 @@
> >  config ATH11K
> >  	tristate "Qualcomm Technologies 802.11ax chipset support"
> >  	depends on MAC80211 && HAS_DMA
> > -	depends on REMOTEPROC
> >  	depends on CRYPTO_MICHAEL_MIC
> >  	depends on ARCH_QCOM || COMPILE_TEST
> >  	select ATH_COMMON
> > @@ -15,13 +14,13 @@ config ATH11K
> >  
> >  config ATH11K_AHB
> >  	tristate "Qualcomm Technologies 802.11ax chipset AHB support"
> > -	depends on ATH11K
> > +	depends on ATH11K && REMOTEPROC
> >  	---help---
> >  	  This module adds support for AHB bus
> >  
> >  config ATH11K_PCI
> >  	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
> > -	depends on ATH11K && PCI
> > +	depends on ATH11K && PCI && MHI_BUS
> >  	---help---
> >  	  This module adds support for PCIE bus
> 
> Currently ATH11K_PCI is not visible if MHI_BUS is disabled, which I'm
> worried will confuse the users. I wonder if we should use 'select
> MHI_BUS' instead? That way ATH11K_PCI would be visible even if MHI_BUS
> is disabled.
> 

Right, this sounds good to me.

> And what about QRTR_MHI? Mani, any suggestions?
> 

Are you asking for Kconfig dependency? If yes, then you need to select it here
also as you can't do much without it.

Btw, I'm not CCed for the patch so I haven't looked at it. But we have made few
changes to the MHI stack which will impact the controller drivers. So I'd
suggest you to rebase MHI controller patch on top of mhi-next [1]. The proposed
changes in MHI will hopefully land in 5.8.

Thanks,
Mani

[1] https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git/log/?h=mhi-next

> -- 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
  2020-05-12  7:13       ` Manivannan Sadhasivam
@ 2020-05-12  8:19         ` Kalle Valo
  -1 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-12  8:19 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: Govind Singh, linux-wireless, ath11k

Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> writes:

> Hi Kalle,
>
> On Mon, May 11, 2020 at 09:03:56PM +0300, Kalle Valo wrote:
>> 
>> Govind Singh <govinds@codeaurora.org> writes:
>> 
>> >  config ATH11K_PCI
>> >  	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
>> > -	depends on ATH11K && PCI
>> > +	depends on ATH11K && PCI && MHI_BUS
>> >  	---help---
>> >  	  This module adds support for PCIE bus
>> 
>> Currently ATH11K_PCI is not visible if MHI_BUS is disabled, which I'm
>> worried will confuse the users. I wonder if we should use 'select
>> MHI_BUS' instead? That way ATH11K_PCI would be visible even if MHI_BUS
>> is disabled.
>> 
>
> Right, this sounds good to me.

Good, I added that in the pending branch.

>> And what about QRTR_MHI? Mani, any suggestions?
>> 
>
> Are you asking for Kconfig dependency? If yes, then you need to select it here
> also as you can't do much without it.

Ok, I added QRTR_MHI to Kconfig as well I also had to add "select MHI"
as othwerwise I would get this warning:

WARNING: unmet direct dependencies detected for QRTR_MHI
  Depends on [n]: NET [=y] && QRTR [=n] && MHI_BUS [=m]
  Selected by [m]:
  - ATH11K_PCI [=m] && NETDEVICES [=y] && WLAN [=y] && WLAN_VENDOR_ATH [=y] && ATH11K [=m] && PCI [=y]

So now Kconfig looks like:

config ATH11K_PCI
	tristate "Qualcomm Technologies 802.11ax chipset PCI support (work in-progress)"
	depends on ATH11K && PCI
	select MHI_BUS
	select QRTR
	select QRTR_MHI
	---help---
	  This module adds support for PCIE bus

Govind&Mani, please check my changes in the pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=5ebf69d1db8b027671b642e3ba0bec3d7c73acb7

> Btw, I'm not CCed for the patch so I haven't looked at it.

This patchset is in my pending branch, link above.

> But we have made few changes to the MHI stack which will impact the
> controller drivers.

Oh, that will create problems. What kind of changes are needed in
ath11k?

> So I'd suggest you to rebase MHI controller patch on top of mhi-next
> [1]. The proposed changes in MHI will hopefully land in 5.8.

I cannot rebase on top mhi-next as my patches go through net-next. One
option I can think of is that I'll pull (not rebase!) mhi-next to my
tree, but I would need to check with David Miller first and I'm not sure
if it's worth the trouble. I think easiest is that we find minimal
possible changes needed to accommodate the new MHI interface and then
inform Linus and Stephen when do the merges.

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git/log/?h=mhi-next

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
@ 2020-05-12  8:19         ` Kalle Valo
  0 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-12  8:19 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: Govind Singh, linux-wireless, ath11k

Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> writes:

> Hi Kalle,
>
> On Mon, May 11, 2020 at 09:03:56PM +0300, Kalle Valo wrote:
>> 
>> Govind Singh <govinds@codeaurora.org> writes:
>> 
>> >  config ATH11K_PCI
>> >  	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
>> > -	depends on ATH11K && PCI
>> > +	depends on ATH11K && PCI && MHI_BUS
>> >  	---help---
>> >  	  This module adds support for PCIE bus
>> 
>> Currently ATH11K_PCI is not visible if MHI_BUS is disabled, which I'm
>> worried will confuse the users. I wonder if we should use 'select
>> MHI_BUS' instead? That way ATH11K_PCI would be visible even if MHI_BUS
>> is disabled.
>> 
>
> Right, this sounds good to me.

Good, I added that in the pending branch.

>> And what about QRTR_MHI? Mani, any suggestions?
>> 
>
> Are you asking for Kconfig dependency? If yes, then you need to select it here
> also as you can't do much without it.

Ok, I added QRTR_MHI to Kconfig as well I also had to add "select MHI"
as othwerwise I would get this warning:

WARNING: unmet direct dependencies detected for QRTR_MHI
  Depends on [n]: NET [=y] && QRTR [=n] && MHI_BUS [=m]
  Selected by [m]:
  - ATH11K_PCI [=m] && NETDEVICES [=y] && WLAN [=y] && WLAN_VENDOR_ATH [=y] && ATH11K [=m] && PCI [=y]

So now Kconfig looks like:

config ATH11K_PCI
	tristate "Qualcomm Technologies 802.11ax chipset PCI support (work in-progress)"
	depends on ATH11K && PCI
	select MHI_BUS
	select QRTR
	select QRTR_MHI
	---help---
	  This module adds support for PCIE bus

Govind&Mani, please check my changes in the pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=5ebf69d1db8b027671b642e3ba0bec3d7c73acb7

> Btw, I'm not CCed for the patch so I haven't looked at it.

This patchset is in my pending branch, link above.

> But we have made few changes to the MHI stack which will impact the
> controller drivers.

Oh, that will create problems. What kind of changes are needed in
ath11k?

> So I'd suggest you to rebase MHI controller patch on top of mhi-next
> [1]. The proposed changes in MHI will hopefully land in 5.8.

I cannot rebase on top mhi-next as my patches go through net-next. One
option I can think of is that I'll pull (not rebase!) mhi-next to my
tree, but I would need to check with David Miller first and I'm not sure
if it's worth the trouble. I think easiest is that we find minimal
possible changes needed to accommodate the new MHI interface and then
inform Linus and Stephen when do the merges.

> [1] https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git/log/?h=mhi-next

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
  2020-05-12  8:19         ` Kalle Valo
@ 2020-05-12  8:24           ` Kalle Valo
  -1 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-12  8:24 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: Govind Singh, linux-wireless, ath11k

Kalle Valo <kvalo@codeaurora.org> writes:

>> But we have made few changes to the MHI stack which will impact the
>> controller drivers.
>
> Oh, that will create problems. What kind of changes are needed in
> ath11k?

I did a test of pulling
'git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git mhi-next' to
my pending branch and at least it compiled without issues. So hopefully
the changes in mhi-next won't break ath11k.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
@ 2020-05-12  8:24           ` Kalle Valo
  0 siblings, 0 replies; 30+ messages in thread
From: Kalle Valo @ 2020-05-12  8:24 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: Govind Singh, linux-wireless, ath11k

Kalle Valo <kvalo@codeaurora.org> writes:

>> But we have made few changes to the MHI stack which will impact the
>> controller drivers.
>
> Oh, that will create problems. What kind of changes are needed in
> ath11k?

I did a test of pulling
'git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git mhi-next' to
my pending branch and at least it compiled without issues. So hopefully
the changes in mhi-next won't break ath11k.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
  2020-05-12  8:19         ` Kalle Valo
@ 2020-05-12  9:00           ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 30+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-12  9:00 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Govind Singh, linux-wireless, ath11k

On Tue, May 12, 2020 at 11:19:04AM +0300, Kalle Valo wrote:
> Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> writes:
> 
> > Hi Kalle,
> >
> > On Mon, May 11, 2020 at 09:03:56PM +0300, Kalle Valo wrote:
> >> 
> >> Govind Singh <govinds@codeaurora.org> writes:
> >> 
> >> >  config ATH11K_PCI
> >> >  	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
> >> > -	depends on ATH11K && PCI
> >> > +	depends on ATH11K && PCI && MHI_BUS
> >> >  	---help---
> >> >  	  This module adds support for PCIE bus
> >> 
> >> Currently ATH11K_PCI is not visible if MHI_BUS is disabled, which I'm
> >> worried will confuse the users. I wonder if we should use 'select
> >> MHI_BUS' instead? That way ATH11K_PCI would be visible even if MHI_BUS
> >> is disabled.
> >> 
> >
> > Right, this sounds good to me.
> 
> Good, I added that in the pending branch.
> 
> >> And what about QRTR_MHI? Mani, any suggestions?
> >> 
> >
> > Are you asking for Kconfig dependency? If yes, then you need to select it here
> > also as you can't do much without it.
> 
> Ok, I added QRTR_MHI to Kconfig as well I also had to add "select MHI"
> as othwerwise I would get this warning:
> 
> WARNING: unmet direct dependencies detected for QRTR_MHI
>   Depends on [n]: NET [=y] && QRTR [=n] && MHI_BUS [=m]
>   Selected by [m]:
>   - ATH11K_PCI [=m] && NETDEVICES [=y] && WLAN [=y] && WLAN_VENDOR_ATH [=y] && ATH11K [=m] && PCI [=y]
> 
> So now Kconfig looks like:
> 
> config ATH11K_PCI
> 	tristate "Qualcomm Technologies 802.11ax chipset PCI support (work in-progress)"
> 	depends on ATH11K && PCI
> 	select MHI_BUS
> 	select QRTR
> 	select QRTR_MHI

LGTM. I should have selected MHI_BUS in QRTR_MHI... but that's fine.

> 	---help---
> 	  This module adds support for PCIE bus
> 
> Govind&Mani, please check my changes in the pending branch:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=5ebf69d1db8b027671b642e3ba0bec3d7c73acb7
> 
> > Btw, I'm not CCed for the patch so I haven't looked at it.
> 
> This patchset is in my pending branch, link above.
> 
> > But we have made few changes to the MHI stack which will impact the
> > controller drivers.
> 
> Oh, that will create problems. What kind of changes are needed in
> ath11k?
> 

I looked into your patch and the only change needed is below:

```
void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr,
                   u32 val)
{
        writel(val, addr);
}

int mhi_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr,
                 u32 *out)
{
       u32 tmp = readl(addr);

       *out = tmp;

       return 0;
}
...
        mhi_ctrl->read_reg = mhi_read_reg;
        mhi_ctrl->write_reg = mhi_write_reg;
```

So we have offloaded the MHI read/write calls to controller drivers as they
are truly physical layer dependent. So the MHI stack just calls the callback
for reading/writing to MHI register space.

> > So I'd suggest you to rebase MHI controller patch on top of mhi-next
> > [1]. The proposed changes in MHI will hopefully land in 5.8.
> 
> I cannot rebase on top mhi-next as my patches go through net-next. One
> option I can think of is that I'll pull (not rebase!) mhi-next to my
> tree, but I would need to check with David Miller first and I'm not sure
> if it's worth the trouble. I think easiest is that we find minimal
> possible changes needed to accommodate the new MHI interface and then
> inform Linus and Stephen when do the merges.
> 

One more option is to create an immutable branch on top of RC like v5.7-rc1
which has the offending patches. Then we can do the pull of this immutable
branch into our respective trees.

Then finally when Linus pulls these two trees, he'll see that these are the
same commits and he should be fine. Only thing we should make sure is to inform
the respective subsystem maintainers to mention this to Linus during pull
request.

For sure the commits will appear in two shortlogs but that won't be an issue.

Let me know what you think.

Thanks,
Mani

> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git/log/?h=mhi-next
> 
> -- 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
@ 2020-05-12  9:00           ` Manivannan Sadhasivam
  0 siblings, 0 replies; 30+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-12  9:00 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Govind Singh, linux-wireless, ath11k

On Tue, May 12, 2020 at 11:19:04AM +0300, Kalle Valo wrote:
> Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> writes:
> 
> > Hi Kalle,
> >
> > On Mon, May 11, 2020 at 09:03:56PM +0300, Kalle Valo wrote:
> >> 
> >> Govind Singh <govinds@codeaurora.org> writes:
> >> 
> >> >  config ATH11K_PCI
> >> >  	tristate "Qualcomm Technologies 802.11ax chipset PCI support"
> >> > -	depends on ATH11K && PCI
> >> > +	depends on ATH11K && PCI && MHI_BUS
> >> >  	---help---
> >> >  	  This module adds support for PCIE bus
> >> 
> >> Currently ATH11K_PCI is not visible if MHI_BUS is disabled, which I'm
> >> worried will confuse the users. I wonder if we should use 'select
> >> MHI_BUS' instead? That way ATH11K_PCI would be visible even if MHI_BUS
> >> is disabled.
> >> 
> >
> > Right, this sounds good to me.
> 
> Good, I added that in the pending branch.
> 
> >> And what about QRTR_MHI? Mani, any suggestions?
> >> 
> >
> > Are you asking for Kconfig dependency? If yes, then you need to select it here
> > also as you can't do much without it.
> 
> Ok, I added QRTR_MHI to Kconfig as well I also had to add "select MHI"
> as othwerwise I would get this warning:
> 
> WARNING: unmet direct dependencies detected for QRTR_MHI
>   Depends on [n]: NET [=y] && QRTR [=n] && MHI_BUS [=m]
>   Selected by [m]:
>   - ATH11K_PCI [=m] && NETDEVICES [=y] && WLAN [=y] && WLAN_VENDOR_ATH [=y] && ATH11K [=m] && PCI [=y]
> 
> So now Kconfig looks like:
> 
> config ATH11K_PCI
> 	tristate "Qualcomm Technologies 802.11ax chipset PCI support (work in-progress)"
> 	depends on ATH11K && PCI
> 	select MHI_BUS
> 	select QRTR
> 	select QRTR_MHI

LGTM. I should have selected MHI_BUS in QRTR_MHI... but that's fine.

> 	---help---
> 	  This module adds support for PCIE bus
> 
> Govind&Mani, please check my changes in the pending branch:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=5ebf69d1db8b027671b642e3ba0bec3d7c73acb7
> 
> > Btw, I'm not CCed for the patch so I haven't looked at it.
> 
> This patchset is in my pending branch, link above.
> 
> > But we have made few changes to the MHI stack which will impact the
> > controller drivers.
> 
> Oh, that will create problems. What kind of changes are needed in
> ath11k?
> 

I looked into your patch and the only change needed is below:

```
void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr,
                   u32 val)
{
        writel(val, addr);
}

int mhi_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr,
                 u32 *out)
{
       u32 tmp = readl(addr);

       *out = tmp;

       return 0;
}
...
        mhi_ctrl->read_reg = mhi_read_reg;
        mhi_ctrl->write_reg = mhi_write_reg;
```

So we have offloaded the MHI read/write calls to controller drivers as they
are truly physical layer dependent. So the MHI stack just calls the callback
for reading/writing to MHI register space.

> > So I'd suggest you to rebase MHI controller patch on top of mhi-next
> > [1]. The proposed changes in MHI will hopefully land in 5.8.
> 
> I cannot rebase on top mhi-next as my patches go through net-next. One
> option I can think of is that I'll pull (not rebase!) mhi-next to my
> tree, but I would need to check with David Miller first and I'm not sure
> if it's worth the trouble. I think easiest is that we find minimal
> possible changes needed to accommodate the new MHI interface and then
> inform Linus and Stephen when do the merges.
> 

One more option is to create an immutable branch on top of RC like v5.7-rc1
which has the offending patches. Then we can do the pull of this immutable
branch into our respective trees.

Then finally when Linus pulls these two trees, he'll see that these are the
same commits and he should be fine. Only thing we should make sure is to inform
the respective subsystem maintainers to mention this to Linus during pull
request.

For sure the commits will appear in two shortlogs but that won't be an issue.

Let me know what you think.

Thanks,
Mani

> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git/log/?h=mhi-next
> 
> -- 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
  2020-05-08  8:58   ` Govind Singh
@ 2020-05-15  3:28     ` Carl Huang
  -1 siblings, 0 replies; 30+ messages in thread
From: Carl Huang @ 2020-05-15  3:28 UTC (permalink / raw)
  To: Govind Singh, ath11k; +Cc: linux-wireless



> -----Original Message-----
> From: ath11k <ath11k-bounces@lists.infradead.org> On Behalf Of Govind
> Singh
> Sent: Friday, May 8, 2020 4:59 PM
> To: ath11k@lists.infradead.org
> Cc: Govind Singh <govinds@codeaurora.org>; linux-
> wireless@vger.kernel.org
> Subject: [EXT] [PATCH 4/4] ath11k: Register mhi controller device for
> qca6390
>
> MHI is a communication protocol to communicate with external Qualcomm
> modems and Wi-Fi chipsets over high speed peripheral buses. Even though
> MHI doesn’t dictate underlying physical layer, protocol and mhi stack is
> structured for PCIe based devices.
>
> Register directly with mhi core layer as a mhi device driver for firmware
> download.
>
> Tested QCA6390 on X86 platform.
> Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.
>
> Signed-off-by: Govind Singh <govinds@codeaurora.org>
> ---
>  drivers/net/wireless/ath/ath11k/Kconfig  |   5 +-
>  drivers/net/wireless/ath/ath11k/Makefile |   2 +-
>  drivers/net/wireless/ath/ath11k/mhi.c    | 379 +++++++++++++++++++++++
>  drivers/net/wireless/ath/ath11k/mhi.h    |  28 ++
>  drivers/net/wireless/ath/ath11k/pci.c    |  97 ++++++
>  drivers/net/wireless/ath/ath11k/pci.h    |  13 +
>  6 files changed, 520 insertions(+), 4 deletions(-)  create mode 100644
> drivers/net/wireless/ath/ath11k/mhi.c
>  create mode 100644 drivers/net/wireless/ath/ath11k/mhi.h
>
> diff --git a/drivers/net/wireless/ath/ath11k/Kconfig
> b/drivers/net/wireless/ath/ath11k/Kconfig
> index 320b3b151bce..bd48796742bb 100644
> --- a/drivers/net/wireless/ath/ath11k/Kconfig
> +++ b/drivers/net/wireless/ath/ath11k/Kconfig
> @@ -2,7 +2,6 @@
>  config ATH11K
>  tristate "Qualcomm Technologies 802.11ax chipset support"
>  depends on MAC80211 && HAS_DMA
> -depends on REMOTEPROC
>  depends on CRYPTO_MICHAEL_MIC
>  depends on ARCH_QCOM || COMPILE_TEST
>  select ATH_COMMON
> @@ -15,13 +14,13 @@ config ATH11K
>
>  config ATH11K_AHB
>  tristate "Qualcomm Technologies 802.11ax chipset AHB support"
> -depends on ATH11K
> +depends on ATH11K && REMOTEPROC
>  ---help---
>    This module adds support for AHB bus
>
>  config ATH11K_PCI
>  tristate "Qualcomm Technologies 802.11ax chipset PCI support"
> -depends on ATH11K && PCI
> +depends on ATH11K && PCI && MHI_BUS
>  ---help---
>    This module adds support for PCIE bus
>
> diff --git a/drivers/net/wireless/ath/ath11k/Makefile
> b/drivers/net/wireless/ath/ath11k/Makefile
> index 933fcb2fd55d..8343c7dfaae3 100644
> --- a/drivers/net/wireless/ath/ath11k/Makefile
> +++ b/drivers/net/wireless/ath/ath11k/Makefile
> @@ -25,7 +25,7 @@ obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o
> ath11k_ahb-y += ahb.o
>
>  obj-$(CONFIG_ATH11K_PCI) += ath11k_pci.o -ath11k_pci-y += pci.o
> +ath11k_pci-y += mhi.o pci.o
>
>  # for tracing framework to find trace.h  CFLAGS_trace.o := -I$(src) diff --git
> a/drivers/net/wireless/ath/ath11k/mhi.c
> b/drivers/net/wireless/ath/ath11k/mhi.c
> new file mode 100644
> index 000000000000..1ca43243e265
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath11k/mhi.c
> @@ -0,0 +1,379 @@
> +// SPDX-License-Identifier: BSD-3-Clause-Clear
> +/* Copyright (c) 2020 The Linux Foundation. All rights reserved. */
> +
> +#include <linux/msi.h>
> +#include <linux/pci.h>
> +
> +#include "debug.h"
> +#include "mhi.h"
> +
> +#define MHI_TIMEOUT_DEFAULT_MS90000
> +
> +static struct mhi_channel_config ath11k_mhi_channels[] = {
> +{
> +.num = 0,
> +.name = "LOOPBACK",
> +.num_elements = 32,
> +.event_ring = 0,
> +.dir = DMA_TO_DEVICE,
> +.ee_mask = 0x4,
> +.pollcfg = 0,
> +.doorbell = MHI_DB_BRST_DISABLE,
> +.lpm_notify = false,
> +.offload_channel = false,
> +.doorbell_mode_switch = false,
> +.auto_queue = false,
> +.auto_start = false,
> +},
> +{
> +.num = 1,
> +.name = "LOOPBACK",
> +.num_elements = 32,
> +.event_ring = 0,
> +.dir = DMA_FROM_DEVICE,
> +.ee_mask = 0x4,
> +.pollcfg = 0,
> +.doorbell = MHI_DB_BRST_DISABLE,
> +.lpm_notify = false,
> +.offload_channel = false,
> +.doorbell_mode_switch = false,
> +.auto_queue = false,
> +.auto_start = false,
> +},
> +{
> +.num = 20,
> +.name = "IPCR",
> +.num_elements = 64,
> +.event_ring = 1,
> +.dir = DMA_TO_DEVICE,
> +.ee_mask = 0x4,
> +.pollcfg = 0,
> +.doorbell = MHI_DB_BRST_DISABLE,
> +.lpm_notify = false,
> +.offload_channel = false,
> +.doorbell_mode_switch = false,
> +.auto_queue = false,
> +.auto_start = true,
> +},
> +{
> +.num = 21,
> +.name = "IPCR",
> +.num_elements = 64,
> +.event_ring = 1,
> +.dir = DMA_FROM_DEVICE,
> +.ee_mask = 0x4,
> +.pollcfg = 0,
> +.doorbell = MHI_DB_BRST_DISABLE,
> +.lpm_notify = false,
> +.offload_channel = false,
> +.doorbell_mode_switch = false,
> +.auto_queue = true,
> +.auto_start = true,
> +},
> +};
> +
> +static struct mhi_event_config ath11k_mhi_events[] = {
> +{
> +.num_elements = 32,
> +.irq_moderation_ms = 0,
> +.irq = 1,
> +.mode = MHI_DB_BRST_DISABLE,

For this evern ring, need to specify  .data_type = MHI_ER_CTRL,

> +.hardware_event = false,
> +.client_managed = false,
> +.offload_channel = false,
> +},
> +{
> +.num_elements = 256,
> +.irq_moderation_ms = 1,
> +.irq = 2,
> +.mode = MHI_DB_BRST_DISABLE,
> +.priority = 1,
> +.hardware_event = false,
> +.client_managed = false,
> +.offload_channel = false,
> +},
> +};
> +
> +static struct mhi_controller_config ath11k_mhi_config = {
> +.max_channels = 128,
> +.timeout_ms = 2000,
> +.use_bounce_buf = false,
> +.buf_len = 0,
> +.num_channels = ARRAY_SIZE(ath11k_mhi_channels),
> +.ch_cfg = ath11k_mhi_channels,
> +.num_events = ARRAY_SIZE(ath11k_mhi_events),
> +.event_cfg = ath11k_mhi_events,
> +};
> +
> +static int ath11k_pci_get_mhi_msi(struct ath11k_pci *ab_pci) {
> +struct ath11k_base *ab = ab_pci->ab;
> +u32 user_base_data, base_vector;
> +int ret, num_vectors, i;
> +int *irq;
> +
> +ret = ath11k_pci_get_user_msi_assignment(ab_pci,
> + "MHI", &num_vectors,
> + &user_base_data,
> &base_vector);
> +if (ret)
> +return ret;
> +
> +ath11k_dbg(ab, ATH11K_DBG_PCI, "Number of assigned MSI for MHI
> is %d, base vector is %d\n",
> +   num_vectors, base_vector);
> +
> +irq = kcalloc(num_vectors, sizeof(int), GFP_KERNEL);
> +if (!irq)
> +return -ENOMEM;
> +
> +for (i = 0; i < num_vectors; i++)
> +irq[i] = ath11k_pci_get_msi_irq(ab_pci->dev,
> +base_vector + i);
> +
> +ab_pci->mhi_ctrl->irq = irq;
> +ab_pci->mhi_ctrl->nr_irqs = num_vectors;
> +
> +return 0;
> +}
> +
> +int ath11k_pci_register_mhi(struct ath11k_pci *ab_pci) {
> +struct ath11k_base *ab = ab_pci->ab;
> +struct mhi_controller *mhi_ctrl;
> +int ret;
> +
> +mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL);
> +if (!mhi_ctrl)
> +return PTR_ERR(mhi_ctrl);
> +
> +ab_pci->mhi_ctrl = mhi_ctrl;
> +mhi_ctrl->fw_image = ATH11K_PCI_FW_FILE_NAME;
> +mhi_ctrl->regs = ab_pci->mem;
> +
> +ret = ath11k_pci_get_mhi_msi(ab_pci);
> +if (ret) {
> +ath11k_err(ab, "failed to get msi for mhi\n");
> +kfree(mhi_ctrl);
> +return ret;
> +}
> +
> +mhi_ctrl->iova_start = 0;
> +mhi_ctrl->iova_stop = 0xffffffff;
> +mhi_ctrl->sbl_size = SZ_512K;
> +mhi_ctrl->seg_len = SZ_512K;
> +mhi_ctrl->fbc_download = true;
> +
> +ret = mhi_register_controller(mhi_ctrl, &ath11k_mhi_config);
> +if (ret) {
> +ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret);
> +kfree(mhi_ctrl);
> +return ret;
> +}
> +
> +return 0;
> +}
> +
> +void ath11k_pci_unregister_mhi(struct ath11k_pci *ab_pci) {
> +struct mhi_controller *mhi_ctrl = ab_pci->mhi_ctrl;
> +
> +mhi_unregister_controller(mhi_ctrl);
> +kfree(mhi_ctrl->irq);
> +}
> +
> +static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state) {
> +switch (mhi_state) {
> +case ATH11K_MHI_INIT:
> +return "INIT";
> +case ATH11K_MHI_DEINIT:
> +return "DEINIT";
> +case ATH11K_MHI_POWER_ON:
> +return "POWER_ON";
> +case ATH11K_MHI_POWER_OFF:
> +return "POWER_OFF";
> +case ATH11K_MHI_FORCE_POWER_OFF:
> +return "FORCE_POWER_OFF";
> +case ATH11K_MHI_SUSPEND:
> +return "SUSPEND";
> +case ATH11K_MHI_RESUME:
> +return "RESUME";
> +case ATH11K_MHI_TRIGGER_RDDM:
> +return "TRIGGER_RDDM";
> +case ATH11K_MHI_RDDM_DONE:
> +return "RDDM_DONE";
> +default:
> +return "UNKNOWN";
> +}
> +};
> +
> +static void ath11k_pci_set_mhi_state_bit(struct ath11k_pci *ab_pci,
> + enum ath11k_mhi_state mhi_state)
> +{
> +struct ath11k_base *ab = ab_pci->ab;
> +
> +switch (mhi_state) {
> +case ATH11K_MHI_INIT:
> +set_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_DEINIT:
> +clear_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_POWER_ON:
> +set_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_POWER_OFF:
> +case ATH11K_MHI_FORCE_POWER_OFF:
> +clear_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state);
> +clear_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci-
> >mhi_state);
> +clear_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_SUSPEND:
> +set_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_RESUME:
> +clear_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_TRIGGER_RDDM:
> +set_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_RDDM_DONE:
> +set_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state);
> +break;
> +default:
> +ath11k_err(ab, "unhandled mhi state (%d)\n", mhi_state);
> +}
> +}
> +
> +static int ath11k_pci_check_mhi_state_bit(struct ath11k_pci *ab_pci,
> +  enum ath11k_mhi_state mhi_state)
> {
> +struct ath11k_base *ab = ab_pci->ab;
> +
> +switch (mhi_state) {
> +case ATH11K_MHI_INIT:
> +if (!test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_DEINIT:
> +case ATH11K_MHI_POWER_ON:
> +if (test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state) &&
> +    !test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_FORCE_POWER_OFF:
> +if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_POWER_OFF:
> +case ATH11K_MHI_SUSPEND:
> +if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state)
> &&
> +    !test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_RESUME:
> +if (test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_TRIGGER_RDDM:
> +if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state)
> &&
> +    !test_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci-
> >mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_RDDM_DONE:
> +return 0;
> +default:
> +ath11k_err(ab, "unhandled mhi state: %s(%d)\n",
> +   ath11k_mhi_state_to_str(mhi_state), mhi_state);
> +}
> +
> +ath11k_err(ab, "failed to set mhi state %s(%d) in current mhi state
> (0x%lx)\n",
> +   ath11k_mhi_state_to_str(mhi_state), mhi_state,
> +   ab_pci->mhi_state);
> +
> +return -EINVAL;
> +}
> +
> +static int ath11k_pci_set_mhi_state(struct ath11k_pci *ab_pci,
> +    enum ath11k_mhi_state mhi_state) {
> +struct ath11k_base *ab = ab_pci->ab;
> +int ret;
> +
> +ret = ath11k_pci_check_mhi_state_bit(ab_pci, mhi_state);
> +if (ret)
> +goto out;
> +
> +ath11k_dbg(ab, ATH11K_DBG_PCI, "setting mhi state: %s(%d)\n",
> +   ath11k_mhi_state_to_str(mhi_state), mhi_state);
> +
> +switch (mhi_state) {
> +case ATH11K_MHI_INIT:
> +ret = mhi_prepare_for_power_up(ab_pci->mhi_ctrl);
> +break;
> +case ATH11K_MHI_DEINIT:
> +mhi_unprepare_after_power_down(ab_pci->mhi_ctrl);
> +ret = 0;
> +break;
> +case ATH11K_MHI_POWER_ON:
> +ret = mhi_async_power_up(ab_pci->mhi_ctrl);
> +break;
> +case ATH11K_MHI_POWER_OFF:
> +mhi_power_down(ab_pci->mhi_ctrl, true);
> +ret = 0;
> +break;
> +case ATH11K_MHI_FORCE_POWER_OFF:
> +mhi_power_down(ab_pci->mhi_ctrl, false);
> +ret = 0;
> +break;
> +case ATH11K_MHI_SUSPEND:
> +break;
> +case ATH11K_MHI_RESUME:
> +break;
> +case ATH11K_MHI_TRIGGER_RDDM:
> +ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl);
> +break;
> +case ATH11K_MHI_RDDM_DONE:
> +break;
> +default:
> +ath11k_err(ab, "unhandled MHI state (%d)\n", mhi_state);
> +ret = -EINVAL;
> +}
> +
> +if (ret)
> +goto out;
> +
> +ath11k_pci_set_mhi_state_bit(ab_pci, mhi_state);
> +
> +return 0;
> +
> +out:
> +ath11k_err(ab, "failed to set mhi state: %s(%d)\n",
> +   ath11k_mhi_state_to_str(mhi_state), mhi_state);
> +return ret;
> +}
> +
> +int ath11k_pci_start_mhi(struct ath11k_pci *ab_pci) {
> +struct ath11k_base *ab = ab_pci->ab;
> +int ret;
> +
> +ab_pci->mhi_ctrl->timeout_ms = MHI_TIMEOUT_DEFAULT_MS;
> +
> +ret = ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_INIT);
> +if (ret)
> +ath11k_err(ab, "failed to set mhi init state: %d\n", ret);
> +
> +ret = ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_POWER_ON);
> +if (ret)
> +ath11k_err(ab, "failed to set mhi power on state: %d\n", ret);
> +
> +return ret;
> +}
> +
> +void ath11k_pci_stop_mhi(struct ath11k_pci *ab_pci) {
> +ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_RESUME);
> +ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_POWER_OFF);
> +ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_DEINIT); }
> +
> diff --git a/drivers/net/wireless/ath/ath11k/mhi.h
> b/drivers/net/wireless/ath/ath11k/mhi.h
> new file mode 100644
> index 000000000000..355de5a2c241
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath11k/mhi.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: BSD-3-Clause-Clear */
> +/*
> + * Copyright (c) 2020 The Linux Foundation. All rights reserved.
> + */
> +#ifndef _ATH11K_MHI_H
> +#define _ATH11K_MHI_H
> +
> +#include "pci.h"
> +#define ATH11K_PCI_FW_FILE_NAME"amss.bin"
> +
> +enum ath11k_mhi_state {
> +ATH11K_MHI_INIT,
> +ATH11K_MHI_DEINIT,
> +ATH11K_MHI_POWER_ON,
> +ATH11K_MHI_POWER_OFF,
> +ATH11K_MHI_FORCE_POWER_OFF,
> +ATH11K_MHI_SUSPEND,
> +ATH11K_MHI_RESUME,
> +ATH11K_MHI_TRIGGER_RDDM,
> +ATH11K_MHI_RDDM,
> +ATH11K_MHI_RDDM_DONE,
> +};
> +
> +int ath11k_pci_start_mhi(struct ath11k_pci *ar_pci); void
> +ath11k_pci_stop_mhi(struct ath11k_pci *ar_pci); int
> +ath11k_pci_register_mhi(struct ath11k_pci *ar_pci); void
> +ath11k_pci_unregister_mhi(struct ath11k_pci *ar_pci); #endif
> diff --git a/drivers/net/wireless/ath/ath11k/pci.c
> b/drivers/net/wireless/ath/ath11k/pci.c
> index d89dcb5fe81e..938078ee8d80 100644
> --- a/drivers/net/wireless/ath/ath11k/pci.c
> +++ b/drivers/net/wireless/ath/ath11k/pci.c
> @@ -9,6 +9,8 @@
>
>  #include "ahb.h"
>  #include "core.h"
> +#include "hif.h"
> +#include "mhi.h"
>  #include "pci.h"
>  #include "debug.h"
>
> @@ -31,6 +33,60 @@ static struct ath11k_msi_config msi_config = {
>  },
>  };
>
> +int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector) {
> +struct pci_dev *pci_dev = to_pci_dev(dev);
> +int irq_num;
> +
> +irq_num = pci_irq_vector(pci_dev, vector);
> +
> +return irq_num;
> +}
> +
> +int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ab_pci, char
> *user_name,
> +       int *num_vectors, u32 *user_base_data,
> +       u32 *base_vector)
> +{
> +struct ath11k_base *ab = ab_pci->ab;
> +struct ath11k_msi_config *msi_config;
> +int idx;
> +
> +msi_config = ab_pci->msi_config;
> +if (!msi_config) {
> +ath11k_err(ab, "MSI is not supported.\n");
> +return -EINVAL;
> +}
> +
> +for (idx = 0; idx < msi_config->total_users; idx++) {
> +if (strcmp(user_name, msi_config->users[idx].name) == 0) {
> +*num_vectors = msi_config->users[idx].num_vectors;
> +*user_base_data = msi_config-
> >users[idx].base_vector
> ++ ab_pci->msi_ep_base_data;
> +*base_vector = msi_config->users[idx].base_vector;
> +
> +ath11k_dbg(ab, ATH11K_DBG_PCI, "Assign MSI to
> user: %s, num_vectors: %d, user_base_data: %u, base_vector: %u\n",
> +   user_name, *num_vectors,
> *user_base_data,
> +   *base_vector);
> +
> +return 0;
> +}
> +}
> +
> +ath11k_err(ab, "Failed to find MSI assignment for %s!\n",
> user_name);
> +
> +return -EINVAL;
> +}
> +
> +static int ath11k_pci_qca6x90_powerup(struct ath11k_pci *ab_pci) {
> +return ath11k_pci_start_mhi(ab_pci);
> +}
> +
> +static void ath11k_pci_qca6x90_powerdown(struct ath11k_pci *ab_pci) {
> +ath11k_pci_stop_mhi(ab_pci);
> +}
> +
>  static int ath11k_pci_get_msi_assignment(struct ath11k_pci *ab_pci)  {
>  ab_pci->msi_config = &msi_config;
> @@ -184,6 +240,34 @@ static void ath11k_pci_free_region(struct
> ath11k_pci *ab_pci)
>  pci_disable_device(pci_dev);
>  }
>
> +static int ath11k_pci_power_up(struct ath11k_base *ab) {
> +struct ath11k_pci *ab_pci;
> +int ret;
> +
> +ab_pci = ath11k_pci_priv(ab);
> +ret = ath11k_pci_qca6x90_powerup(ab_pci);
> +if (ret) {
> +ath11k_err(ab, "failed to power on  mhi: %d\n", ret);
> +return ret;
> +}
> +
> +return 0;
> +}
> +
> +static void ath11k_pci_power_down(struct ath11k_base *ab) {
> +struct ath11k_pci *ab_pci;
> +
> +ab_pci = ath11k_pci_priv(ab);
> +ath11k_pci_qca6x90_powerdown(ab_pci);
> +}
> +
> +static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
> +.power_down = ath11k_pci_power_down,
> +.power_up = ath11k_pci_power_up,
> +};
> +
>  static int ath11k_pci_probe(struct pci_dev *pdev,
>      const struct pci_device_id *pci_dev)  { @@ -229,14
> +313,26 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
>  goto err_free_core;
>  }
>
> +ab->mem = ab_pci->mem;
> +ab->mem_len = ab_pci->mem_len;
> +
>  ret = ath11k_pci_enable_msi(ab_pci);
>  if (ret) {
>  ath11k_err(ab, "failed to enable  msi: %d\n", ret);
>  goto err_pci_free_region;
>  }
>
> +ret = ath11k_pci_register_mhi(ab_pci);
> +if (ret) {
> +ath11k_err(ab, "failed to register  mhi: %d\n", ret);
> +goto err_pci_disable_msi;
> +}
> +
>  return 0;
>
> +err_pci_disable_msi:
> +ath11k_pci_disable_msi(ab_pci);
> +
>  err_pci_free_region:
>  ath11k_pci_free_region(ab_pci);
>
> @@ -252,6 +348,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)
>  struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
>
>  set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
> +ath11k_pci_unregister_mhi(ab_pci);
>  ath11k_pci_disable_msi(ab_pci);
>  ath11k_pci_free_region(ab_pci);
>  ath11k_core_free(ab);
> diff --git a/drivers/net/wireless/ath/ath11k/pci.h
> b/drivers/net/wireless/ath/ath11k/pci.h
> index 7c7fa1965aa6..83b485be6c50 100644
> --- a/drivers/net/wireless/ath/ath11k/pci.h
> +++ b/drivers/net/wireless/ath/ath11k/pci.h
> @@ -2,6 +2,10 @@
>  /*
>   * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
>   */
> +#ifndef _ATH11K_PCI_H
> +#define _ATH11K_PCI_H
> +
> +#include <linux/mhi.h>
>
>  #define QCA6290_VENDOR_ID0x17CB
>  #define QCA6290_DEVICE_ID0x1100
> @@ -33,4 +37,13 @@ struct ath11k_pci {
>  u32 chip_id;
>  struct ath11k_msi_config *msi_config;
>  u32 msi_ep_base_data;
> +struct mhi_controller *mhi_ctrl;
> +unsigned long mhi_state;
>  };
> +
> +int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char
> *user_name,
> +       int *num_vectors, u32 *user_base_data,
> +       u32 *base_vector);
> +
> +int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector);
> +#endif
> --
> 2.22.0
>
> _______________________________________________
> ath11k mailing list
> ath11k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 4/4] ath11k: Register mhi controller device for qca6390
@ 2020-05-15  3:28     ` Carl Huang
  0 siblings, 0 replies; 30+ messages in thread
From: Carl Huang @ 2020-05-15  3:28 UTC (permalink / raw)
  To: Govind Singh, ath11k; +Cc: linux-wireless



> -----Original Message-----
> From: ath11k <ath11k-bounces@lists.infradead.org> On Behalf Of Govind
> Singh
> Sent: Friday, May 8, 2020 4:59 PM
> To: ath11k@lists.infradead.org
> Cc: Govind Singh <govinds@codeaurora.org>; linux-
> wireless@vger.kernel.org
> Subject: [EXT] [PATCH 4/4] ath11k: Register mhi controller device for
> qca6390
>
> MHI is a communication protocol to communicate with external Qualcomm
> modems and Wi-Fi chipsets over high speed peripheral buses. Even though
> MHI doesn’t dictate underlying physical layer, protocol and mhi stack is
> structured for PCIe based devices.
>
> Register directly with mhi core layer as a mhi device driver for firmware
> download.
>
> Tested QCA6390 on X86 platform.
> Tested firmware WLAN.HST.1.0.1.c1-00440-QCAHSTSWPLZ_V2_TO_X86-1.
>
> Signed-off-by: Govind Singh <govinds@codeaurora.org>
> ---
>  drivers/net/wireless/ath/ath11k/Kconfig  |   5 +-
>  drivers/net/wireless/ath/ath11k/Makefile |   2 +-
>  drivers/net/wireless/ath/ath11k/mhi.c    | 379 +++++++++++++++++++++++
>  drivers/net/wireless/ath/ath11k/mhi.h    |  28 ++
>  drivers/net/wireless/ath/ath11k/pci.c    |  97 ++++++
>  drivers/net/wireless/ath/ath11k/pci.h    |  13 +
>  6 files changed, 520 insertions(+), 4 deletions(-)  create mode 100644
> drivers/net/wireless/ath/ath11k/mhi.c
>  create mode 100644 drivers/net/wireless/ath/ath11k/mhi.h
>
> diff --git a/drivers/net/wireless/ath/ath11k/Kconfig
> b/drivers/net/wireless/ath/ath11k/Kconfig
> index 320b3b151bce..bd48796742bb 100644
> --- a/drivers/net/wireless/ath/ath11k/Kconfig
> +++ b/drivers/net/wireless/ath/ath11k/Kconfig
> @@ -2,7 +2,6 @@
>  config ATH11K
>  tristate "Qualcomm Technologies 802.11ax chipset support"
>  depends on MAC80211 && HAS_DMA
> -depends on REMOTEPROC
>  depends on CRYPTO_MICHAEL_MIC
>  depends on ARCH_QCOM || COMPILE_TEST
>  select ATH_COMMON
> @@ -15,13 +14,13 @@ config ATH11K
>
>  config ATH11K_AHB
>  tristate "Qualcomm Technologies 802.11ax chipset AHB support"
> -depends on ATH11K
> +depends on ATH11K && REMOTEPROC
>  ---help---
>    This module adds support for AHB bus
>
>  config ATH11K_PCI
>  tristate "Qualcomm Technologies 802.11ax chipset PCI support"
> -depends on ATH11K && PCI
> +depends on ATH11K && PCI && MHI_BUS
>  ---help---
>    This module adds support for PCIE bus
>
> diff --git a/drivers/net/wireless/ath/ath11k/Makefile
> b/drivers/net/wireless/ath/ath11k/Makefile
> index 933fcb2fd55d..8343c7dfaae3 100644
> --- a/drivers/net/wireless/ath/ath11k/Makefile
> +++ b/drivers/net/wireless/ath/ath11k/Makefile
> @@ -25,7 +25,7 @@ obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o
> ath11k_ahb-y += ahb.o
>
>  obj-$(CONFIG_ATH11K_PCI) += ath11k_pci.o -ath11k_pci-y += pci.o
> +ath11k_pci-y += mhi.o pci.o
>
>  # for tracing framework to find trace.h  CFLAGS_trace.o := -I$(src) diff --git
> a/drivers/net/wireless/ath/ath11k/mhi.c
> b/drivers/net/wireless/ath/ath11k/mhi.c
> new file mode 100644
> index 000000000000..1ca43243e265
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath11k/mhi.c
> @@ -0,0 +1,379 @@
> +// SPDX-License-Identifier: BSD-3-Clause-Clear
> +/* Copyright (c) 2020 The Linux Foundation. All rights reserved. */
> +
> +#include <linux/msi.h>
> +#include <linux/pci.h>
> +
> +#include "debug.h"
> +#include "mhi.h"
> +
> +#define MHI_TIMEOUT_DEFAULT_MS90000
> +
> +static struct mhi_channel_config ath11k_mhi_channels[] = {
> +{
> +.num = 0,
> +.name = "LOOPBACK",
> +.num_elements = 32,
> +.event_ring = 0,
> +.dir = DMA_TO_DEVICE,
> +.ee_mask = 0x4,
> +.pollcfg = 0,
> +.doorbell = MHI_DB_BRST_DISABLE,
> +.lpm_notify = false,
> +.offload_channel = false,
> +.doorbell_mode_switch = false,
> +.auto_queue = false,
> +.auto_start = false,
> +},
> +{
> +.num = 1,
> +.name = "LOOPBACK",
> +.num_elements = 32,
> +.event_ring = 0,
> +.dir = DMA_FROM_DEVICE,
> +.ee_mask = 0x4,
> +.pollcfg = 0,
> +.doorbell = MHI_DB_BRST_DISABLE,
> +.lpm_notify = false,
> +.offload_channel = false,
> +.doorbell_mode_switch = false,
> +.auto_queue = false,
> +.auto_start = false,
> +},
> +{
> +.num = 20,
> +.name = "IPCR",
> +.num_elements = 64,
> +.event_ring = 1,
> +.dir = DMA_TO_DEVICE,
> +.ee_mask = 0x4,
> +.pollcfg = 0,
> +.doorbell = MHI_DB_BRST_DISABLE,
> +.lpm_notify = false,
> +.offload_channel = false,
> +.doorbell_mode_switch = false,
> +.auto_queue = false,
> +.auto_start = true,
> +},
> +{
> +.num = 21,
> +.name = "IPCR",
> +.num_elements = 64,
> +.event_ring = 1,
> +.dir = DMA_FROM_DEVICE,
> +.ee_mask = 0x4,
> +.pollcfg = 0,
> +.doorbell = MHI_DB_BRST_DISABLE,
> +.lpm_notify = false,
> +.offload_channel = false,
> +.doorbell_mode_switch = false,
> +.auto_queue = true,
> +.auto_start = true,
> +},
> +};
> +
> +static struct mhi_event_config ath11k_mhi_events[] = {
> +{
> +.num_elements = 32,
> +.irq_moderation_ms = 0,
> +.irq = 1,
> +.mode = MHI_DB_BRST_DISABLE,

For this evern ring, need to specify  .data_type = MHI_ER_CTRL,

> +.hardware_event = false,
> +.client_managed = false,
> +.offload_channel = false,
> +},
> +{
> +.num_elements = 256,
> +.irq_moderation_ms = 1,
> +.irq = 2,
> +.mode = MHI_DB_BRST_DISABLE,
> +.priority = 1,
> +.hardware_event = false,
> +.client_managed = false,
> +.offload_channel = false,
> +},
> +};
> +
> +static struct mhi_controller_config ath11k_mhi_config = {
> +.max_channels = 128,
> +.timeout_ms = 2000,
> +.use_bounce_buf = false,
> +.buf_len = 0,
> +.num_channels = ARRAY_SIZE(ath11k_mhi_channels),
> +.ch_cfg = ath11k_mhi_channels,
> +.num_events = ARRAY_SIZE(ath11k_mhi_events),
> +.event_cfg = ath11k_mhi_events,
> +};
> +
> +static int ath11k_pci_get_mhi_msi(struct ath11k_pci *ab_pci) {
> +struct ath11k_base *ab = ab_pci->ab;
> +u32 user_base_data, base_vector;
> +int ret, num_vectors, i;
> +int *irq;
> +
> +ret = ath11k_pci_get_user_msi_assignment(ab_pci,
> + "MHI", &num_vectors,
> + &user_base_data,
> &base_vector);
> +if (ret)
> +return ret;
> +
> +ath11k_dbg(ab, ATH11K_DBG_PCI, "Number of assigned MSI for MHI
> is %d, base vector is %d\n",
> +   num_vectors, base_vector);
> +
> +irq = kcalloc(num_vectors, sizeof(int), GFP_KERNEL);
> +if (!irq)
> +return -ENOMEM;
> +
> +for (i = 0; i < num_vectors; i++)
> +irq[i] = ath11k_pci_get_msi_irq(ab_pci->dev,
> +base_vector + i);
> +
> +ab_pci->mhi_ctrl->irq = irq;
> +ab_pci->mhi_ctrl->nr_irqs = num_vectors;
> +
> +return 0;
> +}
> +
> +int ath11k_pci_register_mhi(struct ath11k_pci *ab_pci) {
> +struct ath11k_base *ab = ab_pci->ab;
> +struct mhi_controller *mhi_ctrl;
> +int ret;
> +
> +mhi_ctrl = kzalloc(sizeof(*mhi_ctrl), GFP_KERNEL);
> +if (!mhi_ctrl)
> +return PTR_ERR(mhi_ctrl);
> +
> +ab_pci->mhi_ctrl = mhi_ctrl;
> +mhi_ctrl->fw_image = ATH11K_PCI_FW_FILE_NAME;
> +mhi_ctrl->regs = ab_pci->mem;
> +
> +ret = ath11k_pci_get_mhi_msi(ab_pci);
> +if (ret) {
> +ath11k_err(ab, "failed to get msi for mhi\n");
> +kfree(mhi_ctrl);
> +return ret;
> +}
> +
> +mhi_ctrl->iova_start = 0;
> +mhi_ctrl->iova_stop = 0xffffffff;
> +mhi_ctrl->sbl_size = SZ_512K;
> +mhi_ctrl->seg_len = SZ_512K;
> +mhi_ctrl->fbc_download = true;
> +
> +ret = mhi_register_controller(mhi_ctrl, &ath11k_mhi_config);
> +if (ret) {
> +ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret);
> +kfree(mhi_ctrl);
> +return ret;
> +}
> +
> +return 0;
> +}
> +
> +void ath11k_pci_unregister_mhi(struct ath11k_pci *ab_pci) {
> +struct mhi_controller *mhi_ctrl = ab_pci->mhi_ctrl;
> +
> +mhi_unregister_controller(mhi_ctrl);
> +kfree(mhi_ctrl->irq);
> +}
> +
> +static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state) {
> +switch (mhi_state) {
> +case ATH11K_MHI_INIT:
> +return "INIT";
> +case ATH11K_MHI_DEINIT:
> +return "DEINIT";
> +case ATH11K_MHI_POWER_ON:
> +return "POWER_ON";
> +case ATH11K_MHI_POWER_OFF:
> +return "POWER_OFF";
> +case ATH11K_MHI_FORCE_POWER_OFF:
> +return "FORCE_POWER_OFF";
> +case ATH11K_MHI_SUSPEND:
> +return "SUSPEND";
> +case ATH11K_MHI_RESUME:
> +return "RESUME";
> +case ATH11K_MHI_TRIGGER_RDDM:
> +return "TRIGGER_RDDM";
> +case ATH11K_MHI_RDDM_DONE:
> +return "RDDM_DONE";
> +default:
> +return "UNKNOWN";
> +}
> +};
> +
> +static void ath11k_pci_set_mhi_state_bit(struct ath11k_pci *ab_pci,
> + enum ath11k_mhi_state mhi_state)
> +{
> +struct ath11k_base *ab = ab_pci->ab;
> +
> +switch (mhi_state) {
> +case ATH11K_MHI_INIT:
> +set_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_DEINIT:
> +clear_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_POWER_ON:
> +set_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_POWER_OFF:
> +case ATH11K_MHI_FORCE_POWER_OFF:
> +clear_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state);
> +clear_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci-
> >mhi_state);
> +clear_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_SUSPEND:
> +set_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_RESUME:
> +clear_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_TRIGGER_RDDM:
> +set_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state);
> +break;
> +case ATH11K_MHI_RDDM_DONE:
> +set_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state);
> +break;
> +default:
> +ath11k_err(ab, "unhandled mhi state (%d)\n", mhi_state);
> +}
> +}
> +
> +static int ath11k_pci_check_mhi_state_bit(struct ath11k_pci *ab_pci,
> +  enum ath11k_mhi_state mhi_state)
> {
> +struct ath11k_base *ab = ab_pci->ab;
> +
> +switch (mhi_state) {
> +case ATH11K_MHI_INIT:
> +if (!test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_DEINIT:
> +case ATH11K_MHI_POWER_ON:
> +if (test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state) &&
> +    !test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_FORCE_POWER_OFF:
> +if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_POWER_OFF:
> +case ATH11K_MHI_SUSPEND:
> +if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state)
> &&
> +    !test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_RESUME:
> +if (test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_TRIGGER_RDDM:
> +if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state)
> &&
> +    !test_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci-
> >mhi_state))
> +return 0;
> +break;
> +case ATH11K_MHI_RDDM_DONE:
> +return 0;
> +default:
> +ath11k_err(ab, "unhandled mhi state: %s(%d)\n",
> +   ath11k_mhi_state_to_str(mhi_state), mhi_state);
> +}
> +
> +ath11k_err(ab, "failed to set mhi state %s(%d) in current mhi state
> (0x%lx)\n",
> +   ath11k_mhi_state_to_str(mhi_state), mhi_state,
> +   ab_pci->mhi_state);
> +
> +return -EINVAL;
> +}
> +
> +static int ath11k_pci_set_mhi_state(struct ath11k_pci *ab_pci,
> +    enum ath11k_mhi_state mhi_state) {
> +struct ath11k_base *ab = ab_pci->ab;
> +int ret;
> +
> +ret = ath11k_pci_check_mhi_state_bit(ab_pci, mhi_state);
> +if (ret)
> +goto out;
> +
> +ath11k_dbg(ab, ATH11K_DBG_PCI, "setting mhi state: %s(%d)\n",
> +   ath11k_mhi_state_to_str(mhi_state), mhi_state);
> +
> +switch (mhi_state) {
> +case ATH11K_MHI_INIT:
> +ret = mhi_prepare_for_power_up(ab_pci->mhi_ctrl);
> +break;
> +case ATH11K_MHI_DEINIT:
> +mhi_unprepare_after_power_down(ab_pci->mhi_ctrl);
> +ret = 0;
> +break;
> +case ATH11K_MHI_POWER_ON:
> +ret = mhi_async_power_up(ab_pci->mhi_ctrl);
> +break;
> +case ATH11K_MHI_POWER_OFF:
> +mhi_power_down(ab_pci->mhi_ctrl, true);
> +ret = 0;
> +break;
> +case ATH11K_MHI_FORCE_POWER_OFF:
> +mhi_power_down(ab_pci->mhi_ctrl, false);
> +ret = 0;
> +break;
> +case ATH11K_MHI_SUSPEND:
> +break;
> +case ATH11K_MHI_RESUME:
> +break;
> +case ATH11K_MHI_TRIGGER_RDDM:
> +ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl);
> +break;
> +case ATH11K_MHI_RDDM_DONE:
> +break;
> +default:
> +ath11k_err(ab, "unhandled MHI state (%d)\n", mhi_state);
> +ret = -EINVAL;
> +}
> +
> +if (ret)
> +goto out;
> +
> +ath11k_pci_set_mhi_state_bit(ab_pci, mhi_state);
> +
> +return 0;
> +
> +out:
> +ath11k_err(ab, "failed to set mhi state: %s(%d)\n",
> +   ath11k_mhi_state_to_str(mhi_state), mhi_state);
> +return ret;
> +}
> +
> +int ath11k_pci_start_mhi(struct ath11k_pci *ab_pci) {
> +struct ath11k_base *ab = ab_pci->ab;
> +int ret;
> +
> +ab_pci->mhi_ctrl->timeout_ms = MHI_TIMEOUT_DEFAULT_MS;
> +
> +ret = ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_INIT);
> +if (ret)
> +ath11k_err(ab, "failed to set mhi init state: %d\n", ret);
> +
> +ret = ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_POWER_ON);
> +if (ret)
> +ath11k_err(ab, "failed to set mhi power on state: %d\n", ret);
> +
> +return ret;
> +}
> +
> +void ath11k_pci_stop_mhi(struct ath11k_pci *ab_pci) {
> +ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_RESUME);
> +ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_POWER_OFF);
> +ath11k_pci_set_mhi_state(ab_pci, ATH11K_MHI_DEINIT); }
> +
> diff --git a/drivers/net/wireless/ath/ath11k/mhi.h
> b/drivers/net/wireless/ath/ath11k/mhi.h
> new file mode 100644
> index 000000000000..355de5a2c241
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath11k/mhi.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: BSD-3-Clause-Clear */
> +/*
> + * Copyright (c) 2020 The Linux Foundation. All rights reserved.
> + */
> +#ifndef _ATH11K_MHI_H
> +#define _ATH11K_MHI_H
> +
> +#include "pci.h"
> +#define ATH11K_PCI_FW_FILE_NAME"amss.bin"
> +
> +enum ath11k_mhi_state {
> +ATH11K_MHI_INIT,
> +ATH11K_MHI_DEINIT,
> +ATH11K_MHI_POWER_ON,
> +ATH11K_MHI_POWER_OFF,
> +ATH11K_MHI_FORCE_POWER_OFF,
> +ATH11K_MHI_SUSPEND,
> +ATH11K_MHI_RESUME,
> +ATH11K_MHI_TRIGGER_RDDM,
> +ATH11K_MHI_RDDM,
> +ATH11K_MHI_RDDM_DONE,
> +};
> +
> +int ath11k_pci_start_mhi(struct ath11k_pci *ar_pci); void
> +ath11k_pci_stop_mhi(struct ath11k_pci *ar_pci); int
> +ath11k_pci_register_mhi(struct ath11k_pci *ar_pci); void
> +ath11k_pci_unregister_mhi(struct ath11k_pci *ar_pci); #endif
> diff --git a/drivers/net/wireless/ath/ath11k/pci.c
> b/drivers/net/wireless/ath/ath11k/pci.c
> index d89dcb5fe81e..938078ee8d80 100644
> --- a/drivers/net/wireless/ath/ath11k/pci.c
> +++ b/drivers/net/wireless/ath/ath11k/pci.c
> @@ -9,6 +9,8 @@
>
>  #include "ahb.h"
>  #include "core.h"
> +#include "hif.h"
> +#include "mhi.h"
>  #include "pci.h"
>  #include "debug.h"
>
> @@ -31,6 +33,60 @@ static struct ath11k_msi_config msi_config = {
>  },
>  };
>
> +int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector) {
> +struct pci_dev *pci_dev = to_pci_dev(dev);
> +int irq_num;
> +
> +irq_num = pci_irq_vector(pci_dev, vector);
> +
> +return irq_num;
> +}
> +
> +int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ab_pci, char
> *user_name,
> +       int *num_vectors, u32 *user_base_data,
> +       u32 *base_vector)
> +{
> +struct ath11k_base *ab = ab_pci->ab;
> +struct ath11k_msi_config *msi_config;
> +int idx;
> +
> +msi_config = ab_pci->msi_config;
> +if (!msi_config) {
> +ath11k_err(ab, "MSI is not supported.\n");
> +return -EINVAL;
> +}
> +
> +for (idx = 0; idx < msi_config->total_users; idx++) {
> +if (strcmp(user_name, msi_config->users[idx].name) == 0) {
> +*num_vectors = msi_config->users[idx].num_vectors;
> +*user_base_data = msi_config-
> >users[idx].base_vector
> ++ ab_pci->msi_ep_base_data;
> +*base_vector = msi_config->users[idx].base_vector;
> +
> +ath11k_dbg(ab, ATH11K_DBG_PCI, "Assign MSI to
> user: %s, num_vectors: %d, user_base_data: %u, base_vector: %u\n",
> +   user_name, *num_vectors,
> *user_base_data,
> +   *base_vector);
> +
> +return 0;
> +}
> +}
> +
> +ath11k_err(ab, "Failed to find MSI assignment for %s!\n",
> user_name);
> +
> +return -EINVAL;
> +}
> +
> +static int ath11k_pci_qca6x90_powerup(struct ath11k_pci *ab_pci) {
> +return ath11k_pci_start_mhi(ab_pci);
> +}
> +
> +static void ath11k_pci_qca6x90_powerdown(struct ath11k_pci *ab_pci) {
> +ath11k_pci_stop_mhi(ab_pci);
> +}
> +
>  static int ath11k_pci_get_msi_assignment(struct ath11k_pci *ab_pci)  {
>  ab_pci->msi_config = &msi_config;
> @@ -184,6 +240,34 @@ static void ath11k_pci_free_region(struct
> ath11k_pci *ab_pci)
>  pci_disable_device(pci_dev);
>  }
>
> +static int ath11k_pci_power_up(struct ath11k_base *ab) {
> +struct ath11k_pci *ab_pci;
> +int ret;
> +
> +ab_pci = ath11k_pci_priv(ab);
> +ret = ath11k_pci_qca6x90_powerup(ab_pci);
> +if (ret) {
> +ath11k_err(ab, "failed to power on  mhi: %d\n", ret);
> +return ret;
> +}
> +
> +return 0;
> +}
> +
> +static void ath11k_pci_power_down(struct ath11k_base *ab) {
> +struct ath11k_pci *ab_pci;
> +
> +ab_pci = ath11k_pci_priv(ab);
> +ath11k_pci_qca6x90_powerdown(ab_pci);
> +}
> +
> +static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
> +.power_down = ath11k_pci_power_down,
> +.power_up = ath11k_pci_power_up,
> +};
> +
>  static int ath11k_pci_probe(struct pci_dev *pdev,
>      const struct pci_device_id *pci_dev)  { @@ -229,14
> +313,26 @@ static int ath11k_pci_probe(struct pci_dev *pdev,
>  goto err_free_core;
>  }
>
> +ab->mem = ab_pci->mem;
> +ab->mem_len = ab_pci->mem_len;
> +
>  ret = ath11k_pci_enable_msi(ab_pci);
>  if (ret) {
>  ath11k_err(ab, "failed to enable  msi: %d\n", ret);
>  goto err_pci_free_region;
>  }
>
> +ret = ath11k_pci_register_mhi(ab_pci);
> +if (ret) {
> +ath11k_err(ab, "failed to register  mhi: %d\n", ret);
> +goto err_pci_disable_msi;
> +}
> +
>  return 0;
>
> +err_pci_disable_msi:
> +ath11k_pci_disable_msi(ab_pci);
> +
>  err_pci_free_region:
>  ath11k_pci_free_region(ab_pci);
>
> @@ -252,6 +348,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)
>  struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
>
>  set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
> +ath11k_pci_unregister_mhi(ab_pci);
>  ath11k_pci_disable_msi(ab_pci);
>  ath11k_pci_free_region(ab_pci);
>  ath11k_core_free(ab);
> diff --git a/drivers/net/wireless/ath/ath11k/pci.h
> b/drivers/net/wireless/ath/ath11k/pci.h
> index 7c7fa1965aa6..83b485be6c50 100644
> --- a/drivers/net/wireless/ath/ath11k/pci.h
> +++ b/drivers/net/wireless/ath/ath11k/pci.h
> @@ -2,6 +2,10 @@
>  /*
>   * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
>   */
> +#ifndef _ATH11K_PCI_H
> +#define _ATH11K_PCI_H
> +
> +#include <linux/mhi.h>
>
>  #define QCA6290_VENDOR_ID0x17CB
>  #define QCA6290_DEVICE_ID0x1100
> @@ -33,4 +37,13 @@ struct ath11k_pci {
>  u32 chip_id;
>  struct ath11k_msi_config *msi_config;
>  u32 msi_ep_base_data;
> +struct mhi_controller *mhi_ctrl;
> +unsigned long mhi_state;
>  };
> +
> +int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char
> *user_name,
> +       int *num_vectors, u32 *user_base_data,
> +       u32 *base_vector);
> +
> +int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector);
> +#endif
> --
> 2.22.0
>
> _______________________________________________
> ath11k mailing list
> ath11k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath11k
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/4] Add PCI client driver for QCA6390 chipset
@ 2020-05-08  8:57 ` Govind Singh
  0 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:57 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Govind Singh

QCA6390 chipsets is PCI based 11ax chipset to be supported in ath11k.

Add PCI client driver for QCA6390 chipset with enumeration/resource initialization/msi vector mapping.
With these changes driver is splitted in two modules(bus layer module/ common core module).
This is required due to following reasons.

 1) PCI based transport layer for QCA6390 chipsets.
 2) FW loading based on MHI protocol unlike rproc in IPQ8074A.
 3) MSI based data path/CE/fw RAM dump interrupt.
 4) CE assignments is different.
 5) Different boot up sequence due to requirement of voltage regulators/bootstrap
    pinctrls for QCA6390.
 6) Clear separation in bus level operation.


For AHB based devices:
ath11k_ahb.ko
ath11k_ko

For PCI based devices:
ath11k_pci.ko
ath11k.ko

Tested HW:
	IPQ8074A
	X86 + QCA6390: pci probe/resource setup

Govind Singh (4):
  ath11k: Add PCI client driver for QCA6390 chipset
  ath11k: setup pci resource for QCA6390 target
  ath11k: Add msi config init for QCA6390
  ath11k: Register mhi controller device for qca6390

 drivers/net/wireless/ath/ath11k/Kconfig  |  13 +-
 drivers/net/wireless/ath/ath11k/Makefile |   7 +-
 drivers/net/wireless/ath/ath11k/ahb.c    |  71 -----
 drivers/net/wireless/ath/ath11k/ce.c     |   2 +
 drivers/net/wireless/ath/ath11k/core.c   |   7 +
 drivers/net/wireless/ath/ath11k/core.h   |  11 +-
 drivers/net/wireless/ath/ath11k/debug.c  |   6 +-
 drivers/net/wireless/ath/ath11k/debug.h  |   1 +
 drivers/net/wireless/ath/ath11k/dp.c     |   1 +
 drivers/net/wireless/ath/ath11k/hal.c    |   1 +
 drivers/net/wireless/ath/ath11k/hif.h    |  77 ++++-
 drivers/net/wireless/ath/ath11k/mhi.c    | 379 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/mhi.h    |  28 ++
 drivers/net/wireless/ath/ath11k/pci.c    | 385 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/pci.h    |  49 +++
 15 files changed, 954 insertions(+), 84 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.c
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.h
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.c
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.h

-- 
2.22.0

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/4] Add PCI client driver for QCA6390 chipset
@ 2020-05-08  8:57 ` Govind Singh
  0 siblings, 0 replies; 30+ messages in thread
From: Govind Singh @ 2020-05-08  8:57 UTC (permalink / raw)
  To: ath11k; +Cc: Govind Singh, linux-wireless

QCA6390 chipsets is PCI based 11ax chipset to be supported in ath11k.

Add PCI client driver for QCA6390 chipset with enumeration/resource initialization/msi vector mapping.
With these changes driver is splitted in two modules(bus layer module/ common core module).
This is required due to following reasons.

 1) PCI based transport layer for QCA6390 chipsets.
 2) FW loading based on MHI protocol unlike rproc in IPQ8074A.
 3) MSI based data path/CE/fw RAM dump interrupt.
 4) CE assignments is different.
 5) Different boot up sequence due to requirement of voltage regulators/bootstrap
    pinctrls for QCA6390.
 6) Clear separation in bus level operation.


For AHB based devices:
ath11k_ahb.ko
ath11k_ko

For PCI based devices:
ath11k_pci.ko
ath11k.ko

Tested HW:
	IPQ8074A
	X86 + QCA6390: pci probe/resource setup

Govind Singh (4):
  ath11k: Add PCI client driver for QCA6390 chipset
  ath11k: setup pci resource for QCA6390 target
  ath11k: Add msi config init for QCA6390
  ath11k: Register mhi controller device for qca6390

 drivers/net/wireless/ath/ath11k/Kconfig  |  13 +-
 drivers/net/wireless/ath/ath11k/Makefile |   7 +-
 drivers/net/wireless/ath/ath11k/ahb.c    |  71 -----
 drivers/net/wireless/ath/ath11k/ce.c     |   2 +
 drivers/net/wireless/ath/ath11k/core.c   |   7 +
 drivers/net/wireless/ath/ath11k/core.h   |  11 +-
 drivers/net/wireless/ath/ath11k/debug.c  |   6 +-
 drivers/net/wireless/ath/ath11k/debug.h  |   1 +
 drivers/net/wireless/ath/ath11k/dp.c     |   1 +
 drivers/net/wireless/ath/ath11k/hal.c    |   1 +
 drivers/net/wireless/ath/ath11k/hif.h    |  77 ++++-
 drivers/net/wireless/ath/ath11k/mhi.c    | 379 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/mhi.h    |  28 ++
 drivers/net/wireless/ath/ath11k/pci.c    | 385 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/pci.h    |  49 +++
 15 files changed, 954 insertions(+), 84 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.c
 create mode 100644 drivers/net/wireless/ath/ath11k/mhi.h
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.c
 create mode 100644 drivers/net/wireless/ath/ath11k/pci.h

-- 
2.22.0

_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2020-05-15  3:28 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08  8:58 [PATCH 0/4] Add PCI client driver for QCA6390 chipset Govind Singh
2020-05-08  8:58 ` Govind Singh
2020-05-08  8:58 ` [PATCH 1/4] ath11k: " Govind Singh
2020-05-08  8:58   ` Govind Singh
2020-05-11 17:59   ` Kalle Valo
2020-05-11 17:59     ` Kalle Valo
2020-05-12  5:31     ` govinds
2020-05-12  5:31       ` govinds
2020-05-08  8:58 ` [PATCH 2/4] ath11k: setup pci resource for QCA6390 target Govind Singh
2020-05-08  8:58   ` Govind Singh
2020-05-08  8:58 ` [PATCH 3/4] ath11k: Add msi config init for QCA6390 Govind Singh
2020-05-08  8:58   ` Govind Singh
2020-05-08  8:58 ` [PATCH 4/4] ath11k: Register mhi controller device for qca6390 Govind Singh
2020-05-08  8:58   ` Govind Singh
2020-05-11 18:03   ` Kalle Valo
2020-05-11 18:03     ` Kalle Valo
2020-05-12  7:13     ` Manivannan Sadhasivam
2020-05-12  7:13       ` Manivannan Sadhasivam
2020-05-12  8:19       ` Kalle Valo
2020-05-12  8:19         ` Kalle Valo
2020-05-12  8:24         ` Kalle Valo
2020-05-12  8:24           ` Kalle Valo
2020-05-12  9:00         ` Manivannan Sadhasivam
2020-05-12  9:00           ` Manivannan Sadhasivam
2020-05-11 18:08   ` Kalle Valo
2020-05-11 18:08     ` Kalle Valo
2020-05-15  3:28   ` Carl Huang
2020-05-15  3:28     ` Carl Huang
  -- strict thread matches above, loose matches on Subject: below --
2020-05-08  8:57 [PATCH 0/4] Add PCI client driver for QCA6390 chipset Govind Singh
2020-05-08  8:57 ` Govind Singh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.