From patchwork Sun Mar 22 18:29:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 6067101 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 71F43BF90F for ; Sun, 22 Mar 2015 18:31:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C00E20221 for ; Sun, 22 Mar 2015 18:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6AB0F20220 for ; Sun, 22 Mar 2015 18:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751861AbbCVSbf (ORCPT ); Sun, 22 Mar 2015 14:31:35 -0400 Received: from mout.gmx.net ([212.227.15.18]:53456 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751809AbbCVSbe (ORCPT ); Sun, 22 Mar 2015 14:31:34 -0400 Received: from localhost.localdomain ([80.187.100.161]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0Lh6sJ-1ZKPp62LIN-00oXsK; Sun, 22 Mar 2015 19:31:33 +0100 From: Oleksij Rempel To: linux-wireless@vger.kernel.org, kvalo@codeaurora.org, ath9k-devel@lists.ath9k.org Cc: Oleksij Rempel Subject: [PATCH v3 02/18] ath9k: ar9271_hw_pa_cal - use defs instead of magin numbers Date: Sun, 22 Mar 2015 19:29:47 +0100 Message-Id: <1427049003-8443-3-git-send-email-linux@rempel-privat.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427049003-8443-1-git-send-email-linux@rempel-privat.de> References: <1427049003-8443-1-git-send-email-linux@rempel-privat.de> X-Provags-ID: V03:K0:5c3hWJLJ1ftKi8lhOVHXV9dJVeY39rpH9YjTQjqtW7Cg7/Ywv8A F13Mcb/aqq/tpQR5Nkaf7etOBguF0gTxgaZ2K9C3Fto2qj0XvDXb1rEfgO+GFwlHSv8xwc8 CCpqpb/W2IVnGIZ3Y8ADuiul8ipPIxGSq31nxv8j78tXR07tm7/QlQT2lBATJJEyVHIEal7 ITkn5c7OTduRChD0P5ksw== 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);