qcacmn: Compilation fixes for AP135 platform

1. AP135 platform uses 3.4.104 kernel. Fixed API names for the kernel.
2. Implicit declaration function errors fixed.
3. Stack frame size exceed error fixed for hif_dump_ce_registers function.
4. BIG Endian #define fixed.

Change-Id: I761762f6e51c0890e672f76817a911ade7126dd5
Acked-by:  Venkateswara Swamy Bandaru <vbandaru@codeaurora.org>
CRs-Fixed: 1040617
diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c
index 60ff556..7fd2b1c 100644
--- a/hif/src/ce/ce_main.c
+++ b/hif/src/ce/ce_main.c
@@ -2736,7 +2736,7 @@
 {
 	struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn);
 	uint32_t ce_reg_address = CE0_BASE_ADDRESS;
-	uint32_t ce_reg_values[CE_COUNT_MAX][CE_USEFUL_SIZE >> 2];
+	uint32_t ce_reg_values[CE_USEFUL_SIZE >> 2];
 	uint32_t ce_reg_word_size = CE_USEFUL_SIZE >> 2;
 	uint16_t i;
 	QDF_STATUS status;
@@ -2748,7 +2748,7 @@
 		}
 
 		status = hif_diag_read_mem(hif_hdl, ce_reg_address,
-					   (uint8_t *) &ce_reg_values[i][0],
+					   (uint8_t *) &ce_reg_values[0],
 					   ce_reg_word_size * sizeof(uint32_t));
 
 		if (status != QDF_STATUS_SUCCESS) {
@@ -2757,7 +2757,7 @@
 		}
 		HIF_ERROR("CE%d Registers:", i);
 		qdf_trace_hex_dump(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_DEBUG,
-				   (uint8_t *) &ce_reg_values[i][0],
+				   (uint8_t *) &ce_reg_values[0],
 				   ce_reg_word_size * sizeof(uint32_t));
 	}
 	return 0;
diff --git a/hif/src/ce/ce_reg.h b/hif/src/ce/ce_reg.h
index 9651f75..297e88f 100644
--- a/hif/src/ce/ce_reg.h
+++ b/hif/src/ce/ce_reg.h
@@ -351,14 +351,14 @@
 
 #define CE_SRC_RING_BYTE_SWAP_SET(scn, CE_ctrl_addr, n) \
 	A_TARGET_WRITE(scn, (CE_ctrl_addr) + CE_CTRL1_ADDRESS, \
-		       (A_TARGET_READ((targid), \
+		       (A_TARGET_READ(scn, \
 		       (CE_ctrl_addr) + CE_CTRL1_ADDRESS) \
 		       & ~CE_CTRL1_SRC_RING_BYTE_SWAP_EN_MASK) | \
 		       CE_CTRL1_SRC_RING_BYTE_SWAP_EN_SET(n))
 
 #define CE_DEST_RING_BYTE_SWAP_SET(scn, CE_ctrl_addr, n) \
 	A_TARGET_WRITE(scn, (CE_ctrl_addr)+CE_CTRL1_ADDRESS, \
-		       (A_TARGET_READ((targid), \
+		       (A_TARGET_READ(scn, \
 		       (CE_ctrl_addr) + CE_CTRL1_ADDRESS) \
 		       & ~CE_CTRL1_DST_RING_BYTE_SWAP_EN_MASK) | \
 		       CE_CTRL1_DST_RING_BYTE_SWAP_EN_SET(n))
diff --git a/hif/src/snoc/if_ahb.c b/hif/src/snoc/if_ahb.c
index 362584f..dc60778 100644
--- a/hif/src/snoc/if_ahb.c
+++ b/hif/src/snoc/if_ahb.c
@@ -298,7 +298,11 @@
 		goto err_cleanup1;
 	}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
 	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
+#else
+	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+#endif
 	if (ret) {
 		HIF_ERROR("%s: failed to set dma mask error = %d",
 				__func__, ret);
@@ -306,7 +310,11 @@
 	}
 
 	/* Arrange for access to Target SoC registers. */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
 	mem = devm_ioremap_resource(&pdev->dev, memres);
+#else
+	mem = devm_request_and_ioremap(&pdev->dev, memres);
+#endif
 	if (IS_ERR(mem)) {
 		HIF_INFO("ath: ioremap error\n");
 		ret = PTR_ERR(mem);
diff --git a/hif/src/snoc/if_ahb_reset.c b/hif/src/snoc/if_ahb_reset.c
index 5cb1040..6901f42 100644
--- a/hif/src/snoc/if_ahb_reset.c
+++ b/hif/src/snoc/if_ahb_reset.c
@@ -32,11 +32,13 @@
 #include "if_ahb.h"
 
 #include <linux/clk.h>
-#include <linux/reset.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/device.h>
 #include <linux/of.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+#include <linux/reset.h>
+#endif
 
 /**
  * clk_enable_disable() -  Enable/disable clock
@@ -115,6 +117,7 @@
  *
  * Return : zero on success, non-zero incase of error.
  */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
 int hif_ahb_enable_radio(struct hif_pci_softc *sc,
 		struct platform_device *pdev,
 		const struct platform_device_id *id)
@@ -237,8 +240,17 @@
 
 err_reset:
 	return -EIO;
-
 }
+#else
+int hif_ahb_enable_radio(struct hif_pci_softc *sc,
+		struct platform_device *pdev,
+		const struct platform_device_id *id)
+{
+	qdf_print("%s:%d:Reset routines not available in kernel version.\n",
+		  __func__, __LINE__);
+	return -EIO;
+}
+#endif
 
 /* "wifi_core_warm" is the other reset type */
 #define AHB_RESET_TYPE "wifi_core_cold"
@@ -252,6 +264,7 @@
  *
  * Return : n/a.
  */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
 void hif_ahb_device_reset(struct hif_softc *scn)
 {
 	struct reset_control *resetctl = NULL;
@@ -367,6 +380,13 @@
 	iounmap(mem_tcsr);
 	HIF_INFO("Reset complete for wifi core id : %d\n", wifi_core_id);
 }
+#else
+void hif_ahb_device_reset(struct hif_softc *scn)
+{
+	qdf_print("%s:%d:Reset routines not available in kernel version.\n",
+		  __func__, __LINE__);
+}
+#endif
 
 
 
diff --git a/hif/src/snoc/if_snoc.c b/hif/src/snoc/if_snoc.c
index e022725..df7937f 100644
--- a/hif/src/snoc/if_snoc.c
+++ b/hif/src/snoc/if_snoc.c
@@ -220,7 +220,11 @@
 	int ret;
 	int hif_type;
 	int target_type;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
 	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(37));
+#else
+	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(37));
+#endif
 	if (ret) {
 		HIF_ERROR("%s: failed to set dma mask error = %d",
 				__func__, ret);