From patchwork Fri Sep 7 06:45:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Manoharan, Rajkumar" X-Patchwork-Id: 1420061 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 626BF3FC33 for ; Fri, 7 Sep 2012 06:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754352Ab2IGGpS (ORCPT ); Fri, 7 Sep 2012 02:45:18 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:21836 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753138Ab2IGGpQ (ORCPT ); Fri, 7 Sep 2012 02:45:16 -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=1347000316; x=1378536316; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=fqr1LClwcL1nsuJ+qhz+r0weGjojArqkEU09Bw2QwII=; b=Rel79gq0rMcEuUYli4qH+2A3kKEEHxG7mHzs3CMkxymFewEyvLxrULNt Wu/5IEl39n1lPpZ4dE/OR/w8TmeyLgVZlqR0d1IlgXgx5f9Ryp7EVnydW iF+oyzjP3MklGjAyYo7dk/qGpJ5KtFkjf3y+xpqnUTUsOnOVbAIf2oVyH 0=; X-IronPort-AV: E=McAfee;i="5400,1158,6827"; a="233919542" Received: from ironmsg02-l.qualcomm.com ([172.30.48.16]) by wolverine01.qualcomm.com with ESMTP; 06 Sep 2012 23:45:16 -0700 X-IronPort-AV: E=Sophos;i="4.80,384,1344236400"; d="scan'208";a="122985184" Received: from nasanexhc07.na.qualcomm.com ([172.30.39.190]) by ironmsg02-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 06 Sep 2012 23:45:16 -0700 Received: from qcmail1.qualcomm.com (172.30.39.5) by qcmail1.qualcomm.com (172.30.39.190) with Microsoft SMTP Server (TLS) id 14.2.318.1; Thu, 6 Sep 2012 23:45:14 -0700 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Fri, 07 Sep 2012 12:15:26 +0530 From: Rajkumar Manoharan To: CC: , Rajkumar Manoharan Subject: [PATCH 2/2] ath9k_hw: Read and configure thermocal for AR9462 Date: Fri, 7 Sep 2012 12:15:16 +0530 Message-ID: <1347000316-4466-2-git-send-email-rmanohar@qca.qualcomm.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1347000316-4466-1-git-send-email-rmanohar@qca.qualcomm.com> References: <1347000316-4466-1-git-send-email-rmanohar@qca.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [172.30.39.5] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Read and configure thermometer calibration results read from OTP card. Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 19 +++++++++++++++++++ drivers/net/wireless/ath/ath9k/ar9003_phy.h | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 0e46330..d44ed24 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c @@ -4020,6 +4020,24 @@ static void ar9003_hw_thermometer_apply(struct ath_hw *ah) } } +static void ar9003_hw_thermo_cal_apply(struct ath_hw *ah) +{ + u32 data, ko, kg; + + if (!AR_SREV_9462_20(ah)) + return; + ar9300_otp_read_word(ah, 1, &data); + ko = data & 0xff; + kg = (data >> 8) & 0xff; + if (ko || kg) { + REG_RMW_FIELD(ah, AR_PHY_BB_THERM_ADC_3, + AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET, ko); + REG_RMW_FIELD(ah, AR_PHY_BB_THERM_ADC_3, + AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN, + kg + 256); + } +} + static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah, struct ath9k_channel *chan) { @@ -4036,6 +4054,7 @@ static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah, ar9003_hw_apply_tuning_caps(ah); ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz); ar9003_hw_thermometer_apply(ah); + ar9003_hw_thermo_cal_apply(ah); } static void ath9k_hw_ar9300_set_addac(struct ath_hw *ah, diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h index 25d8181..e8bfb41 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h @@ -609,6 +609,12 @@ #define AR_PHY_BB_THERM_ADC_1_INIT_THERM 0x000000ff #define AR_PHY_BB_THERM_ADC_1_INIT_THERM_S 0 +#define AR_PHY_BB_THERM_ADC_3 (AR_SM_BASE + 0x250) +#define AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN 0x0001ff00 +#define AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN_S 8 +#define AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET 0x000000ff +#define AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET_S 0 + #define AR_PHY_BB_THERM_ADC_4 (AR_SM_BASE + 0x254) #define AR_PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE 0x000000ff #define AR_PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE_S 0