From patchwork Wed Mar 20 04:45:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10860751 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-2.web.codeaurora.org (Postfix) with ESMTP id B773117E0 for ; Wed, 20 Mar 2019 04:48:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9441028A8B for ; Wed, 20 Mar 2019 04:48:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F10A29A07; Wed, 20 Mar 2019 04:48:45 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 2C23529A04 for ; Wed, 20 Mar 2019 04:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726049AbfCTEso (ORCPT ); Wed, 20 Mar 2019 00:48:44 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55478 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725300AbfCTEso (ORCPT ); Wed, 20 Mar 2019 00:48:44 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 69B3960DAD; Wed, 20 Mar 2019 04:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553057323; bh=7atp+JxqmU8JtBhm+x4paCEcFS0Nq8J2HdH/vFVMVcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GxKdsU0PlUaRe2Y0T0ZKKwImkv2lTeoganHwoicPR2iRakSs2kaAK5bIsFayVx4oN n3N0+pi5L4C3Xpq4cxej5IgpV3+qLXLD9uX4AtF+E65Sr/VCVlLH03eV++oovrD/J9 gKkYxuqjok+i8WwObTYkUffYiU+MUgbcQ5YnqT3M= Received: from govinds-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: govinds@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6612E60DAA; Wed, 20 Mar 2019 04:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553057322; bh=7atp+JxqmU8JtBhm+x4paCEcFS0Nq8J2HdH/vFVMVcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTGpnaUQ1QgK/oHV6gFh+3/GgvW55m/ZxZ04tLtXp4g1cLfQWvzYX1LYs+UhglBDj mBlfQIDHdtsSSaCuA6NhIE3mOeknt1A4sVl1Rs7LJUdSAWdb3OznaJBofCVn6sI3BJ 3V7mgszKTikbkC3tv98GKTENIiui0Kfb4SdeJRKg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6612E60DAA Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=govinds@codeaurora.org From: Govind Singh To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Govind Singh Subject: [PATCH v2 1/2] dt: bindings: add dt entry for XO calibration support Date: Wed, 20 Mar 2019 10:15:10 +0530 Message-Id: <20190320044511.12172-2-govinds@codeaurora.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320044511.12172-1-govinds@codeaurora.org> References: <20190320044511.12172-1-govinds@codeaurora.org> MIME-Version: 1.0 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 Add dt binding to get xo calibration data support for wifi rf clock. Signed-off-by: Govind Singh --- Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt index ae661e65354e..ab8042866e83 100644 --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt @@ -81,6 +81,7 @@ Optional properties: Definition: Name of external front end module used. Some valid FEM names for example: "microsemi-lx5586", "sky85703-11" and "sky85803" etc. +- xo-cal-data: xo cal offset to be configured in xo trim register. Example (to supply PCI based wifi block details): From patchwork Wed Mar 20 04:45:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10860755 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-2.web.codeaurora.org (Postfix) with ESMTP id A52E913B5 for ; Wed, 20 Mar 2019 04:48:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A66A28AC1 for ; Wed, 20 Mar 2019 04:48:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E74F29A03; Wed, 20 Mar 2019 04:48:48 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 063C728AC1 for ; Wed, 20 Mar 2019 04:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726225AbfCTEsr (ORCPT ); Wed, 20 Mar 2019 00:48:47 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55540 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725300AbfCTEsr (ORCPT ); Wed, 20 Mar 2019 00:48:47 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9E56C60DAA; Wed, 20 Mar 2019 04:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553057325; bh=2+jlSqLlcsXjClkkQ2hBOeEWGtgRqr6zNzE4sr2bLKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KivkmIPN0eKnXN22lfABwfoTWTVGzuwd/VjhHUceZQAHAEj+PqpZuXs/YRC5uC/FN wqnnYURs2O4INN0pXRTSJ0rWpIfg7Rd1GnsON7oawEi0vB+Bvo7/vrFs+WkA8fM6uo FdrexCA+j5QB/3dY2tOEgbMqHAOsPBiMOJzSC1CA= Received: from govinds-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: govinds@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5E6C360E3E; Wed, 20 Mar 2019 04:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553057324; bh=2+jlSqLlcsXjClkkQ2hBOeEWGtgRqr6zNzE4sr2bLKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mMhaO1oMVT62uzQ4o5vDkF/8rAYCvWlg7m1wxNgqNjyJ00sN1EkR2bVMELPSPa93D iflld6iylZMcv7znBfPGC2oIFsO6GdPAs/+TRRI8Ww0ycCavrCaTANzEyWcKU3FiJW 1MoqpCP68llUYxQBYNRU/mj9tjsTApRl5LzMiGVI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5E6C360E3E Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=govinds@codeaurora.org From: Govind Singh To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Govind Singh Subject: [PATCH v2 2/2] ath10k: Add xo calibration support for wifi rf clock Date: Wed, 20 Mar 2019 10:15:11 +0530 Message-Id: <20190320044511.12172-3-govinds@codeaurora.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320044511.12172-1-govinds@codeaurora.org> References: <20190320044511.12172-1-govinds@codeaurora.org> MIME-Version: 1.0 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 PMIC XO is the clock source for wifi rf clock in integrated wifi chipset ex: WCN3990. Due to board layout errors XO frequency drifts can cause wifi rf clock inaccuracy. XO calibration test tree in Factory Test Mode is used to find the best frequency offset(for example +/-2KHz )by programming XO trim register. This ensure system clock stays within required 20 ppm WLAN rf clock. Retrieve the xo trim offset via system firmware (e.g., device tree), especially in the case where the device doesn't have a useful EEPROM on which to store the calibrated XO offset (e.g., for integrated Wifi). Calibrated XO offset is sent to fw, which compensate the clock drift by programing the XO trim register. Signed-off-by: Govind Singh --- drivers/net/wireless/ath/ath10k/qmi.c | 12 ++++++++++++ drivers/net/wireless/ath/ath10k/snoc.c | 11 +++++++++++ drivers/net/wireless/ath/ath10k/snoc.h | 2 ++ 3 files changed, 25 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/qmi.c b/drivers/net/wireless/ath/ath10k/qmi.c index 37b3bd629f48..99c140a6628d 100644 --- a/drivers/net/wireless/ath/ath10k/qmi.c +++ b/drivers/net/wireless/ath/ath10k/qmi.c @@ -302,10 +302,16 @@ static int ath10k_qmi_send_cal_report_req(struct ath10k_qmi *qmi) struct wlfw_cal_report_resp_msg_v01 resp = {}; struct wlfw_cal_report_req_msg_v01 req = {}; struct ath10k *ar = qmi->ar; + struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); struct qmi_txn txn; int i, j = 0; int ret; + if (ar_snoc->xo_cal_supported) { + req.xo_cal_data_valid = 1; + req.xo_cal_data = ar_snoc->xo_cal_data; + } + ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_cal_report_resp_msg_v01_ei, &resp); if (ret < 0) @@ -636,6 +642,7 @@ ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi) struct wlfw_ind_register_resp_msg_v01 resp = {}; struct wlfw_ind_register_req_msg_v01 req = {}; struct ath10k *ar = qmi->ar; + struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); struct qmi_txn txn; int ret; @@ -646,6 +653,11 @@ ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi *qmi) req.msa_ready_enable_valid = 1; req.msa_ready_enable = 1; + if (ar_snoc->xo_cal_supported) { + req.xo_cal_enable_valid = 1; + req.xo_cal_enable = 1; + } + ret = qmi_txn_init(&qmi->qmi_hdl, &txn, wlfw_ind_register_resp_msg_v01_ei, &resp); if (ret < 0) diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 54efe6be8f1d..7cfd17beb7b0 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "ce.h" @@ -1189,6 +1190,16 @@ static int ath10k_snoc_resource_init(struct ath10k *ar) ar_snoc->ce_irqs[i].irq_line = res->start; } + ret = device_property_read_u32(&pdev->dev, "xo-cal-data", + &ar_snoc->xo_cal_data); + ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc xo-cal-data return %d\n", ret); + if (ret == 0) { + ar_snoc->xo_cal_supported = true; + ath10k_dbg(ar, ATH10K_DBG_SNOC, "xo cal data %x\n", + ar_snoc->xo_cal_data); + } + ret = 0; + out: return ret; } diff --git a/drivers/net/wireless/ath/ath10k/snoc.h b/drivers/net/wireless/ath/ath10k/snoc.h index 2b2f23cf7c5d..25383de8f17d 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.h +++ b/drivers/net/wireless/ath/ath10k/snoc.h @@ -91,6 +91,8 @@ struct ath10k_snoc { struct ath10k_clk_info *clk; struct ath10k_qmi *qmi; unsigned long int flags; + bool xo_cal_supported; + u32 xo_cal_data; }; static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar)