Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e674e6d6 authored by Dedy Lansky's avatar Dedy Lansky Committed by Maya Erez
Browse files

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.

Change-Id: Ia0f2b33f85ba9547bee9415e34143e5b09e28447
Signed-off-by: default avatarDedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: default avatarMaya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Git-commit: 1490846d256af947a4743f04ba8c97dc3bc37073
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git


Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent a3758ded
Loading
Loading
Loading
Loading
+22 −18
Original line number Diff line number Diff line
@@ -934,6 +934,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
@@ -1031,24 +1052,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);
	}