From patchwork Fri Mar 20 12:38:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 6056231 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 085A69F820 for ; Fri, 20 Mar 2015 12:40:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F0DC20523 for ; Fri, 20 Mar 2015 12:40:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1E7520522 for ; Fri, 20 Mar 2015 12:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751470AbbCTMkJ (ORCPT ); Fri, 20 Mar 2015 08:40:09 -0400 Received: from mout.gmx.net ([212.227.15.18]:51368 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbbCTMkH (ORCPT ); Fri, 20 Mar 2015 08:40:07 -0400 Received: from localhost.localdomain ([80.187.100.132]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MJjvw-1YXpkm1yjs-00181R; Fri, 20 Mar 2015 13:39:59 +0100 From: Oleksij Rempel To: linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org, kvalo@codeaurora.org, adrian@freebsd.org Cc: Oleksij Rempel Subject: [PATCH 02/18] ath9k: ar9271_hw_pa_cal - use defs instead of magin numbers Date: Fri, 20 Mar 2015 13:38:42 +0100 Message-Id: <1426855138-6121-3-git-send-email-linux@rempel-privat.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426855138-6121-1-git-send-email-linux@rempel-privat.de> References: <1426855138-6121-1-git-send-email-linux@rempel-privat.de> X-Provags-ID: V03:K0:Y4YNVduMW59X42kcG2Ajrw2rH7e2o33zpRic8yz7INrDicc161w +ZFQosQX2tIzIJULKfCAPYAEWzv2YC+VAKzUjIbIOCOZesrN5moCvszylwdWQ7XbWy1qQxm 6g6SnUxQJoOzE5nNURtOMDheEYA7iGjpJewrZ0bbLJewelBckLoF+6BTKwn1/7yd2/ZGsdk fFgvM6tvwHB+2bok0rXmQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This function uses mixed styles for register names/numbers which is make harder reading and optimisation. Signed-off-by: Oleksij Rempel --- drivers/net/wireless/ath/ath9k/ar9002_calib.c | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c index 42190b6..4576b99 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c @@ -430,22 +430,22 @@ static void ar9271_hw_pa_cal(struct ath_hw *ah, bool is_reset) u32 regVal; unsigned int i; u32 regList[][2] = { - { 0x786c, 0 }, - { 0x7854, 0 }, - { 0x7820, 0 }, - { 0x7824, 0 }, - { 0x7868, 0 }, - { 0x783c, 0 }, - { 0x7838, 0 } , - { 0x7828, 0 } , + { AR9285_AN_TOP3, 0 }, + { AR9285_AN_RXTXBB1, 0 }, + { AR9285_AN_RF2G1, 0 }, + { AR9285_AN_RF2G2, 0 }, + { AR9285_AN_TOP2, 0 }, + { AR9285_AN_RF2G8, 0 }, + { AR9285_AN_RF2G7, 0 } , + { AR9285_AN_RF2G3, 0 } , }; for (i = 0; i < ARRAY_SIZE(regList); i++) regList[i][1] = REG_READ(ah, regList[i][0]); - regVal = REG_READ(ah, 0x7834); + regVal = REG_READ(ah, AR9285_AN_RF2G6); regVal &= (~(0x1)); - REG_WRITE(ah, 0x7834, regVal); + REG_WRITE(ah, AR9285_AN_RF2G6, regVal); regVal = REG_READ(ah, 0x9808); regVal |= (0x1 << 27); REG_WRITE(ah, 0x9808, regVal); @@ -477,7 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_hw *ah, bool is_reset) * does not matter since we turn it off */ REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0); - + /* 7828, b0-11, ccom=fff */ REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff); /* Set: @@ -490,15 +490,16 @@ static void ar9271_hw_pa_cal(struct ath_hw *ah, bool is_reset) /* find off_6_1; */ for (i = 6; i > 0; i--) { - regVal = REG_READ(ah, 0x7834); + regVal = REG_READ(ah, AR9285_AN_RF2G6); regVal |= (1 << (20 + i)); - REG_WRITE(ah, 0x7834, regVal); + REG_WRITE(ah, AR9285_AN_RF2G6, regVal); udelay(1); /* regVal = REG_READ(ah, 0x7834); */ regVal &= (~(0x1 << (20 + i))); - regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9) + regVal |= (MS(REG_READ(ah, AR9285_AN_RF2G9), + AR9285_AN_RXTXBB1_SPARE9) << (20 + i)); - REG_WRITE(ah, 0x7834, regVal); + REG_WRITE(ah, AR9285_AN_RF2G6, regVal); } regVal = (regVal >> 20) & 0x7f; @@ -517,9 +518,9 @@ static void ar9271_hw_pa_cal(struct ath_hw *ah, bool is_reset) ENABLE_REGWRITE_BUFFER(ah); - regVal = REG_READ(ah, 0x7834); + regVal = REG_READ(ah, AR_AN_RF2G1_CH1); regVal |= 0x1; - REG_WRITE(ah, 0x7834, regVal); + REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal); regVal = REG_READ(ah, 0x9808); regVal &= (~(0x1 << 27)); REG_WRITE(ah, 0x9808, regVal);