From 8832b23b20e3d60a5ce93b0c35e529e2df286811 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Date: Mon, 5 Mar 2012 19:32:29 +0530 Subject: [PATCH] WLAN: WCN1314: Add API to enable/disable interrupts from chip. Add an API to enable/disable interrupts from the chip. This API uses func0 SDIO_CCCR_IENx register to enable/disable interrupts from the chip. Change-Id: I2da8d569511aeff0409744a90e7daf4704fff91d Signed-off-by: Pavan kumar --- drivers/net/wireless/libra/libra_sdioif.c | 33 +++++++++++++++++++++++ include/linux/libra_sdioif.h | 1 + 2 files changed, 34 insertions(+) diff --git a/drivers/net/wireless/libra/libra_sdioif.c b/drivers/net/wireless/libra/libra_sdioif.c index 3955642de81..3421f8444d7 100644 --- a/drivers/net/wireless/libra/libra_sdioif.c +++ b/drivers/net/wireless/libra/libra_sdioif.c @@ -29,6 +29,37 @@ static unsigned short libra_sdio_card_id; static suspend_handler_t *libra_suspend_hldr; static resume_handler_t *libra_resume_hldr; +int libra_enable_sdio_irq_in_chip(struct sdio_func *func, u8 enable) +{ + unsigned char reg = 0; + int err = 0; + + sdio_claim_host(func); + + /* Read the value into reg */ + libra_sdiocmd52(func, SDIO_CCCR_IENx, ®, 0, &err); + if (err) + printk(KERN_ERR "%s: Could not read SDIO_CCCR_IENx register " + "err=%d\n", __func__, err); + + if (libra_mmc_host) { + if (enable) { + reg |= 1 << func->num; + reg |= 1; + } else { + reg &= ~(1 << func->num); + } + libra_sdiocmd52(func, SDIO_CCCR_IENx, ®, 1, &err); + if (err) + printk(KERN_ERR "%s: Could not enable/disable irq " + "err=%d\n", __func__, err); + } + sdio_release_host(func); + + return err; +} +EXPORT_SYMBOL(libra_enable_sdio_irq_in_chip); + /** * libra_sdio_configure() - Function to configure the SDIO device param * @libra_sdio_rxhandler Rx handler @@ -89,6 +120,8 @@ int libra_sdio_configure(sdio_irq_handler_t libra_sdio_rxhandler, goto cfg_error; } + libra_enable_sdio_irq_in_chip(func, 0); + sdio_release_host(func); return 0; diff --git a/include/linux/libra_sdioif.h b/include/linux/libra_sdioif.h index 965e2b511c5..08be83a8c23 100644 --- a/include/linux/libra_sdioif.h +++ b/include/linux/libra_sdioif.h @@ -35,6 +35,7 @@ typedef int (suspend_handler_t)(struct sdio_func *); typedef void (resume_handler_t)(struct sdio_func *); +int libra_enable_sdio_irq_in_chip(struct sdio_func *func, u8 enable); int libra_sdio_configure(sdio_irq_handler_t libra_sdio_rxhandler, void (*func_drv_fn)(int *status), u32 funcdrv_timeout, u32 blksize);