wil6210: move pre-FW configuration to separate function
authorDedy Lansky <qca_dlansky@qca.qualcomm.com>
Mon, 28 Aug 2017 19:18:44 +0000 (22:18 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 31 Aug 2017 12:19:40 +0000 (15:19 +0300)
Re-arrange the code to have dedicated function for device configuration
which takes place before FW starts running.

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

index e2ea49077b78b06329d8979afb29209011e67ca9..927e332893f1409ea69a2cb0f8c8a636776b5e8c 100644 (file)
@@ -930,6 +930,27 @@ int wil_ps_update(struct wil6210_priv *wil, enum wmi_ps_profile_type ps_profile)
        return rc;
 }
 
+static void wil_pre_fw_config(struct wil6210_priv *wil)
+{
+       /* Mark FW as loaded from host */
+       wil_s(wil, RGF_USER_USAGE_6, 1);
+
+       /* clear any interrupts which on-card-firmware
+        * may have set
+        */
+       wil6210_clear_irq(wil);
+       /* CAF_ICR - clear and mask */
+       /* it is W1C, clear by writing back same value */
+       wil_s(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, ICR), 0);
+       wil_w(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, IMV), ~0);
+
+       if (wil->fw_calib_result > 0) {
+               __le32 val = cpu_to_le32(wil->fw_calib_result |
+                                               (CALIB_RESULT_SIGNATURE << 8));
+               wil_w(wil, RGF_USER_FW_CALIB_RESULT, (u32 __force)val);
+       }
+}
+
 /*
  * We reset all the structures, and we reset the UMAC.
  * After calling this routine, you're expected to reload
@@ -1023,24 +1044,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
                if (rc)
                        return rc;
 
-               /* Mark FW as loaded from host */
-               wil_s(wil, RGF_USER_USAGE_6, 1);
-
-               /* clear any interrupts which on-card-firmware
-                * may have set
-                */
-               wil6210_clear_irq(wil);
-               /* CAF_ICR - clear and mask */
-               /* it is W1C, clear by writing back same value */
-               wil_s(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, ICR), 0);
-               wil_w(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, IMV), ~0);
-
-               if (wil->fw_calib_result > 0) {
-                       __le32 val = cpu_to_le32(wil->fw_calib_result |
-                                                (CALIB_RESULT_SIGNATURE << 8));
-                       wil_w(wil, RGF_USER_FW_CALIB_RESULT, (u32 __force)val);
-               }
-
+               wil_pre_fw_config(wil);
                wil_release_cpu(wil);
        }