Browse Source

qcacld-3.0: Add support for CNSS USB

Adds support in pld_usb.c for registering with CNSS driver.
pld_usb can now register directly with Linux USB stack or with
CNSS driver.
For QCN7605, registration is to be done with CNSS.

Change-Id: Ibf7e51679e1848bcd8e1acfa43c457f42ff40c0b
CRs-Fixed: 2269602
Ajit Pal Singh 6 years ago
parent
commit
6c6e81c714
4 changed files with 49 additions and 17 deletions
  1. 1 2
      Kbuild
  2. 0 1
      configs/default_defconfig
  3. 41 1
      core/pld/src/pld_usb.c
  4. 7 13
      core/pld/src/pld_usb.h

+ 1 - 2
Kbuild

@@ -1329,7 +1329,7 @@ endif
 ifeq ($(CONFIG_QCA_WIFI_SDIO), y)
 PLD_OBJS +=	$(PLD_SRC_DIR)/pld_sdio.o
 endif
-ifeq ($(CONFIG_PLD_USB_CNSS), y)
+ifeq ($(CONFIG_HIF_USB), y)
 PLD_OBJS +=	$(PLD_SRC_DIR)/pld_usb.o
 endif
 
@@ -1779,7 +1779,6 @@ cppflags-$(CONFIG_FEATURE_SKB_PRE_ALLOC) += -DFEATURE_SKB_PRE_ALLOC
 #Enable USB specific APIS
 ifeq ($(CONFIG_HIF_USB), y)
 cppflags-y += -DHIF_USB \
-            -DCONFIG_PLD_USB_CNSS \
             -DDEBUG_HL_LOGGING \
             -DCONFIG_HL_SUPPORT
 endif

+ 0 - 1
configs/default_defconfig

@@ -373,7 +373,6 @@ endif
 #Enable USB specific APIS
 ifeq ($(CONFIG_ROME_IF),usb)
 	CONFIG_HIF_USB := y
-	CONFIG_PLD_USB_CNSS := y
 endif
 
 #Enable SDIO specific APIS

+ 41 - 1
core/pld/src/pld_usb.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -25,6 +25,9 @@
 #include <linux/platform_device.h>
 #include <linux/err.h>
 #include <linux/list.h>
+#ifdef CONFIG_PLD_USB_CNSS
+#include <net/cnss2.h>
+#endif
 
 
 #define VENDOR_ATHR             0x0CF3
@@ -155,6 +158,42 @@ static int pld_usb_reset_resume(struct usb_interface *interface)
 	return pld_context->ops->reset_resume(&pdev->dev, PLD_BUS_TYPE_USB);
 }
 
+#ifdef CONFIG_PLD_USB_CNSS
+struct cnss_usb_wlan_driver pld_usb_ops = {
+	.name = "pld_usb_cnss",
+	.id_table = pld_usb_id_table,
+	.probe = pld_usb_probe,
+	.disconnect = pld_usb_remove,
+#ifdef CONFIG_PM
+	.suspend = pld_usb_suspend,
+	.resume = pld_usb_resume,
+	.reset_resume = pld_usb_reset_resume,
+#endif
+
+/**
+ * pld_usb_register_driver() - registration routine for wlan usb drive
+ *
+ * Return: int negative error code on failure and 0 on success
+ */
+int pld_usb_register_driver(void)
+{
+	pr_info("%s usb_register\n", __func__);
+	return cnss_wlan_register_driver(&pld_usb_ops);
+}
+
+/**
+ * pld_usb_unregister_driver() - de-registration routine for wlan usb driver
+ *
+ * Return: void
+ */
+void pld_usb_unregister_driver(void)
+{
+	cnss_wlan_register_driver(&pld_usb_ops);
+	pr_info("%s usb_deregister done!\n", __func__);
+}
+
+#else /* CONFIG_PLD_USB_CNSS */
+
 struct usb_driver pld_usb_ops = {
 	.name = "pld_usb",
 	.id_table = pld_usb_id_table,
@@ -209,3 +248,4 @@ void pld_usb_unregister_driver(void)
 	usb_deregister(&pld_usb_ops);
 	pr_info("%s usb_deregister done!\n", __func__);
 }
+#endif /* CONFIG_PLD_USB_CNSS */

+ 7 - 13
core/pld/src/pld_usb.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -20,24 +20,18 @@
 
 #include "pld_common.h"
 
-#if !defined(CONFIG_PLD_USB_CNSS)
+#ifdef HIF_USB
+int pld_usb_register_driver(void);
+void pld_usb_unregister_driver(void);
+int pld_usb_get_ce_id(int irq);
+#else
 static inline int pld_usb_register_driver(void)
 {
 	return 0;
 }
 
 static inline void pld_usb_unregister_driver(void)
-{
-}
-
-static inline int pld_usb_get_ce_id(int irq)
-{
-	return 0;
-}
-#else
-int pld_usb_register_driver(void);
-void pld_usb_unregister_driver(void);
-int pld_usb_get_ce_id(int irq);
+{}
 #endif
 
 static inline int