wil6210: add support for platform specific notification events
authorMaya Erez <qca_merez@qca.qualcomm.com>
Tue, 1 Mar 2016 17:18:11 +0000 (19:18 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Mon, 7 Mar 2016 09:43:20 +0000 (11:43 +0200)
Add the ability to notify the platform driver on different
events, such as FW crash, pre reset and FW ready.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/wil6210/interrupt.c
drivers/net/wireless/ath/wil6210/main.c
drivers/net/wireless/ath/wil6210/wil_platform.h

index 4f2ffa5c6e1735c108e6ab4cdc05e59211dc9b9e..ae902958bf552bceae7055747c2e5e845da83f88 100644 (file)
@@ -394,9 +394,10 @@ static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie)
                wil_fw_core_dump(wil);
                wil_notify_fw_error(wil);
                isr &= ~ISR_MISC_FW_ERROR;
-               if (wil->platform_ops.notify_crash) {
+               if (wil->platform_ops.notify) {
                        wil_err(wil, "notify platform driver about FW crash");
-                       wil->platform_ops.notify_crash(wil->platform_handle);
+                       wil->platform_ops.notify(wil->platform_handle,
+                                                WIL_PLATFORM_EVT_FW_CRASH);
                } else {
                        wil_fw_error_recovery(wil);
                }
index 1fa215d0eeed9471048138a1db5e82d1e6893f2a..1472978dd3f02f1868497c873d5820b0e1f1527a 100644 (file)
@@ -764,6 +764,15 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
        if (wil->hw_version == HW_VER_UNKNOWN)
                return -ENODEV;
 
+       if (wil->platform_ops.notify) {
+               rc = wil->platform_ops.notify(wil->platform_handle,
+                                             WIL_PLATFORM_EVT_PRE_RESET);
+               if (rc)
+                       wil_err(wil,
+                               "%s: PRE_RESET platform notify failed, rc %d\n",
+                               __func__, rc);
+       }
+
        set_bit(wil_status_resetting, wil->status);
 
        cancel_work_sync(&wil->disconnect_worker);
@@ -843,8 +852,27 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
 
                /* we just started MAC, wait for FW ready */
                rc = wil_wait_for_fw_ready(wil);
-               if (rc == 0) /* check FW is responsive */
-                       rc = wmi_echo(wil);
+               if (rc)
+                       return rc;
+
+               /* check FW is responsive */
+               rc = wmi_echo(wil);
+               if (rc) {
+                       wil_err(wil, "%s: wmi_echo failed, rc %d\n",
+                               __func__, rc);
+                       return rc;
+               }
+
+               if (wil->platform_ops.notify) {
+                       rc = wil->platform_ops.notify(wil->platform_handle,
+                                                     WIL_PLATFORM_EVT_FW_RDY);
+                       if (rc) {
+                               wil_err(wil,
+                                       "%s: FW_RDY notify failed, rc %d\n",
+                                       __func__, rc);
+                               rc = 0;
+                       }
+               }
        }
 
        return rc;
index 9a949d9103438f459c8e715bf83e1d16c56853a0..33d4a34b3b1c005371733517678a8f8cfb1eed7c 100644 (file)
 
 struct device;
 
+enum wil_platform_event {
+       WIL_PLATFORM_EVT_FW_CRASH = 0,
+       WIL_PLATFORM_EVT_PRE_RESET = 1,
+       WIL_PLATFORM_EVT_FW_RDY = 2,
+};
+
 /**
  * struct wil_platform_ops - wil platform module calls from this
  * driver to platform driver
@@ -28,7 +34,7 @@ struct wil_platform_ops {
        int (*suspend)(void *handle);
        int (*resume)(void *handle);
        void (*uninit)(void *handle);
-       int (*notify_crash)(void *handle);
+       int (*notify)(void *handle, enum wil_platform_event evt);
 };
 
 /**
This page took 0.026661 seconds and 5 git commands to generate.