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
diff --git a/Kbuild b/Kbuild
index 0802c09..e68aa8f 100644
--- a/Kbuild
+++ b/Kbuild
@@ -1329,7 +1329,7 @@
 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 @@
 #Enable USB specific APIS
 ifeq ($(CONFIG_HIF_USB), y)
 cppflags-y += -DHIF_USB \
-            -DCONFIG_PLD_USB_CNSS \
             -DDEBUG_HL_LOGGING \
             -DCONFIG_HL_SUPPORT
 endif
diff --git a/configs/default_defconfig b/configs/default_defconfig
index 570a207..12d81e5 100644
--- a/configs/default_defconfig
+++ b/configs/default_defconfig
@@ -373,7 +373,6 @@
 #Enable USB specific APIS
 ifeq ($(CONFIG_ROME_IF),usb)
 	CONFIG_HIF_USB := y
-	CONFIG_PLD_USB_CNSS := y
 endif
 
 #Enable SDIO specific APIS
diff --git a/core/pld/src/pld_usb.c b/core/pld/src/pld_usb.c
index 9b56c64..770f4e7 100644
--- a/core/pld/src/pld_usb.c
+++ b/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 @@
 	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 @@
 	usb_deregister(&pld_usb_ops);
 	pr_info("%s usb_deregister done!\n", __func__);
 }
+#endif /* CONFIG_PLD_USB_CNSS */
diff --git a/core/pld/src/pld_usb.h b/core/pld/src/pld_usb.h
index 2f4e929..fc6ffcc 100644
--- a/core/pld/src/pld_usb.h
+++ b/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