qcacmn: Add hif layer changes for sdio bus (Part 3 - HIF SDIO)
Abstract bus related functionalies to respective bus layer.
CRs-Fixed: 969334
Change-Id: Ie14970d69c0a8bf545d136480e4571352f2d4a26
diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c
index 2dac2f4..6bbf06e 100644
--- a/hif/src/hif_main.c
+++ b/hif/src/hif_main.c
@@ -38,8 +38,11 @@
#include <a_debug.h>
#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"
+#include "platform_icnss.h"
+#endif
#include "qdf_trace.h"
#include "qdf_status.h"
#ifdef CONFIG_CNSS
@@ -47,60 +50,10 @@
#endif
#include "hif_debug.h"
#include "mp_dev.h"
-#include "platform_icnss.h"
-
-#define AGC_DUMP 1
-#define CHANINFO_DUMP 2
-#define BB_WATCHDOG_DUMP 3
-#ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG
-#define PCIE_ACCESS_DUMP 4
-#endif
void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t cmd_id, bool start)
{
- struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
- switch (cmd_id) {
- case AGC_DUMP:
- if (start)
- priv_start_agc(scn);
- else
- priv_dump_agc(scn);
- break;
-
- case CHANINFO_DUMP:
- if (start)
- priv_start_cap_chaninfo(scn);
- else
- priv_dump_chaninfo(scn);
- break;
-
- case BB_WATCHDOG_DUMP:
- priv_dump_bbwatchdog(scn);
- break;
-
-#ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG
- case PCIE_ACCESS_DUMP:
- hif_target_dump_access_log();
- break;
-#endif
- default:
- HIF_ERROR("%s: Invalid htc dump command", __func__);
- break;
- }
-}
-
-/**
- * hif_shut_down_device() - hif_shut_down_device
- *
- * SThis fucntion shuts down the device
- *
- * @scn: hif_opaque_softc
- *
- * Return: void
- */
-void hif_shut_down_device(struct hif_opaque_softc *scn)
-{
- hif_stop(scn);
+ hif_trigger_dump(hif_ctx, cmd_id, start);
}
/**
@@ -117,74 +70,6 @@
return scn->mem;
}
-static inline void hif_fw_event_handler(struct HIF_CE_state *hif_state)
-{
- struct hif_msg_callbacks *msg_callbacks =
- &hif_state->msg_callbacks_current;
-
- if (!msg_callbacks->fwEventHandler)
- return;
-
- msg_callbacks->fwEventHandler(msg_callbacks->Context,
- QDF_STATUS_E_FAILURE);
-}
-
-/**
- * hif_fw_interrupt_handler(): FW interrupt handler
- *
- * This function is the FW interrupt handlder
- *
- * @irq: irq number
- * @arg: the user pointer
- *
- * Return: bool
- */
-#ifndef QCA_WIFI_3_0
-irqreturn_t hif_fw_interrupt_handler(int irq, void *arg)
-{
- struct hif_softc *scn = arg;
- struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
- uint32_t fw_indicator_address, fw_indicator;
-
- if (Q_TARGET_ACCESS_BEGIN(scn) < 0)
- return ATH_ISR_NOSCHED;
-
- fw_indicator_address = hif_state->fw_indicator_address;
- /* For sudden unplug this will return ~0 */
- fw_indicator = A_TARGET_READ(scn, fw_indicator_address);
-
- if ((fw_indicator != ~0) && (fw_indicator & FW_IND_EVENT_PENDING)) {
- /* ACK: clear Target-side pending event */
- A_TARGET_WRITE(scn, fw_indicator_address,
- fw_indicator & ~FW_IND_EVENT_PENDING);
- if (Q_TARGET_ACCESS_END(scn) < 0)
- return ATH_ISR_SCHED;
-
- if (hif_state->started) {
- hif_fw_event_handler(hif_state);
- } else {
- /*
- * Probable Target failure before we're prepared
- * to handle it. Generally unexpected.
- */
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: Early firmware event indicated\n",
- __func__));
- }
- } else {
- if (Q_TARGET_ACCESS_END(scn) < 0)
- return ATH_ISR_SCHED;
- }
-
- return ATH_ISR_SCHED;
-}
-#else
-irqreturn_t hif_fw_interrupt_handler(int irq, void *arg)
-{
- return ATH_ISR_SCHED;
-}
-#endif /* #ifdef QCA_WIFI_3_0 */
-
/**
* hif_get_targetdef(): hif_get_targetdef
* @scn: scn
@@ -579,30 +464,6 @@
return QDF_STATUS_SUCCESS;
}
-/**
- * hif_wlan_disable(): call the platform driver to disable wlan
- * @scn: HIF Context
- *
- * This function passes the con_mode to platform driver to disable
- * wlan.
- *
- * Return: void
- */
-void hif_wlan_disable(struct hif_softc *scn)
-{
- enum icnss_driver_mode mode;
- uint32_t con_mode = hif_get_conparam(scn);
-
- if (QDF_GLOBAL_FTM_MODE == con_mode)
- mode = ICNSS_FTM;
- else if (QDF_IS_EPPING_ENABLED(con_mode))
- mode = ICNSS_EPPING;
- else
- mode = ICNSS_MISSION;
-
- icnss_wlan_disable(mode);
-}
-
void hif_disable(struct hif_opaque_softc *hif_ctx, enum hif_disable_type type)
{
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
@@ -612,7 +473,7 @@
hif_nointrs(scn);
if (scn->hif_init_done == false)
- hif_shut_down_device(hif_ctx);
+ hif_shutdown_device(hif_ctx);
else
hif_stop(hif_ctx);