From patchwork Thu May 25 10:51:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: akolli@qti.qualcomm.com X-Patchwork-Id: 9748097 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 2DD066032C for ; Thu, 25 May 2017 10:52:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2703E26E55 for ; Thu, 25 May 2017 10:52:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B77C2766D; Thu, 25 May 2017 10:52:08 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 9CB6D26E55 for ; Thu, 25 May 2017 10:52:07 +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: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:In-Reply-To:References: List-Owner; bh=LzRDnO5KMZsGBEX3MJ9VGoQeRq8WXQAzrc77Y2ivbQE=; b=SWPRcxSXp9Q1Pr /FVKeKQdbB/cIhxpo1p5xqzW0FPNGpD7poV3+5sVfqUG+eJQn0ZQIgHk2Uu/dk2+cuCIJaoQSwhPZ ygEJecynVP+0rt+uzaG0VWtrWmNjMo0Jlngvz3CKcKvGlDYeyjSsygCp7UE7Dt6rKdL2B/QsV9+jT +QMkoZXsYYw3la02zURp58SiGHhlrVk2WmS03mjjDex7r8XoLtnOgNcvMQTTLQ4unFCEt+TDqjUvz mIkq/BM28lNzOrxJXc+ehTNHFIqJMZSSXrpz3JL0PE8ebpOsjpp+jdj3TJQosb/BvkcFBdqzxEZeo Y+sGwqpJkanhoaLgJ9GQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dDqMy-0005Qy-Pc; Thu, 25 May 2017 10:51:52 +0000 Received: from wolverine01.qualcomm.com ([199.106.114.254]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dDqMv-0005Pn-C7 for ath10k@lists.infradead.org; Thu, 25 May 2017 10:51:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1495709509; x=1527245509; h=from:to:cc:subject:date:message-id:mime-version; bh=DXig2ziduCaqZHXcNbXaTFRolvh4X/XML/9ZaxCw3L8=; b=BW4QeRikdkNMtFxY27JWCz9UJ3u1v9HChzr8slCwo/13XM10ZlZaspNA Q5oOW3imZziJBu56TT27cP1Pl+xKHm9jTQ+OLLhVWyW894302WLO9uRO0 RPd31hKdh82uhyIkiQ4LrPTiiUM/225fZN9E9Lb4gWcV5k2zJp/K08zMj g=; X-IronPort-AV: E=Sophos;i="5.38,391,1491289200"; d="scan'208";a="288760022" Received: from unknown (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by wolverine01.qualcomm.com with ESMTP; 25 May 2017 03:51:11 -0700 X-IronPort-AV: E=McAfee;i="5800,7501,8539"; a="1425385747" X-MGA-submission: =?us-ascii?q?MDFMZwbxQfIYvoKQ2ytnyC/QJmp+L17JVYniGt?= =?us-ascii?q?gujA7QeNa2c5tF3iE1yxtLoulglK9x2kzQvvJpjMC44yOK8IXG25Unfl?= =?us-ascii?q?tvYc21TfVF+N8m3VQVGZtnt+OAYOLUUwBkgxNEMOJJYGc3GZkvNECI5z?= =?us-ascii?q?QX?= Received: from nasanexm01g.na.qualcomm.com ([10.85.0.33]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 25 May 2017 03:51:09 -0700 Received: from aphydexm01a.ap.qualcomm.com (10.252.127.10) by NASANEXM01G.na.qualcomm.com (10.85.0.33) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Thu, 25 May 2017 03:51:08 -0700 Received: from localhost (10.80.80.8) by aphydexm01a.ap.qualcomm.com (10.252.127.10) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Thu, 25 May 2017 16:21:02 +0530 From: To: Subject: [PATCH] ath10k: Add BMI parameters to fix calibration from DT/pre-cal Date: Thu, 25 May 2017 16:21:23 +0530 Message-ID: <1495709483-29793-1-git-send-email-akolli@qti.qualcomm.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01E.na.qualcomm.com (10.85.0.31) To aphydexm01a.ap.qualcomm.com (10.252.127.10) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170525_035149_485007_FA845902 X-CRM114-Status: UNSURE ( 9.55 ) 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: Anilkumar Kolli , akolli@codeaurora.org, 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 From: Anilkumar Kolli QCA99X0, QCA9888, QCA9984 supports calibration data in either OTP or DT/pre-cal file. Current ath10k supports Calibration data from OTP only. If caldata is loaded from DT/pre-cal file, fetching board id and applying calibration parameters like tx power gets failed. error log: [ 15.733663] ath10k_pci 0000:01:00.0: failed to fetch board file: -2 [ 15.741474] ath10k_pci 0000:01:00.0: could not probe fw (-2) This patch adds calibration data support from DT/pre-cal file. Below parameters are used to get board id and applying calibration parameters from cal data. EEPROM[OTP] FLASH[DT/pre-cal file] Cal param 0x700 0x10000 Board id 0x10 0x8000 Tested on QCA9888 with pre-cal file. Signed-off-by: Anilkumar Kolli --- drivers/net/wireless/ath/ath10k/bmi.h | 2 ++ drivers/net/wireless/ath/ath10k/core.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/bmi.h b/drivers/net/wireless/ath/ath10k/bmi.h index 0342073ed397..9834f351807e 100644 --- a/drivers/net/wireless/ath/ath10k/bmi.h +++ b/drivers/net/wireless/ath/ath10k/bmi.h @@ -83,6 +83,8 @@ enum bmi_cmd_id { #define BMI_NVRAM_SEG_NAME_SZ 16 #define BMI_PARAM_GET_EEPROM_BOARD_ID 0x10 +#define BMI_PARAM_GET_FLASH_BOARD_ID 0x8000 +#define BMI_PARAM_FLASH_SECTION_ALL 0x10000 #define ATH10K_BMI_BOARD_ID_FROM_OTP_MASK 0x7c00 #define ATH10K_BMI_BOARD_ID_FROM_OTP_LSB 10 diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index eea111d704c5..fb859a0c197a 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -691,7 +691,7 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k *ar) { u32 result, address; u8 board_id, chip_id; - int ret; + int ret, bmi_board_id_param; address = ar->hw_params.patch_load_addr; @@ -715,8 +715,13 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k *ar) return ret; } - ret = ath10k_bmi_execute(ar, address, BMI_PARAM_GET_EEPROM_BOARD_ID, - &result); + if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT || + ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE) + bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID; + else + bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID; + + ret = ath10k_bmi_execute(ar, address, bmi_board_id_param, &result); if (ret) { ath10k_err(ar, "could not execute otp for board id check: %d\n", ret); @@ -845,6 +850,11 @@ static int ath10k_download_and_run_otp(struct ath10k *ar) return ret; } + /* As of now pre-cal is valid for 10_4 variants */ + if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT || + ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE) + bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL; + ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result); if (ret) { ath10k_err(ar, "could not execute otp (%d)\n", ret);