From patchwork Sat Mar 2 05:06:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10836443 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 52373922 for ; Sat, 2 Mar 2019 05:06:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C0432D201 for ; Sat, 2 Mar 2019 05:06:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 303AE2D23D; Sat, 2 Mar 2019 05:06:49 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D69B92D201 for ; Sat, 2 Mar 2019 05:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H8jWyNlgBx8p2I9B6RylqRl+SBKw8sqEHQOqVmBKF14=; b=iJms1ocWi82dcp Y7NCKwpxrEv7WOu6tVJJNWPgthViQ827hyY1TuT4ZNTCIATrWROOgEKhnQZJq2C0mfZxZLJjxYzr2 emMv4eJrlAsEmO3NfcyHMdYnWIVqtIV9EEZmsqohDV1VgWG/zjo29I3EOlCK0epgT8oUyoPQh8NDL ngBWJWkSBjMuzz0VfEogPyNKgASieaTTwtNae6nrXUULsOZcne1o++RNV9bpXzgUP6RwbfeE1ftjQ D1ltXFxYIav19XP8dUZDLFicPxrxsc51BbyBFIx//ZbzE2KHidcqQjT25PEfPrfwEyo3JOis4r/a9 QwxL8U3qu+SKrwCNQrOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzwrI-0001v2-5Z; Sat, 02 Mar 2019 05:06:48 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzwrF-0001t7-1Z for ath10k@lists.infradead.org; Sat, 02 Mar 2019 05:06:46 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C0B5760EA5; Sat, 2 Mar 2019 05:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551503204; bh=7atp+JxqmU8JtBhm+x4paCEcFS0Nq8J2HdH/vFVMVcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BijcnnVGHCkaM1Oy7PgLc8bDE6BXal5RfzdnH5fVEY83epelRKr6i/DI4KSI8FMyU huEaIiPA0kpFRN/KJ5J8i67Z0xICK7fl+Y1xsdhijtuNNU7YnURnOhPDhRyLCEOXr4 U7eGeI6dZpVqlGyQAYTX1+yroQPZtMtz3g9ZPIPU= 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 EACA56087A; Sat, 2 Mar 2019 05:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551503204; bh=7atp+JxqmU8JtBhm+x4paCEcFS0Nq8J2HdH/vFVMVcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BijcnnVGHCkaM1Oy7PgLc8bDE6BXal5RfzdnH5fVEY83epelRKr6i/DI4KSI8FMyU huEaIiPA0kpFRN/KJ5J8i67Z0xICK7fl+Y1xsdhijtuNNU7YnURnOhPDhRyLCEOXr4 U7eGeI6dZpVqlGyQAYTX1+yroQPZtMtz3g9ZPIPU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EACA56087A 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 Subject: [PATCH 1/2] dt: bindings: add dt entry for XO calibration support Date: Sat, 2 Mar 2019 10:36:34 +0530 Message-Id: <20190302050635.17694-2-govinds@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190302050635.17694-1-govinds@codeaurora.org> References: <20190302050635.17694-1-govinds@codeaurora.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190301_210645_103694_98C15418 X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Govind Singh , linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.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 Sat Mar 2 05:06:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govind Singh X-Patchwork-Id: 10836451 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 101951669 for ; Sat, 2 Mar 2019 05:06:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED8AA2D201 for ; Sat, 2 Mar 2019 05:06:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E20142D23D; Sat, 2 Mar 2019 05:06:52 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 84D1D2D201 for ; Sat, 2 Mar 2019 05:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EVjV8JVWPQnzZmP4HCpnt3wwfv+uEG01s3m76SjSSQY=; b=uHR9Us32eo1qyP 3AZ4KPDmxTET1LNZHisPn+HmzcT7d4dUczHbXrT9iO7jRIt5wZxQFKOawaakPiCgxUrh3AerDfyU0 NaoCscwPAD5JrFMqWtr9RqAXQH7dMXeojpNNbR5VsPqp/aJmPaNOxBu1whVc97+QuW/4jiJRtRAcU 8JYB25Lrd2yY1K8nCeOuQ/CDTznz7wEOFUM1ijCcckc6Q3HR+xZF+dRltrlk6jtNTURVLnd+78RlZ 44Zs89S1fwMUd910SSmKlXPeULAy54GSFAOROe41KVivZ343qQ8HO6j05nTDjS9muyj7fGczxv+62 rQdCSHzRN4WXOxv9b4hw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzwrL-00020R-Uq; Sat, 02 Mar 2019 05:06:51 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzwrH-0001uc-Mw for ath10k@lists.infradead.org; Sat, 02 Mar 2019 05:06:49 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7142A60E7A; Sat, 2 Mar 2019 05:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551503207; bh=3R2YWU9ekmHlcpn8ouqeU0AA0Y4avXlO8wQnL7TUdGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FFHdaJfCRYsQYoVJRugrXw84862lf9fikEooiydmPBiGTIXVp6CTEBn8ozLf5fm42 nnLYE6aI2EqlbyBLdGo1Kwon4tSx1/vK1zhVXCPHsx1+d5vnCKQHrWBG5mUYgEUMHn i9OIY2mo4ZQNkteLOsJxMMphWhibNf4Kj5U/uyAc= 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 1448A60E7A; Sat, 2 Mar 2019 05:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551503206; bh=3R2YWU9ekmHlcpn8ouqeU0AA0Y4avXlO8wQnL7TUdGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HaMsOdmACjOQtxK9vXJe7EhrX0vsRtXCZ5Lw9Mx875rTJt53kTDtoTBDLc9aI8HgO 8hJDfNALcCbT08rDiT2kd5kLuy2TX60CRT0qBaqXPtF6w62dkTxsmUOugKuuzI9JER 0mEA7zdSJ53PXncJJOqHQiqyjwcRUk4hX49RvQV8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1448A60E7A 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 Subject: [PATCH 2/2] ath10k: Add xo calibration support for wifi rf clock Date: Sat, 2 Mar 2019 10:36:35 +0530 Message-Id: <20190302050635.17694-3-govinds@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190302050635.17694-1-govinds@codeaurora.org> References: <20190302050635.17694-1-govinds@codeaurora.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190301_210647_796140_48929AAD X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Govind Singh , linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.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 | 10 ++++++++++ drivers/net/wireless/ath/ath10k/snoc.h | 2 ++ 3 files changed, 24 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..7fa0f5c1d070 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,15 @@ 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); + } + 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)