summaryrefslogtreecommitdiff
path: root/hif/src/ce
diff options
context:
space:
mode:
authorPoddar, Siddarth <siddpodd@codeaurora.org>2016-04-27 15:33:48 +0530
committerVishwajith Upendra <vishwaji@codeaurora.org>2016-06-14 13:48:17 -0700
commite41943f3a8c4b5046adaabf49e8181c117d7f4d2 (patch)
tree3696ed6294b7c47fc28555f955007a5d483149a8 /hif/src/ce
parent3573f9537b34d5b18721969d416b737a52599115 (diff)
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
Diffstat (limited to 'hif/src/ce')
-rw-r--r--hif/src/ce/ce_diag.c3
-rw-r--r--hif/src/ce/ce_main.c166
-rw-r--r--hif/src/ce/ce_main.h20
3 files changed, 181 insertions, 8 deletions
diff --git a/hif/src/ce/ce_diag.c b/hif/src/ce/ce_diag.c
index 6fee451e05aa..c1ee743154f4 100644
--- a/hif/src/ce/ce_diag.c
+++ b/hif/src/ce/ce_diag.c
@@ -44,10 +44,9 @@
#include "hif_debug.h"
void
-hif_dump_target_memory(struct hif_opaque_softc *hif_ctx, void *ramdump_base,
+hif_ce_dump_target_memory(struct hif_softc *scn, void *ramdump_base,
uint32_t address, uint32_t size)
{
- struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
uint32_t loc = address;
uint32_t val = 0;
uint32_t j = 0;
diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c
index 0052889a5d25..59774466e06c 100644
--- a/hif/src/ce/ce_main.c
+++ b/hif/src/ce/ce_main.c
@@ -53,6 +53,14 @@
#define CE_POLL_TIMEOUT 10 /* ms */
+#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
+#include "mp_dev.h"
+
/* Forward references */
static int hif_post_recv_buffers_for_pipe(struct HIF_CE_pipe_info *pipe_info);
@@ -79,6 +87,53 @@ static int hif_post_recv_buffers_for_pipe(struct HIF_CE_pipe_info *pipe_info);
static int hif_post_recv_buffers(struct hif_softc *scn);
static void hif_config_rri_on_ddr(struct hif_softc *scn);
+/**
+ * hif_target_access_log_dump() - dump access log
+ *
+ * dump access log
+ *
+ * Return: n/a
+ */
+#ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG
+static void hif_target_access_log_dump(void)
+{
+ hif_target_dump_access_log();
+}
+#endif
+
+
+void hif_trigger_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_access_log_dump();
+ break;
+#endif
+ default:
+ HIF_ERROR("%s: Invalid htc dump command", __func__);
+ break;
+ }
+}
+
static void ce_poll_timeout(void *arg)
{
struct CE_state *CE_state = (struct CE_state *)arg;
@@ -1805,10 +1860,9 @@ void hif_flush_surprise_remove(struct hif_opaque_softc *hif_ctx)
hif_buffer_cleanup(hif_state);
}
-void hif_stop(struct hif_opaque_softc *hif_ctx)
+void hif_ce_stop(struct hif_softc *scn)
{
- struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
- struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(hif_ctx);
+ struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
int pipe_num;
scn->hif_init_done = false;
@@ -2202,7 +2256,7 @@ int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx,
#ifdef IPA_OFFLOAD
/**
- * hif_ipa_get_ce_resource() - get uc resource on hif
+ * hif_ce_ipa_get_ce_resource() - get uc resource on hif
* @scn: bus context
* @ce_sr_base_paddr: copyengine source ring base physical address
* @ce_sr_ring_size: copyengine source ring size
@@ -2214,12 +2268,11 @@ int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx,
*
* Return: None
*/
-void hif_ipa_get_ce_resource(struct hif_opaque_softc *hif_ctx,
+void hif_ce_ipa_get_ce_resource(struct hif_softc *scn,
qdf_dma_addr_t *ce_sr_base_paddr,
uint32_t *ce_sr_ring_size,
qdf_dma_addr_t *ce_reg_paddr)
{
- struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
struct HIF_CE_pipe_info *pipe_info =
&(hif_state->pipe_info[HIF_PCI_IPA_UC_ASSIGNED_CE]);
@@ -2775,3 +2828,104 @@ void hif_disable_interrupt(struct hif_opaque_softc *osc, uint32_t pipe_num)
CE_COPY_COMPLETE_INTR_DISABLE(scn, ctrl_addr);
Q_TARGET_ACCESS_END(scn);
}
+
+/**
+ * hif_fw_event_handler() - hif fw event handler
+ * @hif_state: pointer to hif ce state structure
+ *
+ * Process fw events and raise HTC callback to process fw events.
+ *
+ * Return: none
+ */
+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);
+}
+
+#ifndef QCA_WIFI_3_0
+/**
+ * hif_fw_interrupt_handler() - FW interrupt handler
+ * @irq: irq number
+ * @arg: the user pointer
+ *
+ * Called from the PCI interrupt handler when a
+ * firmware-generated interrupt to the Host.
+ *
+ * Return: status of handled irq
+ */
+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_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);
+}
diff --git a/hif/src/ce/ce_main.h b/hif/src/ce/ce_main.h
index 2c51b85fde1f..6c3a67f91937 100644
--- a/hif/src/ce/ce_main.h
+++ b/hif/src/ce/ce_main.h
@@ -157,8 +157,28 @@ struct shadow_reg_cfg {
uint16_t reg_offset;
};
+void hif_ce_stop(struct hif_softc *scn);
int hif_dump_ce_registers(struct hif_softc *scn);
+void
+hif_ce_dump_target_memory(struct hif_softc *scn, void *ramdump_base,
+ uint32_t address, uint32_t size);
+
+#ifdef IPA_OFFLOAD
+void hif_ce_ipa_get_ce_resource(struct hif_softc *scn,
+ qdf_dma_addr_t *ce_sr_base_paddr,
+ uint32_t *ce_sr_ring_size,
+ qdf_dma_addr_t *ce_reg_paddr);
+#else
+static inline
+void hif_ce_ipa_get_ce_resource(struct hif_softc *scn,
+ qdf_dma_addr_t *ce_sr_base_paddr,
+ uint32_t *ce_sr_ring_size,
+ qdf_dma_addr_t *ce_reg_paddr)
+{
+ return;
+}
+#endif
int hif_wlan_enable(struct hif_softc *scn);
void hif_wlan_disable(struct hif_softc *scn);
void hif_get_target_ce_config(struct CE_pipe_config **target_ce_config_ret,