From patchwork Sun Oct 2 22:29:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 9359821 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 12925608A7 for ; Sun, 2 Oct 2016 22:29:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14E5928A60 for ; Sun, 2 Oct 2016 22:29:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0899728A76; Sun, 2 Oct 2016 22:29:42 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4315828A6F for ; Sun, 2 Oct 2016 22:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751934AbcJBW3a (ORCPT ); Sun, 2 Oct 2016 18:29:30 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34946 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbcJBW3Y (ORCPT ); Sun, 2 Oct 2016 18:29:24 -0400 Received: by mail-wm0-f65.google.com with SMTP id f193so7412620wmg.2; Sun, 02 Oct 2016 15:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=riTBBSf+hw668N0cRku6T9vMR5uGnknyxNAzcq/IJ/g=; b=gAqO//PNRnetcS+z4VVDU1WSMSGPaxs0/bB/OnuzD6Rgsj7JL1yy6uhWdU5xONEGNG 3vKtTbUYFa06bMzNJaOJipmVON1i8KsteF5RTqxERIujnhbHGjSpqM5G1baqEDT2Zol5 LPVwZRXveq/GvCzMV8TZm0qakJ1mFbQL+fwBz/CbxINDwiZJMrtPF64XA2CmPSN673H2 yXKN+n++GixXm1Xalxn2HhmqPvOWeHL0NvWSXggB0roZam0qYJcYoeK8Qq3txPXmKuSS 8EGOmwkypjix3z0zauapq8Osx71tAc7uIOLWYUs1YjdoEyDoaQbzpFB2bGhHUzb+L5vs OJCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=riTBBSf+hw668N0cRku6T9vMR5uGnknyxNAzcq/IJ/g=; b=b/rfl1Hql6OyABjly06ruNAxTCvl3Djfhoo6ZsCIZWKq3ycovrLObk5bDe91DJRP5w WWb4ywVtml66RUt/WmZUHKVQcT4vMTYCMKhDNfTvDs2FE8mSOo8KBzDpotLqGnzC2d4X Hz8bcDgreZ8uDQTisOd0jlWaI5H3InJ8dssU72W9VPaEGFF11brhZqXF5UuDtzQXi/Ve +HP3IDyxG3XnuqXnMfWheEdqu8jDStcvwtNdtblm3grRDly8TS5Y8tO6fAcew03VXYmq ogW0wcl7UCICcfvhvFvxU11CStJJfx66YhNy9EUoGj5kpt+P+B6uPwaiqPknfLDCrJbV RgOg== X-Gm-Message-State: AA6/9RkrWDRmmZl9ZNuLsomEM6BemMNYo/fwREallAY3AeLupHspZC6Gj6rNyouMQVprmw== X-Received: by 10.28.102.6 with SMTP id a6mr6508833wmc.97.1475447362321; Sun, 02 Oct 2016 15:29:22 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD3D4610440DF0B34A14E22AB.dip0.t-ipconnect.de. [2003:dc:d3d4:6104:40df:b34:a14e:22ab]) by smtp.googlemail.com with ESMTPSA id t65sm15817064wmt.15.2016.10.02.15.29.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Oct 2016 15:29:21 -0700 (PDT) From: Martin Blumenstingl To: kvalo@codeaurora.org, ath9k-devel@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org, devicetree@vger.kernel.org, arnd@arndb.de Cc: chunkeey@googlemail.com, nbd@nbd.name, Martin Blumenstingl Subject: [PATCH v2 3/7] ath9k: Add an eeprom_ops callback for retrieving the eepmisc value Date: Mon, 3 Oct 2016 00:29:09 +0200 Message-Id: <20161002222913.12223-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161002222913.12223-1-martin.blumenstingl@googlemail.com> References: <20160821144906.30984-1-martin.blumenstingl@googlemail.com> <20161002222913.12223-1-martin.blumenstingl@googlemail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This allows deciding if we have to swap the EEPROM data (so it matches the system's native endianness) even if no byte-swapping (swab16, based on the first two bytes in the EEPROM) is needed. Signed-off-by: Martin Blumenstingl --- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 8 +++++++- drivers/net/wireless/ath/ath9k/eeprom.h | 1 + drivers/net/wireless/ath/ath9k/eeprom_4k.c | 8 +++++++- drivers/net/wireless/ath/ath9k/eeprom_9287.c | 8 +++++++- drivers/net/wireless/ath/ath9k/eeprom_def.c | 8 +++++++- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 270d4ae..3dbfd86 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c @@ -5498,6 +5498,11 @@ unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah, } } +static u8 ar9003_get_eepmisc(struct ath_hw *ah) +{ + return ah->eeprom.map4k.baseEepHeader.eepMisc; +} + const struct eeprom_ops eep_ar9300_ops = { .check_eeprom = ath9k_hw_ar9300_check_eeprom, .get_eeprom = ath9k_hw_ar9300_get_eeprom, @@ -5508,5 +5513,6 @@ const struct eeprom_ops eep_ar9300_ops = { .set_board_values = ath9k_hw_ar9300_set_board_values, .set_addac = ath9k_hw_ar9300_set_addac, .set_txpower = ath9k_hw_ar9300_set_txpower, - .get_spur_channel = ath9k_hw_ar9300_get_spur_channel + .get_spur_channel = ath9k_hw_ar9300_get_spur_channel, + .get_eepmisc = ar9003_get_eepmisc }; diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h index c466ada..408cfa7 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h @@ -655,6 +655,7 @@ struct eeprom_ops { u16 cfgCtl, u8 twiceAntennaReduction, u8 powerLimit, bool test); u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); + u8 (*get_eepmisc)(struct ath_hw *ah); }; void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val); diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c index 780cb49..7cd9c64 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c @@ -1064,6 +1064,11 @@ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz) return ah->eeprom.map4k.modalHeader.spurChans[i].spurChan; } +static u8 ath9k_hw_4k_get_eepmisc(struct ath_hw *ah) +{ + return ah->eeprom.map4k.baseEepHeader.eepMisc; +} + const struct eeprom_ops eep_4k_ops = { .check_eeprom = ath9k_hw_4k_check_eeprom, .get_eeprom = ath9k_hw_4k_get_eeprom, @@ -1073,5 +1078,6 @@ const struct eeprom_ops eep_4k_ops = { .get_eeprom_rev = ath9k_hw_4k_get_eeprom_rev, .set_board_values = ath9k_hw_4k_set_board_values, .set_txpower = ath9k_hw_4k_set_txpower, - .get_spur_channel = ath9k_hw_4k_get_spur_channel + .get_spur_channel = ath9k_hw_4k_get_spur_channel, + .get_eepmisc = ath9k_hw_4k_get_eepmisc }; diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index f483ba2..e1ba9bc 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c @@ -986,6 +986,11 @@ static u16 ath9k_hw_ar9287_get_spur_channel(struct ath_hw *ah, return ah->eeprom.map9287.modalHeader.spurChans[i].spurChan; } +static u8 ath9k_hw_ar9287_get_eepmisc(struct ath_hw *ah) +{ + return ah->eeprom.map9287.baseEepHeader.eepMisc; +} + const struct eeprom_ops eep_ar9287_ops = { .check_eeprom = ath9k_hw_ar9287_check_eeprom, .get_eeprom = ath9k_hw_ar9287_get_eeprom, @@ -995,5 +1000,6 @@ const struct eeprom_ops eep_ar9287_ops = { .get_eeprom_rev = ath9k_hw_ar9287_get_eeprom_rev, .set_board_values = ath9k_hw_ar9287_set_board_values, .set_txpower = ath9k_hw_ar9287_set_txpower, - .get_spur_channel = ath9k_hw_ar9287_get_spur_channel + .get_spur_channel = ath9k_hw_ar9287_get_spur_channel, + .get_eepmisc = ath9k_hw_ar9287_get_eepmisc }; diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 39b1b27..087bdb7 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c @@ -1317,6 +1317,11 @@ static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz) return ah->eeprom.def.modalHeader[is2GHz].spurChans[i].spurChan; } +static u8 ath9k_hw_def_get_eepmisc(struct ath_hw *ah) +{ + return ah->eeprom.def.baseEepHeader.eepMisc; +} + const struct eeprom_ops eep_def_ops = { .check_eeprom = ath9k_hw_def_check_eeprom, .get_eeprom = ath9k_hw_def_get_eeprom, @@ -1327,5 +1332,6 @@ const struct eeprom_ops eep_def_ops = { .set_board_values = ath9k_hw_def_set_board_values, .set_addac = ath9k_hw_def_set_addac, .set_txpower = ath9k_hw_def_set_txpower, - .get_spur_channel = ath9k_hw_def_get_spur_channel + .get_spur_channel = ath9k_hw_def_get_spur_channel, + .get_eepmisc = ath9k_hw_def_get_eepmisc };