Browse Source

qcacmn: Add USB bus support (HIF Common)

Add module specific changes for USB bus support.

Change-Id: I98ca380567c279d3206aa4afc7a28c2feeb65993
CRs-Fixed: 1023663
Mohit Khanna 9 years ago
parent
commit
440c5295c2

+ 15 - 3
hif/inc/hif.h

@@ -40,7 +40,9 @@ extern "C" {
 #ifdef HIF_PCI
 #include <linux/pci.h>
 #endif /* HIF_PCI */
-
+#ifdef HIF_USB
+#include <linux/usb.h>
+#endif /* HIF_USB */
 #define ENABLE_MBOX_DUMMY_SPACE_FEATURE 1
 
 typedef struct htc_callbacks HTC_CALLBACKS;
@@ -363,7 +365,7 @@ typedef void (*fastpath_msg_handler)(void *, qdf_nbuf_t *, uint32_t);
 #ifdef WLAN_FEATURE_FASTPATH
 void hif_enable_fastpath(struct hif_opaque_softc *hif_ctx);
 bool hif_is_fastpath_mode_enabled(struct hif_opaque_softc *hif_ctx);
-void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int);
+void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret);
 int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx,
 				fastpath_msg_handler handler, void *context);
 #else
@@ -373,6 +375,11 @@ static inline int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx,
 {
 	return QDF_STATUS_E_FAILURE;
 }
+static inline void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int ret)
+{
+	return NULL;
+}
+
 #endif
 
 /*
@@ -613,7 +620,11 @@ struct hif_pipe_addl_info *hif_get_addl_pipe_info(struct hif_opaque_softc *osc,
 uint32_t hif_set_nss_wifiol_mode(struct hif_opaque_softc *osc,
 		uint32_t pipe_num);
 int32_t hif_get_nss_wifiol_bypass_nw_process(struct hif_opaque_softc *osc);
-#endif
+#endif /* QCA_NSS_WIFI_OFFLOAD_SUPPORT */
+
+void hif_set_bundle_mode(struct hif_opaque_softc *scn, bool enabled,
+				int rx_bundle_cnt);
+int hif_bus_reset_resume(struct hif_opaque_softc *scn);
 
 #ifdef WLAN_SUSPEND_RESUME_TEST
 typedef void (*hdd_fake_resume_callback)(uint32_t val);
@@ -623,4 +634,5 @@ void hif_fake_apps_suspend(hdd_fake_resume_callback callback);
 #ifdef __cplusplus
 }
 #endif
+
 #endif /* _HIF_H_ */

+ 6 - 0
hif/inc/regtable.h

@@ -31,8 +31,14 @@
 #ifdef HIF_SDIO
 #include "regtable_sdio.h"
 #endif
+
 #if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
 #include "reg_struct.h"
 #include "regtable_pcie.h"
 #endif
+
+#if defined(HIF_USB)
+#include "regtable_usb.h"
+#endif
+
 #endif

+ 2 - 0
hif/src/ar6320def.h

@@ -460,8 +460,10 @@ struct targetdef_s ar6320_targetdef = {
 	.d_DRAM_BASE_ADDRESS = AR6320_DRAM_BASE_ADDRESS,
 	.d_SOC_CORE_BASE_ADDRESS = AR6320_SOC_CORE_BASE_ADDRESS,
 	.d_CORE_CTRL_ADDRESS = AR6320_CORE_CTRL_ADDRESS,
+#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
 	.d_MSI_NUM_REQUEST = MSI_NUM_REQUEST,
 	.d_MSI_ASSIGN_FW = MSI_ASSIGN_FW,
+#endif
 	.d_CORE_CTRL_CPU_INTR_MASK = AR6320_CORE_CTRL_CPU_INTR_MASK,
 	.d_SR_WR_INDEX_ADDRESS = AR6320_SR_WR_INDEX_ADDRESS,
 	.d_DST_WATERMARK_ADDRESS = AR6320_DST_WATERMARK_ADDRESS,

+ 2 - 0
hif/src/ar6320v2def.h

@@ -464,8 +464,10 @@ struct targetdef_s ar6320v2_targetdef = {
 	.d_DRAM_BASE_ADDRESS = AR6320V2_DRAM_BASE_ADDRESS,
 	.d_SOC_CORE_BASE_ADDRESS = AR6320V2_SOC_CORE_BASE_ADDRESS,
 	.d_CORE_CTRL_ADDRESS = AR6320V2_CORE_CTRL_ADDRESS,
+#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
 	.d_MSI_NUM_REQUEST = MSI_NUM_REQUEST,
 	.d_MSI_ASSIGN_FW = MSI_ASSIGN_FW,
+#endif
 	.d_CORE_CTRL_CPU_INTR_MASK = AR6320V2_CORE_CTRL_CPU_INTR_MASK,
 	.d_SR_WR_INDEX_ADDRESS = AR6320V2_SR_WR_INDEX_ADDRESS,
 	.d_DST_WATERMARK_ADDRESS = AR6320V2_DST_WATERMARK_ADDRESS,

+ 2 - 0
hif/src/ar9888def.h

@@ -367,8 +367,10 @@ struct targetdef_s ar9888_targetdef = {
 	.d_DRAM_BASE_ADDRESS = AR9888_DRAM_BASE_ADDRESS,
 	.d_SOC_CORE_BASE_ADDRESS = AR9888_SOC_CORE_BASE_ADDRESS,
 	.d_CORE_CTRL_ADDRESS = AR9888_CORE_CTRL_ADDRESS,
+#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
 	.d_MSI_NUM_REQUEST = MSI_NUM_REQUEST,
 	.d_MSI_ASSIGN_FW = MSI_ASSIGN_FW,
+#endif
 	.d_CORE_CTRL_CPU_INTR_MASK = AR9888_CORE_CTRL_CPU_INTR_MASK,
 	.d_SR_WR_INDEX_ADDRESS = AR9888_SR_WR_INDEX_ADDRESS,
 	.d_DST_WATERMARK_ADDRESS = AR9888_DST_WATERMARK_ADDRESS,

+ 1 - 1
hif/src/hif_debug.h

@@ -36,7 +36,7 @@
 #define HIF_INFO_LO(args ...) \
 	QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO_LOW, ## args)
 #define HIF_TRACE(args ...) \
-	QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_ERROR, ## args)
+	QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO, ## args)
 #define HIF_DBG(args ...) \
 	QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_DEBUG, ## args)
 

+ 25 - 3
hif/src/hif_main.c

@@ -39,13 +39,13 @@
 #include "hif_main.h"
 #include "hif_hw_version.h"
 #if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
-#include "ce_api.h"
 #include "ce_tasklet.h"
 #endif
 #include "qdf_trace.h"
 #include "qdf_status.h"
 #include "hif_debug.h"
 #include "mp_dev.h"
+#include "ce_api.h"
 
 void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t cmd_id, bool start)
 {
@@ -324,6 +324,11 @@ void hif_get_hw_info(struct hif_opaque_softc *scn, u32 *version, u32 *revision,
 			const char **target_name)
 {
 	struct hif_target_info *info = hif_get_target_info_handle(scn);
+	struct hif_softc *sc = HIF_GET_SOFTC(scn);
+
+	if (sc->bus_type == QDF_BUS_TYPE_USB)
+		hif_usb_get_hw_info(sc);
+
 	*version = info->target_version;
 	*revision = info->target_revision;
 	*target_name = hif_get_hw_name(info);
@@ -455,7 +460,7 @@ QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev,
 
 	scn->hif_init_done = true;
 
-	HIF_TRACE("%s: X OK", __func__);
+	HIF_TRACE("%s: OK", __func__);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -888,7 +893,7 @@ bool hif_is_recovery_in_progress(struct hif_softc *scn)
 
 	return false;
 }
-
+#if defined(HIF_PCI) || defined(SNOC) || defined(HIF_AHB)
 /**
  * hif_batch_send() - API to access hif specific function
  * ce_batch_send.
@@ -958,6 +963,7 @@ int hif_send_fast(struct hif_opaque_softc *osc, qdf_nbuf_t nbuf,
 	return ce_send_fast((struct CE_handle *)ce_tx_hdl, nbuf,
 			transfer_id, download_len);
 }
+#endif
 
 /**
  * hif_reg_write() - API to access hif specific function
@@ -990,3 +996,19 @@ uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset)
 	struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
 	return hif_read32_mb(scn->mem + offset);
 }
+
+#if defined(HIF_USB)
+/**
+ * hif_ramdump_handler(): generic ramdump handler
+ * @scn: struct hif_opaque_softc
+ *
+ * Return: None
+ */
+
+void hif_ramdump_handler(struct hif_opaque_softc *scn)
+
+{
+	if (hif_get_bus_type == QDF_BUS_TYPE_USB)
+		hif_usb_ramdump_handler();
+}
+#endif

+ 10 - 0
hif/src/hif_main.h

@@ -95,6 +95,8 @@
 #define HIF_GET_PCI_SOFTC(scn) ((struct hif_pci_softc *)scn)
 #define HIF_GET_CE_STATE(scn) ((struct HIF_CE_state *)scn)
 #define HIF_GET_SDIO_SOFTC(scn) ((struct hif_sdio_softc *)scn)
+#define HIF_GET_USB_SOFTC(scn) ((struct hif_usb_softc *)scn)
+#define HIF_GET_USB_DEVICE(scn) ((HIF_DEVICE_USB *)scn)
 #define HIF_GET_SOFTC(scn) ((struct hif_softc *)scn)
 #define GET_HIF_OPAQUE_HDL(scn) ((struct hif_opaque_softc *)scn)
 
@@ -203,4 +205,12 @@ void hif_wlan_disable(struct hif_softc *scn);
 int hif_target_sleep_state_adjust(struct hif_softc *scn,
 					 bool sleep_ok,
 					 bool wait_for_it);
+#ifdef HIF_USB
+void hif_usb_get_hw_info(struct hif_softc *scn);
+void hif_ramdump_handler(struct hif_opaque_softc *scn);
+
+#else
+static inline void hif_usb_get_hw_info(struct hif_softc *scn) {}
+static inline void hif_ramdump_handler(struct hif_opaque_softc *scn) {}
+#endif
 #endif /* __HIF_MAIN_H__ */

+ 0 - 13
hif/src/sdio/hif_sdio.c

@@ -226,16 +226,3 @@ void hif_send_complete_check(struct hif_opaque_softc *hif_ctx, uint8_t pipe,
 
 }
 
-/**
- * hif_set_bundle_mode() - set bundling mode.
- * @hif_ctx: HIF context
- * @enabled: enable/disable bundling
- * @rx_bundle_cnt: bundling count
- *
- * Return: none
- */
-void hif_set_bundle_mode(struct hif_opaque_softc *hif_ctx, bool enabled,
-			uint64_t rx_bundle_cnt)
-{
-
-}

+ 2 - 2
hif/src/usb/hif_usb.c

@@ -893,14 +893,14 @@ void hif_suspend_wow(struct hif_opaque_softc *scn)
 }
 
 /**
- * hif_set_bundle_mode() - enable bundling and set default rx bundle cnt
+ * hif_usb_set_bundle_mode() - enable bundling and set default rx bundle cnt
  * @scn: pointer to hif_opaque_softc structure
  * @enabled: flag to enable/disable bundling
  * @rx_bundle_cnt: bundle count to be used for RX
  *
  * Return: none
  */
-void hif_set_bundle_mode(struct hif_opaque_softc *scn,
+void hif_usb_set_bundle_mode(struct hif_softc *scn,
 					bool enabled, int rx_bundle_cnt)
 {
 	HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn);

+ 4 - 5
hif/src/usb/if_usb.c

@@ -361,7 +361,7 @@ int hif_usb_bus_resume(struct hif_softc *hif_ctx)
 }
 
 /**
- * hif_bus_reset_resume() - resume the bus after reset
+ * hif_usb_bus_reset_resume() - resume the bus after reset
  * @scn: struct hif_opaque_softc
  *
  * This function is called to tell the driver that USB device has been resumed
@@ -370,10 +370,9 @@ int hif_usb_bus_resume(struct hif_softc *hif_ctx)
  *
  * Return: int 0 for success, non zero for failure
  */
-int hif_bus_reset_resume(struct hif_opaque_softc *scn)
+int hif_usb_bus_reset_resume(struct hif_softc *hif_ctx)
 {
 	int ret = 0;
-	struct hif_softc *hif_ctx = HIF_GET_SOFTC(scn);
 	HIF_ENTER();
 	if (hif_usb_diag_write_cold_reset(hif_ctx) != QDF_STATUS_SUCCESS)
 		ret = 1;
@@ -621,7 +620,7 @@ void hif_fw_assert_ramdump_pattern(struct hif_usb_softc *sc)
 }
 
 /**
- * hif_ramdump_handler(): dump bus debug registers
+ * hif_usb_ramdump_handler(): dump bus debug registers
  * @scn: struct hif_opaque_softc
  *
  * This function is to receive information of firmware crash dump, and
@@ -641,7 +640,7 @@ void hif_fw_assert_ramdump_pattern(struct hif_usb_softc *sc)
  * Return: 0 for success or error code
  */
 
-void hif_ramdump_handler(struct hif_opaque_softc *scn)
+void hif_usb_ramdump_handler(struct hif_opaque_softc *scn)
 {
 	uint32_t *reg, pattern, i, start_addr = 0;
 	uint32_t len;