qcacmn: Add CE services changes for SRNG based target

SRNG based target uses SRNG(Standard Ring) interface to implement all
the ring related access functions. This change provides CE services to
use interact with SRNG for CE access. It uses hal_srng module for HW
related access. It implements src ring using SRNG src ring and
destination ring using dest and status ring.
fastpath and batch send is not implemented as these are not applicable
to this target

Change-Id: I3e2b613004a08d669319f956d7b0656447eb8521
CRs-Fixed: 1042915
diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c
index 936a451..d5daaf4 100644
--- a/hif/src/hif_main.c
+++ b/hif/src/hif_main.c
@@ -46,6 +46,9 @@
 #include "hif_debug.h"
 #include "mp_dev.h"
 #include "ce_api.h"
+#ifdef QCA_WIFI_QCA8074
+#include "hal_api.h"
+#endif
 
 void hif_dump(struct hif_opaque_softc *hif_ctx, uint8_t cmd_id, bool start)
 {
@@ -340,6 +343,20 @@
 }
 
 /**
+ * hif_get_dev_ba(): API to get device base address.
+ * @scn: scn
+ * @version: version
+ * @revision: revision
+ *
+ * Return: n/a
+ */
+void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle)
+{
+	struct hif_softc *scn = (struct hif_softc *)hif_handle;
+
+	return scn->mem;
+}
+/**
  * hif_open(): hif_open
  * @qdf_ctx: QDF Context
  * @mode: Driver Mode
@@ -415,6 +432,18 @@
 	qdf_mem_free(scn);
 }
 
+static QDF_STATUS hif_hal_attach(struct hif_softc *scn)
+{
+#ifdef QCA_WIFI_QCA8074
+	if (ce_srng_based(scn)) {
+		scn->hal_soc = hal_attach(scn, scn->qdf_dev);
+		if (scn->hal_soc == NULL)
+			return QDF_STATUS_E_FAILURE;
+	}
+#endif
+
+	return QDF_STATUS_SUCCESS;
+}
 /**
  * hif_enable(): hif_enable
  * @hif_ctx: hif_ctx
@@ -446,6 +475,12 @@
 		return status;
 	}
 
+	status = hif_hal_attach(scn);
+	if (status != QDF_STATUS_SUCCESS) {
+		HIF_ERROR("%s: hal attach failed", __func__);
+		return status;
+	}
+
 	if (hif_bus_configure(scn)) {
 		HIF_ERROR("%s: Target probe failed.", __func__);
 		hif_disable_bus(scn);
@@ -914,6 +949,7 @@
 		uint32_t transfer_id, u_int32_t len, uint32_t sendhead)
 {
 	void *ce_tx_hdl = hif_get_ce_handle(osc, CE_HTT_TX_CE);
+
 	return ce_batch_send((struct CE_handle *)ce_tx_hdl, msdu, transfer_id,
 			len, sendhead);
 }
@@ -947,6 +983,7 @@
 		transfer_id, u_int32_t len)
 {
 	void *ce_tx_hdl = hif_get_ce_handle(osc, CE_HTT_TX_CE);
+
 	return ce_send_single((struct CE_handle *)ce_tx_hdl, msdu, transfer_id,
 			len);
 }
@@ -966,6 +1003,7 @@
 		uint32_t transfer_id, uint32_t download_len)
 {
 	void *ce_tx_hdl = hif_get_ce_handle(osc, CE_HTT_TX_CE);
+
 	return ce_send_fast((struct CE_handle *)ce_tx_hdl, nbuf,
 			transfer_id, download_len);
 }