Skip to contentSkip to conversation

qtnfmac: add support for QSR1000/QSR2000 (aka Topaz) chipsets

PATCH In review Sergey Matyukevich 5 participants 10 messages Oct 16, 2018 – Nov 22, 2019 Quantenna qtnfmac wireless driver

lore
Share & tools
lore
#0 lore raw

v2 cover qtnfmac: add support for QSR1000/QSR2000 (aka Topaz) chipsets

Hello Kalle and all,

Here is the next update for qtnfmac driver. This patchset adds support for the previous generation of Quantenna wireless cards, namely QSR1000/QSR2000 family of PCIe devices.

The summary of changes is as follows:
- the last bits of pcie layer unification work:
-- extract remaining code that can be shared across various PCIe chips -- cleanup/rename: get ready to support another chipset
- add support for QSR1000/QSR2000 devices

Regards,
Sergey

Changes v1 -> v2
- simplify Kconfig options for PCIe backend driver

 Kconfig                |   15 
 Makefile               |    9 
 pcie/pcie.c            |  282 +++++++----
 pcie/pcie_priv.h       |   20 
 pcie/pearl_pcie.c      |  211 ++------
 pcie/topaz_pcie.c      | 1219 +++++++++++++++++++++++++++++++++++++++++++++++++
 pcie/topaz_pcie_ipc.h  |   94 +++
 pcie/topaz_pcie_regs.h |   45 +
 qtn_hw_ids.h           |    4 
 util.c                 |   18 
 util.h                 |    2 
 11 files changed, 1664 insertions(+), 255 deletions(-)
#1 lore raw

PATCH v2 1/2 qtnfmac_pcie: use single PCIe driver for all platforms

From: Igor Mitsyanko <[email protected]>

Single PCIe driver can identify hardware type by reading CHIP ID at probe time and invoking a correct initialization sequence.

---
 drivers/net/wireless/quantenna/qtnfmac/Kconfig     |  10 +-
 drivers/net/wireless/quantenna/qtnfmac/Makefile    |   6 +-
 drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 279 ++++++++++++++-------
 .../wireless/quantenna/qtnfmac/pcie/pcie_priv.h    |  19 +-
 .../wireless/quantenna/qtnfmac/pcie/pearl_pcie.c   | 211 +++++-----------
 drivers/net/wireless/quantenna/qtnfmac/util.c      |  16 ++
 drivers/net/wireless/quantenna/qtnfmac/util.h      |   2 +
 7 files changed, 292 insertions(+), 251 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/Kconfig +5 -5
index b8c12a5f16b4..696c50066b53 100644
@@ -1,10 +1,10 @@
 config QTNFMAC
 	tristate
-	depends on QTNFMAC_PEARL_PCIE
-	default m if QTNFMAC_PEARL_PCIE=m
-	default y if QTNFMAC_PEARL_PCIE=y
+	depends on QTNFMAC_PCIE
+	default m if QTNFMAC_PCIE=m
+	default y if QTNFMAC_PCIE=y
 
-config QTNFMAC_PEARL_PCIE
+config QTNFMAC_PCIE
 	tristate "Quantenna QSR10g PCIe support"
 	default n
 	depends on PCI && CFG80211
@@ -16,4 +16,4 @@ config QTNFMAC_PEARL_PCIE
 	  802.11ac QSR10g (aka Pearl) FullMAC chipset running over PCIe.
 
 	  If you choose to build it as a module, two modules will be built:
-	  qtnfmac.ko and qtnfmac_pearl_pcie.ko.
+	  qtnfmac.ko and qtnfmac_pcie.ko.
drivers/net/wireless/quantenna/qtnfmac/Makefile +3 -3
index 17cd7adb4109..d7e8185fddab 100644
@@ -19,11 +19,11 @@ qtnfmac-objs += \
 
 #
 
-obj-$(CONFIG_QTNFMAC_PEARL_PCIE) += qtnfmac_pearl_pcie.o
+obj-$(CONFIG_QTNFMAC_PCIE) += qtnfmac_pcie.o
 
-qtnfmac_pearl_pcie-objs += \
+qtnfmac_pcie-objs += \
 	shm_ipc.o \
 	pcie/pcie.o \
 	pcie/pearl_pcie.o
 
-qtnfmac_pearl_pcie-$(CONFIG_DEBUG_FS) += debug.o
+qtnfmac_pcie-$(CONFIG_DEBUG_FS) += debug.o
drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c +195 -84

409 lines not on this page · raw message

drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h +11 -8
index 5c70fb4c0f92..7c742c56efaf 100644
@@ -23,9 +23,14 @@
 struct qtnf_pcie_bus_priv {
 	struct pci_dev *pdev;
 
+	int (*probe_cb)(struct qtnf_bus *bus, unsigned int tx_bd_size);
+	void (*remove_cb)(struct qtnf_bus *bus);
+	int (*suspend_cb)(struct qtnf_bus *bus);
+	int (*resume_cb)(struct qtnf_bus *bus);
+	u64 (*dma_mask_get_cb)(void);
+
 	spinlock_t tx_reclaim_lock;
 	spinlock_t tx_lock;
-	int mps;
 
 	struct workqueue_struct *workqueue;
 	struct tasklet_struct reclaim_tq;
@@ -43,6 +48,8 @@ struct qtnf_pcie_bus_priv {
 	struct sk_buff **tx_skb;
 	struct sk_buff **rx_skb;
 
+	unsigned int fw_blksize;
+
 	u32 rx_bd_w_index;
 	u32 rx_bd_r_index;
 
@@ -58,21 +65,17 @@ struct qtnf_pcie_bus_priv {
 
 	u8 msi_enabled;
 	u8 tx_stopped;
+	bool flashboot;
 };
 
 int qtnf_pcie_control_tx(struct qtnf_bus *bus, struct sk_buff *skb);
 int qtnf_pcie_alloc_skb_array(struct qtnf_pcie_bus_priv *priv);
-void qtnf_pcie_bringup_fw_async(struct qtnf_bus *bus);
-void qtnf_pcie_fw_boot_done(struct qtnf_bus *bus, bool boot_success,
-			    const char *drv_name);
+void qtnf_pcie_fw_boot_done(struct qtnf_bus *bus, bool boot_success);
 void qtnf_pcie_init_shm_ipc(struct qtnf_pcie_bus_priv *priv,
 			    struct qtnf_shm_ipc_region __iomem *ipc_tx_reg,
 			    struct qtnf_shm_ipc_region __iomem *ipc_rx_reg,
 			    const struct qtnf_shm_ipc_int *ipc_int);
-int qtnf_pcie_probe(struct pci_dev *pdev, size_t priv_size,
-		    const struct qtnf_bus_ops *bus_ops, u64 dma_mask,
-		    bool use_msi);
-void qtnf_pcie_remove(struct qtnf_bus *bus, struct qtnf_pcie_bus_priv *priv);
+struct qtnf_bus *qtnf_pcie_pearl_alloc(struct pci_dev *pdev);
 
 static inline void qtnf_non_posted_write(u32 val, void __iomem *basereg)
 {
drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c +60 -151

317 lines not on this page · raw message

drivers/net/wireless/quantenna/qtnfmac/util.c +16 -0
index e745733ba417..dfe3fe8a42c1 100644
@@ -15,6 +15,7 @@
  */
 
 #include "util.h"
+#include "qtn_hw_ids.h"
 
 void qtnf_sta_list_init(struct qtnf_sta_list *list)
 {
@@ -116,3 +117,18 @@ void qtnf_sta_list_free(struct qtnf_sta_list *list)
 
 	INIT_LIST_HEAD(&list->head);
 }
+
+const char *qtnf_chipid_to_string(unsigned long chip_id)
+{
+	switch (chip_id) {
+	case QTN_CHIP_ID_PEARL:
+		return "Pearl revA";
+	case QTN_CHIP_ID_PEARL_B:
+		return "Pearl revB";
+	case QTN_CHIP_ID_PEARL_C:
+		return "Pearl revC";
+	default:
+		return "unknown";
+	}
+}
+EXPORT_SYMBOL_GPL(qtnf_chipid_to_string);
drivers/net/wireless/quantenna/qtnfmac/util.h +2 -0
index 0d4d92b11540..b8744baac332 100644
@@ -20,6 +20,8 @@
 #include <linux/kernel.h>
 #include "core.h"
 
+const char *qtnf_chipid_to_string(unsigned long chip_id);
+
 void qtnf_sta_list_init(struct qtnf_sta_list *list);
 
 struct qtnf_sta_node *qtnf_sta_list_lookup(struct qtnf_sta_list *list,
Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH v2 1/2] qtnfmac_pcie: use single PCIe driver for all platforms

Quoted 6 lines · Sergey Matyukevich

From: Igor Mitsyanko <[email protected]>

Single PCIe driver can identify hardware type by reading CHIP ID at probe time and invoking a correct initialization sequence.

2 patches applied to wireless-drivers-next.git, thanks.

b7da53cd6cd1 qtnfmac_pcie: use single PCIe driver for all platforms e401fa25cfa2 qtnfmac: add support for Topaz chipsets

Signature · 3 lines
https://patchwork.kernel.org/patch/10643355/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

PATCH v2 2/2 qtnfmac: add support for Topaz chipsets

In reply to Sergey Matyukevich

This patch adds support for QSR1000/QSR2000 family of chipsets to qtnfmac_pcie platform driver.

QSR1000/QSR2000 (aka Topaz) is a family of 80MHz, 11ac Wave2, 4x4/2x4/2x2 chips, including single and dual band devices. Depending on specific chip model and firmware in use, either STA or both STA and AP modes are supported.

Patch adds Topaz support to qtnfmac_pcie driver. Proper platform bus will be selected on probing based on chip ID.

---
 drivers/net/wireless/quantenna/qtnfmac/Kconfig     |    5 +-
 drivers/net/wireless/quantenna/qtnfmac/Makefile    |    3 +-
 drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c |    5 +-
 .../wireless/quantenna/qtnfmac/pcie/pcie_priv.h    |    1 +
 .../wireless/quantenna/qtnfmac/pcie/topaz_pcie.c   | 1219 ++++++++++++++++++++
 .../quantenna/qtnfmac/pcie/topaz_pcie_ipc.h        |   94 ++
 .../quantenna/qtnfmac/pcie/topaz_pcie_regs.h       |   45 +
 .../net/wireless/quantenna/qtnfmac/qtn_hw_ids.h    |    4 +-
 drivers/net/wireless/quantenna/qtnfmac/util.c      |    2 +
 9 files changed, 1373 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c
 create mode 100644 drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie_ipc.h
 create mode 100644 drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie_regs.h
drivers/net/wireless/quantenna/qtnfmac/Kconfig +3 -2
index 696c50066b53..6cf5202c3666 100644
@@ -5,7 +5,7 @@ config QTNFMAC
 	default y if QTNFMAC_PCIE=y
 
 config QTNFMAC_PCIE
-	tristate "Quantenna QSR10g PCIe support"
+	tristate "Quantenna QSR1000/QSR2000/QSR10g PCIe support"
 	default n
 	depends on PCI && CFG80211
 	select QTNFMAC
@@ -13,7 +13,8 @@ config QTNFMAC_PCIE
 	select CRC32
 	help
 	  This option adds support for wireless adapters based on Quantenna
-	  802.11ac QSR10g (aka Pearl) FullMAC chipset running over PCIe.
+	  802.11ac QSR10g (aka Pearl) and QSR1000/QSR2000 (aka Topaz)
+	  FullMAC chipsets running over PCIe.
 
 	  If you choose to build it as a module, two modules will be built:
 	  qtnfmac.ko and qtnfmac_pcie.ko.
drivers/net/wireless/quantenna/qtnfmac/Makefile +2 -1
index d7e8185fddab..40dffbd2ea47 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_QTNFMAC_PCIE) += qtnfmac_pcie.o
 qtnfmac_pcie-objs += \
 	shm_ipc.o \
 	pcie/pcie.o \
-	pcie/pearl_pcie.o
+	pcie/pearl_pcie.o \
+	pcie/topaz_pcie.o
 
 qtnfmac_pcie-$(CONFIG_DEBUG_FS) += debug.o
drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c +4 -1
index 70dd8da5b0dc..c3a32effa6f0 100644
@@ -330,6 +330,9 @@ static int qtnf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	case QTN_CHIP_ID_PEARL_C:
 		bus = qtnf_pcie_pearl_alloc(pdev);
 		break;
+	case QTN_CHIP_ID_TOPAZ:
+		bus = qtnf_pcie_topaz_alloc(pdev);
+		break;
 	default:
 		pr_err("unsupported chip ID 0x%x\n", chipid);
 		return -ENOTSUPP;
@@ -465,7 +468,7 @@ static SIMPLE_DEV_PM_OPS(qtnf_pcie_pm_ops, qtnf_pcie_suspend,
 
 static const struct pci_device_id qtnf_pcie_devid_table[] = {
 	{
-		PCIE_VENDOR_ID_QUANTENNA, PCIE_DEVICE_ID_QTN_PEARL,
+		PCIE_VENDOR_ID_QUANTENNA, PCIE_DEVICE_ID_QSR,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 	},
 	{ },
drivers/net/wireless/quantenna/qtnfmac/pcie/pcie_priv.h +1 -0
index 7c742c56efaf..bbc074e1f34d 100644
@@ -76,6 +76,7 @@ void qtnf_pcie_init_shm_ipc(struct qtnf_pcie_bus_priv *priv,
 			    struct qtnf_shm_ipc_region __iomem *ipc_rx_reg,
 			    const struct qtnf_shm_ipc_int *ipc_int);
 struct qtnf_bus *qtnf_pcie_pearl_alloc(struct pci_dev *pdev);
+struct qtnf_bus *qtnf_pcie_topaz_alloc(struct pci_dev *pdev);
 
 static inline void qtnf_non_posted_write(u32 val, void __iomem *basereg)
 {
drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c new file +1219 -0

1,219 lines not on this page · raw message

drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie_ipc.h new file +94 -0

94 lines not on this page · raw message

drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie_regs.h new file +45 -0

45 lines not on this page · raw message

drivers/net/wireless/quantenna/qtnfmac/qtn_hw_ids.h +3 -1
index 1fe798a9a667..40295a511224 100644
@@ -23,7 +23,7 @@
 
 /* PCIE Device IDs */
 
-#define	PCIE_DEVICE_ID_QTN_PEARL	(0x0008)
+#define	PCIE_DEVICE_ID_QSR		(0x0008)
 
 #define QTN_REG_SYS_CTRL_CSR		0x14
 #define QTN_CHIP_ID_MASK		0xF0
@@ -35,6 +35,8 @@
 /* FW names */
 
 #define QTN_PCI_PEARL_FW_NAME		"qtn/fmac_qsr10g.img"
+#define QTN_PCI_TOPAZ_FW_NAME		"qtn/fmac_qsr1000.img"
+#define QTN_PCI_TOPAZ_BOOTLD_NAME	"qtn/uboot_qsr1000.img"
 
 static inline unsigned int qtnf_chip_id_get(const void __iomem *regs_base)
 {
drivers/net/wireless/quantenna/qtnfmac/util.c +2 -0
index dfe3fe8a42c1..3bc96b264769 100644
@@ -121,6 +121,8 @@ void qtnf_sta_list_free(struct qtnf_sta_list *list)
 const char *qtnf_chipid_to_string(unsigned long chip_id)
 {
 	switch (chip_id) {
+	case QTN_CHIP_ID_TOPAZ:
+		return "Topaz";
 	case QTN_CHIP_ID_PEARL:
 		return "Pearl revA";
 	case QTN_CHIP_ID_PEARL_B:
Signature · 1 line
2.11.0
#4 lore raw

Re: [PATCH v2 2/2] qtnfmac: add support for Topaz chipsets

Hi,

Quoted 16 lines · Sergey Matyukevich

This patch adds support for QSR1000/QSR2000 family of chipsets to qtnfmac_pcie platform driver.

QSR1000/QSR2000 (aka Topaz) is a family of 80MHz, 11ac Wave2, 4x4/2x4/2x2 chips, including single and dual band devices. Depending on specific chip model and firmware in use, either STA or both STA and AP modes are supported.

Patch adds Topaz support to qtnfmac_pcie driver. Proper platform bus will be selected on probing based on chip ID.

---

(snip)

Quoted 14 lines
drivers/net/wireless/quantenna/qtnfmac/qtn_hw_ids.h +1 -1
index 1fe798a9a667..40295a511224 100644
@@ -23,7 +23,7 @@
 
 /* PCIE Device IDs */
 
-#define        PCIE_DEVICE_ID_QTN_PEARL        (0x0008)
+#define        PCIE_DEVICE_ID_QSR              (0x0008)
 
 #define QTN_REG_SYS_CTRL_CSR           0x14
 #define QTN_CHIP_ID_MASK               0xF0

drivers/net/wireless/quantenna/qtnfmac/qtn_hw_ids.h line 39

Quoted 5 lines
drivers/net/wireless/quantenna/qtnfmac/qtn_hw_ids.h +2 -0
@@ -35,6 +35,8 @@
 /* FW names */
 
 #define QTN_PCI_PEARL_FW_NAME          "qtn/fmac_qsr10g.img"
+#define QTN_PCI_TOPAZ_FW_NAME          "qtn/fmac_qsr1000.img"
+#define QTN_PCI_TOPAZ_BOOTLD_NAME      "qtn/uboot_qsr1000.img"

A bit late of a review/question, but how does one obtain one of these files? There's nothing in linux-firmware, and I see only one aborted attempt for adding fmac_qsr10g.img from 2016, but none for the others. Searching for these filenames also didn't reveal any external locations.

Regards
Jonas

#5 lore raw

Re: [PATCH v2 2/2] qtnfmac: add support for Topaz chipsets

Quoted 9 lines

A bit late of a review/question, but how does one obtain one of these files? There's nothing in linux-firmware, and I see only one aborted attempt for adding fmac_qsr10g.img from 2016, but none for the others. Searching for these filenames also didn't reveal any external locations.

Quoted 3 lines

Regards
Jonas

Hi Jonas, we're working towards a second attempt to get those accepted to linux-firmware (fmac_qsr1000.img binary first) admittedly it takes us a long time to do that. The main obstacle for us as developers is that the binary contains 3-d party GPL code so we have to work with other departments to satisfy all submission requirements (provide sources, proper licensing/attribution etc). From a failed fmac_qsr10g.img attempt it was clear that simply providing an contact email is not enough.

We're planning a second attempt to submit firmware binary patch relatively soon, for now we expect device will boot from flash.

#6 lore raw

Re: [PATCH v2 2/2] qtnfmac: add support for Topaz chipsets

Hi Igor,

Quoted 22 lines · Igor Mitsyanko
Quoted 10 lines

A bit late of a review/question, but how does one obtain one of these files? There's nothing in linux-firmware, and I see only one aborted attempt for adding fmac_qsr10g.img from 2016, but none for the others. Searching for these filenames also didn't reveal any external locations.

Quoted 3 lines

Regards
Jonas

Hi Jonas, we're working towards a second attempt to get those accepted to linux-firmware (fmac_qsr1000.img binary first) admittedly it takes us a long time to do that. The main obstacle for us as developers is that the binary contains 3-d party GPL code so we have to work with other departments to satisfy all submission requirements (provide sources, proper licensing/attribution etc). From a failed fmac_qsr10g.img attempt it was clear that simply providing an contact email is not enough.

Quoted 2 lines

We're planning a second attempt to submit firmware binary patch relatively soon, for now we expect device will boot from flash.

Any update on this? The support now had its first anniversary, and still no firmware available for it.

Maybe you could put it up in a (temporary) download location at Quantenna until you get around to the second attempt?

Regards
Jonas

#7 lore raw

Re: [PATCH v2 2/2] qtnfmac: add support for Topaz chipsets

Quoted 5 lines · Jonas Gorski

Any update on this? The support now had its first anniversary, and still no firmware available for it.

Maybe you could put it up in a (temporary) download location at Quantenna until you get around to the second attempt?

Hi Jonas, Quantenna was recently acquired by ON Semiconductor and this was put on hold during the integration. I have gone back to our legal / IT department to work on this again.

#8 lore raw

Re: [PATCH v2 2/2] qtnfmac: add support for Topaz chipsets

Quoted 10 lines · Igor Mitsyanko
Quoted 5 lines · Jonas Gorski

Any update on this? The support now had its first anniversary, and still no firmware available for it.

Maybe you could put it up in a (temporary) download location at Quantenna until you get around to the second attempt?

Hi Jonas, Quantenna was recently acquired by ON Semiconductor and this was put on hold during the integration. I have gone back to our legal / IT department to work on this again.

Thanks, and please put priority on this. It's really bad that if there's an upstream driver but users can't use it because of lack of firmware.

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#9 lore raw

Re: [PATCH v2 2/2] qtnfmac: add support for Topaz chipsets

Quoted 8 lines · Kalle Valo
Quoted 7 lines · Igor Mitsyanko
Quoted 5 lines · Jonas Gorski

Any update on this? The support now had its first anniversary, and still no firmware available for it.

Maybe you could put it up in a (temporary) download location at Quantenna until you get around to the second attempt?

Quoted 6 lines
Quoted 3 lines

Hi Jonas, Quantenna was recently acquired by ON Semiconductor and this was put on hold during the integration. I have gone back to our legal / IT department to work on this again.

Thanks, and please put priority on this. It's really bad that if there's an upstream driver but users can't use it because of lack of firmware.

And it's particularily meaningless since most of the firmware source is available for download from e.g
https://kb.netgear.com/2649/NETGEAR-Open-Source-Code-for-Programmers-GPL
, or other vendors using these modules.

The "Netgear R7500" firmware archives include the GPL distribution of a few Quantenna Topaz firmware versions:

qtn sdk v36.6.0.23: 1.0.0.46,
qtn sdk v36.6.0.28: 1.0.0.52,
qtn sdk v36.6.0.30: 1.0.0.68, 1.0.0.70,
qtn sdk v36.7.3.23: 1.0.0.76, 1.0.0.82,
qtn sdk v37.3.1.25: 1.0.0.94, 1.0.0.108, 1.0.0.110 , 1.0.0.112, 1.0.0.116, 1.0.0.122, qtn sdk v37.3.2.44: 1.0.0.124

These are pretty complete and directly buildable/usable. Now I only have an RGMII connected Topaz module so I am unable to test these firmwares with the PCIe driver, but I assume they will work with it.

Having some officially sanctioned image in linux-firmware would be nice.

Bjørn