Selaa lähdekoodia

qcacld-3.0: Add USB bus support (BMI)

Add BMI specific changes for USB bus support.

Change-Id: Icf9d2097d23945c6fab6d3d06dbff04578c8054e
CRs-Fixed: 1023663
Mohit Khanna 9 vuotta sitten
vanhempi
sitoutus
04bea52a30
4 muutettua tiedostoa jossa 62 lisäystä ja 7 poistoa
  1. 1 0
      core/bmi/src/bmi.c
  2. 1 1
      core/bmi/src/i_bmi.h
  3. 20 6
      core/bmi/src/ol_fw.c
  4. 40 0
      core/bmi/src/ol_fw_common.c

+ 1 - 0
core/bmi/src/bmi.c

@@ -200,6 +200,7 @@ bmi_get_target_info(struct bmi_target_info *targ_info,
 	switch (hif_get_bus_type(scn)) {
 	case QDF_BUS_TYPE_PCI:
 	case QDF_BUS_TYPE_SNOC:
+	case QDF_BUS_TYPE_USB:
 		status = bmi_get_target_info_message_based(targ_info, ol_ctx);
 		break;
 #ifdef HIF_SDIO

+ 1 - 1
core/bmi/src/i_bmi.h

@@ -188,7 +188,7 @@ struct ol_config_info *ol_get_ini_handle(struct ol_context *ol_ctx);
 QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
 		  struct bmi_target_info *targ_info);
 #endif
-#if defined(HIF_PCI) || defined(SNOC) || defined(HIF_AHB)
+#if defined(HIF_PCI) || defined(SNOC) || defined(HIF_AHB) || defined(HIF_USB)
 static inline QDF_STATUS
 hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
 		  struct bmi_target_info *targ_info)

+ 20 - 6
core/bmi/src/ol_fw.c

@@ -42,11 +42,17 @@
 #include "if_sdio.h"
 #include "regtable_sdio.h"
 #endif
+#if defined(HIF_USB)
+#include "if_usb.h"
+#include "regtable_usb.h"
+#endif
 #include "pld_common.h"
+#include "hif_main.h"
 
 #include "i_bmi.h"
 #include "qwlan_version.h"
 #include "cds_concurrency.h"
+#include "dbglog_host.h"
 
 #ifdef FEATURE_SECURE_FIRMWARE
 static struct hash_fw fw_hash;
@@ -604,6 +610,12 @@ void ol_target_failure(void *instance, QDF_STATUS status)
 
 	hif_set_target_status(scn, TARGET_STATUS_RESET);
 
+	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_USB) {
+		if (status == QDF_STATUS_E_USB_ERROR)
+			hif_ramdump_handler(scn);
+		return;
+	}
+
 	if (cds_is_driver_recovering()) {
 		BMI_ERR("%s: Recovery in progress, ignore!\n", __func__);
 		return;
@@ -1248,11 +1260,12 @@ QDF_STATUS ol_download_firmware(struct ol_context *ol_ctx)
 						__func__, address);
 	}
 
-	ret = ol_patch_pll_switch(ol_ctx);
-
-	if (ret != QDF_STATUS_SUCCESS) {
-		BMI_ERR("pll switch failed. status %d", ret);
-		return ret;
+	if (hif_get_bus_type(scn) != QDF_BUS_TYPE_USB) {
+		ret = ol_patch_pll_switch(ol_ctx);
+		if (ret != QDF_STATUS_SUCCESS) {
+			BMI_ERR("pll switch failed. status %d", ret);
+			return ret;
+		}
 	}
 
 	if (ol_ctx->cal_in_flash) {
@@ -1541,7 +1554,8 @@ void ol_dump_target_memory(struct hif_opaque_softc *scn, void *memory_block)
 	u_int32_t address = 0;
 	u_int32_t size = 0;
 
-	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_SDIO)
+	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_SDIO ||
+	    hif_get_bus_type(scn) == QDF_BUS_TYPE_USB)
 		return;
 
 	for (; section_count < 2; section_count++) {

+ 40 - 0
core/bmi/src/ol_fw_common.c

@@ -36,6 +36,9 @@
 #if defined(HIF_SDIO)
 #include "regtable_sdio.h"
 #endif
+#if defined(HIF_USB)
+#include "regtable_usb.h"
+#endif
 #if  defined(CONFIG_CNSS)
 #include <net/cnss.h>
 #endif
@@ -66,6 +69,33 @@ static inline void ol_sdio_disable_sleep(struct ol_context *ol_ctx)
 
 #endif
 
+/**
+ * ol_usb_extra_initialization() - USB extra initilization
+ * @ol_ctx: pointer to ol_context
+ *
+ * USB specific initialization after firmware download
+ *
+ * Return: QDF_STATUS_SUCCESS on success and error QDF status on failure
+ */
+static QDF_STATUS
+ol_usb_extra_initialization(struct ol_context *ol_ctx)
+{
+	struct hif_opaque_softc *scn = ol_ctx->scn;
+	struct hif_target_info *tgt_info =
+				hif_get_target_info_handle(scn);
+	QDF_STATUS status = !QDF_STATUS_SUCCESS;
+	u_int32_t param = 0;
+
+	param |= HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE;
+	status = bmi_write_memory(
+				hif_hia_item_address(tgt_info->target_type,
+					offsetof(struct host_interest_s,
+					hi_acs_flags)),
+				(u_int8_t *)&param, 4, ol_ctx);
+
+	return status;
+}
+
 /*Setting SDIO block size, mbox ISR yield limit for SDIO based HIF*/
 static
 QDF_STATUS ol_sdio_extra_initialization(struct ol_context *ol_ctx)
@@ -144,12 +174,22 @@ exit:
 	return status;
 }
 
+/**
+* ol_extra_initialization() - OL extra initilization
+* @ol_ctx: pointer to ol_context
+*
+* Bus specific initialization after firmware download
+*
+* Return: QDF_STATUS_SUCCESS on success and error QDF status on failure
+*/
 QDF_STATUS ol_extra_initialization(struct ol_context *ol_ctx)
 {
 	struct hif_opaque_softc *scn = ol_ctx->scn;
 
 	if (hif_get_bus_type(scn) == QDF_BUS_TYPE_SDIO)
 		return ol_sdio_extra_initialization(ol_ctx);
+	else if (hif_get_bus_type(scn) == QDF_BUS_TYPE_USB)
+		return ol_usb_extra_initialization(ol_ctx);
 
 	return QDF_STATUS_SUCCESS;
 }