rsi: Register interrupt handler before firmware load
authorPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Fri, 16 Jun 2017 14:35:38 +0000 (20:05 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 21 Jun 2017 15:26:25 +0000 (18:26 +0300)
Before firmware load, sometimes false interrupts are received.
System hang is observed if interrupt handler is not registered
to receive these interrupts. Hence interrupt handler registration
is moved before firmware load. We will drop these false interrupts
as these are not from the device.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_hal.c
drivers/net/wireless/rsi/rsi_91x_sdio.c
drivers/net/wireless/rsi/rsi_main.h

index 3d24e8ed74dfbd5bf78b5932902d48516e8ac1a5..94e074d8bd4f2cad35c08b6e60747500d95a9488 100644 (file)
@@ -733,6 +733,7 @@ int rsi_hal_device_init(struct rsi_hw *adapter)
        default:
                return -EINVAL;
        }
+       common->fsm_state = FSM_CARD_NOT_READY;
 
        return 0;
 }
index 2ef844adacf36886c0abb0160b60e863e00f8247..e5ea99bb2dd8294f211503a00137d9a70df270d7 100644 (file)
@@ -139,6 +139,8 @@ static void rsi_handle_interrupt(struct sdio_func *function)
 {
        struct rsi_hw *adapter = sdio_get_drvdata(function);
 
+       if (adapter->priv->fsm_state == FSM_FW_NOT_LOADED)
+               return;
        sdio_release_host(function);
        rsi_interrupt_handler(adapter);
        sdio_claim_host(function);
@@ -908,10 +910,19 @@ static int rsi_probe(struct sdio_func *pfunction,
                        __func__);
                goto fail;
        }
+       sdio_claim_host(pfunction);
+       if (sdio_claim_irq(pfunction, rsi_handle_interrupt)) {
+               rsi_dbg(ERR_ZONE, "%s: Failed to request IRQ\n", __func__);
+               sdio_release_host(pfunction);
+               goto fail;
+       }
+       sdio_release_host(pfunction);
+       rsi_dbg(INIT_ZONE, "%s: Registered Interrupt handler\n", __func__);
 
        if (rsi_hal_device_init(adapter)) {
                rsi_dbg(ERR_ZONE, "%s: Failed in device init\n", __func__);
                sdio_claim_host(pfunction);
+               sdio_release_irq(pfunction);
                sdio_disable_func(pfunction);
                sdio_release_host(pfunction);
                goto fail;
@@ -923,16 +934,6 @@ static int rsi_probe(struct sdio_func *pfunction,
                return -EIO;
        }
 
-       sdio_claim_host(pfunction);
-       if (sdio_claim_irq(pfunction, rsi_handle_interrupt)) {
-               rsi_dbg(ERR_ZONE, "%s: Failed to request IRQ\n", __func__);
-               sdio_release_host(pfunction);
-               goto fail;
-       }
-
-       sdio_release_host(pfunction);
-       rsi_dbg(INIT_ZONE, "%s: Registered Interrupt handler\n", __func__);
-
        return 0;
 fail:
        rsi_91x_deinit(adapter);
index 833c66f53480097f79fc03b82ca4cd0c6e644f98..74ae0ac113ee570a5385864593c531d0138a6cbb 100644 (file)
@@ -32,6 +32,7 @@
 #define ISR_ZONE                        BIT(8)  /* For Interrupt Msgs         */
 
 enum RSI_FSM_STATES {
+       FSM_FW_NOT_LOADED,
        FSM_CARD_NOT_READY,
        FSM_BOOT_PARAMS_SENT,
        FSM_EEPROM_READ_MAC_ADDR,