From patchwork Mon Aug 28 19:18:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9926053 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 523A660375 for ; Mon, 28 Aug 2017 19:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4438C22638 for ; Mon, 28 Aug 2017 19:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 391CF2879D; Mon, 28 Aug 2017 19:19:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE24C22638 for ; Mon, 28 Aug 2017 19:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751346AbdH1TTF (ORCPT ); Mon, 28 Aug 2017 15:19:05 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:41752 "EHLO alexa-out-lv-01.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751241AbdH1TTC (ORCPT ); Mon, 28 Aug 2017 15:19:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1503947942; x=1535483942; h=cc:from:to:subject:date:message-id:in-reply-to: references; bh=jsSkpsmxZAdm31Fat8VMcAsvxauUCHTd3mkqCDh1o38=; b=l/CE3IcWZ0zL3/+DBKykZlOPd1rJKEyOypQQul+hGUrxjCynFlXKOQbc zi0Z50r2ytFPC0zNqdP67d/02nnvV8Ak1hUiE521BdkIq8ucElMILs9H5 /MnCnPhyMkgjyH88Fv4Cgh7HK2KZKW1UJ1cJVX+oWabAD7G8JsXFHIhcY 8=; X-IronPort-AV: E=Sophos;i="5.41,442,1498546800"; d="scan'208";a="4181692" Received: from ironmsg03-r-new.qualcomm.com (HELO Ironmsg03-R.qualcomm.com) ([10.53.140.107]) by alexa-out-lv-01.qualcomm.com with ESMTP; 28 Aug 2017 12:19:02 -0700 Cc: Dedy Lansky , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez X-IronPort-AV: E=McAfee;i="5900,7806,8637"; a="1430573133" X-MGA-submission: =?us-ascii?q?MDGfKPAwcMzvPLsOHgKNp0SZfGyNFo3qhFRtsw?= =?us-ascii?q?6sZumbgiCpEhiuH6bCmuh/owyeXKrsHu+5ox9LZr/owDXht15HFdaTom?= =?us-ascii?q?BRL1dYWjT42zLn7+fby5ELe48uxdE7fVFXAvzUfRdEKaH2jh7q/iW1ve?= =?us-ascii?q?HQ?= Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by Ironmsg03-R.qualcomm.com with ESMTP; 28 Aug 2017 12:19:00 -0700 From: Maya Erez To: Kalle Valo Subject: [PATCH 4/7] wil6210: move pre-FW configuration to separate function Date: Mon, 28 Aug 2017 22:18:44 +0300 Message-Id: <1503947927-18877-5-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503947927-18877-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1503947927-18877-1-git-send-email-qca_merez@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dedy Lansky Re-arrange the code to have dedicated function for device configuration which takes place before FW starts running. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/main.c | 40 ++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index e2ea490..927e332 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -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); }