Browse Source

qcacmn: SDIO HIF Layer refactor

1. Modifications for SDIO HIF interface with stack.
 Mailbox based devices do not use the SDIO abstraction layer.
 So, devices like QCA6174, QCA9379 etc are to interface with
 the SDIO stack directly, even if the CNSS wrappers are used.
 ADMA based devices use the SDIO abstraction layer. So, devices
 like QCN7605 do not interface with the SDIO stack directly.

2. Remove redundant osdrv layer and refactor the functions
3. Propagate hif context to all the interface functions in hif
4. Remove duplicate hif object allocation (scn) in SDIO hif

Change-Id: I75cfe97b1ef913d1a3e6e556ec5eff796eb9f1d9
CRs-Fixed: 2271110
Sriram Madhvapathi 6 years ago
parent
commit
6615d89b58

+ 2 - 2
hif/inc/hif.h

@@ -405,8 +405,8 @@ uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset);
  */
 struct htc_callbacks {
 	void *context;
-	QDF_STATUS(*rwCompletionHandler)(void *rwContext, QDF_STATUS status);
-	QDF_STATUS(*dsrHandler)(void *context);
+	QDF_STATUS(*rw_compl_handler)(void *rw_ctx, QDF_STATUS status);
+	QDF_STATUS(*dsr_handler)(void *context);
 };
 
 /**

+ 7 - 39
hif/src/sdio/hif_bmi_reg_access.c

@@ -43,14 +43,15 @@ static uint32_t *p_bmi_cmd_credits = &command_credits;
  * Return: QDF_STATUS_SUCCESS for success.
  */
 static QDF_STATUS
-hif_bmi_buffer_send(struct hif_sdio_dev *device, char *buffer, uint32_t length)
+hif_bmi_buffer_send(struct hif_sdio_softc *scn, struct hif_sdio_dev *device,
+		    char *buffer, uint32_t length)
 {
 	QDF_STATUS status;
 	uint32_t timeout;
 	uint32_t address;
 	uint32_t mbox_address[HTC_MAILBOX_NUM_MAX];
 
-	hif_configure_device(device, HIF_DEVICE_GET_FIFO_ADDR,
+	hif_configure_device(NULL, device, HIF_DEVICE_GET_FIFO_ADDR,
 			     &mbox_address[0], sizeof(mbox_address));
 
 	*p_bmi_cmd_credits = 0;
@@ -169,14 +170,14 @@ hif_bmi_buffer_receive(struct hif_sdio_dev *device,
 		 * function to get pending events
 		 * do this only once!
 		 */
-		hif_configure_device(device,
+		hif_configure_device(NULL, device,
 				     HIF_DEVICE_GET_PENDING_EVENTS_FUNC,
 				     &get_pending_events_func,
 				     sizeof(get_pending_events_func));
 		pending_events_func_check = true;
 	}
 
-	hif_configure_device(device, HIF_DEVICE_GET_FIFO_ADDR,
+	hif_configure_device(NULL, device, HIF_DEVICE_GET_FIFO_ADDR,
 			     &mbox_address[0], sizeof(mbox_address));
 
 	/*
@@ -302,7 +303,7 @@ hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
 			("BMI Get Target Info: Enter (device: 0x%pK)\n",
 			device));
 	cid = BMI_GET_TARGET_INFO;
-	status = hif_bmi_buffer_send(device, (char *) &cid, sizeof(cid));
+	status = hif_bmi_buffer_send(scn, device, (char *)&cid, sizeof(cid));
 	if (status != QDF_STATUS_SUCCESS) {
 		AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 				("%s:Unable to write to the device\n",
@@ -410,7 +411,7 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	status = hif_bmi_buffer_send(device, send_message, length);
+	status = hif_bmi_buffer_send(scn, device, send_message, length);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 				("%s:Unable to Send Message to device\n",
@@ -433,39 +434,6 @@ QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *hif_ctx,
 	return status;
 }
 
-/**
- * hif_bmi_raw_write - API to handle bmi raw buffer
- * @device: hif context
- * @buffer: buffer
- * @length: length
- *
- * Return: QDF_STATUS_SUCCESS for success.
- */
-
-QDF_STATUS
-hif_bmi_raw_write(struct hif_sdio_dev *device, char *buffer,
-	      uint32_t length)
-{
-	return hif_bmi_buffer_send(device, buffer, length);
-}
-
-/**
- * hif_bmi_raw_read - call when bmi buffer is received
- * @device: hif context
- * @buffer: buffer
- * @length: length
- * @want_timeout: timeout is needed or not
- *
- * Return: QDF_STATUS_SUCCESS for success.
- */
-QDF_STATUS
-hif_bmi_raw_read(struct hif_sdio_dev *device, char *buffer,
-	     uint32_t length, bool want_timeout)
-{
-	return hif_bmi_buffer_receive(device, buffer, length,
-				  want_timeout);
-}
-
 #ifdef BRINGUP_DEBUG
 #define SDIO_SCRATCH_1_ADDRESS 0x864
 /*Functions used for debugging*/

+ 12 - 11
hif/src/sdio/hif_sdio_dev.c

@@ -73,7 +73,7 @@ HTC_PACKET *hif_dev_alloc_rx_buffer(struct hif_sdio_device *pdev)
 
 /**
  * hif_dev_create() - create hif device after probe.
- * @scn: HIF context
+ * @hif_device: HIF context
  * @callbacks: htc callbacks
  * @target: HIF target
  *
@@ -100,7 +100,7 @@ struct hif_sdio_device *hif_dev_create(struct hif_sdio_dev *hif_device,
 
 	pdev->HIFDevice = hif_device;
 	pdev->pTarget = target;
-	status = hif_configure_device(hif_device,
+	status = hif_configure_device(NULL, hif_device,
 				      HIF_DEVICE_SET_HTC_CONTEXT,
 				      (void *)pdev, sizeof(pdev));
 	if (status != QDF_STATUS_SUCCESS)
@@ -123,7 +123,7 @@ void hif_dev_destroy(struct hif_sdio_device *pdev)
 {
 	QDF_STATUS status;
 
-	status = hif_configure_device(pdev->HIFDevice,
+	status = hif_configure_device(NULL, pdev->HIFDevice,
 				      HIF_DEVICE_SET_HTC_CONTEXT,
 				      (void *)NULL, 0);
 	if (status != QDF_STATUS_SUCCESS)
@@ -144,9 +144,10 @@ struct hif_sdio_device *hif_dev_from_hif(struct hif_sdio_dev *hif_device)
 	struct hif_sdio_device *pdev = NULL;
 	QDF_STATUS status;
 
-	status = hif_configure_device(hif_device,
-				HIF_DEVICE_GET_HTC_CONTEXT,
-				(void **)&pdev, sizeof(struct hif_sdio_device));
+	status = hif_configure_device(NULL, hif_device,
+				      HIF_DEVICE_GET_HTC_CONTEXT,
+				      (void **)&pdev,
+				      sizeof(struct hif_sdio_device));
 	if (status != QDF_STATUS_SUCCESS)
 		HIF_ERROR("%s: set context failed", __func__);
 
@@ -358,7 +359,7 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
 	pdev->HifIRQProcessingMode = HIF_DEVICE_IRQ_ASYNC_SYNC;
 
 	/* see if the HIF layer overrides this assumption */
-	hif_configure_device(hif_device,
+	hif_configure_device(NULL, hif_device,
 			     HIF_DEVICE_GET_IRQ_PROC_MODE,
 			     &pdev->HifIRQProcessingMode,
 			     sizeof(pdev->HifIRQProcessingMode));
@@ -368,7 +369,7 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
 		AR_DEBUG_PRINTF(ATH_DEBUG_WARN,
 			("HIF Interrupt processing is SYNC ONLY\n"));
 		/* see if HIF layer wants HTC to yield */
-		hif_configure_device(hif_device,
+		hif_configure_device(NULL, hif_device,
 				     HIF_DEVICE_GET_IRQ_YIELD_PARAMS,
 				     &pdev->HifIRQYieldParams,
 				     sizeof(pdev->HifIRQYieldParams));
@@ -395,7 +396,7 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
 	/* see if the HIF layer implements the mask/unmask recv
 	 * events function
 	 */
-	hif_configure_device(hif_device,
+	hif_configure_device(NULL, hif_device,
 			     HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC,
 			     &pdev->HifMaskUmaskRecvEvent,
 			     sizeof(pdev->HifMaskUmaskRecvEvent));
@@ -404,8 +405,8 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
 
 	qdf_mem_zero(&htc_cbs, sizeof(struct htc_callbacks));
 	/* the device layer handles these */
-	htc_cbs.rwCompletionHandler = hif_dev_rw_completion_handler;
-	htc_cbs.dsrHandler = hif_dev_dsr_handler;
+	htc_cbs.rw_compl_handler = hif_dev_rw_completion_handler;
+	htc_cbs.dsr_handler = hif_dev_dsr_handler;
 	htc_cbs.context = pdev;
 	status = hif_attach_htc(pdev->HIFDevice, &htc_cbs);
 

+ 5 - 0
hif/src/sdio/hif_sdio_dev.h

@@ -69,4 +69,9 @@ void hif_dev_get_block_size(void *config);
 void hif_dev_set_mailbox_swap(struct hif_sdio_dev *pdev);
 
 bool hif_dev_get_mailbox_swap(struct hif_sdio_dev *pdev);
+
+int hif_sdio_set_drvdata(struct sdio_func *func,
+			 struct hif_sdio_dev *hifdevice);
+
+struct hif_sdio_dev *get_hif_device(struct sdio_func *func);
 #endif /* HIF_SDIO_DEV_H_ */

+ 10 - 296
hif/src/sdio/if_sdio.c

@@ -40,7 +40,6 @@
 #include <hif_debug.h>
 #include "target_type.h"
 #include "epping_main.h"
-#include "pld_sdio.h"
 #include "targaddrs.h"
 #include "sdio_api.h"
 #include <hif_sdio_dev.h>
@@ -60,257 +59,6 @@ struct ol_pl_os_dep_funcs *g_ol_pl_os_dep_funcs;
 #endif
 #define HIF_SDIO_LOAD_TIMEOUT 1000
 
-struct hif_sdio_softc *scn;
-struct hif_softc *ol_sc;
-static atomic_t hif_sdio_load_state;
-/* Wait queue for MC thread */
-wait_queue_head_t sync_wait_queue;
-
-/**
- * hif_sdio_probe() - configure sdio device
- * @context: sdio device context
- * @hif_handle: pointer to hif handle
- *
- * Return: 0 for success and non-zero for failure
- */
-static A_STATUS hif_sdio_probe(void *context, void *hif_handle)
-{
-	int ret = 0;
-	struct HIF_DEVICE_OS_DEVICE_INFO os_dev_info;
-	struct sdio_func *func = NULL;
-	const struct sdio_device_id *id;
-	uint32_t target_type;
-
-	HIF_ENTER();
-	scn = (struct hif_sdio_softc *)qdf_mem_malloc(sizeof(*scn));
-	if (!scn) {
-		ret = -ENOMEM;
-		goto err_alloc;
-	}
-
-	scn->hif_handle = hif_handle;
-	hif_configure_device(hif_handle, HIF_DEVICE_GET_OS_DEVICE,
-			     &os_dev_info,
-			     sizeof(os_dev_info));
-
-	scn->aps_osdev.device = os_dev_info.os_dev;
-	scn->aps_osdev.bc.bc_bustype = QDF_BUS_TYPE_SDIO;
-	spin_lock_init(&scn->target_lock);
-	ol_sc = qdf_mem_malloc(sizeof(*ol_sc));
-	if (!ol_sc) {
-		ret = -ENOMEM;
-		goto err_attach;
-	}
-	OS_MEMZERO(ol_sc, sizeof(*ol_sc));
-
-	{
-		/*
-		 * Attach Target register table. This is needed early on
-		 * even before BMI since PCI and HIF initialization
-		 * directly access Target registers.
-		 *
-		 * TBDXXX: targetdef should not be global -- should be stored
-		 * in per-device struct so that we can support multiple
-		 * different Target types with a single Host driver.
-		 * The whole notion of an "hif type" -- (not as in the hif
-		 * module, but generic "Host Interface Type") is bizarre.
-		 * At first, one one expect it to be things like SDIO, USB, PCI.
-		 * But instead, it's an actual platform type. Inexplicably, the
-		 * values used for HIF platform types are *different* from the
-		 * values used for Target Types.
-		 */
-
-#if defined(CONFIG_AR9888_SUPPORT)
-		hif_register_tbl_attach(ol_sc, HIF_TYPE_AR9888);
-		target_register_tbl_attach(ol_sc, TARGET_TYPE_AR9888);
-		target_type = TARGET_TYPE_AR9888;
-#elif defined(CONFIG_AR6320_SUPPORT)
-		id = ((struct hif_sdio_dev *) hif_handle)->id;
-		if (((id->device & MANUFACTURER_ID_AR6K_BASE_MASK) ==
-				MANUFACTURER_ID_QCA9377_BASE) ||
-			((id->device & MANUFACTURER_ID_AR6K_BASE_MASK) ==
-				MANUFACTURER_ID_QCA9379_BASE)) {
-			hif_register_tbl_attach(ol_sc, HIF_TYPE_AR6320V2);
-			target_register_tbl_attach(ol_sc, TARGET_TYPE_AR6320V2);
-		} else if ((id->device & MANUFACTURER_ID_AR6K_BASE_MASK) ==
-				MANUFACTURER_ID_AR6320_BASE) {
-			int ar6kid = id->device & MANUFACTURER_ID_AR6K_REV_MASK;
-
-			if (ar6kid >= 1) {
-				/* v2 or higher silicon */
-				hif_register_tbl_attach(ol_sc,
-					HIF_TYPE_AR6320V2);
-				target_register_tbl_attach(ol_sc,
-					  TARGET_TYPE_AR6320V2);
-			} else {
-				/* legacy v1 silicon */
-				hif_register_tbl_attach(ol_sc,
-					HIF_TYPE_AR6320);
-				target_register_tbl_attach(ol_sc,
-					  TARGET_TYPE_AR6320);
-			}
-		}
-		target_type = TARGET_TYPE_AR6320;
-
-#endif
-	}
-	func = ((struct hif_sdio_dev *) hif_handle)->func;
-	scn->targetdef =  ol_sc->targetdef;
-	scn->hostdef =  ol_sc->hostdef;
-	scn->aps_osdev.bdev = func;
-	ol_sc->bus_type = scn->aps_osdev.bc.bc_bustype;
-	scn->ol_sc = *ol_sc;
-	ol_sc->target_info.target_type = target_type;
-
-	scn->ramdump_base = pld_hif_sdio_get_virt_ramdump_mem(
-					scn->aps_osdev.device,
-					&scn->ramdump_size);
-	if (scn->ramdump_base == NULL || !scn->ramdump_size) {
-		QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_ERROR,
-			"%s: Failed to get RAM dump memory address or size!\n",
-			__func__);
-	} else {
-		QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO,
-			"%s: ramdump base 0x%pK size %d\n", __func__,
-			scn->ramdump_base, (int)scn->ramdump_size);
-	}
-
-	if (athdiag_procfs_init(scn) != 0) {
-		QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_ERROR,
-			  "%s athdiag_procfs_init failed", __func__);
-		ret = QDF_STATUS_E_FAILURE;
-		goto err_attach1;
-	}
-
-	atomic_set(&hif_sdio_load_state, true);
-	wake_up_interruptible(&sync_wait_queue);
-
-	return 0;
-
-err_attach1:
-	if (scn->ramdump_base)
-		pld_hif_sdio_release_ramdump_mem(scn->ramdump_base);
-	qdf_mem_free(ol_sc);
-err_attach:
-	qdf_mem_free(scn);
-	scn = NULL;
-err_alloc:
-	return ret;
-}
-
-/**
- * hif_sdio_remove() - remove sdio device
- * @conext: sdio device context
- * @hif_handle: pointer to sdio function
- *
- * Return: 0 for success and non-zero for failure
- */
-static A_STATUS hif_sdio_remove(void *context, void *hif_handle)
-{
-	HIF_ENTER();
-
-	if (!scn) {
-		QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_ERROR,
-			  "Global SDIO context is NULL");
-		return A_ERROR;
-	}
-
-	atomic_set(&hif_sdio_load_state, false);
-	athdiag_procfs_remove();
-
-#ifndef TARGET_DUMP_FOR_NON_QC_PLATFORM
-	iounmap(scn->ramdump_base);
-#endif
-
-	if (ol_sc) {
-		qdf_mem_free(ol_sc);
-		ol_sc = NULL;
-	}
-
-	if (scn) {
-		qdf_mem_free(scn);
-		scn = NULL;
-	}
-
-	HIF_EXIT();
-
-	return 0;
-}
-
-/**
- * hif_sdio_suspend() - sdio suspend routine
- * @context: sdio device context
- *
- * Return: 0 for success and non-zero for failure
- */
-static A_STATUS hif_sdio_suspend(void *context)
-{
-	return 0;
-}
-
-/**
- * hif_sdio_resume() - sdio resume routine
- * @context: sdio device context
- *
- * Return: 0 for success and non-zero for failure
- */
-static A_STATUS hif_sdio_resume(void *context)
-{
-	return 0;
-}
-
-/**
- * hif_sdio_power_change() - change power state of sdio bus
- * @conext: sdio device context
- * @config: power state configurartion
- *
- * Return: 0 for success and non-zero for failure
- */
-static A_STATUS hif_sdio_power_change(void *context, uint32_t config)
-{
-	return 0;
-}
-
-/*
- * Module glue.
- */
-#include <linux/version.h>
-static char *version = "HIF (Atheros/multi-bss)";
-static char *dev_info = "ath_hif_sdio";
-
-/**
- * init_ath_hif_sdio() - initialize hif sdio callbacks
- * @param: none
- *
- * Return: 0 for success and non-zero for failure
- */
-static int init_ath_hif_sdio(void)
-{
-	QDF_STATUS status;
-	struct osdrv_callbacks osdrv_callbacks;
-
-	HIF_ENTER();
-	qdf_mem_zero(&osdrv_callbacks, sizeof(osdrv_callbacks));
-	osdrv_callbacks.device_inserted_handler = hif_sdio_probe;
-	osdrv_callbacks.device_removed_handler = hif_sdio_remove;
-	osdrv_callbacks.device_suspend_handler = hif_sdio_suspend;
-	osdrv_callbacks.device_resume_handler = hif_sdio_resume;
-	osdrv_callbacks.device_power_change_handler = hif_sdio_power_change;
-
-	QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO, "%s %d", __func__,
-		  __LINE__);
-	status = hif_init(&osdrv_callbacks);
-	if (status != QDF_STATUS_SUCCESS) {
-		QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_FATAL,
-			  "%s hif_init failed!", __func__);
-		return -ENODEV;
-	}
-	QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_ERROR,
-		 "%s: %s\n", dev_info, version);
-
-	return 0;
-}
-
 /**
  * hif_sdio_bus_suspend() - suspend the bus
  *
@@ -325,8 +73,7 @@ int hif_sdio_bus_suspend(struct hif_softc *hif_ctx)
 	struct hif_sdio_dev *hif_device = scn->hif_handle;
 	struct device *dev = &hif_device->func->dev;
 
-	hif_device_suspend(dev);
-	return 0;
+	return hif_device_suspend(hif_ctx, dev);
 }
 
 
@@ -344,7 +91,7 @@ int hif_sdio_bus_resume(struct hif_softc *hif_ctx)
 	struct hif_sdio_dev *hif_device = scn->hif_handle;
 	struct device *dev = &hif_device->func->dev;
 
-	hif_device_resume(dev);
+	hif_device_resume(hif_ctx, dev);
 	return 0;
 }
 
@@ -364,15 +111,6 @@ void hif_enable_power_gating(void *hif_ctx)
  */
 void hif_sdio_close(struct hif_softc *hif_sc)
 {
-	if (ol_sc) {
-		qdf_mem_free(ol_sc);
-		ol_sc = NULL;
-	}
-
-	if (scn) {
-		qdf_mem_free(scn);
-		scn = NULL;
-	}
 }
 
 /**
@@ -385,12 +123,9 @@ void hif_sdio_close(struct hif_softc *hif_sc)
 QDF_STATUS hif_sdio_open(struct hif_softc *hif_sc,
 				   enum qdf_bus_type bus_type)
 {
-	QDF_STATUS status;
-
 	hif_sc->bus_type = bus_type;
-	status = init_ath_hif_sdio();
 
-	return status;
+	return QDF_STATUS_SUCCESS;
 }
 
 void hif_get_target_revision(struct hif_softc *ol_sc)
@@ -420,38 +155,18 @@ void hif_get_target_revision(struct hif_softc *ol_sc)
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS hif_sdio_enable_bus(struct hif_softc *hif_sc,
-		struct device *dev, void *bdev, const struct hif_bus_id *bid,
-		enum hif_enable_type type)
+QDF_STATUS hif_sdio_enable_bus(struct hif_softc *ol_sc, struct device *dev,
+			       void *bdev, const struct hif_bus_id *bid,
+			       enum hif_enable_type type)
 {
 	int ret = 0;
 	const struct sdio_device_id *id = (const struct sdio_device_id *)bid;
-	struct hif_sdio_softc *sc = HIF_GET_SDIO_SOFTC(hif_sc);
 
-	init_waitqueue_head(&sync_wait_queue);
-	if (hif_sdio_device_inserted(dev, id)) {
+	if (hif_sdio_device_inserted(ol_sc, dev, id)) {
 		HIF_ERROR("wlan: %s hif_sdio_device_inserted failed", __func__);
 		return QDF_STATUS_E_NOMEM;
 	}
 
-	wait_event_interruptible_timeout(sync_wait_queue,
-			  atomic_read(&hif_sdio_load_state) == true,
-			  HIF_SDIO_LOAD_TIMEOUT);
-	hif_sc->hostdef = ol_sc->hostdef;
-	hif_sc->targetdef = ol_sc->targetdef;
-	hif_sc->bus_type = ol_sc->bus_type;
-	hif_sc->target_info.target_type = ol_sc->target_info.target_type;
-
-	sc->hif_handle = scn->hif_handle;
-	sc->aps_osdev.device = scn->aps_osdev.device;
-	sc->aps_osdev.bc.bc_bustype = scn->aps_osdev.bc.bc_bustype;
-	sc->target_lock = scn->target_lock;
-	sc->targetdef = scn->targetdef;
-	sc->hostdef = scn->hostdef;
-	sc->aps_osdev.bdev = scn->aps_osdev.bdev;
-	sc->ramdump_size = scn->ramdump_size;
-	sc->ramdump_base = scn->ramdump_base;
-
 	return ret;
 }
 
@@ -464,8 +179,7 @@ QDF_STATUS hif_sdio_enable_bus(struct hif_softc *hif_sc,
  */
 void hif_sdio_disable_bus(struct hif_softc *hif_sc)
 {
-	struct hif_sdio_softc *sc = HIF_GET_SDIO_SOFTC(hif_sc);
-	struct sdio_func *func = sc->aps_osdev.bdev;
+	struct sdio_func *func = dev_to_sdio_func(hif_sc->qdf_dev->dev);
 
 	hif_sdio_device_removed(func);
 }
@@ -485,8 +199,8 @@ QDF_STATUS hif_sdio_get_config_item(struct hif_softc *hif_sc,
 	struct hif_sdio_softc *sc = HIF_GET_SDIO_SOFTC(hif_sc);
 	struct hif_sdio_dev *hif_device = sc->hif_handle;
 
-	return hif_configure_device(hif_device,
-				opcode, config, config_len);
+	return hif_configure_device(hif_sc, hif_device, opcode,
+				    config, config_len);
 }
 
 /**

+ 8 - 17
hif/src/sdio/if_sdio.h

@@ -26,6 +26,7 @@
 #include <ol_if_athvar.h>
 #include <athdefs.h>
 #include "a_osapi.h"
+#include "pld_sdio.h"
 #include "hif_internal.h"
 
 
@@ -39,10 +40,6 @@
 struct hif_sdio_softc {
 	struct hif_softc ol_sc;
 	struct device *dev;
-	struct _NIC_DEV aps_osdev;
-	struct tasklet_struct intr_tq;  /* tasklet */
-
-	int irq;
 	/*
 	 * Guard changes to Target HW state and to software
 	 * structures that track hardware state.
@@ -81,17 +78,18 @@ int ath_sdio_resume(void *context);
 void hif_init_qdf_ctx(qdf_device_t qdf_dev, void *ol_sc);
 void hif_deinit_qdf_ctx(void *ol_sc);
 
-int hif_sdio_device_inserted(struct device *dev,
-		const struct sdio_device_id *id);
+int hif_sdio_device_inserted(struct hif_softc *ol_sc,
+			     struct device *dev,
+			     const struct sdio_device_id *id);
 void hif_sdio_stop(struct hif_softc *hif_ctx);
 void hif_sdio_shutdown(struct hif_softc *hif_ctx);
 void hif_sdio_device_removed(struct sdio_func *func);
-int hif_device_suspend(struct device *dev);
-int hif_device_resume(struct device *dev);
+int hif_device_suspend(struct hif_softc *ol_sc, struct device *dev);
+int hif_device_resume(struct hif_softc *ol_sc, struct device *dev);
 void hif_register_tbl_attach(struct hif_softc *scn,
-						u32 hif_type);
+			     u32 hif_type);
 void target_register_tbl_attach(struct hif_softc *scn,
-						u32 target_type);
+				u32 target_type);
 void hif_enable_power_gating(void *hif_ctx);
 void hif_sdio_close(struct hif_softc *hif_sc);
 QDF_STATUS hif_sdio_open(struct hif_softc *hif_sc,
@@ -100,11 +98,4 @@ void hif_ar6k_fetch_target_regs(struct hif_sdio_dev *hif_device,
 				uint32_t *targregs);
 QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
 					 struct bmi_target_info *targ_info);
-QDF_STATUS
-hif_bmi_raw_write(struct hif_sdio_dev *device, char *buffer,
-		  uint32_t length);
-QDF_STATUS
-hif_bmi_raw_read(struct hif_sdio_dev *device, char *buffer,
-		 u32 length, bool want_timeout);
-
 #endif /* __IF_SDIO_H__ */

+ 63 - 24
hif/src/sdio/native_sdio/include/hif_internal.h

@@ -235,24 +235,6 @@ enum hif_device_irq_mode {
 	HIF_DEVICE_IRQ_ASYNC_SYNC,  /* DSR to process interrupts */
 };
 
-struct osdrv_callbacks {
-	void *context;
-	/* context to pass for all callbacks
-	 * except device_removed_handler
-	 * the device_removed_handler is only
-	 * called if the device is claimed
-	 */
-	int (*device_inserted_handler)(void *context, void *hif_handle);
-	int (*device_removed_handler)(void *claimed_ctx,
-				    void *hif_handle);
-	int (*device_suspend_handler)(void *context);
-	int (*device_resume_handler)(void *context);
-	int (*device_wakeup_handler)(void *context);
-	int (*device_power_change_handler)(void *context,
-					enum HIF_DEVICE_POWER_CHANGE_TYPE
-					config);
-};
-
 /* other interrupts are pending, host
  * needs to read the to monitor
  */
@@ -280,11 +262,10 @@ typedef int (*HIF_MASK_UNMASK_RECV_EVENT)(struct hif_sdio_dev *device,
 					  bool mask,
 					  void *async_context);
 
-QDF_STATUS hif_configure_device(struct hif_sdio_dev *device,
-			enum hif_device_config_opcode opcode,
-			void *config, uint32_t config_len);
-
-QDF_STATUS hif_init(struct osdrv_callbacks *callbacks);
+QDF_STATUS hif_configure_device(struct hif_softc *ol_sc,
+				struct hif_sdio_dev *device,
+				enum hif_device_config_opcode opcode,
+				void *config, uint32_t config_len);
 
 QDF_STATUS hif_attach_htc(struct hif_sdio_dev *device,
 			  struct htc_callbacks *callbacks);
@@ -300,7 +281,7 @@ void hif_mask_interrupt(struct hif_sdio_dev *device);
 
 void hif_un_mask_interrupt(struct hif_sdio_dev *device);
 
-QDF_STATUS hif_wait_for_pending_recv(struct hif_sdio_dev *device);
+void hif_sdio_configure_pipes(struct hif_sdio_dev *dev, struct sdio_func *func);
 
 struct _HIF_SCATTER_ITEM {
 	u_int8_t     *buffer; /* CPU accessible address of buffer */
@@ -423,6 +404,14 @@ void hif_sdio_quirk_force_drive_strength(struct sdio_func *func);
 void hif_sdio_quirk_write_cccr(struct sdio_func *func);
 int hif_sdio_quirk_mod_strength(struct sdio_func *func);
 int hif_sdio_quirk_async_intr(struct sdio_func *func);
+int hif_sdio_set_bus_speed(struct sdio_func *func);
+int hif_sdio_set_bus_width(struct sdio_func *func);
+int hif_sdio_func_enable(struct hif_sdio_dev *device,
+			 struct sdio_func *func);
+QDF_STATUS hif_sdio_func_disable(struct hif_sdio_dev *device,
+				 struct sdio_func *func,
+				 bool reset);
+QDF_STATUS reinit_sdio(struct hif_sdio_dev *device);
 
 int func0_cmd52_write_byte(struct mmc_card *card,
 			   unsigned int address,
@@ -431,5 +420,55 @@ int func0_cmd52_write_byte(struct mmc_card *card,
 int func0_cmd52_read_byte(struct mmc_card *card,
 			  unsigned int address,
 			  unsigned char *byte);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
+/**
+ * sdio_card_highspeed() - check if high speed supported
+ * @card: pointer to mmc card struct
+ *
+ * Return: non zero if card supports high speed.
+ */
+static inline int sdio_card_highspeed(struct mmc_card *card)
+{
+	return mmc_card_highspeed(card);
+}
+#else
+static inline int sdio_card_highspeed(struct mmc_card *card)
+{
+	return mmc_card_hs(card);
+}
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
+/**
+ * sdio_card_set_highspeed() - set high speed
+ * @card: pointer to mmc card struct
+ *
+ * Return: none.
+ */
+static inline void sdio_card_set_highspeed(struct mmc_card *card)
+{
+	mmc_card_set_highspeed(card);
+}
+#else
+static inline void sdio_card_set_highspeed(struct mmc_card *card)
+{
+}
+#endif
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
+/**
+ * sdio_card_state() - set card state
+ * @card: pointer to mmc card struct
+ *
+ * Return: none.
+ */
+static inline void sdio_card_state(struct mmc_card *card)
+{
+	card->state &= ~MMC_STATE_HIGHSPEED;
+}
+#else
+static inline void sdio_card_state(struct mmc_card *card)
+{
+}
+#endif
 #endif /* _HIF_INTERNAL_H_ */

+ 433 - 0
hif/src/sdio/native_sdio/src/dev_quirks.c

@@ -66,6 +66,16 @@ unsigned int modstrength;
 module_param(modstrength, uint, 0644);
 MODULE_PARM_DESC(modstrength, "Adjust internal driver strength");
 
+unsigned int mmcbuswidth;
+/* PERM:S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH */
+module_param(mmcbuswidth, uint, 0644);
+MODULE_PARM_DESC(mmcbuswidth,
+		 "Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit");
+
+unsigned int mmcclock;
+module_param(mmcclock, uint, 0644);
+MODULE_PARM_DESC(mmcclock, "Set MMC driver Clock value");
+
 #ifdef CONFIG_X86
 unsigned int asyncintdelay = 2;
 module_param(asyncintdelay, uint, 0644);
@@ -76,6 +86,11 @@ module_param(asyncintdelay, uint, 0644);
 MODULE_PARM_DESC(asyncintdelay,	"Delay clock count for async interrupt, 0 is default, valid values are 1 and 2");
 #endif
 
+unsigned int brokenirq;
+module_param(brokenirq, uint, 0644);
+MODULE_PARM_DESC(brokenirq,
+		 "Set as 1 to use polling method instead of interrupt mode");
+
 /**
  * hif_sdio_force_drive_strength() - Set SDIO drive strength
  * @func: pointer to sdio_func
@@ -347,3 +362,421 @@ int hif_sdio_quirk_async_intr(struct sdio_func *func)
 
 	return ret;
 }
+
+#if KERNEL_VERSION(3, 4, 0) <= LINUX_VERSION_CODE
+#ifdef SDIO_BUS_WIDTH_8BIT
+static int hif_cmd52_write_byte_8bit(struct sdio_func *func)
+{
+	return func0_cmd52_write_byte(func->card, SDIO_CCCR_IF,
+			SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_8BIT);
+}
+#else
+static int hif_cmd52_write_byte_8bit(struct sdio_func *func)
+{
+	HIF_ERROR("%s: 8BIT Bus Width not supported\n", __func__);
+	return QDF_STATUS_E_FAILURE;
+}
+#endif
+#endif
+
+/**
+ * hif_sdio_set_bus_speed() - Set the sdio bus speed
+ * @func: pointer to sdio_func
+ *
+ * Return: 0 on success, error number otherwise.
+ */
+int hif_sdio_set_bus_speed(struct sdio_func *func)
+{
+	uint32_t clock, clock_set = 12500000;
+	struct hif_sdio_dev *device = get_hif_device(func);
+	uint16_t manfid;
+
+	manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
+
+	if (manfid == MANUFACTURER_ID_QCN7605_BASE)
+		return 0;
+
+	if (mmcclock > 0)
+		clock_set = mmcclock;
+#if (KERNEL_VERSION(3, 16, 0) > LINUX_VERSION_CODE)
+	if (sdio_card_highspeed(func->card))
+#else
+		if (mmc_card_hs(func->card))
+#endif
+			clock = 50000000;
+		else
+			clock = func->card->cis.max_dtr;
+
+	if (clock > device->host->f_max)
+		clock = device->host->f_max;
+
+	HIF_INFO("%s: Clock setting: (%d,%d)\n", __func__,
+		 func->card->cis.max_dtr, device->host->f_max);
+
+	/* Limit clock if specified */
+	if (mmcclock > 0) {
+		HIF_INFO("%s: Limit clock from %d to %d\n",
+			 __func__, clock, clock_set);
+		device->host->ios.clock = clock_set;
+		device->host->ops->set_ios(device->host,
+				&device->host->ios);
+	}
+
+	return 0;
+}
+
+/**
+ * hif_set_bus_width() - Set the sdio bus width
+ * @func: pointer to sdio_func
+ *
+ * Return: 0 on success, error number otherwise.
+ */
+int hif_sdio_set_bus_width(struct sdio_func *func)
+{
+	int ret = 0;
+	uint16_t manfid;
+	uint8_t data = 0;
+	struct hif_sdio_dev *device = get_hif_device(func);
+
+	manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
+
+	if (manfid == MANUFACTURER_ID_QCN7605_BASE)
+		return ret;
+
+#if KERNEL_VERSION(3, 4, 0) <= LINUX_VERSION_CODE
+	if (mmcbuswidth == 0)
+		return ret;
+
+	/* Set MMC Bus Width: 1-1Bit, 4-4Bit, 8-8Bit */
+	if (mmcbuswidth == 1) {
+		data = SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_1BIT;
+		ret = func0_cmd52_write_byte(func->card,
+					     SDIO_CCCR_IF,
+					     data);
+		if (ret)
+			HIF_ERROR("%s: Bus Width 0x%x failed %d\n",
+				  __func__, data, ret);
+		device->host->ios.bus_width = MMC_BUS_WIDTH_1;
+		device->host->ops->set_ios(device->host,
+					   &device->host->ios);
+	} else if (mmcbuswidth == 4 &&
+		   (device->host->caps & MMC_CAP_4_BIT_DATA)) {
+		data = SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_4BIT;
+		ret = func0_cmd52_write_byte(func->card,
+					     SDIO_CCCR_IF,
+					     data);
+		if (ret)
+			HIF_ERROR("%s: Bus Width 0x%x failed: %d\n",
+				  __func__, data, ret);
+		device->host->ios.bus_width = MMC_BUS_WIDTH_4;
+		device->host->ops->set_ios(device->host,
+				&device->host->ios);
+	} else if (mmcbuswidth == 8 &&
+		   (device->host->caps & MMC_CAP_8_BIT_DATA)) {
+		ret = hif_cmd52_write_byte_8bit(func);
+		if (ret)
+			HIF_ERROR("%s: Bus Width 8 failed: %d\n",
+				  __func__, ret);
+		device->host->ios.bus_width = MMC_BUS_WIDTH_8;
+		device->host->ops->set_ios(device->host,
+				&device->host->ios);
+	} else {
+		HIF_ERROR("%s: Unsupported bus width %d",
+			  __func__, mmcbuswidth);
+		ret = QDF_STATUS_E_FAILURE;
+	}
+
+	HIF_INFO("%s: Bus with : %d\n",  __func__, mmcbuswidth);
+#endif
+	return ret;
+}
+
+/**
+ * hif_sdio_func_enable() - Handle device enabling as per device
+ * @device: HIF device object
+ * @func: function pointer
+ *
+ * Return success or failure
+ */
+int hif_sdio_func_enable(struct hif_sdio_dev *device,
+			 struct sdio_func *func)
+{
+	uint16_t manfid;
+
+	manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
+
+	if (manfid == MANUFACTURER_ID_QCN7605_BASE)
+		return 0;
+
+	if (device->is_disabled) {
+		int ret = 0;
+
+		sdio_claim_host(func);
+
+		ret = hif_sdio_quirk_async_intr(func);
+		if (ret) {
+			HIF_ERROR("%s: Error setting async intr:%d",
+				  __func__, ret);
+			sdio_release_host(func);
+			return QDF_STATUS_E_FAILURE;
+		}
+
+		func->enable_timeout = 100;
+		ret = sdio_enable_func(func);
+		if (ret) {
+			HIF_ERROR("%s: Unable to enable function: %d",
+				  __func__, ret);
+			sdio_release_host(func);
+			return QDF_STATUS_E_FAILURE;
+		}
+
+		ret = sdio_set_block_size(func, HIF_BLOCK_SIZE);
+		if (ret) {
+			HIF_ERROR("%s: Unable to set block size 0x%X : %d\n",
+				  __func__, HIF_BLOCK_SIZE, ret);
+			sdio_release_host(func);
+			return QDF_STATUS_E_FAILURE;
+		}
+
+		ret = hif_sdio_quirk_mod_strength(func);
+		if (ret) {
+			HIF_ERROR("%s: Error setting mod strength : %d\n",
+				  __func__, ret);
+			sdio_release_host(func);
+			return QDF_STATUS_E_FAILURE;
+		}
+
+		sdio_release_host(func);
+	}
+
+	return 0;
+}
+
+/**
+ * hif_mask_interrupt() - Disable hif device irq
+ * @device: pointer to struct hif_sdio_dev
+ *
+ *
+ * Return: None.
+ */
+void hif_mask_interrupt(struct hif_sdio_dev *device)
+{
+	int ret;
+	uint16_t manfid;
+
+	manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
+
+	if (manfid == MANUFACTURER_ID_QCN7605_BASE)
+		return;
+
+	HIF_ENTER();
+
+	/* Mask our function IRQ */
+	sdio_claim_host(device->func);
+	while (atomic_read(&device->irq_handling)) {
+		sdio_release_host(device->func);
+		schedule_timeout_interruptible(HZ / 10);
+		sdio_claim_host(device->func);
+	}
+	ret = sdio_release_irq(device->func);
+	sdio_release_host(device->func);
+	if (ret)
+		HIF_ERROR("%s: Failed %d\n", __func__, ret);
+
+	HIF_EXIT();
+}
+
+/**
+ * hif_irq_handler() - hif-sdio interrupt handler
+ * @func: pointer to sdio_func
+ *
+ * Return: None.
+ */
+static void hif_irq_handler(struct sdio_func *func)
+{
+	struct hif_sdio_dev *device;
+
+	HIF_ENTER();
+
+	device = get_hif_device(func);
+	atomic_set(&device->irq_handling, 1);
+	/* release the host during intr so we can use
+	 * it when we process cmds
+	 */
+	sdio_release_host(device->func);
+	device->htc_callbacks.dsr_handler(device->htc_callbacks.context);
+	sdio_claim_host(device->func);
+	atomic_set(&device->irq_handling, 0);
+
+	HIF_EXIT();
+}
+
+/**
+ * hif_un_mask_interrupt() - Re-enable hif device irq
+ * @device: pointer to struct hif_sdio_dev
+ *
+ *
+ * Return: None.
+ */
+void hif_un_mask_interrupt(struct hif_sdio_dev *device)
+{
+	int ret;
+	uint16_t manfid;
+
+	manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
+
+	if (manfid == MANUFACTURER_ID_QCN7605_BASE)
+		return;
+
+	HIF_ENTER();
+	/*
+	 * On HP Elitebook 8460P, interrupt mode is not stable
+	 * in high throughput, so polling method should be used
+	 * instead of interrupt mode.
+	 */
+	if (brokenirq) {
+		HIF_INFO("%s: Using broken IRQ mode", __func__);
+		device->func->card->host->caps &= ~MMC_CAP_SDIO_IRQ;
+	}
+	/* Register the IRQ Handler */
+	sdio_claim_host(device->func);
+	ret = sdio_claim_irq(device->func, hif_irq_handler);
+	sdio_release_host(device->func);
+
+	HIF_EXIT();
+}
+
+/**
+ * hif_sdio_func_disable() - Handle device enabling as per device
+ * @device: HIF device object
+ * @func: function pointer
+ *
+ * Return success or failure
+ */
+QDF_STATUS hif_sdio_func_disable(struct hif_sdio_dev *device,
+				 struct sdio_func *func,
+				 bool reset)
+{
+	int ret = 0;
+	uint16_t manfid;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+
+	manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
+
+	if (manfid == MANUFACTURER_ID_QCN7605_BASE)
+		return 0;
+
+	/* Disable the card */
+	sdio_claim_host(device->func);
+
+	ret = sdio_disable_func(device->func);
+	if (ret)
+		status = QDF_STATUS_E_FAILURE;
+
+	if (reset && status == QDF_STATUS_SUCCESS)
+		ret = func0_cmd52_write_byte(device->func->card,
+					     SDIO_CCCR_ABORT,
+					     (1 << 3));
+
+	if (ret) {
+		status = QDF_STATUS_E_FAILURE;
+		HIF_ERROR("%s: reset failed : %d", __func__, ret);
+	}
+
+	sdio_release_host(device->func);
+
+	return status;
+}
+
+/**
+ * reinit_sdio() - re-initialize sdio bus
+ * @device: pointer to hif device
+ *
+ * Return: 0 on success, error number otherwise.
+ */
+QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
+{
+	int32_t err = 0;
+	struct mmc_host *host;
+	struct mmc_card *card;
+	struct sdio_func *func;
+	uint8_t  cmd52_resp;
+	uint32_t clock;
+	uint16_t manfid;
+
+	func = device->func;
+	card = func->card;
+	host = card->host;
+
+	manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
+
+	if (manfid == MANUFACTURER_ID_QCN7605_BASE)
+		return 0;
+
+	sdio_claim_host(func);
+
+	do {
+		/* Enable high speed */
+		if (card->host->caps & MMC_CAP_SD_HIGHSPEED) {
+			HIF_INFO_HI("%s: Set high speed mode", __func__);
+			err = func0_cmd52_read_byte(card, SDIO_CCCR_SPEED,
+						    &cmd52_resp);
+			if (err) {
+				HIF_ERROR("%s: CCCR speed set failed  : %d",
+					  __func__, err);
+				sdio_card_state(card);
+				/* no need to break */
+			} else {
+				err = func0_cmd52_write_byte(card,
+							     SDIO_CCCR_SPEED,
+							     (cmd52_resp |
+							      SDIO_SPEED_EHS));
+				if (err) {
+					HIF_ERROR("%s:CCCR speed set failed:%d",
+						  __func__, err);
+					break;
+				}
+				sdio_card_set_highspeed(card);
+				host->ios.timing = MMC_TIMING_SD_HS;
+				host->ops->set_ios(host, &host->ios);
+			}
+		}
+
+		/* Set clock */
+		if (sdio_card_highspeed(card))
+			clock = 50000000;
+		else
+			clock = card->cis.max_dtr;
+
+		if (clock > host->f_max)
+			clock = host->f_max;
+		/*
+		 * In fpga mode the clk should be set to 12500000,
+		 * or will result in scan channel setting timeout error.
+		 * So in fpga mode, please set module parameter mmcclock
+		 * to 12500000.
+		 */
+		if (mmcclock > 0)
+			clock = mmcclock;
+		host->ios.clock = clock;
+		host->ops->set_ios(host, &host->ios);
+
+		if (card->host->caps & MMC_CAP_4_BIT_DATA) {
+			/* Set bus width & disable card detect resistor */
+			err = func0_cmd52_write_byte(card, SDIO_CCCR_IF,
+						     SDIO_BUS_CD_DISABLE |
+						     SDIO_BUS_WIDTH_4BIT);
+			if (err) {
+				HIF_ERROR("%s: Set bus mode failed : %d",
+					  __func__, err);
+				break;
+			}
+			host->ios.bus_width = MMC_BUS_WIDTH_4;
+			host->ops->set_ios(host, &host->ios);
+		}
+	} while (0);
+
+	sdio_release_host(func);
+
+	return (err) ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS;
+}

File diff suppressed because it is too large
+ 198 - 713
hif/src/sdio/native_sdio/src/hif.c


+ 33 - 3
hif/src/sdio/transfer/mailbox.c

@@ -277,7 +277,7 @@ int hif_dev_setup_device(struct hif_sdio_device *pdev)
 	int status = 0;
 	uint32_t blocksizes[MAILBOX_COUNT];
 
-	status = hif_configure_device(pdev->HIFDevice,
+	status = hif_configure_device(NULL, pdev->HIFDevice,
 				      HIF_DEVICE_GET_FIFO_ADDR,
 				      &pdev->MailBoxInfo,
 				      sizeof(pdev->MailBoxInfo));
@@ -285,7 +285,7 @@ int hif_dev_setup_device(struct hif_sdio_device *pdev)
 	if (status != QDF_STATUS_SUCCESS)
 		HIF_ERROR("%s: HIF_DEVICE_GET_MBOX_ADDR failed", __func__);
 
-	status = hif_configure_device(pdev->HIFDevice,
+	status = hif_configure_device(NULL, pdev->HIFDevice,
 				      HIF_DEVICE_GET_BLOCK_SIZE,
 				      blocksizes, sizeof(blocksizes));
 	if (status != QDF_STATUS_SUCCESS)
@@ -519,7 +519,7 @@ void hif_fixup_write_param(struct hif_sdio_dev *pdev, uint32_t req,
 	struct hif_device_mbox_info mboxinfo;
 	uint32_t taddr = *addr, mboxlen = 0;
 
-	hif_configure_device(pdev, HIF_DEVICE_GET_FIFO_ADDR,
+	hif_configure_device(NULL, pdev, HIF_DEVICE_GET_FIFO_ADDR,
 			     &mboxinfo, sizeof(mboxinfo));
 
 	if (taddr >= 0x800 && taddr < 0xC00) {
@@ -1320,4 +1320,34 @@ QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
 
 	return status;
 }
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)) && \
+		 !defined(WITH_BACKPORTS)
+/**
+ * hif_sdio_set_drvdata() - set wlan driver data into upper layer private
+ * @func: pointer to sdio function
+ * @hifdevice: pointer to hif device
+ *
+ * Return: non zero for success.
+ */
+int hif_sdio_set_drvdata(struct sdio_func *func,
+			 struct hif_sdio_dev *hifdevice)
+{
+	return sdio_set_drvdata(func, hifdevice);
+}
+#else
+int hif_sdio_set_drvdata(struct sdio_func *func,
+			 struct hif_sdio_dev *hifdevice)
+{
+	sdio_set_drvdata(func, hifdevice);
+	return 0;
+}
+#endif /* LINUX VERSION */
+
+struct hif_sdio_dev *get_hif_device(struct sdio_func *func)
+{
+	qdf_assert(func != NULL);
+
+	return (struct hif_sdio_dev *)sdio_get_drvdata(func);
+}
 #endif /* CONFIG_SDIO_TRANSFER_MAILBOX */

Some files were not shown because too many files changed in this diff