Skip to content

Commit 1490846

Browse files
Dedy Lanskykvalo
authored andcommitted
wil6210: move pre-FW configuration to separate function
Re-arrange the code to have dedicated function for device configuration which takes place before FW starts running. Signed-off-by: Dedy Lansky <[email protected]> Signed-off-by: Maya Erez <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 761f8e4 commit 1490846

File tree

1 file changed

+22
-18
lines changed
  • drivers/net/wireless/ath/wil6210

1 file changed

+22
-18
lines changed

drivers/net/wireless/ath/wil6210/main.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,27 @@ int wil_ps_update(struct wil6210_priv *wil, enum wmi_ps_profile_type ps_profile)
930930
return rc;
931931
}
932932

933+
static void wil_pre_fw_config(struct wil6210_priv *wil)
934+
{
935+
/* Mark FW as loaded from host */
936+
wil_s(wil, RGF_USER_USAGE_6, 1);
937+
938+
/* clear any interrupts which on-card-firmware
939+
* may have set
940+
*/
941+
wil6210_clear_irq(wil);
942+
/* CAF_ICR - clear and mask */
943+
/* it is W1C, clear by writing back same value */
944+
wil_s(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, ICR), 0);
945+
wil_w(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, IMV), ~0);
946+
947+
if (wil->fw_calib_result > 0) {
948+
__le32 val = cpu_to_le32(wil->fw_calib_result |
949+
(CALIB_RESULT_SIGNATURE << 8));
950+
wil_w(wil, RGF_USER_FW_CALIB_RESULT, (u32 __force)val);
951+
}
952+
}
953+
933954
/*
934955
* We reset all the structures, and we reset the UMAC.
935956
* After calling this routine, you're expected to reload
@@ -1023,24 +1044,7 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
10231044
if (rc)
10241045
return rc;
10251046

1026-
/* Mark FW as loaded from host */
1027-
wil_s(wil, RGF_USER_USAGE_6, 1);
1028-
1029-
/* clear any interrupts which on-card-firmware
1030-
* may have set
1031-
*/
1032-
wil6210_clear_irq(wil);
1033-
/* CAF_ICR - clear and mask */
1034-
/* it is W1C, clear by writing back same value */
1035-
wil_s(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, ICR), 0);
1036-
wil_w(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, IMV), ~0);
1037-
1038-
if (wil->fw_calib_result > 0) {
1039-
__le32 val = cpu_to_le32(wil->fw_calib_result |
1040-
(CALIB_RESULT_SIGNATURE << 8));
1041-
wil_w(wil, RGF_USER_FW_CALIB_RESULT, (u32 __force)val);
1042-
}
1043-
1047+
wil_pre_fw_config(wil);
10441048
wil_release_cpu(wil);
10451049
}
10461050

0 commit comments

Comments
 (0)